summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2016-09-18 16:42:29 +0200
committerxCrystal <rgr.crystal@gmail.com>2016-09-18 21:53:26 +0200
commit68b1685081a6a92e19dab91534d73b6de4319386 (patch)
tree0fd252892b0b81c79962514fb2af91334045fad8 /src
parenta80ff2b50facaa2df80fe4e65c5f4206a32dee69 (diff)
more move effects
Diffstat (limited to 'src')
-rw-r--r--src/data/effect_commands.asm24
-rw-r--r--src/engine/effect_functions.asm121
-rwxr-xr-xsrc/engine/home.asm65
-rwxr-xr-xsrc/wram.asm9
4 files changed, 195 insertions, 24 deletions
diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm
index c5c0ec9..3dfdf9c 100644
--- a/src/data/effect_commands.asm
+++ b/src/data/effect_commands.asm
@@ -8,19 +8,23 @@ EffectCommands: ; 186f7 (6:46f7)
; db $00
; Commands are associated to a time or a scope (CommandType) that determines when their function is executed during the turn.
-; For example type $03 is executed right before dealing damage while type $09 appears to be AI related and is executed later.
+; For example type $03 is executed right before dealing damage while type $09 is AI related and executed during enemy turn only.
; Similar move effects of different Pokemon cards all point to a different command list,
; even though in some cases their commands and function pointers match.
; Function name examples
-; Poison50PercentEffect ; generic effect shared by multiple moves.
-; KakunaStiffenEffect ; unique effect from a move known by multiple cards.
-; AcidEffect ; unique effect from a move known by a single card
-; SpitPoison_Poison50PercentEffect ; unique effect from a move known by a single card. This effect is made of more than one command.
+; PoisonEffect ; generic effect shared by multiple moves.
+; Paralysis50PercentEffect ;
+; KakunaStiffenEffect ; unique effect from a move known by multiple cards.
+; MetapodStiffenEffect ;
+; AcidEffect ; unique effect from a move known by a single card
+; FoulOdorEffect ;
+; SpitPoison_Poison50PercentEffect ; unique effect made of more than one command.
+; SpitPoison_AIEffect ;
EkansSpitPoisonEffectCommands:
dbw $03, SpitPoison_Poison50PercentEffect
- dbw $09, $46f0
+ dbw $09, SpitPoison_AIEffect
db $00
EkansWrapEffectCommands:
@@ -35,12 +39,12 @@ ArbokTerrorStrikeEffectCommands:
ArbokPoisonFangEffectCommands:
dbw $03, PoisonEffect
- dbw $09, $4730
+ dbw $09, PoisonFang_AIEffect
db $00
WeepinbellPoisonPowderEffectCommands:
dbw $03, Poison50PercentEffect
- dbw $09, $4738
+ dbw $09, WeepinbellPoisonPowder_AIEffect
db $00
VictreebelLureEffectCommands:
@@ -64,7 +68,7 @@ CaterpieStringShotEffectCommands:
GloomPoisonPowderEffectCommands:
dbw $03, PoisonEffect
- dbw $09, $478b
+ dbw $09, GloomPoisonPowder_AIEffect
db $00
GloomFoulOdorEffectCommands:
@@ -77,7 +81,7 @@ KakunaStiffenEffectCommands:
KakunaPoisonPowderEffectCommands:
dbw $03, Poison50PercentEffect
- dbw $09, $47b4
+ dbw $09, KakunaPoisonPowder_AIEffect
db $00
GolbatLeechLifeEffectCommands:
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index d8e4789..d37f5e6 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -88,7 +88,33 @@ TossCoin_BankB: ; 2c07e (b:407e)
ret
; 0x2c082
-INCBIN "baserom.gbc",$2c082,$2c09c - $2c082
+TossCoinATimes_BankB: ; 2c082 (b:4082)
+ call TossCoinATimes
+ ret
+; 0x2c086
+
+CommentedOut_2c086: ; 2c086 (b:4086)
+ ret
+; 0x2c087
+
+Func_2c087: ; 2c087 (b:4087)
+ xor a
+ jr asm_2c08c
+
+Func_2c08a: ; 2c08a (b:408a)
+ ld a, $1
+
+asm_2c08c
+ push de
+ push af
+ ld a, $11
+ call Func_0f7f
+ pop af
+ pop de
+ call Func_0fac
+ call TossCoinATimes
+ ret
+; 0x2c09c
Func_2c09c: ; 2c09c (b:409c)
ld a, $1
@@ -102,7 +128,60 @@ Func_2c0a2: ; 2c0a2 (b:40a2)
ret
; 0x2c0a8
-INCBIN "baserom.gbc",$2c0a8,$2c140 - $2c0a8
+INCBIN "baserom.gbc",$2c0a8,$2c0d4 - $2c0a8
+
+; Sets some flags for AI use
+; if target double poisoned
+; [wccbb] <- [wDamage]
+; [wccbc] <- [wDamage]
+; else
+; [wccbb] <- [wDamage] + d
+; [wccbc] <- [wDamage] + e
+; [wDamage] <- [wDamage] + a
+Func_2c0d4: ; 2c0d4 (b:40d4)
+ push af
+ ld a, DUELVARS_ARENA_CARD_STATUS
+ call GetNonTurnDuelistVariable
+ and DOUBLE_POISONED
+ jr z, .notDoublePoisoned
+ pop af
+ ld a, [wDamage]
+ ld [wccbb], a
+ ld [wccbc], a
+ ret
+
+ push af
+
+.notDoublePoisoned
+ ld hl, wDamage
+ ld a, [hl]
+ add d
+ ld [wccbb], a
+ ld a, [hl]
+ add e
+ ld [wccbc], a
+ pop af
+ add [hl]
+ ld [hl], a
+ ret
+; 0x2c0fb
+
+; Sets some flags for AI use
+; [wDamage] <- a
+; [wccbb] <- d
+; [wccbc] <- e
+Func_2c0fb: ; 2c0fb (b:40fb)
+ ld [wDamage], a
+ xor a
+ ld [wDamage + 1], a
+ ld a, d
+ ld [wccbb], a
+ ld a, e
+ ld [wccbc], a
+ ret
+; 0x2c10b
+
+INCBIN "baserom.gbc",$2c10b,$2c140 - $2c10b
; apply a status condition of type 1 identified by register a to the target
ApplySubstatus1ToDefendingCard: ; 2c140 (b:4140)
@@ -139,7 +218,13 @@ ApplySubstatus2ToDefendingCard: ; 2c149 (b:4149)
ret
; 0x2c166
-INCBIN "baserom.gbc",$2c166,$2c6f8 - $2c166
+INCBIN "baserom.gbc",$2c166,$2c6f0 - $2c166
+
+SpitPoison_AIEffect: ; 2c6f0 (b:46f0)
+ ld a, $5
+ lb de, $0, $a
+ jp Func_2c0fb
+; 0x2c6f8
SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
text_de PoisonCheckText
@@ -151,7 +236,21 @@ SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
ret
; 0x2c70a
-INCBIN "baserom.gbc",$2c70a,$2c77e - $2c70a
+INCBIN "baserom.gbc",$2c70a,$2c730 - $2c70a
+
+PoisonFang_AIEffect: ; 2c730 (b:4730)
+ ld a, $a
+ lb de, $a, $a
+ jp Func_2c0d4
+; 0x2c738
+
+WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738)
+ ld a, $5
+ lb de, $0, $a
+ jp Func_2c0d4
+; 0x2c740
+
+INCBIN "baserom.gbc",$2c740,$2c77e - $2c740
AcidEffect: ; 2c77e (b:477e)
text_de AcidCheckText
@@ -162,7 +261,11 @@ AcidEffect: ; 2c77e (b:477e)
ret
; 0x2c78b
-INCBIN "baserom.gbc",$2c78b,$2c793 - $2c78b
+GloomPoisonPowder_AIEffect: ; 2c78b (b:478b)
+ ld a, $a
+ lb de, $a, $a
+ jp Func_2c0d4
+; 0x2c793
; confuses both the target and the user
FoulOdorEffect: ; 2c793 (b:4793)
@@ -184,7 +287,13 @@ KakunaStiffenEffect: ; 2c7a0 (b:47a0)
ret
; 0x2c7b4
-INCBIN "baserom.gbc",$2c7b4,$2c7d0 - $2c7b4
+KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4)
+ ld a, $5
+ lb de, $0, $a
+ jp Func_2c0d4
+; 0x2c7bc
+
+INCBIN "baserom.gbc",$2c7bc,$2c7d0 - $2c7bc
SwordsDanceEffect: ; 2c7d0 (b:47d0)
ld a, [wTempTurnDuelistCardId]
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 71a3008..12b685a 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -2143,18 +2143,71 @@ Func_0f7f: ; 0f7f (0:0f7f)
ld a, DUELVARS_DUELIST_TYPE
call GetNonTurnDuelistVariable
cp DUELIST_TYPE_LINK_OPP
- jr nz, .asm_f98
+ jr nz, .notLink
ld hl, $ff9e
ld bc, $000a
call Func_0ebf
call Func_0f58
-.asm_f98
+.notLink
pop bc
pop hl
ret
; 0xf9b
-INCBIN "baserom.gbc",$0f9b,$100b - $0f9b
+INCBIN "baserom.gbc",$0f9b,$0fac - $0f9b
+
+Func_0fac: ; 0fac (0:0fac)
+ push hl
+ push af
+ ld a, DUELVARS_DUELIST_TYPE
+ call GetNonTurnDuelistVariable
+ cp DUELIST_TYPE_LINK_OPP
+ jr z, .link
+ pop af
+ pop hl
+ ret
+
+.link
+ pop af
+ pop hl
+ push af
+ push hl
+ push de
+ push bc
+ push de
+ push hl
+ push af
+ ld hl, $cbed
+ pop de
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ inc hl
+ pop de
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ inc hl
+ pop de
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ inc hl
+ ld [hl], c
+ inc hl
+ ld [hl], b
+ ld hl, $cbed
+ ld bc, $0008
+ call Func_0ebf
+ jp c, Func_0f35
+ pop bc
+ pop de
+ pop hl
+ pop af
+ ret
+; 0xfe9
+
+INCBIN "baserom.gbc",$0fe9,$100b - $0fe9
Func_100b: ; 100b (0:100b)
ld a, $2
@@ -5879,8 +5932,7 @@ TossCoinATimes: ; 3071 (0:3071)
ld [hl], e
inc hl
ld [hl], d
- rst $18
- dw _TossCoin
+ bank1call _TossCoin
pop hl
ret
@@ -5895,8 +5947,7 @@ TossCoin: ; 307d (0:307d)
inc hl
ld [hl], d
ld a, $1
- rst $18
- dw _TossCoin
+ bank1call _TossCoin
ld hl, $cac2
ld [hl], $0
pop hl
diff --git a/src/wram.asm b/src/wram.asm
index 3b6543f..ba63201 100755
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -524,7 +524,14 @@ wLoadedMove:: ; cca6
wDamage:: ; ccb9
ds $2
- ds $4
+; wccbb and wccbc appear to be used for AI scoring
+wccbb::
+ ds $1
+
+wccbc::
+ ds $1
+
+ ds $2
wccbf:: ; ccbf
ds $2