Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secondary effects overhaul minor follow-up #4062

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,21 @@
.byte 0x8b
.endm

.macro unused0x8C
.macro twoturnmovestringandchargeanimation
.byte 0x8c
.4byte 1f @animation then attack string
@default - attack string then animation
printfromtable gFirstTurnOfTwoStringIds
waitmessage B_WAIT_TIME_LONG
attackanimation
waitanimation
goto 2f
1:
attackanimation
waitanimation
printfromtable gFirstTurnOfTwoStringIds
waitmessage B_WAIT_TIME_LONG
2:
.endm

.macro setmultihitcounter value:req
Expand Down Expand Up @@ -1034,12 +1047,18 @@
.4byte \failInstr
.endm

.macro setsemiinvulnerablebit
.macro setsemiinvulnerablebit clear=FALSE
.byte 0xc5
.byte \clear
.endm

.macro clearsemiinvulnerablebit
setsemiinvulnerablebit TRUE
.endm

.macro jumpifsemiinvulnerablemove jumpInstr:req
.byte 0xc6
.4byte \jumpInstr
.endm

.macro setminimize
Expand Down Expand Up @@ -1868,6 +1887,11 @@
various \battler, VARIOUS_POWER_TRICK
.endm

.macro jumpifmovehaschargeturneffects jumpInstr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_MOVE_HAS_CHARGE_TURN_EFFECTS
.4byte \jumpInstr
.endm

.macro jumpifnotgrounded battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_NOT_GROUNDED
.4byte \jumpInstr
Expand Down Expand Up @@ -2106,9 +2130,8 @@
.4byte \jumpInstr
.endm

.macro jumpifweatheraffected battler:req, flags:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_WEATHER_AFFECTED
.4byte \flags
.macro jumpifweathermovearg battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_WEATHER_MOVE_ARG
.4byte \jumpInstr
.endm

Expand Down
230 changes: 49 additions & 181 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -580,43 +580,6 @@ BattleScript_BeakBlastBurn::
call BattleScript_MoveEffectBurn
return

BattleScript_EffectMeteorBeam::
@ DecideTurn
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
jumpifmove MOVE_METEOR_BEAM, BattleScript_SetStringMeteorBeam
jumpifmove MOVE_ELECTRO_SHOT, BattleScript_SetStringElectroShock
BattleScript_TryCharging:
call BattleScript_FirstChargingTurnMeteorBeam
jumpifmove MOVE_METEOR_BEAM, BattleScript_TryMeteorBeam
jumpifweatheraffected BS_ATTACKER, B_WEATHER_RAIN, BattleScript_TwoTurnMovesSecondTurn @ Check for move Electro Shot
BattleScript_TryMeteorBeam:
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
goto BattleScript_TwoTurnMovesSecondTurn

BattleScript_SetStringMeteorBeam:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_METEOR_BEAM
goto BattleScript_TryCharging

BattleScript_SetStringElectroShock:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_ELECTRO_SHOCK
goto BattleScript_TryCharging

BattleScript_FirstChargingTurnMeteorBeam::
attackcanceler
flushtextbox
ppreduce
attackanimation
waitanimation
orword gHitMarker, HITMARKER_CHARGING
seteffectprimary MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER
copybyte cMULTISTRING_CHOOSER, sTWOTURN_STRINGID
printfromtable gFirstTurnOfTwoStringIds
waitmessage B_WAIT_TIME_LONG
setadditionaleffects @ only onChargeTurnOnly effects will work here
return

BattleScript_EffectSkyDrop::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_SkyDropTurn2
attackcanceler
Expand All @@ -633,16 +596,10 @@ BattleScript_EffectSkyDrop::

BattleScript_SkyDropWork:
setskydrop
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_SKY_DROP
setsemiinvulnerablebit
call BattleScriptFirstChargingTurnAfterAttackString
call BattleScript_FirstChargingTurnAfterAttackString
goto BattleScript_MoveEnd
BattleScript_SkyDropTurn2:
attackcanceler
setbyte sB_ANIM_TURN, 0x1
clearstatusfromeffect BS_ATTACKER, MOVE_EFFECT_CHARGING
orword gHitMarker, HITMARKER_NO_PPDEDUCT
clearsemiinvulnerablebit
call BattleScript_TwoTurnMovesSecondTurnRet
attackstring
clearskydrop BattleScript_SkyDropChangedTarget
jumpiftype BS_TARGET, TYPE_FLYING, BattleScript_SkyDropFlyingType
Expand Down Expand Up @@ -1956,7 +1913,7 @@ BattleScript_GrowthDoMoveAnim::
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPATK, 0
jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthAtk2
jumpifweathermovearg BS_ATTACKER, BattleScript_GrowthAtk2
setstatchanger STAT_ATK, 1, FALSE
goto BattleScript_GrowthAtk
BattleScript_GrowthAtk2:
Expand All @@ -1967,7 +1924,7 @@ BattleScript_GrowthAtk:
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_GrowthTrySpAtk::
jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthSpAtk2
jumpifweathermovearg BS_ATTACKER, BattleScript_GrowthSpAtk2
setstatchanger STAT_SPATK, 1, FALSE
goto BattleScript_GrowthSpAtk
BattleScript_GrowthSpAtk2:
Expand Down Expand Up @@ -3480,29 +3437,6 @@ BattleScript_KOFail::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_TwoTurnMovesSecondTurn::
attackcanceler
setbyte sB_ANIM_TURN, 1
clearstatusfromeffect BS_ATTACKER, MOVE_EFFECT_CHARGING
orword gHitMarker, HITMARKER_NO_PPDEDUCT
goto BattleScript_HitFromAccCheck

