Skip to content

Commit

Permalink
Stats boosts are now tracked using a battler tag instead of turn data
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottSimmonds committed Jun 11, 2024
1 parent 29d4e58 commit d68a7fd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/data/battler-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
return new DestinyBondTag(sourceMove, sourceId);
case BattlerTagType.ICE_FACE:
return new IceFaceTag(sourceMove);
case BattlerTagType.STATS_BOOSTED:
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
case BattlerTagType.NONE:
default:
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
Expand Down
3 changes: 2 additions & 1 deletion src/data/enums/battler-tag-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ export enum BattlerTagType {
MAGNET_RISEN = "MAGNET_RISEN",
MINIMIZED = "MINIMIZED",
DESTINY_BOND = "DESTINY_BOND",
ICE_FACE = "ICE_FACE"
ICE_FACE = "ICE_FACE",
STATS_BOOSTED = "STATS_BOOSTED"
}
10 changes: 2 additions & 8 deletions src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5252,10 +5252,7 @@ export class AddBattlerTagIfBoostedAttr extends AddBattlerTagAttr {
* @returns true
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (
target.turnData.statsBoosted ||
(user.scene.currentBattle.turn === 1 && target.battleData.statsBoostedFirstTurn)
) {
if (user.getTag(BattlerTagType.STATS_BOOSTED)) {
super.apply(user, target, move, args);
}
return true;
Expand Down Expand Up @@ -5283,10 +5280,7 @@ export class StatusIfBoostedAttr extends MoveEffectAttr {
* @returns true
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (
target.turnData.statsBoosted ||
(user.scene.currentBattle.turn === 1 && target.battleData.statsBoostedFirstTurn)
) {
if (target.getTag(BattlerTagType.STATS_BOOSTED)) {
target.trySetStatus(this.effect, true, user);
}
return true;
Expand Down
2 changes: 0 additions & 2 deletions src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3811,7 +3811,6 @@ export class PokemonBattleData {
public endured: boolean = false;
public berriesEaten: BerryType[] = [];
public abilitiesApplied: Abilities[] = [];
public statsBoostedFirstTurn: boolean = false;
}

export class PokemonBattleSummonData {
Expand All @@ -3822,7 +3821,6 @@ export class PokemonBattleSummonData {
export class PokemonTurnData {
public flinched: boolean = false;
public acted: boolean = false;
public statsBoosted: boolean = false;
public hitCount: integer;
public hitsLeft: integer;
public damageDealt: integer = 0;
Expand Down
7 changes: 1 addition & 6 deletions src/phases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3198,12 +3198,7 @@ export class StatChangePhase extends PokemonPhase {

for (const stat of filteredStats) {
if (levels.value > 0 && pokemon.summonData.battleStats[stat] + levels.value <= 6) {
if (pokemon.turnData) {
pokemon.turnData.statsBoosted = true;
}
if (pokemon.scene.currentBattle.turn === 1) {
pokemon.battleData.statsBoostedFirstTurn = true;
}
pokemon.addTag(BattlerTagType.STATS_BOOSTED, 1);
}

pokemon.summonData.battleStats[stat] = Math.max(Math.min(pokemon.summonData.battleStats[stat] + levels.value, 6), -6);
Expand Down

0 comments on commit d68a7fd

Please sign in to comment.