ref: 9f7adeafcfe4aaafcf3900cf7a5381d65d29fe05
parent: bd7563e0b6110f6425d5c1ad820c6c1669d2b632
author: yenatch <[email protected]>
date: Sun Sep 8 19:18:30 EDT 2013
ItemIsMail and comment thief move effect
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9328,72 +9328,102 @@
ld a, [hBattleTurn]
and a
- jr nz, .asm_374ce ; 37495 $37
- call .asm_37501
+ jr nz, .enemy
+
+; The player needs to be able to steal an item.
+
+ call .playeritem
ld a, [hl]
and a
ret nz
- call .asm_3750c
+
+; The enemy needs to have an item to steal.
+
+ call .enemyitem
ld a, [hl]
and a
ret z
+
+; Can't steal mail.
+
ld [$d265], a
ld d, a
- ld a, $2e
- ld hl, $5e76
- rst FarCall
+ callba ItemIsMail
ret c
+
ld a, [EffectFailed]
and a
ret nz
+
ld a, [InLinkBattle]
and a
- jr z, .asm_374be ; 374b7 $5
+ jr z, .stealenemyitem
+
ld a, [IsInBattle]
dec a
ret z
-.asm_374be
- call .asm_3750c
+
+.stealenemyitem
+ call .enemyitem
xor a
ld [hl], a
ld [de], a
- call .asm_37501
+
+ call .playeritem
ld a, [$d265]
ld [hl], a
ld [de], a
- jr .asm_374f8 ; 374cc $2a
-.asm_374ce
- call .asm_3750c
+ jr .stole
+
+
+.enemy
+
+; The enemy can't already have an item.
+
+ call .enemyitem
ld a, [hl]
and a
ret nz
- call .asm_37501
+
+; The player must have an item to steal.
+
+ call .playeritem
ld a, [hl]
and a
ret z
+
+; Can't steal mail!
+
ld [$d265], a
ld d, a
- ld a, $2e
- ld hl, $5e76
- rst FarCall
+ callba ItemIsMail
ret c
+
ld a, [EffectFailed]
and a
ret nz
- call .asm_37501
+
+; If the enemy steals your item,
+; it's gone for good if you don't get it back.
+
+ call .playeritem
xor a
ld [hl], a
ld [de], a
- call .asm_3750c
+
+ call .enemyitem
ld a, [$d265]
ld [hl], a
ld [de], a
-.asm_374f8
+
+
+.stole
call GetItemName
ld hl, StoleText
jp StdBattleTextBox
-.asm_37501
+
+.playeritem
ld a, 1
call BattlePartyAttr
ld d, h
@@ -9401,9 +9431,9 @@
ld hl, BattleMonItem
ret
-.asm_3750c
+.enemyitem
ld a, 1
- call $396d ; GetOTStat_Battle
+ call OTPartyAttr
ld d, h
ld e, l
ld hl, EnemyMonItem
--- a/main.asm
+++ b/main.asm
@@ -29816,7 +29816,7 @@
ld a, [CurPartyMon]
call AddNTimes
ld d, [hl]
- callba Functionb9e76
+ callba ItemIsMail
jr c, .asm_167ed
ld hl, PartyMon1Nickname
ld a, [CurPartyMon]
@@ -32931,7 +32931,7 @@
ld a, $1
call GetPartyParamLocation
ld d, [hl]
- callba Functionb9e76
+ callba ItemIsMail
pop hl
ld a, $14
jr c, .asm_24e2c
@@ -36226,7 +36226,7 @@
push hl
push bc
ld d, [hl]
- callba Functionb9e76
+ callba ItemIsMail
pop bc
pop hl
jr c, .asm_29c5e
@@ -70346,14 +70346,26 @@
INCBIN "baserom.gbc", $b92f7, $b9e76 - $b92f7
-Functionb9e76: ; b9e76
+ItemIsMail: ; b9e76
ld a, d
- ld hl, $5e80
- ld de, $0001
+ ld hl, .items
+ ld de, 1
jp IsInArray
; b9e80
-INCBIN "baserom.gbc", $b9e80, $b9e8b - $b9e80
+.items
+ db FLOWER_MAIL
+ db SURF_MAIL
+ db LITEBLUEMAIL
+ db PORTRAITMAIL
+ db LOVELY_MAIL
+ db EON_MAIL
+ db MORPH_MAIL
+ db BLUESKY_MAIL
+ db MUSIC_MAIL
+ db MIRAGE_MAIL
+ db $ff
+; b9e8b
SECTION "bank2F",ROMX,BANK[$2F]