[P2] Fix damage achievements not awarding (#4613)

This commit is contained in:
MokaStitcher 2024-10-08 17:08:25 +02:00 committed by GitHub
parent 9bb6398385
commit 6e10f6600f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -2758,7 +2758,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (damage > 0) { if (damage > 0) {
if (source.isPlayer()) { if (source.isPlayer()) {
this.scene.validateAchvs(DamageAchv, damage); this.scene.validateAchvs(DamageAchv, new Utils.NumberHolder(damage));
if (damage > this.scene.gameData.gameStats.highestDamage) { if (damage > this.scene.gameData.gameStats.highestDamage) {
this.scene.gameData.gameStats.highestDamage = damage; this.scene.gameData.gameStats.highestDamage = damage;
} }

View File

@ -28,7 +28,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
this.scene.gameData.gameStats.highestLevel = this.level; this.scene.gameData.gameStats.highestLevel = this.level;
} }
this.scene.validateAchvs(LevelAchv, new Utils.IntegerHolder(this.level)); this.scene.validateAchvs(LevelAchv, new Utils.NumberHolder(this.level));
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
const prevStats = pokemon.stats.slice(0); const prevStats = pokemon.stats.slice(0);

View File

@ -109,7 +109,7 @@ export class DamageAchv extends Achv {
damageAmount: integer; damageAmount: integer;
constructor(localizationKey: string, name: string, damageAmount: integer, iconImage: string, score: integer) { constructor(localizationKey: string, name: string, damageAmount: integer, iconImage: string, score: integer) {
super(localizationKey, name, "", iconImage, score, (_scene: BattleScene, args: any[]) => (args[0] as Utils.NumberHolder).value >= this.damageAmount); super(localizationKey, name, "", iconImage, score, (_scene: BattleScene, args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.damageAmount);
this.damageAmount = damageAmount; this.damageAmount = damageAmount;
} }
} }
@ -118,7 +118,7 @@ export class HealAchv extends Achv {
healAmount: integer; healAmount: integer;
constructor(localizationKey: string, name: string, healAmount: integer, iconImage: string, score: integer) { constructor(localizationKey: string, name: string, healAmount: integer, iconImage: string, score: integer) {
super(localizationKey, name, "", iconImage, score, (_scene: BattleScene, args: any[]) => (args[0] as Utils.NumberHolder).value >= this.healAmount); super(localizationKey, name, "", iconImage, score, (_scene: BattleScene, args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.healAmount);
this.healAmount = healAmount; this.healAmount = healAmount;
} }
} }
@ -127,7 +127,7 @@ export class LevelAchv extends Achv {
level: integer; level: integer;
constructor(localizationKey: string, name: string, level: integer, iconImage: string, score: integer) { constructor(localizationKey: string, name: string, level: integer, iconImage: string, score: integer) {
super(localizationKey, name, "", iconImage, score, (scene: BattleScene, args: any[]) => (args[0] as Utils.IntegerHolder).value >= this.level); super(localizationKey, name, "", iconImage, score, (scene: BattleScene, args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.level);
this.level = level; this.level = level;
} }
} }