BattleScriptFirstChargingTurn::
attackcanceler
flushtextbox
ppreduce
attackstring
BattleScriptFirstChargingTurnAfterAttackString:
pause B_WAIT_TIME_LONG
copybyte cMULTISTRING_CHOOSER, sTWOTURN_STRINGID
printfromtable gFirstTurnOfTwoStringIds
waitmessage B_WAIT_TIME_LONG
attackanimation
waitanimation
orword gHitMarker, HITMARKER_CHARGING
seteffectprimary MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER
return

BattleScript_EffectSuperFang::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
Expand Down Expand Up @@ -3777,36 +3711,32 @@ BattleScript_PowerHerbActivation:
return

BattleScript_EffectTwoTurnsAttack::
jumpifmovehaschargeturneffects BattleScript_EffectTwoTurnsAttackTry
jumpifsemiinvulnerablemove BattleScript_EffectTwoTurnsAttackTry
jumpifweathermovearg BS_ATTACKER, BattleScript_EffectTwoTurnsAttackFireImmediately
BattleScript_EffectTwoTurnsAttackTry::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
jumpifmove MOVE_SKY_ATTACK, BattleScript_EffectTwoTurnsAttackSkyAttack
jumpifmove MOVE_RAZOR_WIND, BattleScript_EffectTwoTurnsAttackRazorWind
jumpifmove MOVE_ICE_BURN, BattleScript_EffectTwoTurnsAttackIceBurn
jumpifmove MOVE_FREEZE_SHOCK, BattleScript_EffectTwoTurnsAttackFreezeShock
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_RAZOR_WIND
BattleScript_EffectTwoTurnsAttackContinue:
call BattleScriptFirstChargingTurn
call BattleScript_FirstChargingTurn
jumpifsemiinvulnerablemove BattleScript_EffectTwoTurnsAttackTryPowerHerb
jumpifweathermovearg BS_ATTACKER, BattleScript_TwoTurnMovesSecondTurn
BattleScript_EffectTwoTurnsAttackTryPowerHerb:
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
.if B_UPDATED_MOVE_DATA < GEN_5 @ before Gen 5, charge moves did not print an attack string on the charge turn
attackstring
waitmessage B_WAIT_TIME_LONG
.endif
goto BattleScript_TwoTurnMovesSecondTurn
BattleScript_EffectTwoTurnsAttackSkyAttack:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_SKY_ATTACK
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackRazorWind:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_RAZOR_WIND
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackIceBurn:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_RAZOR_WIND
goto BattleScript_EffectTwoTurnsAttackContinue
BattleScript_EffectTwoTurnsAttackFreezeShock:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_FREEZE_SHOCK
goto BattleScript_EffectTwoTurnsAttackContinue

BattleScript_EffectTwoTurnsAttackFireImmediately::
setbyte sB_ANIM_TURN, 1
goto BattleScript_EffectHit

BattleScript_EffectGeomancy::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_GeomancySecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_GeomancySecondTurn
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_GEOMANCY
call BattleScriptFirstChargingTurn
call BattleScript_FirstChargingTurn
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
BattleScript_GeomancySecondTurn:
Expand Down Expand Up @@ -3843,6 +3773,34 @@ BattleScript_GeomancyTrySpeed::
BattleScript_GeomancyEnd::
goto BattleScript_MoveEnd

BattleScript_FirstChargingTurn::
attackcanceler
ppreduce
.if B_UPDATED_MOVE_DATA >= GEN_5 @ before Gen 5, charge moves did not print an attack string on the charge turn
flushtextbox
attackstring
waitmessage B_WAIT_TIME_LONG
.endif
BattleScript_FirstChargingTurnAfterAttackString:
setsemiinvulnerablebit @ only for moves with EFFECT_SEMI_INVULNERABLE/EFFECT_SKY_DROP
orword gHitMarker, HITMARKER_CHARGING
seteffectprimary MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER
twoturnmovestringandchargeanimation
setadditionaleffects @ only onChargeTurnOnly effects will work here
return

BattleScript_TwoTurnMovesSecondTurn::
call BattleScript_TwoTurnMovesSecondTurnRet
goto BattleScript_HitFromAccCheck

