Fix Moody and Quark Drive (#284)

* Fix Quark Drive and Moody

* Telepathy still unimplemented

* more merge conflict stuff
This commit is contained in:
Tempoanon 2024-04-25 01:23:45 -04:00 committed by GitHub
parent ab8b9f0bfa
commit 230c2bf983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1795,7 +1795,7 @@ export class PostTerrainChangeAddBattlerTagAttr extends PostTerrainChangeAbAttr
} }
applyPostTerrainChange(pokemon: Pokemon, passive: boolean, terrain: TerrainType, args: any[]): boolean { applyPostTerrainChange(pokemon: Pokemon, passive: boolean, terrain: TerrainType, args: any[]): boolean {
if (!this.terrainTypes.find(t => terrain === terrain)) if (!this.terrainTypes.find(t => t === terrain))
return false; return false;
return pokemon.addTag(this.tagType, this.turnCount); return pokemon.addTag(this.tagType, this.turnCount);
@ -1829,6 +1829,23 @@ export class PostTurnResetStatusAbAttr extends PostTurnAbAttr {
} }
} }
export class MoodyAbAttr extends PostTurnAbAttr {
constructor() {
super(true);
}
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
// TODO: Edge case of not choosing to buff or debuff a stat that's already maxed
let selectableStats = [BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD];
let increaseStat = selectableStats[Utils.randInt(selectableStats.length)];
selectableStats = selectableStats.filter(s => s !== increaseStat);
let decreaseStat = selectableStats[Utils.randInt(selectableStats.length)];
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [increaseStat], 2));
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [decreaseStat], -1));
return true;
}
}
export class PostTurnStatChangeAbAttr extends PostTurnAbAttr { export class PostTurnStatChangeAbAttr extends PostTurnAbAttr {
private stats: BattleStat[]; private stats: BattleStat[];
private levels: integer; private levels: integer;
@ -2821,8 +2838,7 @@ export function initAbilities() {
.ignorable() .ignorable()
.unimplemented(), .unimplemented(),
new Ability(Abilities.MOODY, 5) new Ability(Abilities.MOODY, 5)
.attr(PostTurnStatChangeAbAttr, BattleStat.RAND, 2) .attr(MoodyAbAttr),
.attr(PostTurnStatChangeAbAttr, BattleStat.RAND, -1),
new Ability(Abilities.OVERCOAT, 5) new Ability(Abilities.OVERCOAT, 5)
.attr(BlockWeatherDamageAttr) .attr(BlockWeatherDamageAttr)
.attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().hasFlag(MoveFlags.POWDER_MOVE)) .attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().hasFlag(MoveFlags.POWDER_MOVE))