Skip to content

Commit

Permalink
Add ptoad
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisXV committed Feb 23, 2024
1 parent e03d5e4 commit 78dbbac
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 24 deletions.
12 changes: 12 additions & 0 deletions data/mods/gen9ssb/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,18 @@ export const Conditions: {[k: string]: ModdedConditionData & {innateName?: strin
this.add(`c:|${getName('phoopes')}|Jynx! Knock on wood`);
},
},
ptoad: {
noCopy: true,
onStart() {
this.add(`c:|${getName('ptoad')}|/me enters the stage`);
},
onSwitchOut() {
this.add(`c:|${getName('ptoad')}|Taking 5!`);
},
onFaint() {
this.add(`c:|${getName('ptoad')}|Who told you you're allowed to rain on my parade?`);
},
},
pyro: {
noCopy: true,
onStart() {
Expand Down
68 changes: 48 additions & 20 deletions data/mods/gen9ssb/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
onPrepareHit(target, source) {
this.attrLastMove('[anim] Doom Desire');
},
onHit(target) {
onHit(target, source) {
const formats = ['gen9randombattle', 'gen9hackmonscup', 'gen9challengecup', 'gen9computergeneratedteams'];
const randFormat = this.sample(formats);
let msg;
Expand All @@ -1153,7 +1153,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
this.addMove('-anim', target, 'Wish', target);
// @ts-ignore set wants a sig but randbats sets don't have one
changeSet(this, target, team[0], true);
this.add(`c:|${getName('Irpachuza!')}|${msg}`);
this.add(`c:|${getName((source.illusion || source).name)}|${msg}`);
},
isZ: "irpatuziniumz",
secondary: null,
Expand Down Expand Up @@ -1705,7 +1705,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
}
if (!Object.values(pokemon.boosts).some(x => x >= 6)) {
this.boost({atk: 1, def: 1, spa: 1, spd: 1, spe: 1, accuracy: 1, evasion: 1}, pokemon);
this.add(`c:|${getName('Mad Monty')}|Ope! Wrong button, sorry.`);
this.add(`c:|${getName((pokemon.illusion || pokemon).name)}|Ope! Wrong button, sorry.`);
this.boost({atk: -1, def: -1, spa: -1, spd: -1, spe: -1, accuracy: -1, evasion: -1}, pokemon);
}
},
Expand All @@ -1728,10 +1728,10 @@ export const Moves: {[k: string]: ModdedMoveData} = {
onPrepareHit() {
this.attrLastMove('[anim] Salt Cure');
},
onHit(target) {
onHit(target, source) {
if (target.getAbility().flags['cantsuppress']) return;
if (!target.addVolatile('gastroacid')) return;
this.add(`c:|${getName('Mathy')}|Sorry i tried to fix smth but accidentally broke your ability :( will fix it next week`);
this.add(`c:|${getName((source.illusion || source).name)}|Sorry i tried to fix smth but accidentally broke your ability :( will fix it next week`);
},
ignoreAbility: true,
secondary: null,
Expand Down Expand Up @@ -1762,7 +1762,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
}
const plagiarismIndex = source.moves.indexOf('plagiarism');
if (plagiarismIndex < 0) return false;
this.add(`c:|${getName('Meteordash')}|yoink`);
this.add(`c:|${getName((source.illusion || source).name)}|yoink`);
const plagiarisedMove = {
move: move.name,
id: move.id,
Expand Down Expand Up @@ -1831,7 +1831,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
this.attrLastMove('[anim] Curse');
},
onHit(pokemon) {
this.add(`c:|${getName('Mia')}|Please don't break...`);
this.add(`c:|${getName((pokemon.illusion || pokemon).name)}|Please don't break...`);
let stats: BoostID[] = [];
const boost: SparseBoostsTable = {};
let statPlus: BoostID;
Expand All @@ -1856,7 +1856,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
if (randomStat) {
if (boost[randomStat]) {
boost[randomStat] = 0;
this.add(`c:|${getName('Mia')}|Well. Guess that broke. Time to roll back.`);
this.add(`c:|${getName((pokemon.illusion || pokemon).name)}|Well. Guess that broke. Time to roll back.`);
return;
} else {
boost[randomStat] = -2;
Expand All @@ -1867,7 +1867,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
},
onAfterMove(pokemon) {
if (this.randomChance(1, 10)) {
this.add(`c:|${getName('Mia')}|Ouch! That crash is really getting on my nerves...`);
this.add(`c:|${getName((pokemon.illusion || pokemon).name)}|Ouch! That crash is really getting on my nerves...`);
this.damage(pokemon.baseMaxhp / 10);
if (pokemon.hp <= 0) return;
}
Expand All @@ -1885,10 +1885,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
statusText = 'poisoned';
}

this.add(
`c:|${getName('Mia')}|` +
`Darn. A bug ${statusText} me. Guess I should have tested this first.`
);
this.add(`c:|${getName((pokemon.illusion || pokemon).name)}|Darn. A bug ${statusText} me. Guess I should have tested this first.`);
pokemon.setStatus(status);
}
},
Expand Down Expand Up @@ -2007,7 +2004,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
condition: {
onSwap(target, source) {
if (!target.fainted) {
this.add(`c:|${getName('Notater517')}|~nyaa ${target.name}`);
this.add(`c:|${getName((source.illusion || source).name)}|~nyaa ${target.name}`);
this.add(`c:|${getName('Jeopard-E')}|**It is now ${target.name}'s turn to ask a question.**`);
target.side.removeSlotCondition(target, 'nyaa');
}
Expand Down Expand Up @@ -2036,7 +2033,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
onPrepareHit(target, source) {
this.add('-anim', source, 'Memento', target);

this.add(`l|${getName('PartMan').split('|')[1]}`);
this.add(`l|${getName((source.illusion || source).name).split('|')[1]}`);
this.add(`j|FakePart`);
},
onModifyMove(move, source, target) {
Expand Down Expand Up @@ -2142,6 +2139,37 @@ export const Moves: {[k: string]: ModdedMoveData} = {
type: "Ice",
},

// ptoad
pleek: {
accuracy: true,
basePower: 0,
category: "Status",
name: "Pleek...",
shortDesc: "+4 Attack + inflict Perish Song on self.",
pp: 10,
priority: 0,
flags: {sound: 1, bypasssub: 1},
onTry(source) {
if (source.m.usedPleek) {
this.hint("Pleek... only works once per switch-in.");
return false;
}
},
onPrepareHit() {
this.attrLastMove('[anim] Hyper Voice');
this.attrLastMove('[anim] Splash');
},
onHit(target, source, move) {
this.add(`c:|${getName((source.illusion || source).name)}|Pleek...`);
this.boost({atk: 4}, source, source, move);
source.addVolatile('perishsong');
this.add('-start', source, 'perish3', '[silent]');
source.m.usedPleek = true;
},
target: "self",
type: "Fairy",
},

// PYRO
meatgrinder: {
accuracy: 100,
Expand All @@ -2161,10 +2189,10 @@ export const Moves: {[k: string]: ModdedMoveData} = {
this.add('-start', pokemon, 'Meat Grinder');
},
onResidualOrder: 13,
onResidual(pokemon) {
onResidual(pokemon, source) {
this.damage(pokemon.baseMaxhp / (pokemon.hasType(['Normal', 'Fairy']) ? 4 : 8));
if (!pokemon || pokemon.fainted || pokemon.hp <= 0) {
this.add(`c:|${getName('PYRO')}|Tripping off the beat kinda, dripping off the meat grinder`);
this.add(`c:|${getName((source.illusion || source).name)}|Tripping off the beat kinda, dripping off the meat grinder`);
}
const target = this.getAtSlot(pokemon.volatiles['meatgrinder'].sourceSlot);
if (!target || target.fainted || target.hp <= 0) {
Expand Down Expand Up @@ -2814,7 +2842,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
onHit(pokemon, source) {
// TODO: Client support for removing tera without fainting
if (pokemon?.terastallized) {
this.add(`c:|${getName('Vio͜͡let')}|lol never do that ever again thanks`);
this.add(`c:|${getName((source.illusion || source).name)}|lol never do that ever again thanks`);
delete pokemon.terastallized;
const details = pokemon.species.name + (pokemon.level === 100 ? '' : ', L' + pokemon.level) +
(pokemon.gender === '' ? '' : ', ' + pokemon.gender) + (pokemon.set.shiny ? ', shiny' : '');
Expand Down Expand Up @@ -2998,12 +3026,12 @@ export const Moves: {[k: string]: ModdedMoveData} = {
this.add('-anim', source, "Weather Ball", target);
this.add('-anim', source, "Snowscape", source);
},
onHit(target) {
onHit(target, source) {
this.field.setWeather('snow');
if (target.setAbility('normalize')) {
this.add('-ability', target, 'Normalize', '[from] move: Whiteout');
}
this.add(`c:|${getName('Yellow Paint')}|A blank canvas.`);
this.add(`c:|${getName((source.illusion || source).name)}|A blank canvas.`);
},
secondary: null,
target: "normal",
Expand Down
6 changes: 6 additions & 0 deletions data/mods/gen9ssb/random-teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ export const ssbSets: SSBSets = {
signatureMove: 'Gen 1 Blizzard',
evs: {hp: 4, spa: 252, spe: 252}, nature: 'Timid', teraType: 'Ice',
},
ptoad: {
species: 'Politoed', ability: 'Drizzle', item: 'Leftovers', gender: 'M',
moves: ['Jet Punch', 'Ice Punch', 'Earthquake'],
signatureMove: 'Pleek...',
evs: {hp: 252, atk: 252, spd: 4}, nature: 'Adamant', teraType: 'Water',
},
PYRO: {
species: 'Kingambit', ability: 'Hardcore Hustle', item: 'Leftovers', gender: 'M',
moves: ['Kowtow Cleave', 'Sucker Punch', 'Swords Dance'],
Expand Down
101 changes: 97 additions & 4 deletions data/mods/gen9ssb/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,103 @@ export const Scripts: ModdedBattleScriptsData = {
return false;
},
actions: {
switchIn(pokemon, pos, sourceEffect, isDrag) {
if (!pokemon || pokemon.isActive) {
this.battle.hint("A switch failed because the Pokémon trying to switch in is already in.");
return false;
}

const side = pokemon.side;
if (pos >= side.active.length) {
throw new Error(`Invalid switch position ${pos} / ${side.active.length}`);
}
const oldActive = side.active[pos];
const unfaintedActive = oldActive?.hp ? oldActive : null;
if (unfaintedActive) {
oldActive.beingCalledBack = true;
let switchCopyFlag: 'copyvolatile' | 'shedtail' | boolean = false;
if (sourceEffect && typeof (sourceEffect as Move).selfSwitch === 'string') {
switchCopyFlag = (sourceEffect as Move).selfSwitch!;
}
if (!oldActive.skipBeforeSwitchOutEventFlag && !isDrag) {
this.battle.runEvent('BeforeSwitchOut', oldActive);
if (this.battle.gen >= 5) {
this.battle.eachEvent('Update');
}
}
oldActive.skipBeforeSwitchOutEventFlag = false;
if (!this.battle.runEvent('SwitchOut', oldActive)) {
// Warning: DO NOT interrupt a switch-out if you just want to trap a pokemon.
// To trap a pokemon and prevent it from switching out, (e.g. Mean Look, Magnet Pull)
// use the 'trapped' flag instead.

// Note: Nothing in the real games can interrupt a switch-out (except Pursuit KOing,
// which is handled elsewhere); this is just for custom formats.
return false;
}
if (!oldActive.hp) {
// a pokemon fainted from Pursuit before it could switch
return 'pursuitfaint';
}

// will definitely switch out at this point

oldActive.illusion = null;
this.battle.singleEvent('End', oldActive.getAbility(), oldActive.abilityState, oldActive);

// if a pokemon is forced out by Whirlwind/etc or Eject Button/Pack, it can't use its chosen move
this.battle.queue.cancelAction(oldActive);

let newMove = null;
if (this.battle.gen === 4 && sourceEffect) {
newMove = oldActive.lastMove;
}
if (switchCopyFlag) {
pokemon.copyVolatileFrom(oldActive, switchCopyFlag);
}
if (newMove) pokemon.lastMove = newMove;
oldActive.clearVolatile();
}
if (oldActive) {
oldActive.isActive = false;
oldActive.isStarted = false;
oldActive.usedItemThisTurn = false;
oldActive.statsRaisedThisTurn = false;
oldActive.statsLoweredThisTurn = false;
delete oldActive.m.usedPleek;
oldActive.position = pokemon.position;
pokemon.position = pos;
side.pokemon[pokemon.position] = pokemon;
side.pokemon[oldActive.position] = oldActive;
}
pokemon.isActive = true;
side.active[pos] = pokemon;
pokemon.activeTurns = 0;
pokemon.activeMoveActions = 0;
for (const moveSlot of pokemon.moveSlots) {
moveSlot.used = false;
}
this.battle.runEvent('BeforeSwitchIn', pokemon);
if (sourceEffect) {
this.battle.add(isDrag ? 'drag' : 'switch', pokemon, pokemon.getDetails, '[from] ' + sourceEffect);
} else {
this.battle.add(isDrag ? 'drag' : 'switch', pokemon, pokemon.getDetails);
}
pokemon.abilityOrder = this.battle.abilityOrder++;
if (isDrag && this.battle.gen === 2) pokemon.draggedIn = this.battle.turn;
pokemon.previouslySwitchedIn++;

if (isDrag && this.battle.gen >= 5) {
// runSwitch happens immediately so that Mold Breaker can make hazards bypass Clear Body and Levitate
this.battle.singleEvent('PreStart', pokemon.getAbility(), pokemon.abilityState, pokemon);
this.runSwitch(pokemon);
} else {
this.battle.queue.insertChoice({choice: 'runUnnerve', pokemon});
this.battle.queue.insertChoice({choice: 'runSwitch', pokemon});
}

return true;
},
canTerastallize(pokemon) {
if (
pokemon.terastallized || pokemon.species.isMega || pokemon.species.isPrimal || pokemon.species.forme === "Ultra" ||
Expand Down Expand Up @@ -728,11 +825,7 @@ export const Scripts: ModdedBattleScriptsData = {
/* if (pokemon.moveThisTurn) {
// THIS IS PURELY A SANITY CHECK
// DO NOT TAKE ADVANTAGE OF THIS TO PREVENT A POKEMON FROM MOVING;
<<<<<<< HEAD
// USE this.battle.queue.cancelMove INSTEAD
=======
// USE this.queue.cancelMove INSTEAD
>>>>>>> 9d30a32cd (Add Irpachuza (#14))
this.battle.debug('' + pokemon.id + ' INCONSISTENT STATE, ALREADY MOVED: ' + pokemon.moveThisTurn);
this.battle.clearActiveMove(true);
return;
Expand Down
3 changes: 3 additions & 0 deletions sim/global-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ interface ModdedBattleActions {
this: BattleActions, targets: SpreadMoveTargets, pokemon: Pokemon, move: ActiveMove,
moveData?: ActiveMove, isSecondary?: boolean, isSelf?: boolean
) => [SpreadMoveDamage, SpreadMoveTargets];
switchIn?: (
this: BattleActions, pokemon: Pokemon, pos: number, sourceEffect: Effect | null, isDrag?: boolean
) => boolean | "pursuitfaint";
targetTypeChoices?: (this: BattleActions, targetType: string) => boolean;
terastallize?: (this: BattleActions, pokemon: Pokemon) => void;
tryMoveHit?: (
Expand Down

0 comments on commit 78dbbac

Please sign in to comment.