-
Notifications
You must be signed in to change notification settings - Fork 806
Survive poisoning with 1 HP
MasterDriverRex edited this page May 24, 2021
·
6 revisions
Poisoned Pokémon lose 1 HP every four steps you take in the overworld. In Gen 1, 2, and 3 this could make them faint, but starting in Gen 4 they recover from poisoning with 1 HP left. This tutorial ports that feature to pokecrystal.
(The code for this feature was adapted from Twitch Plays Pokémon: Anniversary Crystal.)
Edit data/text/common_2.asm:
_PoisonFaintText::
text_ram wStringBuffer3
text_start
- line "fainted!"
+ line "survived the"
+ cont "poisoning!"
prompt
-
-UnknownText_0x1c0ada::
- text "<PLAYER> is out of"
- line "useable #MON!"
-
- para "<PLAYER> whited"
- line "out!"
- prompt
Since Pokémon can't faint from poisoning we can't white out, so that message is also no longer needed.
Edit engine/events/poisonstep.asm:
DoPoisonStep::
...
-; the mon has fainted, reset its status, set carry, and return %10
+; the mon has fainted, reset its HP to 1 and its status to OK
+ inc hl
+ inc [hl]
ld a, MON_STATUS
call GetPartyParamLocation
ld [hl], 0
ld c, %10
scf
ret
...
.Script_MonFaintedToPoison:
callasm .PlayPoisonSFX
opentext
+ callasm .CheckRecovered
- callasm .CheckWhitedOut
- iffalse .whiteout
closetext
end
-
-.whiteout
- farsjump Script_OverworldWhiteout
-.CheckWhitedOut:
+.CheckRecovered:
xor a
ld [wCurPartyMon], a
ld de, wPoisonStepPartyFlags
.party_loop
push de
ld a, [de]
and %10
jr z, .mon_not_fainted
ld c, HAPPINESS_POISONFAINT
farcall ChangeHappiness
farcall GetPartyNick
- ld hl, .PoisonFaintText
+ ld hl, .PoisonRecoveryText
call PrintText
.mon_not_fainted
pop de
inc de
ld hl, wCurPartyMon
inc [hl]
ld a, [wPartyCount]
cp [hl]
jr nz, .party_loop
- predef CheckPlayerPartyForFitMon
- ld a, d
- ld [wScriptVar], a
ret
-.PoisonFaintText:
+.PoisonRecoveryText:
text_far UnknownText_0x1c0acc
text_end
-
-.PoisonWhiteOutText:
- text_far UnknownText_0x1c0ada
- text_end
That's it!