diff options
author | xCrystal <rgr.crystal@gmail.com> | 2015-04-01 16:51:04 +0200 |
---|---|---|
committer | xCrystal <rgr.crystal@gmail.com> | 2015-04-01 17:05:50 +0200 |
commit | 2fe782b11a039b52fd236da28fb2f1ae10cae7db (patch) | |
tree | 580cc7bf8b0ebd617fd0ba0440618d38c355aa83 /engine/battle/moveEffects | |
parent | 77d0e5ff84cc61ae625da19f184094241eddd4dc (diff) |
Rename battle files and split move effects Part 4
e.asm, e_2. asm, and 14.asm
Diffstat (limited to 'engine/battle/moveEffects')
-rw-r--r-- | engine/battle/moveEffects/heal_effect.asm | 116 | ||||
-rw-r--r-- | engine/battle/moveEffects/paralyze_effect.asm | 53 | ||||
-rw-r--r-- | engine/battle/moveEffects/reflect_light_screen_effect.asm | 45 | ||||
-rw-r--r-- | engine/battle/moveEffects/transform_effect.asm | 138 |
4 files changed, 352 insertions, 0 deletions
diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm new file mode 100644 index 00000000..22d482e7 --- /dev/null +++ b/engine/battle/moveEffects/heal_effect.asm @@ -0,0 +1,116 @@ +HealEffect_: ; 3b9ec (e:79ec) + ld a, [H_WHOSETURN] + and a + ld de, wBattleMonHP + ld hl, wBattleMonMaxHP + ld a, [W_PLAYERMOVENUM] + jr z, .asm_3ba03 + ld de, wEnemyMonHP + ld hl, wEnemyMonMaxHP + ld a, [W_ENEMYMOVENUM] +.asm_3ba03 + ld b, a + ld a, [de] + cp [hl] + inc de + inc hl + ld a, [de] + sbc [hl] + jp z, .failed + ld a, b + cp REST + jr nz, .asm_3ba37 + push hl + push de + push af + ld c, 50 + call DelayFrames + ld hl, wBattleMonStatus + ld a, [H_WHOSETURN] + and a + jr z, .asm_3ba25 + ld hl, wEnemyMonStatus +.asm_3ba25 + ld a, [hl] + and a + ld [hl], 2 ; Number of turns from Rest + ld hl, StartedSleepingEffect + jr z, .asm_3ba31 + ld hl, FellAsleepBecameHealthyText +.asm_3ba31 + call PrintText + pop af + pop de + pop hl +.asm_3ba37 + ld a, [hld] + ld [wHPBarMaxHP], a + ld c, a + ld a, [hl] + ld [wHPBarMaxHP+1], a + ld b, a + jr z, .asm_3ba47 + srl b + rr c +.asm_3ba47 + ld a, [de] + ld [wHPBarOldHP], a + add c + ld [de], a + ld [wHPBarNewHP], a + dec de + ld a, [de] + ld [wHPBarOldHP+1], a + adc b + ld [de], a + ld [wHPBarNewHP+1], a + inc hl + inc de + ld a, [de] + dec de + sub [hl] + dec hl + ld a, [de] + sbc [hl] + jr c, .asm_3ba6f + ld a, [hli] + ld [de], a + ld [wHPBarNewHP+1], a + inc de + ld a, [hl] + ld [de], a + ld [wHPBarNewHP], a +.asm_3ba6f + ld hl, PlayCurrentMoveAnimation + call BankswitchEtoF + ld a, [H_WHOSETURN] + and a + hlCoord 10, 9 + ld a, $1 + jr z, .asm_3ba83 + hlCoord 2, 2 + xor a +.asm_3ba83 + ld [wHPBarType], a + predef UpdateHPBar2 + ld hl, DrawHUDsAndHPBars + call BankswitchEtoF + ld hl, RegainedHealthText + jp PrintText +.failed + ld c, 50 + call DelayFrames + ld hl, PrintButItFailedText_ + jp BankswitchEtoF + +StartedSleepingEffect: ; 3baa2 (e:7aa2) + TX_FAR _StartedSleepingEffect + db "@" + +FellAsleepBecameHealthyText: ; 3baa7 (e:7aa7) + TX_FAR _FellAsleepBecameHealthyText + db "@" + +RegainedHealthText: ; 3baac (e:7aac) + TX_FAR _RegainedHealthText + db "@" diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm new file mode 100644 index 00000000..69acbb01 --- /dev/null +++ b/engine/battle/moveEffects/paralyze_effect.asm @@ -0,0 +1,53 @@ +ParalyzeEffect_: ; 52601 (14:6601) + ld hl, wEnemyMonStatus + ld de, W_PLAYERMOVETYPE + ld a, [H_WHOSETURN] + and a + jp z, .next + ld hl, wBattleMonStatus + ld de, W_ENEMYMOVETYPE +.next + ld a, [hl] + and a ; does the target already have a status ailment? + jr nz, .didntAffect +; check if the target is immune due to types + ld a, [de] + cp ELECTRIC + jr nz, .hitTest + ld b, h + ld c, l + inc bc + ld a, [bc] + cp GROUND + jr z, .doesntAffect + inc bc + ld a, [bc] + cp GROUND + jr z, .doesntAffect +.hitTest + push hl + callab MoveHitTest + pop hl + ld a, [W_MOVEMISSED] + and a + jr nz, .didntAffect + set PAR, [hl] + callab QuarterSpeedDueToParalysis + ld c, 30 + call DelayFrames + callab PlayCurrentMoveAnimation + ld hl, PrintMayNotAttackText + ld b, BANK(PrintMayNotAttackText) + jp Bankswitch +.didntAffect + ld c, 50 + call DelayFrames + ld hl, PrintDidntAffectText + ld b, BANK(PrintDidntAffectText) + jp Bankswitch +.doesntAffect + ld c, 50 + call DelayFrames + ld hl, PrintDoesntAffectText + ld b, BANK(PrintDoesntAffectText) + jp Bankswitch diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm new file mode 100644 index 00000000..39a2c154 --- /dev/null +++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm @@ -0,0 +1,45 @@ +ReflectLightScreenEffect_: ; 3bb97 (e:7b97) + ld hl, W_PLAYERBATTSTATUS3 + ld de, W_PLAYERMOVEEFFECT + ld a, [H_WHOSETURN] + and a + jr z, .asm_3bba8 + ld hl, W_ENEMYBATTSTATUS3 + ld de, W_ENEMYMOVEEFFECT +.asm_3bba8 + ld a, [de] + cp LIGHT_SCREEN_EFFECT + jr nz, .reflect + bit HasLightScreenUp, [hl] ; is mon already protected by light screen? + jr nz, .moveFailed + set HasLightScreenUp, [hl] ; mon is now protected by light screen + ld hl, LightScreenProtectedText + jr .asm_3bbc1 +.reflect + bit HasReflectUp, [hl] ; is mon already protected by reflect? + jr nz, .moveFailed + set HasReflectUp, [hl] ; mon is now protected by reflect + ld hl, ReflectGainedArmorText +.asm_3bbc1 + push hl + ld hl, PlayCurrentMoveAnimation + call BankswitchEtoF + pop hl + jp PrintText +.moveFailed + ld c, $32 + call DelayFrames + ld hl, PrintButItFailedText_ + jp BankswitchEtoF + +LightScreenProtectedText: ; 3bbd7 (e:7bd7) + TX_FAR _LightScreenProtectedText + db "@" + +ReflectGainedArmorText: ; 3bbdc (e:7bdc) + TX_FAR _ReflectGainedArmorText + db "@" + +BankswitchEtoF: ; 3bbe1 (e:7be1) + ld b, BANK(BattleCore) + jp Bankswitch diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm new file mode 100644 index 00000000..6e25712a --- /dev/null +++ b/engine/battle/moveEffects/transform_effect.asm @@ -0,0 +1,138 @@ +TransformEffect_: ; 3bab1 (e:7ab1) + ld hl, wBattleMonSpecies + ld de, wEnemyMonSpecies + ld bc, W_ENEMYBATTSTATUS3 + ld a, [W_ENEMYBATTSTATUS1] + ld a, [H_WHOSETURN] + and a + jr nz, .asm_3bad1 + ld hl, wEnemyMonSpecies + ld de, wBattleMonSpecies + ld bc, W_PLAYERBATTSTATUS3 + ld [wPlayerMoveListIndex], a + ld a, [W_PLAYERBATTSTATUS1] +.asm_3bad1 + bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig) + jp nz, .failed + push hl + push de + push bc + ld hl, W_PLAYERBATTSTATUS2 + ld a, [H_WHOSETURN] + and a + jr z, .asm_3bae4 + ld hl, W_ENEMYBATTSTATUS2 +.asm_3bae4 + bit HasSubstituteUp, [hl] + push af + ld hl, Func_79747 + ld b, BANK(Func_79747) + call nz, Bankswitch + ld a, [W_OPTIONS] + add a + ld hl, PlayCurrentMoveAnimation + ld b, BANK(PlayCurrentMoveAnimation) + jr nc, .asm_3baff + ld hl, AnimationTransformMon + ld b, BANK(AnimationTransformMon) +.asm_3baff + call Bankswitch + ld hl, Func_79771 + ld b, BANK(Func_79771) + pop af + call nz, Bankswitch + pop bc + ld a, [bc] + set Transformed, a + ld [bc], a + pop de + pop hl + push hl + ld a, [hl] + ld [de], a + ld bc, $5 + add hl, bc + inc de + inc de + inc de + inc de + inc de + inc bc + inc bc + call CopyData + ld a, [H_WHOSETURN] + and a + jr z, .asm_3bb32 + ld a, [de] + ld [wcceb], a + inc de + ld a, [de] + ld [wccec], a + dec de +.asm_3bb32 + ld a, [hli] + ld [de], a + inc de + ld a, [hli] + ld [de], a + inc de + inc hl + inc hl + inc hl + inc de + inc de + inc de + ld bc, $8 + call CopyData + ld bc, $ffef + add hl, bc + ld b, $4 +.asm_3bb4a + ld a, [hli] + and a + jr z, .asm_3bb57 + ld a, $5 + ld [de], a + inc de + dec b + jr nz, .asm_3bb4a + jr .asm_3bb5d +.asm_3bb57 + xor a + ld [de], a + inc de + dec b + jr nz, .asm_3bb57 +.asm_3bb5d + pop hl + ld a, [hl] + ld [wd11e], a + call GetMonName + ld hl, wEnemyMonUnmodifiedAttack + ld de, wPlayerMonUnmodifiedAttack + call .copyBasedOnTurn + ld hl, wEnemyMonStatMods + ld de, wPlayerMonStatMods + call .copyBasedOnTurn + ld hl, TransformedText + jp PrintText + +.copyBasedOnTurn + ld a, [H_WHOSETURN] + and a + jr z, .asm_3bb86 + push hl + ld h, d + ld l, e + pop de +.asm_3bb86 + ld bc, $8 + jp CopyData + +.failed + ld hl, PrintButItFailedText_ + jp BankswitchEtoF + +TransformedText: ; 3bb92 (e:7b92) + TX_FAR _TransformedText + db "@" |