mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Move-unique effect commands consistently go in engine/battle/move_effects/
This commit is contained in:
parent
a0cc4a3392
commit
0cf4eb6895
@ -155,7 +155,7 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en
|
||||
|
||||
([Video](https://www.youtube.com/watch?v=zuCLMikWo4Y))
|
||||
|
||||
This is a bug with `BattleCommand_BellyDrum` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
|
||||
This is a bug with `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm):
|
||||
|
||||
```asm
|
||||
BattleCommand_BellyDrum: ; 37c1a
|
||||
@ -307,7 +307,7 @@ CheckHiddenOpponent: ; 37daa
|
||||
|
||||
([Video](https://www.youtube.com/watch?v=202-iAsrIa8))
|
||||
|
||||
This is a bug with `BattleCommand_BeatUp` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
|
||||
This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm):
|
||||
|
||||
```asm
|
||||
.got_mon
|
||||
@ -346,7 +346,7 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/effect_commands.asm]
|
||||
|
||||
This bug existed for all battles in Gold and Silver, and was only fixed for single-player battles in Crystal to preserve link compatibility.
|
||||
|
||||
This is a bug with `BattleCommand_Present` in [engine/battle/effect_commands/present.asm](/engine/battle/effect_commands/present.asm):
|
||||
This is a bug with `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm):
|
||||
|
||||
```asm
|
||||
BattleCommand_Present: ; 37874
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ BattleCommand_Attract: ; 377ce
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp FailAttract
|
||||
jp FailMove
|
||||
; 377f5
|
||||
|
||||
|
241
engine/battle/move_effects/baton_pass.asm
Normal file
241
engine/battle/move_effects/baton_pass.asm
Normal file
@ -0,0 +1,241 @@
|
||||
BattleCommand_BatonPass: ; 379c9
|
||||
; batonpass
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jp nz, .Enemy
|
||||
|
||||
|
||||
; Need something to switch to
|
||||
call CheckAnyOtherAlivePartyMons
|
||||
jp z, FailedBatonPass
|
||||
|
||||
call UpdateBattleMonInParty
|
||||
call AnimateCurrentMove
|
||||
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
|
||||
; Transition into switchmon menu
|
||||
call LoadStandardMenuHeader
|
||||
farcall SetUpBattlePartyMenu_NoLoop
|
||||
|
||||
farcall ForcePickSwitchMonInBattle
|
||||
|
||||
; Return to battle scene
|
||||
call ClearPalettes
|
||||
farcall _LoadBattleFontsHPBar
|
||||
call CloseWindow
|
||||
call ClearSprites
|
||||
hlcoord 1, 0
|
||||
lb bc, 4, 10
|
||||
call ClearBox
|
||||
ld b, SCGB_BATTLE_COLORS
|
||||
call GetSGBLayout
|
||||
call SetPalettes
|
||||
call BatonPass_LinkPlayerSwitch
|
||||
|
||||
; Mobile link battles handle entrances differently
|
||||
farcall CheckMobileBattleError
|
||||
jp c, EndMoveEffect
|
||||
|
||||
ld hl, PassedBattleMonEntrance
|
||||
call CallBattleCore
|
||||
|
||||
call ResetBatonPassStatus
|
||||
ret
|
||||
|
||||
|
||||
.Enemy:
|
||||
|
||||
; Wildmons don't have anything to switch to
|
||||
ld a, [wBattleMode]
|
||||
dec a ; WILDMON
|
||||
jp z, FailedBatonPass
|
||||
|
||||
call CheckAnyOtherAliveEnemyMons
|
||||
jp z, FailedBatonPass
|
||||
|
||||
call UpdateEnemyMonInParty
|
||||
call AnimateCurrentMove
|
||||
call BatonPass_LinkEnemySwitch
|
||||
|
||||
; Mobile link battles handle entrances differently
|
||||
farcall CheckMobileBattleError
|
||||
jp c, EndMoveEffect
|
||||
|
||||
; Passed enemy PartyMon entrance
|
||||
xor a
|
||||
ld [wEnemySwitchMonIndex], a
|
||||
ld hl, EnemySwitch_SetMode
|
||||
call CallBattleCore
|
||||
ld hl, ResetBattleParticipants
|
||||
call CallBattleCore
|
||||
ld a, 1
|
||||
ld [wTypeMatchup], a
|
||||
ld hl, ApplyStatLevelMultiplierOnAllStats
|
||||
call CallBattleCore
|
||||
|
||||
ld hl, SpikesDamage
|
||||
call CallBattleCore
|
||||
|
||||
jr ResetBatonPassStatus
|
||||
|
||||
; 37a67
|
||||
|
||||
|
||||
BatonPass_LinkPlayerSwitch: ; 37a67
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
ret z
|
||||
|
||||
ld a, 1
|
||||
ld [wPlayerAction], a
|
||||
|
||||
call LoadStandardMenuHeader
|
||||
ld hl, LinkBattleSendReceiveAction
|
||||
call CallBattleCore
|
||||
call CloseWindow
|
||||
|
||||
xor a
|
||||
ld [wPlayerAction], a
|
||||
ret
|
||||
|
||||
; 37a82
|
||||
|
||||
|
||||
BatonPass_LinkEnemySwitch: ; 37a82
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
ret z
|
||||
|
||||
call LoadStandardMenuHeader
|
||||
ld hl, LinkBattleSendReceiveAction
|
||||
call CallBattleCore
|
||||
|
||||
ld a, [OTPartyCount]
|
||||
add BATTLEACTION_SWITCH1
|
||||
ld b, a
|
||||
ld a, [wBattleAction]
|
||||
cp BATTLEACTION_SWITCH1
|
||||
jr c, .baton_pass
|
||||
cp b
|
||||
jr c, .switch
|
||||
|
||||
.baton_pass
|
||||
ld a, [CurOTMon]
|
||||
add BATTLEACTION_SWITCH1
|
||||
ld [wBattleAction], a
|
||||
.switch
|
||||
jp CloseWindow
|
||||
|
||||
; 37aab
|
||||
|
||||
|
||||
FailedBatonPass: ; 37aab
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
|
||||
; 37ab1
|
||||
|
||||
|
||||
ResetBatonPassStatus: ; 37ab1
|
||||
; Reset status changes that aren't passed by Baton Pass.
|
||||
|
||||
; Nightmare isn't passed.
|
||||
ld a, BATTLE_VARS_STATUS
|
||||
call GetBattleVar
|
||||
and SLP
|
||||
jr nz, .ok
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1
|
||||
call GetBattleVarAddr
|
||||
res SUBSTATUS_NIGHTMARE, [hl]
|
||||
.ok
|
||||
|
||||
; Disable isn't passed.
|
||||
call ResetActorDisable
|
||||
|
||||
; Attraction isn't passed.
|
||||
ld hl, PlayerSubStatus1
|
||||
res SUBSTATUS_IN_LOVE, [hl]
|
||||
ld hl, EnemySubStatus1
|
||||
res SUBSTATUS_IN_LOVE, [hl]
|
||||
ld hl, PlayerSubStatus5
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS5
|
||||
call GetBattleVarAddr
|
||||
res SUBSTATUS_TRANSFORMED, [hl]
|
||||
res SUBSTATUS_ENCORED, [hl]
|
||||
|
||||
; New mon hasn't used a move yet.
|
||||
ld a, BATTLE_VARS_LAST_MOVE
|
||||
call GetBattleVarAddr
|
||||
ld [hl], 0
|
||||
|
||||
xor a
|
||||
ld [wPlayerWrapCount], a
|
||||
ld [wEnemyWrapCount], a
|
||||
ret
|
||||
|
||||
; 37ae9
|
||||
|
||||
|
||||
CheckAnyOtherAlivePartyMons: ; 37ae9
|
||||
ld hl, PartyMon1HP
|
||||
ld a, [PartyCount]
|
||||
ld d, a
|
||||
ld a, [CurBattleMon]
|
||||
ld e, a
|
||||
jr CheckAnyOtherAliveMons
|
||||
|
||||
; 37af6
|
||||
|
||||
|
||||
CheckAnyOtherAliveEnemyMons: ; 37af6
|
||||
ld hl, OTPartyMon1HP
|
||||
ld a, [OTPartyCount]
|
||||
ld d, a
|
||||
ld a, [CurOTMon]
|
||||
ld e, a
|
||||
|
||||
; fallthrough
|
||||
; 37b01
|
||||
|
||||
CheckAnyOtherAliveMons: ; 37b01
|
||||
; Check for nonzero HP starting from partymon
|
||||
; HP at hl for d partymons, besides current mon e.
|
||||
|
||||
; Return nz if any are alive.
|
||||
|
||||
xor a
|
||||
ld b, a
|
||||
ld c, a
|
||||
.loop
|
||||
ld a, c
|
||||
cp d
|
||||
jr z, .done
|
||||
cp e
|
||||
jr z, .next
|
||||
|
||||
ld a, [hli]
|
||||
or b
|
||||
ld b, a
|
||||
ld a, [hld]
|
||||
or b
|
||||
ld b, a
|
||||
|
||||
.next
|
||||
push bc
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
pop bc
|
||||
inc c
|
||||
jr .loop
|
||||
|
||||
.done
|
||||
ld a, b
|
||||
and a
|
||||
ret
|
||||
|
||||
; 37b1d
|
219
engine/battle/move_effects/beat_up.asm
Normal file
219
engine/battle/move_effects/beat_up.asm
Normal file
@ -0,0 +1,219 @@
|
||||
BattleCommand_BeatUp: ; 35461
|
||||
; beatup
|
||||
|
||||
call ResetDamage
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jp nz, .enemy_beats_up
|
||||
ld a, [PlayerSubStatus3]
|
||||
bit SUBSTATUS_IN_LOOP, a
|
||||
jr nz, .next_mon
|
||||
ld c, 20
|
||||
call DelayFrames
|
||||
xor a
|
||||
ld [PlayerRolloutCount], a
|
||||
ld [wd002], a
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
jr .got_mon
|
||||
|
||||
.next_mon
|
||||
ld a, [PlayerRolloutCount]
|
||||
ld b, a
|
||||
ld a, [PartyCount]
|
||||
sub b
|
||||
ld [wd002], a
|
||||
|
||||
.got_mon
|
||||
ld a, [wd002]
|
||||
ld hl, PartyMonNicknames
|
||||
call GetNick
|
||||
ld a, MON_HP
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
jp z, .beatup_fail ; fainted
|
||||
ld a, [wd002]
|
||||
ld c, a
|
||||
ld a, [CurBattleMon]
|
||||
; BUG: this can desynchronize link battles
|
||||
; Change "cp [hl]" to "cp c" to fix
|
||||
cp [hl]
|
||||
ld hl, BattleMonStatus
|
||||
jr z, .active_mon
|
||||
ld a, MON_STATUS
|
||||
call GetBeatupMonLocation
|
||||
.active_mon
|
||||
ld a, [hl]
|
||||
and a
|
||||
jp nz, .beatup_fail
|
||||
|
||||
ld a, $1
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
ld hl, BeatUpAttackText
|
||||
call StdBattleTextBox
|
||||
ld a, [EnemyMonSpecies]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseDefense]
|
||||
ld c, a
|
||||
push bc
|
||||
ld a, MON_SPECIES
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseAttack]
|
||||
pop bc
|
||||
ld b, a
|
||||
push bc
|
||||
ld a, MON_LEVEL
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld e, a
|
||||
pop bc
|
||||
ld a, [wPlayerMoveStructPower]
|
||||
ld d, a
|
||||
ret
|
||||
|
||||
.enemy_beats_up
|
||||
ld a, [EnemySubStatus3]
|
||||
bit SUBSTATUS_IN_LOOP, a
|
||||
jr nz, .not_first_enemy_beatup
|
||||
|
||||
xor a
|
||||
ld [EnemyRolloutCount], a
|
||||
ld [wd002], a
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
jr .enemy_continue
|
||||
|
||||
.not_first_enemy_beatup
|
||||
ld a, [EnemyRolloutCount]
|
||||
ld b, a
|
||||
ld a, [OTPartyCount]
|
||||
sub b
|
||||
ld [wd002], a
|
||||
.enemy_continue
|
||||
ld a, [wBattleMode]
|
||||
dec a
|
||||
jr z, .wild
|
||||
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
jr nz, .link_or_tower
|
||||
|
||||
ld a, [InBattleTowerBattle]
|
||||
and a
|
||||
jr nz, .link_or_tower
|
||||
|
||||
ld a, [wd002]
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, OTPartySpecies
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
call GetPokemonName
|
||||
jr .got_enemy_nick
|
||||
|
||||
.link_or_tower
|
||||
ld a, [wd002]
|
||||
ld hl, OTPartyMonNicknames
|
||||
ld bc, NAME_LENGTH
|
||||
call AddNTimes
|
||||
ld de, StringBuffer1
|
||||
call CopyBytes
|
||||
.got_enemy_nick
|
||||
ld a, MON_HP
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
jp z, .beatup_fail
|
||||
ld a, [wd002]
|
||||
ld b, a
|
||||
ld a, [CurOTMon]
|
||||
cp b
|
||||
ld hl, EnemyMonStatus
|
||||
jr z, .active_enemy
|
||||
|
||||
ld a, MON_STATUS
|
||||
call GetBeatupMonLocation
|
||||
.active_enemy
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr nz, .beatup_fail
|
||||
|
||||
ld a, $1
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
jr .finish_beatup
|
||||
|
||||
.wild
|
||||
ld a, [EnemyMonSpecies]
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
call GetPokemonName
|
||||
ld hl, BeatUpAttackText
|
||||
call StdBattleTextBox
|
||||
jp EnemyAttackDamage
|
||||
|
||||
.finish_beatup
|
||||
ld hl, BeatUpAttackText
|
||||
call StdBattleTextBox
|
||||
ld a, [BattleMonSpecies]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseDefense]
|
||||
ld c, a
|
||||
push bc
|
||||
ld a, MON_SPECIES
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseAttack]
|
||||
pop bc
|
||||
ld b, a
|
||||
push bc
|
||||
ld a, MON_LEVEL
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld e, a
|
||||
pop bc
|
||||
ld a, [wEnemyMoveStructPower]
|
||||
ld d, a
|
||||
ret
|
||||
|
||||
; 355b0
|
||||
|
||||
|
||||
.beatup_fail ; 355b0
|
||||
ld b, buildopponentrage_command
|
||||
jp SkipToBattleCommand
|
||||
|
||||
; 355b5
|
||||
|
||||
|
||||
BattleCommanda8: ; 355b5
|
||||
ld a, [wBeatUpHitAtLeastOnce]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
jp PrintButItFailed
|
||||
|
||||
; 355bd
|
||||
|
||||
|
||||
GetBeatupMonLocation: ; 355bd
|
||||
push bc
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, PartyMon1Species
|
||||
jr z, .got_species
|
||||
ld hl, OTPartyMon1Species
|
||||
|
||||
.got_species
|
||||
ld a, [wd002]
|
||||
add hl, bc
|
||||
call GetPartyLocation
|
||||
pop bc
|
||||
ret
|
36
engine/battle/move_effects/belly_drum.asm
Normal file
36
engine/battle/move_effects/belly_drum.asm
Normal file
@ -0,0 +1,36 @@
|
||||
BattleCommand_BellyDrum: ; 37c1a
|
||||
; bellydrum
|
||||
; This command is buggy because it raises the user's attack
|
||||
; before checking that it has enough HP to use the move.
|
||||
; Swap the order of these two blocks to fix.
|
||||
call BattleCommand_AttackUp2
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
jr nz, .failed
|
||||
|
||||
callfar GetHalfMaxHP
|
||||
callfar CheckUserHasEnoughHP
|
||||
jr nc, .failed
|
||||
|
||||
push bc
|
||||
call AnimateCurrentMove
|
||||
pop bc
|
||||
callfar SubtractHPFromUser
|
||||
call UpdateUserInParty
|
||||
ld a, 5
|
||||
|
||||
.max_attack_loop
|
||||
push af
|
||||
call BattleCommand_AttackUp2
|
||||
pop af
|
||||
dec a
|
||||
jr nz, .max_attack_loop
|
||||
|
||||
ld hl, BellyDrumText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
|
||||
; 37c55
|
105
engine/battle/move_effects/bide.asm
Normal file
105
engine/battle/move_effects/bide.asm
Normal file
@ -0,0 +1,105 @@
|
||||
BattleCommand_StoreEnergy: ; 36671
|
||||
; storeenergy
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS3
|
||||
call GetBattleVar
|
||||
bit SUBSTATUS_BIDE, a
|
||||
ret z
|
||||
|
||||
ld hl, PlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .check_still_storing_energy
|
||||
ld hl, EnemyRolloutCount
|
||||
.check_still_storing_energy
|
||||
dec [hl]
|
||||
jr nz, .still_storing
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS3
|
||||
call GetBattleVarAddr
|
||||
res SUBSTATUS_BIDE, [hl]
|
||||
|
||||
ld hl, UnleashedEnergyText
|
||||
call StdBattleTextBox
|
||||
|
||||
ld a, BATTLE_VARS_MOVE_POWER
|
||||
call GetBattleVarAddr
|
||||
ld a, 1
|
||||
ld [hl], a
|
||||
ld hl, PlayerDamageTaken + 1
|
||||
ld de, wPlayerCharging ; player
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .player
|
||||
ld hl, EnemyDamageTaken + 1
|
||||
ld de, wEnemyCharging ; enemy
|
||||
.player
|
||||
ld a, [hld]
|
||||
add a
|
||||
ld b, a
|
||||
ld [CurDamage + 1], a
|
||||
ld a, [hl]
|
||||
rl a
|
||||
ld [CurDamage], a
|
||||
jr nc, .not_maxed
|
||||
ld a, $ff
|
||||
ld [CurDamage], a
|
||||
ld [CurDamage + 1], a
|
||||
.not_maxed
|
||||
or b
|
||||
jr nz, .built_up_something
|
||||
ld a, 1
|
||||
ld [AttackMissed], a
|
||||
.built_up_something
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld [de], a
|
||||
|
||||
ld a, BATTLE_VARS_MOVE_ANIM
|
||||
call GetBattleVarAddr
|
||||
ld a, BIDE
|
||||
ld [hl], a
|
||||
|
||||
ld b, unleashenergy_command
|
||||
jp SkipToBattleCommand
|
||||
|
||||
.still_storing
|
||||
ld hl, StoringEnergyText
|
||||
call StdBattleTextBox
|
||||
jp EndMoveEffect
|
||||
|
||||
; 366e5
|
||||
|
||||
|
||||
BattleCommand_UnleashEnergy: ; 366e5
|
||||
; unleashenergy
|
||||
|
||||
ld de, PlayerDamageTaken
|
||||
ld bc, PlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_damage
|
||||
ld de, EnemyDamageTaken
|
||||
ld bc, EnemyRolloutCount
|
||||
.got_damage
|
||||
ld a, BATTLE_VARS_SUBSTATUS3
|
||||
call GetBattleVarAddr
|
||||
set SUBSTATUS_BIDE, [hl]
|
||||
xor a
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [de], a
|
||||
ld [wPlayerMoveStructEffect], a
|
||||
ld [wEnemyMoveStructEffect], a
|
||||
call BattleRandom
|
||||
and 1
|
||||
inc a
|
||||
inc a
|
||||
ld [bc], a
|
||||
ld a, 1
|
||||
ld [wKickCounter], a
|
||||
call AnimateCurrentMove
|
||||
jp EndMoveEffect
|
||||
|
||||
; 3671a
|
98
engine/battle/move_effects/conversion.asm
Normal file
98
engine/battle/move_effects/conversion.asm
Normal file
@ -0,0 +1,98 @@
|
||||
BattleCommand_Conversion: ; 3707f
|
||||
; conversion
|
||||
|
||||
ld hl, BattleMonMoves
|
||||
ld de, BattleMonType1
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_moves
|
||||
ld hl, EnemyMonMoves
|
||||
ld de, EnemyMonType1
|
||||
.got_moves
|
||||
push de
|
||||
ld c, 0
|
||||
ld de, StringBuffer1
|
||||
.loop
|
||||
push hl
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
pop hl
|
||||
and a
|
||||
jr z, .okay
|
||||
push hl
|
||||
push bc
|
||||
dec a
|
||||
ld hl, Moves + MOVE_TYPE
|
||||
call GetMoveAttr
|
||||
ld [de], a
|
||||
inc de
|
||||
pop bc
|
||||
pop hl
|
||||
inc c
|
||||
ld a, c
|
||||
cp NUM_MOVES
|
||||
jr c, .loop
|
||||
.okay
|
||||
ld a, $ff
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [de], a
|
||||
pop de
|
||||
ld hl, StringBuffer1
|
||||
.loop2
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
jr z, .fail
|
||||
cp CURSE_T
|
||||
jr z, .next
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
jr z, .next
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
cp [hl]
|
||||
jr nz, .done
|
||||
.next
|
||||
inc hl
|
||||
jr .loop2
|
||||
|
||||
.fail
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
|
||||
.done
|
||||
.loop3
|
||||
call BattleRandom
|
||||
maskbits NUM_MOVES
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, StringBuffer1
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
jr z, .loop3
|
||||
cp CURSE_T
|
||||
jr z, .loop3
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
jr z, .loop3
|
||||
inc de
|
||||
ld a, [de]
|
||||
dec de
|
||||
cp [hl]
|
||||
jr z, .loop3
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [de], a
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
farcall GetTypeName
|
||||
call AnimateCurrentMove
|
||||
ld hl, TransformedTypeText
|
||||
jp StdBattleTextBox
|
||||
|
||||
; 3710e
|
66
engine/battle/move_effects/conversion2.asm
Normal file
66
engine/battle/move_effects/conversion2.asm
Normal file
@ -0,0 +1,66 @@
|
||||
BattleCommand_Conversion2: ; 359e6
|
||||
; conversion2
|
||||
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
jr nz, .failed
|
||||
ld hl, BattleMonType1
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_type
|
||||
ld hl, EnemyMonType1
|
||||
.got_type
|
||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||
call GetBattleVar
|
||||
and a
|
||||
jr z, .failed
|
||||
push hl
|
||||
dec a
|
||||
ld hl, Moves + MOVE_TYPE
|
||||
call GetMoveAttr
|
||||
ld d, a
|
||||
pop hl
|
||||
cp CURSE_T
|
||||
jr z, .failed
|
||||
call AnimateCurrentMove
|
||||
call BattleCommand_SwitchTurn
|
||||
|
||||
.loop
|
||||
call BattleRandom
|
||||
and $1f
|
||||
cp UNUSED_TYPES
|
||||
jr c, .okay
|
||||
cp UNUSED_TYPES_END
|
||||
jr c, .loop
|
||||
cp TYPES_END
|
||||
jr nc, .loop
|
||||
.okay
|
||||
ld [hli], a
|
||||
ld [hld], a
|
||||
push hl
|
||||
ld a, BATTLE_VARS_MOVE_TYPE
|
||||
call GetBattleVarAddr
|
||||
push af
|
||||
push hl
|
||||
ld a, d
|
||||
ld [hl], a
|
||||
call BattleCheckTypeMatchup
|
||||
pop hl
|
||||
pop af
|
||||
ld [hl], a
|
||||
pop hl
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10
|
||||
jr nc, .loop
|
||||
call BattleCommand_SwitchTurn
|
||||
|
||||
ld a, [hl]
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
predef GetTypeName
|
||||
ld hl, TransformedTypeText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp FailMove
|
||||
|
||||
; 35a53
|
60
engine/battle/move_effects/counter.asm
Normal file
60
engine/battle/move_effects/counter.asm
Normal file
@ -0,0 +1,60 @@
|
||||
BattleCommand_Counter: ; 35813
|
||||
; counter
|
||||
|
||||
ld a, 1
|
||||
ld [AttackMissed], a
|
||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||
call GetBattleVar
|
||||
and a
|
||||
ret z
|
||||
|
||||
ld b, a
|
||||
callfar GetMoveEffect
|
||||
ld a, b
|
||||
cp EFFECT_COUNTER
|
||||
ret z
|
||||
|
||||
call BattleCommand_ResetTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
and a
|
||||
ret z
|
||||
|
||||
call CheckOpponentWentFirst
|
||||
ret z
|
||||
|
||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||
call GetBattleVar
|
||||
dec a
|
||||
ld de, StringBuffer1
|
||||
call GetMoveData
|
||||
|
||||
ld a, [StringBuffer1 + MOVE_POWER]
|
||||
and a
|
||||
ret z
|
||||
|
||||
ld a, [StringBuffer1 + MOVE_TYPE]
|
||||
cp SPECIAL
|
||||
ret nc
|
||||
|
||||
ld hl, CurDamage
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
ret z
|
||||
|
||||
ld a, [hl]
|
||||
add a
|
||||
ld [hld], a
|
||||
ld a, [hl]
|
||||
adc a
|
||||
ld [hl], a
|
||||
jr nc, .capped
|
||||
ld a, $ff
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
.capped
|
||||
|
||||
xor a
|
||||
ld [AttackMissed], a
|
||||
ret
|
||||
|
||||
; 35864
|
11
engine/battle/move_effects/destiny_bond.asm
Normal file
11
engine/battle/move_effects/destiny_bond.asm
Normal file
@ -0,0 +1,11 @@
|
||||
BattleCommand_DestinyBond: ; 35bff
|
||||
; destinybond
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS5
|
||||
call GetBattleVarAddr
|
||||
set SUBSTATUS_DESTINY_BOND, [hl]
|
||||
call AnimateCurrentMove
|
||||
ld hl, DestinyBondEffectText
|
||||
jp StdBattleTextBox
|
||||
|
||||
; 35c0f
|
74
engine/battle/move_effects/disable.asm
Normal file
74
engine/battle/move_effects/disable.asm
Normal file
@ -0,0 +1,74 @@
|
||||
BattleCommand_Disable: ; 36fed
|
||||
; disable
|
||||
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
jr nz, .failed
|
||||
|
||||
ld de, EnemyDisableCount
|
||||
ld hl, EnemyMonMoves
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_moves
|
||||
ld de, PlayerDisableCount
|
||||
ld hl, BattleMonMoves
|
||||
.got_moves
|
||||
|
||||
ld a, [de]
|
||||
and a
|
||||
jr nz, .failed
|
||||
|
||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||
call GetBattleVar
|
||||
and a
|
||||
jr z, .failed
|
||||
cp STRUGGLE
|
||||
jr z, .failed
|
||||
|
||||
ld b, a
|
||||
ld c, $ff
|
||||
.loop
|
||||
inc c
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr nz, .loop
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, EnemyMonPP
|
||||
jr z, .got_pp
|
||||
ld hl, BattleMonPP
|
||||
.got_pp
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .failed
|
||||
.loop2
|
||||
call BattleRandom
|
||||
and 7
|
||||
jr z, .loop2
|
||||
inc a
|
||||
inc c
|
||||
swap c
|
||||
add c
|
||||
ld [de], a
|
||||
call AnimateCurrentMove
|
||||
ld hl, DisabledMove
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr nz, .got_disabled_move_pointer
|
||||
inc hl
|
||||
.got_disabled_move_pointer
|
||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||
call GetBattleVar
|
||||
ld [hl], a
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
call GetMoveName
|
||||
ld hl, WasDisabledText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp FailMove
|
||||
|
||||
; 3705c
|
122
engine/battle/move_effects/encore.asm
Normal file
122
engine/battle/move_effects/encore.asm
Normal file
@ -0,0 +1,122 @@
|
||||
BattleCommand_Encore: ; 35864
|
||||
; encore
|
||||
|
||||
ld hl, EnemyMonMoves
|
||||
ld de, EnemyEncoreCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .ok
|
||||
ld hl, BattleMonMoves
|
||||
ld de, PlayerEncoreCount
|
||||
.ok
|
||||
ld a, BATTLE_VARS_LAST_MOVE_OPP
|
||||
call GetBattleVar
|
||||
and a
|
||||
jp z, .failed
|
||||
cp STRUGGLE
|
||||
jp z, .failed
|
||||
cp ENCORE
|
||||
jp z, .failed
|
||||
cp MIRROR_MOVE
|
||||
jp z, .failed
|
||||
ld b, a
|
||||
|
||||
.got_move
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr nz, .got_move
|
||||
|
||||
ld bc, BattleMonPP - BattleMonMoves - 1
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and PP_MASK
|
||||
jp z, .failed
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
jp nz, .failed
|
||||
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
||||
call GetBattleVarAddr
|
||||
bit SUBSTATUS_ENCORED, [hl]
|
||||
jp nz, .failed
|
||||
set SUBSTATUS_ENCORED, [hl]
|
||||
call BattleRandom
|
||||
and $3
|
||||
inc a
|
||||
inc a
|
||||
inc a
|
||||
ld [de], a
|
||||
call CheckOpponentWentFirst
|
||||
jr nz, .finish_move
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .force_last_enemy_move
|
||||
|
||||
push hl
|
||||
ld a, [LastPlayerMove]
|
||||
ld b, a
|
||||
ld c, 0
|
||||
ld hl, BattleMonMoves
|
||||
.find_player_move
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr z, .got_player_move
|
||||
inc c
|
||||
ld a, c
|
||||
cp NUM_MOVES
|
||||
jr c, .find_player_move
|
||||
pop hl
|
||||
res SUBSTATUS_ENCORED, [hl]
|
||||
xor a
|
||||
ld [de], a
|
||||
jr .failed
|
||||
|
||||
.got_player_move
|
||||
pop hl
|
||||
ld a, c
|
||||
ld [CurMoveNum], a
|
||||
ld a, b
|
||||
ld [CurPlayerMove], a
|
||||
dec a
|
||||
ld de, wPlayerMoveStruct
|
||||
call GetMoveData
|
||||
jr .finish_move
|
||||
|
||||
.force_last_enemy_move
|
||||
push hl
|
||||
ld a, [LastEnemyMove]
|
||||
ld b, a
|
||||
ld c, 0
|
||||
ld hl, EnemyMonMoves
|
||||
.find_enemy_move
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr z, .got_enemy_move
|
||||
inc c
|
||||
ld a, c
|
||||
cp NUM_MOVES
|
||||
jr c, .find_enemy_move
|
||||
pop hl
|
||||
res SUBSTATUS_ENCORED, [hl]
|
||||
xor a
|
||||
ld [de], a
|
||||
jr .failed
|
||||
|
||||
.got_enemy_move
|
||||
pop hl
|
||||
ld a, c
|
||||
ld [CurEnemyMoveNum], a
|
||||
ld a, b
|
||||
ld [CurEnemyMove], a
|
||||
dec a
|
||||
ld de, wEnemyMoveStruct
|
||||
call GetMoveData
|
||||
|
||||
.finish_move
|
||||
call AnimateCurrentMove
|
||||
ld hl, GotAnEncoreText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp PrintDidntAffect2
|
||||
|
||||
; 35926
|
44
engine/battle/move_effects/false_swipe.asm
Normal file
44
engine/battle/move_effects/false_swipe.asm
Normal file
@ -0,0 +1,44 @@
|
||||
BattleCommand_FalseSwipe: ; 35c94
|
||||
; falseswipe
|
||||
|
||||
ld hl, EnemyMonHP
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_hp
|
||||
ld hl, BattleMonHP
|
||||
.got_hp
|
||||
ld de, CurDamage
|
||||
ld c, 2
|
||||
push hl
|
||||
push de
|
||||
call StringCmp
|
||||
pop de
|
||||
pop hl
|
||||
jr c, .done
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
dec a
|
||||
ld [de], a
|
||||
inc a
|
||||
jr nz, .okay
|
||||
dec de
|
||||
ld a, [de]
|
||||
dec a
|
||||
ld [de], a
|
||||
.okay
|
||||
ld a, [CriticalHit]
|
||||
cp 2
|
||||
jr nz, .carry
|
||||
xor a
|
||||
ld [CriticalHit], a
|
||||
.carry
|
||||
scf
|
||||
ret
|
||||
|
||||
.done
|
||||
and a
|
||||
ret
|
||||
|
||||
; 35cc9
|
17
engine/battle/move_effects/focus_energy.asm
Normal file
17
engine/battle/move_effects/focus_energy.asm
Normal file
@ -0,0 +1,17 @@
|
||||
BattleCommand_FocusEnergy: ; 36c98
|
||||
; focusenergy
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS4
|
||||
call GetBattleVarAddr
|
||||
bit SUBSTATUS_FOCUS_ENERGY, [hl]
|
||||
jr nz, .already_pumped
|
||||
set SUBSTATUS_FOCUS_ENERGY, [hl]
|
||||
call AnimateCurrentMove
|
||||
ld hl, GettingPumpedText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.already_pumped
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
|
||||
; 36cb2
|
@ -19,5 +19,5 @@ BattleCommand_Foresight: ; 376a0
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp FailForesight
|
||||
jp FailMove
|
||||
; 376c2
|
29
engine/battle/move_effects/frustration.asm
Normal file
29
engine/battle/move_effects/frustration.asm
Normal file
@ -0,0 +1,29 @@
|
||||
BattleCommand_FrustrationPower: ; 3790e
|
||||
; frustrationpower
|
||||
|
||||
push bc
|
||||
ld hl, BattleMonHappiness
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_happiness
|
||||
ld hl, EnemyMonHappiness
|
||||
.got_happiness
|
||||
ld a, $ff
|
||||
sub [hl]
|
||||
ld [hMultiplicand + 2], a
|
||||
xor a
|
||||
ld [hMultiplicand + 0], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, 10
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, 25
|
||||
ld [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
ld a, [hQuotient + 2]
|
||||
ld d, a
|
||||
pop bc
|
||||
ret
|
||||
|
||||
; 37939
|
61
engine/battle/move_effects/fury_cutter.asm
Normal file
61
engine/battle/move_effects/fury_cutter.asm
Normal file
@ -0,0 +1,61 @@
|
||||
BattleCommand_FuryCutter: ; 37792
|
||||
; furycutter
|
||||
|
||||
ld hl, PlayerFuryCutterCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .go
|
||||
ld hl, EnemyFuryCutterCount
|
||||
|
||||
.go
|
||||
ld a, [AttackMissed]
|
||||
and a
|
||||
jp nz, ResetFuryCutterCount
|
||||
|
||||
inc [hl]
|
||||
|
||||
; Damage capped at 5 turns' worth (16x).
|
||||
ld a, [hl]
|
||||
ld b, a
|
||||
cp 6
|
||||
jr c, .checkdouble
|
||||
ld b, 5
|
||||
|
||||
.checkdouble
|
||||
dec b
|
||||
ret z
|
||||
|
||||
; Double the damage
|
||||
ld hl, CurDamage + 1
|
||||
sla [hl]
|
||||
dec hl
|
||||
rl [hl]
|
||||
jr nc, .checkdouble
|
||||
|
||||
; No overflow
|
||||
ld a, $ff
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
; 377be
|
||||
|
||||
|
||||
ResetFuryCutterCount: ; 377be
|
||||
|
||||
push hl
|
||||
|
||||
ld hl, PlayerFuryCutterCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .reset
|
||||
ld hl, EnemyFuryCutterCount
|
||||
|
||||
.reset
|
||||
xor a
|
||||
ld [hl], a
|
||||
|
||||
pop hl
|
||||
ret
|
||||
|
||||
; 377ce
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user