pokecrystal-board/engine/battle/effect_commands.asm

6923 lines
104 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
DoPlayerTurn:
2013-03-26 17:39:44 -07:00
call SetPlayerTurn
ld a, [wBattlePlayerAction]
2013-03-26 17:39:44 -07:00
and a
ret nz
jr DoTurn
2018-06-24 07:09:41 -07:00
DoEnemyTurn:
2013-03-26 17:39:44 -07:00
call SetEnemyTurn
ld a, [wLinkMode]
2013-03-26 17:39:44 -07:00
and a
jr z, DoTurn
ld a, [wBattleAction]
cp BATTLEACTION_E
2013-03-26 17:39:44 -07:00
jr z, DoTurn
cp BATTLEACTION_SWITCH1
2013-03-26 17:39:44 -07:00
ret nc
; fallthrough
2018-06-24 07:09:41 -07:00
DoTurn:
2013-03-26 17:39:44 -07:00
; Read in and execute the user's move effects for this turn.
xor a
2015-11-09 13:41:09 -08:00
ld [wTurnEnded], a
2013-03-26 17:39:44 -07:00
; Effect command checkturn is called for every move.
2013-03-26 17:39:44 -07:00
call CheckTurn
2015-11-09 13:41:09 -08:00
ld a, [wTurnEnded]
2013-03-26 17:39:44 -07:00
and a
ret nz
call UpdateMoveData
2018-06-24 07:09:41 -07:00
DoMove:
2013-03-26 17:39:44 -07:00
; Get the user's move effect.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld c, a
ld b, 0
ld hl, MoveEffectsPointers
add hl, bc
2015-12-26 18:59:03 -08:00
add hl, bc
2013-03-26 17:39:44 -07:00
ld a, BANK(MoveEffectsPointers)
call GetFarHalfword
2018-01-23 14:39:09 -08:00
ld de, wBattleScriptBuffer
2013-03-26 17:39:44 -07:00
.GetMoveEffect:
2013-03-26 17:39:44 -07:00
ld a, BANK(MoveEffects)
call GetFarByte
inc hl
ld [de], a
inc de
cp endmove_command
2013-03-26 17:39:44 -07:00
jr nz, .GetMoveEffect
; Start at the first command.
2018-01-23 14:39:09 -08:00
ld hl, wBattleScriptBuffer
2013-03-26 17:39:44 -07:00
ld a, l
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress], a
2013-03-26 17:39:44 -07:00
ld a, h
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress + 1], a
2013-03-26 17:39:44 -07:00
.ReadMoveEffectCommand:
2018-01-23 14:39:09 -08:00
; ld a, [wBattleScriptBufferAddress++]
ld a, [wBattleScriptBufferAddress]
2013-03-26 17:39:44 -07:00
ld l, a
2018-01-23 14:39:09 -08:00
ld a, [wBattleScriptBufferAddress + 1]
2013-03-26 17:39:44 -07:00
ld h, a
ld a, [hli]
push af
ld a, l
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress], a
2013-03-26 17:39:44 -07:00
ld a, h
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress + 1], a
2013-03-26 17:39:44 -07:00
pop af
; endturn_command (-2) is used to terminate branches without ending the read cycle.
cp endturn_command
2013-03-26 17:39:44 -07:00
ret nc
; The rest of the commands (01-af) are read from BattleCommandPointers.
push bc
dec a
ld c, a
ld b, 0
ld hl, BattleCommandPointers
add hl, bc
2015-12-26 18:59:03 -08:00
add hl, bc
2013-03-26 17:39:44 -07:00
pop bc
ld a, BANK(BattleCommandPointers)
call GetFarHalfword
call .DoMoveEffectCommand
jr .ReadMoveEffectCommand
.DoMoveEffectCommand:
jp hl
2013-03-26 17:39:44 -07:00
CheckTurn:
2018-06-24 07:09:41 -07:00
BattleCommand_CheckTurn:
2013-03-26 17:39:44 -07:00
; checkturn
; Repurposed as hardcoded turn handling. Useless as a command.
; Move $ff immediately ends the turn.
ld a, BATTLE_VARS_MOVE
call GetBattleVar
2013-03-26 17:39:44 -07:00
inc a
2015-11-09 13:41:09 -08:00
jp z, EndTurn
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wAttackMissed], a
ld [wEffectFailed], a
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2018-01-23 14:39:09 -08:00
ld [wAlreadyDisobeyed], a
ld [wAlreadyFailed], a
2016-01-09 13:28:22 -08:00
ld [wSomeoneIsRampaging], a
2013-03-26 17:39:44 -07:00
ld a, EFFECTIVE
2018-01-23 14:39:09 -08:00
ld [wTypeModifier], a
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jp nz, CheckEnemyTurn
CheckPlayerTurn:
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus4
bit SUBSTATUS_RECHARGE, [hl]
jr z, .no_recharge
2013-03-26 17:39:44 -07:00
res SUBSTATUS_RECHARGE, [hl]
2013-03-26 17:39:44 -07:00
ld hl, MustRechargeText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.no_recharge
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonStatus
2013-03-26 17:39:44 -07:00
ld a, [hl]
and SLP
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
dec a
2018-01-23 14:39:09 -08:00
ld [wBattleMonStatus], a
and SLP
jr z, .woke_up
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-12-19 01:47:39 -08:00
ld de, ANIM_SLP
2013-03-26 17:39:44 -07:00
call FarPlayBattleAnimation
jr .fast_asleep
2013-03-26 17:39:44 -07:00
.woke_up
2013-03-26 17:39:44 -07:00
ld hl, WokeUpText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2013-05-02 21:22:28 -07:00
call UpdateBattleMonInParty
ld hl, UpdatePlayerHUD
2013-12-31 00:25:38 -08:00
call CallBattleCore
2013-03-26 17:39:44 -07:00
ld a, $1
2015-11-09 13:41:09 -08:00
ld [hBGMapMode], a
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus1
res SUBSTATUS_NIGHTMARE, [hl]
jr .not_asleep
2013-03-26 17:39:44 -07:00
.fast_asleep
2013-03-26 17:39:44 -07:00
ld hl, FastAsleepText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
; Snore and Sleep Talk bypass sleep.
2018-01-23 14:39:09 -08:00
ld a, [wCurPlayerMove]
2013-03-26 17:39:44 -07:00
cp SNORE
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
cp SLEEP_TALK
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_asleep
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonStatus
bit FRZ, [hl]
jr z, .not_frozen
2013-03-26 17:39:44 -07:00
; Flame Wheel and Sacred Fire thaw the user.
2018-01-23 14:39:09 -08:00
ld a, [wCurPlayerMove]
2013-03-26 17:39:44 -07:00
cp FLAME_WHEEL
jr z, .not_frozen
2013-03-26 17:39:44 -07:00
cp SACRED_FIRE
jr z, .not_frozen
2013-03-26 17:39:44 -07:00
ld hl, FrozenSolidText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_frozen
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus3
bit SUBSTATUS_FLINCHED, [hl]
jr z, .not_flinched
2013-03-26 17:39:44 -07:00
res SUBSTATUS_FLINCHED, [hl]
2013-03-26 17:39:44 -07:00
ld hl, FlinchedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_flinched
2018-01-23 14:39:09 -08:00
ld hl, wPlayerDisableCount
2013-03-26 17:39:44 -07:00
ld a, [hl]
and a
jr z, .not_disabled
2013-03-26 17:39:44 -07:00
dec a
ld [hl], a
and $f
jr nz, .not_disabled
2013-03-26 17:39:44 -07:00
ld [hl], a
2018-01-23 14:39:09 -08:00
ld [wDisabledMove], a
2013-03-26 17:39:44 -07:00
ld hl, DisabledNoMoreText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
.not_disabled
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus3]
2013-03-26 17:39:44 -07:00
add a
jr nc, .not_confused
2018-01-23 14:39:09 -08:00
ld hl, wPlayerConfuseCount
2013-03-26 17:39:44 -07:00
dec [hl]
jr nz, .confused
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus3
res SUBSTATUS_CONFUSED, [hl]
2013-03-26 17:39:44 -07:00
ld hl, ConfusedNoMoreText
call StdBattleTextBox
jr .not_confused
2013-03-26 17:39:44 -07:00
.confused
2013-03-26 17:39:44 -07:00
ld hl, IsConfusedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
ld de, ANIM_CONFUSED
call FarPlayBattleAnimation
; 50% chance of hitting itself
call BattleRandom
cp 50 percent + 1
jr nc, .not_confused
2013-03-26 17:39:44 -07:00
2015-09-09 14:05:19 -07:00
; clear confusion-dependent substatus
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus3
2013-03-26 17:39:44 -07:00
ld a, [hl]
and 1 << SUBSTATUS_CONFUSED
2013-03-26 17:39:44 -07:00
ld [hl], a
call HitConfusion
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_confused
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus1]
add a ; bit SUBSTATUS_ATTRACT
jr nc, .not_infatuated
2013-03-26 17:39:44 -07:00
ld hl, InLoveWithText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-12-19 01:47:39 -08:00
ld de, ANIM_IN_LOVE
2013-03-26 17:39:44 -07:00
call FarPlayBattleAnimation
; 50% chance of infatuation
call BattleRandom
cp 50 percent + 1
jr c, .not_infatuated
2013-03-26 17:39:44 -07:00
ld hl, InfatuationText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_infatuated
2013-03-26 17:39:44 -07:00
; We can't disable a move that doesn't exist.
2018-01-23 14:39:09 -08:00
ld a, [wDisabledMove]
2013-03-26 17:39:44 -07:00
and a
jr z, .no_disabled_move
2013-03-26 17:39:44 -07:00
; Are we using the disabled move?
2018-01-23 14:39:09 -08:00
ld hl, wCurPlayerMove
2013-03-26 17:39:44 -07:00
cp [hl]
jr nz, .no_disabled_move
2013-03-26 17:39:44 -07:00
call MoveDisabled
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.no_disabled_move
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonStatus
bit PAR, [hl]
2013-03-26 17:39:44 -07:00
ret z
; 25% chance to be fully paralyzed
call BattleRandom
cp 25 percent
2013-03-26 17:39:44 -07:00
ret nc
ld hl, FullyParalyzedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2018-06-24 07:09:41 -07:00
CantMove:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res SUBSTATUS_ROLLOUT, [hl]
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
ld a, [hl]
and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED)
2013-03-26 17:39:44 -07:00
ld [hl], a
call ResetFuryCutterCount
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp FLY
2015-11-06 19:36:06 -08:00
jr z, .fly_dig
2013-03-26 17:39:44 -07:00
cp DIG
2013-03-26 17:39:44 -07:00
ret nz
2015-11-06 19:36:06 -08:00
.fly_dig
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
2015-11-09 13:41:09 -08:00
jp AppearUserRaiseSub
2018-06-24 07:09:41 -07:00
OpponentCantMove:
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
call CantMove
2015-10-10 04:45:39 -07:00
jp BattleCommand_SwitchTurn
2018-06-24 07:09:41 -07:00
CheckEnemyTurn:
2018-01-23 14:39:09 -08:00
ld hl, wEnemySubStatus4
bit SUBSTATUS_RECHARGE, [hl]
jr z, .no_recharge
2013-03-26 17:39:44 -07:00
res SUBSTATUS_RECHARGE, [hl]
2013-03-26 17:39:44 -07:00
ld hl, MustRechargeText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.no_recharge
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonStatus
2013-03-26 17:39:44 -07:00
ld a, [hl]
and SLP
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
dec a
2018-01-23 14:39:09 -08:00
ld [wEnemyMonStatus], a
2013-03-26 17:39:44 -07:00
and a
jr z, .woke_up
2013-03-26 17:39:44 -07:00
ld hl, FastAsleepText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-12-19 01:47:39 -08:00
ld de, ANIM_SLP
2013-03-26 17:39:44 -07:00
call FarPlayBattleAnimation
jr .fast_asleep
2013-03-26 17:39:44 -07:00
.woke_up
2013-03-26 17:39:44 -07:00
ld hl, WokeUpText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2013-05-02 21:22:28 -07:00
call UpdateEnemyMonInParty
ld hl, UpdateEnemyHUD
2013-12-31 00:25:38 -08:00
call CallBattleCore
2013-03-26 17:39:44 -07:00
ld a, $1
2015-11-09 13:41:09 -08:00
ld [hBGMapMode], a
2018-01-23 14:39:09 -08:00
ld hl, wEnemySubStatus1
res SUBSTATUS_NIGHTMARE, [hl]
jr .not_asleep
2013-03-26 17:39:44 -07:00
.fast_asleep
; Snore and Sleep Talk bypass sleep.
2018-01-23 14:39:09 -08:00
ld a, [wCurEnemyMove]
2013-03-26 17:39:44 -07:00
cp SNORE
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
cp SLEEP_TALK
jr z, .not_asleep
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_asleep
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonStatus
bit FRZ, [hl]
jr z, .not_frozen
; Flame Wheel and Sacred Fire thaw the user.
2018-01-23 14:39:09 -08:00
ld a, [wCurEnemyMove]
cp FLAME_WHEEL
jr z, .not_frozen
cp SACRED_FIRE
jr z, .not_frozen
2013-03-26 17:39:44 -07:00
ld hl, FrozenSolidText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_frozen
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemySubStatus3
bit SUBSTATUS_FLINCHED, [hl]
jr z, .not_flinched
2013-03-26 17:39:44 -07:00
res SUBSTATUS_FLINCHED, [hl]
2013-03-26 17:39:44 -07:00
ld hl, FlinchedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_flinched
2018-01-23 14:39:09 -08:00
ld hl, wEnemyDisableCount
2013-03-26 17:39:44 -07:00
ld a, [hl]
and a
jr z, .not_disabled
2013-03-26 17:39:44 -07:00
dec a
ld [hl], a
and $f
jr nz, .not_disabled
2013-03-26 17:39:44 -07:00
ld [hl], a
2018-01-23 14:39:09 -08:00
ld [wEnemyDisabledMove], a
2013-03-26 17:39:44 -07:00
ld hl, DisabledNoMoreText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
.not_disabled
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus3]
add a ; bit SUBSTATUS_CONFUSED
jr nc, .not_confused
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemyConfuseCount
2013-03-26 17:39:44 -07:00
dec [hl]
jr nz, .confused
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemySubStatus3
res SUBSTATUS_CONFUSED, [hl]
2013-03-26 17:39:44 -07:00
ld hl, ConfusedNoMoreText
call StdBattleTextBox
jr .not_confused
2013-03-26 17:39:44 -07:00
.confused
2013-03-26 17:39:44 -07:00
ld hl, IsConfusedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
ld de, ANIM_CONFUSED
call FarPlayBattleAnimation
; 50% chance of hitting itself
call BattleRandom
2018-02-04 18:21:34 -08:00
cp 50 percent + 1
jr nc, .not_confused
2013-03-26 17:39:44 -07:00
; clear confusion-dependent substatus
2018-01-23 14:39:09 -08:00
ld hl, wEnemySubStatus3
2013-03-26 17:39:44 -07:00
ld a, [hl]
and 1 << SUBSTATUS_CONFUSED
2013-03-26 17:39:44 -07:00
ld [hl], a
ld hl, HurtItselfText
call StdBattleTextBox
2015-11-09 13:41:09 -08:00
call HitSelfInConfusion
call BattleCommand_DamageCalc
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
; Flicker the monster pic unless flying or underground.
ld de, ANIM_HIT_CONFUSION
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
2013-03-26 17:39:44 -07:00
call z, PlayFXAnimID
ld c, TRUE
call DoEnemyDamage
2015-11-06 13:42:38 -08:00
call BattleCommand_RaiseSub
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_confused
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus1]
add a ; bit SUBSTATUS_ATTRACT
jr nc, .not_infatuated
2013-03-26 17:39:44 -07:00
ld hl, InLoveWithText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-12-19 01:47:39 -08:00
ld de, ANIM_IN_LOVE
2013-03-26 17:39:44 -07:00
call FarPlayBattleAnimation
; 50% chance of infatuation
call BattleRandom
2018-02-04 18:21:34 -08:00
cp 50 percent + 1
jr c, .not_infatuated
2013-03-26 17:39:44 -07:00
ld hl, InfatuationText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.not_infatuated
; We can't disable a move that doesn't exist.
2018-01-23 14:39:09 -08:00
ld a, [wEnemyDisabledMove]
2013-03-26 17:39:44 -07:00
and a
jr z, .no_disabled_move
2013-03-26 17:39:44 -07:00
; Are we using the disabled move?
2018-01-23 14:39:09 -08:00
ld hl, wCurEnemyMove
2013-03-26 17:39:44 -07:00
cp [hl]
jr nz, .no_disabled_move
2013-03-26 17:39:44 -07:00
call MoveDisabled
call CantMove
2015-11-09 13:41:09 -08:00
jp EndTurn
2013-03-26 17:39:44 -07:00
.no_disabled_move
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonStatus
bit PAR, [hl]
2013-03-26 17:39:44 -07:00
ret z
; 25% chance to be fully paralyzed
call BattleRandom
cp 25 percent
2013-03-26 17:39:44 -07:00
ret nc
ld hl, FullyParalyzedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call CantMove
; fallthrough
2018-06-24 07:09:41 -07:00
EndTurn:
2013-03-26 17:39:44 -07:00
ld a, $1
2015-11-09 13:41:09 -08:00
ld [wTurnEnded], a
2013-03-26 17:39:44 -07:00
jp ResetDamage
2018-06-24 07:09:41 -07:00
MoveDisabled:
; Make sure any charged moves fail
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
res SUBSTATUS_CHARGED, [hl]
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE
call GetBattleVar
2015-11-06 17:55:16 -08:00
ld [wNamedObjectIndexBuffer], a
2013-05-02 23:43:44 -07:00
call GetMoveName
2013-03-26 17:39:44 -07:00
ld hl, DisabledMoveText
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
HitConfusion:
2013-03-26 17:39:44 -07:00
ld hl, HurtItselfText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wCriticalHit], a
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
call HitSelfInConfusion
call BattleCommand_DamageCalc
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
; Flicker the monster pic unless flying or underground.
ld de, ANIM_HIT_CONFUSION
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
2013-03-26 17:39:44 -07:00
call z, PlayFXAnimID
ld hl, UpdatePlayerHUD
2013-12-31 00:25:38 -08:00
call CallBattleCore
2013-03-26 17:39:44 -07:00
ld a, $1
2015-11-09 13:41:09 -08:00
ld [hBGMapMode], a
ld c, TRUE
call DoPlayerDamage
2015-11-06 13:42:38 -08:00
jp BattleCommand_RaiseSub
2018-06-24 07:09:41 -07:00
BattleCommand_CheckObedience:
2013-03-26 17:39:44 -07:00
; checkobedience
; Enemy can't disobey
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
ret nz
2015-11-09 13:41:09 -08:00
call CheckUserIsCharging
2013-03-26 17:39:44 -07:00
ret nz
; If we've already checked this turn
2018-01-23 14:39:09 -08:00
ld a, [wAlreadyDisobeyed]
2013-03-26 17:39:44 -07:00
and a
ret nz
xor a
2018-01-23 14:39:09 -08:00
ld [wAlreadyDisobeyed], a
2013-03-26 17:39:44 -07:00
; No obedience in link battles
; (since no handling exists for enemy)
ld a, [wLinkMode]
2013-03-26 17:39:44 -07:00
and a
ret nz
2018-01-23 14:39:09 -08:00
ld a, [wInBattleTowerBattle]
2013-03-26 17:39:44 -07:00
and a
ret nz
; If the monster's id doesn't match the player's,
; some conditions need to be met.
ld a, MON_ID
2013-03-26 17:39:44 -07:00
call BattlePartyAttr
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID]
2013-03-26 17:39:44 -07:00
cp [hl]
jr nz, .obeylevel
inc hl
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID + 1]
2013-03-26 17:39:44 -07:00
cp [hl]
ret z
.obeylevel
; The maximum obedience level is constrained by owned badges:
ld hl, wJohtoBadges
2013-03-26 17:39:44 -07:00
; risingbadge
2015-11-07 18:04:54 -08:00
bit RISINGBADGE, [hl]
ld a, MAX_LEVEL + 1
2013-03-26 17:39:44 -07:00
jr nz, .getlevel
; stormbadge
2015-11-07 18:04:54 -08:00
bit STORMBADGE, [hl]
2013-03-26 17:39:44 -07:00
ld a, 70
jr nz, .getlevel
; fogbadge
2015-11-07 18:04:54 -08:00
bit FOGBADGE, [hl]
2013-03-26 17:39:44 -07:00
ld a, 50
jr nz, .getlevel
; hivebadge
2015-11-07 18:04:54 -08:00
bit HIVEBADGE, [hl]
2013-03-26 17:39:44 -07:00
ld a, 30
jr nz, .getlevel
; no badges
2013-03-26 17:39:44 -07:00
ld a, 10
.getlevel
; c = obedience level
; d = monster level
; b = c + d
ld b, a
ld c, a
2018-01-23 14:39:09 -08:00
ld a, [wBattleMonLevel]
2013-03-26 17:39:44 -07:00
ld d, a
add b
ld b, a
; No overflow (this should never happen)
jr nc, .checklevel
ld b, $ff
.checklevel
; If the monster's level is lower than the obedience level, it will obey.
ld a, c
cp d
ret nc
; Random number from 0 to obedience level + monster level
.rand1
call BattleRandom
2013-03-26 17:39:44 -07:00
swap a
cp b
jr nc, .rand1
; The higher above the obedience level the monster is,
; the more likely it is to disobey.
cp c
ret c
; Sleep-only moves have separate handling, and a higher chance of
; being ignored. Lazy monsters like their sleep.
call IgnoreSleepOnly
ret c
; Another random number from 0 to obedience level + monster level
.rand2
call BattleRandom
2013-03-26 17:39:44 -07:00
cp b
jr nc, .rand2
; A second chance.
cp c
jr c, .UseInstead
; No hope of using a move now.
; b = number of levels the monster is above the obedience level
ld a, d
sub c
ld b, a
; The chance of napping is the difference out of 256.
call BattleRandom
2013-03-26 17:39:44 -07:00
swap a
sub b
jr c, .Nap
; The chance of not hitting itself is the same.
cp b
jr nc, .DoNothing
ld hl, WontObeyText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call HitConfusion
jp .EndDisobedience
2013-03-26 17:39:44 -07:00
.Nap:
call BattleRandom
2013-03-26 17:39:44 -07:00
add a
swap a
and SLP
2013-03-26 17:39:44 -07:00
jr z, .Nap
2018-01-23 14:39:09 -08:00
ld [wBattleMonStatus], a
2013-03-26 17:39:44 -07:00
ld hl, BeganToNapText
jr .Print
.DoNothing:
2018-01-11 09:00:01 -08:00
; 4 random choices
call BattleRandom
2018-01-11 09:00:01 -08:00
and %11
2013-03-26 17:39:44 -07:00
ld hl, LoafingAroundText
2018-01-11 09:00:01 -08:00
and a ; 0
2013-03-26 17:39:44 -07:00
jr z, .Print
ld hl, WontObeyText
2018-01-11 09:00:01 -08:00
dec a ; 1
2013-03-26 17:39:44 -07:00
jr z, .Print
ld hl, TurnedAwayText
2018-01-11 09:00:01 -08:00
dec a ; 2
2013-03-26 17:39:44 -07:00
jr z, .Print
ld hl, IgnoredOrdersText
.Print:
call StdBattleTextBox
jp .EndDisobedience
2013-03-26 17:39:44 -07:00
.UseInstead:
2013-03-26 17:39:44 -07:00
; Can't use another move if the monster only has one!
2018-01-23 14:39:09 -08:00
ld a, [wBattleMonMoves + 1]
2013-03-26 17:39:44 -07:00
and a
jr z, .DoNothing
; Don't bother trying to handle Disable.
2018-01-23 14:39:09 -08:00
ld a, [wDisabledMove]
2013-03-26 17:39:44 -07:00
and a
jr nz, .DoNothing
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonPP
ld de, wBattleMonMoves
2013-03-26 17:39:44 -07:00
ld b, 0
ld c, NUM_MOVES
.GetTotalPP:
2013-03-26 17:39:44 -07:00
ld a, [hli]
2018-01-11 09:00:01 -08:00
and PP_MASK
2013-03-26 17:39:44 -07:00
add b
ld b, a
dec c
jr z, .CheckMovePP
; Stop at undefined moves.
inc de
ld a, [de]
and a
jr nz, .GetTotalPP
.CheckMovePP:
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonPP
ld a, [wCurMoveNum]
2013-03-26 17:39:44 -07:00
ld e, a
ld d, 0
add hl, de
; Can't use another move if only one move has PP.
ld a, [hl]
2018-01-11 09:00:01 -08:00
and PP_MASK
2013-03-26 17:39:44 -07:00
cp b
jr z, .DoNothing
; Make sure we can actually use the move once we get there.
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wAlreadyDisobeyed], a
2013-03-26 17:39:44 -07:00
ld a, [w2DMenuNumRows]
2013-03-26 17:39:44 -07:00
ld b, a
; Save the move we originally picked for afterward.
2018-01-23 14:39:09 -08:00
ld a, [wCurMoveNum]
2013-03-26 17:39:44 -07:00
ld c, a
push af
.RandomMove:
call BattleRandom
2018-01-16 14:27:50 -08:00
maskbits NUM_MOVES
2013-03-26 17:39:44 -07:00
cp b
jr nc, .RandomMove
; Not the move we were trying to use.
cp c
jr z, .RandomMove
; Make sure it has PP.
2018-01-23 14:39:09 -08:00
ld [wCurMoveNum], a
ld hl, wBattleMonPP
2013-03-26 17:39:44 -07:00
ld e, a
ld d, 0
add hl, de
ld a, [hl]
2018-01-11 09:00:01 -08:00
and PP_MASK
2013-03-26 17:39:44 -07:00
jr z, .RandomMove
; Use it.
2018-01-23 14:39:09 -08:00
ld a, [wCurMoveNum]
2013-03-26 17:39:44 -07:00
ld c, a
ld b, 0
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonMoves
2013-03-26 17:39:44 -07:00
add hl, bc
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wCurPlayerMove], a
2013-03-26 17:39:44 -07:00
call SetPlayerTurn
call UpdateMoveData
call DoMove
; Restore original move choice.
pop af
2018-01-23 14:39:09 -08:00
ld [wCurMoveNum], a
2013-03-26 17:39:44 -07:00
.EndDisobedience:
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wLastPlayerMove], a
ld [wLastPlayerCounterMove], a
2013-03-26 17:39:44 -07:00
; Break Encore too.
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSubStatus5
res SUBSTATUS_ENCORED, [hl]
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wPlayerEncoreCount], a
2013-03-26 17:39:44 -07:00
jp EndMoveEffect
2018-06-24 07:09:41 -07:00
IgnoreSleepOnly:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
; Snore and Sleep Talk bypass sleep.
2013-03-26 17:39:44 -07:00
cp SNORE
jr z, .CheckSleep
cp SLEEP_TALK
jr z, .CheckSleep
and a
ret
.CheckSleep:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and SLP
2013-03-26 17:39:44 -07:00
ret z
; 'ignored orders…sleeping!'
2013-03-27 14:07:00 -07:00
ld hl, IgnoredSleepingText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
call EndMoveEffect
scf
ret
2018-06-24 07:09:41 -07:00
BattleCommand_UsedMoveText:
2013-03-26 17:39:44 -07:00
; usedmovetext
2017-12-24 09:47:30 -08:00
farcall DisplayUsedMoveText
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
CheckUserIsCharging:
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2015-11-07 18:04:54 -08:00
ld a, [wPlayerCharging] ; player
2013-03-26 17:39:44 -07:00
jr z, .end
2015-11-07 18:04:54 -08:00
ld a, [wEnemyCharging] ; enemy
2013-03-26 17:39:44 -07:00
.end
and a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_DoTurn:
2015-11-09 13:41:09 -08:00
call CheckUserIsCharging
2013-03-26 17:39:44 -07:00
ret nz
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonPP
ld de, wPlayerSubStatus3
ld bc, wPlayerTurnsTaken
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .proceed
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonPP
ld de, wEnemySubStatus3
ld bc, wEnemyTurnsTaken
2013-03-26 17:39:44 -07:00
.proceed
2013-03-26 17:39:44 -07:00
; If we've gotten this far, this counts as a turn.
ld a, [bc]
inc a
ld [bc], a
ld a, BATTLE_VARS_MOVE
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp STRUGGLE
ret z
ld a, [de]
and 1 << SUBSTATUS_IN_LOOP | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE
2013-03-26 17:39:44 -07:00
ret nz
2015-11-06 17:55:16 -08:00
call .consume_pp
2013-03-26 17:39:44 -07:00
ld a, b
and a
jp nz, EndMoveEffect
; SubStatus5
2013-03-26 17:39:44 -07:00
inc de
2015-12-26 18:59:03 -08:00
inc de
2013-03-26 17:39:44 -07:00
ld a, [de]
bit SUBSTATUS_TRANSFORMED, a
2013-03-26 17:39:44 -07:00
ret nz
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1PP
ld a, [wCurBattleMon]
2015-11-06 17:55:16 -08:00
jr z, .player
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
; mimic this part entirely if wildbattle
ld a, [wBattleMode]
2013-03-26 17:39:44 -07:00
dec a
2015-11-06 17:55:16 -08:00
jr z, .wild
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wOTPartyMon1PP
ld a, [wCurOTMon]
2013-03-26 17:39:44 -07:00
2015-11-06 17:55:16 -08:00
.player
2013-03-26 17:39:44 -07:00
call GetPartyLocation
push hl
2015-11-09 13:41:09 -08:00
call CheckMimicUsed
2013-03-26 17:39:44 -07:00
pop hl
ret c
2015-11-06 17:55:16 -08:00
.consume_pp
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld a, [wCurMoveNum]
jr z, .okay
2018-01-23 14:39:09 -08:00
ld a, [wCurEnemyMoveNum]
2013-03-26 17:39:44 -07:00
.okay
2013-03-26 17:39:44 -07:00
ld c, a
ld b, 0
2013-03-26 17:39:44 -07:00
add hl, bc
ld a, [hl]
2018-01-11 09:00:01 -08:00
and PP_MASK
2015-11-09 13:41:09 -08:00
jr z, .out_of_pp
2013-03-26 17:39:44 -07:00
dec [hl]
ld b, 0
2013-03-26 17:39:44 -07:00
ret
2015-11-06 17:55:16 -08:00
.wild
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonMoves
ld a, [wCurEnemyMoveNum]
2013-03-26 17:39:44 -07:00
ld c, a
ld b, 0
2013-03-26 17:39:44 -07:00
add hl, bc
ld a, [hl]
cp MIMIC
jr z, .mimic
2015-11-09 13:41:09 -08:00
ld hl, wWildMonMoves
2013-03-26 17:39:44 -07:00
add hl, bc
ld a, [hl]
cp MIMIC
ret z
.mimic
2015-11-09 13:41:09 -08:00
ld hl, wWildMonPP
2015-11-06 17:55:16 -08:00
call .consume_pp
2013-03-26 17:39:44 -07:00
ret
2015-11-09 13:41:09 -08:00
.out_of_pp
call BattleCommand_MoveDelay
2013-03-26 17:39:44 -07:00
; get move effect
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-03-26 17:39:44 -07:00
; continuous?
ld hl, .continuousmoves
2013-03-27 13:19:51 -07:00
ld de, 1
2013-03-26 17:39:44 -07:00
call IsInArray
; 'has no pp left for [move]'
2013-03-27 14:07:00 -07:00
ld hl, HasNoPPLeftText
2013-03-26 17:39:44 -07:00
jr c, .print
; 'but no pp is left for the move'
2013-03-27 14:07:00 -07:00
ld hl, NoPPLeftText
2013-03-26 17:39:44 -07:00
.print
call StdBattleTextBox
2013-04-27 14:12:23 -07:00
ld b, 1
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
.continuousmoves
2013-04-27 14:12:23 -07:00
db EFFECT_RAZOR_WIND
db EFFECT_SKY_ATTACK
db EFFECT_SKULL_BASH
db EFFECT_SOLARBEAM
db EFFECT_FLY
db EFFECT_ROLLOUT
db EFFECT_BIDE
db EFFECT_RAMPAGE
db -1
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CheckMimicUsed:
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld a, [wCurMoveNum]
2015-11-06 17:55:16 -08:00
jr z, .player
2018-01-23 14:39:09 -08:00
ld a, [wCurEnemyMoveNum]
2013-03-26 17:39:44 -07:00
2015-11-06 17:55:16 -08:00
.player
2013-03-26 17:39:44 -07:00
ld c, a
2015-11-09 13:41:09 -08:00
ld a, MON_MOVES
2013-05-02 23:43:44 -07:00
call UserPartyAttr
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp MIMIC
2015-11-09 13:41:09 -08:00
jr z, .mimic
;
2013-03-26 17:39:44 -07:00
ld b, 0
add hl, bc
ld a, [hl]
cp MIMIC
2015-11-09 13:41:09 -08:00
jr nz, .mimic
2013-03-26 17:39:44 -07:00
scf
ret
2015-11-09 13:41:09 -08:00
.mimic
2013-03-26 17:39:44 -07:00
and a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_Critical:
2013-03-26 17:39:44 -07:00
; critical
; Determine whether this attack's hit will be critical.
xor a
2018-01-23 14:39:09 -08:00
ld [wCriticalHit], a
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_POWER
call GetBattleVar
2013-03-26 17:39:44 -07:00
and a
ret z
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonItem
ld a, [wEnemyMonSpecies]
2013-03-26 17:39:44 -07:00
jr nz, .Item
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonItem
ld a, [wBattleMonSpecies]
2013-03-26 17:39:44 -07:00
.Item:
2013-03-26 17:39:44 -07:00
ld c, 0
cp CHANSEY
jr nz, .Farfetchd
ld a, [hl]
cp LUCKY_PUNCH
jr nz, .FocusEnergy
; +2 critical level
ld c, 2
jr .Tally
.Farfetchd:
2013-03-26 17:39:44 -07:00
cp FARFETCH_D
jr nz, .FocusEnergy
ld a, [hl]
cp STICK
jr nz, .FocusEnergy
; +2 critical level
ld c, 2
jr .Tally
.FocusEnergy:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
bit SUBSTATUS_FOCUS_ENERGY, a
2013-03-26 17:39:44 -07:00
jr z, .CheckCritical
; +1 critical level
inc c
.CheckCritical:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld de, 1
ld hl, CriticalHitMoves
2013-03-26 17:39:44 -07:00
push bc
call IsInArray
pop bc
jr nc, .ScopeLens
; +2 critical level
inc c
2015-12-26 18:59:03 -08:00
inc c
2013-03-26 17:39:44 -07:00
.ScopeLens:
2013-03-26 17:39:44 -07:00
push bc
call GetUserItem
ld a, b
cp HELD_CRITICAL_UP ; Increased critical chance. Only Scope Lens has this.
2013-03-26 17:39:44 -07:00
pop bc
jr nz, .Tally
; +1 critical level
inc c
.Tally:
ld hl, CriticalHitChances
2013-03-26 17:39:44 -07:00
ld b, 0
add hl, bc
call BattleRandom
2013-03-26 17:39:44 -07:00
cp [hl]
ret nc
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wCriticalHit], a
2013-03-26 17:39:44 -07:00
ret
2018-07-03 23:42:11 -07:00
INCLUDE "data/moves/critical_hit_moves.asm"
INCLUDE "data/battle/critical_hit_chances.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/triple_kick.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_Stab:
2015-09-09 16:27:07 -07:00
; STAB = Same Type Attack Bonus
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp STRUGGLE
ret z
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonType1
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonType1
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld d, a
ld e, [hl]
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2015-09-09 16:27:07 -07:00
jr z, .go ; Who Attacks and who Defends
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonType1
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonType1
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld d, a
ld e, [hl]
.go
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVarAddr
2015-11-06 17:55:16 -08:00
ld [wTypeMatchup], a
2013-03-26 17:39:44 -07:00
push hl
push de
push bc
2017-12-24 09:47:30 -08:00
farcall DoWeatherModifiers
2013-03-26 17:39:44 -07:00
pop bc
pop de
pop hl
push de
push bc
2017-12-24 09:47:30 -08:00
farcall DoBadgeTypeBoosts
2013-03-26 17:39:44 -07:00
pop bc
pop de
2015-11-06 17:55:16 -08:00
ld a, [wTypeMatchup]
2013-03-26 17:39:44 -07:00
cp b
jr z, .stab
2013-03-26 17:39:44 -07:00
cp c
jr z, .stab
jr .SkipStab
2013-03-26 17:39:44 -07:00
.stab
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage + 1
2013-03-26 17:39:44 -07:00
ld a, [hld]
ld h, [hl]
ld l, a
2013-03-26 17:39:44 -07:00
ld b, h
ld c, l
srl b
rr c
add hl, bc
2013-03-26 17:39:44 -07:00
ld a, h
2018-01-23 14:39:09 -08:00
ld [wCurDamage], a
2013-03-26 17:39:44 -07:00
ld a, l
2018-01-23 14:39:09 -08:00
ld [wCurDamage + 1], a
2018-01-23 14:39:09 -08:00
ld hl, wTypeModifier
2013-03-26 17:39:44 -07:00
set 7, [hl]
.SkipStab:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld b, a
ld hl, TypeMatchups
.TypesLoop:
2013-03-26 17:39:44 -07:00
ld a, [hli]
cp -1
jr z, .end
; foresight
cp -2
jr nz, .SkipForesightCheck
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
bit SUBSTATUS_IDENTIFIED, a
jr nz, .end
jr .TypesLoop
.SkipForesightCheck:
2013-03-26 17:39:44 -07:00
cp b
jr nz, .SkipType
2013-03-26 17:39:44 -07:00
ld a, [hl]
cp d
jr z, .GotMatchup
2013-03-26 17:39:44 -07:00
cp e
jr z, .GotMatchup
jr .SkipType
.GotMatchup:
2013-03-26 17:39:44 -07:00
push hl
push bc
inc hl
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and %10000000
ld b, a
; If the target is immune to the move, treat it as a miss and calculate the damage as 0
2013-03-26 17:39:44 -07:00
ld a, [hl]
and a
jr nz, .NotImmune
2013-03-26 17:39:44 -07:00
inc a
2018-01-23 14:39:09 -08:00
ld [wAttackMissed], a
2013-03-26 17:39:44 -07:00
xor a
.NotImmune:
ld [hMultiplier], a
2013-03-26 17:39:44 -07:00
add b
2018-01-23 14:39:09 -08:00
ld [wTypeModifier], a
2013-03-26 17:39:44 -07:00
xor a
ld [hMultiplicand + 0], a
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld [hMultiplicand + 1], a
2013-03-26 17:39:44 -07:00
ld a, [hld]
ld [hMultiplicand + 2], a
2013-05-02 23:43:44 -07:00
call Multiply
ld a, [hProduct + 1]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hProduct + 2]
2013-03-26 17:39:44 -07:00
or b
ld b, a
ld a, [hProduct + 3]
2013-03-26 17:39:44 -07:00
or b
jr z, .ok ; This is a very convoluted way to get back that we've essentially dealt no damage.
; Take the product and divide it by 10.
ld a, 10
ld [hDivisor], a
ld b, 4
2013-05-02 23:43:44 -07:00
call Divide
ld a, [hQuotient + 1]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hQuotient + 2]
2013-03-26 17:39:44 -07:00
or b
jr nz, .ok
ld a, 1
ld [hMultiplicand + 2], a
.ok
ld a, [hMultiplicand + 1]
2013-03-26 17:39:44 -07:00
ld [hli], a
ld a, [hMultiplicand + 2]
2013-03-26 17:39:44 -07:00
ld [hl], a
pop bc
pop hl
.SkipType:
2013-03-26 17:39:44 -07:00
inc hl
2015-12-26 18:59:03 -08:00
inc hl
jr .TypesLoop
.end
2015-11-06 17:55:16 -08:00
call BattleCheckTypeMatchup
ld a, [wTypeMatchup]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2015-11-06 17:55:16 -08:00
and %10000000
2013-03-26 17:39:44 -07:00
or b
2018-01-23 14:39:09 -08:00
ld [wTypeModifier], a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCheckTypeMatchup:
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonType1
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, CheckTypeMatchup
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonType1
2018-06-24 07:09:41 -07:00
CheckTypeMatchup:
; There is an incorrect assumption about this function made in the AI related code: when
; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
; offensive type in a will make this function do the right thing. Since a is overwritten,
; this assumption is incorrect. A simple fix would be to load the move type for the
; current move into a in BattleCheckTypeMatchup, before falling through, which is
; consistent with how the rest of the code assumes this code works like.
2013-03-26 17:39:44 -07:00
push hl
push de
push bc
2013-05-02 23:43:44 -07:00
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld d, a
ld b, [hl]
inc hl
ld c, [hl]
ld a, 10 ; 1.0
2015-11-06 17:55:16 -08:00
ld [wTypeMatchup], a
ld hl, TypeMatchups
.TypesLoop:
2013-03-26 17:39:44 -07:00
ld a, [hli]
cp -1
jr z, .End
cp -2
jr nz, .Next
2013-05-02 23:43:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_IDENTIFIED, a
jr nz, .End
jr .TypesLoop
.Next:
2013-03-26 17:39:44 -07:00
cp d
jr nz, .Nope
2013-03-26 17:39:44 -07:00
ld a, [hli]
cp b
jr z, .Yup
2013-03-26 17:39:44 -07:00
cp c
jr z, .Yup
jr .Nope2
.Nope:
2013-03-26 17:39:44 -07:00
inc hl
.Nope2:
2013-03-26 17:39:44 -07:00
inc hl
jr .TypesLoop
.Yup:
2013-03-26 17:39:44 -07:00
xor a
ld [hDividend + 0], a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld [hMultiplicand + 2], a
2015-11-06 17:55:16 -08:00
ld a, [wTypeMatchup]
ld [hMultiplier], a
2013-03-26 17:39:44 -07:00
call Multiply
ld a, 10
ld [hDivisor], a
2013-03-26 17:39:44 -07:00
push bc
ld b, 4
2013-03-26 17:39:44 -07:00
call Divide
pop bc
ld a, [hQuotient + 2]
2015-11-06 17:55:16 -08:00
ld [wTypeMatchup], a
jr .TypesLoop
.End:
2013-03-26 17:39:44 -07:00
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
BattleCommand_ResetTypeMatchup:
; Reset the type matchup multiplier to 1.0, if the type matchup is not 0.
; If there is immunity in play, the move automatically misses.
2015-11-06 17:55:16 -08:00
call BattleCheckTypeMatchup
ld a, [wTypeMatchup]
2013-03-26 17:39:44 -07:00
and a
ld a, 10 ; 1.0
jr nz, .reset
2013-03-26 17:39:44 -07:00
call ResetDamage
xor a
2018-01-23 14:39:09 -08:00
ld [wTypeModifier], a
2013-03-26 17:39:44 -07:00
inc a
2018-01-23 14:39:09 -08:00
ld [wAttackMissed], a
2013-03-26 17:39:44 -07:00
ret
2015-11-06 17:55:16 -08:00
.reset
2015-11-06 17:55:16 -08:00
ld [wTypeMatchup], a
2013-03-26 17:39:44 -07:00
ret
INCLUDE "engine/battle/ai/switch.asm"
2013-03-26 17:39:44 -07:00
2018-01-22 13:23:34 -08:00
INCLUDE "data/types/type_matchups.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DamageVariation:
2013-03-26 17:39:44 -07:00
; damagevariation
; Modify the damage spread between 85% and 100%.
; Because of the method of division the probability distribution
; is not consistent. This makes the highest damage multipliers
; rarer than normal.
; No point in reducing 1 or 0 damage.
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld a, [hli]
and a
jr nz, .go
ld a, [hl]
cp 2
ret c
.go
; Start with the maximum damage.
xor a
ld [hMultiplicand + 0], a
2013-03-26 17:39:44 -07:00
dec hl
ld a, [hli]
ld [hMultiplicand + 1], a
2013-03-26 17:39:44 -07:00
ld a, [hl]
ld [hMultiplicand + 2], a
2013-03-26 17:39:44 -07:00
; Multiply by 85-100%...
.loop
call BattleRandom
2013-03-26 17:39:44 -07:00
rrca
cp 85 percent + 1
2013-03-26 17:39:44 -07:00
jr c, .loop
ld [hMultiplier], a
2013-03-26 17:39:44 -07:00
call Multiply
; ...divide by 100%...
ld a, $ff ; 100%
ld [hDivisor], a
2013-03-26 17:39:44 -07:00
ld b, $4
call Divide
; ...to get .85-1.00x damage.
ld a, [hQuotient + 1]
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld [hli], a
ld a, [hQuotient + 2]
2013-03-26 17:39:44 -07:00
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_CheckHit:
2013-03-26 17:39:44 -07:00
; checkhit
call .DreamEater
jp z, .Miss
call .Protect
jp nz, .Miss
call .DrainSub
jp z, .Miss
call .LockOn
ret nz
call .FlyDigMoves
jp nz, .Miss
call .ThunderRain
ret z
call .XAccuracy
2013-03-26 17:39:44 -07:00
ret nz
; Perfect-accuracy moves
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_ALWAYS_HIT
2013-03-26 17:39:44 -07:00
ret z
call .StatModifiers
ld a, [wPlayerMoveStruct + MOVE_ACC]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hBattleTurn]
and a
jr z, .BrightPowder
ld a, [wEnemyMoveStruct + MOVE_ACC]
2013-03-26 17:39:44 -07:00
ld b, a
.BrightPowder:
2013-03-26 17:39:44 -07:00
push bc
call GetOpponentItem
ld a, b
2013-05-02 22:29:57 -07:00
cp HELD_BRIGHTPOWDER
2013-03-26 17:39:44 -07:00
ld a, c ; % miss
pop bc
jr nz, .skip_brightpowder
2013-03-26 17:39:44 -07:00
ld c, a
ld a, b
sub c
ld b, a
jr nc, .skip_brightpowder
2013-03-26 17:39:44 -07:00
ld b, 0
.skip_brightpowder
2013-03-26 17:39:44 -07:00
ld a, b
cp -1
2013-03-26 17:39:44 -07:00
jr z, .Hit
call BattleRandom
2013-03-26 17:39:44 -07:00
cp b
jr nc, .Miss
.Hit:
2013-03-26 17:39:44 -07:00
ret
.Miss:
2013-03-26 17:39:44 -07:00
; Keep the damage value intact if we're using (Hi) Jump Kick.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_JUMP_KICK
2013-03-26 17:39:44 -07:00
jr z, .Missed
call ResetDamage
.Missed:
2013-03-26 17:39:44 -07:00
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wAttackMissed], a
2013-03-26 17:39:44 -07:00
ret
.DreamEater:
2013-03-26 17:39:44 -07:00
; Return z if we're trying to eat the dream of
; a monster that isn't sleeping.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_DREAM_EATER
2013-03-26 17:39:44 -07:00
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
and SLP
2013-03-26 17:39:44 -07:00
ret
.Protect:
2013-03-26 17:39:44 -07:00
; Return nz if the opponent is protected.
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_PROTECT, a
2013-03-26 17:39:44 -07:00
ret z
ld c, 40
call DelayFrames
; 'protecting itself!'
2013-03-27 14:07:00 -07:00
ld hl, ProtectingItselfText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
ld c, 40
call DelayFrames
ld a, 1
and a
ret
.LockOn:
2013-03-26 17:39:44 -07:00
; Return nz if we are locked-on and aren't trying to use Earthquake,
; Fissure or Magnitude on a monster that is flying.
ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_LOCK_ON, [hl]
res SUBSTATUS_LOCK_ON, [hl]
2013-03-26 17:39:44 -07:00
ret z
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_FLYING, a
2013-03-26 17:39:44 -07:00
jr z, .LockedOn
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp EARTHQUAKE
ret z
cp FISSURE
ret z
cp MAGNITUDE
ret z
.LockedOn:
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
.DrainSub:
2013-03-26 17:39:44 -07:00
; Return z if using an HP drain move on a substitute.
2013-05-02 23:43:44 -07:00
call CheckSubstituteOpp
jr z, .not_draining_sub
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-03-26 17:39:44 -07:00
2013-05-02 23:43:44 -07:00
cp EFFECT_LEECH_HIT
2013-03-26 17:39:44 -07:00
ret z
2013-05-02 23:43:44 -07:00
cp EFFECT_DREAM_EATER
2013-03-26 17:39:44 -07:00
ret z
.not_draining_sub
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
.FlyDigMoves:
2013-03-26 17:39:44 -07:00
; Check for moves that can hit underground/flying opponents.
; Return z if the current move can hit the opponent.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
2013-03-26 17:39:44 -07:00
ret z
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_FLYING, a
2013-03-26 17:39:44 -07:00
jr z, .DigMoves
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp GUST
ret z
cp WHIRLWIND
ret z
cp THUNDER
ret z
cp TWISTER
ret
.DigMoves:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp EARTHQUAKE
ret z
cp FISSURE
ret z
cp MAGNITUDE
ret
.ThunderRain:
2013-03-26 17:39:44 -07:00
; Return z if the current move always hits in rain, and it is raining.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_THUNDER
2013-03-26 17:39:44 -07:00
ret nz
ld a, [wBattleWeather]
2013-03-26 17:39:44 -07:00
cp WEATHER_RAIN
ret
.XAccuracy:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
bit SUBSTATUS_X_ACCURACY, a
2013-03-26 17:39:44 -07:00
ret
.StatModifiers:
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2016-01-17 21:39:01 -08:00
; load the user's accuracy into b and the opponent's evasion into c.
ld hl, wPlayerMoveStruct + MOVE_ACC
2018-01-23 14:39:09 -08:00
ld a, [wPlayerAccLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wEnemyEvaLevel]
2013-03-26 17:39:44 -07:00
ld c, a
jr z, .got_acc_eva
2013-03-26 17:39:44 -07:00
ld hl, wEnemyMoveStruct + MOVE_ACC
2018-01-23 14:39:09 -08:00
ld a, [wEnemyAccLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wPlayerEvaLevel]
2013-03-26 17:39:44 -07:00
ld c, a
.got_acc_eva
2013-03-26 17:39:44 -07:00
cp b
2016-01-17 21:39:01 -08:00
jr c, .skip_foresight_check
2013-03-26 17:39:44 -07:00
2016-01-17 21:39:01 -08:00
; if the target's evasion is greater than the user's accuracy,
; check the target's foresight status
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_IDENTIFIED, a
2013-03-26 17:39:44 -07:00
ret nz
2016-01-17 21:39:01 -08:00
.skip_foresight_check
; subtract evasion from 14
ld a, MAX_STAT_LEVEL + 1
2013-03-26 17:39:44 -07:00
sub c
ld c, a
2016-01-17 21:39:01 -08:00
; store the base move accuracy for math ops
2013-03-26 17:39:44 -07:00
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
2013-03-26 17:39:44 -07:00
ld a, [hl]
ld [hMultiplicand + 2], a
2013-03-26 17:39:44 -07:00
push hl
2016-01-17 21:39:01 -08:00
ld d, 2 ; do this twice, once for the user's accuracy and once for the target's evasion
2013-03-26 17:39:44 -07:00
.accuracy_loop
2016-01-17 21:39:01 -08:00
; look up the multiplier from the table
2013-03-26 17:39:44 -07:00
push bc
ld hl, AccuracyLevelMultipliers
2013-03-26 17:39:44 -07:00
dec b
sla b
ld c, b
ld b, 0
add hl, bc
pop bc
2016-01-17 21:39:01 -08:00
; multiply by the first byte in that row...
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld [hMultiplier], a
2013-03-26 17:39:44 -07:00
call Multiply
2016-01-17 21:39:01 -08:00
; ... and divide by the second byte
2013-03-26 17:39:44 -07:00
ld a, [hl]
ld [hDivisor], a
ld b, 4
2013-03-26 17:39:44 -07:00
call Divide
2016-01-17 21:39:01 -08:00
; minimum accuracy is $0001
ld a, [hQuotient + 2]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hQuotient + 1]
2013-03-26 17:39:44 -07:00
or b
jr nz, .min_accuracy
ld [hQuotient + 1], a
2016-01-17 21:39:01 -08:00
ld a, 1
ld [hQuotient + 2], a
2013-03-26 17:39:44 -07:00
.min_accuracy
2016-01-17 21:39:01 -08:00
; do the same thing to the target's evasion
2013-03-26 17:39:44 -07:00
ld b, c
dec d
jr nz, .accuracy_loop
2013-03-26 17:39:44 -07:00
2016-01-17 21:39:01 -08:00
; if the result is more than 2 bytes, max out at 100%
ld a, [hQuotient + 1]
2013-03-26 17:39:44 -07:00
and a
ld a, [hQuotient + 2]
jr z, .finish_accuracy
2013-03-26 17:39:44 -07:00
ld a, $ff
.finish_accuracy
2013-03-26 17:39:44 -07:00
pop hl
ld [hl], a
ret
INCLUDE "data/battle/accuracy_multipliers.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_EffectChance:
2013-03-26 22:52:04 -07:00
; effectchance
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wEffectFailed], a
2013-03-26 17:39:44 -07:00
call CheckSubstituteOpp
2013-03-26 22:52:04 -07:00
jr nz, .failed
2013-03-26 17:39:44 -07:00
push hl
ld hl, wPlayerMoveStruct + MOVE_CHANCE
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_move_chance
ld hl, wEnemyMoveStruct + MOVE_CHANCE
.got_move_chance
2013-03-26 22:52:04 -07:00
call BattleRandom
2013-03-26 17:39:44 -07:00
cp [hl]
pop hl
ret c
2013-03-26 22:52:04 -07:00
.failed
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wEffectFailed], a
2013-03-26 17:39:44 -07:00
and a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_LowerSub:
; lowersub
2013-03-26 22:52:04 -07:00
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_SUBSTITUTE, a
2013-03-26 17:39:44 -07:00
ret z
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_CHARGED, a
2015-11-06 13:42:38 -08:00
jr nz, .already_charged
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-04-27 14:12:23 -07:00
cp EFFECT_RAZOR_WIND
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-04-27 14:12:23 -07:00
cp EFFECT_SKY_ATTACK
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-04-27 14:12:23 -07:00
cp EFFECT_SKULL_BASH
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-04-27 14:12:23 -07:00
cp EFFECT_SOLARBEAM
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-04-27 14:12:23 -07:00
cp EFFECT_FLY
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-03-26 17:39:44 -07:00
2015-11-06 13:42:38 -08:00
.already_charged
2013-03-26 17:39:44 -07:00
call .Rampage
2015-11-06 13:42:38 -08:00
jr z, .charge_turn
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
call CheckUserIsCharging
2013-03-26 17:39:44 -07:00
ret nz
2015-11-06 13:42:38 -08:00
.charge_turn
2015-11-06 19:36:06 -08:00
call _CheckBattleScene
2015-11-09 13:41:09 -08:00
jr c, .mimic_anims
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-26 17:39:44 -07:00
inc a
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
ld a, SUBSTITUTE
2015-11-09 13:41:09 -08:00
jp LoadAnim
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
.mimic_anims
2015-11-06 19:36:06 -08:00
call BattleCommand_LowerSubNoAnim
jp BattleCommand_MoveDelay
2013-03-26 17:39:44 -07:00
.Rampage:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-04-27 14:12:23 -07:00
cp EFFECT_ROLLOUT
2015-11-06 13:42:38 -08:00
jr z, .rollout_rampage
2013-04-27 14:12:23 -07:00
cp EFFECT_RAMPAGE
2015-11-06 13:42:38 -08:00
jr z, .rollout_rampage
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
2015-11-06 13:42:38 -08:00
.rollout_rampage
2016-01-09 13:28:22 -08:00
ld a, [wSomeoneIsRampaging]
2013-03-26 17:39:44 -07:00
and a
ld a, 0
2016-01-09 13:28:22 -08:00
ld [wSomeoneIsRampaging], a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_MoveAnim:
; moveanim
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
call BattleCommand_MoveAnimNoSub
2015-11-06 13:42:38 -08:00
jp BattleCommand_RaiseSub
2018-06-24 07:09:41 -07:00
BattleCommand_MoveAnimNoSub:
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jp nz, BattleCommand_MoveDelay
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld de, wPlayerRolloutCount
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_ENEMY_DAMAGE
jr z, .got_rollout_count
2018-01-23 14:39:09 -08:00
ld de, wEnemyRolloutCount
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_PLAYER_DAMAGE
2013-03-26 17:39:44 -07:00
.got_rollout_count
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-04-25 01:26:37 -07:00
cp EFFECT_MULTI_HIT
jr z, .alternate_anim
2013-04-25 01:26:37 -07:00
cp EFFECT_CONVERSION
jr z, .alternate_anim
2013-04-25 01:26:37 -07:00
cp EFFECT_DOUBLE_HIT
jr z, .alternate_anim
cp EFFECT_POISON_MULTI_HIT
jr z, .alternate_anim
2013-04-25 01:26:37 -07:00
cp EFFECT_TRIPLE_KICK
2015-11-06 13:42:38 -08:00
jr z, .triplekick
2013-03-26 17:39:44 -07:00
xor a
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2013-03-26 17:39:44 -07:00
2015-11-06 13:42:38 -08:00
.triplekick
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld e, a
ld d, 0
call PlayFXAnimID
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp FLY
jr z, .clear_sprite
2013-03-26 17:39:44 -07:00
cp DIG
ret nz
.clear_sprite
2015-11-09 13:41:09 -08:00
jp AppearUserLowerSub
.alternate_anim
2015-11-06 17:55:16 -08:00
ld a, [wKickCounter]
2013-05-02 23:43:44 -07:00
and 1
xor 1
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2013-03-26 17:39:44 -07:00
ld a, [de]
cp 1
2013-03-26 17:39:44 -07:00
push af
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld e, a
2013-05-02 23:43:44 -07:00
ld d, 0
2013-03-26 17:39:44 -07:00
pop af
jp z, PlayFXAnimID
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
jp PlayFXAnimID
2018-06-24 07:09:41 -07:00
BattleCommand_StatUpAnim:
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jp nz, BattleCommand_MoveDelay
2013-03-26 17:39:44 -07:00
xor a
2015-11-06 13:42:38 -08:00
jr BattleCommand_StatUpDownAnim
2018-06-24 07:09:41 -07:00
BattleCommand_StatDownAnim:
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jp nz, BattleCommand_MoveDelay
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_ENEMY_STAT_DOWN
2015-11-06 13:42:38 -08:00
jr z, BattleCommand_StatUpDownAnim
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_WOBBLE
2013-03-26 17:39:44 -07:00
; fallthrough
2018-06-24 07:09:41 -07:00
BattleCommand_StatUpDownAnim:
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
xor a
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld e, a
ld d, 0
jp PlayFXAnimID
2018-06-24 07:09:41 -07:00
BattleCommand_SwitchTurn:
2013-03-26 22:52:04 -07:00
; switchturn
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
2013-03-26 22:52:04 -07:00
xor 1
2013-03-26 17:39:44 -07:00
ld [hBattleTurn], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_RaiseSub:
; raisesub
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_SUBSTITUTE, a
2013-03-26 17:39:44 -07:00
ret z
2013-03-26 22:52:04 -07:00
2015-11-06 19:36:06 -08:00
call _CheckBattleScene
jp c, BattleCommand_RaiseSubNoAnim
2013-03-26 22:52:04 -07:00
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-26 17:39:44 -07:00
ld a, $2
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
ld a, SUBSTITUTE
2015-11-09 13:41:09 -08:00
jp LoadAnim
2018-06-24 07:09:41 -07:00
BattleCommand_FailureText:
2015-11-09 13:41:09 -08:00
; failuretext
; If the move missed or failed, load the appropriate
; text, and end the effects of multi-turn or multi-
; hit moves.
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
ret z
2013-03-26 22:52:04 -07:00
2015-11-09 13:41:09 -08:00
call GetFailureResultText
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVarAddr
2013-03-26 22:52:04 -07:00
cp FLY
2015-11-09 13:41:09 -08:00
jr z, .fly_dig
2013-03-26 22:52:04 -07:00
cp DIG
2015-11-09 13:41:09 -08:00
jr z, .fly_dig
2013-03-26 22:52:04 -07:00
; Move effect:
2013-03-26 17:39:44 -07:00
inc hl
ld a, [hl]
2013-03-26 22:52:04 -07:00
2013-04-27 14:12:23 -07:00
cp EFFECT_MULTI_HIT
2015-11-09 13:41:09 -08:00
jr z, .multihit
2013-04-27 14:12:23 -07:00
cp EFFECT_DOUBLE_HIT
2015-11-09 13:41:09 -08:00
jr z, .multihit
cp EFFECT_POISON_MULTI_HIT
2015-11-09 13:41:09 -08:00
jr z, .multihit
2013-03-26 17:39:44 -07:00
jp EndMoveEffect
2013-03-26 22:52:04 -07:00
2015-11-09 13:41:09 -08:00
.multihit
2015-11-06 13:42:38 -08:00
call BattleCommand_RaiseSub
2013-03-26 17:39:44 -07:00
jp EndMoveEffect
2013-03-26 22:52:04 -07:00
2015-11-09 13:41:09 -08:00
.fly_dig
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
2013-05-02 23:43:44 -07:00
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
2015-11-09 13:41:09 -08:00
call AppearUserRaiseSub
2013-03-26 17:39:44 -07:00
jp EndMoveEffect
2018-06-24 07:09:41 -07:00
BattleCommand_ApplyDamage:
; applydamage
2013-03-27 14:07:00 -07:00
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_ENDURE, a
jr z, .focus_band
call BattleCommand_FalseSwipe
ld b, 0
jr nc, .damage
ld b, 1
jr .damage
2013-03-26 17:39:44 -07:00
.focus_band
2013-03-26 17:39:44 -07:00
call GetOpponentItem
ld a, b
2013-05-02 22:29:57 -07:00
cp HELD_FOCUS_BAND
ld b, 0
jr nz, .damage
call BattleRandom
2013-03-26 17:39:44 -07:00
cp c
jr nc, .damage
call BattleCommand_FalseSwipe
ld b, 0
jr nc, .damage
ld b, 2
.damage
2013-03-26 17:39:44 -07:00
push bc
call .update_damage_taken
ld c, FALSE
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2015-11-09 13:41:09 -08:00
jr nz, .damage_player
call DoEnemyDamage
2015-11-09 13:41:09 -08:00
jr .done_damage
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
.damage_player
call DoPlayerDamage
2013-03-26 17:39:44 -07:00
2015-11-09 13:41:09 -08:00
.done_damage
2013-03-26 17:39:44 -07:00
pop bc
ld a, b
and a
ret z
2013-03-26 17:39:44 -07:00
dec a
jr nz, .focus_band_text
2013-03-27 14:07:00 -07:00
ld hl, EnduredText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.focus_band_text
2013-03-26 17:39:44 -07:00
call GetOpponentItem
ld a, [hl]
2015-11-06 17:55:16 -08:00
ld [wNamedObjectIndexBuffer], a
2013-05-02 22:29:57 -07:00
call GetItemName
2013-03-27 14:07:00 -07:00
ld hl, HungOnText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.update_damage_taken
2013-05-02 22:29:57 -07:00
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
2013-05-02 22:29:57 -07:00
bit SUBSTATUS_SUBSTITUTE, a
2013-03-26 17:39:44 -07:00
ret nz
2013-05-02 22:29:57 -07:00
2018-01-23 14:39:09 -08:00
ld de, wPlayerDamageTaken + 1
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr nz, .got_damage_taken
2018-01-23 14:39:09 -08:00
ld de, wEnemyDamageTaken + 1
2013-03-26 17:39:44 -07:00
.got_damage_taken
2018-01-23 14:39:09 -08:00
ld a, [wCurDamage + 1]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [de]
add b
ld [de], a
dec de
2018-01-23 14:39:09 -08:00
ld a, [wCurDamage]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [de]
adc b
ld [de], a
ret nc
ld a, $ff
ld [de], a
inc de
ld [de], a
ret
2018-06-24 07:09:41 -07:00
GetFailureResultText:
2013-03-27 14:07:00 -07:00
ld hl, DoesntAffectText
ld de, DoesntAffectText
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and $7f
2015-11-09 13:41:09 -08:00
jr z, .got_text
2013-05-02 23:43:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_FUTURE_SIGHT
2013-03-27 14:07:00 -07:00
ld hl, ButItFailedText
ld de, ItFailedText
2015-11-09 13:41:09 -08:00
jr z, .got_text
2013-03-27 14:07:00 -07:00
ld hl, AttackMissedText
ld de, AttackMissed2Text
2018-01-23 14:39:09 -08:00
ld a, [wCriticalHit]
cp -1
2015-11-09 13:41:09 -08:00
jr nz, .got_text
2013-03-27 14:07:00 -07:00
ld hl, UnaffectedText
2015-11-09 13:41:09 -08:00
.got_text
call FailText_CheckOpponentProtect
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wCriticalHit], a
2013-05-02 23:43:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_JUMP_KICK
2013-03-26 17:39:44 -07:00
ret nz
2015-11-09 13:41:09 -08:00
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and $7f
ret z
2015-11-09 13:41:09 -08:00
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, [hl]
2018-05-06 09:16:57 -07:00
rept 3
2013-03-26 17:39:44 -07:00
srl a
rr b
2018-05-06 09:16:57 -07:00
endr
2013-03-26 17:39:44 -07:00
ld [hl], b
dec hl
ld [hli], a
or b
2015-11-09 13:41:09 -08:00
jr nz, .do_at_least_1_damage
2013-03-26 17:39:44 -07:00
inc a
ld [hl], a
2015-11-09 13:41:09 -08:00
.do_at_least_1_damage
2013-03-27 14:07:00 -07:00
ld hl, CrashedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
ld a, $1
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2015-11-09 13:41:09 -08:00
call LoadMoveAnim
ld c, TRUE
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jp nz, DoEnemyDamage
jp DoPlayerDamage
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
FailText_CheckOpponentProtect:
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_PROTECT, a
2015-11-09 13:41:09 -08:00
jr z, .not_protected
2013-03-26 17:39:44 -07:00
ld h, d
ld l, e
2015-11-09 13:41:09 -08:00
.not_protected
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
BattleCommand_BideFailText:
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
ret z
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and $7f
jp z, PrintDoesntAffect
jp PrintButItFailed
2018-06-24 07:09:41 -07:00
BattleCommand_CriticalText:
2013-03-26 17:39:44 -07:00
; criticaltext
; Prints the message for critical hits or one-hit KOs.
; If there is no message to be printed, wait 20 frames.
2018-01-23 14:39:09 -08:00
ld a, [wCriticalHit]
2013-03-26 17:39:44 -07:00
and a
jr z, .wait
dec a
add a
ld hl, .texts
2013-03-26 17:39:44 -07:00
ld b, 0
ld c, a
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wCriticalHit], a
2013-03-26 17:39:44 -07:00
.wait
ld c, 20
jp DelayFrames
.texts
dw CriticalHitText
dw OneHitKOText
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_StartLoop:
2013-03-26 22:52:04 -07:00
; startloop
2018-01-23 14:39:09 -08:00
ld hl, wPlayerRolloutCount
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .ok
2018-01-23 14:39:09 -08:00
ld hl, wEnemyRolloutCount
.ok
2013-03-26 17:39:44 -07:00
xor a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_SuperEffectiveLoopText:
2013-03-26 22:52:04 -07:00
; supereffectivelooptext
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
bit SUBSTATUS_IN_LOOP, a
2013-03-26 17:39:44 -07:00
ret nz
; fallthrough
2018-06-24 07:09:41 -07:00
BattleCommand_SuperEffectiveText:
2013-03-26 22:52:04 -07:00
; supereffectivetext
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and $7f
cp 10 ; 1.0
ret z
ld hl, SuperEffectiveText
2013-03-26 17:39:44 -07:00
jr nc, .print
ld hl, NotVeryEffectiveText
2013-03-26 17:39:44 -07:00
.print
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
BattleCommand_CheckDestinyBond:
2013-03-26 22:52:04 -07:00
; checkdestinybond
; Faint the user if it fainted an opponent using Destiny Bond.
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_hp
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonHP
2013-03-26 22:52:04 -07:00
.got_hp
2013-03-26 17:39:44 -07:00
ld a, [hli]
or [hl]
ret nz
2013-03-26 22:52:04 -07:00
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_DESTINY_BOND, a
jr z, .no_dbond
2013-03-26 22:52:04 -07:00
2013-03-27 14:07:00 -07:00
ld hl, TookDownWithItText
call StdBattleTextBox
2013-04-27 14:12:23 -07:00
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonMaxHP + 1
2013-04-27 14:12:23 -07:00
bccoord 2, 2 ; hp bar
ld a, 0
jr nz, .got_max_hp
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonMaxHP + 1
2013-04-27 14:12:23 -07:00
bccoord 10, 9 ; hp bar
ld a, 1
.got_max_hp
ld [wWhichHPBar], a
2013-03-26 17:39:44 -07:00
ld a, [hld]
2018-01-23 14:39:09 -08:00
ld [wBuffer1], a
2013-03-26 17:39:44 -07:00
ld a, [hld]
2018-01-23 14:39:09 -08:00
ld [wBuffer2], a
2013-03-26 17:39:44 -07:00
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wBuffer3], a
2013-03-26 17:39:44 -07:00
xor a
ld [hld], a
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wBuffer4], a
2013-03-26 17:39:44 -07:00
xor a
ld [hl], a
2018-01-23 14:39:09 -08:00
ld [wBuffer5], a
ld [wBuffer6], a
2013-03-26 17:39:44 -07:00
ld h, b
ld l, c
predef AnimateHPBar
2013-05-02 21:22:28 -07:00
call RefreshBattleHuds
2013-03-26 22:52:04 -07:00
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-26 17:39:44 -07:00
inc a
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
ld a, DESTINY_BOND
2015-11-09 13:41:09 -08:00
call LoadAnim
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-26 22:52:04 -07:00
jr .finish
2013-03-26 22:52:04 -07:00
.no_dbond
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-04-27 14:12:23 -07:00
cp EFFECT_MULTI_HIT
jr z, .multiple_hit_raise_sub
2013-04-27 14:12:23 -07:00
cp EFFECT_DOUBLE_HIT
jr z, .multiple_hit_raise_sub
cp EFFECT_POISON_MULTI_HIT
jr z, .multiple_hit_raise_sub
2013-04-27 14:12:23 -07:00
cp EFFECT_TRIPLE_KICK
jr z, .multiple_hit_raise_sub
2013-04-27 14:12:23 -07:00
cp EFFECT_BEAT_UP
jr nz, .finish
2013-03-26 22:52:04 -07:00
.multiple_hit_raise_sub
2015-11-06 13:42:38 -08:00
call BattleCommand_RaiseSub
2013-03-26 22:52:04 -07:00
.finish
2013-03-26 17:39:44 -07:00
jp EndMoveEffect
2018-06-24 07:09:41 -07:00
BattleCommand_BuildOpponentRage:
2013-03-26 22:52:04 -07:00
; buildopponentrage
2013-03-26 17:39:44 -07:00
jp .start
2013-03-26 17:39:44 -07:00
.start
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
ret nz
2013-03-26 22:52:04 -07:00
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
2013-05-02 23:43:44 -07:00
bit SUBSTATUS_RAGE, a
2013-03-26 17:39:44 -07:00
ret z
2013-03-26 22:52:04 -07:00
2015-11-05 16:13:09 -08:00
ld de, wEnemyRageCounter
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2015-11-05 16:13:09 -08:00
jr z, .player
ld de, wPlayerRageCounter
.player
2013-03-26 17:39:44 -07:00
ld a, [de]
inc a
ret z
ld [de], a
2013-03-26 22:52:04 -07:00
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-27 14:07:00 -07:00
ld hl, RageBuildingText
call StdBattleTextBox
2015-10-10 04:45:39 -07:00
jp BattleCommand_SwitchTurn
2018-06-24 07:09:41 -07:00
BattleCommand_RageDamage:
2013-03-26 22:52:04 -07:00
; ragedamage
2018-01-23 14:39:09 -08:00
ld a, [wCurDamage]
2013-03-26 17:39:44 -07:00
ld h, a
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wCurDamage + 1]
2013-03-26 17:39:44 -07:00
ld l, a
ld c, a
ld a, [hBattleTurn]
and a
2015-11-05 16:13:09 -08:00
ld a, [wPlayerRageCounter]
jr z, .rage_loop
2015-11-05 16:13:09 -08:00
ld a, [wEnemyRageCounter]
.rage_loop
2013-03-26 17:39:44 -07:00
and a
jr z, .done
2013-03-26 17:39:44 -07:00
dec a
add hl, bc
jr nc, .rage_loop
2018-01-25 18:34:42 -08:00
ld hl, $ffff
.done
2013-03-26 17:39:44 -07:00
ld a, h
2018-01-23 14:39:09 -08:00
ld [wCurDamage], a
2013-03-26 17:39:44 -07:00
ld a, l
2018-01-23 14:39:09 -08:00
ld [wCurDamage + 1], a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
EndMoveEffect:
2018-01-23 14:39:09 -08:00
ld a, [wBattleScriptBufferAddress]
2013-03-26 17:39:44 -07:00
ld l, a
2018-01-23 14:39:09 -08:00
ld a, [wBattleScriptBufferAddress + 1]
2013-03-26 17:39:44 -07:00
ld h, a
ld a, $ff
ld [hli], a
2015-12-26 18:59:03 -08:00
ld [hli], a
2013-03-26 17:39:44 -07:00
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
DittoMetalPowder:
ld a, MON_SPECIES
2013-03-26 17:39:44 -07:00
call BattlePartyAttr
ld a, [hBattleTurn]
and a
ld a, [hl]
jr nz, .Ditto
2018-01-23 14:39:09 -08:00
ld a, [wTempEnemyMonSpecies]
2013-03-26 17:39:44 -07:00
.Ditto:
2013-03-26 17:39:44 -07:00
cp DITTO
ret nz
push bc
call GetOpponentItem
ld a, [hl]
cp METAL_POWDER
pop bc
ret nz
ld a, c
srl a
add c
ld c, a
ret nc
srl b
ld a, b
and a
jr nz, .done
2013-03-26 17:39:44 -07:00
inc b
.done
2013-03-26 17:39:44 -07:00
scf
rr c
ret
2018-06-24 07:09:41 -07:00
BattleCommand_DamageStats:
; damagestats
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jp nz, EnemyAttackDamage
; fallthrough
2018-06-24 07:09:41 -07:00
PlayerAttackDamage:
; Return move power d, player level e, enemy defense c and player attack b.
2013-03-26 17:39:44 -07:00
call ResetDamage
ld hl, wPlayerMoveStructPower
2013-03-26 17:39:44 -07:00
ld a, [hli]
and a
ld d, a
ret z
2013-03-26 17:39:44 -07:00
ld a, [hl]
2014-01-05 05:24:27 -08:00
cp SPECIAL
jr nc, .special
.physical
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonDefense
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
bit SCREENS_REFLECT, a
jr z, .physicalcrit
2013-03-26 17:39:44 -07:00
sla c
rl b
.physicalcrit
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonAttack
2013-03-26 17:39:44 -07:00
call GetDamageStatsCritical
jr c, .thickclub
2018-01-23 14:39:09 -08:00
ld hl, wEnemyDefense
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wPlayerAttack
jr .thickclub
.special
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonSpclDef
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
bit SCREENS_LIGHT_SCREEN, a
jr z, .specialcrit
2013-03-26 17:39:44 -07:00
sla c
rl b
.specialcrit
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonSpclAtk
2013-03-26 17:39:44 -07:00
call GetDamageStatsCritical
jr c, .lightball
2018-01-23 14:39:09 -08:00
ld hl, wEnemySpDef
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSpAtk
.lightball
; Note: Returns player special attack at hl in hl.
call LightBallBoost
jr .done
.thickclub
; Note: Returns player attack at hl in hl.
call ThickClubBoost
.done
2015-11-09 13:41:09 -08:00
call TruncateHL_BC
2018-01-23 14:39:09 -08:00
ld a, [wBattleMonLevel]
2013-03-26 17:39:44 -07:00
ld e, a
call DittoMetalPowder
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
2018-06-24 07:09:41 -07:00
TruncateHL_BC:
2015-11-09 13:41:09 -08:00
.loop
; Truncate 16-bit values hl and bc to 8-bit values b and c respectively.
; b = hl, c = bc
2013-03-26 17:39:44 -07:00
ld a, h
or b
2015-11-09 13:41:09 -08:00
jr z, .finish
2013-03-26 17:39:44 -07:00
srl b
rr c
srl b
rr c
2013-03-26 17:39:44 -07:00
ld a, c
or b
2015-11-09 13:41:09 -08:00
jr nz, .done_bc
2013-03-26 17:39:44 -07:00
inc c
2015-11-09 13:41:09 -08:00
.done_bc
2013-03-26 17:39:44 -07:00
srl h
rr l
srl h
rr l
2013-03-26 17:39:44 -07:00
ld a, l
or h
2015-11-09 13:41:09 -08:00
jr nz, .finish
2013-03-26 17:39:44 -07:00
inc l
2015-11-09 13:41:09 -08:00
.finish
ld a, [wLinkMode]
cp 3
jr z, .done
; If we go back to the loop point,
; it's the same as doing this exact
; same check twice.
2013-03-26 17:39:44 -07:00
ld a, h
or b
2015-11-09 13:41:09 -08:00
jr nz, .loop
.done
2013-03-26 17:39:44 -07:00
ld b, l
ret
2018-06-24 07:09:41 -07:00
GetDamageStatsCritical:
2013-03-26 17:39:44 -07:00
; Return carry if non-critical.
2018-01-23 14:39:09 -08:00
ld a, [wCriticalHit]
2013-03-26 17:39:44 -07:00
and a
scf
ret z
; fallthrough
2018-06-24 07:09:41 -07:00
GetDamageStats:
2013-03-26 17:39:44 -07:00
; Return the attacker's offensive stat and the defender's defensive
; stat based on whether the attacking type is physical or special.
push hl
push bc
ld a, [hBattleTurn]
and a
jr nz, .enemy
ld a, [wPlayerMoveStructType]
2014-01-05 05:24:27 -08:00
cp SPECIAL
2013-03-26 17:39:44 -07:00
; special
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSAtkLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wEnemySDefLevel]
2013-03-26 17:39:44 -07:00
jr nc, .end
; physical
2018-01-23 14:39:09 -08:00
ld a, [wPlayerAtkLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wEnemyDefLevel]
2013-03-26 17:39:44 -07:00
jr .end
.enemy
ld a, [wEnemyMoveStructType]
2014-01-05 05:24:27 -08:00
cp SPECIAL
2013-03-26 17:39:44 -07:00
; special
2018-01-23 14:39:09 -08:00
ld a, [wEnemySAtkLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSDefLevel]
2013-03-26 17:39:44 -07:00
jr nc, .end
; physical
2018-01-23 14:39:09 -08:00
ld a, [wEnemyAtkLevel]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wPlayerDefLevel]
2013-03-26 17:39:44 -07:00
.end
cp b
pop bc
pop hl
ret
2018-06-24 07:09:41 -07:00
ThickClubBoost:
2013-04-19 23:29:39 -07:00
; Return in hl the stat value at hl.
2013-03-26 17:39:44 -07:00
; If the attacking monster is Cubone or Marowak and
2013-04-19 23:29:39 -07:00
; it's holding a Thick Club, double it.
2013-03-26 17:39:44 -07:00
push bc
push de
ld b, CUBONE
ld c, MAROWAK
ld d, THICK_CLUB
call SpeciesItemBoost
pop de
pop bc
ret
2018-06-24 07:09:41 -07:00
LightBallBoost:
2013-04-19 23:29:39 -07:00
; Return in hl the stat value at hl.
2013-03-26 17:39:44 -07:00
; If the attacking monster is Pikachu and it's
2013-04-19 23:29:39 -07:00
; holding a Light Ball, double it.
2013-03-26 17:39:44 -07:00
push bc
push de
ld b, PIKACHU
ld c, PIKACHU
ld d, LIGHT_BALL
call SpeciesItemBoost
pop de
pop bc
ret
2018-06-24 07:09:41 -07:00
SpeciesItemBoost:
2013-04-19 23:29:39 -07:00
; Return in hl the stat value at hl.
2013-03-26 17:39:44 -07:00
; If the attacking monster is species b or c and
2013-04-19 23:29:39 -07:00
; it's holding item d, double it.
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld l, [hl]
ld h, a
push hl
ld a, MON_SPECIES
2013-03-26 17:39:44 -07:00
call BattlePartyAttr
ld a, [hBattleTurn]
and a
ld a, [hl]
jr z, .CompareSpecies
2018-01-23 14:39:09 -08:00
ld a, [wTempEnemyMonSpecies]
.CompareSpecies:
2013-03-26 17:39:44 -07:00
pop hl
cp b
jr z, .GetItemHeldEffect
2013-03-26 17:39:44 -07:00
cp c
ret nz
.GetItemHeldEffect:
2013-03-26 17:39:44 -07:00
push hl
call GetUserItem
ld a, [hl]
pop hl
cp d
ret nz
; Double the stat
sla l
rl h
ret
2018-06-24 07:09:41 -07:00
EnemyAttackDamage:
2013-03-26 17:39:44 -07:00
call ResetDamage
; No damage dealt with 0 power.
ld hl, wEnemyMoveStructPower
ld a, [hli] ; hl = wEnemyMoveStructType
2013-03-26 17:39:44 -07:00
ld d, a
and a
ret z
ld a, [hl]
2014-01-05 05:24:27 -08:00
cp SPECIAL
2013-03-26 17:39:44 -07:00
jr nc, .Special
.physical
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonDefense
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld a, [wPlayerScreens]
bit SCREENS_REFLECT, a
jr z, .physicalcrit
2013-03-26 17:39:44 -07:00
sla c
rl b
.physicalcrit
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonAttack
2013-03-26 17:39:44 -07:00
call GetDamageStatsCritical
jr c, .thickclub
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wPlayerDefense
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wEnemyAttack
jr .thickclub
2013-03-26 17:39:44 -07:00
.Special:
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonSpclDef
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld a, [wPlayerScreens]
bit SCREENS_LIGHT_SCREEN, a
jr z, .specialcrit
2013-03-26 17:39:44 -07:00
sla c
rl b
.specialcrit
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonSpclAtk
2013-03-26 17:39:44 -07:00
call GetDamageStatsCritical
jr c, .lightball
2018-01-23 14:39:09 -08:00
ld hl, wPlayerSpDef
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 14:39:09 -08:00
ld hl, wEnemySpAtk
2013-03-26 17:39:44 -07:00
.lightball
call LightBallBoost
jr .done
2013-03-26 17:39:44 -07:00
.thickclub
call ThickClubBoost
2013-03-26 17:39:44 -07:00
.done
2015-11-09 13:41:09 -08:00
call TruncateHL_BC
2018-01-23 14:39:09 -08:00
ld a, [wEnemyMonLevel]
2013-03-26 17:39:44 -07:00
ld e, a
call DittoMetalPowder
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
INCLUDE "engine/battle/move_effects/beat_up.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_ClearMissDamage:
2013-03-26 22:52:04 -07:00
; clearmissdamage
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
ret z
2015-09-09 16:27:07 -07:00
2013-03-26 17:39:44 -07:00
jp ResetDamage
2018-06-24 07:09:41 -07:00
HitSelfInConfusion:
2013-03-26 17:39:44 -07:00
call ResetDamage
ld a, [hBattleTurn]
and a
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonDefense
ld de, wPlayerScreens
ld a, [wBattleMonLevel]
2015-11-09 13:41:09 -08:00
jr z, .got_it
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonDefense
ld de, wEnemyScreens
ld a, [wEnemyMonLevel]
2015-11-09 13:41:09 -08:00
.got_it
2013-03-26 17:39:44 -07:00
push af
ld a, [hli]
ld b, a
ld c, [hl]
ld a, [de]
bit SCREENS_REFLECT, a
2015-11-09 13:41:09 -08:00
jr z, .mimic_screen
2013-03-26 17:39:44 -07:00
sla c
rl b
2015-11-09 13:41:09 -08:00
.mimic_screen
2013-03-26 17:39:44 -07:00
dec hl
dec hl
dec hl
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld l, [hl]
ld h, a
2015-11-09 13:41:09 -08:00
call TruncateHL_BC
ld d, 40
2013-03-26 17:39:44 -07:00
pop af
ld e, a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_DamageCalc:
; damagecalc
; Return a damage value for move power d, player level e, enemy defense c and player attack b.
; Return 1 if successful, else 0.
2013-03-26 22:52:04 -07:00
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
; Selfdestruct and Explosion halve defense.
cp EFFECT_SELFDESTRUCT
jr nz, .dont_selfdestruct
2013-03-26 17:39:44 -07:00
srl c
jr nz, .dont_selfdestruct
2013-03-26 17:39:44 -07:00
inc c
.dont_selfdestruct
; Variable-hit moves and Conversion can have a power of 0.
2013-04-25 01:26:37 -07:00
cp EFFECT_MULTI_HIT
jr z, .skip_zero_damage_check
2013-04-25 01:26:37 -07:00
cp EFFECT_CONVERSION
jr z, .skip_zero_damage_check
; No damage if move power is 0.
2013-03-26 17:39:44 -07:00
ld a, d
and a
ret z
.skip_zero_damage_check
; Minimum defense value is 1.
2013-03-26 17:39:44 -07:00
ld a, c
and a
jr nz, .not_dividing_by_zero
ld c, 1
.not_dividing_by_zero
2013-03-26 17:39:44 -07:00
xor a
ld hl, hDividend
2013-03-26 17:39:44 -07:00
ld [hli], a
2015-12-26 18:59:03 -08:00
ld [hli], a
2013-03-26 17:39:44 -07:00
ld [hl], a
; Level * 2
2013-03-26 17:39:44 -07:00
ld a, e
add a
jr nc, .level_not_overflowing
2013-03-26 17:39:44 -07:00
ld [hl], $1
.level_not_overflowing
2013-03-26 17:39:44 -07:00
inc hl
ld [hli], a
; / 5
ld a, 5
2013-03-26 17:39:44 -07:00
ld [hld], a
push bc
ld b, $4
call Divide
2013-03-26 17:39:44 -07:00
pop bc
; + 2
2013-03-26 17:39:44 -07:00
inc [hl]
2015-12-26 18:59:03 -08:00
inc [hl]
; * bp
2013-03-26 17:39:44 -07:00
inc hl
ld [hl], d
call Multiply
; * Attack
2013-03-26 17:39:44 -07:00
ld [hl], b
call Multiply
; / Defense
2013-03-26 17:39:44 -07:00
ld [hl], c
ld b, $4
call Divide
; / 50
ld [hl], 50
2013-03-26 17:39:44 -07:00
ld b, $4
call Divide
; Item boosts
2013-03-26 17:39:44 -07:00
call GetUserItem
2013-03-26 17:39:44 -07:00
ld a, b
and a
jr z, .DoneItem
2013-03-26 17:39:44 -07:00
ld hl, TypeBoostItems
.NextItem:
2013-03-26 17:39:44 -07:00
ld a, [hli]
cp -1
jr z, .DoneItem
; Item effect
2013-03-26 17:39:44 -07:00
cp b
ld a, [hli]
jr nz, .NextItem
; Type
2013-03-26 17:39:44 -07:00
ld b, a
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVar
2013-03-26 17:39:44 -07:00
cp b
jr nz, .DoneItem
; * 100 + item effect amount
2013-03-26 17:39:44 -07:00
ld a, c
add 100
ld [hMultiplier], a
call Multiply
; / 100
ld a, 100
ld [hDivisor], a
ld b, 4
call Divide
2018-06-25 09:24:18 -07:00
.DoneItem:
; Critical hits
call .CriticalMultiplier
2018-01-23 14:39:09 -08:00
; Update wCurDamage (capped at 997).
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld b, [hl]
ld a, [hProduct + 3]
2013-03-26 17:39:44 -07:00
add b
ld [hProduct + 3], a
jr nc, .dont_cap_1
ld a, [hProduct + 2]
2013-03-26 17:39:44 -07:00
inc a
ld [hProduct + 2], a
2013-03-26 17:39:44 -07:00
and a
jr z, .Cap
.dont_cap_1
ld a, [hProduct]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hProduct + 1]
2013-03-26 17:39:44 -07:00
or a
jr nz, .Cap
ld a, [hProduct + 2]
cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_2
cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap
ld a, [hProduct + 3]
cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr nc, .Cap
.dont_cap_2
2013-03-26 17:39:44 -07:00
inc hl
ld a, [hProduct + 3]
2013-03-26 17:39:44 -07:00
ld b, [hl]
add b
ld [hld], a
ld a, [hProduct + 2]
2013-03-26 17:39:44 -07:00
ld b, [hl]
adc b
ld [hl], a
jr c, .Cap
2013-03-26 17:39:44 -07:00
ld a, [hl]
cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3
cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
jr nc, .Cap
2013-03-26 17:39:44 -07:00
inc hl
ld a, [hld]
cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
jr c, .dont_cap_3
.Cap:
ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
2013-03-26 17:39:44 -07:00
ld [hli], a
ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
2013-03-26 17:39:44 -07:00
ld [hld], a
.dont_cap_3
; Minimum neutral damage is 2 (bringing the cap to 999).
2013-03-26 17:39:44 -07:00
inc hl
ld a, [hl]
add MIN_NEUTRAL_DAMAGE
2013-03-26 17:39:44 -07:00
ld [hld], a
jr nc, .dont_floor
2013-03-26 17:39:44 -07:00
inc [hl]
.dont_floor
ld a, 1
2013-03-26 17:39:44 -07:00
and a
ret
.CriticalMultiplier:
2018-01-23 14:39:09 -08:00
ld a, [wCriticalHit]
2013-03-26 17:39:44 -07:00
and a
ret z
; x2
ld a, [hQuotient + 2]
2013-03-26 17:39:44 -07:00
add a
ld [hProduct + 3], a
ld a, [hQuotient + 1]
2013-03-26 17:39:44 -07:00
rl a
ld [hProduct + 2], a
; Cap at $ffff.
2013-03-26 17:39:44 -07:00
ret nc
ld a, $ff
ld [hProduct + 2], a
ld [hProduct + 3], a
2013-03-26 17:39:44 -07:00
ret
2018-01-22 13:23:34 -08:00
INCLUDE "data/types/type_boost_items.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_ConstantDamage:
2013-03-26 22:52:04 -07:00
; constantdamage
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonLevel
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_turn
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonLevel
2013-03-26 17:39:44 -07:00
.got_turn
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_LEVEL_DAMAGE
2013-03-26 17:39:44 -07:00
ld b, [hl]
ld a, 0
jr z, .got_power
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
2013-05-02 23:43:44 -07:00
cp EFFECT_PSYWAVE
jr z, .psywave
2013-03-26 17:39:44 -07:00
2013-05-02 23:43:44 -07:00
cp EFFECT_SUPER_FANG
jr z, .super_fang
2013-03-26 17:39:44 -07:00
2013-05-02 23:43:44 -07:00
cp EFFECT_REVERSAL
jr z, .reversal
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_POWER
call GetBattleVar
2013-03-26 17:39:44 -07:00
ld b, a
ld a, $0
jr .got_power
2013-03-26 17:39:44 -07:00
.psywave
2013-03-26 17:39:44 -07:00
ld a, b
srl a
add b
ld b, a
.psywave_loop
call BattleRandom
2013-03-26 17:39:44 -07:00
and a
jr z, .psywave_loop
2013-03-26 17:39:44 -07:00
cp b
jr nc, .psywave_loop
2013-03-26 17:39:44 -07:00
ld b, a
ld a, 0
jr .got_power
.super_fang
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_hp
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonHP
.got_hp
2013-03-26 17:39:44 -07:00
ld a, [hli]
srl a
ld b, a
ld a, [hl]
rr a
push af
ld a, b
pop bc
and a
jr nz, .got_power
2013-03-26 17:39:44 -07:00
or b
ld a, 0
jr nz, .got_power
ld b, 1
jr .got_power
.got_power
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld [hli], a
ld [hl], b
ret
.reversal
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .reversal_got_hp
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonHP
.reversal_got_hp
2013-03-26 17:39:44 -07:00
xor a
ld [hDividend], a
ld [hMultiplicand + 0], a
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld [hMultiplicand + 1], a
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld [hMultiplicand + 2], a
2013-03-26 17:39:44 -07:00
ld a, $30
ld [hMultiplier], a
2013-05-02 23:43:44 -07:00
call Multiply
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld a, [hl]
ld [hDivisor], a
2013-03-26 17:39:44 -07:00
ld a, b
and a
jr z, .skip_to_divide
2013-03-26 17:39:44 -07:00
ld a, [hProduct + 4]
2013-03-26 17:39:44 -07:00
srl b
rr a
srl b
rr a
ld [hDivisor], a
ld a, [hProduct + 2]
2013-03-26 17:39:44 -07:00
ld b, a
srl b
ld a, [hProduct + 3]
2013-03-26 17:39:44 -07:00
rr a
srl b
rr a
ld [hDividend + 3], a
2013-03-26 17:39:44 -07:00
ld a, b
ld [hDividend + 2], a
2013-03-26 17:39:44 -07:00
.skip_to_divide
2018-01-25 18:34:42 -08:00
ld b, 4
2013-05-02 23:43:44 -07:00
call Divide
ld a, [hQuotient + 2]
2013-03-26 17:39:44 -07:00
ld b, a
2018-01-25 18:34:42 -08:00
ld hl, FlailReversalPower
2013-03-26 17:39:44 -07:00
.reversal_loop
2013-03-26 17:39:44 -07:00
ld a, [hli]
cp b
jr nc, .break_loop
2013-03-26 17:39:44 -07:00
inc hl
jr .reversal_loop
2013-03-26 17:39:44 -07:00
.break_loop
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
ld a, [hl]
2015-09-09 16:27:07 -07:00
jr nz, .notPlayersTurn
2013-03-26 17:39:44 -07:00
ld hl, wPlayerMoveStructPower
2013-03-26 17:39:44 -07:00
ld [hl], a
push hl
call PlayerAttackDamage
2015-09-09 16:27:07 -07:00
jr .notEnemysTurn
2013-03-26 17:39:44 -07:00
2015-09-09 16:27:07 -07:00
.notPlayersTurn
ld hl, wEnemyMoveStructPower
2013-03-26 17:39:44 -07:00
ld [hl], a
push hl
call EnemyAttackDamage
2015-09-09 16:27:07 -07:00
.notEnemysTurn
call BattleCommand_DamageCalc
2013-03-26 17:39:44 -07:00
pop hl
ld [hl], 1
ret
2018-01-26 08:01:15 -08:00
INCLUDE "data/moves/flail_reversal_power.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/counter.asm"
2013-03-26 22:52:04 -07:00
INCLUDE "engine/battle/move_effects/encore.asm"
INCLUDE "engine/battle/move_effects/pain_split.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/snore.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/conversion2.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/lock_on.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/sketch.asm"
2014-01-05 05:24:27 -08:00
2018-06-24 07:09:41 -07:00
BattleCommand_DefrostOpponent:
; defrostopponent
; Thaw the opponent if frozen, and
; raise the user's Attack one stage.
2014-01-05 05:24:27 -08:00
call AnimateCurrentMove
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
call Defrost
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
ld a, [hl]
push hl
push af
ld a, EFFECT_ATTACK_UP
2013-03-26 17:39:44 -07:00
ld [hl], a
call BattleCommand_StatUp
2014-01-05 05:24:27 -08:00
pop af
pop hl
ld [hl], a
2013-03-26 17:39:44 -07:00
ret
INCLUDE "engine/battle/move_effects/sleep_talk.asm"
2013-03-26 22:52:04 -07:00
INCLUDE "engine/battle/move_effects/destiny_bond.asm"
INCLUDE "engine/battle/move_effects/spite.asm"
INCLUDE "engine/battle/move_effects/false_swipe.asm"
INCLUDE "engine/battle/move_effects/heal_bell.asm"
2018-06-24 07:09:41 -07:00
FarPlayBattleAnimation:
; play animation de
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret nz
; fallthrough
2018-06-24 07:09:41 -07:00
PlayFXAnimID:
ld a, e
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 15:21:53 -08:00
ld [wFXAnimID], a
ld a, d
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 15:21:53 -08:00
ld [wFXAnimID + 1], a
ld c, 3
call DelayFrames
callfar PlayBattleAnim
ret
2013-03-26 22:52:04 -07:00
2018-06-24 07:09:41 -07:00
DoEnemyDamage:
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 15:21:53 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld b, a
ld a, [hl]
or b
jr z, .did_no_damage
ld a, c
and a
jr nz, .ignore_substitute
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 15:21:53 -08:00
ld a, [wEnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
jp nz, DoSubstituteDamage
.ignore_substitute
; Substract wCurDamage from wEnemyMonHP.
; store original HP in little endian wBuffer3/4
ld a, [hld]
ld b, a
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 15:21:53 -08:00
ld a, [wEnemyMonHP + 1]
2018-01-23 14:39:09 -08:00
ld [wBuffer3], a
sub b
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 15:21:53 -08:00
ld [wEnemyMonHP + 1], a
ld a, [hl]
ld b, a
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 15:21:53 -08:00
ld a, [wEnemyMonHP]
ld [wBuffer4], a
sbc b
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 15:21:53 -08:00
ld [wEnemyMonHP], a
jr nc, .no_underflow
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 15:21:53 -08:00
ld a, [wBuffer4]
ld [hli], a
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 15:21:53 -08:00
ld a, [wBuffer3]
ld [hl], a
xor a
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 15:21:53 -08:00
ld hl, wEnemyMonHP
ld [hli], a
ld [hl], a
.no_underflow
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 15:21:53 -08:00
ld hl, wEnemyMonMaxHP
2013-03-26 17:39:44 -07:00
ld a, [hli]
2018-01-23 14:39:09 -08:00
ld [wBuffer2], a
2013-03-26 17:39:44 -07:00
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wBuffer1], a
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 15:21:53 -08:00
ld hl, wEnemyMonHP
ld a, [hli]
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 15:21:53 -08:00
ld [wBuffer6], a
ld a, [hl]
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 15:21:53 -08:00
ld [wBuffer5], a
hlcoord 2, 2
2013-03-26 17:39:44 -07:00
xor a
ld [wWhichHPBar], a
predef AnimateHPBar
.did_no_damage
jp RefreshBattleHuds
2013-03-27 14:07:00 -07:00
2018-06-24 07:09:41 -07:00
DoPlayerDamage:
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 15:21:53 -08:00
ld hl, wCurDamage
ld a, [hli]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hl]
or b
jr z, .did_no_damage
ld a, c
and a
jr nz, .ignore_substitute
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 15:21:53 -08:00
ld a, [wPlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
jp nz, DoSubstituteDamage
.ignore_substitute
; Substract wCurDamage from wBattleMonHP.
; store original HP in little endian wBuffer3/4
; store new HP in little endian wBuffer5/6
ld a, [hld]
2013-03-26 17:39:44 -07:00
ld b, a
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 15:21:53 -08:00
ld a, [wBattleMonHP + 1]
ld [wBuffer3], a
sub b
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 15:21:53 -08:00
ld [wBattleMonHP + 1], a
2018-01-23 14:39:09 -08:00
ld [wBuffer5], a
ld b, [hl]
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 15:21:53 -08:00
ld a, [wBattleMonHP]
ld [wBuffer4], a
sbc b
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 15:21:53 -08:00
ld [wBattleMonHP], a
2018-01-23 14:39:09 -08:00
ld [wBuffer6], a
jr nc, .no_underflow
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 15:21:53 -08:00
ld a, [wBuffer4]
ld [hli], a
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 15:21:53 -08:00
ld a, [wBuffer3]
ld [hl], a
xor a
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 15:21:53 -08:00
ld hl, wBattleMonHP
ld [hli], a
ld [hl], a
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 15:21:53 -08:00
ld hl, wBuffer5
ld [hli], a
ld [hl], a
2013-03-26 17:39:44 -07:00
.no_underflow
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 15:21:53 -08:00
ld hl, wBattleMonMaxHP
ld a, [hli]
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 15:21:53 -08:00
ld [wBuffer2], a
ld a, [hl]
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 15:21:53 -08:00
ld [wBuffer1], a
hlcoord 10, 9
ld a, 1
ld [wWhichHPBar], a
predef AnimateHPBar
.did_no_damage
jp RefreshBattleHuds
2018-06-24 07:09:41 -07:00
DoSubstituteDamage:
ld hl, SubTookDamageText
call StdBattleTextBox
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld de, wEnemySubstituteHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_hp
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 15:21:53 -08:00
ld de, wPlayerSubstituteHP
.got_hp
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 15:21:53 -08:00
ld hl, wCurDamage
ld a, [hli]
2013-03-26 17:39:44 -07:00
and a
jr nz, .broke
ld a, [de]
sub [hl]
ld [de], a
jr z, .broke
jr nc, .done
2013-03-26 22:52:04 -07:00
.broke
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVarAddr
res SUBSTATUS_SUBSTITUTE, [hl]
ld hl, SubFadedText
call StdBattleTextBox
call BattleCommand_SwitchTurn
call BattleCommand_LowerSubNoAnim
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
call z, AppearUserLowerSub
call BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVarAddr
cp EFFECT_MULTI_HIT
jr z, .ok
cp EFFECT_DOUBLE_HIT
jr z, .ok
cp EFFECT_POISON_MULTI_HIT
jr z, .ok
cp EFFECT_TRIPLE_KICK
jr z, .ok
cp EFFECT_BEAT_UP
jr z, .ok
xor a
ld [hl], a
.ok
call RefreshBattleHuds
.done
jp ResetDamage
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
UpdateMoveData:
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVarAddr
ld d, h
ld e, l
2013-03-27 14:07:00 -07:00
ld a, BATTLE_VARS_MOVE
call GetBattleVar
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 15:21:53 -08:00
ld [wCurMove], a
ld [wNamedObjectIndexBuffer], a
2013-03-27 14:07:00 -07:00
dec a
call GetMoveData
call GetMoveName
jp CopyName1
2018-06-24 07:09:41 -07:00
BattleCommand_SleepTarget:
; sleeptarget
2013-03-26 22:52:04 -07:00
call GetOpponentItem
ld a, b
cp HELD_PREVENT_SLEEP
jr nz, .not_protected_by_item
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, ProtectedByText
jr .fail
.not_protected_by_item
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
ld d, h
ld e, l
ld a, [de]
and SLP
ld hl, AlreadyAsleepText
jr nz, .fail
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 15:21:53 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jp nz, PrintDidntAffect2
2015-11-09 13:41:09 -08:00
ld hl, DidntAffect1Text
call .CheckAIRandomFail
jr c, .fail
ld a, [de]
2013-03-26 17:39:44 -07:00
and a
jr nz, .fail
call CheckSubstituteOpp
jr nz, .fail
2015-11-09 13:41:09 -08:00
call AnimateCurrentMove
ld b, $7
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 15:21:53 -08:00
ld a, [wInBattleTowerBattle]
and a
jr z, .random_loop
ld b, $3
2013-03-27 14:07:00 -07:00
.random_loop
call BattleRandom
and b
jr z, .random_loop
cp 7
jr z, .random_loop
inc a
ld [de], a
call UpdateOpponentInParty
call RefreshBattleHuds
ld hl, FellAsleepText
call StdBattleTextBox
farcall UseHeldStatusHealingItem
jp z, OpponentCantMove
ret
2013-03-27 14:07:00 -07:00
2015-11-09 13:41:09 -08:00
.fail
push hl
call AnimateFailedMove
pop hl
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
.CheckAIRandomFail:
; Enemy turn
ld a, [hBattleTurn]
and a
jr z, .dont_fail
2013-03-26 22:52:04 -07:00
; Not in link battle
ld a, [wLinkMode]
and a
jr nz, .dont_fail
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld a, [wInBattleTowerBattle]
and a
jr nz, .dont_fail
2013-03-26 22:52:04 -07:00
; Not locked-on by the enemy
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 15:21:53 -08:00
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a
jr nz, .dont_fail
2013-03-26 22:52:04 -07:00
call BattleRandom
cp 25 percent + 1 ; 25% chance AI fails
ret c
2013-03-26 22:52:04 -07:00
.dont_fail
xor a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_PoisonTarget:
; poisontarget
2013-03-26 22:52:04 -07:00
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
and a
ret nz
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 15:21:53 -08:00
ld a, [wTypeModifier]
and $7f
ret z
call CheckIfTargetIsPoisonType
ret z
call GetOpponentItem
ld a, b
cp HELD_PREVENT_POISON
ret z
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 15:21:53 -08:00
ld a, [wEffectFailed]
2013-03-26 17:39:44 -07:00
and a
ret nz
call SafeCheckSafeguard
ret nz
2015-11-09 13:41:09 -08:00
call PoisonOpponent
ld de, ANIM_PSN
call PlayOpponentBattleAnim
call RefreshBattleHuds
2013-03-26 17:39:44 -07:00
ld hl, WasPoisonedText
call StdBattleTextBox
farcall UseHeldStatusHealingItem
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_Poison:
; poison
ld hl, DoesntAffectText
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 15:21:53 -08:00
ld a, [wTypeModifier]
and $7f
jp z, .failed
call CheckIfTargetIsPoisonType
jp z, .failed
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
ld b, a
ld hl, AlreadyPoisonedText
and 1 << PSN
jp nz, .failed
call GetOpponentItem
ld a, b
cp HELD_PREVENT_POISON
jr nz, .do_poison
2013-03-26 17:39:44 -07:00
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, ProtectedByText
jr .failed
.do_poison
ld hl, DidntAffect1Text
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
2013-03-26 17:39:44 -07:00
and a
jr nz, .failed
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
2018-02-04 10:16:40 -08:00
jr z, .dont_sample_failure
2013-03-26 17:39:44 -07:00
ld a, [wLinkMode]
and a
2018-02-04 10:16:40 -08:00
jr nz, .dont_sample_failure
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld a, [wInBattleTowerBattle]
and a
2018-02-04 10:16:40 -08:00
jr nz, .dont_sample_failure
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a
2018-02-04 10:16:40 -08:00
jr nz, .dont_sample_failure
2013-03-26 17:39:44 -07:00
call BattleRandom
cp 25 percent + 1 ; 25% chance AI fails
jr c, .failed
2018-02-04 10:16:40 -08:00
.dont_sample_failure
call CheckSubstituteOpp
jr nz, .failed
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 15:21:53 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jr nz, .failed
call .check_toxic
jr z, .toxic
2013-03-26 17:39:44 -07:00
call .apply_poison
ld hl, WasPoisonedText
call StdBattleTextBox
jr .finished
2013-03-26 17:39:44 -07:00
.toxic
set SUBSTATUS_TOXIC, [hl]
xor a
ld [de], a
call .apply_poison
2013-03-26 17:39:44 -07:00
ld hl, BadlyPoisonedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
.finished
farcall UseHeldStatusHealingItem
2013-03-26 17:39:44 -07:00
ret
.failed
push hl
call AnimateFailedMove
pop hl
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
.apply_poison
call AnimateCurrentMove
call PoisonOpponent
jp RefreshBattleHuds
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
.check_toxic
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
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 15:21:53 -08:00
ld de, wEnemyToxicCount
jr z, .ok
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 15:21:53 -08:00
ld de, wPlayerToxicCount
.ok
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_TOXIC
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CheckIfTargetIsPoisonType:
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 15:21:53 -08:00
ld de, wEnemyMonType1
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .ok
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 15:21:53 -08:00
ld de, wBattleMonType1
.ok
ld a, [de]
2013-03-26 17:39:44 -07:00
inc de
cp POISON
ret z
2013-03-26 17:39:44 -07:00
ld a, [de]
cp POISON
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
PoisonOpponent:
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set PSN, [hl]
jp UpdateOpponentInParty
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DrainTarget:
; draintarget
call SapHealth
ld hl, SuckedHealthText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_EatDream:
; eatdream
call SapHealth
ld hl, DreamEatenText
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
SapHealth:
; Divide damage by 2, store it in hDividend
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage
2013-03-26 17:39:44 -07:00
ld a, [hli]
srl a
ld [hDividend], a
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [hl]
rr a
ld [hDividend + 1], a
2013-03-26 17:39:44 -07:00
or b
jr nz, .at_least_one
ld a, 1
ld [hDividend + 1], a
.at_least_one
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 15:21:53 -08:00
ld hl, wBattleMonHP
ld de, wBattleMonMaxHP
ld a, [hBattleTurn]
2013-03-26 17:39:44 -07:00
and a
jr z, .battlemonhp
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonHP
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 15:21:53 -08:00
ld de, wEnemyMonMaxHP
.battlemonhp
; Store current HP in little endian wBuffer3/4
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 15:21:53 -08:00
ld bc, wBuffer4
ld a, [hli]
ld [bc], a
ld a, [hl]
dec bc
ld [bc], a
; Store max HP in little endian wBuffer1/2
ld a, [de]
dec bc
ld [bc], a
inc de
ld a, [de]
dec bc
ld [bc], a
; Add hDividend to current HP and copy it to little endian wBuffer5/6
ld a, [hDividend + 1]
ld b, [hl]
add b
ld [hld], a
2018-01-23 14:39:09 -08:00
ld [wBuffer5], a
ld a, [hDividend]
ld b, [hl]
adc b
ld [hli], a
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 15:21:53 -08:00
ld [wBuffer6], a
jr c, .max_hp
; Substract current HP from max HP (to see if we have more than max HP)
2013-03-26 17:39:44 -07:00
ld a, [hld]
ld b, a
ld a, [de]
dec de
2013-03-26 17:39:44 -07:00
sub b
ld a, [hli]
2013-03-26 17:39:44 -07:00
ld b, a
ld a, [de]
inc de
2013-03-26 17:39:44 -07:00
sbc b
jr nc, .finish
.max_hp
; Load max HP into current HP and copy it to little endian wBuffer5/6
ld a, [de]
ld [hld], a
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 15:21:53 -08:00
ld [wBuffer5], a
dec de
ld a, [de]
2013-03-26 17:39:44 -07:00
ld [hli], a
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 15:21:53 -08:00
ld [wBuffer6], a
inc de
.finish
ld a, [hBattleTurn]
and a
hlcoord 10, 9
ld a, $1
jr z, .hp_bar
hlcoord 2, 2
2013-03-26 17:39:44 -07:00
xor a
.hp_bar
ld [wWhichHPBar], a
predef AnimateHPBar
call RefreshBattleHuds
jp UpdateBattleMonInParty
2018-06-24 07:09:41 -07:00
BattleCommand_BurnTarget:
; burntarget
2013-03-26 17:39:44 -07:00
xor a
ld [wNumHits], a
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
and a
jp nz, Defrost
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 15:21:53 -08:00
ld a, [wTypeModifier]
and $7f
ret z
call CheckMoveTypeMatchesTarget ; Don't burn a Fire-type
ret z
call GetOpponentItem
ld a, b
cp HELD_PREVENT_BURN
ret z
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 15:21:53 -08:00
ld a, [wEffectFailed]
and a
ret nz
call SafeCheckSafeguard
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set BRN, [hl]
call UpdateOpponentInParty
ld hl, ApplyBrnEffectOnAttack
call CallBattleCore
ld de, ANIM_BRN
call PlayOpponentBattleAnim
call RefreshBattleHuds
2013-03-26 17:39:44 -07:00
ld hl, WasBurnedText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
farcall UseHeldStatusHealingItem
ret
2018-06-24 07:09:41 -07:00
Defrost:
ld a, [hl]
and 1 << FRZ
ret z
2013-03-27 14:07:00 -07:00
xor a
ld [hl], a
2013-03-27 14:07:00 -07:00
2013-03-26 22:52:04 -07:00
ld a, [hBattleTurn]
2013-03-26 17:39:44 -07:00
and a
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 15:21:53 -08:00
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
jr z, .ok
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 15:21:53 -08:00
ld hl, wPartyMon1Status
ld a, [wCurBattleMon]
.ok
2013-03-26 17:39:44 -07:00
call GetPartyLocation
xor a
ld [hl], a
call UpdateOpponentInParty
2013-03-26 17:39:44 -07:00
ld hl, DefrostedOpponentText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_FreezeTarget:
; freezetarget
2013-03-27 14:07:00 -07:00
xor a
ld [wNumHits], a
call CheckSubstituteOpp
ret nz
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
and a
ret nz
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
and $7f
ret z
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 15:21:53 -08:00
ld a, [wBattleWeather]
cp WEATHER_SUN
ret z
call CheckMoveTypeMatchesTarget ; Don't freeze an Ice-type
ret z
call GetOpponentItem
ld a, b
cp HELD_PREVENT_FREEZE
ret z
2018-01-23 14:39:09 -08:00
ld a, [wEffectFailed]
2013-03-26 17:39:44 -07:00
and a
ret nz
call SafeCheckSafeguard
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set FRZ, [hl]
2013-05-02 21:22:28 -07:00
call UpdateOpponentInParty
ld de, ANIM_FRZ
call PlayOpponentBattleAnim
2013-05-02 21:22:28 -07:00
call RefreshBattleHuds
2013-03-27 14:07:00 -07:00
ld hl, WasFrozenText
call StdBattleTextBox
2013-03-27 14:07:00 -07:00
2017-12-24 09:47:30 -08:00
farcall UseHeldStatusHealingItem
ret nz
2013-03-27 14:07:00 -07:00
call OpponentCantMove
call EndRechargeOpp
ld hl, wEnemyJustGotFrozen
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .finish
ld hl, wPlayerJustGotFrozen
.finish
ld [hl], $1
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_ParalyzeTarget:
; paralyzetarget
2013-03-26 22:52:04 -07:00
xor a
ld [wNumHits], a
2013-03-26 17:39:44 -07:00
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
2013-03-26 17:39:44 -07:00
and a
ret nz
2018-01-23 14:39:09 -08:00
ld a, [wTypeModifier]
2013-03-26 17:39:44 -07:00
and $7f
ret z
call GetOpponentItem
ld a, b
cp HELD_PREVENT_PARALYZE
2013-03-26 17:39:44 -07:00
ret z
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 15:21:53 -08:00
ld a, [wEffectFailed]
2013-03-26 17:39:44 -07:00
and a
ret nz
2015-11-06 19:36:06 -08:00
call SafeCheckSafeguard
2013-03-26 17:39:44 -07:00
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set PAR, [hl]
call UpdateOpponentInParty
ld hl, ApplyPrzEffectOnSpeed
call CallBattleCore
ld de, ANIM_PAR
call PlayOpponentBattleAnim
call RefreshBattleHuds
call PrintParalyze
ld hl, UseHeldStatusHealingItem
jp CallBattleCore
2015-11-06 19:36:06 -08:00
2018-06-24 07:09:41 -07:00
BattleCommand_AttackUp:
; attackup
ld b, ATTACK
jr BattleCommand_StatUp
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DefenseUp:
; defenseup
ld b, DEFENSE
jr BattleCommand_StatUp
2013-03-26 22:52:04 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpeedUp:
; speedup
ld b, SPEED
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialAttackUp:
; specialattackup
ld b, SP_ATTACK
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialDefenseUp:
; specialdefenseup
ld b, SP_DEFENSE
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_AccuracyUp:
; accuracyup
ld b, ACCURACY
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_EvasionUp:
; evasionup
ld b, EVASION
jr BattleCommand_StatUp
2015-09-04 13:30:40 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_AttackUp2:
; attackup2
ld b, $10 | ATTACK
jr BattleCommand_StatUp
2015-09-04 13:30:40 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DefenseUp2:
; defenseup2
ld b, $10 | DEFENSE
jr BattleCommand_StatUp
2015-09-04 13:30:40 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpeedUp2:
; speedup2
ld b, $10 | SPEED
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialAttackUp2:
; specialattackup2
ld b, $10 | SP_ATTACK
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialDefenseUp2:
; specialdefenseup2
ld b, $10 | SP_DEFENSE
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_AccuracyUp2:
; accuracyup2
ld b, $10 | ACCURACY
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_EvasionUp2:
; evasionup2
ld b, $10 | EVASION
jr BattleCommand_StatUp
2018-06-24 07:09:41 -07:00
BattleCommand_StatUp:
; statup
call CheckIfStatCanBeRaised
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 15:21:53 -08:00
ld a, [wFailedMessage]
2013-03-26 17:39:44 -07:00
and a
ret nz
jp StatUpAnimation
2015-09-04 13:30:40 -07:00
2018-06-24 07:09:41 -07:00
CheckIfStatCanBeRaised:
ld a, b
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 15:21:53 -08:00
ld [wLoweredStat], a
ld hl, wPlayerStatLevels
ld a, [hBattleTurn]
and a
jr z, .got_stat_levels
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 15:21:53 -08:00
ld hl, wEnemyStatLevels
.got_stat_levels
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 15:21:53 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jp nz, .stat_raise_failed
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 15:21:53 -08:00
ld a, [wEffectFailed]
and a
jp nz, .stat_raise_failed
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
inc b
ld a, $d
cp b
jp c, .cant_raise_stat
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f0
jr z, .got_num_stages
inc b
ld a, $d
cp b
jr nc, .got_num_stages
ld b, a
.got_num_stages
ld [hl], b
push hl
ld a, c
cp $5
jr nc, .done_calcing_stats
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 15:21:53 -08:00
ld hl, wBattleMonStats + 1
ld de, wPlayerStats
ld a, [hBattleTurn]
and a
jr z, .got_stats_pointer
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 15:21:53 -08:00
ld hl, wEnemyMonStats + 1
ld de, wEnemyStats
.got_stats_pointer
push bc
sla c
ld b, 0
add hl, bc
ld a, c
add e
ld e, a
jr nc, .no_carry
inc d
.no_carry
pop bc
ld a, [hld]
sub LOW(MAX_STAT_VALUE)
jr nz, .not_already_max
ld a, [hl]
sbc HIGH(MAX_STAT_VALUE)
jp z, .stats_already_max
.not_already_max
ld a, [hBattleTurn]
and a
jr z, .calc_player_stats
call CalcEnemyStats
jr .done_calcing_stats
.calc_player_stats
call CalcPlayerStats
.done_calcing_stats
pop hl
2013-03-26 17:39:44 -07:00
xor a
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 15:21:53 -08:00
ld [wFailedMessage], a
ret
2013-03-27 14:07:00 -07:00
2018-06-24 07:09:41 -07:00
.stats_already_max
2013-03-26 17:39:44 -07:00
pop hl
dec [hl]
; fallthrough
2018-06-24 07:09:41 -07:00
.cant_raise_stat
ld a, $2
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 15:21:53 -08:00
ld [wFailedMessage], a
ld a, $1
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 15:21:53 -08:00
ld [wAttackMissed], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
.stat_raise_failed
ld a, $1
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 15:21:53 -08:00
ld [wFailedMessage], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
StatUpAnimation:
ld bc, wPlayerMinimized
ld hl, DropPlayerSub
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .do_player
ld bc, wEnemyMinimized
ld hl, DropEnemySub
.do_player
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
cp MINIMIZE
ret nz
2013-03-26 17:39:44 -07:00
ld a, $1
ld [bc], a
call _CheckBattleScene
ret nc
2013-03-26 17:39:44 -07:00
xor a
ld [hBGMapMode], a
call CallBattleCore
call WaitBGMap
jp BattleCommand_MoveDelay
2018-06-24 07:09:41 -07:00
BattleCommand_AttackDown:
; attackdown
ld a, ATTACK
jr BattleCommand_StatDown
2018-06-24 07:09:41 -07:00
BattleCommand_DefenseDown:
; defensedown
ld a, DEFENSE
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpeedDown:
; speeddown
ld a, SPEED
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialAttackDown:
; specialattackdown
ld a, SP_ATTACK
jr BattleCommand_StatDown
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialDefenseDown:
; specialdefensedown
ld a, SP_DEFENSE
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_AccuracyDown:
; accuracydown
ld a, ACCURACY
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_EvasionDown:
; evasiondown
ld a, EVASION
jr BattleCommand_StatDown
2018-06-24 07:09:41 -07:00
BattleCommand_AttackDown2:
; attackdown2
ld a, $10 | ATTACK
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DefenseDown2:
; defensedown2
ld a, $10 | DEFENSE
jr BattleCommand_StatDown
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpeedDown2:
; speeddown2
ld a, $10 | SPEED
jr BattleCommand_StatDown
2013-03-26 22:52:04 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialAttackDown2:
; specialattackdown2
ld a, $10 | SP_ATTACK
jr BattleCommand_StatDown
2013-03-27 14:07:00 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_SpecialDefenseDown2:
; specialdefensedown2
ld a, $10 | SP_DEFENSE
jr BattleCommand_StatDown
2013-03-27 14:07:00 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_AccuracyDown2:
; accuracydown2
ld a, $10 | ACCURACY
jr BattleCommand_StatDown
2018-06-24 07:09:41 -07:00
BattleCommand_EvasionDown2:
; evasiondown2
ld a, $10 | EVASION
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_StatDown:
; statdown
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld [wLoweredStat], a
2013-03-26 22:52:04 -07:00
call CheckMist
jp nz, .Mist
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld hl, wEnemyStatLevels
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .GetStatLevel
2018-01-23 14:39:09 -08:00
ld hl, wPlayerStatLevels
2013-03-26 22:52:04 -07:00
.GetStatLevel:
; Attempt to lower the stat.
2018-01-23 14:39:09 -08:00
ld a, [wLoweredStat]
2013-03-26 17:39:44 -07:00
and $f
ld c, a
ld b, 0
2013-03-26 17:39:44 -07:00
add hl, bc
ld b, [hl]
dec b
jp z, .CantLower
; Sharply lower the stat if applicable.
2018-01-23 14:39:09 -08:00
ld a, [wLoweredStat]
2013-03-26 17:39:44 -07:00
and $f0
jr z, .ComputerMiss
dec b
jr nz, .ComputerMiss
2013-03-26 17:39:44 -07:00
inc b
.ComputerMiss:
; Computer opponents have a 25% chance of failing.
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .DidntMiss
ld a, [wLinkMode]
2013-03-26 17:39:44 -07:00
and a
2013-06-13 13:10:39 -07:00
jr nz, .DidntMiss
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 15:21:53 -08:00
ld a, [wInBattleTowerBattle]
2013-03-26 17:39:44 -07:00
and a
2013-06-13 13:10:39 -07:00
jr nz, .DidntMiss
; Lock-On still always works.
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 15:21:53 -08:00
ld a, [wPlayerSubStatus5]
2013-06-13 13:10:39 -07:00
bit SUBSTATUS_LOCK_ON, a
jr nz, .DidntMiss
; Attacking moves that also lower accuracy are unaffected.
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_ACCURACY_DOWN_HIT
jr z, .DidntMiss
call BattleRandom
cp 25 percent + 1 ; 25% chance AI fails
jr c, .Failed
2013-03-26 17:39:44 -07:00
.DidntMiss:
call CheckSubstituteOpp
jr nz, .Failed
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jr nz, .Failed
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 15:21:53 -08:00
ld a, [wEffectFailed]
and a
jr nz, .Failed
call CheckHiddenOpponent
jr nz, .Failed
; Accuracy/Evasion reduction don't involve stats.
ld [hl], b
ld a, c
cp ACCURACY
jr nc, .Hit
push hl
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 15:21:53 -08:00
ld hl, wEnemyMonAttack + 1
ld de, wEnemyStats
ld a, [hBattleTurn]
and a
jr z, .do_enemy
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 15:21:53 -08:00
ld hl, wBattleMonAttack + 1
ld de, wPlayerStats
.do_enemy
call TryLowerStat
pop hl
jr z, .CouldntLower
.Hit:
xor a
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 15:21:53 -08:00
ld [wFailedMessage], a
ret
.CouldntLower:
inc [hl]
.CantLower:
ld a, 3
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 15:21:53 -08:00
ld [wFailedMessage], a
2013-03-26 17:39:44 -07:00
ld a, 1
2018-01-23 14:39:09 -08:00
ld [wAttackMissed], a
2013-03-26 17:39:44 -07:00
ret
.Failed:
ld a, 1
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 15:21:53 -08:00
ld [wFailedMessage], a
ld [wAttackMissed], a
ret
.Mist:
ld a, 2
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 15:21:53 -08:00
ld [wFailedMessage], a
ld a, 1
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 15:21:53 -08:00
ld [wAttackMissed], a
ret
2018-06-24 07:09:41 -07:00
CheckMist:
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_ATTACK_DOWN
jr c, .dont_check_mist
cp EFFECT_EVASION_DOWN + 1
jr c, .check_mist
cp EFFECT_ATTACK_DOWN_2
jr c, .dont_check_mist
cp EFFECT_EVASION_DOWN_2 + 1
jr c, .check_mist
cp EFFECT_ATTACK_DOWN_HIT
jr c, .dont_check_mist
cp EFFECT_EVASION_DOWN_HIT + 1
jr c, .check_mist
.dont_check_mist
xor a
ret
2013-03-26 17:39:44 -07:00
.check_mist
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
bit SUBSTATUS_MIST, a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_StatUpMessage:
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 15:21:53 -08:00
ld a, [wFailedMessage]
and a
ret nz
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
2013-03-26 17:39:44 -07:00
ld b, a
inc b
call GetStatName
ld hl, .stat
jp BattleTextBox
.stat
text_jump UnknownText_0x1c0cc6
start_asm
ld hl, .up
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f0
ret z
ld hl, .wayup
2013-03-26 17:39:44 -07:00
ret
.wayup
text_jump UnknownText_0x1c0cd0
db "@"
2013-03-26 17:39:44 -07:00
.up
text_jump UnknownText_0x1c0ce0
db "@"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_StatDownMessage:
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 15:21:53 -08:00
ld a, [wFailedMessage]
and a
2013-03-26 17:39:44 -07:00
ret nz
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
ld b, a
inc b
call GetStatName
ld hl, .stat
jp BattleTextBox
2013-03-26 22:52:04 -07:00
.stat
text_jump UnknownText_0x1c0ceb
start_asm
ld hl, .fell
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f0
ret z
ld hl, .sharplyfell
2013-03-26 17:39:44 -07:00
ret
.sharplyfell
text_jump UnknownText_0x1c0cf5
db "@"
.fell
text_jump UnknownText_0x1c0d06
db "@"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
TryLowerStat:
; Lower stat c from stat struct hl (buffer de).
push bc
sla c
ld b, 0
add hl, bc
; add de, c
ld a, c
2013-03-26 17:39:44 -07:00
add e
ld e, a
jr nc, .no_carry
inc d
.no_carry
pop bc
; The lowest possible stat is 1.
ld a, [hld]
sub 1
jr nz, .not_min
ld a, [hl]
and a
ret z
.not_min
ld a, [hBattleTurn]
and a
jr z, .Player
call BattleCommand_SwitchTurn
call CalcPlayerStats
call BattleCommand_SwitchTurn
jr .end
.Player:
call BattleCommand_SwitchTurn
call CalcEnemyStats
call BattleCommand_SwitchTurn
.end
ld a, 1
and a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_StatUpFailText:
; statupfailtext
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 15:21:53 -08:00
ld a, [wFailedMessage]
and a
ret z
push af
call BattleCommand_MoveDelay
pop af
dec a
jp z, TryPrintButItFailed
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
ld b, a
inc b
call GetStatName
ld hl, WontRiseAnymoreText
jp StdBattleTextBox
2013-03-26 22:52:04 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_StatDownFailText:
; statdownfailtext
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 15:21:53 -08:00
ld a, [wFailedMessage]
and a
2013-03-26 17:39:44 -07:00
ret z
push af
call BattleCommand_MoveDelay
pop af
dec a
jp z, TryPrintButItFailed
dec a
ld hl, ProtectedByMistText
jp z, StdBattleTextBox
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
ld b, a
inc b
call GetStatName
ld hl, WontDropAnymoreText
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
GetStatName:
ld hl, StatNames
ld c, "@"
.CheckName:
dec b
jr z, .Copy
.GetName:
ld a, [hli]
cp c
jr z, .CheckName
jr .GetName
2013-03-26 22:52:04 -07:00
.Copy:
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 15:21:53 -08:00
ld de, wStringBuffer2
ld bc, wStringBuffer3 - wStringBuffer2
jp CopyBytes
2013-03-27 14:07:00 -07:00
INCLUDE "data/battle/stat_names.asm"
2013-03-27 14:07:00 -07:00
INCLUDE "data/battle/stat_multipliers.asm"
2013-03-27 14:07:00 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_AllStatsUp:
; allstatsup
2013-03-26 17:39:44 -07:00
; Attack
call ResetMiss
call BattleCommand_AttackUp
call BattleCommand_StatUpMessage
2013-03-26 17:39:44 -07:00
; Defense
call ResetMiss
call BattleCommand_DefenseUp
call BattleCommand_StatUpMessage
2013-03-26 17:39:44 -07:00
; Speed
call ResetMiss
call BattleCommand_SpeedUp
call BattleCommand_StatUpMessage
2013-03-26 17:39:44 -07:00
; Special Attack
call ResetMiss
call BattleCommand_SpecialAttackUp
call BattleCommand_StatUpMessage
2013-03-26 17:39:44 -07:00
; Special Defense
call ResetMiss
call BattleCommand_SpecialDefenseUp
jp BattleCommand_StatUpMessage
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
ResetMiss:
xor a
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 15:21:53 -08:00
ld [wAttackMissed], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
LowerStat:
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 15:21:53 -08:00
ld [wLoweredStat], a
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld hl, wPlayerStatLevels
ld a, [hBattleTurn]
and a
jr z, .got_target
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 15:21:53 -08:00
ld hl, wEnemyStatLevels
2013-03-26 17:39:44 -07:00
.got_target
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
dec b
jr z, .cant_lower_anymore
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld a, [wLoweredStat]
and $f0
jr z, .got_num_stages
dec b
jr nz, .got_num_stages
inc b
.got_num_stages
ld [hl], b
ld a, c
cp 5
jr nc, .accuracy_evasion
push hl
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 15:21:53 -08:00
ld hl, wBattleMonStats + 1
ld de, wPlayerStats
ld a, [hBattleTurn]
and a
jr z, .got_target_2
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 15:21:53 -08:00
ld hl, wEnemyMonStats + 1
ld de, wEnemyStats
.got_target_2
call TryLowerStat
pop hl
jr z, .failed
2013-03-26 17:39:44 -07:00
.accuracy_evasion
ld a, [hBattleTurn]
and a
jr z, .player
2013-03-26 17:39:44 -07:00
call CalcEnemyStats
2013-03-26 17:39:44 -07:00
jr .finish
2013-03-26 17:39:44 -07:00
.player
call CalcPlayerStats
2013-03-26 17:39:44 -07:00
.finish
xor a
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 15:21:53 -08:00
ld [wFailedMessage], a
ret
2013-03-26 17:39:44 -07:00
.failed
inc [hl]
2013-03-26 17:39:44 -07:00
.cant_lower_anymore
ld a, 2
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 15:21:53 -08:00
ld [wFailedMessage], a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_TriStatusChance:
; tristatuschance
2013-03-26 22:52:04 -07:00
call BattleCommand_EffectChance
2013-03-26 17:39:44 -07:00
.loop
; 1/3 chance of each status
call BattleRandom
swap a
2018-01-11 09:00:01 -08:00
and %11
jr z, .loop
dec a
ld hl, .ptrs
rst JumpTable
ret
2013-03-26 17:39:44 -07:00
.ptrs
dw BattleCommand_ParalyzeTarget ; paralyze
dw BattleCommand_FreezeTarget ; freeze
dw BattleCommand_BurnTarget ; burn
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_Curl:
; curl
ld a, BATTLE_VARS_SUBSTATUS2
call GetBattleVarAddr
set SUBSTATUS_CURLED, [hl]
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_RaiseSubNoAnim:
ld hl, GetBattleMonBackpic
ld a, [hBattleTurn]
and a
jr z, .PlayerTurn
ld hl, GetEnemyMonFrontpic
.PlayerTurn:
xor a
ld [hBGMapMode], a
call CallBattleCore
jp WaitBGMap
2018-06-24 07:09:41 -07:00
BattleCommand_LowerSubNoAnim:
ld hl, DropPlayerSub
ld a, [hBattleTurn]
and a
jr z, .PlayerTurn
ld hl, DropEnemySub
.PlayerTurn:
xor a
ld [hBGMapMode], a
call CallBattleCore
jp WaitBGMap
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CalcPlayerStats:
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 15:21:53 -08:00
ld hl, wPlayerAtkLevel
ld de, wPlayerStats
ld bc, wBattleMonAttack
ld a, 5
call CalcStats
2013-03-26 17:39:44 -07:00
ld hl, BadgeStatBoosts
call CallBattleCore
2013-03-26 17:39:44 -07:00
call BattleCommand_SwitchTurn
2013-03-26 22:52:04 -07:00
ld hl, ApplyPrzEffectOnSpeed
call CallBattleCore
ld hl, ApplyBrnEffectOnAttack
call CallBattleCore
2013-03-26 17:39:44 -07:00
jp BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CalcEnemyStats:
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 15:21:53 -08:00
ld hl, wEnemyAtkLevel
ld de, wEnemyStats
ld bc, wEnemyMonAttack
ld a, 5
call CalcStats
call BattleCommand_SwitchTurn
2013-03-26 22:52:04 -07:00
ld hl, ApplyPrzEffectOnSpeed
call CallBattleCore
2013-03-26 22:52:04 -07:00
ld hl, ApplyBrnEffectOnAttack
call CallBattleCore
2013-03-26 17:39:44 -07:00
jp BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CalcStats:
.loop
push af
ld a, [hli]
push hl
push bc
2013-04-27 14:12:23 -07:00
ld c, a
dec c
ld b, 0
ld hl, StatLevelMultipliers
add hl, bc
add hl, bc
2013-04-27 14:12:23 -07:00
xor a
ld [hMultiplicand + 0], a
ld a, [de]
ld [hMultiplicand + 1], a
inc de
ld a, [de]
ld [hMultiplicand + 2], a
inc de
2013-04-27 14:12:23 -07:00
ld a, [hli]
ld [hMultiplier], a
call Multiply
ld a, [hl]
ld [hDivisor], a
ld b, 4
call Divide
2013-03-26 17:39:44 -07:00
ld a, [hQuotient + 1]
ld b, a
ld a, [hQuotient + 2]
or b
jr nz, .check_maxed_out
ld a, 1
ld [hQuotient + 2], a
jr .not_maxed_out
2013-03-26 17:39:44 -07:00
.check_maxed_out
ld a, [hQuotient + 2]
cp LOW(MAX_STAT_VALUE)
ld a, b
sbc HIGH(MAX_STAT_VALUE)
jr c, .not_maxed_out
2013-03-26 17:39:44 -07:00
ld a, LOW(MAX_STAT_VALUE)
ld [hQuotient + 2], a
ld a, HIGH(MAX_STAT_VALUE)
ld [hQuotient + 1], a
2013-03-26 22:52:04 -07:00
.not_maxed_out
pop bc
ld a, [hQuotient + 1]
ld [bc], a
inc bc
ld a, [hQuotient + 2]
ld [bc], a
inc bc
pop hl
pop af
dec a
jr nz, .loop
ret
2015-09-04 13:30:40 -07:00
INCLUDE "engine/battle/move_effects/bide.asm"
2015-09-04 13:30:40 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_CheckRampage:
; checkrampage
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 15:21:53 -08:00
ld de, wPlayerRolloutCount
ld a, [hBattleTurn]
2013-03-26 17:39:44 -07:00
and a
jr z, .player
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 15:21:53 -08:00
ld de, wEnemyRolloutCount
.player
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
bit SUBSTATUS_RAMPAGE, [hl]
ret z
ld a, [de]
dec a
ld [de], a
jr nz, .continue_rampage
res SUBSTATUS_RAMPAGE, [hl]
call BattleCommand_SwitchTurn
call SafeCheckSafeguard
push af
call BattleCommand_SwitchTurn
pop af
jr nz, .continue_rampage
set SUBSTATUS_CONFUSED, [hl]
call BattleRandom
and %00000001
inc a
inc a
inc de ; ConfuseCount
ld [de], a
.continue_rampage
ld b, rampage_command
jp SkipToBattleCommand
2018-06-24 07:09:41 -07:00
BattleCommand_Rampage:
; rampage
2013-03-26 17:39:44 -07:00
; No rampage during Sleep Talk.
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and SLP
ret nz
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld de, wPlayerRolloutCount
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .ok
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 15:21:53 -08:00
ld de, wEnemyRolloutCount
2013-03-26 17:39:44 -07:00
.ok
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
set SUBSTATUS_RAMPAGE, [hl]
; Rampage for 1 or 2 more turns
call BattleRandom
and %00000001
inc a
ld [de], a
ld a, 1
ld [wSomeoneIsRampaging], a
ret
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/teleport.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
SetBattleDraw:
ld a, [wBattleResult]
2018-04-05 08:44:02 -07:00
and BATTLERESULT_BITMASK
or DRAW
ld [wBattleResult], a
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_ForceSwitch:
; forceswitch
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld a, [wBattleType]
cp BATTLETYPE_SHINY
jp z, .fail
cp BATTLETYPE_TRAP
jp z, .fail
cp BATTLETYPE_CELEBI
jp z, .fail
cp BATTLETYPE_SUICUNE
jp z, .fail
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jp nz, .force_player_switch
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 15:21:53 -08:00
ld a, [wAttackMissed]
and a
jr nz, .missed
ld a, [wBattleMode]
dec a
jr nz, .trainer
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 15:21:53 -08:00
ld a, [wCurPartyLevel]
ld b, a
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 15:21:53 -08:00
ld a, [wBattleMonLevel]
cp b
jr nc, .wild_force_flee
add b
ld c, a
inc c
.random_loop_wild
call BattleRandom
cp c
jr nc, .random_loop_wild
srl b
srl b
cp b
jr nc, .wild_force_flee
.missed
jp .fail
.wild_force_flee
call UpdateBattleMonInParty
xor a
ld [wNumHits], a
inc a
ld [wForcedSwitch], a
call SetBattleDraw
ld a, [wPlayerMoveStructAnimation]
jp .succeed
.trainer
call FindAliveEnemyMons
jr c, .switch_fail
ld a, [wEnemyGoesFirst]
and a
jr z, .switch_fail
call UpdateEnemyMonInParty
ld a, $1
ld [wKickCounter], a
call AnimateCurrentMove
ld c, $14
call DelayFrames
hlcoord 1, 0
lb bc, 4, 10
call ClearBox
ld c, 20
call DelayFrames
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 15:21:53 -08:00
ld a, [wOTPartyCount]
ld b, a
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 15:21:53 -08:00
ld a, [wCurOTMon]
ld c, a
; select a random enemy mon to switch to
.random_loop_trainer
call BattleRandom
and $7
cp b
jr nc, .random_loop_trainer
cp c
jr z, .random_loop_trainer
push af
push bc
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 15:21:53 -08:00
ld hl, wOTPartyMon1HP
call GetPartyLocation
2013-03-26 17:39:44 -07:00
ld a, [hli]
or [hl]
pop bc
pop de
jr z, .random_loop_trainer
2013-03-26 17:39:44 -07:00
ld a, d
inc a
ld [wEnemySwitchMonIndex], a
callfar ForceEnemySwitch
ld hl, DraggedOutText
call StdBattleTextBox
ld hl, SpikesDamage
jp CallBattleCore
.switch_fail
jp .fail
.force_player_switch
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 15:21:53 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
jr nz, .player_miss
ld a, [wBattleMode]
dec a
jr nz, .vs_trainer
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 15:21:53 -08:00
ld a, [wBattleMonLevel]
ld b, a
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 15:21:53 -08:00
ld a, [wCurPartyLevel]
cp b
jr nc, .wild_succeed_playeristarget
add b
ld c, a
inc c
.wild_random_loop_playeristarget
call BattleRandom
cp c
jr nc, .wild_random_loop_playeristarget
srl b
srl b
cp b
jr nc, .wild_succeed_playeristarget
.player_miss
jr .fail
.wild_succeed_playeristarget
call UpdateBattleMonInParty
2013-03-26 17:39:44 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
inc a
ld [wForcedSwitch], a
call SetBattleDraw
ld a, [wEnemyMoveStructAnimation]
jr .succeed
.vs_trainer
call CheckPlayerHasMonToSwitchTo
jr c, .fail
ld a, [wEnemyGoesFirst]
cp $1
jr z, .switch_fail
call UpdateBattleMonInParty
ld a, $1
ld [wKickCounter], a
call AnimateCurrentMove
ld c, 20
call DelayFrames
hlcoord 9, 7
lb bc, 5, 11
call ClearBox
ld c, 20
call DelayFrames
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 15:21:53 -08:00
ld a, [wPartyCount]
ld b, a
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 15:21:53 -08:00
ld a, [wCurBattleMon]
ld c, a
.random_loop_trainer_playeristarget
call BattleRandom
and $7
cp b
jr nc, .random_loop_trainer_playeristarget
cp c
jr z, .random_loop_trainer_playeristarget
2013-03-26 17:39:44 -07:00
push af
push bc
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 15:21:53 -08:00
ld hl, wPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
pop bc
pop de
jr z, .random_loop_trainer_playeristarget
ld a, d
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 15:21:53 -08:00
ld [wCurPartyMon], a
ld hl, SwitchPlayerMon
call CallBattleCore
2013-03-26 17:39:44 -07:00
ld hl, DraggedOutText
call StdBattleTextBox
2013-03-26 17:39:44 -07:00
ld hl, SpikesDamage
jp CallBattleCore
.fail
call BattleCommand_LowerSub
call BattleCommand_MoveDelay
call BattleCommand_RaiseSub
jp PrintButItFailed
2013-03-26 17:39:44 -07:00
.succeed
push af
call SetBattleDraw
ld a, $1
ld [wKickCounter], a
call AnimateCurrentMove
ld c, 20
call DelayFrames
pop af
2013-03-26 17:39:44 -07:00
ld hl, FledInFearText
cp ROAR
jr z, .do_text
ld hl, BlownAwayText
.do_text
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
CheckPlayerHasMonToSwitchTo:
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 15:21:53 -08:00
ld a, [wPartyCount]
ld d, a
ld e, 0
ld bc, PARTYMON_STRUCT_LENGTH
.loop
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 15:21:53 -08:00
ld a, [wCurBattleMon]
cp e
jr z, .next
ld a, e
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 15:21:53 -08:00
ld hl, wPartyMon1HP
call AddNTimes
ld a, [hli]
or [hl]
jr nz, .not_fainted
2013-03-26 17:39:44 -07:00
.next
inc e
dec d
jr nz, .loop
2013-03-26 17:39:44 -07:00
scf
ret
2013-03-26 17:39:44 -07:00
.not_fainted
and a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_EndLoop:
; endloop
; Loop back to 'critical'.
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld de, wPlayerRolloutCount
ld bc, wPlayerDamageTaken
ld a, [hBattleTurn]
and a
jr z, .got_addrs
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 15:21:53 -08:00
ld de, wEnemyRolloutCount
ld bc, wEnemyDamageTaken
.got_addrs
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
bit SUBSTATUS_IN_LOOP, [hl]
jp nz, .in_loop
set SUBSTATUS_IN_LOOP, [hl]
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVarAddr
ld a, [hl]
cp EFFECT_POISON_MULTI_HIT
jr z, .twineedle
cp EFFECT_DOUBLE_HIT
ld a, 1
jr z, .double_hit
ld a, [hl]
cp EFFECT_BEAT_UP
jr z, .beat_up
cp EFFECT_TRIPLE_KICK
jr nz, .not_triple_kick
.reject_triple_kick_sample
call BattleRandom
and $3
jr z, .reject_triple_kick_sample
dec a
jr nz, .double_hit
ld a, 1
ld [bc], a
jr .done_loop
2013-03-26 22:52:04 -07:00
.beat_up
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr nz, .check_ot_beat_up
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 15:21:53 -08:00
ld a, [wPartyCount]
cp 1
jp z, .only_one_beatup
dec a
jr .double_hit
2015-11-09 13:41:09 -08:00
.check_ot_beat_up
ld a, [wBattleMode]
cp WILD_BATTLE
jp z, .only_one_beatup
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 15:21:53 -08:00
ld a, [wOTPartyCount]
cp 1
jp z, .only_one_beatup
dec a
jr .double_hit
.only_one_beatup
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
res SUBSTATUS_IN_LOOP, [hl]
2018-04-03 03:00:24 -07:00
call BattleCommand_BeatUpFailText
jp EndMoveEffect
.not_triple_kick
call BattleRandom
and $3
cp 2
jr c, .got_number_hits
call BattleRandom
and $3
.got_number_hits
inc a
.double_hit
ld [de], a
inc a
ld [bc], a
jr .loop_back_to_critical
2013-03-26 17:39:44 -07:00
.twineedle
ld a, 1
jr .double_hit
2013-03-26 17:39:44 -07:00
.in_loop
ld a, [de]
dec a
ld [de], a
jr nz, .loop_back_to_critical
.done_loop
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
res SUBSTATUS_IN_LOOP, [hl]
ld hl, PlayerHitTimesText
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_hit_n_times_text
ld hl, EnemyHitTimesText
.got_hit_n_times_text
push bc
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_BEAT_UP
jr z, .beat_up_2
call StdBattleTextBox
.beat_up_2
pop bc
xor a
ld [bc], a
ret
.loop_back_to_critical
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 15:21:53 -08:00
ld a, [wBattleScriptBufferAddress + 1]
ld h, a
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 15:21:53 -08:00
ld a, [wBattleScriptBufferAddress]
ld l, a
.not_critical
ld a, [hld]
cp critical_command
jr nz, .not_critical
inc hl
ld a, h
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 15:21:53 -08:00
ld [wBattleScriptBufferAddress + 1], a
ld a, l
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 15:21:53 -08:00
ld [wBattleScriptBufferAddress], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_FakeOut:
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 15:21:53 -08:00
ld a, [wAttackMissed]
and a
ret nz
2013-03-26 17:39:44 -07:00
call CheckSubstituteOpp
jr nz, .fail
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
and 1 << FRZ | SLP
jr nz, .fail
2013-03-26 17:39:44 -07:00
call CheckOpponentWentFirst
jr z, FlinchTarget
2013-03-26 17:39:44 -07:00
.fail
ld a, 1
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 15:21:53 -08:00
ld [wAttackMissed], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_FlinchTarget:
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
and 1 << FRZ | SLP
ret nz
call CheckOpponentWentFirst
ret nz
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 15:21:53 -08:00
ld a, [wEffectFailed]
2013-03-26 17:39:44 -07:00
and a
ret nz
; fallthrough
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
FlinchTarget:
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
set SUBSTATUS_FLINCHED, [hl]
jp EndRechargeOpp
2013-03-26 22:52:04 -07:00
2018-06-24 07:09:41 -07:00
CheckOpponentWentFirst:
; Returns a=0, z if user went first
; Returns a=1, nz if opponent went first
push bc
ld a, [wEnemyGoesFirst] ; 0 if player went first
ld b, a
ld a, [hBattleTurn] ; 0 if it's the player's turn
xor b ; 1 if opponent went first
pop bc
ret
2018-06-24 07:09:41 -07:00
BattleCommand_HeldFlinch:
; kingsrock
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld a, [wAttackMissed]
2013-03-26 17:39:44 -07:00
and a
ret nz
call GetUserItem
ld a, b
cp HELD_FLINCH
ret nz
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVarAddr
ld d, h
ld e, l
call GetUserItem
call BattleRandom
cp c
ret nc
call EndRechargeOpp
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
set SUBSTATUS_FLINCHED, [hl]
ret
2018-06-24 07:09:41 -07:00
BattleCommand_OHKO:
; ohko
2013-03-26 22:52:04 -07:00
call ResetDamage
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 15:21:53 -08:00
ld a, [wTypeModifier]
and $7f
jr z, .no_effect
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 15:21:53 -08:00
ld hl, wEnemyMonLevel
ld de, wBattleMonLevel
ld bc, wPlayerMoveStruct + MOVE_ACC
ld a, [hBattleTurn]
and a
jr z, .got_move_accuracy
push hl
ld h, d
ld l, e
pop de
ld bc, wEnemyMoveStruct + MOVE_ACC
.got_move_accuracy
ld a, [de]
sub [hl]
jr c, .no_effect
add a
ld e, a
ld a, [bc]
add e
jr nc, .finish_ohko
ld a, $ff
.finish_ohko
ld [bc], a
call BattleCommand_CheckHit
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 15:21:53 -08:00
ld hl, wCurDamage
ld a, $ff
ld [hli], a
ld [hl], a
ld a, $2
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 15:21:53 -08:00
ld [wCriticalHit], a
ret
.no_effect
ld a, $ff
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 15:21:53 -08:00
ld [wCriticalHit], a
ld a, $1
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 15:21:53 -08:00
ld [wAttackMissed], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_CheckCharge:
; checkcharge
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
bit SUBSTATUS_CHARGED, [hl]
ret z
res SUBSTATUS_CHARGED, [hl]
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
ld b, charge_command
jp SkipToBattleCommand
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_Charge:
; charge
2013-03-26 17:39:44 -07:00
call BattleCommand_ClearText
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and SLP
jr z, .awake
2013-03-26 17:39:44 -07:00
call BattleCommand_MoveDelay
call BattleCommand_RaiseSub
call PrintButItFailed
jp EndMoveEffect
2013-03-26 22:52:04 -07:00
.awake
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
set SUBSTATUS_CHARGED, [hl]
ld hl, IgnoredOrders2Text
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 15:21:53 -08:00
ld a, [wAlreadyDisobeyed]
2013-03-26 17:39:44 -07:00
and a
call nz, StdBattleTextBox
call BattleCommand_LowerSub
xor a
ld [wNumHits], a
inc a
ld [wKickCounter], a
call LoadMoveAnim
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
cp FLY
jr z, .flying
cp DIG
jr z, .flying
call BattleCommand_RaiseSub
jr .not_flying
.flying
call DisappearUser
.not_flying
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld b, a
cp FLY
jr z, .set_flying
cp DIG
jr nz, .dont_set_digging
set SUBSTATUS_UNDERGROUND, [hl]
jr .dont_set_digging
.set_flying
set SUBSTATUS_FLYING, [hl]
.dont_set_digging
call CheckUserIsCharging
jr nz, .mimic
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
call GetBattleVarAddr
ld [hl], b
ld a, BATTLE_VARS_LAST_MOVE
call GetBattleVarAddr
ld [hl], b
.mimic
call ResetDamage
2013-03-26 17:39:44 -07:00
ld hl, .UsedText
call BattleTextBox
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_SKULL_BASH
ld b, endturn_command
jp z, SkipToBattleCommand
jp EndMoveEffect
2013-03-26 17:39:44 -07:00
.UsedText:
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 15:21:53 -08:00
text_jump UnknownText_0x1c0d0e ; "<USER>"
start_asm
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
cp RAZOR_WIND
ld hl, .RazorWind
jr z, .done
2013-03-26 17:39:44 -07:00
cp SOLARBEAM
ld hl, .Solarbeam
jr z, .done
2013-03-26 17:39:44 -07:00
cp SKULL_BASH
ld hl, .SkullBash
jr z, .done
cp SKY_ATTACK
ld hl, .SkyAttack
jr z, .done
2013-03-26 17:39:44 -07:00
cp FLY
ld hl, .Fly
jr z, .done
2013-03-26 17:39:44 -07:00
cp DIG
ld hl, .Dig
.done
ret
2013-03-26 17:39:44 -07:00
.RazorWind:
; 'made a whirlwind!'
text_jump UnknownText_0x1c0d12
db "@"
2013-03-26 17:39:44 -07:00
.Solarbeam:
; 'took in sunlight!'
text_jump UnknownText_0x1c0d26
db "@"
2013-03-26 17:39:44 -07:00
.SkullBash:
; 'lowered its head!'
text_jump UnknownText_0x1c0d3a
db "@"
.SkyAttack:
; 'is glowing!'
text_jump UnknownText_0x1c0d4e
db "@"
2013-03-26 17:39:44 -07:00
.Fly:
; 'flew up high!'
text_jump UnknownText_0x1c0d5c
db "@"
2013-03-26 17:39:44 -07:00
.Dig:
; 'dug a hole!'
text_jump UnknownText_0x1c0d6c
db "@"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand3c:
; unused
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_TrapTarget:
; traptarget
2013-03-26 22:52:04 -07:00
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 15:21:53 -08:00
ld a, [wAttackMissed]
and a
ret nz
ld hl, wEnemyWrapCount
ld de, wEnemyTrappingMove
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_trap
ld hl, wPlayerWrapCount
ld de, wPlayerTrappingMove
2013-04-27 14:12:23 -07:00
.got_trap
ld a, [hl]
and a
ret nz
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
bit SUBSTATUS_SUBSTITUTE, a
ret nz
call BattleRandom
; trapped for 2-5 turns
and %11
inc a
inc a
inc a
ld [hl], a
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld [de], a
ld b, a
ld hl, .Traps
2013-04-27 14:12:23 -07:00
.find_trap_text
ld a, [hli]
cp b
jr z, .found_trap_text
inc hl
inc hl
jr .find_trap_text
2013-03-27 14:07:00 -07:00
.found_trap_text
ld a, [hli]
ld h, [hl]
ld l, a
jp StdBattleTextBox
2013-03-27 14:07:00 -07:00
.Traps:
dbw BIND, UsedBindText ; 'used BIND on'
dbw WRAP, WrappedByText ; 'was WRAPPED by'
dbw FIRE_SPIN, FireSpinTrapText ; 'was trapped!'
dbw CLAMP, ClampedByText ; 'was CLAMPED by'
dbw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!'
INCLUDE "engine/battle/move_effects/mist.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/focus_energy.asm"
2018-06-24 07:09:41 -07:00
BattleCommand_Recoil:
; recoil
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld hl, wBattleMonMaxHP
ld a, [hBattleTurn]
and a
jr z, .got_hp
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 15:21:53 -08:00
ld hl, wEnemyMonMaxHP
.got_hp
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld d, a
; get 1/4 damage or 1 HP, whichever is higher
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 15:21:53 -08:00
ld a, [wCurDamage]
ld b, a
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 15:21:53 -08:00
ld a, [wCurDamage + 1]
ld c, a
srl b
rr c
srl b
rr c
ld a, b
or c
jr nz, .min_damage
inc c
.min_damage
ld a, [hli]
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 15:21:53 -08:00
ld [wBuffer2], a
ld a, [hl]
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 15:21:53 -08:00
ld [wBuffer1], a
dec hl
dec hl
ld a, [hl]
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 15:21:53 -08:00
ld [wBuffer3], a
sub c
ld [hld], a
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 15:21:53 -08:00
ld [wBuffer5], a
ld a, [hl]
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 15:21:53 -08:00
ld [wBuffer4], a
sbc b
ld [hl], a
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 15:21:53 -08:00
ld [wBuffer6], a
jr nc, .dont_ko
xor a
ld [hli], a
ld [hl], a
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 15:21:53 -08:00
ld hl, wBuffer5
ld [hli], a
ld [hl], a
.dont_ko
hlcoord 10, 9
ld a, [hBattleTurn]
and a
ld a, 1
jr z, .animate_hp_bar
hlcoord 2, 2
xor a
.animate_hp_bar
ld [wWhichHPBar], a
predef AnimateHPBar
call RefreshBattleHuds
ld hl, RecoilText
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
BattleCommand_ConfuseTarget:
; confusetarget
call GetOpponentItem
ld a, b
cp HELD_PREVENT_CONFUSE
ret z
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 15:21:53 -08:00
ld a, [wEffectFailed]
2013-03-26 17:39:44 -07:00
and a
ret nz
call SafeCheckSafeguard
ret nz
call CheckSubstituteOpp
ret nz
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
bit SUBSTATUS_CONFUSED, [hl]
ret nz
jr BattleCommand_FinishConfusingTarget
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_Confuse:
; confuse
call GetOpponentItem
ld a, b
cp HELD_PREVENT_CONFUSE
jr nz, .no_item_protection
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
call AnimateFailedMove
ld hl, ProtectedByText
jp StdBattleTextBox
.no_item_protection
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
bit SUBSTATUS_CONFUSED, [hl]
jr z, .not_already_confused
call AnimateFailedMove
ld hl, AlreadyConfusedText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.not_already_confused
call CheckSubstituteOpp
jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit
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 15:21:53 -08:00
ld a, [wAttackMissed]
and a
jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit
2018-06-24 07:09:41 -07:00
BattleCommand_FinishConfusingTarget:
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 15:21:53 -08:00
ld bc, wEnemyConfuseCount
ld a, [hBattleTurn]
and a
jr z, .got_confuse_count
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 15:21:53 -08:00
ld bc, wPlayerConfuseCount
2013-03-26 17:39:44 -07:00
.got_confuse_count
set SUBSTATUS_CONFUSED, [hl]
; confused for 2-5 turns
call BattleRandom
and %11
inc a
inc a
ld [bc], a
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_CONFUSE_HIT
jr z, .got_effect
cp EFFECT_SNORE
jr z, .got_effect
cp EFFECT_SWAGGER
jr z, .got_effect
call AnimateCurrentMove
.got_effect
ld de, ANIM_CONFUSED
call PlayOpponentBattleAnim
ld hl, BecameConfusedText
call StdBattleTextBox
call GetOpponentItem
ld a, b
cp HELD_HEAL_STATUS
jr z, .heal_confusion
cp HELD_HEAL_CONFUSION
ret nz
.heal_confusion
ld hl, UseConfusionHealingItem
jp CallBattleCore
2018-06-24 07:09:41 -07:00
BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit:
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_CONFUSE_HIT
ret z
cp EFFECT_SNORE
ret z
cp EFFECT_SWAGGER
ret z
jp PrintDidntAffect2
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_Paralyze:
; paralyze
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVar
bit PAR, a
jr nz, .paralyzed
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 15:21:53 -08:00
ld a, [wTypeModifier]
and $7f
jr z, .didnt_affect
call GetOpponentItem
ld a, b
cp HELD_PREVENT_PARALYZE
jr nz, .no_item_protection
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
call AnimateFailedMove
ld hl, ProtectedByText
jp StdBattleTextBox
.no_item_protection
ld a, [hBattleTurn]
and a
jr z, .dont_sample_failure
2013-03-26 17:39:44 -07:00
ld a, [wLinkMode]
and a
jr nz, .dont_sample_failure
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld a, [wInBattleTowerBattle]
and a
jr nz, .dont_sample_failure
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 15:21:53 -08:00
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a
jr nz, .dont_sample_failure
2013-03-26 17:39:44 -07:00
call BattleRandom
2018-02-04 10:16:40 -08:00
cp 25 percent + 1 ; 25% chance AI fails
jr c, .failed
2013-03-26 17:39:44 -07:00
.dont_sample_failure
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
and a
jr nz, .failed
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 15:21:53 -08:00
ld a, [wAttackMissed]
and a
jr nz, .failed
call CheckSubstituteOpp
jr nz, .failed
ld c, 30
call DelayFrames
call AnimateCurrentMove
2013-03-26 17:39:44 -07:00
ld a, $1
ld [hBGMapMode], a
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set PAR, [hl]
call UpdateOpponentInParty
ld hl, ApplyPrzEffectOnSpeed
call CallBattleCore
call UpdateBattleHuds
call PrintParalyze
ld hl, UseHeldStatusHealingItem
jp CallBattleCore
.paralyzed
call AnimateFailedMove
ld hl, AlreadyParalyzedText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.failed
jp PrintDidntAffect2
2013-03-26 17:39:44 -07:00
.didnt_affect
call AnimateFailedMove
jp PrintDoesntAffect
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CheckMoveTypeMatchesTarget:
; Compare move type to opponent type.
; Return z if matching the opponent type,
; unless the move is Normal (Tri Attack).
push hl
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 15:21:53 -08:00
ld hl, wEnemyMonType1
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .ok
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 15:21:53 -08:00
ld hl, wBattleMonType1
2013-03-26 17:39:44 -07:00
.ok
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVar
cp NORMAL
jr z, .normal
2013-03-26 17:39:44 -07:00
cp [hl]
jr z, .return
inc hl
cp [hl]
2013-03-26 17:39:44 -07:00
.return
pop hl
ret
2013-03-26 17:39:44 -07:00
.normal
ld a, 1
2013-03-26 17:39:44 -07:00
and a
pop hl
ret
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/substitute.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_RechargeNextTurn:
; rechargenextturn
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
set SUBSTATUS_RECHARGE, [hl]
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
EndRechargeOpp:
push hl
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVarAddr
res SUBSTATUS_RECHARGE, [hl]
pop hl
ret
2013-09-08 19:44:20 -07:00
INCLUDE "engine/battle/move_effects/rage.asm"
2013-09-08 19:44:20 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DoubleFlyingDamage:
; doubleflyingdamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
bit SUBSTATUS_FLYING, a
ret z
jr DoubleDamage
2018-06-24 07:09:41 -07:00
BattleCommand_DoubleUndergroundDamage:
; doubleundergrounddamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
bit SUBSTATUS_UNDERGROUND, a
ret z
2013-03-26 17:39:44 -07:00
; fallthrough
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
DoubleDamage:
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 15:21:53 -08:00
ld hl, wCurDamage + 1
sla [hl]
dec hl
rl [hl]
jr nc, .quit
2013-09-08 19:30:10 -07:00
ld a, $ff
ld [hli], a
ld [hl], a
.quit
ret
2013-09-08 19:30:10 -07:00
INCLUDE "engine/battle/move_effects/mimic.asm"
2013-09-08 19:30:10 -07:00
INCLUDE "engine/battle/move_effects/leech_seed.asm"
2013-09-08 19:30:10 -07:00
INCLUDE "engine/battle/move_effects/splash.asm"
INCLUDE "engine/battle/move_effects/disable.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/pay_day.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/conversion.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_ResetStats:
; resetstats
2013-03-26 17:39:44 -07:00
ld a, 7 ; neutral
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 15:21:53 -08:00
ld hl, wPlayerStatLevels
call .Fill
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 15:21:53 -08:00
ld hl, wEnemyStatLevels
call .Fill
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
push af
2013-03-26 17:39:44 -07:00
call SetPlayerTurn
call CalcPlayerStats
call SetEnemyTurn
call CalcEnemyStats
2013-03-26 17:39:44 -07:00
pop af
ld [hBattleTurn], a
2013-03-26 17:39:44 -07:00
call AnimateCurrentMove
2013-03-26 17:39:44 -07:00
ld hl, EliminatedStatsText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.Fill:
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 15:21:53 -08:00
ld b, wPlayerStatLevelsEnd - wPlayerStatLevels
.next
ld [hli], a
dec b
jr nz, .next
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
BattleCommand_Heal:
; heal
2013-03-26 17:39:44 -07:00
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 15:21:53 -08:00
ld de, wBattleMonHP
ld hl, wBattleMonMaxHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_hp
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 15:21:53 -08:00
ld de, wEnemyMonHP
ld hl, wEnemyMonMaxHP
.got_hp
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld b, a
push hl
push de
push bc
ld c, 2
call StringCmp
pop bc
pop de
pop hl
jp z, .hp_full
ld a, b
cp REST
jr nz, .not_rest
push hl
push de
push af
call BattleCommand_MoveDelay
ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarAddr
res SUBSTATUS_TOXIC, [hl]
ld a, BATTLE_VARS_STATUS
call GetBattleVarAddr
ld a, [hl]
2013-03-26 17:39:44 -07:00
and a
ld [hl], REST_SLEEP_TURNS + 1
ld hl, WentToSleepText
jr z, .no_status_to_heal
ld hl, RestedText
.no_status_to_heal
call StdBattleTextBox
ld a, [hBattleTurn]
and a
jr nz, .calc_enemy_stats
call CalcPlayerStats
jr .got_stats
.calc_enemy_stats
call CalcEnemyStats
.got_stats
pop af
pop de
pop hl
.not_rest
jr z, .restore_full_hp
ld hl, GetHalfMaxHP
call CallBattleCore
jr .finish
.restore_full_hp
ld hl, GetMaxHP
call CallBattleCore
.finish
call AnimateCurrentMove
call BattleCommand_SwitchTurn
ld hl, RestoreHP
call CallBattleCore
call BattleCommand_SwitchTurn
call UpdateUserInParty
call RefreshBattleHuds
ld hl, RegainedHealthText
jp StdBattleTextBox
.hp_full
call AnimateFailedMove
ld hl, HPIsFullText
jp StdBattleTextBox
INCLUDE "engine/battle/move_effects/transform.asm"
2018-06-24 07:09:41 -07:00
BattleSideCopy:
; Copy bc bytes from hl to de if it's the player's turn.
; Copy bc bytes from de to hl if it's the enemy's turn.
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .copy
2013-03-26 17:39:44 -07:00
; Swap hl and de
push hl
ld h, d
ld l, e
pop de
.copy
jp CopyBytes
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleEffect_ButItFailed:
call AnimateFailedMove
jp PrintButItFailed
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
ClearLastMove:
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
call GetBattleVarAddr
xor a
ld [hl], a
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_LAST_MOVE
call GetBattleVarAddr
xor a
ld [hl], a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
ResetActorDisable:
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .player
2013-03-26 17:39:44 -07:00
xor a
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 15:21:53 -08:00
ld [wEnemyDisableCount], a
ld [wEnemyDisabledMove], a
2013-03-26 17:39:44 -07:00
ret
.player
xor a
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 15:21:53 -08:00
ld [wPlayerDisableCount], a
ld [wDisabledMove], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_Screen:
; screen
2013-03-26 17:39:44 -07:00
2018-01-23 14:39:09 -08:00
ld hl, wPlayerScreens
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 15:21:53 -08:00
ld bc, wPlayerLightScreenCount
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_screens_pointer
2018-01-23 14:39:09 -08:00
ld hl, wEnemyScreens
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 15:21:53 -08:00
ld bc, wEnemyLightScreenCount
.got_screens_pointer
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_LIGHT_SCREEN
jr nz, .Reflect
bit SCREENS_LIGHT_SCREEN, [hl]
jr nz, .failed
set SCREENS_LIGHT_SCREEN, [hl]
ld a, 5
ld [bc], a
ld hl, LightScreenEffectText
jr .good
.Reflect:
bit SCREENS_REFLECT, [hl]
jr nz, .failed
set SCREENS_REFLECT, [hl]
; LightScreenCount -> ReflectCount
inc bc
ld a, 5
ld [bc], a
ld hl, ReflectEffectText
.good
call AnimateCurrentMove
jp StdBattleTextBox
.failed
call AnimateFailedMove
jp PrintButItFailed
2018-06-24 07:09:41 -07:00
PrintDoesntAffect:
; 'it doesn't affect'
ld hl, DoesntAffectText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
PrintNothingHappened:
; 'but nothing happened!'
ld hl, NothingHappenedText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
TryPrintButItFailed:
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 15:21:53 -08:00
ld a, [wAlreadyFailed]
and a
ret nz
2013-03-26 17:39:44 -07:00
; fallthrough
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
PrintButItFailed:
; 'but it failed!'
ld hl, ButItFailedText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
FailMove:
call AnimateFailedMove
; fallthrough
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
FailMimic:
ld hl, ButItFailedText ; 'but it failed!'
ld de, ItFailedText ; 'it failed!'
jp FailText_CheckOpponentProtect
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
PrintDidntAffect:
; 'it didn't affect'
ld hl, DidntAffect1Text
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
PrintDidntAffect2:
call AnimateFailedMove
ld hl, DidntAffect1Text ; 'it didn't affect'
ld de, DidntAffect2Text ; 'it didn't affect'
jp FailText_CheckOpponentProtect
2018-06-24 07:09:41 -07:00
PrintParalyze:
; 'paralyzed! maybe it can't attack!'
ld hl, ParalyzedText
jp StdBattleTextBox
2018-06-24 07:09:41 -07:00
CheckSubstituteOpp:
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
bit SUBSTATUS_SUBSTITUTE, a
ret
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/selfdestruct.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/mirror_move.asm"
INCLUDE "engine/battle/move_effects/metronome.asm"
2018-06-24 07:09:41 -07:00
CheckUserMove:
; Return z if the user has move a.
ld b, a
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 15:21:53 -08:00
ld de, wBattleMonMoves
ld a, [hBattleTurn]
2013-03-26 17:39:44 -07:00
and a
jr z, .ok
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 15:21:53 -08:00
ld de, wEnemyMonMoves
.ok
ld c, NUM_MOVES
.loop
ld a, [de]
inc de
cp b
2013-03-26 17:39:44 -07:00
ret z
dec c
jr nz, .loop
2013-03-26 17:39:44 -07:00
ld a, 1
and a
ret
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
ResetTurn:
ld hl, wPlayerCharging
ld a, [hBattleTurn]
and a
jr z, .player
ld hl, wEnemyCharging
2013-03-26 17:39:44 -07:00
.player
ld [hl], 1
2013-03-26 17:39:44 -07:00
xor a
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 15:21:53 -08:00
ld [wAlreadyDisobeyed], a
call DoMove
jp EndMoveEffect
INCLUDE "engine/battle/move_effects/thief.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_ArenaTrap:
; arenatrap
2013-03-26 17:39:44 -07:00
; Doesn't work on an absent opponent.
call CheckHiddenOpponent
jr nz, .failed
; Don't trap if the opponent is already trapped.
ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarAddr
bit SUBSTATUS_CANT_RUN, [hl]
jr nz, .failed
; Otherwise trap the opponent.
set SUBSTATUS_CANT_RUN, [hl]
call AnimateCurrentMove
ld hl, CantEscapeNowText
jp StdBattleTextBox
.failed
call AnimateFailedMove
jp PrintButItFailed
INCLUDE "engine/battle/move_effects/nightmare.asm"
2018-06-24 07:09:41 -07:00
BattleCommand_Defrost:
; defrost
; Thaw the user.
ld a, BATTLE_VARS_STATUS
call GetBattleVarAddr
bit FRZ, [hl]
ret z
res FRZ, [hl]
; Don't update the enemy's party struct in a wild battle.
ld a, [hBattleTurn]
and a
jr z, .party
ld a, [wBattleMode]
dec a
jr z, .done
2013-03-26 17:39:44 -07:00
.party
ld a, MON_STATUS
call UserPartyAttr
res FRZ, [hl]
2013-03-26 17:39:44 -07:00
.done
call RefreshBattleHuds
ld hl, WasDefrostedText
jp StdBattleTextBox
INCLUDE "engine/battle/move_effects/curse.asm"
INCLUDE "engine/battle/move_effects/protect.asm"
INCLUDE "engine/battle/move_effects/endure.asm"
INCLUDE "engine/battle/move_effects/spikes.asm"
INCLUDE "engine/battle/move_effects/foresight.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/perish_song.asm"
INCLUDE "engine/battle/move_effects/sandstorm.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/rollout.asm"
2018-06-24 07:09:41 -07:00
BattleCommand5d:
; unused
2013-03-26 17:39:44 -07:00
ret
INCLUDE "engine/battle/move_effects/fury_cutter.asm"
INCLUDE "engine/battle/move_effects/attract.asm"
INCLUDE "engine/battle/move_effects/return.asm"
INCLUDE "engine/battle/move_effects/present.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/frustration.asm"
2013-03-26 17:39:44 -07:00
INCLUDE "engine/battle/move_effects/safeguard.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
SafeCheckSafeguard:
push hl
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 15:21:53 -08:00
ld hl, wEnemyScreens
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .got_turn
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 15:21:53 -08:00
ld hl, wPlayerScreens
.got_turn
bit SCREENS_SAFEGUARD, [hl]
pop hl
ret
2018-06-24 07:09:41 -07:00
BattleCommand_CheckSafeguard:
; checksafeguard
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 15:21:53 -08:00
ld hl, wEnemyScreens
ld a, [hBattleTurn]
2013-03-26 17:39:44 -07:00
and a
jr z, .got_turn
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 15:21:53 -08:00
ld hl, wPlayerScreens
.got_turn
bit SCREENS_SAFEGUARD, [hl]
2013-03-26 17:39:44 -07:00
ret z
ld a, 1
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 15:21:53 -08:00
ld [wAttackMissed], a
call BattleCommand_MoveDelay
ld hl, SafeguardProtectText
call StdBattleTextBox
jp EndMoveEffect
INCLUDE "engine/battle/move_effects/magnitude.asm"
INCLUDE "engine/battle/move_effects/baton_pass.asm"
INCLUDE "engine/battle/move_effects/pursuit.asm"
INCLUDE "engine/battle/move_effects/rapid_spin.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_HealMorn:
2013-03-26 17:39:44 -07:00
; healmorn
ld b, MORN_F
2015-12-23 17:46:23 -08:00
jr BattleCommand_TimeBasedHealContinue
2018-06-24 07:09:41 -07:00
BattleCommand_HealDay:
2013-03-26 17:39:44 -07:00
; healday
ld b, DAY_F
2015-12-23 17:46:23 -08:00
jr BattleCommand_TimeBasedHealContinue
2018-06-24 07:09:41 -07:00
BattleCommand_HealNite:
2013-03-26 17:39:44 -07:00
; healnite
ld b, NITE_F
2013-03-26 17:39:44 -07:00
; fallthrough
2018-06-24 07:09:41 -07:00
BattleCommand_TimeBasedHealContinue:
2013-03-26 17:39:44 -07:00
; Time- and weather-sensitive heal.
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonMaxHP
ld de, wBattleMonHP
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .start
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonMaxHP
ld de, wEnemyMonHP
2013-03-26 17:39:44 -07:00
.start
; Index for .Multipliers
; Default restores half max HP.
ld c, 2
; Don't bother healing if HP is already full.
push bc
call StringCmp
pop bc
jr z, .Full
; Don't factor in time of day in link battles.
ld a, [wLinkMode]
2013-03-26 17:39:44 -07:00
and a
jr nz, .Weather
2018-01-23 14:39:09 -08:00
ld a, [wTimeOfDay]
2013-03-26 17:39:44 -07:00
cp b
jr z, .Weather
2015-12-23 17:46:23 -08:00
dec c ; double
2013-03-26 17:39:44 -07:00
.Weather:
ld a, [wBattleWeather]
2013-03-26 17:39:44 -07:00
and a
jr z, .Heal
; x2 in sun
; /2 in rain/sandstorm
inc c
cp WEATHER_SUN
jr z, .Heal
dec c
2015-12-26 18:59:03 -08:00
dec c
2013-03-26 17:39:44 -07:00
.Heal:
2013-03-26 17:39:44 -07:00
ld b, 0
ld hl, .Multipliers
add hl, bc
2015-12-26 18:59:03 -08:00
add hl, bc
2013-03-26 17:39:44 -07:00
ld a, [hli]
ld h, [hl]
ld l, a
ld a, BANK(GetMaxHP)
rst FarCall
call AnimateCurrentMove
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-26 17:39:44 -07:00
2017-12-24 09:47:30 -08:00
callfar RestoreHP
2013-03-26 17:39:44 -07:00
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-05-02 21:22:28 -07:00
call UpdateUserInParty
2013-03-26 17:39:44 -07:00
; 'regained health!'
ld hl, RegainedHealthText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.Full:
call AnimateFailedMove
2013-03-26 17:39:44 -07:00
; 'hp is full!'
ld hl, HPIsFullText
jp StdBattleTextBox
2013-03-26 17:39:44 -07:00
.Multipliers:
2013-03-26 17:39:44 -07:00
dw GetEighthMaxHP
dw GetQuarterMaxHP
dw GetHalfMaxHP
dw GetMaxHP
INCLUDE "engine/battle/move_effects/hidden_power.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/rain_dance.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/sunny_day.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/belly_drum.asm"
2014-01-05 05:24:27 -08:00
INCLUDE "engine/battle/move_effects/psych_up.asm"
INCLUDE "engine/battle/move_effects/mirror_coat.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
BattleCommand_DoubleMinimizeDamage:
2013-03-26 22:52:04 -07:00
; doubleminimizedamage
2013-03-26 17:39:44 -07:00
ld hl, wEnemyMinimized
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .ok
ld hl, wPlayerMinimized
.ok
2013-03-26 17:39:44 -07:00
ld a, [hl]
and a
ret z
2018-01-23 14:39:09 -08:00
ld hl, wCurDamage + 1
2013-03-26 17:39:44 -07:00
sla [hl]
dec hl
rl [hl]
ret nc
ld a, $ff
ld [hli], a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleCommand_SkipSunCharge:
2015-11-09 13:41:09 -08:00
; mimicsuncharge
ld a, [wBattleWeather]
2013-03-26 17:39:44 -07:00
cp WEATHER_SUN
ret nz
ld b, charge_command
2013-03-26 22:52:04 -07:00
jp SkipToBattleCommand
INCLUDE "engine/battle/move_effects/future_sight.asm"
INCLUDE "engine/battle/move_effects/thunder.asm"
2013-03-26 17:39:44 -07:00
2018-06-24 07:09:41 -07:00
CheckHiddenOpponent:
2017-12-19 16:04:56 -08:00
; BUG: This routine should account for Lock-On and Mind Reader.
2013-03-26 17:39:44 -07:00
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
2013-03-26 17:39:44 -07:00
ret
2018-06-24 07:09:41 -07:00
GetUserItem:
2013-03-26 17:39:44 -07:00
; Return the effect of the user's item in bc, and its id at hl.
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonItem
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .go
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonItem
2013-03-26 17:39:44 -07:00
.go
ld b, [hl]
jp GetItemHeldEffect
2018-06-24 07:09:41 -07:00
GetOpponentItem:
2013-03-26 17:39:44 -07:00
; Return the effect of the opponent's item in bc, and its id at hl.
2018-01-23 14:39:09 -08:00
ld hl, wEnemyMonItem
2013-03-26 17:39:44 -07:00
ld a, [hBattleTurn]
and a
jr z, .go
2018-01-23 14:39:09 -08:00
ld hl, wBattleMonItem
2013-03-26 17:39:44 -07:00
.go
ld b, [hl]
jp GetItemHeldEffect
2018-06-24 07:09:41 -07:00
GetItemHeldEffect:
2013-03-26 17:39:44 -07:00
; Return the effect of item b in bc.
ld a, b
and a
ret z
push hl
ld hl, ItemAttributes + ITEMATTR_EFFECT
2013-03-26 17:39:44 -07:00
dec a
ld c, a
ld b, 0
2017-12-12 17:15:07 -08:00
ld a, ITEMATTR_STRUCT_LENGTH
2013-03-26 17:39:44 -07:00
call AddNTimes
2013-04-29 23:01:54 -07:00
ld a, BANK(ItemAttributes)
2013-03-26 17:39:44 -07:00
call GetFarHalfword
ld b, l
ld c, h
pop hl
ret
2018-06-24 07:09:41 -07:00
AnimateCurrentMoveEitherSide:
2013-03-27 13:19:51 -07:00
push hl
push de
push bc
2015-11-06 17:55:16 -08:00
ld a, [wKickCounter]
2013-03-27 13:19:51 -07:00
push af
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
2013-03-27 13:19:51 -07:00
pop af
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2015-11-09 13:41:09 -08:00
call PlayDamageAnim
2015-11-06 13:42:38 -08:00
call BattleCommand_RaiseSub
2013-03-27 13:19:51 -07:00
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
AnimateCurrentMove:
2013-03-27 13:19:51 -07:00
push hl
push de
push bc
2015-11-06 17:55:16 -08:00
ld a, [wKickCounter]
2013-03-27 13:19:51 -07:00
push af
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
2013-03-27 13:19:51 -07:00
pop af
2015-11-06 17:55:16 -08:00
ld [wKickCounter], a
2015-11-09 13:41:09 -08:00
call LoadMoveAnim
2015-11-06 13:42:38 -08:00
call BattleCommand_RaiseSub
2013-03-27 13:19:51 -07:00
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
PlayDamageAnim:
2013-03-27 13:19:51 -07:00
xor a
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-27 13:19:51 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-27 13:19:51 -07:00
and a
ret z
2018-01-23 14:39:09 -08:00
ld [wFXAnimID], a
2013-03-27 13:19:51 -07:00
ld a, [hBattleTurn]
and a
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_ENEMY_DAMAGE
2015-11-06 17:55:16 -08:00
jr z, .player
2015-11-09 13:41:09 -08:00
ld a, BATTLEANIM_PLAYER_DAMAGE
2013-03-27 13:19:51 -07:00
2015-11-06 17:55:16 -08:00
.player
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-27 13:19:51 -07:00
2015-11-06 17:55:16 -08:00
jp PlayUserBattleAnim
2018-06-24 07:09:41 -07:00
LoadMoveAnim:
2013-03-27 13:19:51 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-27 13:19:51 -07:00
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
2013-03-27 13:19:51 -07:00
and a
ret z
; fallthrough
2018-06-24 07:09:41 -07:00
LoadAnim:
2018-01-23 14:39:09 -08:00
ld [wFXAnimID], a
2013-03-27 13:19:51 -07:00
; fallthrough
2018-06-24 07:09:41 -07:00
PlayUserBattleAnim:
2013-03-27 13:19:51 -07:00
push hl
push de
push bc
callfar PlayBattleAnim
2013-03-27 13:19:51 -07:00
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
PlayOpponentBattleAnim:
2013-03-27 13:19:51 -07:00
ld a, e
2018-01-23 14:39:09 -08:00
ld [wFXAnimID], a
2013-03-27 13:19:51 -07:00
ld a, d
2018-01-23 14:39:09 -08:00
ld [wFXAnimID + 1], a
2013-03-27 13:19:51 -07:00
xor a
2015-12-23 11:00:29 -08:00
ld [wNumHits], a
2013-03-27 13:19:51 -07:00
push hl
push de
push bc
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-27 13:19:51 -07:00
callfar PlayBattleAnim
2013-03-27 13:19:51 -07:00
2015-10-10 04:45:39 -07:00
call BattleCommand_SwitchTurn
2013-03-27 13:19:51 -07:00
pop bc
pop de
pop hl
ret
2018-06-24 07:09:41 -07:00
CallBattleCore:
ld a, BANK("Battle Core")
2013-03-27 13:19:51 -07:00
rst FarCall
ret
2018-06-24 07:09:41 -07:00
AnimateFailedMove:
2015-11-06 13:42:38 -08:00
call BattleCommand_LowerSub
call BattleCommand_MoveDelay
2015-11-06 13:42:38 -08:00
jp BattleCommand_RaiseSub
2018-06-24 07:09:41 -07:00
BattleCommand_MoveDelay:
; movedelay
2013-03-26 17:39:44 -07:00
; Wait 40 frames.
ld c, 40
jp DelayFrames
2018-06-24 07:09:41 -07:00
BattleCommand_ClearText:
2013-03-26 22:52:04 -07:00
; cleartext
2013-03-26 17:39:44 -07:00
; Used in multi-hit moves.
ld hl, .text
jp BattleTextBox
2013-03-26 17:39:44 -07:00
.text
db "@"
2018-06-24 07:09:41 -07:00
SkipToBattleCommand:
2013-03-26 22:52:04 -07:00
; Skip over commands until reaching command b.
2018-01-23 14:39:09 -08:00
ld a, [wBattleScriptBufferAddress + 1]
2013-03-26 22:52:04 -07:00
ld h, a
2018-01-23 14:39:09 -08:00
ld a, [wBattleScriptBufferAddress]
2013-03-26 22:52:04 -07:00
ld l, a
2015-11-09 13:41:09 -08:00
.loop
2013-03-26 22:52:04 -07:00
ld a, [hli]
cp b
2015-11-09 13:41:09 -08:00
jr nz, .loop
2013-03-26 22:52:04 -07:00
ld a, h
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress + 1], a
2013-03-26 22:52:04 -07:00
ld a, l
2018-01-23 14:39:09 -08:00
ld [wBattleScriptBufferAddress], a
2013-03-26 22:52:04 -07:00
ret
2018-06-24 07:09:41 -07:00
GetMoveAttr:
2013-03-27 13:19:51 -07:00
; Assuming hl = Moves + x, return attribute x of move a.
push bc
ld bc, MOVE_LENGTH
2013-03-27 13:19:51 -07:00
call AddNTimes
call GetMoveByte
pop bc
ret
2018-06-24 07:09:41 -07:00
GetMoveData:
2013-03-27 13:19:51 -07:00
; Copy move struct a to de.
2013-03-26 17:39:44 -07:00
ld hl, Moves
ld bc, MOVE_LENGTH
2013-03-26 17:39:44 -07:00
call AddNTimes
ld a, BANK(Moves)
2013-03-26 17:39:44 -07:00
jp FarCopyBytes
2018-06-24 07:09:41 -07:00
GetMoveByte:
2013-03-27 13:19:51 -07:00
ld a, BANK(Moves)
jp GetFarByte
2018-06-24 07:09:41 -07:00
DisappearUser:
2017-12-24 09:47:30 -08:00
farcall _DisappearUser
2013-03-27 13:19:51 -07:00
ret
2018-06-24 07:09:41 -07:00
AppearUserLowerSub:
2017-12-24 09:47:30 -08:00
farcall _AppearUserLowerSub
2013-03-27 13:19:51 -07:00
ret
2018-06-24 07:09:41 -07:00
AppearUserRaiseSub:
2017-12-24 09:47:30 -08:00
farcall _AppearUserRaiseSub
2013-03-27 13:19:51 -07:00
ret
2018-06-24 07:09:41 -07:00
_CheckBattleScene:
2015-11-06 19:36:06 -08:00
; Checks the options. Returns carry if battle animations are disabled.
2013-03-27 13:19:51 -07:00
push hl
push de
push bc
2017-12-24 09:47:30 -08:00
farcall CheckBattleScene
2013-03-27 13:19:51 -07:00
pop bc
pop de
pop hl
ret