merge with be
@ -1543,6 +1543,11 @@
|
||||
.byte \case
|
||||
.endm
|
||||
|
||||
.macro handleprimalreversion battler:req, case:req
|
||||
various \battler, VARIOUS_HANDLE_PRIMAL_REVERSION
|
||||
.byte \case
|
||||
.endm
|
||||
|
||||
.macro handleformchange battler:req, case:req
|
||||
various \battler, VARIOUS_HANDLE_FORM_CHANGE
|
||||
.byte \case
|
||||
@ -1769,10 +1774,9 @@
|
||||
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
|
||||
.endm
|
||||
|
||||
.macro jumpifweatheraffected battler:req, weather:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_WEATHER_AFFECTED
|
||||
.4byte \weather
|
||||
.4byte \ptr
|
||||
.macro consumeberry battler:req, restoreItem=FALSE
|
||||
various \battler, VARIOUS_CONSUME_BERRY
|
||||
.byte \restoreItem
|
||||
.endm
|
||||
|
||||
.macro activateitemeffects battler:req
|
||||
@ -1827,6 +1831,39 @@
|
||||
various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN
|
||||
.endm
|
||||
|
||||
.macro trytoclearprimalweather
|
||||
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
|
||||
.endm
|
||||
|
||||
.macro getrototillertargets ptr:req
|
||||
various BS_ATTACKER, VARIOUS_GET_ROTOTILLER_TARGETS
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifnotrototilleraffected battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro tryactivatebattlebond battler:req
|
||||
various \battler, VARIOUS_TRY_ACTIVATE_BATTLE_BOND
|
||||
.endm
|
||||
|
||||
.macro jumpifcantreverttoprimal ptr:req
|
||||
various BS_ATTACKER, VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro applyplasmafists
|
||||
various BS_ATTACKER, VARIOUS_APPLY_PLASMA_FISTS
|
||||
.endm
|
||||
|
||||
.macro jumpifweatheraffected battler:req, weather:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_WEATHER_AFFECTED
|
||||
.4byte \weather
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "constants/songs.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/pokemon.h"
|
||||
#include "constants/items.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "asm/macros/battle_anim_script.inc"
|
||||
.include "constants/constants.inc"
|
||||
@ -823,6 +824,8 @@ gBattleAnims_General::
|
||||
.4byte General_RestoreBg @ B_ANIM_RESTORE_BG
|
||||
.4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE
|
||||
.4byte General_GulpMissile @ B_ANIM_GULP_MISSILE
|
||||
.4byte General_StrongWinds @ B_ANIM_STRONG_WINDS
|
||||
.4byte General_PrimalReversion @ B_ANIM_PRIMAL_REVERSION
|
||||
|
||||
.align 2
|
||||
gBattleAnims_Special::
|
||||
@ -5373,6 +5376,31 @@ ScaldHitSplats:
|
||||
return
|
||||
|
||||
Move_SHELL_SMASH:
|
||||
loadspritegfx ANIM_TAG_SHELL_RIGHT
|
||||
loadspritegfx ANIM_TAG_SHELL_LEFT
|
||||
loadspritegfx ANIM_TAG_IMPACT
|
||||
loadspritegfx ANIM_TAG_ROCKS
|
||||
loadspritegfx ANIM_TAG_HANDS_AND_FEET
|
||||
playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER
|
||||
createsprite gShellSmashRightShellSpriteTemplate, ANIM_ATTACKER, 2, 0xffd7, 0x0, 0x2, 0x333, 0x0, 0xa
|
||||
createsprite gShellSmashLeftShellSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x0, 0x6, 0xfccd, 0x0, 0xa
|
||||
delay 10
|
||||
createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1
|
||||
createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x8, 0x1, 0x0
|
||||
playsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET
|
||||
createvisualtask AnimTask_ShakeMon, 2, 1, 3, 0, 5, 1
|
||||
waitforvisualfinish
|
||||
playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x14, 0x18, 0xe, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x5, 0x0, 0xffec, 0x18, 0xe, 0x1
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x5, 0x14, 0xffe8, 0xe, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0xfffb, 0x0, 0xffec, 0xffe8, 0xe, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfffb, 0x1e, 0x12, 0x8, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0xffee, 0x8, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xffe2, 0x12, 0x8, 0x2
|
||||
createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xffe2, 0xffee, 0x8, 0x2
|
||||
createvisualtask AnimTask_ShakeMon, 2, 1, 0, 3, 7, 1
|
||||
waitforvisualfinish
|
||||
end
|
||||
|
||||
Move_HEAL_PULSE:
|
||||
@ -24398,6 +24426,17 @@ General_TotemFlare::
|
||||
clearmonbg ANIM_ATTACKER
|
||||
end
|
||||
|
||||
RainbowEndureEffect:
|
||||
launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2
|
||||
delay 0x3
|
||||
launchtemplate gEndureEnergySpriteTemplate 0x2 0x4 0x0 0xe 0x1c 0x1 @Red Buff
|
||||
delay 0x3
|
||||
launchtemplate gGreenEndureEnergySpriteTemplate 0x2 0x4 0x0 0xfffb 0xa 0x2
|
||||
delay 0x3
|
||||
launchtemplate gYellowEndureEnergySpriteTemplate 0x2 0x4 0x0 0x1c 0x1a 0x3
|
||||
delay 0x3
|
||||
return
|
||||
|
||||
General_GulpMissile: @ Tackle anim (placeholder)
|
||||
loadspritegfx ANIM_TAG_IMPACT
|
||||
monbg ANIM_ATTACKER
|
||||
@ -24412,15 +24451,88 @@ General_GulpMissile: @ Tackle anim (placeholder)
|
||||
blendoff
|
||||
end
|
||||
|
||||
RainbowEndureEffect:
|
||||
launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2
|
||||
delay 0x3
|
||||
launchtemplate gEndureEnergySpriteTemplate 0x2 0x4 0x0 0xe 0x1c 0x1 @Red Buff
|
||||
delay 0x3
|
||||
launchtemplate gGreenEndureEnergySpriteTemplate 0x2 0x4 0x0 0xfffb 0xa 0x2
|
||||
delay 0x3
|
||||
launchtemplate gYellowEndureEnergySpriteTemplate 0x2 0x4 0x0 0x1c 0x1a 0x3
|
||||
delay 0x3
|
||||
General_StrongWinds::
|
||||
loadspritegfx ANIM_TAG_FLYING_DIRT
|
||||
playsewithpan SE_M_GUST, 0
|
||||
createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20)
|
||||
waitforvisualfinish
|
||||
createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE
|
||||
delay 32
|
||||
waitforvisualfinish
|
||||
stopsound
|
||||
end
|
||||
|
||||
General_PrimalReversion::
|
||||
launchtask AnimTask_PrimalReversion 0x5 0x0
|
||||
jumpargeq 0x0, ITEM_RED_ORB, General_PrimalReversion_Omega
|
||||
jumpargeq 0x1, ITEM_BLUE_ORB, General_PrimalReversion_Alpha
|
||||
General_PrimalReversion_Alpha:
|
||||
loadspritegfx ANIM_TAG_ALPHA_STONE
|
||||
loadspritegfx ANIM_TAG_PRIMAL_PARTICLES
|
||||
loadspritegfx ANIM_TAG_ALPHA_SYMBOL
|
||||
monbg ANIM_ATTACKER
|
||||
setalpha 12, 8
|
||||
loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3
|
||||
createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11)
|
||||
call PrimalReversionParticles
|
||||
call PrimalReversionParticles
|
||||
call PrimalReversionParticles
|
||||
waitforvisualfinish
|
||||
playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER
|
||||
createsprite gAlphaStoneSpriteTemplate, ANIM_ATTACKER, 41, 0, 0, 0, 0
|
||||
delay 20
|
||||
createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA
|
||||
waitforvisualfinish
|
||||
createvisualtask AnimTask_TransformMon, 2, 0, 1
|
||||
createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA
|
||||
createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14
|
||||
waitforvisualfinish
|
||||
createsprite gAlphaSymbolSpriteTemplate ANIM_ATTACKER, 2
|
||||
waitforvisualfinish
|
||||
clearmonbg ANIM_ATK_PARTNER
|
||||
blendoff
|
||||
end
|
||||
General_PrimalReversion_Omega:
|
||||
loadspritegfx ANIM_TAG_OMEGA_STONE
|
||||
loadspritegfx ANIM_TAG_PRIMAL_PARTICLES
|
||||
loadspritegfx ANIM_TAG_OMEGA_SYMBOL
|
||||
monbg ANIM_ATTACKER
|
||||
setalpha 12, 8
|
||||
loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3
|
||||
createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11)
|
||||
call PrimalReversionParticles
|
||||
call PrimalReversionParticles
|
||||
call PrimalReversionParticles
|
||||
waitforvisualfinish
|
||||
playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER
|
||||
createsprite gOmegaStoneSpriteTemplate, ANIM_ATTACKER, 41, 0, 0, 0, 0
|
||||
delay 20
|
||||
createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA
|
||||
waitforvisualfinish
|
||||
createvisualtask AnimTask_TransformMon, 2, 0, 1
|
||||
createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA
|
||||
createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14
|
||||
waitforvisualfinish
|
||||
createsprite gOmegaSymbolSpriteTemplate ANIM_ATTACKER, 2
|
||||
waitforvisualfinish
|
||||
clearmonbg ANIM_ATK_PARTNER
|
||||
blendoff
|
||||
end
|
||||
PrimalReversionParticles:
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, 40, -10, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, -35, -10, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, 15, -40, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, -10, -32, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, 25, -20, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, -40, -20, 13
|
||||
delay 3
|
||||
createsprite gPrimalParticlesSpriteTemplate, ANIM_ATTACKER, 2, 5, -40, 13
|
||||
delay 3
|
||||
return
|
||||
|
||||
SnatchMoveTrySwapFromSubstitute:
|
||||
|
@ -380,6 +380,209 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT
|
||||
.4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT
|
||||
.4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25
|
||||
.4byte BattleScript_EffectStuffCheeks @ EFFECT_STUFF_CHEEKS
|
||||
.4byte BattleScript_EffectDefenseDownHit @ EFFECT_GRAV_APPLE
|
||||
.4byte BattleScript_EffectEvasionUpHit @ EFFECT_EVASION_UP_HIT
|
||||
.4byte BattleScript_EffectDoubleIronBash @ EFFECT_DOUBLE_IRON_BASH
|
||||
.4byte BattleScript_EffectGlitzyGlow @ EFFECT_GLITZY_GLOW
|
||||
.4byte BattleScript_EffectBaddyBad @ EFFECT_BADDY_BAD
|
||||
.4byte BattleScript_EffectSappySeed @ EFFECT_SAPPY_SEED
|
||||
.4byte BattleScript_EffectFreezyFrost @ EFFECT_FREEZY_FROST
|
||||
.4byte BattleScript_EffectSparklySwirl @ EFFECT_SPARKLY_SWIRL
|
||||
.4byte BattleScript_EffectPlasmaFists @ EFFECT_PLASMA_FISTS
|
||||
|
||||
BattleScript_EffectPlasmaFists:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
seteffectwithchance
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
applyplasmafists
|
||||
printstring STRINGID_IONDELUGEON
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectSparklySwirl:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
healpartystatus
|
||||
waitstate
|
||||
updatestatusicon BS_ATTACKER_WITH_PARTNER
|
||||
waitstate
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectFreezyFrost:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
normalisebuffs
|
||||
printstring STRINGID_STATCHANGESGONE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectSappySeed:
|
||||
jumpifstatus3 BS_TARGET, STATUS3_LEECHSEED, BattleScript_EffectHit
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
jumpifhasnohp BS_TARGET, BattleScript_MoveEnd
|
||||
setseeded
|
||||
printfromtable gLeechSeedStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectBaddyBad:
|
||||
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_REFLECT, BattleScript_EffectHit
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
setreflect
|
||||
printfromtable gReflectLightScreenSafeguardStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectGlitzyGlow:
|
||||
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_LIGHTSCREEN, BattleScript_EffectHit
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
setlightscreen
|
||||
printfromtable gReflectLightScreenSafeguardStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectDoubleIronBash:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
setmultihitcounter 2
|
||||
initmultihitstring
|
||||
sethword sMULTIHIT_EFFECT, MOVE_EFFECT_FLINCH
|
||||
goto BattleScript_MultiHitLoop
|
||||
|
||||
BattleScript_EffectEvasionUpHit:
|
||||
setmoveeffect MOVE_EFFECT_EVS_PLUS_1 | MOVE_EFFECT_AFFECTS_USER
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_EffectStuffCheeks::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifnotberry BS_ATTACKER, BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
BattleScript_StuffCheeksEatBerry:
|
||||
setbyte sBERRY_OVERRIDE, TRUE
|
||||
orword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
consumeberry BS_ATTACKER
|
||||
bicword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, FALSE
|
||||
setstatchanger STAT_DEF, 2, FALSE
|
||||
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_StuffCheeksEnd
|
||||
setgraphicalstatchangevalues
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_StuffCheeksEnd @ cant raise def
|
||||
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_StuffCheeksEnd:
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectDecorate:
|
||||
attackcanceler
|
||||
@ -636,6 +839,11 @@ BattleScript_MoveEffectIncinerate::
|
||||
BattleScript_MoveEffectBugBite::
|
||||
printstring STRINGID_BUGBITE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
orword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, TRUE @ override the requirements for eating berries
|
||||
consumeberry BS_ATTACKER, TRUE @ consume the berry, then restore the item from changedItems
|
||||
bicword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, FALSE
|
||||
return
|
||||
|
||||
BattleScript_EffectCoreEnforcer:
|
||||
@ -646,6 +854,9 @@ BattleScript_MoveEffectCoreEnforcer::
|
||||
setgastroacid BattleScript_CoreEnforcerRet
|
||||
printstring STRINGID_PKMNSABILITYSUPPRESSED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
BattleScript_CoreEnforcerRet:
|
||||
return
|
||||
|
||||
@ -738,6 +949,9 @@ BattleScript_EffectPartingShotSwitch:
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
waitstate
|
||||
@ -946,22 +1160,19 @@ BattleScript_EffectRototiller:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
selectfirstvalidtarget
|
||||
BattleScript_RototillerLoop:
|
||||
movevaluescleanup
|
||||
jumpifnotgrounded BS_TARGET, BattleScript_RototillerNoEffect
|
||||
jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_RototillerLoop2
|
||||
BattleScript_RototillerNoEffect:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NOEFFECTONTARGET
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
BattleScript_RototillerLoop2:
|
||||
jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_RototillerDoMoveAnim
|
||||
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, MAX_STAT_STAGE, BattleScript_RototillerCantRaiseMultipleStats
|
||||
BattleScript_RototillerDoMoveAnim::
|
||||
getrototillertargets BattleScript_ButItFailed
|
||||
@ at least one battler is affected
|
||||
attackanimation
|
||||
waitanimation
|
||||
savetarget
|
||||
setbyte gBattlerTarget, 0
|
||||
BattleScript_RototillerLoop:
|
||||
movevaluescleanup
|
||||
jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_RototillerCheckAffected
|
||||
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, MAX_STAT_STAGE, BattleScript_RototillerCantRaiseMultipleStats
|
||||
BattleScript_RototillerCheckAffected:
|
||||
jumpifnotrototilleraffected BS_TARGET, BattleScript_RototillerNoEffect
|
||||
BattleScript_RototillerAffected:
|
||||
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, 0
|
||||
setstatchanger STAT_ATK, 1, FALSE
|
||||
@ -977,13 +1188,22 @@ BattleScript_RototillerTrySpAtk::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_RototillerMoveTargetEnd:
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_RototillerLoop
|
||||
addbyte gBattlerTarget, 1
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_RototillerLoop
|
||||
end
|
||||
|
||||
BattleScript_RototillerCantRaiseMultipleStats:
|
||||
copybyte gBattlerAttacker, gBattlerTarget
|
||||
printstring STRINGID_STATSWONTINCREASE2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
|
||||
BattleScript_RototillerNoEffect:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NOEFFECTONTARGET
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
|
||||
BattleScript_EffectBestow:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON
|
||||
@ -1742,6 +1962,9 @@ BattleScript_EffectSimpleBeam:
|
||||
waitanimation
|
||||
printstring STRINGID_PKMNACQUIREDSIMPLE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectSuckerPunch:
|
||||
@ -1790,6 +2013,9 @@ BattleScript_EffectHealingWish:
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
waitstate
|
||||
@ -1827,6 +2053,9 @@ BattleScript_EffectWorrySeed:
|
||||
waitanimation
|
||||
printstring STRINGID_PKMNACQUIREDABILITY
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectPowerSplit:
|
||||
@ -1955,6 +2184,9 @@ BattleScript_EffectGastroAcid:
|
||||
waitanimation
|
||||
printstring STRINGID_PKMNSABILITYSUPPRESSED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectToxicSpikes:
|
||||
@ -2149,6 +2381,9 @@ BattleScript_EffectHitEscape:
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
waitstate
|
||||
@ -2960,7 +3195,7 @@ BattleScript_EffectRecoilIfMiss::
|
||||
accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE
|
||||
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
|
||||
typecalc
|
||||
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveMissedDoDamage
|
||||
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveMissedDoDamage
|
||||
.endif
|
||||
goto BattleScript_HitFromAtkString
|
||||
BattleScript_MoveMissedDoDamage::
|
||||
@ -2971,7 +3206,7 @@ BattleScript_MoveMissedDoDamage::
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
.if B_CRASH_IF_TARGET_IMMUNE < GEN_4
|
||||
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
|
||||
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
|
||||
.endif
|
||||
printstring STRINGID_PKMNCRASHED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
@ -3087,6 +3322,9 @@ BattleScript_EffectTransform::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
transformdataexecution
|
||||
attackanimation
|
||||
waitanimation
|
||||
@ -3169,7 +3407,11 @@ BattleScript_EffectParalyze:
|
||||
jumpifleafguard BattleScript_LeafGuardProtects
|
||||
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
|
||||
jumpifsubstituteblocks BattleScript_ButItFailed
|
||||
.if B_GLARE_GHOST >= GEN_4
|
||||
jumpifmove MOVE_GLARE, BattleScript_BattleScript_EffectParalyzeNoTypeCalc
|
||||
.endif
|
||||
typecalc
|
||||
BattleScript_BattleScript_EffectParalyzeNoTypeCalc:
|
||||
jumpifmovehadnoeffect BattleScript_ButItFailed
|
||||
jumpifstatus BS_TARGET, STATUS1_PARALYSIS, BattleScript_AlreadyParalyzed
|
||||
tryparalyzetype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected
|
||||
@ -3710,7 +3952,7 @@ BattleScript_TripleKickPrintStrings::
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0, BattleScript_TripleKickEnd
|
||||
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd
|
||||
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd
|
||||
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
|
||||
printstring STRINGID_HITXTIMES
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
@ -3735,6 +3977,9 @@ BattleScript_EffectMeanLook::
|
||||
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
|
||||
jumpifstatus2 BS_TARGET, STATUS2_ESCAPE_PREVENTION, BattleScript_ButItFailed
|
||||
jumpifsubstituteblocks BattleScript_ButItFailed
|
||||
.if B_GHOSTS_ESCAPE >= GEN_6
|
||||
jumpiftype BS_TARGET, TYPE_GHOST, BattleScript_ButItFailed
|
||||
.endif
|
||||
attackanimation
|
||||
waitanimation
|
||||
setmoveeffect MOVE_EFFECT_PREVENT_ESCAPE
|
||||
@ -3878,6 +4123,7 @@ BattleScript_PerishSongLoopIncrement::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_PerishSongBlocked::
|
||||
copybyte sBATTLER, gBattlerTarget
|
||||
printstring STRINGID_PKMNSXBLOCKSY2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_PerishSongLoopIncrement
|
||||
@ -3891,6 +4137,9 @@ BattleScript_EffectSandstorm::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn
|
||||
setsandstorm
|
||||
goto BattleScript_MoveWeatherChange
|
||||
|
||||
@ -4024,6 +4273,9 @@ BattleScript_EffectBatonPass::
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
waitstate
|
||||
@ -4050,6 +4302,7 @@ BattleScript_EffectRapidSpin::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
|
||||
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
|
||||
seteffectwithchance
|
||||
setstatchanger STAT_SPEED, 1, FALSE
|
||||
@ -4065,8 +4318,8 @@ BattleScript_EffectRapidSpinEnd::
|
||||
end
|
||||
.else
|
||||
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
|
||||
.endif
|
||||
goto BattleScript_EffectHit
|
||||
.endif
|
||||
|
||||
BattleScript_EffectSonicboom::
|
||||
attackcanceler
|
||||
@ -4093,6 +4346,9 @@ BattleScript_EffectRainDance::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn
|
||||
setrain
|
||||
BattleScript_MoveWeatherChange::
|
||||
attackanimation
|
||||
@ -4106,9 +4362,80 @@ BattleScript_EffectSunnyDay::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn
|
||||
setsunny
|
||||
goto BattleScript_MoveWeatherChange
|
||||
|
||||
BattleScript_ExtremelyHarshSunlightWasNotLessened:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end3
|
||||
|
||||
BattleScript_ExtremelyHarshSunlightWasNotLessenedRet:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_NoReliefFromHeavyRain:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NORELIEFROMHEAVYRAIN
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_NoReliefFromHeavyRainEnd3:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NORELIEFROMHEAVYRAIN
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end3
|
||||
|
||||
BattleScript_NoReliefFromHeavyRainRet:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NORELIEFROMHEAVYRAIN
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_MysteriousAirCurrentBlowsOn:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_MysteriousAirCurrentBlowsOnEnd3:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end3
|
||||
|
||||
BattleScript_MysteriousAirCurrentBlowsOnRet:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_BlockedByPrimalWeatherEnd3::
|
||||
call BattleScript_AbilityPopUp
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3
|
||||
end3
|
||||
|
||||
BattleScript_BlockedByPrimalWeatherRet::
|
||||
call BattleScript_AbilityPopUp
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet
|
||||
return
|
||||
|
||||
BattleScript_EffectDefenseUpHit::
|
||||
setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER
|
||||
goto BattleScript_EffectHit
|
||||
@ -4464,6 +4791,9 @@ BattleScript_EffectHail::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain
|
||||
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn
|
||||
sethail
|
||||
goto BattleScript_MoveWeatherChange
|
||||
|
||||
@ -5178,6 +5508,7 @@ BattleScript_FaintTarget::
|
||||
tryactivatemoxie BS_ATTACKER @ and chilling neigh, as one ice rider
|
||||
tryactivatebeastboost BS_ATTACKER
|
||||
tryactivategrimneigh BS_ATTACKER @ and as one shadow rider
|
||||
tryactivatebattlebond BS_ATTACKER
|
||||
trytrainerslidefirstdownmsg BS_TARGET
|
||||
return
|
||||
|
||||
@ -5230,6 +5561,9 @@ BattleScript_FaintedMonTryChooseAnother:
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_ATTACKER
|
||||
switchinanim BS_ATTACKER, 0
|
||||
@ -5240,6 +5574,9 @@ BattleScript_FaintedMonChooseAnother:
|
||||
getswitchedmondata BS_FAINTED
|
||||
switchindataupdate BS_FAINTED
|
||||
hpthresholds BS_FAINTED
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_FAINTED
|
||||
switchinanim BS_FAINTED, FALSE
|
||||
@ -5272,6 +5609,9 @@ BattleScript_HandleFaintedMonLoop::
|
||||
getswitchedmondata BS_FAINTED
|
||||
switchindataupdate BS_FAINTED
|
||||
hpthresholds BS_FAINTED
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_FAINTED
|
||||
switchinanim BS_FAINTED, FALSE
|
||||
@ -5474,10 +5814,16 @@ BattleScript_DoSwitchOut::
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_ATTACKER
|
||||
switchinanim BS_ATTACKER, FALSE
|
||||
waitstate
|
||||
jumpifcantreverttoprimal BattleScript_DoSwitchOut2
|
||||
call BattleScript_PrimalReversionRet
|
||||
BattleScript_DoSwitchOut2:
|
||||
switchineffects BS_ATTACKER
|
||||
moveendcase MOVEEND_STATUS_IMMUNITY_ABILITIES
|
||||
moveendcase MOVEEND_MIRROR_MOVE
|
||||
@ -5775,6 +6121,9 @@ BattleScript_RoarSuccessSwitch::
|
||||
call BattleScript_RoarSuccessRet
|
||||
getswitchedmondata BS_TARGET
|
||||
switchindataupdate BS_TARGET
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
switchinanim BS_TARGET, FALSE
|
||||
waitstate
|
||||
printstring STRINGID_PKMNWASDRAGGEDOUT
|
||||
@ -6266,6 +6615,10 @@ BattleScript_SelectingNotAllowedMoveGravity::
|
||||
printselectionstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
endselectionscript
|
||||
|
||||
BattleScript_SelectingNotAllowedStuffCheeks::
|
||||
printselectionstring STRINGID_STUFFCHEEKSCANTSELECT
|
||||
endselectionscript
|
||||
|
||||
BattleScript_SelectingNotAllowedBelch::
|
||||
printselectionstring STRINGID_BELCHCANTSELECT
|
||||
endselectionscript
|
||||
@ -6501,6 +6854,33 @@ BattleScript_WishMegaEvolution::
|
||||
switchinabilities BS_ATTACKER
|
||||
end2
|
||||
|
||||
BattleScript_PrimalReversion::
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
setbyte gIsCriticalHit, 0
|
||||
handleprimalreversion BS_ATTACKER, 0
|
||||
handleprimalreversion BS_ATTACKER, 1
|
||||
playanimation BS_ATTACKER, B_ANIM_PRIMAL_REVERSION, NULL
|
||||
waitanimation
|
||||
handleprimalreversion BS_ATTACKER, 2
|
||||
printstring STRINGID_PKMNREVERTEDTOPRIMAL
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
switchinabilities BS_ATTACKER
|
||||
end2
|
||||
|
||||
BattleScript_PrimalReversionRet::
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
setbyte gIsCriticalHit, 0
|
||||
handleprimalreversion BS_ATTACKER, 0
|
||||
handleprimalreversion BS_ATTACKER, 1
|
||||
playanimation BS_ATTACKER, B_ANIM_PRIMAL_REVERSION, NULL
|
||||
waitanimation
|
||||
handleprimalreversion BS_ATTACKER, 2
|
||||
printstring STRINGID_PKMNREVERTEDTOPRIMAL
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_AttackerFormChange::
|
||||
pause 5
|
||||
copybyte gBattlerAbility, gBattlerAttacker
|
||||
@ -6673,7 +7053,7 @@ BattleScript_PowderMoveNoEffect::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_PowderMoveNoEffectPrint
|
||||
jumpifability BS_TARGET, ABILITY_OVERCOAT, BattleScript_PowderMoveNoEffectOvercoat
|
||||
printstring STRINGID_SAFETYGOOGLESPROTECTED
|
||||
printstring STRINGID_SAFETYGOGGLESPROTECTED
|
||||
goto BattleScript_PowderMoveNoEffectWaitMsg
|
||||
BattleScript_PowderMoveNoEffectOvercoat:
|
||||
call BattleScript_AbilityPopUp
|
||||
@ -7216,6 +7596,56 @@ BattleScript_DroughtActivates::
|
||||
call BattleScript_WeatherFormChanges
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_EXTREMELYHARSHSUNLIGHT
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL
|
||||
call BattleScript_WeatherFormChanges
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandEvaporatesWaterTypeMoves::
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
pause B_WAIT_TIME_SHORT
|
||||
ppreduce
|
||||
printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_PrimordialSeaActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_HEAVYRAIN
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL
|
||||
call BattleScript_WeatherFormChanges
|
||||
end3
|
||||
|
||||
BattleScript_PrimordialSeaFizzlesOutFireTypeMoves::
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
pause B_WAIT_TIME_SHORT
|
||||
ppreduce
|
||||
printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_DeltaStreamActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_MYSTERIOUSAIRCURRENT
|
||||
waitstate
|
||||
playanimation BS_ATTACKER, B_ANIM_STRONG_WINDS, NULL
|
||||
end3
|
||||
|
||||
BattleScript_AttackWeakenedByStrongWinds::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_SnowWarningActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
@ -7344,6 +7774,7 @@ BattleScript_MoveStatDrain::
|
||||
waitanimation
|
||||
printstring STRINGID_TARGETABILITYSTATRAISE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
clearsemiinvulnerablebit
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
@ -8040,22 +8471,22 @@ BattleScript_HangedOnMsgRet:
|
||||
return
|
||||
|
||||
BattleScript_BerryConfuseHealEnd2::
|
||||
jumpifability BS_ATTACKER, ABILITY_RIPEN, BattleScript_BerryConfuseHealEnd2_AbilityPopup
|
||||
jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_BerryConfuseHealEnd2_AbilityPopup
|
||||
goto BattleScript_BerryConfuseHealEnd2_Anim
|
||||
BattleScript_BerryConfuseHealEnd2_AbilityPopup:
|
||||
call BattleScript_AbilityPopUp
|
||||
BattleScript_BerryConfuseHealEnd2_Anim:
|
||||
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
printstring STRINGID_PKMNSITEMRESTOREDHEALTH
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
||||
healthbarupdate BS_ATTACKER
|
||||
datahpupdate BS_ATTACKER
|
||||
healthbarupdate BS_SCRIPTING
|
||||
datahpupdate BS_SCRIPTING
|
||||
printstring STRINGID_FORXCOMMAYZ
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER
|
||||
seteffectprimary
|
||||
removeitem BS_ATTACKER
|
||||
removeitem BS_SCRIPTING
|
||||
end2
|
||||
|
||||
BattleScript_BerryConfuseHealRet::
|
||||
@ -8072,9 +8503,9 @@ BattleScript_BerryConfuseHealRet_Anim:
|
||||
datahpupdate BS_SCRIPTING
|
||||
printstring STRINGID_FORXCOMMAYZ
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
removeitem BS_SCRIPTING
|
||||
removeitem BS_TARGET
|
||||
return
|
||||
|
||||
BattleScript_BerryStatRaiseEnd2::
|
||||
@ -8286,6 +8717,14 @@ BattleScript_QuickClawActivation::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end2
|
||||
|
||||
BattleScript_QuickDrawActivation::
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_CANACTFASTERTHANKSTO
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end2
|
||||
|
||||
BattleScript_CustapBerryActivation::
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
@ -8398,6 +8837,9 @@ BattleScript_EjectButtonActivates::
|
||||
getswitchedmondata BS_SCRIPTING
|
||||
switchindataupdate BS_SCRIPTING
|
||||
hpthresholds BS_SCRIPTING
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring 0x3
|
||||
switchinanim BS_SCRIPTING 0x1
|
||||
waitstate
|
||||
|
BIN
graphics/battle_anims/backgrounds/windstorm_brew.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
graphics/battle_anims/sprites/alpha_symbol.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
graphics/battle_anims/sprites/omega_symbol.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
graphics/battle_anims/sprites/primal_particles.png
Normal file
After Width: | Height: | Size: 510 B |
19
graphics/battle_interface/ability_pop_up.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
1 177 91
|
||||
143 129 149
|
||||
103 91 111
|
||||
79 65 85
|
||||
59 31 81
|
||||
103 89 109
|
||||
231 239 245
|
||||
249 253 255
|
||||
0 0 0
|
||||
0 0 0
|
||||
107 115 115
|
||||
74 66 82
|
||||
0 0 0
|
||||
214 214 206
|
||||
132 140 140
|
||||
0 0 0
|
BIN
graphics/battle_interface/alpha_indicator.png
Normal file
After Width: | Height: | Size: 266 B |
BIN
graphics/battle_interface/last_used_ball_l.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
graphics/battle_interface/last_used_ball_r.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
graphics/battle_interface/omega_indicator.png
Normal file
After Width: | Height: | Size: 271 B |
@ -37,6 +37,7 @@
|
||||
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
||||
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
|
||||
#define B_ACTION_DEBUG 20
|
||||
#define B_ACTION_THROW_BALL 21 // R to throw last used ball
|
||||
#define B_ACTION_NONE 0xFF
|
||||
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
@ -150,6 +151,7 @@ struct ProtectStruct
|
||||
u32 disableEjectPack:1;
|
||||
u32 statFell:1;
|
||||
u32 pranksterElevated:1;
|
||||
u32 quickDraw:1;
|
||||
u32 physicalDmg;
|
||||
u32 specialDmg;
|
||||
u8 physicalBattlerId;
|
||||
@ -174,6 +176,7 @@ struct SpecialStatus
|
||||
u8 instructedChosenTarget:3;
|
||||
u8 berryReduced:1;
|
||||
u8 gemBoost:1;
|
||||
u8 rototillerAffected:1; // to be affected by rototiller
|
||||
u8 gemParam;
|
||||
u8 damagedMons:4; // Mons that have been damaged directly by using a move, includes substitute.
|
||||
u8 dancerUsedMove:1;
|
||||
@ -209,6 +212,7 @@ struct SideTimer
|
||||
u8 tailwindBattlerId;
|
||||
u8 luckyChantTimer;
|
||||
u8 luckyChantBattlerId;
|
||||
u8 retaliateTimer;
|
||||
};
|
||||
|
||||
struct FieldTimer
|
||||
@ -461,10 +465,14 @@ struct MegaEvolutionData
|
||||
bool8 alreadyEvolved[4]; // Array id is used for mon position.
|
||||
u16 evolvedSpecies[MAX_BATTLERS_COUNT];
|
||||
u16 playerEvolvedSpecies;
|
||||
u8 primalRevertedPartyIds[2]; // As flags using gBitTable;
|
||||
u16 primalRevertedSpecies[MAX_BATTLERS_COUNT];
|
||||
u16 playerPrimalRevertedSpecies;
|
||||
u8 battlerId;
|
||||
bool8 playerSelect;
|
||||
u8 triggerSpriteId;
|
||||
bool8 isWishMegaEvo;
|
||||
bool8 isPrimalReversion;
|
||||
};
|
||||
|
||||
struct Illusion
|
||||
@ -488,7 +496,7 @@ struct BattleStruct
|
||||
u8 turnEffectsBattlerId;
|
||||
u8 turnCountersTracker;
|
||||
u16 wrappedMove[MAX_BATTLERS_COUNT];
|
||||
u8 moveTarget[MAX_BATTLERS_COUNT];
|
||||
u16 moveTarget[MAX_BATTLERS_COUNT];
|
||||
u8 expGetterMonId;
|
||||
u8 wildVictorySong;
|
||||
u8 dynamicMoveType;
|
||||
@ -593,6 +601,7 @@ struct BattleStruct
|
||||
bool8 spriteIgnore0Hp;
|
||||
struct Illusion illusion[MAX_BATTLERS_COUNT];
|
||||
s8 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier
|
||||
s32 aiSimulatedDamage[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // attacker, target, move to make debugging easier
|
||||
u8 soulheartBattlerId;
|
||||
u8 friskedBattler; // Frisk needs to identify 2 battlers in double battles.
|
||||
bool8 friskedAbility; // If identifies two mons, show the ability pop-up only once.
|
||||
@ -602,6 +611,7 @@ struct BattleStruct
|
||||
u8 quickClawBattlerId;
|
||||
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
|
||||
u8 blunderPolicy:1; // should blunder policy activate
|
||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||
};
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
@ -676,6 +686,7 @@ struct BattleScripting
|
||||
bool8 fixedPopup; // Force ability popup to stick until manually called back
|
||||
u16 abilityPopupOverwrite;
|
||||
u8 switchCase; // Special switching conditions, eg. red card
|
||||
u8 overrideBerryRequirements;
|
||||
};
|
||||
|
||||
// rom_80A5C6C
|
||||
@ -855,6 +866,7 @@ extern u8 gUnusedFirstBattleVar2;
|
||||
extern u32 gSideStatuses[2];
|
||||
extern struct SideTimer gSideTimers[2];
|
||||
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
|
||||
extern u32 gStatuses4[MAX_BATTLERS_COUNT];
|
||||
extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];
|
||||
extern u16 gPauseCounterBattle;
|
||||
extern u16 gPaydayMoney;
|
||||
@ -905,5 +917,6 @@ extern u8 gNumberOfMovesToChoose;
|
||||
extern u8 gBattleControllerData[MAX_BATTLERS_COUNT];
|
||||
extern bool8 gHasFetchedBall;
|
||||
extern u8 gLastUsedBall;
|
||||
extern u16 gLastThrownBall;
|
||||
|
||||
#endif // GUARD_BATTLE_H
|
||||
|
@ -442,6 +442,7 @@ extern const union AffineAnimCmd *const gAffineAnims_SpinningHandOrFoot[];
|
||||
extern const union AnimCmd *const gAnims_RevengeBigScratch[];
|
||||
|
||||
// battle_anim_rock.c
|
||||
extern const union AnimCmd *const gAnims_FlyingRock[];
|
||||
extern const union AffineAnimCmd *const gAffineAnims_Whirlpool[];
|
||||
extern const union AffineAnimCmd *const gAffineAnims_BasicRock[];
|
||||
void AnimParticleInVortex(struct Sprite *sprite);
|
||||
@ -449,6 +450,7 @@ void AnimFallingRock(struct Sprite *sprite);
|
||||
void AnimRaiseSprite(struct Sprite *sprite);
|
||||
void AnimFallingRock_Step(struct Sprite *sprite);
|
||||
void AnimFlyingSandCrescent(struct Sprite *sprite);
|
||||
void AnimRockFragment(struct Sprite *);
|
||||
|
||||
// battle_anim_dark.c
|
||||
void AnimClawSlash(struct Sprite *sprite);
|
||||
|
@ -41,6 +41,8 @@ enum
|
||||
|
||||
#define TAG_MEGA_TRIGGER_TILE 0xD777
|
||||
#define TAG_MEGA_INDICATOR_TILE 0xD778
|
||||
#define TAG_ALPHA_INDICATOR_TILE 0xD779
|
||||
#define TAG_OMEGA_INDICATOR_TILE 0xD77A
|
||||
|
||||
#define TAG_HEALTHBOX_PAL 0xD6FF
|
||||
#define TAG_HEALTHBAR_PAL 0xD704
|
||||
@ -49,6 +51,8 @@ enum
|
||||
|
||||
#define TAG_MEGA_TRIGGER_PAL 0xD777
|
||||
#define TAG_MEGA_INDICATOR_PAL 0xD778
|
||||
#define TAG_ALPHA_INDICATOR_PAL 0xD779
|
||||
#define TAG_OMEGA_INDICATOR_PAL 0xD77A
|
||||
|
||||
enum
|
||||
{
|
||||
@ -93,5 +97,9 @@ u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
|
||||
u8 GetHPBarLevel(s16 hp, s16 maxhp);
|
||||
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle);
|
||||
void DestroyAbilityPopUp(u8 battlerId);
|
||||
bool32 CanThrowLastUsedBall(void);
|
||||
void TryHideLastUsedBall(void);
|
||||
void TryRestoreLastUsedBall(void);
|
||||
void TryAddLastUsedBallItemSprites(void);
|
||||
|
||||
#endif // GUARD_BATTLE_INTERFACE_H
|
||||
|
@ -37,6 +37,7 @@ bool32 TryResetBattlerStatChanges(u8 battler);
|
||||
bool32 CanCamouflage(u8 battlerId);
|
||||
u16 GetNaturePowerMove(void);
|
||||
void StealTargetItem(u8 battlerStealer, u8 battlerItem);
|
||||
u8 GetCatchingBattler(void);
|
||||
|
||||
extern void (* const gBattleScriptingCommandsTable[])(void);
|
||||
extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];
|
||||
|
@ -298,6 +298,7 @@ extern const u8 BattleScript_ProteanActivates[];
|
||||
extern const u8 BattleScript_DazzlingProtected[];
|
||||
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
|
||||
extern const u8 BattleScript_MoveUsedPowder[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedBelch[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
|
||||
extern const u8 BattleScript_PsychicSurgeActivates[];
|
||||
@ -365,6 +366,7 @@ extern const u8 BattleScript_PerishBodyActivates[];
|
||||
extern const u8 BattleScript_ActivateAsOne[];
|
||||
extern const u8 BattleScript_RaiseStatOnFaintingTarget[];
|
||||
extern const u8 BattleScript_QuickClawActivation[];
|
||||
extern const u8 BattleScript_QuickDrawActivation[];
|
||||
extern const u8 BattleScript_CustapBerryActivation[];
|
||||
extern const u8 BattleScript_MicleBerryActivateEnd2[];
|
||||
extern const u8 BattleScript_MicleBerryActivateRet[];
|
||||
@ -389,5 +391,15 @@ extern const u8 BattleScript_DarkTypePreventsPrankster[];
|
||||
extern const u8 BattleScript_GulpMissileGorging[];
|
||||
extern const u8 BattleScript_GulpMissileGulping[];
|
||||
extern const u8 BattleScript_BattleBondActivatesOnMoveEndAttacker[];
|
||||
extern const u8 BattleScript_DesolateLandActivates[];
|
||||
extern const u8 BattleScript_DesolateLandEvaporatesWaterTypeMoves[];
|
||||
extern const u8 BattleScript_PrimordialSeaActivates[];
|
||||
extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[];
|
||||
extern const u8 BattleScript_DeltaStreamActivates[];
|
||||
extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[];
|
||||
extern const u8 BattleScript_AttackWeakenedByStrongWinds[];
|
||||
extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[];
|
||||
extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
|
||||
extern const u8 BattleScript_PrimalReversion[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define ITEMEFFECT_TARGET 0x5
|
||||
#define ITEMEFFECT_ORBS 0x6
|
||||
#define ITEMEFFECT_LIFEORB_SHELLBELL 0x7
|
||||
#define ITEMEFFECT_BATTLER_MOVE_END 0x8 // move end effects for just the battler, not whole field
|
||||
|
||||
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
|
||||
|
||||
@ -47,6 +48,7 @@ struct TypePower
|
||||
|
||||
extern const struct TypePower gNaturalGiftTable[];
|
||||
|
||||
void HandleAction_ThrowBall(void);
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move);
|
||||
void HandleAction_UseMove(void);
|
||||
void HandleAction_Switch(void);
|
||||
@ -107,7 +109,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
|
||||
void ClearFuryCutterDestinyBondGrudge(u8 battlerId);
|
||||
void HandleAction_RunBattleScript(void);
|
||||
u32 SetRandomTarget(u32 battlerId);
|
||||
u8 GetMoveTarget(u16 move, u8 setTarget);
|
||||
u32 GetMoveTarget(u16 move, u8 setTarget);
|
||||
u8 IsMonDisobedient(void);
|
||||
u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating);
|
||||
u32 GetBattlerHoldEffectParam(u8 battlerId);
|
||||
@ -152,7 +154,7 @@ bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||
bool32 TryRoomService(u8 battlerId);
|
||||
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
||||
void DoBurmyFormChange(u32 monId);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
||||
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
|
||||
|
||||
// ability checks
|
||||
|
@ -169,10 +169,12 @@
|
||||
#define STATUS3_HEAL_BLOCK (1 << 27)
|
||||
#define STATUS3_AQUA_RING (1 << 28)
|
||||
#define STATUS3_LASER_FOCUS (1 << 29)
|
||||
#define STATUS3_ELECTRIFIED (1 << 30)
|
||||
#define STATUS3_POWER_TRICK (1 << 31)
|
||||
#define STATUS3_POWER_TRICK (1 << 30)
|
||||
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE)
|
||||
|
||||
#define STATUS4_ELECTRIFIED (1 << 0)
|
||||
#define STATUS4_PLASMA_FISTS (1 << 1)
|
||||
|
||||
#define HITMARKER_x10 (1 << 4)
|
||||
#define HITMARKER_x20 (1 << 5)
|
||||
#define HITMARKER_DESTINYBOND (1 << 6)
|
||||
@ -257,17 +259,21 @@
|
||||
#define WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
|
||||
#define WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT)
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
|
||||
#define WEATHER_RAIN_PRIMAL (1 << 3)
|
||||
#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT | WEATHER_RAIN_PRIMAL)
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 4)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 5)
|
||||
#define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT)
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 5)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 6)
|
||||
#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT)
|
||||
#define WEATHER_HAIL_TEMPORARY (1 << 7)
|
||||
#define WEATHER_HAIL_PERMANENT (1 << 8)
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 6)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 7)
|
||||
#define WEATHER_SUN_PRIMAL (1 << 8)
|
||||
#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT | WEATHER_SUN_PRIMAL)
|
||||
#define WEATHER_HAIL_TEMPORARY (1 << 9)
|
||||
#define WEATHER_HAIL_PERMANENT (1 << 10)
|
||||
#define WEATHER_HAIL_ANY (WEATHER_HAIL_TEMPORARY | WEATHER_HAIL_PERMANENT)
|
||||
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
|
||||
#define WEATHER_STRONG_WINDS (1 << 11)
|
||||
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY | WEATHER_STRONG_WINDS)
|
||||
#define WEATHER_PRIMAL_ANY (WEATHER_RAIN_PRIMAL | WEATHER_SUN_PRIMAL | WEATHER_STRONG_WINDS)
|
||||
|
||||
// Battle Weather as enum
|
||||
#define ENUM_WEATHER_NONE 0
|
||||
@ -275,6 +281,9 @@
|
||||
#define ENUM_WEATHER_SUN 2
|
||||
#define ENUM_WEATHER_SANDSTORM 3
|
||||
#define ENUM_WEATHER_HAIL 4
|
||||
#define ENUM_WEATHER_SUN_PRIMAL 5
|
||||
#define ENUM_WEATHER_RAIN_PRIMAL 6
|
||||
#define ENUM_WEATHER_STRONG_WINDS 7
|
||||
|
||||
// Move Effects
|
||||
#define MOVE_EFFECT_SLEEP 0x1
|
||||
@ -379,5 +388,6 @@
|
||||
#define MOVE_TARGET_FOES_AND_ALLY 0x20
|
||||
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
|
||||
#define MOVE_TARGET_ALLY 0x80
|
||||
#define MOVE_TARGET_ALL_BATTLERS (0x100 | MOVE_TARGET_USER)
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_H
|
||||
|
@ -391,6 +391,9 @@
|
||||
#define ANIM_TAG_DREEPY (ANIM_SPRITES_START + 379)
|
||||
#define ANIM_TAG_ICE_ROCK_SINGLE (ANIM_SPRITES_START + 380)
|
||||
#define ANIM_TAG_STONE_PILLAR_MULTI (ANIM_SPRITES_START + 381)
|
||||
#define ANIM_TAG_ALPHA_SYMBOL (ANIM_SPRITES_START + 382)
|
||||
#define ANIM_TAG_OMEGA_SYMBOL (ANIM_SPRITES_START + 383)
|
||||
#define ANIM_TAG_PRIMAL_PARTICLES (ANIM_SPRITES_START + 384)
|
||||
|
||||
// battlers
|
||||
#define ANIM_ATTACKER 0
|
||||
@ -524,6 +527,8 @@
|
||||
#define B_ANIM_RESTORE_BG 27 // for Terrain Endings
|
||||
#define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare
|
||||
#define B_ANIM_GULP_MISSILE 29
|
||||
#define B_ANIM_STRONG_WINDS 30
|
||||
#define B_ANIM_PRIMAL_REVERSION 31
|
||||
|
||||
// special animations table (gBattleAnims_Special)
|
||||
#define B_ANIM_LVL_UP 0
|
||||
|
@ -88,19 +88,42 @@
|
||||
// Calculation settings
|
||||
#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage.
|
||||
#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2.
|
||||
#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%.
|
||||
#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%.
|
||||
#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%.
|
||||
#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
|
||||
|
||||
// Exp and stat settings
|
||||
#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching.
|
||||
#define B_TRAINER_EXP_MULTIPLIER GEN_7 // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain.
|
||||
#define B_SPLIT_EXP GEN_7 // In Gen6+, all participating mon get full experience.
|
||||
#define B_SCALED_EXP GEN_7 // In Gen5 and Gen7+, experience is weighted by level difference.
|
||||
#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
|
||||
#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%.
|
||||
#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%.
|
||||
#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
|
||||
#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%.
|
||||
#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
|
||||
#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing.
|
||||
#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect.
|
||||
#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats.
|
||||
#define B_MAX_LEVEL_EV_GAINS GEN_7 // In Gen5+, Lv100 Pokémon can obtain Effort Values normally.
|
||||
#define B_RECALCULATE_STATS GEN_7 // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle.
|
||||
|
||||
// Damage settings
|
||||
#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
|
||||
#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
|
||||
#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect.
|
||||
#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
|
||||
#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs.
|
||||
#define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs.
|
||||
|
||||
// Type settings
|
||||
#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle.
|
||||
#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed.
|
||||
#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves.
|
||||
#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves.
|
||||
#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon.
|
||||
|
||||
// Turn count settings
|
||||
#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.)
|
||||
#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns.
|
||||
#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack.
|
||||
#define B_TAILWIND_TURNS GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3.
|
||||
#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
|
||||
#define B_TAUNT_TURNS GEN_7 // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns.
|
||||
|
||||
// Move data settings
|
||||
#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.
|
||||
@ -108,39 +131,38 @@
|
||||
#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint.
|
||||
#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
|
||||
#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage.
|
||||
#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing.
|
||||
|
||||
// Move accuracy settings
|
||||
#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss.
|
||||
#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
|
||||
#define B_BLIZZARD_HAIL GEN_7 // In Gen4+, Blizzard bypasses accuracy checks if it's hailing.
|
||||
|
||||
// Other move settings
|
||||
#define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute.
|
||||
#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss.
|
||||
#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
|
||||
#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.)
|
||||
#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns.
|
||||
#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack.
|
||||
#define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems.
|
||||
#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
|
||||
#define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5.
|
||||
#define B_CAN_SPITE_FAIL GEN_7 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP.
|
||||
#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
|
||||
#define B_TAILWIND_TIMER GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3.
|
||||
#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6.
|
||||
#define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally.
|
||||
|
||||
// Ability settings
|
||||
#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
|
||||
#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger.
|
||||
#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.
|
||||
#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag.
|
||||
#define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation.
|
||||
#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore.
|
||||
#define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before.
|
||||
#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
|
||||
#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities.
|
||||
#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon.
|
||||
|
||||
// Item settings
|
||||
#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end.
|
||||
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
||||
#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable
|
||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||
|
||||
// Flag settings
|
||||
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
|
||||
@ -158,21 +180,21 @@
|
||||
#define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end.
|
||||
#define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move.
|
||||
#define B_SHOW_SPLIT_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category split.
|
||||
#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
|
||||
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
|
||||
|
||||
// Critical Capture
|
||||
#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled.
|
||||
#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm.
|
||||
|
||||
// Item Theft Settings
|
||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||
// Last Used Ball
|
||||
#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented
|
||||
#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball.
|
||||
|
||||
// Other
|
||||
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
|
||||
#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
|
||||
#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed.
|
||||
#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves.
|
||||
#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves.
|
||||
#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8.
|
||||
#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc)
|
||||
|
||||
// Animation Settings
|
||||
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.
|
||||
@ -191,8 +213,6 @@
|
||||
#define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette.
|
||||
#define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette.
|
||||
|
||||
#define B_HIDE_HEALTHBOXES_DURING_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
|
||||
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
|
||||
#define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H
|
||||
|
@ -364,7 +364,17 @@
|
||||
#define EFFECT_SNIPE_SHOT 358
|
||||
#define EFFECT_TRIPLE_HIT 359
|
||||
#define EFFECT_RECOIL_HP_25 360
|
||||
#define EFFECT_STUFF_CHEEKS 361
|
||||
#define EFFECT_GRAV_APPLE 362
|
||||
#define EFFECT_EVASION_UP_HIT 363
|
||||
#define EFFECT_DOUBLE_IRON_BASH 364
|
||||
#define EFFECT_GLITZY_GLOW 365
|
||||
#define EFFECT_BADDY_BAD 366
|
||||
#define EFFECT_SAPPY_SEED 367
|
||||
#define EFFECT_FREEZY_FROST 368
|
||||
#define EFFECT_SPARKLY_SWIRL 369
|
||||
#define EFFECT_PLASMA_FISTS 370
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 361
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 371
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
|
||||
#define sABILITY_OVERWRITE gBattleScripting + 0x34
|
||||
#define sSWITCH_CASE gBattleScripting + 0x36
|
||||
#define sBERRY_OVERRIDE gBattleScripting + 0x37
|
||||
|
||||
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
||||
#define cMISS_TYPE gBattleCommunication + 6
|
||||
@ -184,7 +185,15 @@
|
||||
#define VARIOUS_TRY_HEAL_QUARTER_HP 112
|
||||
#define VARIOUS_REMOVE_TERRAIN 113
|
||||
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
|
||||
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 115
|
||||
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
|
||||
#define VARIOUS_GET_ROTOTILLER_TARGETS 116
|
||||
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 117
|
||||
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 118
|
||||
#define VARIOUS_CONSUME_BERRY 119
|
||||
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 120
|
||||
#define VARIOUS_HANDLE_PRIMAL_REVERSION 121
|
||||
#define VARIOUS_APPLY_PLASMA_FISTS 122
|
||||
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 123
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -523,7 +523,7 @@
|
||||
#define STRINGID_GRASSYTERRAINHEALS 519
|
||||
#define STRINGID_ELECTRICTERRAINPREVENTS 520
|
||||
#define STRINGID_PSYCHICTERRAINPREVENTS 521
|
||||
#define STRINGID_SAFETYGOOGLESPROTECTED 522
|
||||
#define STRINGID_SAFETYGOGGLESPROTECTED 522
|
||||
#define STRINGID_FLOWERVEILPROTECTED 523
|
||||
#define STRINGID_SWEETVEILPROTECTED 524
|
||||
#define STRINGID_AROMAVEILPROTECTED 525
|
||||
@ -580,8 +580,22 @@
|
||||
#define STRINGID_HEALBLOCKEDNOMORE 576
|
||||
#define STRINGID_ATTACKERBECAMEFULLYCHARGED 577
|
||||
#define STRINGID_ATTACKERBECAMEASHSPECIES 578
|
||||
#define STRINGID_EXTREMELYHARSHSUNLIGHT 579
|
||||
#define STRINGID_EXTREMESUNLIGHTFADED 580
|
||||
#define STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT 581
|
||||
#define STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED 582
|
||||
#define STRINGID_HEAVYRAIN 583
|
||||
#define STRINGID_HEAVYRAINLIFTED 584
|
||||
#define STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN 585
|
||||
#define STRINGID_NORELIEFROMHEAVYRAIN 586
|
||||
#define STRINGID_MYSTERIOUSAIRCURRENT 587
|
||||
#define STRINGID_STRONGWINDSDISSIPATED 588
|
||||
#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 589
|
||||
#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 590
|
||||
#define STRINGID_STUFFCHEEKSCANTSELECT 592
|
||||
#define STRINGID_PKMNREVERTEDTOPRIMAL 593
|
||||
|
||||
#define BATTLESTRINGS_COUNT 579
|
||||
#define BATTLESTRINGS_COUNT 594
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -130,7 +130,7 @@
|
||||
// Gen6 hold effects
|
||||
#define HOLD_EFFECT_FAIRY_POWER 139
|
||||
#define HOLD_EFFECT_MEGA_STONE 140
|
||||
#define HOLD_EFFECT_SAFETY_GOOGLES 141
|
||||
#define HOLD_EFFECT_SAFETY_GOGGLES 141
|
||||
#define HOLD_EFFECT_LUMINOUS_MOSS 142
|
||||
#define HOLD_EFFECT_SNOWBALL 143
|
||||
#define HOLD_EFFECT_WEAKNESS_POLICY 144
|
||||
|
@ -338,6 +338,7 @@
|
||||
// Evolution types
|
||||
#define EVO_MEGA_EVOLUTION 0xffff // Not an actual evolution, used to temporarily mega evolve in battle.
|
||||
#define EVO_MOVE_MEGA_EVOLUTION 0xfffe // Mega Evolution that checks for a move instead of held item.
|
||||
#define EVO_PRIMAL_REVERSION 0xfffd // Not an actual evolution, used to undergo primal reversion in battle.
|
||||
#define EVO_FRIENDSHIP 1 // Pokémon levels up with friendship ≥ 220
|
||||
#define EVO_FRIENDSHIP_DAY 2 // Pokémon levels up during the day with friendship ≥ 220
|
||||
#define EVO_FRIENDSHIP_NIGHT 3 // Pokémon levels up at night with friendship ≥ 220
|
||||
@ -353,8 +354,25 @@
|
||||
#define EVO_LEVEL_NINJASK 13 // Pokémon reaches the specified level (special value for Ninjask)
|
||||
#define EVO_LEVEL_SHEDINJA 14 // Pokémon reaches the specified level (special value for Shedinja)
|
||||
#define EVO_BEAUTY 15 // Pokémon levels up with beauty ≥ specified value
|
||||
#define EVO_LEVEL_FEMALE 16 // Pokémon reaches the specified level, is female
|
||||
#define EVO_LEVEL_MALE 17 // Pokémon reaches the specified level, is male
|
||||
#define EVO_LEVEL_NIGHT 18 // Pokémon reaches the specified level, is night
|
||||
#define EVO_LEVEL_DAY 19 // Pokémon reaches the specified level, is day
|
||||
#define EVO_LEVEL_DUSK 20 // Pokémon reaches the specified level, is dusk (5-6 P.M)
|
||||
#define EVO_ITEM_HOLD_DAY 21 // Pokémon levels up, holds specified item at day
|
||||
#define EVO_ITEM_HOLD_NIGHT 22 // Pokémon levels up, holds specified item at night
|
||||
#define EVO_MOVE 23 // Pokémon levels up, knows specified move
|
||||
#define EVO_MOVE_TYPE 24 // Pokémon levels up, knows move with specified type
|
||||
#define EVO_MAPSEC 25 // Pokémon levels up on specified mapsec
|
||||
#define EVO_ITEM_MALE 26 // specified item is used on a male Pokémon
|
||||
#define EVO_ITEM_FEMALE 27 // specified item is used on a female Pokémon
|
||||
#define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level while it's raining
|
||||
#define EVO_SPECIFIC_MON_IN_PARTY 29 // Pokémon levels up with a specified Pokémon in party
|
||||
#define EVO_LEVEL_DARK_TYPE_MON_IN_PARTY 30 // Pokémon reaches the specified level with a Dark Type Pokémon in party
|
||||
#define EVO_TRADE_SPECIFIC_MON 31 // Pokémon is traded for a specified Pokémon
|
||||
#define EVO_SPECIFIC_MAP 32 // Pokémon levels up on specified map
|
||||
|
||||
#define EVOS_PER_MON 5
|
||||
#define EVOS_PER_MON 10
|
||||
|
||||
// Evolution 'modes,' for GetEvolutionTargetSpecies
|
||||
#define EVO_MODE_NORMAL 0
|
||||
|
@ -4697,6 +4697,7 @@ extern const u32 gBattleAnimSpritePal_MagnifyingGlass[];
|
||||
extern const u32 gBattleAnimSpritePal_BrownOrb[];
|
||||
extern const u32 gBattleAnimSpritePal_MetalSoundWaves[];
|
||||
extern const u32 gBattleAnimSpritePal_FlyingDirt[];
|
||||
extern const u32 gBattleAnimSpritePal_Windstorm[];
|
||||
extern const u32 gBattleAnimSpritePal_IcicleSpear[];
|
||||
extern const u32 gBattleAnimSpritePal_Hail[];
|
||||
extern const u32 gBattleAnimSpritePal_GlowyRedOrb[];
|
||||
@ -4748,6 +4749,8 @@ extern const u32 gBattleAnimSpriteGfx_MegaStone[];
|
||||
extern const u32 gBattleAnimSpritePal_MegaStone[];
|
||||
extern const u32 gBattleAnimSpriteGfx_MegaParticles[];
|
||||
extern const u32 gBattleAnimSpritePal_MegaParticles[];
|
||||
extern const u32 gBattleAnimSpriteGfx_PrimalParticles[];
|
||||
extern const u32 gBattleAnimSpritePal_PrimalParticles[];
|
||||
extern const u32 gBattleAnimSpriteGfx_MegaSymbol[];
|
||||
extern const u32 gBattleAnimSpritePal_MegaSymbol[];
|
||||
extern const u32 gBattleAnimSpriteGfx_FlashCannonBall[];
|
||||
@ -4764,6 +4767,8 @@ extern const u32 gBattleAnimSpriteGfx_AcupressureFinger[];
|
||||
extern const u32 gBattleAnimSpritePal_AcupressureFinger[];
|
||||
extern const u32 gBattleAnimSpriteGfx_AlphaStone[];
|
||||
extern const u32 gBattleAnimSpritePal_AlphaStone[];
|
||||
extern const u32 gBattleAnimSpriteGfx_AlphaSymbol[];
|
||||
extern const u32 gBattleAnimSpritePal_AlphaSymbol[];
|
||||
extern const u32 gBattleAnimSpriteGfx_Anchor[];
|
||||
extern const u32 gBattleAnimSpriteGfx_Apple[];
|
||||
extern const u32 gBattleAnimSpritePal_Apple[];
|
||||
@ -4866,6 +4871,8 @@ extern const u32 gBattleAnimSpriteGfx_Obstruct[];
|
||||
extern const u32 gBattleAnimSpritePal_Obstruct[];
|
||||
extern const u32 gBattleAnimSpriteGfx_OmegaStone[];
|
||||
extern const u32 gBattleAnimSpritePal_OmegaStone[];
|
||||
extern const u32 gBattleAnimSpriteGfx_OmegaSymbol[];
|
||||
extern const u32 gBattleAnimSpritePal_OmegaSymbol[];
|
||||
extern const u32 gBattleAnimSpriteGfx_PinkDiamond[];
|
||||
extern const u32 gBattleAnimSpritePal_PinkDiamond[];
|
||||
extern const u32 gBattleAnimSpriteGfx_PoisonColumn[];
|
||||
@ -5199,6 +5206,9 @@ extern const u16 gSlotMachineReelTimePikachu_Pal[];
|
||||
extern const u32 gBattleAnimBgTilemap_Sandstorm[];
|
||||
extern const u32 gBattleAnimBgImage_Sandstorm[];
|
||||
|
||||
extern const u32 gBattleAnimBgTilemap_Windstorm[];
|
||||
extern const u32 gBattleAnimBgImage_Windstorm[];
|
||||
|
||||
// Pokedex Area Screen
|
||||
extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[];
|
||||
extern const u16 gPokedexAreaScreenAreaUnknown_Pal[];
|
||||
|
@ -33,5 +33,6 @@ void ItemUseInBattle_EnigmaBerry(u8);
|
||||
void Task_UseDigEscapeRopeOnField(u8 taskId);
|
||||
u8 CanUseDigOrEscapeRopeOnCurMap(void);
|
||||
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
|
||||
u32 CanThrowBall(void);
|
||||
|
||||
#endif // GUARD_ITEM_USE_H
|
||||
|
@ -216,7 +216,7 @@ struct BattleMove
|
||||
u8 accuracy;
|
||||
u8 pp;
|
||||
u8 secondaryEffectChance;
|
||||
u8 target;
|
||||
u16 target;
|
||||
s8 priority;
|
||||
u32 flags;
|
||||
u8 split;
|
||||
|
@ -177,10 +177,10 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
|
||||
}
|
||||
|
||||
sBattler_AI = gActiveBattler;
|
||||
// Simulate dmg for all AI moves against all opposing targets
|
||||
// Simulate dmg for all AI moves against all other targets
|
||||
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
|
||||
{
|
||||
if (GET_BATTLER_SIDE2(sBattler_AI) == GET_BATTLER_SIDE2(gBattlerTarget))
|
||||
if (sBattler_AI == gBattlerTarget)
|
||||
continue;
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
@ -210,6 +210,10 @@ u8 BattleAI_ChooseMoveOrAction(void)
|
||||
else
|
||||
ret = ChooseMoveOrAction_Doubles();
|
||||
|
||||
// Clear protect structures, some flags may be set during AI calcs
|
||||
// e.g. pranksterElevated from GetMovePriority
|
||||
memset(&gProtectStructs[gActiveBattler], 0, sizeof(struct ProtectStruct));
|
||||
|
||||
gCurrentMove = savedCurrentMove;
|
||||
return ret;
|
||||
}
|
||||
@ -262,8 +266,10 @@ static u8 ChooseMoveOrAction_Singles(void)
|
||||
AI_THINKING_STRUCT->movesetIndex = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++) {
|
||||
gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i];
|
||||
gBattleStruct->aiSimulatedDamage[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->simulatedDmg[sBattler_AI][gBattlerTarget][i];
|
||||
}
|
||||
|
||||
// Check special AI actions.
|
||||
if (AI_THINKING_STRUCT->aiAction & AI_ACTION_FLEE)
|
||||
@ -428,8 +434,10 @@ static u8 ChooseMoveOrAction_Doubles(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
for (j = 0; j < MAX_MON_MOVES; j++) {
|
||||
gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j];
|
||||
gBattleStruct->aiSimulatedDamage[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->simulatedDmg[sBattler_AI][gBattlerTarget][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,8 +520,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
// move data
|
||||
u8 atkPriority = GetMovePriority(battlerAtk, move);
|
||||
u16 moveEffect = gBattleMoves[move].effect;
|
||||
u8 moveType = gBattleMoves[move].type;
|
||||
u8 moveTarget = gBattleMoves[move].target;
|
||||
s32 moveType;
|
||||
u16 moveTarget = gBattleMoves[move].target;
|
||||
u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move);
|
||||
u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef);
|
||||
bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk);
|
||||
@ -526,6 +534,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
if (IsTargetingPartner(battlerAtk, battlerDef))
|
||||
return score;
|
||||
|
||||
GET_MOVE_TYPE(move, moveType);
|
||||
|
||||
// check non-user target
|
||||
if (!(gBattleMoves[move].target & MOVE_TARGET_USER))
|
||||
{
|
||||
@ -751,7 +761,34 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
if (gStatuses3[battlerAtk] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(battlerAtk, move))
|
||||
return 0; // Can't even select heal blocked move
|
||||
// primal weather check
|
||||
//TODO
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
{
|
||||
if (gBattleWeather & WEATHER_PRIMAL_ANY)
|
||||
{
|
||||
switch (move)
|
||||
{
|
||||
case MOVE_SUNNY_DAY:
|
||||
case MOVE_RAIN_DANCE:
|
||||
case MOVE_HAIL:
|
||||
case MOVE_SANDSTORM:
|
||||
RETURN_SCORE_MINUS(30);
|
||||
}
|
||||
}
|
||||
|
||||
if (!IS_MOVE_STATUS(move))
|
||||
{
|
||||
if (gBattleWeather & WEATHER_SUN_PRIMAL)
|
||||
{
|
||||
if (moveType == TYPE_WATER)
|
||||
RETURN_SCORE_MINUS(30);
|
||||
}
|
||||
else if (gBattleWeather & WEATHER_RAIN_PRIMAL)
|
||||
{
|
||||
if (moveType == TYPE_FIRE)
|
||||
RETURN_SCORE_MINUS(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check move effects
|
||||
switch (moveEffect)
|
||||
@ -795,21 +832,17 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_DEFENSE_UP_2:
|
||||
if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES)
|
||||
score -= 10;
|
||||
case EFFECT_STUFF_CHEEKS:
|
||||
if (ItemId_GetPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES)
|
||||
return 0; // cannot even select
|
||||
//fallthrough
|
||||
case EFFECT_DEFENSE_UP:
|
||||
case EFFECT_DEFENSE_UP_2:
|
||||
case EFFECT_DEFENSE_UP_3:
|
||||
case EFFECT_DEFENSE_CURL:
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_DEF))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_SPEED_UP:
|
||||
case EFFECT_SPEED_UP_2:
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPEED))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_SPECIAL_ATTACK_UP:
|
||||
case EFFECT_SPECIAL_ATTACK_UP_2:
|
||||
case EFFECT_SPECIAL_ATTACK_UP_3:
|
||||
@ -2437,13 +2470,32 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
switch (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef))
|
||||
{
|
||||
case AI_EFFECTIVENESS_x4:
|
||||
if (WEATHER_HAS_EFFECT
|
||||
&& gBattleWeather & WEATHER_STRONG_WINDS
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING))
|
||||
{
|
||||
if (AI_RandLessThan(176)) //Consider it supereffective instead of hypereffective.
|
||||
score += 2;
|
||||
else
|
||||
score++;
|
||||
}
|
||||
else
|
||||
score += 4;
|
||||
break;
|
||||
case AI_EFFECTIVENESS_x2:
|
||||
if (WEATHER_HAS_EFFECT
|
||||
&& gBattleWeather & WEATHER_STRONG_WINDS
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING))
|
||||
{
|
||||
break; // Don't increase score, consider it neutral.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AI_RandLessThan(176))
|
||||
score += 2;
|
||||
else
|
||||
score++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2466,7 +2518,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
// move data
|
||||
u8 moveType = gBattleMoves[move].type;
|
||||
u16 effect = gBattleMoves[move].effect;
|
||||
u8 target = gBattleMoves[move].target;
|
||||
u16 target = gBattleMoves[move].target;
|
||||
// ally data
|
||||
u8 battlerAtkPartner = AI_DATA->battlerAtkPartner;
|
||||
u16 atkPartnerAbility = AI_DATA->atkPartnerAbility;
|
||||
@ -3283,7 +3335,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
case EFFECT_TRAP:
|
||||
case EFFECT_MEAN_LOOK:
|
||||
if (HasMoveEffect(battlerDef, EFFECT_RAPID_SPIN)
|
||||
|| IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)
|
||||
|| (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST))
|
||||
|| gBattleMons[battlerDef].status2 & STATUS2_WRAPPED)
|
||||
{
|
||||
break; // in this case its a bad attacking move
|
||||
@ -3315,6 +3367,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
case EFFECT_PARALYZE:
|
||||
IncreaseParalyzeScore(battlerAtk, battlerDef, move, &score);
|
||||
break;
|
||||
case EFFECT_GRAV_APPLE:
|
||||
if (gFieldStatuses & STATUS_FIELD_GRAVITY)
|
||||
score += 2;
|
||||
// fall through
|
||||
case EFFECT_ATTACK_DOWN_HIT:
|
||||
case EFFECT_DEFENSE_DOWN_HIT:
|
||||
case EFFECT_SPECIAL_ATTACK_DOWN_HIT:
|
||||
|
@ -643,7 +643,7 @@ bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect)
|
||||
{
|
||||
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -1448,7 +1448,7 @@ bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect)
|
||||
|| ability == ABILITY_SAND_FORCE
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| ability == ABILITY_MAGIC_GUARD
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_ROCK)
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_STEEL)
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_GROUND)
|
||||
@ -1473,7 +1473,7 @@ bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect)
|
||||
|| ability == ABILITY_SLUSH_RUSH
|
||||
|| ability == ABILITY_MAGIC_GUARD
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
||||
|| HasMove(battler, MOVE_BLIZZARD)
|
||||
|| HasMoveEffect(battler, EFFECT_AURORA_VEIL)
|
||||
@ -2273,7 +2273,7 @@ static u32 GetWeatherDamage(u8 battlerId)
|
||||
{
|
||||
if (BattlerAffectedBySandstorm(battlerId, ability)
|
||||
&& !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
if (damage == 0)
|
||||
@ -2284,7 +2284,7 @@ static u32 GetWeatherDamage(u8 battlerId)
|
||||
{
|
||||
if (BattlerAffectedByHail(battlerId, ability)
|
||||
&& !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
if (damage == 0)
|
||||
|
@ -1564,6 +1564,9 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
|
||||
{gBattleAnimSpriteGfx_DreepyMissile, 0x200, ANIM_TAG_DREEPY},
|
||||
{gBattleAnimSpriteGfx_IceRock, 0x1800, ANIM_TAG_ICE_ROCK_SINGLE},
|
||||
{gBattleAnimSpriteGfx_StonePillar, 0x1800, ANIM_TAG_STONE_PILLAR_MULTI},
|
||||
{gBattleAnimSpriteGfx_AlphaSymbol, 0x0200, ANIM_TAG_ALPHA_SYMBOL},
|
||||
{gBattleAnimSpriteGfx_OmegaSymbol, 0x0200, ANIM_TAG_OMEGA_SYMBOL},
|
||||
{gBattleAnimSpriteGfx_PrimalParticles, 0x0180, ANIM_TAG_PRIMAL_PARTICLES},
|
||||
};
|
||||
|
||||
const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
|
||||
@ -2011,6 +2014,9 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
|
||||
{gBattleAnimSpritePal_DreepyMissile, ANIM_TAG_DREEPY},
|
||||
{gBattleAnimSpritePal_IceRock, ANIM_TAG_ICE_ROCK_SINGLE},
|
||||
{gBattleAnimSpritePal_StonePillar, ANIM_TAG_STONE_PILLAR_MULTI},
|
||||
{gBattleAnimSpritePal_AlphaSymbol, ANIM_TAG_ALPHA_SYMBOL},
|
||||
{gBattleAnimSpritePal_OmegaSymbol, ANIM_TAG_OMEGA_SYMBOL},
|
||||
{gBattleAnimSpritePal_PrimalParticles, ANIM_TAG_PRIMAL_PARTICLES},
|
||||
};
|
||||
|
||||
const struct BattleAnimBackground gBattleAnimBackgroundTable[] =
|
||||
|
@ -1219,6 +1219,61 @@ const struct SpriteTemplate gMegaSymbolSpriteTemplate =
|
||||
.callback = AnimGhostStatusSprite,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gAlphaStoneSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_ALPHA_STONE,
|
||||
.paletteTag = ANIM_TAG_ALPHA_STONE,
|
||||
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gAffineAnims_LusterPurgeCircle,
|
||||
.callback = AnimSpriteOnMonPos,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gOmegaStoneSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_OMEGA_STONE,
|
||||
.paletteTag = ANIM_TAG_OMEGA_STONE,
|
||||
.oam = &gOamData_AffineDouble_ObjBlend_64x64,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gAffineAnims_LusterPurgeCircle,
|
||||
.callback = AnimSpriteOnMonPos,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gPrimalParticlesSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_PRIMAL_PARTICLES,
|
||||
.paletteTag = ANIM_TAG_PRIMAL_PARTICLES,
|
||||
.oam = &gOamData_AffineNormal_ObjBlend_16x16,
|
||||
.anims = gPowerAbsorptionOrbAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gPowerAbsorptionOrbAffineAnimTable,
|
||||
.callback = AnimPowerAbsorptionOrb,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gAlphaSymbolSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_ALPHA_SYMBOL,
|
||||
.paletteTag = ANIM_TAG_ALPHA_SYMBOL,
|
||||
.oam = &gOamData_AffineOff_ObjBlend_32x32,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = AnimGhostStatusSprite,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gOmegaSymbolSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_OMEGA_SYMBOL,
|
||||
.paletteTag = ANIM_TAG_OMEGA_SYMBOL,
|
||||
.oam = &gOamData_AffineOff_ObjBlend_32x32,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = AnimGhostStatusSprite,
|
||||
};
|
||||
|
||||
void AnimBlackSmoke(struct Sprite *sprite)
|
||||
{
|
||||
sprite->x += gBattleAnimArgs[0];
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "constants/battle_anim.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "random.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "graphics.h"
|
||||
|
||||
extern const struct SpriteTemplate gFlashingHitSplatSpriteTemplate;
|
||||
|
||||
@ -30,7 +32,7 @@ static void AnimUnusedFlashingLight_Step(struct Sprite *);
|
||||
static void AnimSkyAttackBird(struct Sprite *);
|
||||
static void AnimSkyAttackBird_Step(struct Sprite *);
|
||||
static void AnimTask_AnimateGustTornadoPalette_Step(u8);
|
||||
|
||||
static void AnimTask_LoadWindstormBackground_Step(u8 taskId);
|
||||
|
||||
const struct SpriteTemplate gEllipticalGustSpriteTemplate =
|
||||
{
|
||||
@ -1231,3 +1233,99 @@ static void AnimTask_SetAttackerVisibility(u8 taskId)
|
||||
}
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
|
||||
void AnimTask_LoadWindstormBackground(u8 taskId)
|
||||
{
|
||||
int var0;
|
||||
struct BattleAnimBgData animBg;
|
||||
|
||||
var0 = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
|
||||
|
||||
if (!IsContest())
|
||||
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
||||
|
||||
gBattle_BG1_X = 0;
|
||||
gBattle_BG1_Y = 0;
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
||||
|
||||
GetBattleAnimBg1Data(&animBg);
|
||||
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Windstorm, animBg.tilesOffset);
|
||||
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Windstorm, 0);
|
||||
LoadCompressedPalette(gBattleAnimSpritePal_Windstorm, animBg.paletteId * 16, 32);
|
||||
|
||||
if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
var0 = 1;
|
||||
|
||||
gTasks[taskId].data[0] = var0;
|
||||
gTasks[taskId].func = AnimTask_LoadWindstormBackground_Step;
|
||||
}
|
||||
|
||||
static void AnimTask_LoadWindstormBackground_Step(u8 taskId)
|
||||
{
|
||||
struct BattleAnimBgData animBg;
|
||||
|
||||
if (gTasks[taskId].data[0] == 0)
|
||||
gBattle_BG1_X += -6;
|
||||
else
|
||||
gBattle_BG1_X += 6;
|
||||
|
||||
gBattle_BG1_Y += -1;
|
||||
|
||||
switch (gTasks[taskId].data[12])
|
||||
{
|
||||
case 0:
|
||||
if (++gTasks[taskId].data[10] == 4)
|
||||
{
|
||||
gTasks[taskId].data[10] = 0;
|
||||
gTasks[taskId].data[11]++;
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
|
||||
if (gTasks[taskId].data[11] == 7)
|
||||
{
|
||||
gTasks[taskId].data[12]++;
|
||||
gTasks[taskId].data[11] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (++gTasks[taskId].data[11] == 101)
|
||||
{
|
||||
gTasks[taskId].data[11] = 7;
|
||||
gTasks[taskId].data[12]++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (++gTasks[taskId].data[10] == 4)
|
||||
{
|
||||
gTasks[taskId].data[10] = 0;
|
||||
gTasks[taskId].data[11]--;
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
|
||||
if (gTasks[taskId].data[11] == 0)
|
||||
{
|
||||
gTasks[taskId].data[12]++;
|
||||
gTasks[taskId].data[11] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
GetBattleAnimBg1Data(&animBg);
|
||||
ClearBattleAnimBg(animBg.bgId);
|
||||
gTasks[taskId].data[12]++;
|
||||
break;
|
||||
case 4:
|
||||
if (!IsContest())
|
||||
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
|
||||
|
||||
gBattle_BG1_X = 0;
|
||||
gBattle_BG1_Y = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||
DestroyAnimVisualTask(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "battle_controllers.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
//// function declarations
|
||||
static void SpriteCB_SpriteToCentreOfSide(struct Sprite* sprite);
|
||||
@ -93,6 +94,40 @@ const struct SpriteTemplate gPowerTrickSpriteTemplate =
|
||||
|
||||
|
||||
//// GEN 5
|
||||
//shell smash
|
||||
const struct SpriteTemplate gShellSmashLeftShellSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_SHELL_RIGHT,
|
||||
.paletteTag = ANIM_TAG_SHELL_RIGHT,
|
||||
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gAffineAnims_Bite,
|
||||
.callback = AnimBite
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gShellSmashRightShellSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_SHELL_LEFT,
|
||||
.paletteTag = ANIM_TAG_SHELL_LEFT,
|
||||
.oam = &gOamData_AffineNormal_ObjBlend_64x64,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gAffineAnims_Bite,
|
||||
.callback = AnimBite
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gShellSmashPurpleRocksSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_ROCKS,
|
||||
.paletteTag = ANIM_TAG_SHELL_RIGHT,
|
||||
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
||||
.anims = gAnims_FlyingRock,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = AnimRockFragment
|
||||
};
|
||||
|
||||
//wide guard
|
||||
const struct SpriteTemplate gWideGuardBlueConversionTemplate =
|
||||
{
|
||||
@ -5020,3 +5055,12 @@ void AnimTask_TechnoBlast(u8 taskId)
|
||||
gBattleAnimArgs[0] = 0;
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
|
||||
void AnimTask_PrimalReversion(u8 taskId)
|
||||
{
|
||||
if (ItemId_GetId(gBattleMons[gBattleAnimAttacker].item) == ITEM_RED_ORB)
|
||||
gBattleAnimArgs[0] = ItemId_GetId(gBattleMons[gBattleAnimAttacker].item);
|
||||
else
|
||||
gBattleAnimArgs[0] = 0;
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
static void AnimRockFragment(struct Sprite *);
|
||||
static void AnimTask_Rollout_Step(u8 taskId);
|
||||
static void AnimRolloutParticle(struct Sprite *);
|
||||
static void AnimRockTomb(struct Sprite *);
|
||||
@ -43,7 +42,7 @@ static const union AnimCmd sAnim_FlyingRock_2[] =
|
||||
ANIMCMD_END,
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sAnims_FlyingRock[] =
|
||||
const union AnimCmd *const gAnims_FlyingRock[] =
|
||||
{
|
||||
sAnim_FlyingRock_0,
|
||||
sAnim_FlyingRock_1,
|
||||
@ -55,7 +54,7 @@ const struct SpriteTemplate gFallingRockSpriteTemplate =
|
||||
.tileTag = ANIM_TAG_ROCKS,
|
||||
.paletteTag = ANIM_TAG_ROCKS,
|
||||
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
||||
.anims = sAnims_FlyingRock,
|
||||
.anims = gAnims_FlyingRock,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = AnimFallingRock,
|
||||
@ -66,7 +65,7 @@ const struct SpriteTemplate gRockFragmentSpriteTemplate =
|
||||
.tileTag = ANIM_TAG_ROCKS,
|
||||
.paletteTag = ANIM_TAG_ROCKS,
|
||||
.oam = &gOamData_AffineOff_ObjNormal_32x32,
|
||||
.anims = sAnims_FlyingRock,
|
||||
.anims = gAnims_FlyingRock,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = AnimRockFragment,
|
||||
@ -430,7 +429,7 @@ void AnimFallingRock_Step(struct Sprite *sprite)
|
||||
}
|
||||
|
||||
// Animates the rock particles that are shown on the impact for Rock Blast / Rock Smash
|
||||
static void AnimRockFragment(struct Sprite *sprite)
|
||||
void AnimRockFragment(struct Sprite *sprite)
|
||||
{
|
||||
StartSpriteAnim(sprite, gBattleAnimArgs[5]);
|
||||
AnimateSprite(sprite);
|
||||
|
@ -249,6 +249,7 @@ static void HandleInputChooseAction(void)
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
TryHideLastUsedBall();
|
||||
|
||||
switch (gActionSelectionCursor[gActiveBattler])
|
||||
{
|
||||
@ -336,6 +337,15 @@ static void HandleInputChooseAction(void)
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_DEBUG, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
TryHideLastUsedBall();
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_THROW_BALL, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void UnusedEndBounceEffect(void)
|
||||
@ -372,6 +382,7 @@ static void HandleInputChooseTarget(void)
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||
TryHideLastUsedBall();
|
||||
HideMegaTriggerSprite();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
@ -485,6 +496,19 @@ static void HandleInputChooseTarget(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void HideAllTargets(void)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (IsBattlerAlive(i) && gBattleSpritesDataPtr->healthBoxesData[i].healthboxIsBouncing)
|
||||
{
|
||||
gSprites[gBattlerSpriteIds[i]].callback = SpriteCb_HideAsMoveTarget;
|
||||
EndBounceEffect(i, BOUNCE_HEALTHBOX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HideShownTargets(void)
|
||||
{
|
||||
s32 i;
|
||||
@ -498,6 +522,34 @@ static void HideShownTargets(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleInputShowEntireFieldTargets(void)
|
||||
{
|
||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||
gPlayerDpadHoldFrames++;
|
||||
else
|
||||
gPlayerDpadHoldFrames = 0;
|
||||
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
HideAllTargets();
|
||||
if (gBattleStruct->mega.playerSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
HideAllTargets();
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
|
||||
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
|
||||
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleInputShowTargets(void)
|
||||
{
|
||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||
@ -514,6 +566,7 @@ static void HandleInputShowTargets(void)
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
TryHideLastUsedBall();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||
@ -537,7 +590,7 @@ static void TryShowAsTarget(u32 battlerId)
|
||||
|
||||
static void HandleInputChooseMove(void)
|
||||
{
|
||||
u8 moveTarget;
|
||||
u16 moveTarget;
|
||||
u32 canSelectTarget = 0;
|
||||
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleResources->bufferA[gActiveBattler][4]);
|
||||
|
||||
@ -589,7 +642,17 @@ static void HandleInputChooseMove(void)
|
||||
}
|
||||
|
||||
// Show all available targets for multi-target moves
|
||||
if (B_SHOW_TARGETS && moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
|
||||
if (B_SHOW_TARGETS)
|
||||
{
|
||||
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
|
||||
{
|
||||
u32 i = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
TryShowAsTarget(i);
|
||||
|
||||
canSelectTarget = 3;
|
||||
}
|
||||
else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
|
||||
{
|
||||
TryShowAsTarget(gMultiUsePlayerCursor);
|
||||
TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor));
|
||||
@ -598,18 +661,21 @@ static void HandleInputChooseMove(void)
|
||||
canSelectTarget = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (canSelectTarget == 0)
|
||||
switch (canSelectTarget)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
if (gBattleStruct->mega.playerSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
TryHideLastUsedBall();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (canSelectTarget == 1)
|
||||
{
|
||||
break;
|
||||
case 1:
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
|
||||
|
||||
if (moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
|
||||
@ -620,10 +686,13 @@ static void HandleInputChooseMove(void)
|
||||
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
|
||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
case 2:
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputShowTargets;
|
||||
break;
|
||||
case 3: // Entire field
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputShowEntireFieldTargets;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
||||
@ -2696,6 +2765,7 @@ static void PlayerHandleChooseAction(void)
|
||||
for (i = 0; i < 4; i++)
|
||||
ActionSelectionDestroyCursorAt(i);
|
||||
|
||||
TryRestoreLastUsedBall();
|
||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);
|
||||
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
|
||||
|
@ -97,6 +97,7 @@ enum
|
||||
LIST_ITEM_STATUS1,
|
||||
LIST_ITEM_STATUS2,
|
||||
LIST_ITEM_STATUS3,
|
||||
LIST_ITEM_STATUS4,
|
||||
LIST_ITEM_SIDE_STATUS,
|
||||
LIST_ITEM_AI,
|
||||
LIST_ITEM_AI_MOVES_PTS,
|
||||
@ -164,6 +165,7 @@ static const u8 sText_StatStages[] = _("Stat Stages");
|
||||
static const u8 sText_Status1[] = _("Status1");
|
||||
static const u8 sText_Status2[] = _("Status2");
|
||||
static const u8 sText_Status3[] = _("Status3");
|
||||
static const u8 sText_Status4[] = _("Status4");
|
||||
static const u8 sText_HeldItem[] = _("Held Item");
|
||||
static const u8 sText_SideStatus[] = _("Side Status");
|
||||
static const u8 sText_MaxHp[] = _("HP Max");
|
||||
@ -207,6 +209,8 @@ static const u8 sText_GastroAcid[] = _("Gastro Acid");
|
||||
static const u8 sText_SmackDown[] = _("Smacked Down");
|
||||
static const u8 sText_MiracleEye[] = _("Miracle Eye");
|
||||
static const u8 sText_AquaRing[] = _("Aqua Ring");
|
||||
static const u8 sText_LaserFocus[] = _("Laser Focused");
|
||||
static const u8 sText_Electrified[] = _("Electrified");
|
||||
static const u8 sText_AuroraVeil[] = _("Aurora Veil");
|
||||
static const u8 sText_LuckyChant[] = _("Lucky Chant");
|
||||
static const u8 sText_Tailwind[] = _("Tailwind");
|
||||
@ -228,7 +232,7 @@ static const u8 sText_InDoubles[] = _("In Doubles");
|
||||
static const u8 sText_HpAware[] = _("HP aware");
|
||||
static const u8 sText_Unknown[] = _("Unknown");
|
||||
static const u8 sText_InLove[] = _("In Love");
|
||||
static const u8 sText_AIMovePts[] = _("AI Move Pts");
|
||||
static const u8 sText_AIMovePts[] = _("AI Pts/Dmg");
|
||||
static const u8 sText_AiKnowledge[] = _("AI Info");
|
||||
static const u8 sText_EffectOverride[] = _("Effect Override");
|
||||
|
||||
@ -295,6 +299,13 @@ static const struct BitfieldInfo sStatus3Bitfield[] =
|
||||
// Magnet Rise 1, 26,
|
||||
// Heal Block 1, 27,
|
||||
{/*Aqua Ring*/ 1, 28},
|
||||
{/*Laser Focus*/ 1, 29},
|
||||
// Power Trick 1, 30,
|
||||
};
|
||||
|
||||
static const struct BitfieldInfo sStatus4Bitfield[] =
|
||||
{
|
||||
{/*Electrified*/ 1, 0,}
|
||||
};
|
||||
|
||||
static const struct BitfieldInfo sAIBitfield[] =
|
||||
@ -324,6 +335,7 @@ static const struct ListMenuItem sMainListItems[] =
|
||||
{sText_Status1, LIST_ITEM_STATUS1},
|
||||
{sText_Status2, LIST_ITEM_STATUS2},
|
||||
{sText_Status3, LIST_ITEM_STATUS3},
|
||||
{sText_Status4, LIST_ITEM_STATUS4},
|
||||
{sText_SideStatus, LIST_ITEM_SIDE_STATUS},
|
||||
{sText_AI, LIST_ITEM_AI},
|
||||
{sText_AIMovePts, LIST_ITEM_AI_MOVES_PTS},
|
||||
@ -408,6 +420,12 @@ static const struct ListMenuItem sStatus3ListItems[] =
|
||||
{sText_SmackDown, 8},
|
||||
{sText_MiracleEye, 9},
|
||||
{sText_AquaRing, 10},
|
||||
{sText_LaserFocus, 11},
|
||||
};
|
||||
|
||||
static const struct ListMenuItem sStatus4ListItems[] =
|
||||
{
|
||||
{sText_Electrified, 0},
|
||||
};
|
||||
|
||||
static const struct ListMenuItem sSideStatusListItems[] =
|
||||
@ -713,6 +731,12 @@ static void PutMovesPointsText(struct BattleDebugMenu *data)
|
||||
gBattleStruct->aiFinalScore[data->aiBattlerId][gSprites[data->aiIconSpriteIds[j]].data[0]][i],
|
||||
STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 83 + count * 54, i * 15, 0, NULL);
|
||||
|
||||
ConvertIntToDecimalStringN(text,
|
||||
gBattleStruct->aiSimulatedDamage[data->aiBattlerId][gSprites[data->aiIconSpriteIds[j]].data[0]][i],
|
||||
STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 110 + count * 54, i * 15, 0, NULL);
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -780,7 +804,7 @@ static void Task_ShowAiPoints(u8 taskId)
|
||||
break;
|
||||
// Put text
|
||||
case 1:
|
||||
winTemplate = CreateWindowTemplate(1, 0, 4, 27, 14, 15, 0x200);
|
||||
winTemplate = CreateWindowTemplate(1, 0, 4, 30, 14, 15, 0x200);
|
||||
data->aiMovesWindowId = AddWindow(&winTemplate);
|
||||
PutWindowTilemap(data->aiMovesWindowId);
|
||||
PutMovesPointsText(data);
|
||||
@ -1176,6 +1200,11 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data)
|
||||
itemsCount = ARRAY_COUNT(sStatus3ListItems);
|
||||
data->bitfield = sStatus3Bitfield;
|
||||
break;
|
||||
case LIST_ITEM_STATUS4:
|
||||
listTemplate.items = sStatus4ListItems;
|
||||
itemsCount = ARRAY_COUNT(sStatus4ListItems);
|
||||
data->bitfield = sStatus4Bitfield;
|
||||
break;
|
||||
case LIST_ITEM_AI:
|
||||
listTemplate.items = sAIListItems;
|
||||
itemsCount = ARRAY_COUNT(sAIListItems);
|
||||
@ -1734,6 +1763,11 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data)
|
||||
data->modifyArrows.currValue = GetBitfieldValue(gStatuses3[data->battlerId], data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount);
|
||||
data->modifyArrows.typeOfVal = VAL_BITFIELD_32;
|
||||
goto CASE_ITEM_STATUS;
|
||||
case LIST_ITEM_STATUS4:
|
||||
data->modifyArrows.modifiedValPtr = &gStatuses4[data->battlerId];
|
||||
data->modifyArrows.currValue = GetBitfieldValue(gStatuses4[data->battlerId], data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount);
|
||||
data->modifyArrows.typeOfVal = VAL_BITFIELD_32;
|
||||
goto CASE_ITEM_STATUS;
|
||||
case LIST_ITEM_AI:
|
||||
data->modifyArrows.modifiedValPtr = &gBattleResources->ai->aiFlags;
|
||||
data->modifyArrows.currValue = GetBitfieldValue(gBattleResources->ai->aiFlags, data->bitfield[data->currentSecondaryListItemId].currBit, data->bitfield[data->currentSecondaryListItemId].bitsCount);
|
||||
@ -1951,7 +1985,7 @@ static const u8 sText_HoldEffectAbsorbBulb[] = _("Absorb Bulb");
|
||||
static const u8 sText_HoldEffectCellBattery[] = _("Cell Battery");
|
||||
static const u8 sText_HoldEffectFairyPower[] = _("Fairy Power");
|
||||
static const u8 sText_HoldEffectMegaStone[] = _("Mega Stone");
|
||||
static const u8 sText_HoldEffectSafetyGoogles[] = _("Safety Googles");
|
||||
static const u8 sText_HoldEffectSafetyGoggles[] = _("Safety Goggles");
|
||||
static const u8 sText_HoldEffectLuminousMoss[] = _("Luminous Moss");
|
||||
static const u8 sText_HoldEffectSnowball[] = _("Snowball");
|
||||
static const u8 sText_HoldEffectWeaknessPolicy[] = _("Weakness Policy");
|
||||
@ -2091,7 +2125,7 @@ static const u8 *const sHoldEffectNames[] =
|
||||
[HOLD_EFFECT_CELL_BATTERY] = sText_HoldEffectCellBattery,
|
||||
[HOLD_EFFECT_FAIRY_POWER] = sText_HoldEffectFairyPower,
|
||||
[HOLD_EFFECT_MEGA_STONE] = sText_HoldEffectMegaStone,
|
||||
[HOLD_EFFECT_SAFETY_GOOGLES] = sText_HoldEffectSafetyGoogles,
|
||||
[HOLD_EFFECT_SAFETY_GOGGLES] = sText_HoldEffectSafetyGoggles,
|
||||
[HOLD_EFFECT_LUMINOUS_MOSS] = sText_HoldEffectLuminousMoss,
|
||||
[HOLD_EFFECT_SNOWBALL] = sText_HoldEffectSnowball,
|
||||
[HOLD_EFFECT_WEAKNESS_POLICY] = sText_HoldEffectWeaknessPolicy,
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "constants/battle_config.h"
|
||||
#include "data.h"
|
||||
#include "pokemon_summary_screen.h"
|
||||
#include "item_icon.h"
|
||||
#include "item_use.h"
|
||||
#include "item.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
enum
|
||||
{ // Corresponds to gHealthboxElementsGfxTable (and the tables after it) in graphics.c
|
||||
@ -196,6 +200,9 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32
|
||||
static void SpriteCb_AbilityPopUp(struct Sprite *sprite);
|
||||
static void Task_FreeAbilityPopUpGfx(u8 taskId);
|
||||
|
||||
static void SpriteCB_LastUsedBall(struct Sprite *sprite);
|
||||
static void SpriteCB_LastUsedBallWin(struct Sprite *sprite);
|
||||
|
||||
// const rom data
|
||||
static const struct OamData sUnknown_0832C138 =
|
||||
{
|
||||
@ -665,6 +672,28 @@ static const struct SpritePalette sSpritePalette_MegaIndicator =
|
||||
sMegaIndicatorPal, TAG_MEGA_INDICATOR_PAL
|
||||
};
|
||||
|
||||
static const u8 sAlphaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/alpha_indicator.4bpp");
|
||||
static const u16 sAlphaIndicatorPal[] = INCBIN_U16("graphics/battle_interface/alpha_indicator.gbapal");
|
||||
static const u8 sOmegaIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/omega_indicator.4bpp");
|
||||
static const u16 sOmegaIndicatorPal[] = INCBIN_U16("graphics/battle_interface/omega_indicator.gbapal");
|
||||
|
||||
static const struct SpriteSheet sSpriteSheet_AlphaIndicator =
|
||||
{
|
||||
sAlphaIndicatorGfx, sizeof(sAlphaIndicatorGfx), TAG_ALPHA_INDICATOR_TILE
|
||||
};
|
||||
static const struct SpritePalette sSpritePalette_AlphaIndicator =
|
||||
{
|
||||
sAlphaIndicatorPal, TAG_ALPHA_INDICATOR_PAL
|
||||
};
|
||||
static const struct SpriteSheet sSpriteSheet_OmegaIndicator =
|
||||
{
|
||||
sOmegaIndicatorGfx, sizeof(sOmegaIndicatorGfx), TAG_OMEGA_INDICATOR_TILE
|
||||
};
|
||||
static const struct SpritePalette sSpritePalette_OmegaIndicator =
|
||||
{
|
||||
sOmegaIndicatorPal, TAG_OMEGA_INDICATOR_PAL
|
||||
};
|
||||
|
||||
static const struct OamData sOamData_MegaIndicator =
|
||||
{
|
||||
.y = 0,
|
||||
@ -693,6 +722,28 @@ static const struct SpriteTemplate sSpriteTemplate_MegaIndicator =
|
||||
.callback = SpriteCb_MegaIndicator,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_AlphaIndicator =
|
||||
{
|
||||
.tileTag = TAG_ALPHA_INDICATOR_TILE,
|
||||
.paletteTag = TAG_ALPHA_INDICATOR_PAL,
|
||||
.oam = &sOamData_MegaIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_MegaIndicator,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_OmegaIndicator =
|
||||
{
|
||||
.tileTag = TAG_OMEGA_INDICATOR_TILE,
|
||||
.paletteTag = TAG_OMEGA_INDICATOR_PAL,
|
||||
.oam = &sOamData_MegaIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_MegaIndicator,
|
||||
};
|
||||
|
||||
|
||||
// code
|
||||
|
||||
@ -723,6 +774,12 @@ u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId)
|
||||
return gSprites[spriteId].hOther_IndicatorSpriteId;
|
||||
}
|
||||
|
||||
static void InitLastUsedBallAssets(void)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
{
|
||||
s16 data6 = 0;
|
||||
@ -805,13 +862,17 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
healthBarSpritePtr->hBar_Data6 = data6;
|
||||
healthBarSpritePtr->invisible = TRUE;
|
||||
|
||||
// Create mega indicator sprite if is a mega evolved mon.
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
// Create mega indicator sprite if is a mega evolved or a primal reverted mon.
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]]
|
||||
|| gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
megaIndicatorSpriteId = CreateMegaIndicatorSprite(battlerId, 0);
|
||||
gSprites[megaIndicatorSpriteId].invisible = TRUE;
|
||||
}
|
||||
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
|
||||
return healthboxLeftSpriteId;
|
||||
}
|
||||
|
||||
@ -910,7 +971,8 @@ void SetHealthboxSpriteVisible(u8 healthboxSpriteId)
|
||||
gSprites[healthboxSpriteId].invisible = FALSE;
|
||||
gSprites[gSprites[healthboxSpriteId].hMain_HealthBarSpriteId].invisible = FALSE;
|
||||
gSprites[gSprites[healthboxSpriteId].oam.affineParam].invisible = FALSE;
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]]
|
||||
|| gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
u8 spriteId = GetMegaIndicatorSpriteId(healthboxSpriteId);
|
||||
if (spriteId != 0xFF)
|
||||
@ -978,7 +1040,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes)
|
||||
if (indicatorSpriteId != 0xFF)
|
||||
gSprites[indicatorSpriteId].oam.priority = priority;
|
||||
|
||||
#if B_HIDE_HEALTHBOXES_DURING_ANIMS
|
||||
#if B_HIDE_HEALTHBOX_IN_ANIMS
|
||||
if (hideHPBoxes && IsBattlerAlive(i))
|
||||
TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId);
|
||||
#endif
|
||||
@ -1033,8 +1095,9 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
|
||||
u8 *objVram;
|
||||
u8 battler = gSprites[healthboxSpriteId].hMain_Battler;
|
||||
|
||||
// Don't print Lv char if mon is mega evolved.
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])
|
||||
// Don't print Lv char if mon is mega evolved or primal reverted.
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]]
|
||||
|| gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])
|
||||
{
|
||||
objVram = ConvertIntToDecimalStringN(text, lvl, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
xPos = 5 * (3 - (objVram - (text + 2))) - 1;
|
||||
@ -1506,8 +1569,24 @@ u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which)
|
||||
u32 spriteId, position;
|
||||
s16 x, y;
|
||||
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
LoadSpritePalette(&sSpritePalette_MegaIndicator);
|
||||
LoadSpriteSheet(&sSpriteSheet_MegaIndicator);
|
||||
}
|
||||
else if (gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
if (GET_BASE_SPECIES_ID(gBattleMons[battlerId].species) == SPECIES_GROUDON)
|
||||
{
|
||||
LoadSpritePalette(&sSpritePalette_OmegaIndicator);
|
||||
LoadSpriteSheet(&sSpriteSheet_OmegaIndicator);
|
||||
}
|
||||
else if (GET_BASE_SPECIES_ID(gBattleMons[battlerId].species) == SPECIES_KYOGRE)
|
||||
{
|
||||
LoadSpritePalette(&sSpritePalette_AlphaIndicator);
|
||||
LoadSpriteSheet(&sSpriteSheet_AlphaIndicator);
|
||||
}
|
||||
}
|
||||
|
||||
position = GetBattlerPosition(battlerId);
|
||||
GetBattlerHealthboxCoords(battlerId, &x, &y);
|
||||
@ -1520,9 +1599,19 @@ u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which)
|
||||
else if (gBattleMons[battlerId].level < 10)
|
||||
x += 5;
|
||||
|
||||
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_MegaIndicator, x, y, 0);
|
||||
gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId;
|
||||
}
|
||||
else if (gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]])
|
||||
{
|
||||
if (GET_BASE_SPECIES_ID(gBattleMons[battlerId].species) == SPECIES_GROUDON)
|
||||
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_OmegaIndicator, x, y, 0);
|
||||
else if (GET_BASE_SPECIES_ID(gBattleMons[battlerId].species) == SPECIES_KYOGRE)
|
||||
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_AlphaIndicator, x, y, 0);
|
||||
}
|
||||
|
||||
gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId;
|
||||
gSprites[spriteId].tBattler = battlerId;
|
||||
return spriteId;
|
||||
}
|
||||
@ -3123,3 +3212,200 @@ static void Task_FreeAbilityPopUpGfx(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
// last used ball
|
||||
#define LAST_BALL_WINDOW_TAG 0xD721
|
||||
|
||||
static const struct OamData sOamData_LastUsedBall =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = SPRITE_SHAPE(32x32),
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = SPRITE_SIZE(32x32),
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow =
|
||||
{
|
||||
.tileTag = LAST_BALL_WINDOW_TAG,
|
||||
.paletteTag = ABILITY_POP_UP_TAG,
|
||||
.oam = &sOamData_LastUsedBall,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCB_LastUsedBallWin
|
||||
};
|
||||
|
||||
#if B_LAST_USED_BALL_BUTTON == R_BUTTON
|
||||
static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp");
|
||||
#else
|
||||
static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp");
|
||||
#endif
|
||||
static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
|
||||
{
|
||||
sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG
|
||||
};
|
||||
|
||||
#define LAST_USED_BALL_X_F 15
|
||||
#define LAST_USED_BALL_X_0 -15
|
||||
#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68)
|
||||
|
||||
#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1)
|
||||
#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0)
|
||||
#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8)
|
||||
|
||||
#define sHide data[0]
|
||||
|
||||
bool32 CanThrowLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == FALSE
|
||||
return FALSE;
|
||||
#else
|
||||
return (!(CanThrowBall() != 0
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
|| !CheckBagHasItem(gLastThrownBall, 1)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TryAddLastUsedBallItemSprites(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gLastThrownBall == 0
|
||||
|| (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)))
|
||||
{
|
||||
// we're out of the last used ball, so just set it to the first ball in the bag
|
||||
// we have to compact the bag first bc it is typically only compacted when you open it
|
||||
CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]);
|
||||
gLastThrownBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId;
|
||||
}
|
||||
|
||||
if (CanThrowBall() != 0
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
|| !CheckBagHasItem(gLastThrownBall, 1))
|
||||
return;
|
||||
|
||||
// ball
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gLastThrownBall);
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0;
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y;
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall;
|
||||
}
|
||||
|
||||
// window
|
||||
LoadSpritePalette(&sSpritePalette_AbilityPopUp);
|
||||
if (GetSpriteTileStartByTag(LAST_BALL_WINDOW_TAG) == 0xFFFF)
|
||||
LoadSpriteSheet(&sSpriteSheet_LastUsedBallWindow);
|
||||
|
||||
if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow,
|
||||
LAST_BALL_WIN_X_0,
|
||||
LAST_USED_WIN_Y, 5);
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallWinGfx(struct Sprite *sprite)
|
||||
{
|
||||
FreeSpriteTilesByTag(LAST_BALL_WINDOW_TAG);
|
||||
FreeSpritePaletteByTag(ABILITY_POP_UP_TAG);
|
||||
DestroySprite(sprite);
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallGfx(struct Sprite *sprite)
|
||||
{
|
||||
FreeSpriteTilesByTag(102);
|
||||
FreeSpritePaletteByTag(102);
|
||||
DestroySprite(sprite);
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBallWin(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->sHide)
|
||||
{
|
||||
if (sprite->x != LAST_BALL_WIN_X_0)
|
||||
sprite->x--;
|
||||
|
||||
if (sprite->x == LAST_BALL_WIN_X_0)
|
||||
DestroyLastUsedBallWinGfx(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->x != LAST_BALL_WIN_X_F)
|
||||
sprite->x++;
|
||||
}
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBall(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->sHide)
|
||||
{
|
||||
if (sprite->x != LAST_USED_BALL_X_0)
|
||||
sprite->x--;
|
||||
|
||||
if (sprite->x == LAST_USED_BALL_X_0)
|
||||
DestroyLastUsedBallGfx(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->x != LAST_USED_BALL_X_F)
|
||||
sprite->x++;
|
||||
}
|
||||
}
|
||||
|
||||
static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
return;
|
||||
|
||||
switch (caseId)
|
||||
{
|
||||
case 0: // hide
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = TRUE; // hide
|
||||
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = TRUE; // hide
|
||||
break;
|
||||
case 1: // restore
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryHideLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
TryHideOrRestoreLastUsedBall(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryRestoreLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
TryHideOrRestoreLastUsedBall(1);
|
||||
else
|
||||
TryAddLastUsedBallItemSprites();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,7 @@ EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read
|
||||
EWRAM_DATA u32 gSideStatuses[2] = {0};
|
||||
EWRAM_DATA struct SideTimer gSideTimers[2] = {0};
|
||||
EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA u32 gStatuses4[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA u16 gPauseCounterBattle = 0;
|
||||
EWRAM_DATA u16 gPaydayMoney = 0;
|
||||
@ -230,6 +231,7 @@ EWRAM_DATA u16 gPartnerSpriteId = 0;
|
||||
EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
|
||||
EWRAM_DATA u8 gLastUsedBall = 0;
|
||||
EWRAM_DATA u16 gLastThrownBall = 0;
|
||||
|
||||
// IWRAM common vars
|
||||
void (*gPreBattleCallback1)(void);
|
||||
@ -401,6 +403,7 @@ static void (* const sTurnActionsFuncsTable[])(void) =
|
||||
[B_ACTION_TRY_FINISH] = HandleAction_TryFinish,
|
||||
[B_ACTION_FINISHED] = HandleAction_ActionFinished,
|
||||
[B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted,
|
||||
[B_ACTION_THROW_BALL] = HandleAction_ThrowBall,
|
||||
};
|
||||
|
||||
static void (* const sEndTurnFuncsTable[])(void) =
|
||||
@ -2847,6 +2850,7 @@ static void BattleStartClearSetData(void)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
gStatuses3[i] = 0;
|
||||
gStatuses4[i] = 0;
|
||||
gDisableStructs[i].isFirstTurn = 2;
|
||||
gLastMoves[i] = 0;
|
||||
gLastLandedMoves[i] = 0;
|
||||
@ -2958,7 +2962,9 @@ void SwitchInClearSetData(void)
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
|
||||
{
|
||||
gBattleMons[gActiveBattler].status2 &= (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_ESCAPE_PREVENTION | STATUS2_CURSED);
|
||||
gStatuses3[gActiveBattler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED);
|
||||
gStatuses3[gActiveBattler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED
|
||||
| STATUS3_GASTRO_ACID | STATUS3_EMBARGO | STATUS3_TELEKINESIS | STATUS3_MAGNET_RISE | STATUS3_HEAL_BLOCK
|
||||
| STATUS3_AQUA_RING | STATUS3_POWER_TRICK);
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@ -2979,6 +2985,8 @@ void SwitchInClearSetData(void)
|
||||
gStatuses3[gActiveBattler] = 0;
|
||||
}
|
||||
|
||||
gStatuses4[gActiveBattler] = 0;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler))
|
||||
@ -3051,6 +3059,7 @@ void FaintClearSetData(void)
|
||||
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
gStatuses3[gActiveBattler] = 0;
|
||||
gStatuses4[gActiveBattler] = 0;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@ -3095,6 +3104,7 @@ void FaintClearSetData(void)
|
||||
gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0;
|
||||
gProtectStructs[gActiveBattler].statRaised = 0;
|
||||
gProtectStructs[gActiveBattler].statFell = 0;
|
||||
gProtectStructs[gActiveBattler].pranksterElevated = 0;
|
||||
|
||||
gDisableStructs[gActiveBattler].isFirstTurn = 2;
|
||||
|
||||
@ -3512,6 +3522,18 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
}
|
||||
memset(gTotemBoosts, 0, sizeof(gTotemBoosts)); // erase all totem boosts just to be safe
|
||||
|
||||
// Primal Reversion
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (CanMegaEvolve(i)
|
||||
&& GetBattlerHoldEffect(i, TRUE) == HOLD_EFFECT_PRIMAL_ORB)
|
||||
{
|
||||
gBattlerAttacker = i;
|
||||
BattleScriptExecute(BattleScript_PrimalReversion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check all switch in abilities happening from the fastest mon to slowest.
|
||||
while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount)
|
||||
{
|
||||
@ -3683,6 +3705,10 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||
return 0;
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
if (IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_GHOST))
|
||||
return 0;
|
||||
#endif
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
return 0;
|
||||
if (GetBattlerAbility(gActiveBattler) == ABILITY_RUN_AWAY)
|
||||
@ -4073,6 +4099,10 @@ static void HandleTurnActionSelectionState(void)
|
||||
case B_ACTION_SAFARI_BALL:
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
case B_ACTION_THROW_BALL:
|
||||
gBattleStruct->throwingPokeBall = TRUE;
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
case B_ACTION_SAFARI_POKEBLOCK:
|
||||
if ((gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)) != 0)
|
||||
{
|
||||
@ -4186,6 +4216,13 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (gBattleCommunication[ACTIONS_CONFIRMED_COUNT] == gBattlersCount)
|
||||
{
|
||||
sub_818603C(1);
|
||||
|
||||
if (WILD_DOUBLE_BATTLE && gBattleStruct->throwingPokeBall) {
|
||||
// if we choose to throw a ball with our second mon, skip the action of the first
|
||||
// (if we have chosen throw ball with first, second's is already skipped)
|
||||
gChosenActionByBattler[B_POSITION_PLAYER_LEFT] = B_ACTION_NOTHING_FAINTED;
|
||||
}
|
||||
|
||||
gBattleMainFunc = SetActionsAndBattlersTurnOrder;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
@ -4366,20 +4403,32 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|
||||
u32 holdEffectBattler1 = 0, holdEffectBattler2 = 0;
|
||||
s8 priority1 = 0, priority2 = 0;
|
||||
|
||||
// Battler 1
|
||||
speedBattler1 = GetBattlerTotalSpeedStat(battler1);
|
||||
holdEffectBattler1 = GetBattlerHoldEffect(battler1, TRUE);
|
||||
if ((holdEffectBattler1 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler1)) / 100)
|
||||
// Quick Draw
|
||||
if (!ignoreChosenMoves && GetBattlerAbility(battler1) == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler1]) && Random() % 100 < 30)
|
||||
gProtectStructs[battler1].quickDraw = TRUE;
|
||||
// Quick Claw and Custap Berry
|
||||
if (!gProtectStructs[battler1].quickDraw
|
||||
&& ((holdEffectBattler1 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler1)) / 100)
|
||||
|| (!IsAbilityOnOpposingSide(battler1, ABILITY_UNNERVE)
|
||||
&& holdEffectBattler1 == HOLD_EFFECT_CUSTAP_BERRY
|
||||
&& HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item)))
|
||||
&& HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item))))
|
||||
gProtectStructs[battler1].custap = TRUE;
|
||||
|
||||
// Battler 2
|
||||
speedBattler2 = GetBattlerTotalSpeedStat(battler2);
|
||||
holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE);
|
||||
if ((holdEffectBattler2 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler2)) / 100)
|
||||
// Quick Draw
|
||||
if (!ignoreChosenMoves && GetBattlerAbility(battler2) == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler2]) && Random() % 100 < 30)
|
||||
gProtectStructs[battler2].quickDraw = TRUE;
|
||||
// Quick Claw and Custap Berry
|
||||
if (!gProtectStructs[battler2].quickDraw
|
||||
&& ((holdEffectBattler2 == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler2)) / 100)
|
||||
|| (!IsAbilityOnOpposingSide(battler2, ABILITY_UNNERVE)
|
||||
&& holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY
|
||||
&& HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item)))
|
||||
&& HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item))))
|
||||
gProtectStructs[battler2].custap = TRUE;
|
||||
|
||||
if (!ignoreChosenMoves)
|
||||
@ -4396,7 +4445,11 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|
||||
// LAGGING TAIL - always last
|
||||
// STALL - always last
|
||||
|
||||
if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap)
|
||||
if (gProtectStructs[battler1].quickDraw && !gProtectStructs[battler2].quickDraw)
|
||||
strikesFirst = 0;
|
||||
else if (!gProtectStructs[battler1].quickDraw && gProtectStructs[battler2].quickDraw)
|
||||
strikesFirst = 1;
|
||||
else if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap)
|
||||
strikesFirst = 0;
|
||||
else if (gProtectStructs[battler2].custap && !gProtectStructs[battler1].custap)
|
||||
strikesFirst = 1;
|
||||
@ -4507,7 +4560,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
{
|
||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||
{
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH)
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM
|
||||
|| gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH
|
||||
|| gChosenActionByBattler[gActiveBattler] == B_ACTION_THROW_BALL)
|
||||
{
|
||||
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler];
|
||||
gBattlerByTurnOrder[turnOrderId] = gActiveBattler;
|
||||
@ -4516,7 +4571,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
}
|
||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||
{
|
||||
if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH)
|
||||
if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM
|
||||
&& gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH
|
||||
&& gChosenActionByBattler[gActiveBattler] != B_ACTION_THROW_BALL)
|
||||
{
|
||||
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler];
|
||||
gBattlerByTurnOrder[turnOrderId] = gActiveBattler;
|
||||
@ -4532,7 +4589,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
if (gActionsByTurnOrder[i] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[i] != B_ACTION_SWITCH
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH)
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH
|
||||
&& gActionsByTurnOrder[i] != B_ACTION_THROW_BALL
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_THROW_BALL)
|
||||
{
|
||||
if (GetWhoStrikesFirst(battler1, battler2, FALSE))
|
||||
SwapTurnOrder(i, j);
|
||||
@ -4651,13 +4710,16 @@ static void CheckQuickClaw_CustapBerryActivation(void)
|
||||
gBattleStruct->quickClawBattlerId++;
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE
|
||||
&& gChosenMoveByBattler[gActiveBattler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here
|
||||
&& gProtectStructs[gActiveBattler].custap
|
||||
&& (gProtectStructs[gActiveBattler].custap || gProtectStructs[gActiveBattler].quickDraw)
|
||||
&& !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||
&& !(gDisableStructs[gBattlerAttacker].truantCounter)
|
||||
&& !(gProtectStructs[gActiveBattler].noValidMoves))
|
||||
{
|
||||
if (gProtectStructs[gActiveBattler].custap)
|
||||
{
|
||||
gProtectStructs[gActiveBattler].custap = FALSE;
|
||||
gLastUsedItem = gBattleMons[gActiveBattler].item;
|
||||
PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem);
|
||||
if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY)
|
||||
{
|
||||
// don't record berry since its gone now
|
||||
@ -4668,6 +4730,15 @@ static void CheckQuickClaw_CustapBerryActivation(void)
|
||||
RecordItemEffectBattle(gActiveBattler, GetBattlerHoldEffect(gActiveBattler, FALSE));
|
||||
BattleScriptExecute(BattleScript_QuickClawActivation);
|
||||
}
|
||||
}
|
||||
else if (gProtectStructs[gActiveBattler].quickDraw)
|
||||
{
|
||||
gProtectStructs[gActiveBattler].quickDraw = FALSE;
|
||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
|
||||
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
|
||||
BattleScriptExecute(BattleScript_QuickDrawActivation);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4911,6 +4982,17 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
UndoFormChange(i, B_SIDE_PLAYER, FALSE);
|
||||
DoBurmyFormChange(i);
|
||||
}
|
||||
#if B_RECALCULATE_STATS >= GEN_5
|
||||
// Recalculate the stats of every party member before the end
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
||||
{
|
||||
CalculateMonStats(&gPlayerParty[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
|
||||
gCB2_AfterEvolution = BattleMainCB2;
|
||||
}
|
||||
@ -5100,7 +5182,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
|
||||
attackerAbility = GetBattlerAbility(battlerAtk);
|
||||
GET_MOVE_TYPE(move, moveType);
|
||||
if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL)
|
||||
|| gStatuses3[battlerAtk] & STATUS3_ELECTRIFIED)
|
||||
|| gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED)
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC;
|
||||
}
|
||||
@ -5132,6 +5214,10 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = 0x80 | TYPE_WATER;
|
||||
}
|
||||
else if (gStatuses4[battlerAtk] & STATUS4_PLASMA_FISTS && moveType == TYPE_NORMAL)
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC;
|
||||
}
|
||||
|
||||
// Check if a gem should activate.
|
||||
GET_MOVE_TYPE(move, moveType);
|
||||
|
@ -653,7 +653,7 @@ static const u8 sText_MistyTerrainPreventsStatus[] = _("{B_DEF_NAME_WITH_PREFIX}
|
||||
static const u8 sText_GrassyTerrainHeals[] = _("{B_ATK_NAME_WITH_PREFIX} is healed\nby the grassy terrain!");
|
||||
static const u8 sText_ElectricTerrainPreventsSleep[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith electrified terrain!");
|
||||
static const u8 sText_PsychicTerrainPreventsPriority[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith psychic terrain!");
|
||||
static const u8 sText_SafetyGooglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!");
|
||||
static const u8 sText_SafetyGogglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!");
|
||||
static const u8 sText_FlowerVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of petals!");
|
||||
static const u8 sText_SweetVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of sweetness!");
|
||||
static const u8 sText_AromaVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby an aromatic veil!");
|
||||
@ -692,7 +692,7 @@ static const u8 sText_PkmnsWillPerishIn3Turns[] = _("Both Pokémon will perish\n
|
||||
static const u8 sText_AbilityRaisedStatDrastically[] = _("{B_DEF_ABILITY} raised {B_DEF_NAME_WITH_PREFIX}'s\n{B_BUFF1} drastically!");
|
||||
static const u8 sText_AsOneEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} has two Abilities!");
|
||||
static const u8 sText_CuriousMedicineEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s\nstat changes were reset!");
|
||||
static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_LAST_ITEM}!");
|
||||
static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_BUFF1}!");
|
||||
static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!");
|
||||
static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!");
|
||||
static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!");
|
||||
@ -706,9 +706,37 @@ static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormen
|
||||
static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!");
|
||||
static const u8 sText_AttackerBecameFullyCharged[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its bond with its trainer!\p");
|
||||
static const u8 sText_AttackerBecameAshSpecies[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_BUFF1}!\p");
|
||||
static const u8 sText_ExtremelyHarshSunlight[] = _("The sunlight turned\nextremely harsh!");
|
||||
static const u8 sText_ExtremeSunlightFaded[] = _("The extreme sunlight faded.{PAUSE 64}");
|
||||
static const u8 sText_MoveEvaporatedInTheHarshSunlight[] = _("The Water-type attack evaporated\nin the harsh sunlight!");
|
||||
static const u8 sText_ExtremelyHarshSunlightWasNotLessened[] = _("The extremely harsh sunlight\nwas not lessened at all!");
|
||||
static const u8 sText_HeavyRain[] = _("A heavy rain began to fall!");
|
||||
static const u8 sText_HeavyRainLifted[] = _("The heavy rain has lifted!{PAUSE 64}");
|
||||
static const u8 sText_MoveFizzledOutInTheHeavyRain[] = _("The Fire-type attack fizzled out\nin the heavy rain!");
|
||||
static const u8 sText_NoReliefFromHeavyRain[] = _("There is no relief from\nthis heavy rain!");
|
||||
static const u8 sText_MysteriousAirCurrent[] = _("A mysterious air current is\nprotecting Flying-type Pokémon!");
|
||||
static const u8 sText_StrongWindsDissipated[] = _("The mysterious strong winds\nhave dissipated!{PAUSE 64}");
|
||||
static const u8 sText_MysteriousAirCurrentBlowsOn[] = _("The mysterious air current\nblows on regardless!");
|
||||
static const u8 sText_AttackWeakenedByStrongWinds[] = _("The mysterious strong winds\nweakened the attack!");
|
||||
static const u8 sText_StuffCheeksCantSelect[] = _("Stuff Cheeks cannot be\nselected without a Berry!\p");
|
||||
static const u8 sText_PkmnRevertedToPrimal[] = _("{B_ATK_NAME_WITH_PREFIX}'s Primal Reversion!\nIt reverted to its primal form!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_PKMNREVERTEDTOPRIMAL - 12] = sText_PkmnRevertedToPrimal,
|
||||
[STRINGID_STUFFCHEEKSCANTSELECT - 12] = sText_StuffCheeksCantSelect,
|
||||
[STRINGID_ATTACKWEAKENEDBSTRONGWINDS - 12] = sText_AttackWeakenedByStrongWinds,
|
||||
[STRINGID_MYSTERIOUSAIRCURRENTBLOWSON - 12] = sText_MysteriousAirCurrentBlowsOn,
|
||||
[STRINGID_STRONGWINDSDISSIPATED - 12] = sText_StrongWindsDissipated,
|
||||
[STRINGID_MYSTERIOUSAIRCURRENT - 12] = sText_MysteriousAirCurrent,
|
||||
[STRINGID_NORELIEFROMHEAVYRAIN - 12] = sText_NoReliefFromHeavyRain,
|
||||
[STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN - 12] = sText_MoveFizzledOutInTheHeavyRain,
|
||||
[STRINGID_HEAVYRAINLIFTED - 12] = sText_HeavyRainLifted,
|
||||
[STRINGID_HEAVYRAIN - 12] = sText_HeavyRain,
|
||||
[STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED - 12] = sText_ExtremelyHarshSunlightWasNotLessened,
|
||||
[STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT - 12] = sText_MoveEvaporatedInTheHarshSunlight,
|
||||
[STRINGID_EXTREMESUNLIGHTFADED - 12] = sText_ExtremeSunlightFaded,
|
||||
[STRINGID_EXTREMELYHARSHSUNLIGHT - 12] = sText_ExtremelyHarshSunlight,
|
||||
[STRINGID_ATTACKERBECAMEASHSPECIES - 12] = sText_AttackerBecameAshSpecies,
|
||||
[STRINGID_ATTACKERBECAMEFULLYCHARGED - 12] = sText_AttackerBecameFullyCharged,
|
||||
[STRINGID_HEALBLOCKEDNOMORE - 12] = sText_HealBlockedNoMore,
|
||||
@ -756,7 +784,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_AROMAVEILPROTECTED - 12] = sText_AromaVeilProtected,
|
||||
[STRINGID_SWEETVEILPROTECTED - 12] = sText_SweetVeilProtected,
|
||||
[STRINGID_FLOWERVEILPROTECTED - 12] = sText_FlowerVeilProtected,
|
||||
[STRINGID_SAFETYGOOGLESPROTECTED - 12] = sText_SafetyGooglesProtected,
|
||||
[STRINGID_SAFETYGOGGLESPROTECTED - 12] = sText_SafetyGogglesProtected,
|
||||
[STRINGID_SPECTRALTHIEFSTEAL - 12] = sText_SpectralThiefSteal,
|
||||
[STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse,
|
||||
[STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText,
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "constants/party_menu.h"
|
||||
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
extern struct Evolution gEvolutionTable[][EVOS_PER_MON];
|
||||
|
||||
extern const u8* const gBattleScriptsForMoveEffects[];
|
||||
|
||||
@ -1334,6 +1335,28 @@ static void Cmd_attackcanceler(void)
|
||||
{
|
||||
s32 i, moveType;
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
|
||||
if (moveType == TYPE_FIRE
|
||||
&& (gBattleWeather & WEATHER_RAIN_PRIMAL)
|
||||
&& WEATHER_HAS_EFFECT
|
||||
&& gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves;
|
||||
return;
|
||||
}
|
||||
|
||||
if (moveType == TYPE_WATER
|
||||
&& (gBattleWeather & WEATHER_SUN_PRIMAL)
|
||||
&& WEATHER_HAS_EFFECT
|
||||
&& gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gBattleOutcome != 0)
|
||||
{
|
||||
gCurrentActionFuncId = B_ACTION_FINISHED;
|
||||
@ -1353,7 +1376,6 @@ static void Cmd_attackcanceler(void)
|
||||
return;
|
||||
|
||||
// Check Protean activation.
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
if ((GetBattlerAbility(gBattlerAttacker) == ABILITY_PROTEAN || GetBattlerAbility(gBattlerAttacker) == ABILITY_LIBERO)
|
||||
&& (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType ||
|
||||
(gBattleMons[gBattlerAttacker].type3 != moveType && gBattleMons[gBattlerAttacker].type3 != TYPE_MYSTERY))
|
||||
@ -1371,7 +1393,8 @@ static void Cmd_attackcanceler(void)
|
||||
return;
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattlerTarget, 0, 0, 0))
|
||||
return;
|
||||
if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING))
|
||||
if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE
|
||||
&& !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING | HITMARKER_NO_PPDEDUCT))
|
||||
&& !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_NoPPForMove;
|
||||
@ -1416,7 +1439,7 @@ static void Cmd_attackcanceler(void)
|
||||
gProtectStructs[gBattlerTarget].bounceMove = 0;
|
||||
gProtectStructs[gBattlerTarget].usesBouncedMove = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker))
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE))
|
||||
{
|
||||
// Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker
|
||||
gBattlerTarget = gBattlerAttacker;
|
||||
@ -1574,11 +1597,12 @@ static bool32 AccuracyCalcHelper(u16 move)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (gBattleMoves[move].effect == EFFECT_VITAL_THROW
|
||||
|| gBattleMoves[move].accuracy == 0
|
||||
|| ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))
|
||||
|| (IsBattlerWeatherAffected(gBattlerTarget, WEATHER_RAIN_ANY) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|
||||
|| (gBattleWeather & WEATHER_HAIL_ANY && move == MOVE_BLIZZARD))
|
||||
if ((WEATHER_HAS_EFFECT &&
|
||||
((IsBattlerWeatherAffected(gBattlerTarget, WEATHER_RAIN_ANY) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|
||||
|| ((B_BLIZZARD_HAIL >= GEN_4 && (gBattleWeather & WEATHER_HAIL_ANY) && move == MOVE_BLIZZARD))))
|
||||
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|
||||
|| (gBattleMoves[move].accuracy == 0)
|
||||
|| ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)))
|
||||
{
|
||||
// thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella
|
||||
JumpIfMoveFailed(7, move);
|
||||
@ -1893,6 +1917,9 @@ static void Cmd_typecalc(void)
|
||||
static void Cmd_adjustdamage(void)
|
||||
{
|
||||
u8 holdEffect, param;
|
||||
u32 moveType;
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
|
||||
if (DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
goto END;
|
||||
@ -1970,6 +1997,23 @@ END:
|
||||
gBattlescriptCurrInstr = BattleScript_GemActivates;
|
||||
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
|
||||
}
|
||||
|
||||
// WEATHER_STRONG_WINDS prints a string when it's about to reduce the power
|
||||
// of a move that is Super Effective against a Flying-type Pokémon.
|
||||
if (gBattleWeather & WEATHER_STRONG_WINDS)
|
||||
{
|
||||
if ((gBattleMons[gBattlerTarget].type1 == TYPE_FLYING
|
||||
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type1) >= UQ_4_12(2.0))
|
||||
|| (gBattleMons[gBattlerTarget].type2 == TYPE_FLYING
|
||||
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type2) >= UQ_4_12(2.0))
|
||||
|| (gBattleMons[gBattlerTarget].type3 == TYPE_FLYING
|
||||
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type3) >= UQ_4_12(2.0)))
|
||||
{
|
||||
gBattlerAbility = gBattlerTarget;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Cmd_multihitresultmessage(void)
|
||||
@ -3332,16 +3376,22 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)
|
||||
if (ItemId_GetPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
// target loses their berry
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
gBattleMons[gEffectBattler].item = 0;
|
||||
CheckSetUnburden(gEffectBattler);
|
||||
|
||||
gActiveBattler = gEffectBattler;
|
||||
|
||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
|
||||
// attacker temporarily gains their item
|
||||
gBattleStruct->changedItems[gBattlerAttacker] = gBattleMons[gBattlerAttacker].item;
|
||||
gBattleMons[gBattlerAttacker].item = gLastUsedItem;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
||||
}
|
||||
@ -3458,12 +3508,14 @@ static void Cmd_tryfaintmon(void)
|
||||
if (gBattleResults.playerFaintCounter < 0xFF)
|
||||
gBattleResults.playerFaintCounter++;
|
||||
AdjustFriendshipOnBattleFaint(gActiveBattler);
|
||||
gSideTimers[0].retaliateTimer = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleResults.opponentFaintCounter < 0xFF)
|
||||
gBattleResults.opponentFaintCounter++;
|
||||
gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL);
|
||||
gSideTimers[1].retaliateTimer = 2;
|
||||
}
|
||||
if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0)
|
||||
{
|
||||
@ -3790,6 +3842,9 @@ static void Cmd_getexp(void)
|
||||
*(&gBattleStruct->sentInPokes) >>= 1;
|
||||
gBattleScripting.getexpState = 5;
|
||||
gBattleMoveDamage = 0; // used for exp
|
||||
#if B_MAX_LEVEL_EV_GAINS >= GEN_5
|
||||
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4486,12 +4541,13 @@ static void Cmd_endselectionscript(void)
|
||||
static void Cmd_playanimation(void)
|
||||
{
|
||||
const u16* argumentPtr;
|
||||
u8 animId = gBattlescriptCurrInstr[2];
|
||||
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||
argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
|
||||
#if B_TERRAIN_BG_CHANGE == FALSE
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_RESTORE_BG)
|
||||
if (animId == B_ANIM_RESTORE_BG)
|
||||
{
|
||||
// workaround for .if not working
|
||||
gBattlescriptCurrInstr += 7;
|
||||
@ -4499,28 +4555,29 @@ static void Cmd_playanimation(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_STATS_CHANGE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_MEGA_EVOLUTION
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_ILLUSION_OFF
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_FORM_CHANGE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SUBSTITUTE_FADE)
|
||||
if (animId == B_ANIM_STATS_CHANGE
|
||||
|| animId == B_ANIM_SNATCH_MOVE
|
||||
|| animId == B_ANIM_MEGA_EVOLUTION
|
||||
|| animId == B_ANIM_ILLUSION_OFF
|
||||
|| animId == B_ANIM_FORM_CHANGE
|
||||
|| animId == B_ANIM_SUBSTITUTE_FADE
|
||||
|| animId == B_ANIM_PRIMAL_REVERSION)
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else if (gHitMarker & HITMARKER_NO_ANIMATIONS)
|
||||
else if (gHitMarker & HITMARKER_NO_ANIMATIONS && animId != B_ANIM_RESTORE_BG)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 7);
|
||||
gBattlescriptCurrInstr = BattleScript_Pausex20;
|
||||
}
|
||||
else if (gBattlescriptCurrInstr[2] == B_ANIM_RAIN_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SUN_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SANDSTORM_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_HAIL_CONTINUES)
|
||||
else if (animId == B_ANIM_RAIN_CONTINUES
|
||||
|| animId == B_ANIM_SUN_CONTINUES
|
||||
|| animId == B_ANIM_SANDSTORM_CONTINUES
|
||||
|| animId == B_ANIM_HAIL_CONTINUES)
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
@ -4530,7 +4587,7 @@ static void Cmd_playanimation(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
@ -4550,7 +4607,8 @@ static void Cmd_playanimation2(void) // animation Id is stored in the first poin
|
||||
|| *animationIdPtr == B_ANIM_MEGA_EVOLUTION
|
||||
|| *animationIdPtr == B_ANIM_ILLUSION_OFF
|
||||
|| *animationIdPtr == B_ANIM_FORM_CHANGE
|
||||
|| *animationIdPtr == B_ANIM_SUBSTITUTE_FADE)
|
||||
|| *animationIdPtr == B_ANIM_SUBSTITUTE_FADE
|
||||
|| *animationIdPtr == B_ANIM_PRIMAL_REVERSION)
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, *animationIdPtr, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
@ -5109,7 +5167,6 @@ static void Cmd_moveend(void)
|
||||
MoveValuesCleanUp();
|
||||
gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect;
|
||||
BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]);
|
||||
gBattleStruct->atkCancellerTracker = 0; // Run all cancellers on next target
|
||||
gBattlescriptCurrInstr = BattleScript_FlushMessageBox;
|
||||
return;
|
||||
}
|
||||
@ -5139,7 +5196,7 @@ static void Cmd_moveend(void)
|
||||
// Attacker is the damage-dealer, battler is mon to be switched out
|
||||
if (IsBattlerAlive(battler)
|
||||
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_BUTTON
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0)
|
||||
&& CountUsablePartyMons(battler) > 0) // Has mon to switch into
|
||||
{
|
||||
@ -5173,7 +5230,7 @@ static void Cmd_moveend(void)
|
||||
// Attacker is the one to be switched out, battler is one with red card
|
||||
if (battler != gBattlerAttacker
|
||||
&& IsBattlerAlive(battler)
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RED_CARD
|
||||
&& (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0)
|
||||
&& CanBattlerSwitch(gBattlerAttacker))
|
||||
@ -5240,7 +5297,7 @@ static void Cmd_moveend(void)
|
||||
if (battler != gBattlerAttacker // Cannot pickpocket yourself
|
||||
&& GetBattlerAbility(battler) == ABILITY_PICKPOCKET // Target must have pickpocket ability
|
||||
&& BATTLER_DAMAGED(battler) // Target needs to have been damaged
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) // Subsitute unaffected
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) // Subsitute unaffected
|
||||
&& IsBattlerAlive(battler) // Battler must be alive to pickpocket
|
||||
&& gBattleMons[battler].item == ITEM_NONE // Pickpocketer can't have an item already
|
||||
&& CanStealItem(battler, gBattlerAttacker, gBattleMons[gBattlerAttacker].item)) // Cannot steal plates, mega stones, etc
|
||||
@ -6592,7 +6649,6 @@ static void Cmd_jumptocalledmove(void)
|
||||
else
|
||||
gChosenMove = gCurrentMove = gCalledMove;
|
||||
|
||||
gBattleStruct->atkCancellerTracker = 0;
|
||||
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
|
||||
}
|
||||
|
||||
@ -7335,6 +7391,21 @@ static u32 GetHighestStatId(u32 battlerId)
|
||||
return highestId;
|
||||
}
|
||||
|
||||
static bool32 IsRototillerAffected(u32 battlerId)
|
||||
{
|
||||
if (!IsBattlerAlive(battlerId))
|
||||
return FALSE;
|
||||
if (!IsBattlerGrounded(battlerId))
|
||||
return FALSE; // Only grounded battlers affected
|
||||
if (!IS_BATTLER_OF_TYPE(battlerId, TYPE_GRASS))
|
||||
return FALSE; // Only grass types affected
|
||||
if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE; // Rototiller doesn't affected semi-invulnerable battlers
|
||||
if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battlerId, FALSE))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void Cmd_various(void)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
@ -8048,7 +8119,7 @@ static void Cmd_various(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_ELECTRIFIED;
|
||||
gStatuses4[gBattlerTarget] |= STATUS4_ELECTRIFIED;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
@ -8138,6 +8209,47 @@ static void Cmd_various(void)
|
||||
}
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
case VARIOUS_HANDLE_PRIMAL_REVERSION:
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]];
|
||||
else
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]];
|
||||
|
||||
// Change species.
|
||||
if (gBattlescriptCurrInstr[3] == 0)
|
||||
{
|
||||
u16 primalSpecies;
|
||||
gBattleStruct->mega.primalRevertedSpecies[gActiveBattler] = gBattleMons[gActiveBattler].species;
|
||||
if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT
|
||||
|| (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT && !(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER))))
|
||||
{
|
||||
gBattleStruct->mega.playerPrimalRevertedSpecies = gBattleStruct->mega.primalRevertedSpecies[gActiveBattler];
|
||||
}
|
||||
// Checks Primal Reversion
|
||||
primalSpecies = GetMegaEvolutionSpecies(gBattleStruct->mega.primalRevertedSpecies[gActiveBattler], gBattleMons[gActiveBattler].item);
|
||||
|
||||
gBattleMons[gActiveBattler].species = primalSpecies;
|
||||
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].species);
|
||||
|
||||
BtlController_EmitSetMonData(0, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[gActiveBattler]], 2, &gBattleMons[gActiveBattler].species);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
// Change stats.
|
||||
else if (gBattlescriptCurrInstr[3] == 1)
|
||||
{
|
||||
RecalcBattlerStats(gActiveBattler, mon);
|
||||
gBattleStruct->mega.primalRevertedPartyIds[GetBattlerSide(gActiveBattler)] |= gBitTable[gBattlerPartyIndexes[gActiveBattler]];
|
||||
}
|
||||
// Update healthbox and elevation.
|
||||
else
|
||||
{
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], mon, HEALTHBOX_ALL);
|
||||
CreateMegaIndicatorSprite(gActiveBattler, 0);
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
|
||||
SetBattlerShadowSpriteCallback(gActiveBattler, gBattleMons[gActiveBattler].species);
|
||||
}
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
case VARIOUS_HANDLE_FORM_CHANGE:
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]];
|
||||
@ -8743,7 +8855,120 @@ static void Cmd_various(void)
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler))
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE))
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER:
|
||||
{
|
||||
bool8 shouldNotClear = FALSE;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (((GetBattlerAbility(i) == ABILITY_DESOLATE_LAND && gBattleWeather & WEATHER_SUN_PRIMAL)
|
||||
|| (GetBattlerAbility(i) == ABILITY_PRIMORDIAL_SEA && gBattleWeather & WEATHER_RAIN_PRIMAL)
|
||||
|| (GetBattlerAbility(i) == ABILITY_DELTA_STREAM && gBattleWeather & WEATHER_STRONG_WINDS))
|
||||
&& IsBattlerAlive(i)
|
||||
&& !(gStatuses3[i] & STATUS3_GASTRO_ACID))
|
||||
shouldNotClear = TRUE;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_SUN_PRIMAL && !shouldNotClear)
|
||||
{
|
||||
gBattleWeather &= ~WEATHER_SUN_PRIMAL;
|
||||
PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler);
|
||||
gBattleCommunication[MSG_DISPLAY] = 1;
|
||||
}
|
||||
else if (gBattleWeather & WEATHER_RAIN_PRIMAL && !shouldNotClear)
|
||||
{
|
||||
gBattleWeather &= ~WEATHER_RAIN_PRIMAL;
|
||||
PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler);
|
||||
gBattleCommunication[MSG_DISPLAY] = 1;
|
||||
}
|
||||
else if (gBattleWeather & WEATHER_STRONG_WINDS && !shouldNotClear)
|
||||
{
|
||||
gBattleWeather &= ~WEATHER_STRONG_WINDS;
|
||||
PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler);
|
||||
gBattleCommunication[MSG_DISPLAY] = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VARIOUS_GET_ROTOTILLER_TARGETS:
|
||||
// Gets the battlers to be affected by rototiller. If there are none, print 'But it failed!'
|
||||
{
|
||||
u32 count = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = FALSE;
|
||||
if (IsRototillerAffected(i))
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = TRUE;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // Rototiller fails
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED:
|
||||
if (gSpecialStatuses[gActiveBattler].rototillerAffected)
|
||||
{
|
||||
gSpecialStatuses[gActiveBattler].rototillerAffected = FALSE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // Unaffected by rototiller - print STRINGID_NOEFFECTONTARGET
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_ACTIVATE_BATTLE_BOND:
|
||||
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
|
||||
&& HasAttackerFaintedTarget()
|
||||
&& CalculateEnemyPartyCount() > 1)
|
||||
{
|
||||
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
|
||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
|
||||
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VARIOUS_CONSUME_BERRY:
|
||||
if (ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) == HOLD_EFFECT_NONE)
|
||||
{
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
}
|
||||
|
||||
gBattleScripting.battler = gEffectBattler = gBattlerTarget = gActiveBattler; // Cover all berry effect battlerId cases. e.g. ChangeStatBuffs uses target ID
|
||||
// Do move end berry effects for just a single battler, instead of looping through all battlers
|
||||
if (ItemBattleEffects(ITEMEFFECT_BATTLER_MOVE_END, gActiveBattler, FALSE))
|
||||
return;
|
||||
|
||||
if (gBattlescriptCurrInstr[3])
|
||||
{
|
||||
gBattleMons[gActiveBattler].item = gBattleStruct->changedItems[gActiveBattler];
|
||||
gBattleStruct->changedItems[gActiveBattler] = ITEM_NONE;
|
||||
gBattleResources->flags->flags[gActiveBattler] &= ~(RESOURCE_FLAG_UNBURDEN);
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL:
|
||||
{
|
||||
bool8 canDoPrimalReversion = FALSE;
|
||||
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
if (gEvolutionTable[gBattleMons[gActiveBattler].species][i].method == EVO_PRIMAL_REVERSION
|
||||
&& gEvolutionTable[gBattleMons[gActiveBattler].species][i].param == gBattleMons[gActiveBattler].item)
|
||||
canDoPrimalReversion = TRUE;
|
||||
}
|
||||
if (!canDoPrimalReversion)
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
@ -8758,6 +8983,11 @@ static void Cmd_various(void)
|
||||
}
|
||||
return;
|
||||
}
|
||||
case VARIOUS_APPLY_PLASMA_FISTS:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
gStatuses4[i] |= STATUS4_PLASMA_FISTS;
|
||||
break;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
}
|
||||
@ -10064,7 +10294,7 @@ static void Cmd_weatherdamage(void)
|
||||
&& ability != ABILITY_SAND_RUSH
|
||||
&& ability != ABILITY_OVERCOAT
|
||||
&& !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
@ -10089,7 +10319,7 @@ static void Cmd_weatherdamage(void)
|
||||
&& ability != ABILITY_OVERCOAT
|
||||
&& ability != ABILITY_ICE_BODY
|
||||
&& !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
@ -10703,7 +10933,7 @@ static void Cmd_settailwind(void)
|
||||
{
|
||||
gSideStatuses[side] |= SIDE_STATUS_TAILWIND;
|
||||
gSideTimers[side].tailwindBattlerId = gBattlerAttacker;
|
||||
gSideTimers[side].tailwindTimer = (B_TAILWIND_TIMER >= GEN_5) ? 4 : 3;
|
||||
gSideTimers[side].tailwindTimer = (B_TAILWIND_TURNS >= GEN_5) ? 4 : 3;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
else
|
||||
@ -10919,7 +11149,7 @@ static void Cmd_trysetperishsong(void)
|
||||
{
|
||||
if (gStatuses3[i] & STATUS3_PERISH_SONG
|
||||
|| GetBattlerAbility(i) == ABILITY_SOUNDPROOF
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i))
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i, TRUE))
|
||||
{
|
||||
notAffectedCount++;
|
||||
}
|
||||
@ -11456,7 +11686,7 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
|
||||
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
|
||||
&& gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
|
||||
#else
|
||||
if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED
|
||||
if (gBattleCommunication[MISS_TYPE] == B_MSG_PROTECTED
|
||||
|| gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE
|
||||
|| IsBattlerProtected(gBattlerTarget, gCurrentMove)
|
||||
|| DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
@ -11559,9 +11789,15 @@ static void Cmd_settaunt(void)
|
||||
}
|
||||
else if (gDisableStructs[gBattlerTarget].tauntTimer == 0)
|
||||
{
|
||||
#if B_TAUNT_TURNS >= GEN_5
|
||||
u8 turns = 4;
|
||||
if (GetBattlerTurnOrderNum(gBattlerTarget) > GetBattlerTurnOrderNum(gBattlerAttacker))
|
||||
turns--; // If the target hasn't yet moved this turn, Taunt lasts for only three turns (source: Bulbapedia)
|
||||
#elif B_TAUNT_TURNS == GEN_4
|
||||
u8 turns = (Random() & 2) + 3;
|
||||
#else
|
||||
u8 turns = 2;
|
||||
#endif
|
||||
|
||||
gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = turns;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
@ -12414,7 +12650,7 @@ static void Cmd_removelightscreenreflect(void) // brick break
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static u8 GetCatchingBattler(void)
|
||||
u8 GetCatchingBattler(void)
|
||||
{
|
||||
if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)))
|
||||
return GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
@ -12449,6 +12685,7 @@ static void Cmd_handleballthrow(void)
|
||||
u32 odds;
|
||||
u8 catchRate;
|
||||
|
||||
gLastThrownBall = gLastUsedItem;
|
||||
if (gLastUsedItem == ITEM_SAFARI_BALL)
|
||||
catchRate = gBattleStruct->safariCatchFactor * 1275 / 100;
|
||||
else
|
||||
|
@ -621,6 +621,12 @@ bool8 TryRunFromBattle(u8 battler)
|
||||
gProtectStructs[battler].fleeFlag = 1;
|
||||
effect++;
|
||||
}
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
else if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
{
|
||||
effect++;
|
||||
}
|
||||
#endif
|
||||
else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY)
|
||||
{
|
||||
if (InBattlePyramid())
|
||||
@ -756,6 +762,17 @@ void HandleAction_SafariZoneBallThrow(void)
|
||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||
}
|
||||
|
||||
void HandleAction_ThrowBall(void)
|
||||
{
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||
gBattle_BG0_X = 0;
|
||||
gBattle_BG0_Y = 0;
|
||||
gLastUsedItem = gLastThrownBall;
|
||||
RemoveBagItem(gLastUsedItem, 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BallThrow;
|
||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||
}
|
||||
|
||||
void HandleAction_ThrowPokeblock(void)
|
||||
{
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||
@ -1715,6 +1732,21 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
|
||||
{
|
||||
gCurrentMove = move;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace;
|
||||
gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeks;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gActiveBattler;
|
||||
if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
{
|
||||
@ -1797,6 +1829,8 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND)
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
|
||||
unusableMoves |= gBitTable[i];
|
||||
}
|
||||
return unusableMoves;
|
||||
}
|
||||
@ -1870,6 +1904,7 @@ enum
|
||||
ENDTURN_PSYCHIC_TERRAIN,
|
||||
ENDTURN_ION_DELUGE,
|
||||
ENDTURN_FAIRY_LOCK,
|
||||
ENDTURN_RETALIATE,
|
||||
ENDTURN_FIELD_COUNT,
|
||||
};
|
||||
|
||||
@ -2106,7 +2141,8 @@ u8 DoFieldEndTurnEffects(void)
|
||||
case ENDTURN_RAIN:
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY)
|
||||
{
|
||||
if (!(gBattleWeather & WEATHER_RAIN_PERMANENT))
|
||||
if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)
|
||||
&& !(gBattleWeather & WEATHER_RAIN_PRIMAL))
|
||||
{
|
||||
if (--gWishFutureKnock.weatherDuration == 0)
|
||||
{
|
||||
@ -2156,7 +2192,9 @@ u8 DoFieldEndTurnEffects(void)
|
||||
case ENDTURN_SUN:
|
||||
if (gBattleWeather & WEATHER_SUN_ANY)
|
||||
{
|
||||
if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0)
|
||||
if (!(gBattleWeather & WEATHER_SUN_PERMANENT)
|
||||
&& !(gBattleWeather & WEATHER_SUN_PRIMAL)
|
||||
&& --gWishFutureKnock.weatherDuration == 0)
|
||||
{
|
||||
gBattleWeather &= ~WEATHER_SUN_TEMPORARY;
|
||||
gBattlescriptCurrInstr = BattleScript_SunlightFaded;
|
||||
@ -2220,7 +2258,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_ELECTRIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
|
||||
@ -2230,7 +2268,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_MISTY_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_MistyTerrainEnds);
|
||||
@ -2252,7 +2290,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_PSYCHIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
|
||||
@ -2298,6 +2336,13 @@ u8 DoFieldEndTurnEffects(void)
|
||||
}
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_RETALIATE:
|
||||
if (gSideTimers[B_SIDE_PLAYER].retaliateTimer > 0)
|
||||
gSideTimers[B_SIDE_PLAYER].retaliateTimer--;
|
||||
if (gSideTimers[B_SIDE_OPPONENT].retaliateTimer > 0)
|
||||
gSideTimers[B_SIDE_OPPONENT].retaliateTimer--;
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_FIELD_COUNT:
|
||||
effect++;
|
||||
break;
|
||||
@ -2341,6 +2386,7 @@ enum
|
||||
ENDTURN_POWDER,
|
||||
ENDTURN_THROAT_CHOP,
|
||||
ENDTURN_SLOW_START,
|
||||
ENDTURN_PLASMA_FISTS,
|
||||
ENDTURN_BATTLER_COUNT
|
||||
};
|
||||
|
||||
@ -2824,7 +2870,7 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_ELECTRIFY:
|
||||
gStatuses3[gActiveBattler] &= ~(STATUS3_ELECTRIFIED);
|
||||
gStatuses4[gActiveBattler] &= ~(STATUS4_ELECTRIFIED);
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
case ENDTURN_POWDER:
|
||||
gBattleMons[gActiveBattler].status2 &= ~(STATUS2_POWDER);
|
||||
@ -2847,6 +2893,11 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
}
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_PLASMA_FISTS:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
gStatuses4[i] &= ~(STATUS4_PLASMA_FISTS);
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_BATTLER_COUNT: // done
|
||||
gBattleStruct->turnEffectsTracker = 0;
|
||||
gBattleStruct->turnEffectsBattlerId++;
|
||||
@ -3092,7 +3143,6 @@ enum
|
||||
CANCELLER_POWDER_MOVE,
|
||||
CANCELLER_POWDER_STATUS,
|
||||
CANCELLER_THROAT_CHOP,
|
||||
CANCELLER_PRANKSTER,
|
||||
CANCELLER_END,
|
||||
CANCELLER_PSYCHIC_TERRAIN,
|
||||
CANCELLER_END2,
|
||||
@ -3383,9 +3433,10 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
gBattlerAbility = gBattlerTarget;
|
||||
effect = 1;
|
||||
}
|
||||
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOOGLES);
|
||||
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOGGLES);
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
effect = 1;
|
||||
}
|
||||
|
||||
@ -3420,18 +3471,6 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
}
|
||||
gBattleStruct->atkCancellerTracker++;
|
||||
break;
|
||||
case CANCELLER_PRANKSTER:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
|
||||
&& !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE))
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)))
|
||||
CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected
|
||||
gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
|
||||
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
|
||||
effect = 1;
|
||||
}
|
||||
gBattleStruct->atkCancellerTracker++;
|
||||
break;
|
||||
case CANCELLER_END:
|
||||
break;
|
||||
}
|
||||
@ -3676,9 +3715,12 @@ u8 TryWeatherFormChange(u8 battler)
|
||||
static const u16 sWeatherFlagsInfo[][3] =
|
||||
{
|
||||
[ENUM_WEATHER_RAIN] = {WEATHER_RAIN_TEMPORARY, WEATHER_RAIN_PERMANENT, HOLD_EFFECT_DAMP_ROCK},
|
||||
[ENUM_WEATHER_RAIN_PRIMAL] = {WEATHER_RAIN_PRIMAL, WEATHER_RAIN_PRIMAL, HOLD_EFFECT_DAMP_ROCK},
|
||||
[ENUM_WEATHER_SUN] = {WEATHER_SUN_TEMPORARY, WEATHER_SUN_PERMANENT, HOLD_EFFECT_HEAT_ROCK},
|
||||
[ENUM_WEATHER_SUN_PRIMAL] = {WEATHER_SUN_PRIMAL, WEATHER_SUN_PRIMAL, HOLD_EFFECT_HEAT_ROCK},
|
||||
[ENUM_WEATHER_SANDSTORM] = {WEATHER_SANDSTORM_TEMPORARY, WEATHER_SANDSTORM_PERMANENT, HOLD_EFFECT_SMOOTH_ROCK},
|
||||
[ENUM_WEATHER_HAIL] = {WEATHER_HAIL_TEMPORARY, WEATHER_HAIL_PERMANENT, HOLD_EFFECT_ICY_ROCK},
|
||||
[ENUM_WEATHER_STRONG_WINDS] = {WEATHER_STRONG_WINDS, WEATHER_STRONG_WINDS, HOLD_EFFECT_NONE},
|
||||
};
|
||||
|
||||
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
|
||||
@ -3689,6 +3731,13 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
|
||||
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]);
|
||||
return TRUE;
|
||||
}
|
||||
else if (gBattleWeather & WEATHER_PRIMAL_ANY
|
||||
&& GetBattlerAbility(battler) != ABILITY_DESOLATE_LAND
|
||||
&& GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA
|
||||
&& GetBattlerAbility(battler) != ABILITY_DELTA_STREAM)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1])))
|
||||
{
|
||||
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]);
|
||||
@ -4159,6 +4208,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = 1;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_SAND_STREAM:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE))
|
||||
@ -4166,6 +4221,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = 1;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_DROUGHT:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN, TRUE))
|
||||
@ -4173,6 +4234,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = 1;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_SNOW_WARNING:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_HAIL, TRUE))
|
||||
@ -4180,6 +4247,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = 1;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_ELECTRIC_SURGE:
|
||||
if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer))
|
||||
@ -4269,6 +4342,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_DESOLATE_LAND:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN_PRIMAL, TRUE))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DesolateLandActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_PRIMORDIAL_SEA:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_RAIN_PRIMAL, TRUE))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_PrimordialSeaActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_DELTA_STREAM:
|
||||
if (TryChangeBattleWeather(battler, ENUM_WEATHER_STRONG_WINDS, TRUE))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DeltaStreamActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_ENDTURN: // 1
|
||||
@ -4457,7 +4551,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_MOVES_BLOCK: // 2
|
||||
if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND)
|
||||
if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(gBattleMoves[move].target & MOVE_TARGET_USER))
|
||||
|| (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC))
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)
|
||||
@ -4477,6 +4571,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
gBattlescriptCurrInstr = BattleScript_DazzlingProtected;
|
||||
effect = 1;
|
||||
}
|
||||
else if (BlocksPrankster(move, gBattlerAttacker, gBattlerTarget, TRUE)
|
||||
&& !(IS_MOVE_STATUS(move) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE))
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[move].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)))
|
||||
CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected
|
||||
gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
|
||||
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
|
||||
effect = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case ABILITYEFFECT_ABSORBING: // 3
|
||||
if (move != MOVE_NONE)
|
||||
@ -4785,7 +4889,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
{
|
||||
#if B_ROUGH_SKIN_DMG >= GEN_4
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8;
|
||||
#else
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
#endif
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
|
||||
@ -4823,7 +4931,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
case ABILITY_EFFECT_SPORE:
|
||||
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GRASS)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_OVERCOAT
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
i = Random() % 3;
|
||||
if (i == 0)
|
||||
@ -4957,14 +5065,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
&& TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE))
|
||||
&& !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY))
|
||||
{
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet;
|
||||
effect++;
|
||||
}
|
||||
else if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE))
|
||||
{
|
||||
gBattleScripting.battler = gActiveBattler = battler;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SandSpitActivates;
|
||||
effect++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITY_PERISH_BODY:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
@ -5069,18 +5185,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_BATTLE_BOND:
|
||||
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
|
||||
&& gBattleResults.opponentFaintCounter != 0
|
||||
&& CalculateEnemyPartyCount() > 1)
|
||||
{
|
||||
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
|
||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
|
||||
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis
|
||||
@ -5562,6 +5666,8 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
|
||||
|
||||
if (gBattleMons[battlerId].hp == 0)
|
||||
return FALSE;
|
||||
if (gBattleScripting.overrideBerryRequirements)
|
||||
return TRUE;
|
||||
// Unnerve prevents consumption of opponents' berries.
|
||||
if (isBerry && IsUnnerveAbilityOnOpposingSide(battlerId))
|
||||
return FALSE;
|
||||
@ -5594,7 +5700,7 @@ static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2)
|
||||
gBattleMoveDamage *= 2;
|
||||
gBattlerAbility = battlerId;
|
||||
}
|
||||
|
||||
gBattleScripting.battler = battlerId;
|
||||
if (end2)
|
||||
{
|
||||
if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavorId) < 0)
|
||||
@ -5765,7 +5871,8 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
|
||||
|
||||
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
|
||||
{
|
||||
if (HasEnoughHpToEatBerry(battlerId, 2, itemId))
|
||||
if (HasEnoughHpToEatBerry(battlerId, 2, itemId)
|
||||
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP))
|
||||
{
|
||||
if (percentHeal)
|
||||
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
|
||||
@ -6392,11 +6499,14 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEMEFFECT_BATTLER_MOVE_END:
|
||||
goto DO_ITEMEFFECT_MOVE_END; // this hurts a bit to do, but is an easy solution
|
||||
case ITEMEFFECT_MOVE_END:
|
||||
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
||||
{
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||
DO_ITEMEFFECT_MOVE_END:
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_MICLE_BERRY:
|
||||
@ -6809,7 +6919,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
if (TARGET_TURN_DAMAGED
|
||||
&& (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battlerId)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
&& gBattleMons[gBattlerAttacker].item == ITEM_NONE)
|
||||
@ -6921,7 +7031,7 @@ u32 SetRandomTarget(u32 battlerId)
|
||||
return target;
|
||||
}
|
||||
|
||||
u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||
u32 GetMoveTarget(u16 move, u8 setTarget)
|
||||
{
|
||||
u8 targetBattler = 0;
|
||||
u32 i, moveTarget, side;
|
||||
@ -7580,6 +7690,26 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
basePower *= 2;
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_HIDDEN_POWER:
|
||||
{
|
||||
#if B_HIDDEN_POWER_DMG < GEN_6
|
||||
u8 powerBits;
|
||||
|
||||
powerBits = ((gBattleMons[gBattlerAttacker].hpIV & 2) >> 1)
|
||||
| ((gBattleMons[gBattlerAttacker].attackIV & 2) << 0)
|
||||
| ((gBattleMons[gBattlerAttacker].defenseIV & 2) << 1)
|
||||
| ((gBattleMons[gBattlerAttacker].speedIV & 2) << 2)
|
||||
| ((gBattleMons[gBattlerAttacker].spAttackIV & 2) << 3)
|
||||
| ((gBattleMons[gBattlerAttacker].spDefenseIV & 2) << 4);
|
||||
|
||||
basePower = (40 * powerBits) / 63 + 30;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case EFFECT_GRAV_APPLE:
|
||||
if (gFieldStatuses & STATUS_FIELD_GRAVITY)
|
||||
MulModifier(&basePower, UQ_4_12(1.5));
|
||||
break;
|
||||
}
|
||||
|
||||
// move-specific base power changes
|
||||
@ -7603,6 +7733,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef);
|
||||
u16 holdEffectModifier;
|
||||
u16 modifier = UQ_4_12(1.0);
|
||||
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
|
||||
|
||||
// attacker's abilities
|
||||
switch (GetBattlerAbility(battlerAtk))
|
||||
@ -7855,7 +7986,8 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
MulModifier(&modifier, UQ_4_12(2.0));
|
||||
break;
|
||||
case EFFECT_RETALIATE:
|
||||
// todo
|
||||
if (gSideTimers[atkSide].retaliateTimer == 1)
|
||||
MulModifier(&modifier, UQ_4_12(2.0));
|
||||
break;
|
||||
case EFFECT_SOLARBEAM:
|
||||
if (IsBattlerWeatherAffected(battlerAtk, (WEATHER_HAIL_ANY | WEATHER_SANDSTORM_ANY | WEATHER_RAIN_ANY)))
|
||||
@ -8088,7 +8220,8 @@ static bool32 CanEvolve(u32 species)
|
||||
{
|
||||
if (gEvolutionTable[species][i].method
|
||||
&& gEvolutionTable[species][i].method != EVO_MEGA_EVOLUTION
|
||||
&& gEvolutionTable[species][i].method != EVO_MOVE_MEGA_EVOLUTION)
|
||||
&& gEvolutionTable[species][i].method != EVO_MOVE_MEGA_EVOLUTION
|
||||
&& gEvolutionTable[species][i].method != EVO_PRIMAL_REVERSION)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -8452,6 +8585,13 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt
|
||||
if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT)
|
||||
mod = UQ_4_12(1.0);
|
||||
|
||||
// WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS)
|
||||
{
|
||||
if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
}
|
||||
|
||||
MulModifier(modifier, mod);
|
||||
}
|
||||
|
||||
@ -8635,7 +8775,8 @@ u16 GetMegaEvolutionSpecies(u16 preEvoSpecies, u16 heldItemId)
|
||||
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
if (gEvolutionTable[preEvoSpecies][i].method == EVO_MEGA_EVOLUTION
|
||||
if ((gEvolutionTable[preEvoSpecies][i].method == EVO_MEGA_EVOLUTION
|
||||
|| gEvolutionTable[preEvoSpecies][i].method == EVO_PRIMAL_REVERSION)
|
||||
&& gEvolutionTable[preEvoSpecies][i].param == heldItemId)
|
||||
return gEvolutionTable[preEvoSpecies][i].targetSpecies;
|
||||
}
|
||||
@ -8702,12 +8843,20 @@ bool32 CanMegaEvolve(u8 battlerId)
|
||||
else
|
||||
holdEffect = ItemId_GetHoldEffect(itemId);
|
||||
|
||||
// Can Mega Evolve via Item.
|
||||
// Can Mega Evolve via Mega Stone.
|
||||
if (holdEffect == HOLD_EFFECT_MEGA_STONE)
|
||||
{
|
||||
gBattleStruct->mega.isWishMegaEvo = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Can undergo Primal Reversion.
|
||||
if (holdEffect == HOLD_EFFECT_PRIMAL_ORB)
|
||||
{
|
||||
gBattleStruct->mega.isWishMegaEvo = FALSE;
|
||||
gBattleStruct->mega.isPrimalReversion = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is an entry in the evolution table for Wish Mega Evolution.
|
||||
@ -8723,12 +8872,20 @@ bool32 CanMegaEvolve(u8 battlerId)
|
||||
|
||||
void UndoMegaEvolution(u32 monId)
|
||||
{
|
||||
u16 baseSpecies = GET_BASE_SPECIES_ID(GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES));
|
||||
|
||||
if (gBattleStruct->mega.evolvedPartyIds[B_SIDE_PLAYER] & gBitTable[monId])
|
||||
{
|
||||
gBattleStruct->mega.evolvedPartyIds[B_SIDE_PLAYER] &= ~(gBitTable[monId]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleStruct->mega.playerEvolvedSpecies);
|
||||
CalculateMonStats(&gPlayerParty[monId]);
|
||||
}
|
||||
else if (gBattleStruct->mega.primalRevertedPartyIds[B_SIDE_PLAYER] & gBitTable[monId])
|
||||
{
|
||||
gBattleStruct->mega.primalRevertedPartyIds[B_SIDE_PLAYER] &= ~(gBitTable[monId]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &baseSpecies);
|
||||
CalculateMonStats(&gPlayerParty[monId]);
|
||||
}
|
||||
// While not exactly a mega evolution, Zygarde follows the same rules.
|
||||
else if (GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL) == SPECIES_ZYGARDE_COMPLETE)
|
||||
{
|
||||
@ -8745,6 +8902,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
static const u16 species[][2] = // changed form id, default form id
|
||||
{
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
|
||||
@ -8757,11 +8915,10 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
};
|
||||
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted when switching out
|
||||
i = 1;
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
|
||||
i = 2;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
@ -9343,16 +9500,21 @@ void DoBurmyFormChange(u32 monId)
|
||||
}
|
||||
}
|
||||
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget)
|
||||
{
|
||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||
if (gProtectStructs[battlerPrankster].pranksterElevated
|
||||
&& GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef)
|
||||
&& !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark-types can block Prankster'd
|
||||
&& !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
|
||||
if (!gProtectStructs[battlerPrankster].pranksterElevated)
|
||||
return FALSE;
|
||||
if (GetBattlerSide(battlerPrankster) == GetBattlerSide(battlerDef))
|
||||
return FALSE;
|
||||
if (checkTarget && (gBattleMoves[move].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)))
|
||||
return FALSE;
|
||||
if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK))
|
||||
return FALSE;
|
||||
if (gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1789,7 +1789,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 30,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3101,7 +3101,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_SOUND,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3205,7 +3205,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3753,7 +3753,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_HIDDEN_POWER] =
|
||||
{
|
||||
#if B_UPDATED_MOVE_DATA >= GEN_6
|
||||
#if B_HIDDEN_POWER_DMG >= GEN_6
|
||||
.power = 60,
|
||||
#else
|
||||
.power = 1,
|
||||
@ -3809,7 +3809,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3823,7 +3823,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -4130,7 +4130,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -4773,7 +4773,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -5513,7 +5513,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -5670,7 +5670,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -6884,7 +6884,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = -7,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -7487,7 +7487,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
@ -7579,7 +7579,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
@ -7944,7 +7944,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_SCALD] =
|
||||
{
|
||||
#if B_UPDATED_MOVE_DATA >= GEN_6
|
||||
.effect = EFFECT_SCALD,
|
||||
#else
|
||||
.effect = EFFECT_BURN_HIT,
|
||||
#endif
|
||||
.power = 80,
|
||||
.type = TYPE_WATER,
|
||||
.accuracy = 100,
|
||||
@ -8847,7 +8851,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -8941,7 +8945,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 25,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 1,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9092,7 +9096,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER | MOVE_TARGET_FOES_AND_ALLY,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9106,7 +9110,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9120,7 +9124,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9204,7 +9208,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9454,7 +9458,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9974,7 +9978,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -10435,7 +10439,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_PLASMA_FISTS] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
|
||||
.effect = EFFECT_PLASMA_FISTS,
|
||||
.power = 100,
|
||||
.type = TYPE_ELECTRIC,
|
||||
.accuracy = 100,
|
||||
@ -10465,7 +10469,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
{
|
||||
#if B_UPDATED_MOVE_DATA >= GEN_8
|
||||
.power = 80,
|
||||
.effect = EFFECT_PLACEHOLDER, // TODO: EFFECT_EVASION_UP_HIT
|
||||
.effect = EFFECT_EVASION_UP_HIT,
|
||||
.pp = 10,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
|
||||
#else
|
||||
@ -10608,7 +10612,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (Light Screen + Hit)
|
||||
.effect = EFFECT_GLITZY_GLOW,
|
||||
.type = TYPE_PSYCHIC,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
@ -10628,7 +10632,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (Reflect + Hit)
|
||||
.effect = EFFECT_BADDY_BAD,
|
||||
.type = TYPE_DARK,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
@ -10650,7 +10654,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.pp = 15,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (Leech Seed + Hit)
|
||||
.effect = EFFECT_SAPPY_SEED,
|
||||
.type = TYPE_GRASS,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
@ -10671,7 +10675,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.pp = 15,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (Haze + Hit)
|
||||
.effect = EFFECT_FREEZY_FROST,
|
||||
.type = TYPE_ICE,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
@ -10692,7 +10696,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.pp = 15,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (Heal Bell + Hit)
|
||||
.effect = EFFECT_SPARKLY_SWIRL,
|
||||
.type = TYPE_FAIRY,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
@ -10725,7 +10729,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
#else
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST,
|
||||
#endif
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO (EFFECT_FLINCH_HIT + EFFECT_DOUBLE_HIT)
|
||||
.effect = EFFECT_DOUBLE_IRON_BASH,
|
||||
.power = 60,
|
||||
.type = TYPE_STEEL,
|
||||
.accuracy = 100,
|
||||
@ -10738,7 +10742,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_DYNAMAX_CANNON] =
|
||||
{
|
||||
.effect = EFFECT_HIT,
|
||||
.effect = EFFECT_DYNAMAX_DOUBLE_DMG,
|
||||
.power = 100,
|
||||
.type = TYPE_DRAGON,
|
||||
.accuracy = 100,
|
||||
@ -10780,7 +10784,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_STUFF_CHEEKS] =
|
||||
{
|
||||
.effect = EFFECT_DEFENSE_UP_2,
|
||||
.effect = EFFECT_STUFF_CHEEKS,
|
||||
.power = 0,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 0,
|
||||
@ -10857,7 +10861,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -10913,7 +10917,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -11103,7 +11107,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_GRAV_APPLE] =
|
||||
{
|
||||
.effect = EFFECT_DEFENSE_DOWN_HIT,
|
||||
.effect = EFFECT_GRAV_APPLE,
|
||||
.power = 80,
|
||||
.type = TYPE_GRASS,
|
||||
.accuracy = 100,
|
||||
|
@ -41,6 +41,15 @@ const u32 gBattleAnimSpritePal_MegaParticles[] = INCBIN_U32("graphics/battle_ani
|
||||
const u32 gBattleAnimSpriteGfx_MegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/mega_symbol.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_MegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/mega_symbol.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_AlphaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_symbol.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_AlphaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/alpha_symbol.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/omega_symbol.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_OmegaSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/omega_symbol.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_PrimalParticles[] = INCBIN_U32("graphics/battle_anims/sprites/primal_particles.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_FlashCannonBall[] = INCBIN_U32("graphics/battle_anims/sprites/flash_cannon_ball.gbapal.lz");
|
||||
|
||||
@ -1312,11 +1321,14 @@ const u32 gUnknown_08D85A1C[] = INCBIN_U32("graphics/battle_frontier/battle_tile
|
||||
#include "data/graphics/intro_scene.h"
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimBgTilemap_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz");
|
||||
const u32 gBattleAnimBgImage_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.4bpp.lz");
|
||||
|
||||
const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz");
|
||||
const u32 gBattleAnimBgTilemap_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz");
|
||||
const u32 gBattleAnimBgImage_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.gbapal.lz");
|
||||
|
@ -936,42 +936,61 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId)
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
u32 CanThrowBall(void)
|
||||
{
|
||||
if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) // There are two present pokemon.
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
|
||||
{
|
||||
static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\nThere are two pokemon out there!\p");
|
||||
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, textCantThrowPokeBall, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage);
|
||||
return 1; // There are two present pokemon.
|
||||
}
|
||||
else if (gBattlerInMenuId == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) // Attempting to throw a ball with the second pokemon while both are alive.
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
|
||||
{
|
||||
static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\p");
|
||||
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, textCantThrowPokeBall, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage);
|
||||
return 2; // No room for mon
|
||||
}
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon?
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE)
|
||||
{
|
||||
return 3; // in semi-invulnerable state
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0; // usable
|
||||
}
|
||||
|
||||
static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p");
|
||||
static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p");
|
||||
void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
{
|
||||
switch (CanThrowBall())
|
||||
{
|
||||
case 0: // usable
|
||||
default:
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
if (!InBattlePyramid())
|
||||
Task_FadeAndCloseBagMenu(taskId);
|
||||
else
|
||||
CloseBattlePyramidBag(taskId);
|
||||
}
|
||||
break;
|
||||
case 1: // There are two present pokemon.
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, CloseItemMessage);
|
||||
else
|
||||
{
|
||||
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
case 2: // No room for mon
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
case 3: // Semi-Invulnerable
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "berry_powder.h"
|
||||
#include "mevent.h"
|
||||
#include "union_room_chat.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
extern const u8 EventScript_ResetAllMapFlags[];
|
||||
|
||||
|