summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-09-08 23:18:30 -0400
committeryenatch <yenatch@gmail.com>2013-09-08 23:18:30 -0400
commit9f7adeafcfe4aaafcf3900cf7a5381d65d29fe05 (patch)
treee9286ba9ceccef73452a09cbd4ef85ddf1b66dd5
parentbd7563e0b6110f6425d5c1ad820c6c1669d2b632 (diff)
ItemIsMail and comment thief move effect
-rw-r--r--battle/effect_commands.asm76
-rw-r--r--main.asm26
2 files changed, 72 insertions, 30 deletions
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm
index 953aee752..5ac336ed9 100644
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9328,72 +9328,102 @@ BattleCommand50: ; 37492
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 @@ BattleCommand50: ; 37492
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
diff --git a/main.asm b/main.asm
index c6783c6ce..a985d9548 100644
--- a/main.asm
+++ b/main.asm
@@ -29816,7 +29816,7 @@ Function16798: ; 16798
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 @@ Function24dd4: ; 24dd4
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 @@ Function29bfb: ; 29bfb
push hl
push bc
ld d, [hl]
- callba Functionb9e76
+ callba ItemIsMail
pop bc
pop hl
jr c, .asm_29c5e
@@ -70346,14 +70346,26 @@ Functionb92b8: ; b92b8
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]