summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Survive-poisoning-with-1-HP.md112
-rw-r--r--Tutorials.md2
-rw-r--r--screenshots/survived-poisoning.pngbin0 -> 1954 bytes
3 files changed, 113 insertions, 1 deletions
diff --git a/Survive-poisoning-with-1-HP.md b/Survive-poisoning-with-1-HP.md
new file mode 100644
index 0000000..5b9b74c
--- /dev/null
+++ b/Survive-poisoning-with-1-HP.md
@@ -0,0 +1,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
+ UnknownText_0x1c0acc::
+ 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.
+
+
+## 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
+- farjump Script_OverworldWhiteout
+
+-.CheckWhitedOut:
++.CheckRecovered:
+ xor a
+ ld [wCurPartyMon], a
+ ld de, wEngineBuffer2
+ .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!
+
+![Screenshot](screenshots/survived-poisoning.png)
diff --git a/Tutorials.md b/Tutorials.md
index b90f104..cf69e91 100644
--- a/Tutorials.md
+++ b/Tutorials.md
@@ -89,6 +89,7 @@ Tutorials may use diff syntax to show edits:
- [Don't gain experience at level 100](Don't-gain-experience-at-level-100)
- [Erratic and Fluctuating experience growth rates](Erratic-and-Fluctuating-experience-growth-rates)
- [Lose money proportional to badges and level](Lose-money-proportional-to-badges-and-level)
+- [Survive poisoning with 1 HP](Survive-poisoning-with-1-HP)
- [Show move names when you receive a TM or HM](Show-move-names-when-you-receive-a-TM-or-HM)
- [Infinitely reusable TMs](Infinitely-reusable-TMs)
- [Automatically reuse Repel](Automatically-reuse-Repel)
@@ -129,7 +130,6 @@ Feel free to contribute one of these!
- Items that act like overworld moves
- Safari Game
- Ghost and Silph Scope
-- Cure poison when it reaches 1 HP outside a battle
- Bill calls to switch boxes when one is full
- Show quantity already in Pack in Marts
- Instant text option
diff --git a/screenshots/survived-poisoning.png b/screenshots/survived-poisoning.png
new file mode 100644
index 0000000..d448274
--- /dev/null
+++ b/screenshots/survived-poisoning.png
Binary files differ