Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; PokeRed version
- ; based on https://github.com/pret/pokered/blob/master/engine/battle/core.asm
- ; 3E582 (6582 in bank F)
- .dreamEaterCheck
- 1A ld a,[de]
- FE 08 cp a,DREAM_EATER_EFFECT
- 20 06 jr nz,.swiftCheck
- 0A ld a,[bc]
- E6 07 and a,SLP ; is the target pokemon sleeping?
- CA 0966 jp z,.moveMissed
- .swiftCheck
- 1A ld a,[de]
- FE 11 cp a,SWIFT_EFFECT
- C8 ret z ; Swift never misses
- ; This was moved from above swiftCheck, fixing one bug and creating another.
- CD 797B call CheckTargetSubstitute ; note that this overwrites a
- 28 0A jr z,.checkForDigOrFlyStatus
- ; This code is buggy.
- ; It's supposed to prevent HP draining moves from working on substitutes.
- ; Since $7b79 overwrites a with either $00 or $01, it never works.
- FE 03 cp a,DRAIN_HP_EFFECT
- CA 0966 jp z,.moveMissed
- FE 08 cp a,DREAM_EATER_EFFECT
- CA 0966 jp z,.moveMissed
- .checkForDigOrFlyStatus
- CB 76 bit Invulnerable,[hl]
- C2 0966 jp nz,.moveMissed
- ; ...
- ; 3FB79 (7B79 in bank F)
- CheckTargetSubstitute:
- E5 push hl
- 21 68D0 ld hl, wEnemyBattleStatus2
- F0 F3 ld a, [H_WHOSETURN]
- A7 and a
- 28 03 jr z, .next1
- 21 63D0 ld hl, wPlayerBattleStatus2
- .next1
- CB 66 bit HasSubstituteUp, [hl]
- E1 pop hl
- C9 ret
- ; Pocket Monsters Aka (Japan) (Rev A)
- ; 3E86B (686B in bank F)
- .dreamEaterCheck
- 1A ld a,[de]
- FE 08 cp a,DREAM_EATER_EFFECT
- 20 06 jr nz,.substCheck
- 0A ld a,[bc]
- E6 07 and a,SLP ; is the target pokemon sleeping?
- CA F268 jp z,.moveMissed
- .substCheck
- CD B17F call CheckTargetSubstituteProbably
- 28 0E jr z,.checkForDigOrFlyStatus
- ; Supposed to prevent HP draining moves from working on substitutes?
- ; But also prevents Swift Effect from working when there isn't a substitute?
- 1A ld a,[de]
- FE 11 cp a,SWIFT_EFFECT
- C8 ret z
- FE 03 cp a,DRAIN_HP_EFFECT
- CA F268 jp z,.moveMissed
- FE 08 cp a,DREAM_EATER_EFFECT
- CA F268 jp z,.moveMissed
- .checkForDigOrFlyStatus
- CB 76
- C2 F268 jp nz,.moveMissed
- ; ...
- ; 3FFB1 (7FB1 in bank F)
- ; Same opcodes as PokeRed's CheckTargetSubstitute.
- ; Assume the variables mean the same thing for now.
- CheckTargetSubstituteProbably:
- E5 push hl
- 21 45D0 ld hl,?
- F0 F3 ld a, [?]
- A7 and a
- 28 03 jr z, .next1
- 21 40D0 ld hl,?
- .next1
- CB 66 bit HasSubstituteUp?, [hl]
- E1 pop hl
- C9 ret
Add Comment
Please, Sign In to add comment