Add Move Effect Message to Power & Guard Split

This commit is contained in:
xsn34kzx 2024-08-21 00:48:56 -04:00
parent dc0f90d4d5
commit 272a3a31f2
2 changed files with 28 additions and 19 deletions

View File

@ -5912,38 +5912,47 @@ export class SwapStatAttr extends MoveEffectAttr {
/** /**
* Attribute used for status moves, namely Power Split and Guard Split, * Attribute used for status moves, namely Power Split and Guard Split,
* that take the average of a user's and target's corresponding * that take the average of a user's and target's corresponding
* stats and assign that average back to that stat. * stats and assign that average back to each corresponding stat.
* @extends MoveEffectAttr * @extends MoveEffectAttr
* @see {@linkcode apply} * @see {@linkcode apply}
*/ */
export class AverageStatAttr extends MoveEffectAttr { export class AverageStatsAttr extends MoveEffectAttr {
/** The stat to be averaged between the user and the target */ /** The stats to be averaged individually between the user and the target */
private stat: EffectiveStat; private stats: readonly EffectiveStat[];
private msgKey: string;
constructor(stat: EffectiveStat) { constructor(stats: readonly EffectiveStat[], msgKey: string) {
super(); super();
this.stat = stat; this.stats = stats;
this.msgKey = msgKey;
} }
/** /**
* Takes the average of the user's and target's corresponding current * Takes the average of the user's and target's corresponding {@linkcode stat}
* {@linkcode stat} values and sets that stat to the average for both * values and sets those stats to the corresponding average for both
* temporarily. * temporarily.
* @param user the {@linkcode Pokemon} that used the move * @param user the {@linkcode Pokemon} that used the move
* @param target the {@linkcode Pokemon} that the move was used on * @param target the {@linkcode Pokemon} that the move was used on
* @param _move N/A * @param move N/A
* @param _args N/A * @param args N/A
* @returns true if attribute application succeeds * @returns true if attribute application succeeds
*/ */
apply(user: Pokemon, target: Pokemon, _move: Move, _args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const avg = Math.floor((user.getStat(this.stat, false) + target.getStat(this.stat, false)) / 2); if (super.apply(user, target, move, args)) {
for (const s of this.stats) {
const avg = Math.floor((user.getStat(s, false) + target.getStat(s, false)) / 2);
user.setStat(this.stat, avg, false); user.setStat(s, avg, false);
target.setStat(this.stat, avg, false); target.setStat(s, avg, false);
}
user.scene.queueMessage(i18next.t(this.msgKey, { pokemonName: getPokemonNameWithAffix(user) }));
return true; return true;
} }
return false;
}
} }
export class DiscourageFrequentUseAttr extends MoveAttr { export class DiscourageFrequentUseAttr extends MoveAttr {
@ -7600,11 +7609,9 @@ export function initMoves() {
.target(MoveTarget.USER_SIDE) .target(MoveTarget.USER_SIDE)
.attr(AddArenaTagAttr, ArenaTagType.WIDE_GUARD, 1, true, true), .attr(AddArenaTagAttr, ArenaTagType.WIDE_GUARD, 1, true, true),
new StatusMove(Moves.GUARD_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5) new StatusMove(Moves.GUARD_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
.attr(AverageStatAttr, Stat.DEF) .attr(AverageStatsAttr, [ Stat.DEF, Stat.SPDEF ], "moveTriggers:guardSplit"),
.attr(AverageStatAttr, Stat.SPDEF),
new StatusMove(Moves.POWER_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5) new StatusMove(Moves.POWER_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
.attr(AverageStatAttr, Stat.ATK) .attr(AverageStatsAttr, [ Stat.ATK, Stat.SPATK ], "moveTriggers:powerSplit"),
.attr(AverageStatAttr, Stat.SPATK),
new StatusMove(Moves.WONDER_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5) new StatusMove(Moves.WONDER_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5)
.ignoresProtect() .ignoresProtect()
.target(MoveTarget.BOTH_SIDES) .target(MoveTarget.BOTH_SIDES)

View File

@ -7,6 +7,8 @@ export const moveTriggers: SimpleTranslationEntries = {
"switchedStatChanges": "{{pokemonName}} switched stat changes with the target!", "switchedStatChanges": "{{pokemonName}} switched stat changes with the target!",
"switchedTwoStatChanges": "{{pokemonName}} switched all changes to its {{firstStat}}\nand {{secondStat}} with its target!", "switchedTwoStatChanges": "{{pokemonName}} switched all changes to its {{firstStat}}\nand {{secondStat}} with its target!",
"swappedStat": "{{pokemonName}} switched {{stat}} with its target!", "swappedStat": "{{pokemonName}} switched {{stat}} with its target!",
"guardSplit": "{{pokemonName}} shared its guard with the target!",
"powerSplit": "{{pokemonName}} shared its power with the target!",
"goingAllOutForAttack": "{{pokemonName}} is going all out for this attack!", "goingAllOutForAttack": "{{pokemonName}} is going all out for this attack!",
"regainedHealth": "{{pokemonName}} regained\nhealth!", "regainedHealth": "{{pokemonName}} regained\nhealth!",
"keptGoingAndCrashed": "{{pokemonName}} kept going\nand crashed!", "keptGoingAndCrashed": "{{pokemonName}} kept going\nand crashed!",