Adding New Moves - koreanpanda345/Pokemon-Showdown-Server-Guide GitHub Wiki

To add a new move, we need to edit the moves.ts file in the client/data folder. The structure looks something like this

name_lower_case: {
    num: Number, // Move id.
    accuracy: Boolean || Number, // The accuracy of the move. If the move has no accuracy check, then it put true.
    basePower: Number, // The Move's Base Power. If the move doesn't have any base power, then set it to 0.
    category: String, // The Move's Category. Its either Physical, Special, or Status.
    desc?: String, // The Description of the Move.
    shortDesc?: String, // The Short Description of the Move.
    name: String, // The name of the move.
    pp: Number, // The amount of Power Points(PP) the move has.
    priority: Number, // The move's Priority. If it doesn't have any change in the standard priority bracket, then set it to 0.
    flags: {}, // The move's Flags. This is what the move is classified. example if the move can be protected against, then you put in protect: 1. The reason you put 1 is to activate that flag. If it can't be blocked by protect, then you don't put anything. This is by default 0, which means it doesn't have that flag.
    drain?: Number[], // If the move drains hp. If so, then the value is a Number array, with a size of 2. this is like a fraction, the first number is the numerator, and the last number is the dominator. example: [1, 2] = 1/2.
    effect?: {}, // The Move's Effects.
    secondary: {} || null, // The Move's secondary affects. If the move doesn't have any secondary affects, then set it to null. if there is, then this is an object. Refer to the other moves, that have secondary affects, for those structures.
    target: String, // The Move's Target type. This is like if the move hits 1 target, multiple targets, or self. Set this to normal if it hits 1 target, like most moves.
    type: String, // The Move's Type.
    contestType?: String // The Mov'es Contest Type.
}

an example of this would be Peek-a-Boo. the signature move of Ghosunny.

peekaboo: {
    num: -1
	name: "Peek-a-Boo",
    shortDesc: "If the target is asleep, This move will decrease all of the target’s stats by 1 stage. This will wake up the target. Fails if the target is not asleep.",

	desc: "When the target is sleeping, the user manifests itself into the target’s dream, and terrorizes the target inside their mind. Causing the target to wake up feeling weak.",
    effect: { // This is an optional property. But this is used when your move has effects. effect and secondary are not the same thing in this context.
    	onHit(target, source, move) { // onHit() is called on when the target is hit by the source. in this context, when the user hits the Target.
            if(target.status !== 'slp') return; // Checks if the target's status is asleep. if not, then return. which in this context means the move will fail.
            target.cureStatus(); // This will cure the status of the target. in this context it removes the asleep status.
            this.boost({atk: -1, def: -1, spa: -1, spd: -1, spe: -1}, target, source, move); // this.boost will lower the target's status 1 stage.
        },
    },
	category: 'Status', // This is a Status move.
	target: 'normal',
    pp: 30,
    priority: 0,
    accuracy: true,// This move doesn't have an accuracy check, thats why it is set to true.
    basePower: 0, // since it is a status move, it doesn't have a base power.
    flags: {status: 1}, // This is only has the status flag, because we are assuming the target is asleep, if they are not asleep then this move fails, if they are asleep, then they can't do anything to us.
    type: "Ghost",
    contestType: "Cool",
}