2018-06-24 14:09:41 +00:00
|
|
|
_DisappearUser:
|
2015-10-11 16:15:03 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
|
|
|
ldh a, [hBattleTurn]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
2015-11-09 21:41:09 +00:00
|
|
|
jr z, .player
|
|
|
|
call GetEnemyFrontpicCoords
|
|
|
|
jr .okay
|
|
|
|
.player
|
|
|
|
call GetPlayerBackpicCoords
|
|
|
|
.okay
|
2015-10-11 16:15:03 +00:00
|
|
|
call ClearBox
|
2015-11-09 21:41:09 +00:00
|
|
|
jr FinishAppearDisappearUser
|
2015-10-11 16:15:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_AppearUserRaiseSub:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall BattleCommand_RaiseSubNoAnim
|
2015-11-09 21:41:09 +00:00
|
|
|
jr AppearUser
|
2015-10-11 16:15:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_AppearUserLowerSub:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall BattleCommand_LowerSubNoAnim
|
2015-10-11 16:15:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
AppearUser:
|
2015-10-11 16:15:03 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
|
|
|
ldh a, [hBattleTurn]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
2015-11-09 21:41:09 +00:00
|
|
|
jr z, .player
|
|
|
|
call GetEnemyFrontpicCoords
|
2015-10-11 16:15:03 +00:00
|
|
|
xor a
|
2015-11-09 21:41:09 +00:00
|
|
|
jr .okay
|
|
|
|
.player
|
|
|
|
call GetPlayerBackpicCoords
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, $31
|
2015-11-09 21:41:09 +00:00
|
|
|
.okay
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hGraphicStartTile], a
|
2018-01-16 19:30:10 +00:00
|
|
|
predef PlaceGraphic
|
2018-06-24 14:09:41 +00:00
|
|
|
FinishAppearDisappearUser:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-11 16:15:03 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetEnemyFrontpicCoords:
|
2015-10-11 16:15:03 +00:00
|
|
|
hlcoord 12, 0
|
|
|
|
lb bc, 7, 7
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetPlayerBackpicCoords:
|
2015-10-11 16:15:03 +00:00
|
|
|
hlcoord 2, 6
|
|
|
|
lb bc, 6, 6
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DoWeatherModifiers:
|
2018-01-26 02:34:42 +00:00
|
|
|
ld de, WeatherTypeModifiers
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, [wBattleWeather]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld b, a
|
2018-07-28 23:27:34 +00:00
|
|
|
ld a, [wCurType]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckWeatherType:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-07-28 23:27:34 +00:00
|
|
|
cp -1
|
2015-11-09 21:41:09 +00:00
|
|
|
jr z, .done_weather_types
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
cp b
|
|
|
|
jr nz, .NextWeatherType
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
cp c
|
|
|
|
jr z, .ApplyModifier
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NextWeatherType:
|
2015-10-11 16:15:03 +00:00
|
|
|
inc de
|
2016-05-04 15:46:23 +00:00
|
|
|
inc de
|
2015-10-11 16:15:03 +00:00
|
|
|
jr .CheckWeatherType
|
|
|
|
|
2015-11-09 21:41:09 +00:00
|
|
|
.done_weather_types
|
2018-01-26 02:34:42 +00:00
|
|
|
ld de, WeatherMoveModifiers
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
|
|
|
call GetBattleVar
|
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckWeatherMove:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-07-28 23:27:34 +00:00
|
|
|
cp -1
|
2015-10-11 16:15:03 +00:00
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
cp b
|
|
|
|
jr nz, .NextWeatherMove
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
cp c
|
|
|
|
jr z, .ApplyModifier
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NextWeatherMove:
|
2015-10-11 16:15:03 +00:00
|
|
|
inc de
|
2016-05-04 15:46:23 +00:00
|
|
|
inc de
|
2015-10-11 16:15:03 +00:00
|
|
|
jr .CheckWeatherMove
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.ApplyModifier:
|
2015-10-11 16:15:03 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMultiplicand + 0], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wCurDamage
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMultiplicand + 1], a
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, [hl]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMultiplicand + 2], a
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMultiplier], a
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
call Multiply
|
|
|
|
|
|
|
|
ld a, 10
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hDivisor], a
|
2018-07-28 23:27:34 +00:00
|
|
|
ld b, 4
|
2015-10-11 16:15:03 +00:00
|
|
|
call Divide
|
|
|
|
|
2018-08-26 17:49:38 +00:00
|
|
|
ldh a, [hQuotient + 1]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
|
|
|
ld bc, -1
|
|
|
|
jr nz, .Update
|
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hQuotient + 2]
|
2018-08-26 17:49:38 +00:00
|
|
|
ld b, a
|
|
|
|
ldh a, [hQuotient + 3]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld c, a
|
|
|
|
or b
|
|
|
|
jr nz, .Update
|
|
|
|
|
|
|
|
ld bc, 1
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Update:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurDamage], a
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, c
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurDamage + 1], a
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-01-26 02:34:42 +00:00
|
|
|
INCLUDE "data/battle/weather_modifiers.asm"
|
2015-10-11 16:15:03 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DoBadgeTypeBoosts:
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, [wLinkMode]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wInBattleTowerBattle]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2015-10-11 16:15:03 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
2018-01-26 02:34:42 +00:00
|
|
|
ld hl, BadgeTypeBoosts
|
2015-10-11 16:15:03 +00:00
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wKantoBadges]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld b, a
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wJohtoBadges]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckBadge:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, [hl]
|
2018-01-11 03:53:42 +00:00
|
|
|
cp -1
|
2015-10-11 16:15:03 +00:00
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
jr nc, .NextBadge
|
|
|
|
|
2018-07-28 23:27:34 +00:00
|
|
|
ld a, [wCurType]
|
2015-10-11 16:15:03 +00:00
|
|
|
cp [hl]
|
|
|
|
jr z, .ApplyBoost
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NextBadge:
|
2015-10-11 16:15:03 +00:00
|
|
|
inc hl
|
|
|
|
jr .CheckBadge
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.ApplyBoost:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDamage]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld h, a
|
|
|
|
ld d, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDamage + 1]
|
2015-10-11 16:15:03 +00:00
|
|
|
ld l, a
|
|
|
|
ld e, a
|
|
|
|
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
|
|
|
|
ld a, e
|
|
|
|
or d
|
2015-11-09 21:41:09 +00:00
|
|
|
jr nz, .done_min
|
2015-10-11 16:15:03 +00:00
|
|
|
ld e, 1
|
|
|
|
|
2015-11-09 21:41:09 +00:00
|
|
|
.done_min
|
2015-10-11 16:15:03 +00:00
|
|
|
add hl, de
|
|
|
|
jr nc, .Update
|
|
|
|
|
|
|
|
ld hl, $ffff
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Update:
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, h
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurDamage], a
|
2015-10-11 16:15:03 +00:00
|
|
|
ld a, l
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurDamage + 1], a
|
2015-10-11 16:15:03 +00:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-01-28 06:17:32 +00:00
|
|
|
INCLUDE "data/types/badge_type_boosts.asm"
|