Skip to content

Commit

Permalink
Swift fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreams897 committed Jun 19, 2023
1 parent 46920b8 commit b8c4f01
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5389,25 +5389,26 @@ MoveHitTest:
.dreamEaterCheck
ld a, [de]
cp DREAM_EATER_EFFECT
jr nz, .swiftCheck
jr nz, .checkForDigOrFlyStatus
ld a, [bc]
and SLP_MASK
jp z, .moveMissed
.checkForDigOrFlyStatus
bit INVULNERABLE, [hl]
jp nz, .moveMissed
.swiftCheck
ld a, [de]
cp SWIFT_EFFECT
ret z ; Swift never misses (this was fixed from the Japanese versions)
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
jr z, .checkForDigOrFlyStatus
jr z, .noSubstitute
; The fix for Swift broke this code. It's supposed to prevent HP draining moves from working on Substitutes.
; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works.
cp DRAIN_HP_EFFECT
jp z, .moveMissed
cp DREAM_EATER_EFFECT
jp z, .moveMissed
.checkForDigOrFlyStatus
bit INVULNERABLE, [hl]
jp nz, .moveMissed
.noSubstitute
ldh a, [hWhoseTurn]
and a
jr nz, .enemyTurn
Expand Down

0 comments on commit b8c4f01

Please sign in to comment.