diff options
author | xCrystal <rgr.crystal@gmail.com> | 2015-04-01 11:23:27 +0200 |
---|---|---|
committer | xCrystal <rgr.crystal@gmail.com> | 2015-04-01 17:05:10 +0200 |
commit | e74dce24b4bbb0d0d23a1724932b289050b66d4a (patch) | |
tree | ac695b04a00f7af920e1e84b88adbcb0fce84842 /engine/battle/moveEffects | |
parent | 9d93b5b630eaabd57f213c9dc5761223ff7445ec (diff) |
Rename battle files and split move effects Part 1
1.asm, 4.asm, and 4_2.asm
Diffstat (limited to 'engine/battle/moveEffects')
-rw-r--r-- | engine/battle/moveEffects/conversion_effect.asm | 34 | ||||
-rw-r--r-- | engine/battle/moveEffects/drain_hp_effect.asm | 104 | ||||
-rw-r--r-- | engine/battle/moveEffects/haze_effect.asm | 76 | ||||
-rw-r--r-- | engine/battle/moveEffects/recoil_effect.asm | 68 |
4 files changed, 282 insertions, 0 deletions
diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm new file mode 100644 index 00000000..511df2fd --- /dev/null +++ b/engine/battle/moveEffects/conversion_effect.asm @@ -0,0 +1,34 @@ +ConversionEffect_: ; 139a3 (4:79a3) + ld hl, wEnemyMonType1 + ld de, wBattleMonType1 + ld a, [H_WHOSETURN] + and a + ld a, [W_ENEMYBATTSTATUS1] + jr z, .asm_139b8 + push hl + ld h, d + ld l, e + pop de + ld a, [W_PLAYERBATTSTATUS1] +.asm_139b8 + bit Invulnerable, a ; is mon immune to typical attacks (dig/fly) + jr nz, PrintButItFailedText + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + ld hl, PlayCurrentMoveAnimation + call CallBankF + ld hl, ConvertedTypeText + jp PrintText + +ConvertedTypeText: ; 139cd (4:79cd) + TX_FAR _ConvertedTypeText + db "@" + +PrintButItFailedText: ; 139d2 (4:79d2) + ld hl, PrintButItFailedText_ +CallBankF: ; 139d5 (4:79d5) + ld b, BANK(PrintButItFailedText_) + jp Bankswitch diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm new file mode 100644 index 00000000..517d53d1 --- /dev/null +++ b/engine/battle/moveEffects/drain_hp_effect.asm @@ -0,0 +1,104 @@ +DrainHPEffect_: ; 783f (1:783f) + ld hl, W_DAMAGE + ld a, [hl] + srl a ; divide damage by 2 + ld [hli], a + ld a, [hl] + rr a + ld [hld], a + or [hl] ; is damage 0? + jr nz, .getAttackerHP +; if damage is 0, increase to 1 so that the attacker gains at least 1 HP + inc hl + inc [hl] +.getAttackerHP + ld hl, wBattleMonHP + ld de, wBattleMonMaxHP + ld a, [H_WHOSETURN] + and a + jp z, .addDamageToAttackerHP + ld hl, wEnemyMonHP + ld de, wEnemyMonMaxHP +.addDamageToAttackerHP + ld bc, wHPBarOldHP+1 +; copy current HP to wHPBarOldHP + ld a, [hli] + ld [bc], a + ld a, [hl] + dec bc + ld [bc], a +; copy max HP to wHPBarMaxHP + ld a, [de] + dec bc + ld [bc], a + inc de + ld a, [de] + dec bc + ld [bc], a +; add damage to attacker's HP and copy new HP to wHPBarNewHP + ld a, [W_DAMAGE + 1] + ld b, [hl] + add b + ld [hld], a + ld [wHPBarNewHP], a + ld a, [W_DAMAGE] + ld b, [hl] + adc b + ld [hli], a + ld [wHPBarNewHP+1], a + jr c, .capToMaxHP ; if HP > 65,535, cap to max HP +; compare HP with max HP + ld a, [hld] + ld b, a + ld a, [de] + dec de + sub b + ld a, [hli] + ld b, a + ld a, [de] + inc de + sbc b + jr nc, .next +.capToMaxHP + ld a, [de] + ld [hld], a + ld [wHPBarNewHP], a + dec de + ld a, [de] + ld [hli], a + ld [wHPBarNewHP+1], a + inc de +.next + ld a, [H_WHOSETURN] + and a + hlCoord 10, 9 + ld a, $1 + jr z, .next2 + hlCoord 2, 2 + xor a +.next2 + ld [wHPBarType], a + predef UpdateHPBar2 + predef DrawPlayerHUDAndHPBar + predef DrawEnemyHUDAndHPBar + callab ReadPlayerMonCurHPAndStatus + ld hl, SuckedHealthText + ld a, [H_WHOSETURN] + and a + ld a, [W_PLAYERMOVEEFFECT] + jr z, .next3 + ld a, [W_ENEMYMOVEEFFECT] +.next3 + cp DREAM_EATER_EFFECT + jr nz, .printText + ld hl, DreamWasEatenText +.printText + jp PrintText + +SuckedHealthText: ; 78dc (1:78dc) + TX_FAR _SuckedHealthText + db "@" + +DreamWasEatenText: ; 78e1 (1:78e1) + TX_FAR _DreamWasEatenText + db "@" diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm new file mode 100644 index 00000000..2343e784 --- /dev/null +++ b/engine/battle/moveEffects/haze_effect.asm @@ -0,0 +1,76 @@ +HazeEffect_: ; 139da (4:79da) + ld a, $7 + ld hl, wPlayerMonAttackMod + call ResetStatMods + ld hl, wEnemyMonAttackMod + call ResetStatMods + ld hl, wPlayerMonUnmodifiedAttack + ld de, wBattleMonAttack + call ResetStats + ld hl, wEnemyMonUnmodifiedAttack + ld de, wEnemyMonAttack + call ResetStats + ld hl, wEnemyMonStatus + ld de, wEnemySelectedMove + ld a, [H_WHOSETURN] + and a + jr z, .asm_13a09 + ld hl, wBattleMonStatus + dec de + +.asm_13a09 + ld a, [hl] + ld [hl], $0 + and $27 + jr z, .asm_13a13 + ld a, $ff + ld [de], a + +.asm_13a13 + xor a + ld [W_PLAYERDISABLEDMOVE], a + ld [W_ENEMYDISABLEDMOVE], a + ld hl, wccee + ld [hli], a + ld [hl], a + ld hl, W_PLAYERBATTSTATUS1 + call CureStatuses + ld hl, W_ENEMYBATTSTATUS1 + call CureStatuses + ld hl, PlayCurrentMoveAnimation + call CallBankF + ld hl, StatusChangesEliminatedText + jp PrintText + +CureStatuses: ; 13a37 (4:7a37) + res Confused, [hl] + inc hl ; BATTSTATUS2 + ld a, [hl] + and (1 << UsingRage) | (1 << NeedsToRecharge) | (1 << HasSubstituteUp) | (1 << 3) ; clear all but these from BATTSTATUS2 + ld [hli], a ; BATTSTATUS3 + ld a, [hl] + and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses + ld [hl], a + ret + +ResetStatMods: ; 13a43 (4:7a43) + ld b, $8 +.loop + ld [hli], a + dec b + jr nz, .loop + ret + +ResetStats: ; 13a4a (4:7a4a) + ld b, $8 +.loop + ld a, [hli] + ld [de], a + inc de + dec b + jr nz, .loop + ret + +StatusChangesEliminatedText: ; 13a53 (4:7a53) + TX_FAR _StatusChangesEliminatedText + db "@" diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm new file mode 100644 index 00000000..0460b208 --- /dev/null +++ b/engine/battle/moveEffects/recoil_effect.asm @@ -0,0 +1,68 @@ +RecoilEffect_: ; 1392c (4:792c) + ld a, [H_WHOSETURN] + and a + ld a, [W_PLAYERMOVENUM] + ld hl, wBattleMonMaxHP + jr z, .asm_1393d + ld a, [W_ENEMYMOVENUM] + ld hl, wEnemyMonMaxHP +.asm_1393d + ld d, a + ld a, [W_DAMAGE] + ld b, a + ld a, [W_DAMAGE + 1] + ld c, a + srl b + rr c + ld a, d + cp STRUGGLE + jr z, .asm_13953 + srl b + rr c +.asm_13953 + ld a, b + or c + jr nz, .asm_13958 + inc c +.asm_13958 + ld a, [hli] + ld [wHPBarMaxHP+1], a + ld a, [hl] + ld [wHPBarMaxHP], a + push bc + ld bc, $fff2 + add hl, bc + pop bc + ld a, [hl] + ld [wHPBarOldHP], a + sub c + ld [hld], a + ld [wHPBarNewHP], a + ld a, [hl] + ld [wHPBarOldHP+1], a + sbc b + ld [hl], a + ld [wHPBarNewHP+1], a + jr nc, .asm_13982 + xor a + ld [hli], a + ld [hl], a + ld hl, wHPBarNewHP + ld [hli], a + ld [hl], a +.asm_13982 + hlCoord 10, 9 + ld a, [H_WHOSETURN] + and a + ld a, $1 + jr z, .asm_13990 + hlCoord 2, 2 + xor a +.asm_13990 + ld [wHPBarType], a + predef UpdateHPBar2 + ld hl, HitWithRecoilText + jp PrintText +HitWithRecoilText: ; 1399e (4:799e) + TX_FAR _HitWithRecoilText + db "@" |