2015-11-09 13:41:09 -08:00
|
|
|
_DisappearUser: ; fbd54
|
2015-10-11 09:15:03 -07:00
|
|
|
xor a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, [hBattleTurn]
|
2015-10-11 09:15:03 -07:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .player
|
|
|
|
call GetEnemyFrontpicCoords
|
|
|
|
jr .okay
|
|
|
|
.player
|
|
|
|
call GetPlayerBackpicCoords
|
|
|
|
.okay
|
2015-10-11 09:15:03 -07:00
|
|
|
call ClearBox
|
2015-11-09 13:41:09 -08:00
|
|
|
jr FinishAppearDisappearUser
|
2015-10-11 09:15:03 -07:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
_AppearUserRaiseSub: ; fbd69 (3e:7d69)
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BattleCommand_RaiseSubNoAnim
|
2015-11-09 13:41:09 -08:00
|
|
|
jr AppearUser
|
2015-10-11 09:15:03 -07:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
_AppearUserLowerSub: ; fbd71 (3e:7d71)
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BattleCommand_LowerSubNoAnim
|
2015-10-11 09:15:03 -07:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
AppearUser: ; fbd77 (3e:7d77)
|
2015-10-11 09:15:03 -07:00
|
|
|
xor a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, [hBattleTurn]
|
2015-10-11 09:15:03 -07:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .player
|
|
|
|
call GetEnemyFrontpicCoords
|
2015-10-11 09:15:03 -07:00
|
|
|
xor a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr .okay
|
|
|
|
.player
|
|
|
|
call GetPlayerBackpicCoords
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, $31
|
2015-11-09 13:41:09 -08:00
|
|
|
.okay
|
2016-01-12 09:46:18 -08:00
|
|
|
ld [hGraphicStartTile], a
|
|
|
|
predef PlaceGraphic
|
2015-11-09 13:41:09 -08:00
|
|
|
FinishAppearDisappearUser: ; fbd91 (3e:7d91)
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, $1
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hBGMapMode], a
|
2015-10-11 09:15:03 -07:00
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
GetEnemyFrontpicCoords: ; fbd96 (3e:7d96)
|
2015-10-11 09:15:03 -07:00
|
|
|
hlcoord 12, 0
|
|
|
|
lb bc, 7, 7
|
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
|
2015-10-11 09:15:03 -07:00
|
|
|
hlcoord 2, 6
|
|
|
|
lb bc, 6, 6
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
DoWeatherModifiers: ; fbda4
|
|
|
|
|
|
|
|
ld de, .WeatherTypeModifiers
|
|
|
|
ld a, [Weather]
|
|
|
|
ld b, a
|
|
|
|
ld a, [wd265] ; move type
|
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckWeatherType:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp $ff
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .done_weather_types
|
2015-10-11 09:15:03 -07:00
|
|
|
|
|
|
|
cp b
|
|
|
|
jr nz, .NextWeatherType
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
cp c
|
|
|
|
jr z, .ApplyModifier
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NextWeatherType:
|
2015-10-11 09:15:03 -07:00
|
|
|
inc de
|
2016-05-04 08:46:23 -07:00
|
|
|
inc de
|
2015-10-11 09:15:03 -07:00
|
|
|
jr .CheckWeatherType
|
|
|
|
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.done_weather_types
|
2015-10-11 09:15:03 -07:00
|
|
|
ld de, .WeatherMoveModifiers
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_MOVE_EFFECT
|
|
|
|
call GetBattleVar
|
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckWeatherMove:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp $ff
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
cp b
|
|
|
|
jr nz, .NextWeatherMove
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
cp c
|
|
|
|
jr z, .ApplyModifier
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NextWeatherMove:
|
2015-10-11 09:15:03 -07:00
|
|
|
inc de
|
2016-05-04 08:46:23 -07:00
|
|
|
inc de
|
2015-10-11 09:15:03 -07:00
|
|
|
jr .CheckWeatherMove
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.ApplyModifier:
|
2015-10-11 09:15:03 -07:00
|
|
|
xor a
|
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
ld hl, CurDamage
|
|
|
|
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
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Update:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, b
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld a, c
|
|
|
|
ld [CurDamage + 1], a
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.WeatherTypeModifiers:
|
2015-10-11 09:15:03 -07:00
|
|
|
db WEATHER_RAIN, WATER, 15
|
|
|
|
db WEATHER_RAIN, FIRE, 05
|
|
|
|
db WEATHER_SUN, FIRE, 15
|
|
|
|
db WEATHER_SUN, WATER, 05
|
|
|
|
db $ff
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.WeatherMoveModifiers:
|
2015-10-11 09:15:03 -07:00
|
|
|
db WEATHER_RAIN, EFFECT_SOLARBEAM, 05
|
|
|
|
db $ff
|
|
|
|
; fbe24
|
|
|
|
|
|
|
|
|
|
|
|
DoBadgeTypeBoosts: ; fbe24
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2015-10-11 09:15:03 -07:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, [InBattleTowerBattle]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
|
|
|
ld hl, .BadgeTypes
|
|
|
|
|
|
|
|
ld a, [KantoBadges]
|
|
|
|
ld b, a
|
|
|
|
ld a, [JohtoBadges]
|
|
|
|
ld c, a
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckBadge:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
jr nc, .NextBadge
|
|
|
|
|
|
|
|
ld a, [wd265] ; move type
|
|
|
|
cp [hl]
|
|
|
|
jr z, .ApplyBoost
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NextBadge:
|
2015-10-11 09:15:03 -07:00
|
|
|
inc hl
|
|
|
|
jr .CheckBadge
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.ApplyBoost:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, [CurDamage]
|
|
|
|
ld h, a
|
|
|
|
ld d, a
|
|
|
|
ld a, [CurDamage + 1]
|
|
|
|
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 13:41:09 -08:00
|
|
|
jr nz, .done_min
|
2015-10-11 09:15:03 -07:00
|
|
|
ld e, 1
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.done_min
|
2015-10-11 09:15:03 -07:00
|
|
|
add hl, de
|
|
|
|
jr nc, .Update
|
|
|
|
|
|
|
|
ld hl, $ffff
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Update:
|
2015-10-11 09:15:03 -07:00
|
|
|
ld a, h
|
|
|
|
ld [CurDamage], a
|
|
|
|
ld a, l
|
|
|
|
ld [CurDamage + 1], a
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.BadgeTypes:
|
2015-10-11 09:15:03 -07:00
|
|
|
db FLYING ; zephyrbadge
|
|
|
|
db BUG ; hivebadge
|
|
|
|
db NORMAL ; plainbadge
|
|
|
|
db GHOST ; fogbadge
|
|
|
|
db STEEL ; mineralbadge
|
|
|
|
db FIGHTING ; stormbadge
|
|
|
|
db ICE ; glacierbadge
|
|
|
|
db DRAGON ; risingbadge
|
|
|
|
|
|
|
|
db ROCK ; boulderbadge
|
|
|
|
db WATER ; cascadebadge
|
|
|
|
db ELECTRIC ; thunderbadge
|
|
|
|
db GRASS ; rainbowbadge
|
|
|
|
db POISON ; soulbadge
|
|
|
|
db PSYCHIC ; marshbadge
|
|
|
|
db FIRE ; volcanobadge
|
|
|
|
db GROUND ; earthbadge
|
|
|
|
db $ff
|
|
|
|
; fbe91
|