1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
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](https://github.com/TwitchPlaysPokemon/tppcrystal251pub/).)
## Contents
1. [Change the overworld poison message](#1-change-the-overworld-poison-message)
2. [Implement survival with 1 HP](#2-implement-survival-with-1-hp)
## 1. Change the overworld poison message
Edit [data/text/common_2.asm](../blob/master/data/text/common_2.asm):
```diff
_PoisonFaintText::
text_ram wStringBuffer3
text_start
- line "fainted!"
+ line "survived the"
+ cont "poisoning!"
prompt
-
-_PoisonWhiteoutText::
- 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.
## 2. Implement survival with 1 HP
Edit [engine/events/poisonstep.asm](../blob/master/engine/events/poisonstep.asm):
```diff
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!

|