summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlibjet <libj3t@gmail.com>2020-05-29 16:38:56 +0100
committerlibjet <libj3t@gmail.com>2020-05-29 16:38:56 +0100
commitf0212e7fb938415fa20014b1ed013795b537a489 (patch)
tree532650c25a60455ce74325c3e4111252345e11a0
parent3a9930b9d4348cf0a67861438d7af32fbb60d812 (diff)
Add engine/events/pokerus/check_pokerus.asm
-rwxr-xr-xengine/events/pokerus/check_pokerus.asm25
-rw-r--r--main.asm4
2 files changed, 27 insertions, 2 deletions
diff --git a/engine/events/pokerus/check_pokerus.asm b/engine/events/pokerus/check_pokerus.asm
new file mode 100755
index 00000000..201a3713
--- /dev/null
+++ b/engine/events/pokerus/check_pokerus.asm
@@ -0,0 +1,25 @@
+_CheckPokerus:
+; Return carry if a monster in your party has Pokerus
+
+; Get number of monsters to iterate over
+ ld a, [wPartyCount]
+ and a
+ jr z, .NoPokerus
+ ld b, a
+; Check each monster in the party for Pokerus
+ ld hl, wPartyMon1PokerusStatus
+ ld de, PARTYMON_STRUCT_LENGTH
+.Check:
+ ld a, [hl]
+ and $0f ; only the bottom nybble is used
+ jr nz, .HasPokerus
+; Next PartyMon
+ add hl, de
+ dec b
+ jr nz, .Check
+.NoPokerus:
+ and a
+ ret
+.HasPokerus:
+ scf
+ ret
diff --git a/main.asm b/main.asm
index e0d0f00d..f1579047 100644
--- a/main.asm
+++ b/main.asm
@@ -373,8 +373,8 @@ INCLUDE "engine/pokemon/mail_2.asm"
SECTION "bank31_2", ROMX
-_CheckPokerus::
- dr $c7a40, $c7a5a
+INCLUDE "engine/events/pokerus/check_pokerus.asm"
+
CheckForLuckyNumberWinners::
dr $c7a5a, $c7bad
PrintTodaysLuckyNumber::