Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: innerthunder <[email protected]>
  • Loading branch information
DayKev and innerthunder authored Nov 29, 2024
1 parent 266f9e9 commit c20aa9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param ignoreFaintPhase boolean to ignore adding a FaintPhase, passsed to damage()
* @returns integer of damage done
*/
damageAndUpdate(damage: number, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon, move?: Move): number {
damageAndUpdate(damage: number, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon): number {
const damagePhase = new DamageAnimPhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
this.scene.unshiftPhase(damagePhase);
damage = this.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
Expand All @@ -3006,8 +3006,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* Run PostDamageAbAttr from any source of damage that is not from a multi-hit
* Multi-hits are handled in move-effect-phase.ts for PostDamageAbAttr
*/
const multiHitModifier = source?.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
if (!multiHitModifier && !source?.hasAbilityWithAttr(AddSecondStrikeAbAttr) && !move?.hasAttr(MultiHitAttr)) {
if (source.turnData.hitCount <= 1) {

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

src/test/abilities/wind_power.test.ts > Abilities - Wind Power > does not interact with Sandstorm

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

src/test/moves/baton_pass.test.ts > Moves - Baton Pass > doesn't allow binding effects from the user to persist

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ FireSpinTag.lapse src/data/battler-tags.ts:1221:17 ❯ src/field/pokemon.ts:3119:123 ❯ EnemyPokemon.lapseTags src/field/pokemon.ts:3119:10 ❯ handlePokemon src/phases/turn-end-phase.ts:26:15 ❯ src/phases/field-phase.ts:9:30 ❯ TurnEndPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ TurnEndPhase.start src/phases/turn-end-phase.ts:50:10

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

src/test/moves/tidy_up.test.ts > Moves - Tidy Up > substitutes are cleared

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/abilities/gorilla_tactics.test.ts > Abilities - Gorilla Tactics > should struggle if the only usable move is disabled

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ RecoilAttr.apply src/data/move.ts:1540:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/crafty_shield.test.ts > Moves - Crafty Shield > should protect the user and allies from moves that ignore other protection

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ CurseAttr.apply src/data/move.ts:5402:12 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:442:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/disable.test.ts > Moves - Disable > causes STRUGGLE if all usable moves are disabled

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ RecoilAttr.apply src/data/move.ts:1540:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/disable.test.ts > Moves - Disable > cannot disable STRUGGLE

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ RecoilAttr.apply src/data/move.ts:1540:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/dive.test.ts > Moves - Dive > should trigger on-contact post-defend ability effects

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ PostDefendContactDamageAbAttr.applyPostDefend src/data/ability.ts:967:16 ❯ src/data/ability.ts:5165:92 ❯ applyAbAttrsInternal src/data/ability.ts:4883:20 ❯ Module.applyPostDefendAbAttrs src/data/ability.ts:5165:10 ❯ src/phases/move-effect-phase.ts:479:7 ❯ Module.executeIf src/utils.ts:252:22 ❯ MoveEffectPhase.applyOnGetHitAbEffects src/phases/move-effect-phase.ts:478:12 ❯ src/phases/move-effect-phase.ts:509:14

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/dragon_tail.test.ts > Moves - Dragon Tail > should cause opponent to flee, display ability, and not crash

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ PostDefendContactDamageAbAttr.applyPostDefend src/data/ability.ts:967:16 ❯ src/data/ability.ts:5165:92 ❯ applyAbAttrsInternal src/data/ability.ts:4883:20 ❯ Module.applyPostDefendAbAttrs src/data/ability.ts:5165:10 ❯ src/phases/move-effect-phase.ts:479:7 ❯ Module.executeIf src/utils.ts:252:22 ❯ MoveEffectPhase.applyOnGetHitAbEffects src/phases/move-effect-phase.ts:478:12 ❯ src/phases/move-effect-phase.ts:509:14

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/dragon_tail.test.ts > Moves - Dragon Tail > should proceed without crashing in a double battle

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ PostDefendContactDamageAbAttr.applyPostDefend src/data/ability.ts:967:16 ❯ src/data/ability.ts:5165:92 ❯ applyAbAttrsInternal src/data/ability.ts:4883:20 ❯ Module.applyPostDefendAbAttrs src/data/ability.ts:5165:10 ❯ src/phases/move-effect-phase.ts:479:7 ❯ Module.executeIf src/utils.ts:252:22 ❯ MoveEffectPhase.applyOnGetHitAbEffects src/phases/move-effect-phase.ts:478:12 ❯ src/phases/move-effect-phase.ts:509:14

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/dragon_tail.test.ts > Moves - Dragon Tail > should redirect targets upon opponent flee

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ PostDefendContactDamageAbAttr.applyPostDefend src/data/ability.ts:967:16 ❯ src/data/ability.ts:5165:92 ❯ applyAbAttrsInternal src/data/ability.ts:4883:20 ❯ Module.applyPostDefendAbAttrs src/data/ability.ts:5165:10 ❯ src/phases/move-effect-phase.ts:479:7 ❯ Module.executeIf src/utils.ts:252:22 ❯ MoveEffectPhase.applyOnGetHitAbEffects src/phases/move-effect-phase.ts:478:12 ❯ src/phases/move-effect-phase.ts:509:14

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/grudge.test.ts > Moves - Grudge > should not reduce the opponent's PP if the user dies to weather/indirect damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

src/test/moves/shed_tail.test.ts > Moves - Shed Tail > transfers a Substitute doll to the switched in Pokemon

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/abilities/wind_rider.test.ts > Abilities - Wind Rider > does not interact with Sandstorm

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/arena/weather_sandstorm.test.ts > Weather - Sandstorm > inflicts damage equal to 1/16 of Pokemon's max HP at turn end

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/arena/weather_sandstorm.test.ts > Weather - Sandstorm > does not inflict damage to a Pokemon that is underwater (Dive) or underground (Dig)

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/fake_out.test.ts > Moves - Fake Out > can be used at the start of every wave even if the pokemon wasn't recalled

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/fake_out.test.ts:55:11

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > shouldn't stop damage from HP-drain attacks, just HP restoration

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/heal_block.test.ts:46:12

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > shouldn't stop Liquid Ooze from dealing damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ PokemonHealPhase.end src/phases/pokemon-heal-phase.ts:68:17 ❯ PokemonHealPhase.start src/phases/pokemon-heal-phase.ts:41:12 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ DamageAnimPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27 ❯ DamageAnimPhase.Phase.end src/test/utils/phaseInterceptor.ts:437:52 ❯ DamageAnimPhase.end src/phases/damage-anim-phase.ts:81:13 ❯ src/phases/damage-anim-phase.ts:68:60

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > should stop delayed heals, such as from Wish

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/heal_block.test.ts:77:12

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > should prevent Grassy Terrain from restoring HP

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/heal_block.test.ts:98:12

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > should prevent healing from heal-over-time moves

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/heal_block.test.ts:111:12

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

src/test/moves/heal_block.test.ts > Moves - Heal Block > should prevent abilities from restoring HP

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/heal_block.test.ts:129:12

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

src/test/abilities/screen_cleaner.test.ts > Abilities - Screen Cleaner > removes Aurora Veil

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

src/test/battle/damage_calculation.test.ts > Battle Mechanics - Damage Calculation > Charizard with odd HP survives Stealth Rock damage twice

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ StealthRockTag.activateTrap src/data/arena-tag.ts:868:15 ❯ StealthRockTag.apply src/data/arena-tag.ts:651:17 ❯ src/field/arena.ts:541:25 ❯ Arena.applyTagsForSide src/field/arena.ts:541:10 ❯ Arena.applyTags src/field/arena.ts:552:10 ❯ PostSummonPhase.start src/phases/post-summon-phase.ts:23:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

src/test/battle/inverse_battle.test.ts > Inverse Battle > Stealth Rock follows the inverse matchups - Stealth Rock against Charizard deals 1/32 of max HP

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ StealthRockTag.activateTrap src/data/arena-tag.ts:868:15 ❯ StealthRockTag.apply src/data/arena-tag.ts:651:17 ❯ src/field/arena.ts:541:25 ❯ Arena.applyTagsForSide src/field/arena.ts:541:10 ❯ Arena.applyTags src/field/arena.ts:552:10 ❯ PostSummonPhase.start src/phases/post-summon-phase.ts:23:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

src/test/moves/pledge_moves.test.ts > Moves - Pledge Moves > Grass Pledge - should combine with Fire Pledge to form a 150-power Fire-type attack that creates a 'sea of fire'

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/data/arena-tag.ts:1152:15 ❯ FireGrassPledgeTag.lapse src/data/arena-tag.ts:1147:59 ❯ src/field/arena.ts:640:31 ❯ Arena.lapseTags src/field/arena.ts:640:15 ❯ TurnEndPhase.start src/phases/turn-end-phase.ts:52:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/boss-pokemon.test.ts > Boss Pokemon / Shields > breaking multiple shields at once requires extra damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/boss-pokemon.test.ts:128:11

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/boss-pokemon.test.ts > Boss Pokemon / Shields > the number of stat stage boosts is consistent when several shields are broken at once

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/boss-pokemon.test.ts:168:13

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/abilities/forecast.test.ts > Abilities - Forecast > changes form based on weather

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/abilities/forecast.test.ts > Abilities - Forecast > does not change Castform's form until after Stealth Rock deals damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ StealthRockTag.activateTrap src/data/arena-tag.ts:868:15 ❯ StealthRockTag.apply src/data/arena-tag.ts:651:17 ❯ src/field/arena.ts:541:25 ❯ Arena.applyTagsForSide src/field/arena.ts:541:10 ❯ Arena.applyTags src/field/arena.ts:552:10 ❯ PostSummonPhase.start src/phases/post-summon-phase.ts:23:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should KO the opponent on the same turn

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ DestinyBondTag.lapse src/data/battler-tags.ts:723:13 ❯ FaintPhase.start src/phases/faint-phase.ts:61:23 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should KO the opponent on the next turn

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ DestinyBondTag.lapse src/data/battler-tags.ts:723:13 ❯ FaintPhase.start src/phases/faint-phase.ts:61:23 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should not KO the opponent if the user dies to weather

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should not cause a crash if the user is KO'd by Ceaseless Edge

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ DestinyBondTag.lapse src/data/battler-tags.ts:723:13 ❯ FaintPhase.start src/phases/faint-phase.ts:61:23 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should not cause a crash if the user is KO'd by Pledge moves

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ DestinyBondTag.lapse src/data/battler-tags.ts:723:13 ❯ FaintPhase.start src/phases/faint-phase.ts:61:23 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

src/test/moves/destiny_bond.test.ts > Moves - Destiny Bond > should not allow the opponent to revive via Reviver Seed

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ DestinyBondTag.lapse src/data/battler-tags.ts:723:13 ❯ FaintPhase.start src/phases/faint-phase.ts:61:23 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/gulp_missile.test.ts > Abilities - Gulp Missile > deals 1/4 of the attacker's maximum HP when hit by a damaging attack

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ GulpMissileTag.lapse src/data/battler-tags.ts:2290:18 ❯ src/field/pokemon.ts:3119:123 ❯ PlayerPokemon.lapseTags src/field/pokemon.ts:3119:10 ❯ PlayerPokemon.apply src/field/pokemon.ts:2870:14 ❯ src/phases/move-effect-phase.ts:271:51 ❯ cleanUpAndComplete src/data/battle-anims.ts:905:11

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/gulp_missile.test.ts > Abilities - Gulp Missile > lowers attacker's DEF stat stage by 1 when hit in Gulping form

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ GulpMissileTag.lapse src/data/battler-tags.ts:2290:18 ❯ src/field/pokemon.ts:3119:123 ❯ PlayerPokemon.lapseTags src/field/pokemon.ts:3119:10 ❯ PlayerPokemon.apply src/field/pokemon.ts:2870:14 ❯ src/phases/move-effect-phase.ts:271:51 ❯ cleanUpAndComplete src/data/battle-anims.ts:905:11

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/gulp_missile.test.ts > Abilities - Gulp Missile > paralyzes the enemy when hit in Gorging form

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ GulpMissileTag.lapse src/data/battler-tags.ts:2290:18 ❯ src/field/pokemon.ts:3119:123 ❯ PlayerPokemon.lapseTags src/field/pokemon.ts:3119:10 ❯ PlayerPokemon.apply src/field/pokemon.ts:2870:14 ❯ src/phases/move-effect-phase.ts:271:51 ❯ cleanUpAndComplete src/data/battle-anims.ts:905:11

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/gulp_missile.test.ts > Abilities - Gulp Missile > activates on faint

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ GulpMissileTag.lapse src/data/battler-tags.ts:2290:18 ❯ src/field/pokemon.ts:3119:123 ❯ PlayerPokemon.lapseTags src/field/pokemon.ts:3119:10 ❯ PlayerPokemon.apply src/field/pokemon.ts:2870:14 ❯ src/phases/move-effect-phase.ts:271:51 ❯ cleanUpAndComplete src/data/battle-anims.ts:905:11 ❯ MoveAnim.play src/data/battle-anims.ts:910:16 ❯ src/phases/move-effect-phase.ts:192:104

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/gulp_missile.test.ts > Abilities - Gulp Missile > doesn't trigger if user is behind a substitute

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/magic_guard.test.ts > Abilities - Magic Guard > ability should prevent damage caused by weather

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ inflictDamage src/phases/weather-effect-phase.ts:50:19 ❯ src/phases/weather-effect-phase.ts:56:13 ❯ src/phases/field-phase.ts:9:30 ❯ WeatherEffectPhase.executeForAll src/phases/field-phase.ts:9:11 ❯ WeatherEffectPhase.start src/phases/weather-effect-phase.ts:53:14 ❯ BattleScene.shiftPhase src/battle-scene.ts:2371:25 ❯ MoveEndPhase.end src/phase.ts:17:16 ❯ PhaseInterceptor.superEndPhase src/test/utils/phaseInterceptor.ts:474:27

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/magic_guard.test.ts > Abilities - Magic Guard > Magic Guard prevents damage caused by entry hazards

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ SpikesTag.activateTrap src/data/arena-tag.ts:702:17 ❯ SpikesTag.apply src/data/arena-tag.ts:651:17 ❯ src/field/arena.ts:541:25 ❯ Arena.applyTagsForSide src/field/arena.ts:541:10 ❯ Arena.applyTags src/field/arena.ts:552:10 ❯ PostSummonPhase.start src/phases/post-summon-phase.ts:23:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/magic_guard.test.ts > Abilities - Magic Guard > Magic Guard prevents against damage from volatile status effects

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ CurseAttr.apply src/data/move.ts:5402:12 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:442:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/abilities/magic_guard.test.ts > Abilities - Magic Guard > Magic Guard does not prevent damage from Struggle's recoil

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ RecoilAttr.apply src/data/move.ts:1540:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

src/test/moves/ceaseless_edge.test.ts > Moves - Ceaseless Edge > trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ SpikesTag.activateTrap src/data/arena-tag.ts:702:17 ❯ SpikesTag.apply src/data/arena-tag.ts:651:17 ❯ src/field/arena.ts:541:25 ❯ Arena.applyTagsForSide src/field/arena.ts:541:10 ❯ Arena.applyTags src/field/arena.ts:552:10 ❯ PostSummonPhase.start src/phases/post-summon-phase.ts:23:22 ❯ Object.call src/test/utils/phaseInterceptor.ts:458:39 ❯ Timeout.<anonymous> src/test/utils/phaseInterceptor.ts:388:24

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/abilities/sweet_veil.test.ts > Abilities - Sweet Veil > prevents the user and its allies from falling asleep

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ RecoilAttr.apply src/data/move.ts:1540:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/safeguard.test.ts > Moves - Safeguard > doesn't protect from self-inflicted via Rest or Flame Orb

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ EnemyPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ src/test/moves/safeguard.test.ts:124:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should cause the user to take damage

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should redirect enemy attack damage to the Substitute doll

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should fade after redirecting more damage than its remaining HP

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should block stat changes from status moves

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should be bypassed by sound-based moves

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > should be bypassed by attackers with Infiltrator

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > shouldn't block the user's own status moves

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18

Check failure on line 3009 in src/field/pokemon.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

src/test/moves/substitute.test.ts > Moves - Substitute > shouldn't block the opponent from setting hazards

TypeError: Cannot read properties of undefined (reading 'turnData') ❯ PlayerPokemon.damageAndUpdate src/field/pokemon.ts:3009:16 ❯ AddSubstituteAttr.apply src/data/move.ts:1695:10 ❯ src/data/move.ts:7511:27 ❯ applyMoveAttrsInternal src/data/move.ts:7507:10 ❯ Module.applyFilteredMoveAttrs src/data/move.ts:7539:10 ❯ src/phases/move-effect-phase.ts:424:18
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, [], source);
}
return damage;
Expand Down
7 changes: 2 additions & 5 deletions src/phases/move-effect-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,8 @@ export class MoveEffectPhase extends PokemonPhase {
* Multi-Lens, Multi Hit move and Parental Bond check for PostDamageAbAttr
* other damage source are calculated in damageAndUpdate in pokemon.ts
*/
if (target.hasAbilityWithAttr(PostDamageForceSwitchAbAttr)) {
const multiHitModifier = user.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
if (multiHitModifier || user.hasAbilityWithAttr(AddSecondStrikeAbAttr) || move.hasAttr(MultiHitAttr)) {
applyPostDamageAbAttrs(PostDamageAbAttr, target, 0, target.hasPassive(), false, [], user);
}
if (user.turnData.hitCount > 1) {
applyPostDamageAbAttrs(PostDamageAbAttr, target, 0, target.hasPassive(), false, [], user);
}
}

Expand Down

0 comments on commit c20aa9f

Please sign in to comment.