Implemented Synchronoise's effect (#221)

* Implemented Synchronoise's effect

Tested with Soak, Forest's Curse, and a variety of attacker and defender types.

* Fixed Synchronoise double battle functionality

It now does zero damage only to targets who do not share any types with it, while correctly damaging any who do.  It also fails entirely if the user is UNKNOWN type.
This commit is contained in:
InfernoVulpix 2024-05-01 16:14:19 -04:00 committed by GitHub
parent e6c31966d7
commit 10169382d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -3706,6 +3706,19 @@ export class FirstMoveCondition extends MoveCondition {
}
}
export class hitsSameTypeAttr extends VariableMoveTypeMultiplierAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const multiplier = args[0] as Utils.NumberHolder;
if (!user.getTypes().some(type => target.getTypes().includes(type))){
multiplier.value = 0;
return true;
}
return false;
}
}
const unknownTypeCondition: MoveConditionFunc = (user, target, move) => !user.getTypes().includes(Type.UNKNOWN);
export type MoveTargetSet = {
targets: BattlerIndex[];
multiple: boolean;
@ -5087,7 +5100,8 @@ export function initMoves() {
.condition(failOnMaxCondition),
new AttackMove(Moves.SYNCHRONOISE, Type.PSYCHIC, MoveCategory.SPECIAL, 120, 100, 10, -1, 0, 5)
.target(MoveTarget.ALL_NEAR_OTHERS)
.partial(),
.condition(unknownTypeCondition)
.attr(hitsSameTypeAttr),
new AttackMove(Moves.ELECTRO_BALL, Type.ELECTRIC, MoveCategory.SPECIAL, -1, 100, 10, -1, 0, 5)
.attr(BattleStatRatioPowerAttr, Stat.SPD)
.ballBombMove(),