mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
32ed487a47
# Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
220 lines
3.4 KiB
NASM
220 lines
3.4 KiB
NASM
BattleCommand_BeatUp: ; 35461
|
|
; beatup
|
|
|
|
call ResetDamage
|
|
ld a, [hBattleTurn]
|
|
and a
|
|
jp nz, .enemy_beats_up
|
|
ld a, [wPlayerSubStatus3]
|
|
bit SUBSTATUS_IN_LOOP, a
|
|
jr nz, .next_mon
|
|
ld c, 20
|
|
call DelayFrames
|
|
xor a
|
|
ld [wPlayerRolloutCount], a
|
|
ld [wd002], a
|
|
ld [wBeatUpHitAtLeastOnce], a
|
|
jr .got_mon
|
|
|
|
.next_mon
|
|
ld a, [wPlayerRolloutCount]
|
|
ld b, a
|
|
ld a, [wPartyCount]
|
|
sub b
|
|
ld [wd002], a
|
|
|
|
.got_mon
|
|
ld a, [wd002]
|
|
ld hl, wPartyMonNicknames
|
|
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, [wCurBattleMon]
|
|
; BUG: this can desynchronize link battles
|
|
; Change "cp [hl]" to "cp c" to fix
|
|
cp [hl]
|
|
ld hl, wBattleMonStatus
|
|
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, [wEnemyMonSpecies]
|
|
ld [wCurSpecies], a
|
|
call GetBaseData
|
|
ld a, [wBaseDefense]
|
|
ld c, a
|
|
push bc
|
|
ld a, MON_SPECIES
|
|
call GetBeatupMonLocation
|
|
ld a, [hl]
|
|
ld [wCurSpecies], a
|
|
call GetBaseData
|
|
ld a, [wBaseAttack]
|
|
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, [wEnemySubStatus3]
|
|
bit SUBSTATUS_IN_LOOP, a
|
|
jr nz, .not_first_enemy_beatup
|
|
|
|
xor a
|
|
ld [wEnemyRolloutCount], a
|
|
ld [wd002], a
|
|
ld [wBeatUpHitAtLeastOnce], a
|
|
jr .enemy_continue
|
|
|
|
.not_first_enemy_beatup
|
|
ld a, [wEnemyRolloutCount]
|
|
ld b, a
|
|
ld a, [wOTPartyCount]
|
|
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, [wInBattleTowerBattle]
|
|
and a
|
|
jr nz, .link_or_tower
|
|
|
|
ld a, [wd002]
|
|
ld c, a
|
|
ld b, 0
|
|
ld hl, wOTPartySpecies
|
|
add hl, bc
|
|
ld a, [hl]
|
|
ld [wNamedObjectIndexBuffer], a
|
|
call GetPokemonName
|
|
jr .got_enemy_nick
|
|
|
|
.link_or_tower
|
|
ld a, [wd002]
|
|
ld hl, wOTPartyMonNicknames
|
|
ld bc, NAME_LENGTH
|
|
call AddNTimes
|
|
ld de, wStringBuffer1
|
|
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, [wCurOTMon]
|
|
cp b
|
|
ld hl, wEnemyMonStatus
|
|
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, [wEnemyMonSpecies]
|
|
ld [wNamedObjectIndexBuffer], a
|
|
call GetPokemonName
|
|
ld hl, BeatUpAttackText
|
|
call StdBattleTextBox
|
|
jp EnemyAttackDamage
|
|
|
|
.finish_beatup
|
|
ld hl, BeatUpAttackText
|
|
call StdBattleTextBox
|
|
ld a, [wBattleMonSpecies]
|
|
ld [wCurSpecies], a
|
|
call GetBaseData
|
|
ld a, [wBaseDefense]
|
|
ld c, a
|
|
push bc
|
|
ld a, MON_SPECIES
|
|
call GetBeatupMonLocation
|
|
ld a, [hl]
|
|
ld [wCurSpecies], a
|
|
call GetBaseData
|
|
ld a, [wBaseAttack]
|
|
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, wPartyMon1Species
|
|
jr z, .got_species
|
|
ld hl, wOTPartyMon1Species
|
|
|
|
.got_species
|
|
ld a, [wd002]
|
|
add hl, bc
|
|
call GetPartyLocation
|
|
pop bc
|
|
ret
|