BattleScript_TwoTurnMovesSecondTurnRet:
attackcanceler
setbyte sB_ANIM_TURN, 1
clearstatusfromeffect BS_ATTACKER, MOVE_EFFECT_CHARGING
orword gHitMarker, HITMARKER_NO_PPDEDUCT
clearsemiinvulnerablebit @ only for moves with EFFECT_SEMI_INVULNERABLE/EFFECT_SKY_DROP
return

BattleScript_EffectSubstitute::
attackcanceler
ppreduce
Expand Down Expand Up @@ -4173,17 +4131,6 @@ BattleScript_PartyHealEnd::
waitstate
goto BattleScript_MoveEnd

BattleScript_EffectTripleKick::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
jumpifmove MOVE_TRIPLE_AXEL BS_TripleAxel
addbyte sTRIPLE_KICK_POWER, 10 @ triple kick gets +10 power
goto BattleScript_HitFromAtkString

BS_TripleAxel:
addbyte sTRIPLE_KICK_POWER, 20 @ triple axel gets +20 power
goto BattleScript_HitFromAtkString

BattleScript_EffectMeanLook::
attackcanceler
attackstring
Expand Down Expand Up @@ -4649,23 +4596,6 @@ BattleScript_EffectMirrorCoat::
adjustdamage
goto BattleScript_HitFromAtkAnimation

BattleScript_EffectSkullBash::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_SKULL_BASH
call BattleScriptFirstChargingTurn
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_SkullBashEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_SkullBashEnd
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_SkullBashEnd::
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
goto BattleScript_TwoTurnMovesSecondTurn

BattleScript_EffectFutureSight::
attackcanceler
attackstring
Expand All @@ -4677,25 +4607,6 @@ BattleScript_EffectFutureSight::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_EffectGust::
goto BattleScript_EffectHit

BattleScript_EffectSolarBeam::
jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_SolarBeamOnFirstTurn
BattleScript_SolarBeamDecideTurn::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_SOLAR_BEAM
call BattleScriptFirstChargingTurn
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
goto BattleScript_TwoTurnMovesSecondTurn
BattleScript_SolarBeamOnFirstTurn::
orword gHitMarker, HITMARKER_CHARGING
seteffectprimary MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER
ppreduce
goto BattleScript_TwoTurnMovesSecondTurn

BattleScript_EffectTeleport::
.if B_TELEPORT_BEHAVIOR >= GEN_7
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass
Expand Down Expand Up @@ -4760,46 +4671,6 @@ BattleScript_BeatUpEnd::
end
.endif

BattleScript_EffectSemiInvulnerable::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_SecondTurnSemiInvulnerable
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_SecondTurnSemiInvulnerable
jumpifmove MOVE_FLY, BattleScript_FirstTurnFly
jumpifmove MOVE_DIVE, BattleScript_FirstTurnDive
jumpifmove MOVE_BOUNCE, BattleScript_FirstTurnBounce
jumpifmove MOVE_PHANTOM_FORCE, BattleScript_FirstTurnPhantomForce
jumpifmove MOVE_SHADOW_FORCE, BattleScript_FirstTurnPhantomForce
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_DIG
goto BattleScript_FirstTurnSemiInvulnerable
BattleScript_FirstTurnBounce::
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_BOUNCE
goto BattleScript_FirstTurnSemiInvulnerable
BattleScript_FirstTurnDive::
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_DIVE
goto BattleScript_FirstTurnSemiInvulnerable
BattleScript_FirstTurnPhantomForce:
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_PHANTOM_FORCE
goto BattleScript_FirstTurnSemiInvulnerable
BattleScript_FirstTurnFly::
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_FLY
BattleScript_FirstTurnSemiInvulnerable::
call BattleScriptFirstChargingTurn
setsemiinvulnerablebit
jumpifnoholdeffect BS_ATTACKER, HOLD_EFFECT_POWER_HERB, BattleScript_MoveEnd
call BattleScript_PowerHerbActivation
BattleScript_SecondTurnSemiInvulnerable::
attackcanceler
setbyte sB_ANIM_TURN, 1
clearstatusfromeffect BS_ATTACKER, MOVE_EFFECT_CHARGING
orword gHitMarker, HITMARKER_NO_PPDEDUCT
BattleScript_SemiInvulnerableTryHit::
accuracycheck BattleScript_SemiInvulnerableMiss, ACC_CURR_MOVE
clearsemiinvulnerablebit
goto BattleScript_HitFromAtkString

BattleScript_SemiInvulnerableMiss::
clearsemiinvulnerablebit
goto BattleScript_PrintMoveMissed

BattleScript_EffectDefenseCurl::
attackcanceler
attackstring
Expand Down Expand Up @@ -5539,9 +5410,6 @@ BattleScript_CosmicPowerTrySpDef::
BattleScript_CosmicPowerEnd::
goto BattleScript_MoveEnd

BattleScript_EffectSkyUppercut::
goto BattleScript_EffectHit

BattleScript_EffectBulkUp::
attackcanceler
attackstring
Expand Down
Loading
Loading