pokecrystal-board/engine/battle/misc.asm
Rangi 32ed487a47 Merge branch 'master' of https://github.com/pret/pokecrystal
# 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
2018-02-03 19:42:56 -05:00

229 lines
2.8 KiB
NASM

_DisappearUser: ; fbd54
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
jr .okay
.player
call GetPlayerBackpicCoords
.okay
call ClearBox
jr FinishAppearDisappearUser
_AppearUserRaiseSub: ; fbd69 (3e:7d69)
farcall BattleCommand_RaiseSubNoAnim
jr AppearUser
_AppearUserLowerSub: ; fbd71 (3e:7d71)
farcall BattleCommand_LowerSubNoAnim
AppearUser: ; fbd77 (3e:7d77)
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
xor a
jr .okay
.player
call GetPlayerBackpicCoords
ld a, $31
.okay
ld [hGraphicStartTile], a
predef PlaceGraphic
FinishAppearDisappearUser: ; fbd91 (3e:7d91)
ld a, $1
ld [hBGMapMode], a
ret
GetEnemyFrontpicCoords: ; fbd96 (3e:7d96)
hlcoord 12, 0
lb bc, 7, 7
ret
GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
hlcoord 2, 6
lb bc, 6, 6
ret
DoWeatherModifiers: ; fbda4
ld de, WeatherTypeModifiers
ld a, [wBattleWeather]
ld b, a
ld a, [wd265] ; move type
ld c, a
.CheckWeatherType:
ld a, [de]
inc de
cp $ff
jr z, .done_weather_types
cp b
jr nz, .NextWeatherType
ld a, [de]
cp c
jr z, .ApplyModifier
.NextWeatherType:
inc de
inc de
jr .CheckWeatherType
.done_weather_types
ld de, WeatherMoveModifiers
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
ld c, a
.CheckWeatherMove:
ld a, [de]
inc de
cp $ff
jr z, .done
cp b
jr nz, .NextWeatherMove
ld a, [de]
cp c
jr z, .ApplyModifier
.NextWeatherMove:
inc de
inc de
jr .CheckWeatherMove
.ApplyModifier:
xor a
ld [hMultiplicand + 0], a
ld hl, wCurDamage
ld a, [hli]
ld [hMultiplicand + 1], a
ld a, [hl]
ld [hMultiplicand + 2], a
inc de
ld a, [de]
ld [hMultiplier], a
call Multiply
ld a, 10
ld [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 0]
and a
ld bc, -1
jr nz, .Update
ld a, [hQuotient + 1]
ld b, a
ld a, [hQuotient + 2]
ld c, a
or b
jr nz, .Update
ld bc, 1
.Update:
ld a, b
ld [wCurDamage], a
ld a, c
ld [wCurDamage + 1], a
.done
ret
INCLUDE "data/battle/weather_modifiers.asm"
DoBadgeTypeBoosts: ; fbe24
ld a, [wLinkMode]
and a
ret nz
ld a, [wInBattleTowerBattle]
and a
ret nz
ld a, [hBattleTurn]
and a
ret nz
push de
push bc
ld hl, BadgeTypeBoosts
ld a, [wKantoBadges]
ld b, a
ld a, [wJohtoBadges]
ld c, a
.CheckBadge:
ld a, [hl]
cp -1
jr z, .done
srl b
rr c
jr nc, .NextBadge
ld a, [wd265] ; move type
cp [hl]
jr z, .ApplyBoost
.NextBadge:
inc hl
jr .CheckBadge
.ApplyBoost:
ld a, [wCurDamage]
ld h, a
ld d, a
ld a, [wCurDamage + 1]
ld l, a
ld e, a
srl d
rr e
srl d
rr e
srl d
rr e
ld a, e
or d
jr nz, .done_min
ld e, 1
.done_min
add hl, de
jr nc, .Update
ld hl, $ffff
.Update:
ld a, h
ld [wCurDamage], a
ld a, l
ld [wCurDamage + 1], a
.done
pop bc
pop de
ret
INCLUDE "data/types/badge_type_boosts.asm"