diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 8fd760634..df4a860dd 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1838,6 +1838,10 @@ .macro trytoclearprimalweather various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER .endm + + .macro setattackertostickywebuser + various BS_TARGET, VARIOUS_SET_ATTACKER_STICKY_WEB_USER + .endm .macro getrototillertargets ptr:req various BS_ATTACKER, VARIOUS_GET_ROTOTILLER_TARGETS @@ -1874,6 +1878,19 @@ .4byte \ptr .endm + .macro trytoapplymimicry battler:req, ptr:req + various \battler, VARIOUS_TRY_TO_APPLY_MIMICRY + .4byte \ptr + .endm + + .macro photongeysercheck + various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK + .endm + + .macro shellsidearmcheck + various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index aa914bf89..cebfdc98e 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -5,6 +5,7 @@ #include "constants/moves.h" #include "constants/pokemon.h" #include "constants/items.h" +#include "constants/battle_config.h" .include "asm/macros.inc" .include "asm/macros/battle_anim_script.inc" .include "constants/constants.inc" @@ -1893,7 +1894,7 @@ Move_AURA_SPHERE: monbg ANIM_ATK_PARTNER monbgprio_28 ANIM_ATTACKER setalpha 12, 8 - call SetHighSpeedBg + call SetAuraSphereBG playsewithpan SE_M_SKY_UPPERCUT, 0 delay 60 createsprite gAuraSphereBlast, ANIM_TARGET, 3, 0 @@ -1908,6 +1909,10 @@ Move_AURA_SPHERE: delay 1 end +SetAuraSphereBG: + fadetobg BG_AURA_SPHERE + goto SetHighSpeedBgFade + Move_ROCK_POLISH: loadspritegfx ANIM_TAG_WHITE_STREAK loadspritegfx ANIM_TAG_SPARKLE_3 @@ -2378,7 +2383,7 @@ Move_FOCUS_BLAST: monbg ANIM_ATK_PARTNER monbgprio_28 ANIM_ATTACKER setalpha 12, 8 - call SetHighSpeedBg + call SetFocusBlastBG createsprite gSuperpowerOrbSpriteTemplate, ANIM_TARGET, 2, 0 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER waitforvisualfinish @@ -2391,6 +2396,10 @@ Move_FOCUS_BLAST: delay 1 end +SetFocusBlastBG: + fadetobg BG_FOCUS_BLAST + goto SetHighSpeedBgFade + Move_ENERGY_BALL: loadspritegfx ANIM_TAG_ENERGY_BALL monbg ANIM_TARGET @@ -3448,6 +3457,7 @@ Move_GUNK_SHOT: monbg ANIM_DEF_PARTNER monbgprio_28 ANIM_TARGET setalpha 12, 8 + call SetGunkShotBG createvisualtask AnimTask_ShakeMon 5, 5, ANIM_ATTACKER, 0, 2, 40, 1 delay 6 panse_1B SE_M_HYDRO_PUMP, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 0 @@ -3475,6 +3485,7 @@ Move_GUNK_SHOT: call GunkShotImpact call PoisonBubblesEffect waitforvisualfinish + call UnsetHighSpeedBg clearmonbg ANIM_DEF_PARTNER blendoff end @@ -3490,6 +3501,10 @@ GunkShotImpact: createsprite gGunkShotImpactSpriteTemplate, 4, 4, 0, 15, 1, 1 createsprite gGunkShotImpactSpriteTemplate, 4, 4, 0, -15, 1, 1 return +SetGunkShotBG: + fadetobg BG_GUNK_SHOT + goto SetHighSpeedBgFade + Move_IRON_HEAD: loadspritegfx ANIM_TAG_GUST @@ -14023,7 +14038,50 @@ Move_METEOR_BEAM:: end @to do: Move_SHELL_SIDE_ARM:: - end @to do: + launchtask AnimTask_ShellSideArm 0x5 0x0 + jumpargeq 0x0, TRUE, Move_SHELL_SIDE_ARM_PHYSICAL + jumpargeq 0x0, FALSE, Move_SHELL_SIDE_ARM_SPECIAL +Move_SHELL_SIDE_ARM_PHYSICAL: @ Modified Body Slam, placeholder + loadspritegfx ANIM_TAG_IMPACT + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_IMPACT, 0, 6, 6, RGB_MAGENTA + monbg ANIM_DEF_PARTNER + setalpha 12, 8 + playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER + createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 6, 1, ANIM_ATTACKER + waitforvisualfinish + delay 11 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 26, 0, 0, 5 + delay 6 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, ANIM_TARGET, 0 + loopsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET, 10, 2 + delay 1 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -28, 0, 0, 3 + waitforvisualfinish + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 + waitforvisualfinish + delay 10 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 6 + delay 5 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 6 + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + end +Move_SHELL_SIDE_ARM_SPECIAL: @ Modified Snipe Shot, placeholder + loadspritegfx ANIM_TAG_IMPACT_2 + loadspritegfx ANIM_TAG_LEER + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_IMPACT_2, 0, 6, 6, RGB_MAGENTA + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_LEER, 0, 6, 6, RGB_MAGENTA + launchtemplate gLeerSpriteTemplate 0x82, 2 0x18 -12 + playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER + waitforvisualfinish + delay 0x20 + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + launchtemplate gSnipeShotBallTemplate 0x82, 3, 0 0 24, + waitforvisualfinish + launchtask AnimTask_ShakeMon2 2 5 1 4 0 8, 1 + waitforvisualfinish + end Move_MISTY_EXPLOSION:: end @to do: @@ -14035,7 +14093,87 @@ Move_RISING_VOLTAGE:: end @to do: Move_TERRAIN_PULSE:: - end @to do: + loadspritegfx ANIM_TAG_DRAGON_PULSE + monbg ANIM_TARGET + setalpha 12, 8 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + launchtask AnimTask_TerrainPulse 0x5 0x0 + jumpargeq 0x0, TYPE_ELECTRIC, TerrainPulseElectric + jumpargeq 0x0, TYPE_GRASS, TerrainPulseGrass + jumpargeq 0x0, TYPE_FAIRY, TerrainPulseFairy + jumpargeq 0x0, TYPE_PSYCHIC, TerrainPulsePsychic +TerrainPulseNormal: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB_WHITE + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 2, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB_WHITE + goto TerrainPulseEnd + +TerrainPulseElectric: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(27, 27, 0) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 27, 0) + goto TerrainPulseEnd + +TerrainPulseGrass: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(11, 26, 11) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(11, 26, 11) + goto TerrainPulseEnd + +TerrainPulseFairy: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(31, 24, 31) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 24, 31) + goto TerrainPulseEnd + +TerrainPulsePsychic: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(27, 0, 13) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 0, 13) + goto TerrainPulseEnd + +TerrainPulseEnd: + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + waitforvisualfinish + delay 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB_BLACK + waitforvisualfinish + blendoff + clearmonbg ANIM_TARGET + end Move_SKITTER_SMACK:: end @to do: @@ -23307,17 +23445,50 @@ Move_SKY_UPPERCUT: end Move_SECRET_POWER: + createvisualtask AnimTask_GetFieldTerrain, 5 + jumpargeq 0, STATUS_FIELD_MISTY_TERRAIN, Move_FAIRY_WIND + jumpargeq 0, STATUS_FIELD_GRASSY_TERRAIN, Move_NEEDLE_ARM + jumpargeq 0, STATUS_FIELD_ELECTRIC_TERRAIN, Move_THUNDER_SHOCK + jumpargeq 0, STATUS_FIELD_PSYCHIC_TERRAIN, Move_CONFUSION createvisualtask AnimTask_GetBattleTerrain, 5 - jumpargeq 0, BATTLE_TERRAIN_GRASS, Move_NEEDLE_ARM - jumpargeq 0, BATTLE_TERRAIN_LONG_GRASS, Move_MAGICAL_LEAF - jumpargeq 0, BATTLE_TERRAIN_SAND, Move_MUD_SHOT - jumpargeq 0, BATTLE_TERRAIN_UNDERWATER, Move_WATERFALL - jumpargeq 0, BATTLE_TERRAIN_WATER, Move_SURF - jumpargeq 0, BATTLE_TERRAIN_POND, Move_BUBBLE_BEAM - jumpargeq 0, BATTLE_TERRAIN_MOUNTAIN, Move_ROCK_THROW - jumpargeq 0, BATTLE_TERRAIN_CAVE, Move_BITE - jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH + jumpargeq 0, BATTLE_TERRAIN_GRASS, Move_NEEDLE_ARM + jumpargeq 0, BATTLE_TERRAIN_LONG_GRASS, Move_MAGICAL_LEAF + jumpargeq 0, BATTLE_TERRAIN_SAND, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_UNDERWATER, Move_WATERFALL + jumpargeq 0, BATTLE_TERRAIN_WATER, Move_SURF + jumpargeq 0, BATTLE_TERRAIN_POND, Move_BUBBLE_BEAM + jumpargeq 0, BATTLE_TERRAIN_MOUNTAIN, Move_ROCK_THROW + jumpargeq 0, BATTLE_TERRAIN_CAVE, Move_BITE + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH + jumpargeq 0, BATTLE_TERRAIN_SOARING, Move_GUST + jumpargeq 0, BATTLE_TERRAIN_SKY_PILLAR, Move_GUST + jumpargeq 0, BATTLE_TERRAIN_BURIAL_GROUND, Move_SHADOW_SNEAK + jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT +.if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD +.else + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE +.endif + jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD + jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE + jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND + jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT + jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE +.if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP + goto Move_SPIT_UP +.elseif B_SECRET_POWER_ANIMATION == GEN_6 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM + goto Move_BODY_SLAM +.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM + goto Move_MUD_SLAP +.else + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM +.endif Move_TWISTER: loadspritegfx ANIM_TAG_LEAF @@ -24034,6 +24205,7 @@ General_TurnTrap: jumpargeq 0, TRAP_ANIM_WHIRLPOOL, Status_Whirlpool jumpargeq 0, TRAP_ANIM_CLAMP, Status_Clamp jumpargeq 0, TRAP_ANIM_SAND_TOMB, Status_SandTomb + jumpargeq 0, TRAP_ANIM_MAGMA_STORM, Status_MagmaStorm jumpargeq 0, TRAP_ANIM_INFESTATION, Status_Infestation goto Status_BindWrap Status_BindWrap: @@ -24060,6 +24232,32 @@ Status_FireSpin: stopsound end +Status_MagmaStorm: + loadspritegfx ANIM_TAG_SMALL_EMBER + fadetobg BG_MAGMA_STORM + waitbgfadeout + createvisualtask AnimTask_MoveSeismicTossBg, 3 + playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET + loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET, 5, 8 + createvisualtask AnimTask_SeismicTossBgAccelerateDownAtEnd, 3 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + call FireSpinEffect + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + call FireSpinEffect + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + restorebg + waitbgfadeout + setarg 7, 0xFFF + waitbgfadein + stopsound + clearmonbg ANIM_DEF_PARTNER + blendoff + end + Status_Whirlpool: loadspritegfx ANIM_TAG_WATER_ORB monbg ANIM_DEF_PARTNER diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index df0048ad9..6744b7929 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -367,7 +367,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectGeomancy @ EFFECT_GEOMANCY .4byte BattleScript_EffectFairyLock @ EFFECT_FAIRY_LOCK .4byte BattleScript_EffectAllySwitch @ EFFECT_ALLY_SWITCH - .4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT + .4byte BattleScript_EffectRelicSong @ EFFECT_RELIC_SONG .4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT .4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS .4byte BattleScript_EffectEerieSpell @ EFFECT_EERIE_SPELL @@ -392,10 +392,50 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectSparklySwirl @ EFFECT_SPARKLY_SWIRL .4byte BattleScript_EffectPlasmaFists @ EFFECT_PLASMA_FISTS .4byte BattleScript_EffectHyperspaceFury @ EFFECT_HYPERSPACE_FURY + .4byte BattleScript_EffectAuraWheel @ EFFECT_AURA_WHEEL + .4byte BattleScript_EffectPhotonGeyser @ EFFECT_PHOTON_GEYSER + .4byte BattleScript_EffectShellSideArm @ EFFECT_SHELL_SIDE_ARM + .4byte BattleScript_EffectHit @ EFFECT_TERRAIN_PULSE + +BattleScript_EffectShellSideArm: + shellsidearmcheck + setmoveeffect MOVE_EFFECT_POISON + goto BattleScript_EffectHit + +BattleScript_EffectPhotonGeyser: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + photongeysercheck + 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 + goto BattleScript_MoveEnd + +BattleScript_EffectAuraWheel: @ Aura Wheel can only be used by Morpeko + jumpifspecies BS_ATTACKER, SPECIES_MORPEKO, BattleScript_EffectSpeedUpHit + jumpifspecies BS_ATTACKER, SPECIES_MORPEKO_HANGRY, BattleScript_EffectSpeedUpHit + printstring STRINGID_BUTPOKEMONCANTUSETHEMOVE + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd BattleScript_EffectHyperspaceFury: - jumpifspecies BS_ATTACKER, SPECIES_TREECKO, BattleScript_EffectHyperspaceFuryUnbound - jumpifspecies BS_ATTACKER, SPECIES_MUDKIP, BattleScript_ButHoopaCantUseIt + jumpifspecies BS_ATTACKER, SPECIES_HOOPA_UNBOUND, BattleScript_EffectHyperspaceFuryUnbound + jumpifspecies BS_ATTACKER, SPECIES_HOOPA, BattleScript_ButHoopaCantUseIt printstring STRINGID_BUTPOKEMONCANTUSETHEMOVE waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd @@ -734,9 +774,30 @@ BattleScript_EffectAttackerDefenseDownHit: setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN goto BattleScript_EffectHit -BattleScript_EffectSleepHit: - setmoveeffect MOVE_EFFECT_SLEEP - goto BattleScript_EffectHit +BattleScript_EffectRelicSong: + setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + 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 + argumentstatuseffect + tryfaintmon BS_TARGET, FALSE, NULL + goto BattleScript_MoveEnd BattleScript_EffectAllySwitch: attackcanceler @@ -1908,6 +1969,23 @@ BattleScript_EffectPsychicTerrain: waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL call BattleScript_TerrainSeedLoop + jumpifabilitypresent ABILITY_MIMICRY, BattleScript_ApplyMimicry + goto BattleScript_MoveEnd + +BattleScript_ApplyMimicry:: + savetarget + setbyte gBattlerTarget, 0 +BattleScript_MimicryLoopIter: + copybyte sBATTLER, gBattlerTarget + trytoapplymimicry BS_TARGET, BattleScript_MimicryLoop_NextBattler + copybyte gBattlerAbility, sBATTLER + call BattleScript_AbilityPopUp + printstring STRINGID_BATTLERTYPECHANGEDTO + waitmessage B_WAIT_TIME_LONG +BattleScript_MimicryLoop_NextBattler: + addbyte gBattlerTarget, 0x1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_MimicryLoopIter + restoretarget goto BattleScript_MoveEnd BattleScript_EffectTopsyTurvy: @@ -2581,6 +2659,18 @@ BattleScript_AromaVeilProtects: orhalfword gMoveResultFlags, MOVE_RESULT_FAILED goto BattleScript_MoveEnd +BattleScript_PastelVeilProtectsRet:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_PASTELVEILPROTECTED + waitmessage B_WAIT_TIME_LONG + return + +BattleScript_PastelVeilProtects: + call BattleScript_PastelVeilProtectsRet + orhalfword gMoveResultFlags, MOVE_RESULT_FAILED + goto BattleScript_MoveEnd + BattleScript_LeafGuardProtectsRet:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp @@ -2889,6 +2979,34 @@ BattleScript_StatDownPrintString:: BattleScript_StatDownEnd:: goto BattleScript_MoveEnd +BattleScript_MirrorArmorReflect:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss +BattleScript_MirrorArmorReflectStatLoss: + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd + jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim + goto BattleScript_MirrorArmorReflectWontFall +BattleScript_MirrorArmorReflectAnim: + setgraphicalstatchangevalues + playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 +BattleScript_MirrorArmorReflectPrintString: + printfromtable gStatDownStringIds + waitmessage B_WAIT_TIME_LONG +BattleScript_MirrorArmorReflectEnd: + return + +BattleScript_MirrorArmorReflectWontFall: + copybyte gBattlerTarget, gBattlerAttacker @ STRINGID_STATSWONTDECREASE uses target + goto BattleScript_MirrorArmorReflectPrintString + +@ gBattlerTarget is battler with Mirror Armor +BattleScript_MirrorArmorReflectStickyWeb: + call BattleScript_AbilityPopUp + setattackertostickywebuser + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_StickyWebOnSwitchInEnd @ Sticky web user not on field -> no stat loss + goto BattleScript_MirrorArmorReflectStatLoss + BattleScript_StatDown:: playanimation BS_EFFECT_BATTLER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printfromtable gStatDownStringIds @@ -3053,6 +3171,7 @@ BattleScript_EffectToxic:: ppreduce jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects + jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects @@ -3080,6 +3199,7 @@ BattleScript_AlreadyPoisoned:: BattleScript_ImmunityProtected:: copybyte gEffectBattler, gBattlerTarget + call BattleScript_AbilityPopUp setbyte cMULTISTRING_CHOOSER, B_MSG_ABILITY_PREVENTS_MOVE_STATUS call BattleScript_PSNPrevention goto BattleScript_MoveEnd @@ -3408,6 +3528,7 @@ BattleScript_EffectPoison:: ppreduce jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects + jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects @@ -6364,6 +6485,7 @@ BattleScript_StickyWebOnSwitchIn:: copybyte gBattlerTarget, sBATTLER printstring STRINGID_STICKYWEBSWITCHIN waitmessage B_WAIT_TIME_LONG + jumpifability BS_TARGET, ABILITY_MIRROR_ARMOR, BattleScript_MirrorArmorReflectStickyWeb statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StickyWebOnSwitchInEnd jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_StickyWebOnSwitchInStatAnim jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_StickyWebOnSwitchInEnd @@ -6928,6 +7050,7 @@ BattleScript_AttackerFormChange:: call BattleScript_AbilityPopUp printstring STRINGID_EMPTYSTRING3 waitmessage 1 +BattleScript_AttackerFormChangeNoPopup:: handleformchange BS_ATTACKER, 0 handleformchange BS_ATTACKER, 1 playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL @@ -6939,6 +7062,21 @@ BattleScript_AttackerFormChangeEnd3:: call BattleScript_AttackerFormChange end3 +BattleScript_AttackerFormChangeEnd3NoPopup:: + call BattleScript_AttackerFormChangeNoPopup + +BattleScript_AttackerFormChangeMoveEffect:: + waitmessage 1 + handleformchange BS_ATTACKER, 0 + handleformchange BS_ATTACKER, 1 + playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL + waitanimation + copybyte sBATTLER, gBattlerAttacker + printstring STRINGID_PKMNTRANSFORMED + waitmessage B_WAIT_TIME_LONG + handleformchange BS_ATTACKER, 2 + end3 + BattleScript_BallFetch:: call BattleScript_AbilityPopUp printstring STRINGID_FETCHEDPOKEBALL @@ -7938,6 +8076,7 @@ BattleScript_GrassyTerrainHealEnd: BattleScript_AbilityNoSpecificStatLoss:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp +BattleScript_AbilityNoSpecificStatLossPrint: printstring STRINGID_PKMNSXPREVENTSYLOSS waitmessage B_WAIT_TIME_LONG setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY @@ -7957,6 +8096,12 @@ BattleScript_ColorChangeActivates:: waitmessage B_WAIT_TIME_LONG return +BattleScript_MimicryActivatesEnd3:: + call BattleScript_AbilityPopUp + printstring STRINGID_BATTLERTYPECHANGEDTO + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_ProteanActivates:: call BattleScript_AbilityPopUp printstring STRINGID_PKMNCHANGEDTYPE @@ -8212,6 +8357,13 @@ BattleScript_CuteCharmActivates:: call BattleScript_TryDestinyKnotTarget return +BattleScript_GooeyActivates:: + waitstate + call BattleScript_AbilityPopUp + swapattackerwithtarget @ for defiant, mirror armor + seteffectsecondary + return + BattleScript_AbilityStatusEffect:: waitstate call BattleScript_AbilityPopUp @@ -8941,3 +9093,27 @@ BattleScript_DarkTypePreventsPrankster:: waitmessage B_WAIT_TIME_LONG orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd + +BattleScript_PastelVeilActivates:: + setbyte gBattleCommunication, 0 + setbyte gBattleCommunication + 1, 0 +BattleScript_PastelVeil_TryCurePoison: + jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_PastelVeilCurePoison + goto BattleScript_PastelVeilLoopIncrement +BattleScript_PastelVeilCurePoison: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication + 1, 0x0, BattleScript_PastelVeilCurePoisonNoPopUp + call BattleScript_AbilityPopUp + setbyte gBattleCommunication + 1, 1 +BattleScript_PastelVeilCurePoisonNoPopUp: @ Only show Pastel Veil pop up once if it cures two mons + printfromtable gSwitchInAbilityStringIds + waitmessage B_WAIT_TIME_LONG + curestatus BS_TARGET + updatestatusicon BS_TARGET +BattleScript_PastelVeilLoopIncrement: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_PastelVeilEnd + addbyte gBattleCommunication, 1 + jumpifnoally BS_TARGET, BattleScript_PastelVeilEnd + setallytonexttarget BattleScript_PastelVeil_TryCurePoison + goto BattleScript_PastelVeilEnd +BattleScript_PastelVeilEnd: + end3 diff --git a/graphics/battle_anims/backgrounds/dark_void.bin b/graphics/battle_anims/backgrounds/dark_void.bin deleted file mode 100644 index 97b879f01..000000000 Binary files a/graphics/battle_anims/backgrounds/dark_void.bin and /dev/null differ diff --git a/graphics/battle_anims/backgrounds/dark_void.pal b/graphics/battle_anims/backgrounds/dark_void.pal deleted file mode 100644 index f4cf0f09d..000000000 --- a/graphics/battle_anims/backgrounds/dark_void.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -0 0 0 -131 131 131 -123 123 123 -115 115 115 -106 106 106 -98 98 98 -82 82 82 -65 65 65 -49 49 49 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/battle_anims/backgrounds/dark_void.png b/graphics/battle_anims/backgrounds/dark_void.png deleted file mode 100644 index 2922f89d3..000000000 Binary files a/graphics/battle_anims/backgrounds/dark_void.png and /dev/null differ diff --git a/graphics/battle_anims/backgrounds/new/dark_void.bin b/graphics/battle_anims/backgrounds/new/dark_void.bin index 97b879f01..274b971db 100644 Binary files a/graphics/battle_anims/backgrounds/new/dark_void.bin and b/graphics/battle_anims/backgrounds/new/dark_void.bin differ diff --git a/graphics/battle_anims/backgrounds/new/dark_void.pal b/graphics/battle_anims/backgrounds/new/dark_void.pal index f4cf0f09d..6aa0b26a6 100644 --- a/graphics/battle_anims/backgrounds/new/dark_void.pal +++ b/graphics/battle_anims/backgrounds/new/dark_void.pal @@ -2,14 +2,14 @@ JASC-PAL 0100 16 0 0 0 -131 131 131 -123 123 123 -115 115 115 -106 106 106 -98 98 98 -82 82 82 -65 65 65 -49 49 49 +48 48 48 +72 72 72 +88 88 88 +120 120 120 +0 0 0 +0 0 0 +0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/dark_void.png b/graphics/battle_anims/backgrounds/new/dark_void.png deleted file mode 100644 index 2922f89d3..000000000 Binary files a/graphics/battle_anims/backgrounds/new/dark_void.png and /dev/null differ diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.bin b/graphics/battle_anims/backgrounds/new/focus_blast.bin index 98e3e8e16..25c569a14 100644 Binary files a/graphics/battle_anims/backgrounds/new/focus_blast.bin and b/graphics/battle_anims/backgrounds/new/focus_blast.bin differ diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.png b/graphics/battle_anims/backgrounds/new/focus_blast.png index 8720658a7..7c8755f59 100644 Binary files a/graphics/battle_anims/backgrounds/new/focus_blast.png and b/graphics/battle_anims/backgrounds/new/focus_blast.png differ diff --git a/graphics/battle_anims/backgrounds/new/magic_room.pal b/graphics/battle_anims/backgrounds/new/magic_room.pal index 2613d5ee1..ad110acec 100644 --- a/graphics/battle_anims/backgrounds/new/magic_room.pal +++ b/graphics/battle_anims/backgrounds/new/magic_room.pal @@ -2,12 +2,12 @@ JASC-PAL 0100 16 0 0 0 -164 156 24 -156 148 24 -197 189 32 -172 164 32 -115 106 16 -0 0 0 +248 248 144 +224 224 120 +200 200 96 +176 176 72 +152 152 48 +120 120 16 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/trick_room.bin b/graphics/battle_anims/backgrounds/new/trick_room.bin index 46060d168..c58eed62a 100644 Binary files a/graphics/battle_anims/backgrounds/new/trick_room.bin and b/graphics/battle_anims/backgrounds/new/trick_room.bin differ diff --git a/graphics/battle_anims/backgrounds/new/trick_room.pal b/graphics/battle_anims/backgrounds/new/trick_room.pal index 5e0aae212..1861ef92a 100644 --- a/graphics/battle_anims/backgrounds/new/trick_room.pal +++ b/graphics/battle_anims/backgrounds/new/trick_room.pal @@ -2,12 +2,12 @@ JASC-PAL 0100 16 0 0 0 -106 123 139 -90 106 139 -123 139 164 -123 139 197 -65 74 115 -0 0 0 +152 184 248 +128 160 240 +104 136 216 +80 112 192 +56 88 168 +24 56 136 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/trick_room.png b/graphics/battle_anims/backgrounds/new/trick_room.png index aac1ddc88..8605eb063 100644 Binary files a/graphics/battle_anims/backgrounds/new/trick_room.png and b/graphics/battle_anims/backgrounds/new/trick_room.png differ diff --git a/graphics/battle_anims/backgrounds/new/waterfall.bin b/graphics/battle_anims/backgrounds/new/waterfall.bin index 076beeff2..eb2085cb2 100644 Binary files a/graphics/battle_anims/backgrounds/new/waterfall.bin and b/graphics/battle_anims/backgrounds/new/waterfall.bin differ diff --git a/graphics/battle_anims/backgrounds/new/waterfall.pal b/graphics/battle_anims/backgrounds/new/waterfall.pal index 1ae2f0ef9..69a25c589 100644 --- a/graphics/battle_anims/backgrounds/new/waterfall.pal +++ b/graphics/battle_anims/backgrounds/new/waterfall.pal @@ -2,10 +2,10 @@ JASC-PAL 0100 16 0 0 0 -131 205 230 -123 180 213 -115 156 205 -115 139 164 +128 200 232 +120 176 216 +112 152 200 +112 136 160 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/waterfall.png b/graphics/battle_anims/backgrounds/new/waterfall.png index 2fa27759f..3ddb1a0a2 100644 Binary files a/graphics/battle_anims/backgrounds/new/waterfall.png and b/graphics/battle_anims/backgrounds/new/waterfall.png differ diff --git a/graphics/battle_anims/backgrounds/new/wonder_room.pal b/graphics/battle_anims/backgrounds/new/wonder_room.pal index a1792d017..89addaae0 100644 --- a/graphics/battle_anims/backgrounds/new/wonder_room.pal +++ b/graphics/battle_anims/backgrounds/new/wonder_room.pal @@ -2,12 +2,12 @@ JASC-PAL 0100 16 0 0 0 -214 55 93 -199 40 78 -222 91 123 -223 96 127 -158 31 62 -0 0 0 +248 144 248 +224 120 224 +200 96 200 +176 72 176 +152 48 152 +120 16 120 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/trick_room.png b/graphics/battle_anims/backgrounds/trick_room.png deleted file mode 100644 index 99eda69bf..000000000 Binary files a/graphics/battle_anims/backgrounds/trick_room.png and /dev/null differ diff --git a/graphics/battle_anims/backgrounds/trick_room_map.bin b/graphics/battle_anims/backgrounds/trick_room_map.bin deleted file mode 100644 index 3d0041baa..000000000 Binary files a/graphics/battle_anims/backgrounds/trick_room_map.bin and /dev/null differ diff --git a/include/battle.h b/include/battle.h index 5e5aa2479..3c4b4d220 100644 --- a/include/battle.h +++ b/include/battle.h @@ -145,8 +145,8 @@ struct ProtectStruct u32 powderSelfDmg:1; u32 usedThroatChopPreventedMove:1; u32 statRaised:1; - u32 micle:1; - u32 custap:1; // also quick claw + u32 usedMicleBerry:1; + u32 usedCustapBerry:1; // also quick claw u32 touchedProtectLike:1; u32 disableEjectPack:1; u32 statFell:1; @@ -222,10 +222,7 @@ struct FieldTimer u8 wonderRoomTimer; u8 magicRoomTimer; u8 trickRoomTimer; - u8 grassyTerrainTimer; - u8 mistyTerrainTimer; - u8 electricTerrainTimer; - u8 psychicTerrainTimer; + u8 terrainTimer; u8 gravityTimer; u8 fairyLockTimer; }; @@ -612,6 +609,7 @@ struct BattleStruct 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 + u8 stickyWebUser; }; #define GET_MOVE_TYPE(move, typeArg) \ @@ -928,5 +926,6 @@ extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; extern u16 gLastThrownBall; +extern bool8 gSwapDamageCategory; // Photon Geyser, Shell Side Arm, Light That Burns the Sky #endif // GUARD_BATTLE_H diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index b8cd53c07..b6df2168e 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -54,6 +54,7 @@ bool32 IsRecycleEncouragedItem(u16 item); bool32 CanKnockOffItem(u8 battler, u16 item); bool32 IsAbilityOfRating(u16 ability, s8 rating); s8 GetAbilityRating(u16 ability); +bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability); // stat stage checks bool32 AnyStatIsRaised(u8 battlerId); @@ -120,7 +121,6 @@ bool32 IsSemiInvulnerable(u8 battlerDef, u16 move); // status checks bool32 AI_CanBeBurned(u8 battler, u16 ability); -bool32 AI_CanBePoisoned(u8 battler, u16 ability); bool32 AI_CanBeConfused(u8 battler, u16 ability); bool32 AI_CanSleep(u8 battler, u16 ability); bool32 IsBattlerIncapacitated(u8 battler, u16 ability); diff --git a/include/battle_message.h b/include/battle_message.h index e8b362c9e..5c10f9e04 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -310,6 +310,5 @@ extern const u8 gText_BattleTourney[]; extern const u16 gMissStringIds[]; extern const u16 gStatUpStringIds[]; -extern const u16 gTrappingMoves[]; #endif // GUARD_BATTLE_MESSAGE_H diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index b55ac1391..5b263410c 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -36,6 +36,7 @@ u32 IsAbilityStatusProtected(u32 battler); bool32 TryResetBattlerStatChanges(u8 battler); bool32 CanCamouflage(u8 battlerId); u16 GetNaturePowerMove(void); +u16 GetSecretPowerMoveEffect(void); void StealTargetItem(u8 battlerStealer, u8 battlerItem); u8 GetCatchingBattler(void); diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 403af9515..c956b44d5 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -404,5 +404,12 @@ extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; extern const u8 BattleScript_WanderingSpiritActivates[]; +extern const u8 BattleScript_MirrorArmorReflect[]; +extern const u8 BattleScript_GooeyActivates[]; +extern const u8 BattleScript_PastelVeilActivates[]; +extern const u8 BattleScript_MimicryActivatesEnd3[]; +extern const u8 BattleScript_ApplyMimicry[]; +extern const u8 BattleScript_AttackerFormChangeEnd3NoPopup[]; +extern const u8 BattleScript_AttackerFormChangeMoveEffect[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/battle_util.h b/include/battle_util.h index 7f267308d..fb74610d0 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -157,8 +157,11 @@ void DoBurmyFormChange(u32 monId); bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget); u16 GetUsedHeldItem(u8 battler); bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags); +void TryToApplyMimicry(u8 battlerId, bool8 various); +void TryToRevertMimicry(void); +void RestoreBattlerOriginalTypes(u8 battlerId); -// ability checks +// Ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); bool32 IsRolePlayBannedAbility(u16 ability); bool32 IsSkillSwapBannedAbility(u16 ability); @@ -168,7 +171,7 @@ bool32 IsEntrainmentBannedAbilityAttacker(u16 ability); bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability); bool32 CanSleep(u8 battlerId); -bool32 CanBePoisoned(u8 battlerId); +bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget); bool32 CanBeBurned(u8 battlerId); bool32 CanBeParalyzed(u8 battlerId); bool32 CanBeFrozen(u8 battlerId); diff --git a/include/constants/battle.h b/include/constants/battle.h index 918c3e7f0..2fb4d3401 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -357,22 +357,38 @@ #define MOVE_EFFECT_INCINERATE 0x44 #define MOVE_EFFECT_BUG_BITE 0x45 #define MOVE_EFFECT_RECOIL_HP_25 0x46 -#define NUM_MOVE_EFFECTS 0x47 +#define MOVE_EFFECT_RELIC_SONG 0x47 +#define NUM_MOVE_EFFECTS 0x48 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 // Battle terrain defines for gBattleTerrain. -#define BATTLE_TERRAIN_GRASS 0 -#define BATTLE_TERRAIN_LONG_GRASS 1 -#define BATTLE_TERRAIN_SAND 2 -#define BATTLE_TERRAIN_UNDERWATER 3 -#define BATTLE_TERRAIN_WATER 4 -#define BATTLE_TERRAIN_POND 5 -#define BATTLE_TERRAIN_MOUNTAIN 6 -#define BATTLE_TERRAIN_CAVE 7 -#define BATTLE_TERRAIN_BUILDING 8 -#define BATTLE_TERRAIN_PLAIN 9 +#define BATTLE_TERRAIN_GRASS 0 +#define BATTLE_TERRAIN_LONG_GRASS 1 +#define BATTLE_TERRAIN_SAND 2 +#define BATTLE_TERRAIN_UNDERWATER 3 +#define BATTLE_TERRAIN_WATER 4 +#define BATTLE_TERRAIN_POND 5 +#define BATTLE_TERRAIN_MOUNTAIN 6 +#define BATTLE_TERRAIN_CAVE 7 +#define BATTLE_TERRAIN_BUILDING 8 +#define BATTLE_TERRAIN_PLAIN 9 +// New battle terrains are used for Secret Power but not fully implemented. +#define BATTLE_TERRAIN_SOARING 10 +#define BATTLE_TERRAIN_SKY_PILLAR 11 +#define BATTLE_TERRAIN_BURIAL_GROUND 12 +#define BATTLE_TERRAIN_PUDDLE 13 +#define BATTLE_TERRAIN_MARSH 14 +#define BATTLE_TERRAIN_SWAMP 15 +#define BATTLE_TERRAIN_SNOW 16 +#define BATTLE_TERRAIN_ICE 17 +#define BATTLE_TERRAIN_VOLCANO 18 +#define BATTLE_TERRAIN_DISTORTION_WORLD 19 +#define BATTLE_TERRAIN_SPACE 20 +#define BATTLE_TERRAIN_ULTRA_SPACE 21 + +#define BATTLE_TERRAIN_COUNT 22 #define B_WAIT_TIME_LONG 64 #define B_WAIT_TIME_MED 48 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c7871bd15..7df75794e 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -565,7 +565,8 @@ #define TRAP_ANIM_WHIRLPOOL 2 #define TRAP_ANIM_CLAMP 3 #define TRAP_ANIM_SAND_TOMB 4 -#define TRAP_ANIM_INFESTATION 5 +#define TRAP_ANIM_MAGMA_STORM 5 +#define TRAP_ANIM_INFESTATION 6 // Weather defines for battle animation scripts. #define ANIM_WEATHER_NONE 0 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 41fee089d..05ce39d43 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -47,6 +47,10 @@ #define SPECIES_GRENINJA_ASH 10017 #define SPECIES_HOOPA 0 #define SPECIES_HOOPA_UNBOUND 10018 + #define SPECIES_MELOETTA 0 + #define SPECIES_MELOETTA_PIROUETTE 10019 + #define SPECIES_MORPEKO 0 + #define SPECIES_MORPEKO_HANGRY 10020 #endif // Items with peculiar battle effects. @@ -91,7 +95,6 @@ #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. @@ -157,7 +160,8 @@ #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_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a 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_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. // Item settings @@ -166,6 +170,7 @@ #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. +#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. @@ -178,26 +183,31 @@ // Eg: Replace with VAR_UNUSED_0x40F7 so you can use VAR_TERRAIN for that feature. #define VAR_TERRAIN 0 // If this var has a value, assigning a STATUS_FIELD_xx_TERRAIN to it before battle causes the battle to start with that terrain active +// Terrain settings +#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. +#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. +#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on terrain and generation. +#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. +#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. + // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. #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. - -// 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. +// Catching settings +#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) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#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_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. diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 62b49a191..ca6407028 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -350,7 +350,7 @@ #define EFFECT_GEOMANCY 344 #define EFFECT_FAIRY_LOCK 345 #define EFFECT_ALLY_SWITCH 346 -#define EFFECT_SLEEP_HIT 347 +#define EFFECT_RELIC_SONG 347 #define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348 #define EFFECT_BODY_PRESS 349 #define EFFECT_EERIE_SPELL 350 @@ -375,7 +375,11 @@ #define EFFECT_SPARKLY_SWIRL 369 #define EFFECT_PLASMA_FISTS 370 #define EFFECT_HYPERSPACE_FURY 371 +#define EFFECT_AURA_WHEEL 372 +#define EFFECT_PHOTON_GEYSER 373 +#define EFFECT_SHELL_SIDE_ARM 374 +#define EFFECT_TERRAIN_PULSE 375 -#define NUM_BATTLE_MOVE_EFFECTS 372 +#define NUM_BATTLE_MOVE_EFFECTS 376 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index fb1142f48..9e2f162fd 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -197,6 +197,10 @@ #define VARIOUS_UPDATE_ABILITY_POPUP 124 #define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125 #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 +#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127 +#define VARIOUS_TRY_TO_APPLY_MIMICRY 128 +#define VARIOUS_PHOTON_GEYSER_CHECK 129 +#define VARIOUS_SHELL_SIDE_ARM_CHECK 130 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 27b39475a..8fba7597c 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -410,7 +410,7 @@ #define STRINGID_PKMNTWISTEDDIMENSIONS 406 #define STRINGID_POINTEDSTONESFLOAT 407 #define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 -#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 +#define STRINGID_TRAPPEDBYSWIRLINGMAGMA 409 #define STRINGID_VANISHEDINSTANTLY 410 #define STRINGID_PROTECTEDTEAM 411 #define STRINGID_SHAREDITSGUARD 412 @@ -599,8 +599,11 @@ #define STRINGID_BROKETHROUGHPROTECTION 596 #define STRINGID_ABILITYALLOWSONLYMOVE 597 #define STRINGID_SWAPPEDABILITIES 598 +#define STRINGID_PASTELVEILPROTECTED 599 +#define STRINGID_PASTELVEILENTERS 600 +#define STRINGID_BATTLERTYPECHANGEDTO 601 -#define BATTLESTRINGS_COUNT 599 +#define BATTLESTRINGS_COUNT 602 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. @@ -835,6 +838,7 @@ #define B_MSG_SWITCHIN_SCREENCLEANER 12 #define B_MSG_SWITCHIN_ASONE 13 #define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14 +#define B_MSG_SWITCHIN_PASTEL_VEIL 15 // gMentalHerbCureStringIds #define B_MSG_MENTALHERBCURE_INFATUATION 0 diff --git a/include/constants/contest.h b/include/constants/contest.h index cefcbeebd..f7b858c4a 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -238,5 +238,9 @@ #define COMBO_STARTER_THOUSAND_WAVES 82 #define COMBO_STARTER_HYPERSPACE_FURY 83 #define COMBO_STARTER_SHADOW_BONE 84 +#define COMBO_STARTER_ELECTRIC_TERRAIN 85 +#define COMBO_STARTER_MISTY_TERRAIN 86 +#define COMBO_STARTER_GRASSY_TERRAIN 87 +#define COMBO_STARTER_PSYCHIC_TERRAIN 88 #endif // GUARD_CONSTANTS_CONTEST_H diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 4e776e592..959148e6c 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -308,6 +308,7 @@ #define FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets #define FLAG_THAW_USER (1 << 25) #define FLAG_HIT_IN_SUBSTITUTE (1 << 26) // Hyperspace Fury +#define FLAG_TWO_STRIKES (1 << 27) // A move with this flag will strike twice, and may apply its effect on each hit // Split defines. #define SPLIT_PHYSICAL 0x0 diff --git a/include/graphics.h b/include/graphics.h index 58a5ec27d..efb57bfde 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4944,7 +4944,6 @@ extern const u32 gBattleAnimBgImage_GigaImpact[]; extern const u32 gBattleAnimBgPalette_GigaImpact[]; extern const u32 gBattleAnimBgImage_SpacialRend[]; extern const u32 gBattleAnimBgPalette_SpacialRend[]; -extern const u32 gBattleAnimBgImage_DarkVoid[]; extern const u32 gBattleAnimBgPalette_DarkVoid[]; extern const u32 gBattleAnimBgTilemap_DarkVoid[]; extern const u32 gBattleAnimBgPalette_Dark[]; diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 84fa7b634..77196cf9a 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -578,6 +578,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { switch (AI_DATA->defAbility) { + case ABILITY_MAGIC_GUARD: + switch (moveEffect) + { + case EFFECT_POISON: + case EFFECT_WILL_O_WISP: + case EFFECT_TOXIC: + case EFFECT_LEECH_SEED: + score -= 5; + break; + case EFFECT_CURSE: + if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GHOST)) // Don't use Curse if you're a ghost type vs a Magic Guard user, they'll take no damage. + score -= 5; + break; + } + break; case ABILITY_VOLT_ABSORB: case ABILITY_MOTOR_DRIVE: case ABILITY_LIGHTNING_ROD: @@ -2949,7 +2964,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } - // ability checks + // attacker ability checks switch (AI_DATA->atkAbility) { case ABILITY_MOXIE: @@ -2960,21 +2975,6 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 8; // prioritize killing target for stat boost } break; - case ABILITY_MAGIC_GUARD: - switch (moveEffect) - { - case EFFECT_POISON: - case EFFECT_WILL_O_WISP: - case EFFECT_TOXIC: - case EFFECT_LEECH_SEED: - score -= 5; - break; - case EFFECT_CURSE: - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) - score -= 5; - break; - } - break; } // ability checks // move effect checks @@ -3999,7 +3999,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case HOLD_EFFECT_TOXIC_ORB: - if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility) && AI_CanBePoisoned(battlerDef, AI_DATA->defAbility)) + if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility)) score += 2; break; case HOLD_EFFECT_FLAME_ORB: @@ -4305,7 +4305,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!IsBattlerGrounded(battlerDef)) score += 3; break; - case EFFECT_SLEEP_HIT: // Relic Song + case EFFECT_RELIC_SONG: #if (defined SPECIES_MELOETTA && defined SPECIES_MELOETTA_PIROUETTE) if (AI_DATA->atkSpecies == SPECIES_MELOETTA && gBattleMons[battlerDef].defense < gBattleMons[battlerDef].spDefense) score += 3; // Change to pirouette if can do more damage diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index fef6e6c6f..1e229fbe8 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -733,28 +733,45 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) else dmg = (critDmg + normalDmg * (critChance - 1)) / critChance; - // handle dynamic move damage + // Handle dynamic move damage switch (gBattleMoves[move].effect) { case EFFECT_LEVEL_DAMAGE: case EFFECT_PSYWAVE: - //psywave's expected damage is equal to the user's level - dmg = gBattleMons[battlerAtk].level; + dmg = gBattleMons[battlerAtk].level * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; case EFFECT_DRAGON_RAGE: - dmg = 40; + dmg = 40 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; case EFFECT_SONICBOOM: - dmg = 20; + dmg = 20 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; - //case EFFECT_METAL_BURST: - //case EFFECT_COUNTER: - default: - //do not add the random factor, it's an average case analysis - //dmg *= (100 - (Random() % 10)) / 100; // add random factor + case EFFECT_MULTI_HIT: + dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 5 : 3); + break; + case EFFECT_TRIPLE_KICK: + dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 6 : 5); + break; + case EFFECT_ENDEAVOR: + // If target has less HP than user, Endeavor does no damage + dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); + break; + case EFFECT_SUPER_FANG: + dmg = (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND + ? max(2, gBattleMons[battlerDef].hp * 3 / 4) + : max(1, gBattleMons[battlerDef].hp / 2)); + break; + case EFFECT_FINAL_GAMBIT: + dmg = gBattleMons[battlerAtk].hp; break; } + // Handle other multi-strike moves + if (gBattleMoves[move].flags & FLAG_TWO_STRIKES) + dmg *= 2; + else if (move == MOVE_SURGING_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) + dmg *= 3; + RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); @@ -1065,6 +1082,16 @@ bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgM return FALSE; } +bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability) +{ + if (IsBattlerAlive(battlerId) && AI_GetAbility(battlerId) == ability) + return TRUE; + else if (IsBattlerAlive(BATTLE_PARTNER(battlerId)) && AI_GetAbility(BATTLE_PARTNER(battlerId)) == ability) + return TRUE; + else + return FALSE; +} + // does NOT include ability suppression checks s32 AI_GetAbility(u32 battlerId) { @@ -2606,27 +2633,38 @@ bool32 AI_CanSleep(u8 battler, u16 ability) bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { if (!AI_CanSleep(battlerDef, defAbility) - || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep return FALSE; return TRUE; } -bool32 AI_CanBePoisoned(u8 battler, u16 ability) +static bool32 AI_CanPoisonType(u8 battlerAttacker, u8 battlerTarget) { - if (ability == ABILITY_IMMUNITY - || ability == ABILITY_PASTEL_VEIL - || gBattleMons[battler].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battler) - || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD) + return ((AI_GetAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS) + || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); +} + +static bool32 AI_CanBePoisoned(u8 battlerAtk, u8 battlerDef) +{ + u16 ability = AI_GetAbility(battlerDef); + + if (!(AI_CanPoisonType(battlerAtk, battlerDef)) + || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battlerDef].status1 & STATUS1_ANY + || ability == ABILITY_IMMUNITY + || ability == ABILITY_COMATOSE + || AI_IsAbilityOnSide(battlerDef, ABILITY_PASTEL_VEIL) + || gBattleMons[battlerDef].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerDef) + || AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } bool32 ShouldPoisonSelf(u8 battler, u16 ability) { - if (AI_CanBePoisoned(battler, ability) && ( + if (AI_CanBePoisoned(battler, battler) && ( ability == ABILITY_MARVEL_SCALE || ability == ABILITY_POISON_HEAL || ability == ABILITY_QUICK_FEET @@ -2641,7 +2679,7 @@ bool32 ShouldPoisonSelf(u8 battler, u16 ability) bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { - if (!AI_CanBePoisoned(battlerDef, defAbility) + if (!AI_CanBePoisoned(battlerAtk, battlerDef) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) @@ -2654,7 +2692,7 @@ bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 return TRUE; } -static bool32 CanBeParayzed(u8 battler, u16 ability) +static bool32 AI_CanBeParalyzed(u8 battler, u16 ability) { if (ability == ABILITY_LIMBER || IS_BATTLER_OF_TYPE(battler, TYPE_ELECTRIC) @@ -2666,7 +2704,7 @@ static bool32 CanBeParayzed(u8 battler, u16 ability) bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { - if (!CanBeParayzed(battlerDef, defAbility) + if (!AI_CanBeParalyzed(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) @@ -2744,7 +2782,7 @@ bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 atkGe || atkGender == defGender || atkGender == MON_GENDERLESS || defGender == MON_GENDERLESS - || IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL)) + || AI_IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL)) return FALSE; return TRUE; } diff --git a/src/battle_anim.c b/src/battle_anim.c index 6f4e5b54e..e6152a7cf 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -2059,7 +2059,7 @@ const struct BattleAnimBackground gBattleAnimBackgroundTable[] = [BG_ROCK_WRECKER] = {gBattleAnimBgImage_Hurricane, gBattleAnimBgPalette_RockWrecker, gBattleAnimBgTilemap_Hurricane}, [BG_SPACIAL_REND_ON_OPPONENT] = {gBattleAnimBgImage_SpacialRend, gBattleAnimBgPalette_SpacialRend, gBattleAnimBgTilemap_GigaImpactOpponent}, [BG_SPACIAL_REND_ON_PLAYER] = {gBattleAnimBgImage_SpacialRend, gBattleAnimBgPalette_SpacialRend, gBattleAnimBgTilemap_GigaImpactPlayer}, - [BG_DARK_VOID] = {gBattleAnimBgImage_DarkVoid, gBattleAnimBgPalette_DarkVoid, gBattleAnimBgTilemap_DarkVoid}, + [BG_DARK_VOID] = {gBattleAnimBgImage_Waterfall, gBattleAnimBgPalette_DarkVoid, gBattleAnimBgTilemap_DarkVoid}, [BG_WATER] = {gBattleAnimBgImage_HydroPump, gBattleAnimBgPalette_HydroPump, gBattleAnimBgTilemap_HydroPump}, [BG_NIGHTMARE] = {gBattleAnimBgImage_Nightmare, gBattleAnimBgPalette_Nightmare, gBattleAnimBgTilemap_Nightmare}, [BG_LEAF_STORM] = {gBattleAnimBgImage_LeafStorm, gBattleAnimBgPalette_LeafStorm, gBattleAnimBgTilemap_LeafStorm}, diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index d04483e6b..63fed0b3d 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -5064,3 +5064,34 @@ void AnimTask_PrimalReversion(u8 taskId) gBattleAnimArgs[0] = 0; DestroyAnimVisualTask(taskId); } + +void AnimTask_ShellSideArm(u8 taskId) +{ + if (gSwapDamageCategory) + gBattleAnimArgs[0] = TRUE; + else + gBattleAnimArgs[0] = FALSE; + DestroyAnimVisualTask(taskId); +} + +void AnimTask_TerrainPulse(u8 taskId) +{ + if (IsBattlerTerrainAffected(gBattleAnimAttacker, STATUS_FIELD_TERRAIN_ANY)) + { + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) + gBattleAnimArgs[0] = TYPE_ELECTRIC; + else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) + gBattleAnimArgs[0] = TYPE_GRASS; + else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) + gBattleAnimArgs[0] = TYPE_FAIRY; + else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) + gBattleAnimArgs[0] = TYPE_PSYCHIC; + else //failsafe + gBattleAnimArgs[0] = 0; + } + else + { + gBattleAnimArgs[0] = 0; + } + DestroyAnimVisualTask(taskId); +} diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 207d1255d..f325cba07 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -2496,6 +2496,8 @@ void AnimTask_GetTrappedMoveAnimId(u8 taskId) gBattleAnimArgs[0] = TRAP_ANIM_CLAMP; else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_SAND_TOMB) gBattleAnimArgs[0] = TRAP_ANIM_SAND_TOMB; + else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_MAGMA_STORM) + gBattleAnimArgs[0] = TRAP_ANIM_MAGMA_STORM; else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_INFESTATION) gBattleAnimArgs[0] = TRAP_ANIM_INFESTATION; else diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 6cefba92a..c85a918da 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -136,6 +136,7 @@ void AnimTask_SetCamouflageBlend(u8 taskId) gBattleAnimArgs[4] = RGB(31, 31, 31); break; case BATTLE_TERRAIN_PLAIN: + default: gBattleAnimArgs[4] = RGB(31, 31, 31); break; } @@ -904,6 +905,12 @@ void AnimTask_GetBattleTerrain(u8 taskId) DestroyAnimVisualTask(taskId); } +void AnimTask_GetFieldTerrain(u8 taskId) +{ + gBattleAnimArgs[0] = gFieldStatuses & STATUS_FIELD_TERRAIN_ANY; + DestroyAnimVisualTask(taskId); +} + void AnimTask_AllocBackupPalBuffer(u8 taskId) { gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); diff --git a/src/battle_debug.c b/src/battle_debug.c index b34afe484..c967cfe00 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -559,7 +559,7 @@ static const struct BgTemplate sBgTemplates[] = }, { .bg = 1, - .charBaseIndex = 10, + .charBaseIndex = 2, .mapBaseIndex = 20, .screenSize = 0, .paletteMode = 0, diff --git a/src/battle_main.c b/src/battle_main.c index ad02854bd..84491987e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -232,6 +232,7 @@ EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA bool8 gHasFetchedBall = FALSE; EWRAM_DATA u8 gLastUsedBall = 0; EWRAM_DATA u16 gLastThrownBall = 0; +EWRAM_DATA bool8 gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky // IWRAM common vars void (*gPreBattleCallback1)(void); @@ -2933,12 +2934,16 @@ static void BattleStartClearSetData(void) gBattleStruct->mega.triggerSpriteId = 0xFF; + gBattleStruct->stickyWebUser = 0xFF; + for (i = 0; i < PARTY_SIZE; i++) { gBattleStruct->usedHeldItems[i][0] = 0; gBattleStruct->usedHeldItems[i][1] = 0; gBattleStruct->itemStolen[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); } + + gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky } void SwitchInClearSetData(void) @@ -3030,6 +3035,9 @@ void SwitchInClearSetData(void) gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; gBattleStruct->lastMoveFailed &= ~(gBitTable[gActiveBattler]); gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + + if (gActiveBattler == gBattleStruct->stickyWebUser) + gBattleStruct->stickyWebUser = 0xFF; // Switched into sticky web user slot so reset it for (i = 0; i < gBattlersCount; i++) { @@ -3079,35 +3087,35 @@ void FaintClearSetData(void) memset(&gDisableStructs[gActiveBattler], 0, sizeof(struct DisableStruct)); - gProtectStructs[gActiveBattler].protected = 0; - gProtectStructs[gActiveBattler].spikyShielded = 0; - gProtectStructs[gActiveBattler].kingsShielded = 0; - gProtectStructs[gActiveBattler].banefulBunkered = 0; - gProtectStructs[gActiveBattler].obstructed = 0; - gProtectStructs[gActiveBattler].endured = 0; - gProtectStructs[gActiveBattler].noValidMoves = 0; - gProtectStructs[gActiveBattler].helpingHand = 0; - gProtectStructs[gActiveBattler].bounceMove = 0; - gProtectStructs[gActiveBattler].stealMove = 0; - gProtectStructs[gActiveBattler].prlzImmobility = 0; - gProtectStructs[gActiveBattler].confusionSelfDmg = 0; - gProtectStructs[gActiveBattler].targetAffected = 0; - gProtectStructs[gActiveBattler].chargingTurn = 0; + gProtectStructs[gActiveBattler].protected = FALSE; + gProtectStructs[gActiveBattler].spikyShielded = FALSE; + gProtectStructs[gActiveBattler].kingsShielded = FALSE; + gProtectStructs[gActiveBattler].banefulBunkered = FALSE; + gProtectStructs[gActiveBattler].obstructed = FALSE; + gProtectStructs[gActiveBattler].endured = FALSE; + gProtectStructs[gActiveBattler].noValidMoves = FALSE; + gProtectStructs[gActiveBattler].helpingHand = FALSE; + gProtectStructs[gActiveBattler].bounceMove = FALSE; + gProtectStructs[gActiveBattler].stealMove = FALSE; + gProtectStructs[gActiveBattler].prlzImmobility = FALSE; + gProtectStructs[gActiveBattler].confusionSelfDmg = FALSE; + gProtectStructs[gActiveBattler].targetAffected = FALSE; + gProtectStructs[gActiveBattler].chargingTurn = FALSE; gProtectStructs[gActiveBattler].fleeFlag = 0; - gProtectStructs[gActiveBattler].usedImprisonedMove = 0; - gProtectStructs[gActiveBattler].loveImmobility = 0; - gProtectStructs[gActiveBattler].usedDisabledMove = 0; - gProtectStructs[gActiveBattler].usedTauntedMove = 0; - gProtectStructs[gActiveBattler].flag2Unknown = 0; - gProtectStructs[gActiveBattler].flinchImmobility = 0; - gProtectStructs[gActiveBattler].notFirstStrike = 0; - gProtectStructs[gActiveBattler].usedHealBlockedMove = 0; - gProtectStructs[gActiveBattler].usesBouncedMove = 0; - gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; - gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; - gProtectStructs[gActiveBattler].statRaised = 0; - gProtectStructs[gActiveBattler].statFell = 0; - gProtectStructs[gActiveBattler].pranksterElevated = 0; + gProtectStructs[gActiveBattler].usedImprisonedMove = FALSE; + gProtectStructs[gActiveBattler].loveImmobility = FALSE; + gProtectStructs[gActiveBattler].usedDisabledMove = FALSE; + gProtectStructs[gActiveBattler].usedTauntedMove = FALSE; + gProtectStructs[gActiveBattler].flag2Unknown = FALSE; + gProtectStructs[gActiveBattler].flinchImmobility = FALSE; + gProtectStructs[gActiveBattler].notFirstStrike = FALSE; + gProtectStructs[gActiveBattler].usedHealBlockedMove = FALSE; + gProtectStructs[gActiveBattler].usesBouncedMove = FALSE; + gProtectStructs[gActiveBattler].usedGravityPreventedMove = FALSE; + gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = FALSE; + gProtectStructs[gActiveBattler].statRaised = FALSE; + gProtectStructs[gActiveBattler].statFell = FALSE; + gProtectStructs[gActiveBattler].pranksterElevated = FALSE; gDisableStructs[gActiveBattler].isFirstTurn = 2; @@ -3127,6 +3135,9 @@ void FaintClearSetData(void) gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + + if (gActiveBattler == gBattleStruct->stickyWebUser) + gBattleStruct->stickyWebUser = 0xFF; // User of sticky web fainted, so reset the stored battler ID for (i = 0; i < gBattlersCount; i++) { @@ -4418,7 +4429,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) || (!IsAbilityOnOpposingSide(battler1, ABILITY_UNNERVE) && holdEffectBattler1 == HOLD_EFFECT_CUSTAP_BERRY && HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item)))) - gProtectStructs[battler1].custap = TRUE; + gProtectStructs[battler1].usedCustapBerry = TRUE; // Battler 2 speedBattler2 = GetBattlerTotalSpeedStat(battler2); @@ -4432,7 +4443,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) || (!IsAbilityOnOpposingSide(battler2, ABILITY_UNNERVE) && holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY && HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item)))) - gProtectStructs[battler2].custap = TRUE; + gProtectStructs[battler2].usedCustapBerry = TRUE; if (!ignoreChosenMoves) { @@ -4452,9 +4463,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) strikesFirst = 0; else if (!gProtectStructs[battler1].quickDraw && gProtectStructs[battler2].quickDraw) strikesFirst = 1; - else if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap) + else if (gProtectStructs[battler1].usedCustapBerry && !gProtectStructs[battler2].usedCustapBerry) strikesFirst = 0; - else if (gProtectStructs[battler2].custap && !gProtectStructs[battler1].custap) + else if (gProtectStructs[battler2].usedCustapBerry && !gProtectStructs[battler1].usedCustapBerry) strikesFirst = 1; else if (holdEffectBattler1 == HOLD_EFFECT_LAGGING_TAIL && holdEffectBattler2 != HOLD_EFFECT_LAGGING_TAIL) strikesFirst = 1; @@ -4615,10 +4626,10 @@ static void TurnValuesCleanUp(bool8 var0) { if (var0) { - gProtectStructs[gActiveBattler].protected = 0; - gProtectStructs[gActiveBattler].spikyShielded = 0; - gProtectStructs[gActiveBattler].kingsShielded = 0; - gProtectStructs[gActiveBattler].banefulBunkered = 0; + gProtectStructs[gActiveBattler].protected = FALSE; + gProtectStructs[gActiveBattler].spikyShielded = FALSE; + gProtectStructs[gActiveBattler].kingsShielded = FALSE; + gProtectStructs[gActiveBattler].banefulBunkered = FALSE; } else { @@ -4713,14 +4724,14 @@ 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].quickDraw) + && (gProtectStructs[gActiveBattler].usedCustapBerry || gProtectStructs[gActiveBattler].quickDraw) && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - if (gProtectStructs[gActiveBattler].custap) + if (gProtectStructs[gActiveBattler].usedCustapBerry) { - gProtectStructs[gActiveBattler].custap = FALSE; + gProtectStructs[gActiveBattler].usedCustapBerry = FALSE; gLastUsedItem = gBattleMons[gActiveBattler].item; PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) @@ -5130,7 +5141,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) gBattleStruct->dynamicMoveType = 0; gBattleStruct->ateBoost[battlerAtk] = 0; - gSpecialStatuses[battlerAtk].gemBoost = 0; + gSpecialStatuses[battlerAtk].gemBoost = FALSE; if (gBattleMoves[move].effect == EFFECT_WEATHER_BALL) { @@ -5181,6 +5192,22 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) if (ItemId_GetPocket(gBattleMons[battlerAtk].item) == POCKET_BERRIES) gBattleStruct->dynamicMoveType = gNaturalGiftTable[ITEM_TO_BERRY(gBattleMons[battlerAtk].item)].type; } + else if (gBattleMoves[move].effect == EFFECT_TERRAIN_PULSE) + { + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_TERRAIN_ANY)) + { + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | 0x80; + else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_GRASS | 0x80; + else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_FAIRY | 0x80; + else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_PSYCHIC | 0x80; + else //failsafe + gBattleStruct->dynamicMoveType = TYPE_NORMAL | 0x80; + } + } attackerAbility = GetBattlerAbility(battlerAtk); GET_MOVE_TYPE(move, moveType); @@ -5221,6 +5248,10 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) { gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC; } + else if (move == MOVE_AURA_WHEEL && gBattleMons[battlerAtk].species == SPECIES_MORPEKO_HANGRY) + { + gBattleStruct->dynamicMoveType = 0x80 | TYPE_DARK; + } // Check if a gem should activate. GET_MOVE_TYPE(move, moveType); @@ -5228,7 +5259,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) && moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item)) { gSpecialStatuses[battlerAtk].gemParam = GetBattlerHoldEffectParam(battlerAtk); - gSpecialStatuses[battlerAtk].gemBoost = 1; + gSpecialStatuses[battlerAtk].gemBoost = TRUE; } } diff --git a/src/battle_message.c b/src/battle_message.c index 37919ddca..f52f6be7e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -725,9 +725,15 @@ static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way i static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); static const u8 sText_AbilityAllowsOnlyMove[] = _("{B_ATK_ABILITY} allows the\nuse of only {B_CURRENT_MOVE}!\p"); static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped Abilities\nwith its target!"); +static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!"); +static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!"); +static const u8 sText_BattlerTypeChangedTo[] = _("{B_BUFF1}'s type\nchanged to {B_BUFF2}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_BATTLERTYPECHANGEDTO - 12] = sText_BattlerTypeChangedTo, + [STRINGID_PASTELVEILENTERS - 12] = sText_PastelVeilEnters, + [STRINGID_PASTELVEILPROTECTED -12] = sText_PastelVeilProtected, [STRINGID_SWAPPEDABILITIES - 12] = sText_SwappedAbilities, [STRINGID_ABILITYALLOWSONLYMOVE - 12] = sText_AbilityAllowsOnlyMove, [STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection, @@ -1194,7 +1200,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PKMNTWISTEDDIMENSIONS - 12] = sText_PkmnTwistedDimensions, [STRINGID_POINTEDSTONESFLOAT - 12] = sText_PointedStonesFloat, [STRINGID_CLOAKEDINMYSTICALMOONLIGHT - 12] = sText_CloakedInMysticalMoonlight, - [STRINGID_TRAPPERBYSWIRLINGMAGMA - 12] = sText_TrappedBySwirlingMagma, + [STRINGID_TRAPPEDBYSWIRLINGMAGMA - 12] = sText_TrappedBySwirlingMagma, [STRINGID_VANISHEDINSTANTLY - 12] = sText_VanishedInstantly, [STRINGID_PROTECTEDTEAM - 12] = sText_ProtectedTeam, [STRINGID_SHAREDITSGUARD - 12] = sText_SharedItsGuard, @@ -1375,6 +1381,7 @@ const u16 gSwitchInAbilityStringIds[] = [B_MSG_SWITCHIN_SCREENCLEANER] = STRINGID_SCREENCLEANERENTERS, [B_MSG_SWITCHIN_ASONE] = STRINGID_ASONEENTERS, [B_MSG_SWITCHIN_CURIOUS_MEDICINE] = STRINGID_CURIOUSMEDICINEENTERS, + [B_MSG_SWITCHIN_PASTEL_VEIL] = STRINGID_PASTELVEILENTERS, }; const u16 gMissStringIds[] = @@ -1528,16 +1535,17 @@ const u16 gFirstTurnOfTwoStringIds[] = [B_MSG_TURN1_FREEZE_SHOCK] = STRINGID_CLOAKEDINAFREEZINGLIGHT, }; -// Index copied from move's index in gTrappingMoves +// Index copied from move's index in sTrappingMoves const u16 gWrappedStringIds[] = { - STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND - STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP - STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_FIRE_SPIN - STRINGID_PKMNCLAMPED, // MOVE_CLAMP - STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_WHIRLPOOL - STRINGID_PKMNTRAPPEDBYSANDTOMB,// MOVE_SAND_TOMB - STRINGID_INFESTATION, // MOVE_INFESTATION + STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND + STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP + STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_FIRE_SPIN + STRINGID_PKMNCLAMPED, // MOVE_CLAMP + STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_WHIRLPOOL + STRINGID_PKMNTRAPPEDBYSANDTOMB, // MOVE_SAND_TOMB + STRINGID_TRAPPEDBYSWIRLINGMAGMA, // MOVE_MAGMA_STORM + STRINGID_INFESTATION, // MOVE_INFESTATION }; const u16 gMistUsedStringIds[] = @@ -1748,11 +1756,6 @@ const u16 gCaughtMonStringIds[] = [B_MSG_LANETTES_BOX_FULL] = STRINGID_PKMNBOXLANETTESPCFULL, }; -const u16 gTrappingMoves[] = -{ - MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_INFESTATION, 0xFFFF -}; - const u16 gRoomsStringIds[] = { STRINGID_PKMNTWISTEDDIMENSIONS, STRINGID_TRICKROOMENDS, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9e779da1b..93e1b31e2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -54,6 +54,7 @@ #include "constants/rgb.h" #include "data.h" #include "constants/party_menu.h" +#include "battle_util.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; @@ -278,6 +279,11 @@ static const s32 sExperienceScalingFactors[] = 159767, }; +static const u16 sTrappingMoves[] = +{ + MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, 0xFFFF +}; + #define STAT_CHANGE_WORKED 0 #define STAT_CHANGE_DIDNT_WORK 1 @@ -1091,18 +1097,76 @@ static const u16 sMoveEffectsForbiddenToInstruct[] = FORBIDDEN_INSTRUCT_END }; -static const u16 sNaturePowerMoves[] = +static const u16 sNaturePowerMoves[BATTLE_TERRAIN_COUNT] = { +#if B_NATURE_POWER_MOVES >= GEN_7 [BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL, [BATTLE_TERRAIN_LONG_GRASS] = MOVE_ENERGY_BALL, [BATTLE_TERRAIN_SAND] = MOVE_EARTH_POWER, - [BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTH_POWER, - [BATTLE_TERRAIN_CAVE] = MOVE_POWER_GEM, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTH_POWER, [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, - [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK + [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SNOW] = MOVE_ICE_BEAM, +#elif B_NATURE_POWER_MOVES == GEN_6 + [BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_ENERGY_BALL, + [BATTLE_TERRAIN_SAND] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SNOW] = MOVE_FROST_BREATH, +#elif B_NATURE_POWER_MOVES == GEN_5 + [BATTLE_TERRAIN_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#elif B_NATURE_POWER_MOVES == GEN_4 + [BATTLE_TERRAIN_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_CAVE] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#else // Gen 1-3 + [BATTLE_TERRAIN_GRASS] = MOVE_STUN_SPORE, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_RAZOR_LEAF, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_SURF, + [BATTLE_TERRAIN_POND] = MOVE_BUBBLE_BEAM, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_CAVE] = MOVE_SHADOW_BALL, + [BATTLE_TERRAIN_BUILDING] = MOVE_SWIFT, + [BATTLE_TERRAIN_PLAIN] = MOVE_SWIFT, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#endif + [BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_SOARING] = MOVE_AIR_SLASH, + [BATTLE_TERRAIN_SKY_PILLAR] = MOVE_AIR_SLASH, + [BATTLE_TERRAIN_BURIAL_GROUND] = MOVE_SHADOW_BALL, + [BATTLE_TERRAIN_PUDDLE] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_MARSH] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_SWAMP] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_ICE] = MOVE_ICE_BEAM, + [BATTLE_TERRAIN_VOLCANO] = MOVE_LAVA_PLUME, + [BATTLE_TERRAIN_DISTORTION_WORLD] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SPACE] = MOVE_DRACO_METEOR, + [BATTLE_TERRAIN_ULTRA_SPACE] = MOVE_PSYSHOCK, }; static const u16 sPickupItems[] = @@ -1147,18 +1211,38 @@ static const u8 sPickupProbabilities[] = 30, 40, 50, 60, 70, 80, 90, 94, 98 }; -static const u8 sTerrainToType[] = +static const u8 sTerrainToType[BATTLE_TERRAIN_COUNT] = { - [BATTLE_TERRAIN_GRASS] = TYPE_GRASS, - [BATTLE_TERRAIN_LONG_GRASS] = TYPE_GRASS, - [BATTLE_TERRAIN_SAND] = TYPE_GROUND, - [BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER, - [BATTLE_TERRAIN_WATER] = TYPE_WATER, - [BATTLE_TERRAIN_POND] = TYPE_WATER, - [BATTLE_TERRAIN_MOUNTAIN] = TYPE_GROUND, - [BATTLE_TERRAIN_CAVE] = TYPE_ROCK, - [BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL, - [BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL, + [BATTLE_TERRAIN_GRASS] = TYPE_GRASS, + [BATTLE_TERRAIN_LONG_GRASS] = TYPE_GRASS, + [BATTLE_TERRAIN_SAND] = TYPE_GROUND, + [BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER, + [BATTLE_TERRAIN_WATER] = TYPE_WATER, + [BATTLE_TERRAIN_POND] = TYPE_WATER, + [BATTLE_TERRAIN_CAVE] = TYPE_ROCK, + [BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL, + [BATTLE_TERRAIN_SOARING] = TYPE_FLYING, + [BATTLE_TERRAIN_SKY_PILLAR] = TYPE_FLYING, + [BATTLE_TERRAIN_BURIAL_GROUND] = TYPE_GHOST, + [BATTLE_TERRAIN_PUDDLE] = TYPE_GROUND, + [BATTLE_TERRAIN_MARSH] = TYPE_GROUND, + [BATTLE_TERRAIN_SWAMP] = TYPE_GROUND, + [BATTLE_TERRAIN_SNOW] = TYPE_ICE, + [BATTLE_TERRAIN_ICE] = TYPE_ICE, + [BATTLE_TERRAIN_VOLCANO] = TYPE_FIRE, + [BATTLE_TERRAIN_DISTORTION_WORLD] = TYPE_NORMAL, + [BATTLE_TERRAIN_SPACE] = TYPE_DRAGON, + [BATTLE_TERRAIN_ULTRA_SPACE] = TYPE_PSYCHIC, +#if B_CAMOUFLAGE_TYPES >= GEN_5 + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_GROUND, + [BATTLE_TERRAIN_PLAIN] = TYPE_GROUND, +#elif B_CAMOUFLAGE_TYPES == GEN_4 + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK, + [BATTLE_TERRAIN_PLAIN] = TYPE_GROUND, +#else + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK, + [BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL, +#endif }; // - ITEM_ULTRA_BALL skips Master Ball and ITEM_NONE @@ -1436,8 +1520,8 @@ static void Cmd_attackcanceler(void) && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT); - gProtectStructs[gBattlerTarget].bounceMove = 0; - gProtectStructs[gBattlerTarget].usesBouncedMove = 1; + gProtectStructs[gBattlerTarget].bounceMove = FALSE; + gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 0; if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE)) { @@ -1457,7 +1541,7 @@ static void Cmd_attackcanceler(void) && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { RecordAbilityBattle(gBattlerTarget, ABILITY_MAGIC_BOUNCE); - gProtectStructs[gBattlerTarget].usesBouncedMove = 1; + gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; @@ -1469,7 +1553,7 @@ static void Cmd_attackcanceler(void) if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED) { PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH); - gProtectStructs[gBattlerByTurnOrder[i]].stealMove = 0; + gProtectStructs[gBattlerByTurnOrder[i]].stealMove = FALSE; gBattleScripting.battler = gBattlerByTurnOrder[i]; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SnatchedMove; @@ -1479,7 +1563,7 @@ static void Cmd_attackcanceler(void) if (gSpecialStatuses[gBattlerTarget].lightningRodRedirected) { - gSpecialStatuses[gBattlerTarget].lightningRodRedirected = 0; + gSpecialStatuses[gBattlerTarget].lightningRodRedirected = FALSE; gLastUsedAbility = ABILITY_LIGHTNING_ROD; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_TookAttack; @@ -1487,7 +1571,7 @@ static void Cmd_attackcanceler(void) } else if (gSpecialStatuses[gBattlerTarget].stormDrainRedirected) { - gSpecialStatuses[gBattlerTarget].stormDrainRedirected = 0; + gSpecialStatuses[gBattlerTarget].stormDrainRedirected = FALSE; gLastUsedAbility = ABILITY_STORM_DRAIN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_TookAttack; @@ -1498,8 +1582,8 @@ static void Cmd_attackcanceler(void) && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))) && gBattleMoves[gCurrentMove].effect != EFFECT_SUCKER_PUNCH) { - if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) - gProtectStructs[gBattlerAttacker].touchedProtectLike = 1; + if (IsMoveMakingContact(gCurrentMove, gBattlerAttacker)) + gProtectStructs[gBattlerAttacker].touchedProtectLike = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; @@ -1682,9 +1766,9 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move) else if (atkHoldEffect == HOLD_EFFECT_ZOOM_LENS && GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef)); calc = (calc * (100 + atkParam)) / 100; - if (gProtectStructs[battlerAtk].micle) + if (gProtectStructs[battlerAtk].usedMicleBerry) { - gProtectStructs[battlerAtk].micle = FALSE; + gProtectStructs[battlerAtk].usedMicleBerry = FALSE; if (atkAbility == ABILITY_RIPEN) calc = (calc * 140) / 100; // ripen gives 40% acc boost else @@ -1789,7 +1873,7 @@ static void Cmd_ppreduce(void) if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattlerAttacker].pp[gCurrMovePos]) { - gProtectStructs[gBattlerAttacker].notFirstStrike = 1; + gProtectStructs[gBattlerAttacker].notFirstStrike = TRUE; // For item Metronome, echoed voice if (gCurrentMove == gLastResultingMoves[gBattlerAttacker] && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) @@ -1936,17 +2020,17 @@ static void Cmd_adjustdamage(void) if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param) { RecordItemEffectBattle(gBattlerTarget, holdEffect); - gSpecialStatuses[gBattlerTarget].focusBanded = 1; + gSpecialStatuses[gBattlerTarget].focusBanded = TRUE; } else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget)) { RecordItemEffectBattle(gBattlerTarget, holdEffect); - gSpecialStatuses[gBattlerTarget].focusSashed = 1; + gSpecialStatuses[gBattlerTarget].focusSashed = TRUE; } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STURDY && BATTLER_MAX_HP(gBattlerTarget)) { RecordAbilityBattle(gBattlerTarget, ABILITY_STURDY); - gSpecialStatuses[gBattlerTarget].sturdied = 1; + gSpecialStatuses[gBattlerTarget].sturdied = TRUE; } if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE @@ -2026,7 +2110,7 @@ static void Cmd_multihitresultmessage(void) if (gMoveResultFlags & MOVE_RESULT_STURDIED) { gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].sturdied = 0; // Delete this line to make Sturdy last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].sturdied = FALSE; // Delete this line to make Sturdy last for the duration of the whole move turn. BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SturdiedMsg; return; @@ -2036,8 +2120,8 @@ static void Cmd_multihitresultmessage(void) gLastUsedItem = gBattleMons[gBattlerTarget].item; gPotentialItemEffectBattler = gBattlerTarget; gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].focusBanded = 0; // Delete this line to make Focus Band last for the duration of the whole move turn. - gSpecialStatuses[gBattlerTarget].focusSashed = 0; // Delete this line to make Focus Sash last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].focusBanded = FALSE; // Delete this line to make Focus Band last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].focusSashed = FALSE; // Delete this line to make Focus Sash last for the duration of the whole move turn. BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_HangedOnMsg; return; @@ -2049,7 +2133,7 @@ static void Cmd_multihitresultmessage(void) if (gSpecialStatuses[gBattlerTarget].berryReduced && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString; } @@ -2401,7 +2485,7 @@ static void Cmd_resultmessage(void) else if (gMoveResultFlags & MOVE_RESULT_STURDIED) { gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].sturdied = 0; + gSpecialStatuses[gBattlerTarget].sturdied = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SturdiedMsg; return; @@ -2443,7 +2527,7 @@ static void Cmd_resultmessage(void) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { gLastUsedItem = gBattleMons[gBattlerTarget].item; - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString; } @@ -2585,6 +2669,8 @@ void SetMoveEffect(bool32 primary, u32 certain) { s32 i, byTwo, affectsUser = 0; bool32 statusChanged = FALSE; + bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR); + u32 flags = 0; switch (gBattleScripting.moveEffect) // Set move effects which happen later on { @@ -2683,15 +2769,13 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT; RESET_RETURN } - if (!CanPoisonType(gBattleScripting.battler, gEffectBattler)) - break; - if (!CanBePoisoned(gEffectBattler)) + if (!CanBePoisoned(gBattleScripting.battler, gEffectBattler)) break; statusChanged = TRUE; break; case STATUS1_BURN: - if (gCurrentMove == MOVE_BURNING_JEALOUSY && gProtectStructs[gEffectBattler].statRaised == 0) + if (gCurrentMove == MOVE_BURNING_JEALOUSY && !gProtectStructs[gEffectBattler].statRaised) break; if ((GetBattlerAbility(gEffectBattler) == ABILITY_WATER_VEIL || GetBattlerAbility(gEffectBattler) == ABILITY_WATER_BUBBLE) @@ -2810,11 +2894,8 @@ void SetMoveEffect(bool32 primary, u32 certain) } if (gBattleMons[gEffectBattler].status1) break; - if (CanPoisonType(gBattleScripting.battler, gEffectBattler)) + if (CanBePoisoned(gBattleScripting.battler, gEffectBattler)) { - if (!CanBePoisoned(gEffectBattler)) - break; - // It's redundant, because at this point we know the status1 value is 0. gBattleMons[gEffectBattler].status1 &= ~(STATUS1_TOXIC_POISON); gBattleMons[gEffectBattler].status1 &= ~(STATUS1_POISON); @@ -2956,7 +3037,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_CHARGING: gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gEffectBattler] = gCurrentMove; - gProtectStructs[gEffectBattler].chargingTurn = 1; + gProtectStructs[gEffectBattler].chargingTurn = TRUE; gBattlescriptCurrInstr++; break; case MOVE_EFFECT_WRAP: @@ -2980,9 +3061,9 @@ void SetMoveEffect(bool32 primary, u32 certain) for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > 5) + if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves) - 1) break; - if (gTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) + if (sTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; } } @@ -2994,7 +3075,8 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_PLUS_1: case MOVE_EFFECT_ACC_PLUS_1: case MOVE_EFFECT_EVS_PLUS_1: - if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1), + if (NoAliveMonsForEitherParty() + || ChangeStatBuffs(SET_STAT_BUFF_VALUE(1), gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_1 + 1, affectsUser, 0)) { @@ -3015,11 +3097,16 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_1: case MOVE_EFFECT_ACC_MINUS_1: case MOVE_EFFECT_EVS_MINUS_1: + flags = affectsUser; + if (mirrorArmorReflected && !affectsUser) + flags |= STAT_BUFF_ALLOW_PTR; + if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE, - gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1, - affectsUser, 0)) + gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1, + flags, gBattlescriptCurrInstr + 1)) { - gBattlescriptCurrInstr++; + if (!mirrorArmorReflected) + gBattlescriptCurrInstr++; } else { @@ -3036,7 +3123,8 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_PLUS_2: case MOVE_EFFECT_ACC_PLUS_2: case MOVE_EFFECT_EVS_PLUS_2: - if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2), + if (NoAliveMonsForEitherParty() + || ChangeStatBuffs(SET_STAT_BUFF_VALUE(2), gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_2 + 1, affectsUser, 0)) { @@ -3057,11 +3145,15 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_2: case MOVE_EFFECT_ACC_MINUS_2: case MOVE_EFFECT_EVS_MINUS_2: + flags = affectsUser; + if (mirrorArmorReflected && !affectsUser) + flags |= STAT_BUFF_ALLOW_PTR; if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE, gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_2 + 1, - affectsUser, 0)) + flags, gBattlescriptCurrInstr + 1)) { - gBattlescriptCurrInstr++; + if (!mirrorArmorReflected) + gBattlescriptCurrInstr++; } else { @@ -3146,8 +3238,15 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_ALL_STATS_UP: - BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_AllStatsUp; + if (NoAliveMonsForEitherParty()) + { + gBattlescriptCurrInstr++; + } + else + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_AllStatsUp; + } break; case MOVE_EFFECT_RAPIDSPIN: BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -3281,15 +3380,15 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_FEINT: if (IS_BATTLER_PROTECTED(gBattlerTarget)) { - gProtectStructs[gBattlerTarget].protected = 0; + gProtectStructs[gBattlerTarget].protected = FALSE; gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_QUICK_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_CRAFTY_SHIELD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_MAT_BLOCK); - gProtectStructs[gBattlerTarget].spikyShielded = 0; - gProtectStructs[gBattlerTarget].kingsShielded = 0; - gProtectStructs[gBattlerTarget].banefulBunkered = 0; - gProtectStructs[gBattlerTarget].obstructed = 0; + gProtectStructs[gBattlerTarget].spikyShielded = FALSE; + gProtectStructs[gBattlerTarget].kingsShielded = FALSE; + gProtectStructs[gBattlerTarget].banefulBunkered = FALSE; + gProtectStructs[gBattlerTarget].obstructed = FALSE; if (gCurrentMove == MOVE_FEINT) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -3393,6 +3492,21 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite; } break; + case MOVE_EFFECT_RELIC_SONG: + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SHEER_FORCE) + { + if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA) + { + gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA_PIROUETTE; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + } + else if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA_PIROUETTE) + { + gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + } + } + break; } } } @@ -4842,7 +4956,7 @@ static void Cmd_moveend(void) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -4853,7 +4967,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].kingsShielded) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable @@ -4864,7 +4978,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].banefulBunkered) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER); BattleScriptPushCursor(); @@ -5024,7 +5138,7 @@ static void Cmd_moveend(void) BtlController_EmitSpriteInvisibility(0, FALSE); MarkBattlerForControllerExec(gActiveBattler); gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE); - gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = 1; + gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = TRUE; gBattleScripting.moveendState++; return; } @@ -5130,7 +5244,7 @@ static void Cmd_moveend(void) // Set a flag if move hits either target (for throat spray that can't check damage) if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) - gProtectStructs[gBattlerAttacker].targetAffected = 1; + gProtectStructs[gBattlerAttacker].targetAffected = TRUE; if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE @@ -5328,7 +5442,7 @@ static void Cmd_moveend(void) { gBattleScripting.savedBattler = gBattlerTarget | 0x4; gBattleScripting.savedBattler |= (gBattlerAttacker << 4); - gSpecialStatuses[gBattlerAttacker].dancerUsedMove = 1; + gSpecialStatuses[gBattlerAttacker].dancerUsedMove = TRUE; } for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { @@ -5376,13 +5490,13 @@ static void Cmd_moveend(void) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3; if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3; - gProtectStructs[gBattlerAttacker].usesBouncedMove = 0; - gProtectStructs[gBattlerAttacker].targetAffected = 0; + gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE; + gProtectStructs[gBattlerAttacker].targetAffected = FALSE; gBattleStruct->ateBoost[gBattlerAttacker] = 0; gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST); - gSpecialStatuses[gBattlerAttacker].gemBoost = 0; + gSpecialStatuses[gBattlerAttacker].gemBoost = FALSE; gSpecialStatuses[gBattlerAttacker].damagedMons = 0; - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; gBattleScripting.moveEffect = 0; gBattleScripting.moveendState++; break; @@ -7223,19 +7337,19 @@ static void HandleTerrainMove(u32 moveEffect) switch (moveEffect) { case EFFECT_MISTY_TERRAIN: - statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.mistyTerrainTimer; + statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 0; break; case EFFECT_GRASSY_TERRAIN: - statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.grassyTerrainTimer; + statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 1; break; case EFFECT_ELECTRIC_TERRAIN: - statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.electricTerrainTimer; + statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 2; break; case EFFECT_PSYCHIC_TERRAIN: - statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.psychicTerrainTimer; + statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 3; break; } @@ -7258,9 +7372,8 @@ static void HandleTerrainMove(u32 moveEffect) bool32 CanPoisonType(u8 battlerAttacker, u8 battlerTarget) { - return (GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION - || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) - || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); + return ((GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS) + || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); } bool32 CanParalyzeType(u8 battlerAttacker, u8 battlerTarget) @@ -7654,9 +7767,9 @@ static void Cmd_various(void) gBattleCommunication[0] = FALSE; break; case VARIOUS_RESET_INTIMIDATE_TRACE_BITS: - gSpecialStatuses[gActiveBattler].intimidatedMon = 0; - gSpecialStatuses[gActiveBattler].traced = 0; - gSpecialStatuses[gActiveBattler].switchInAbilityDone = 0; + gSpecialStatuses[gActiveBattler].intimidatedMon = FALSE; + gSpecialStatuses[gActiveBattler].traced = FALSE; + gSpecialStatuses[gActiveBattler].switchInAbilityDone = FALSE; break; case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP: if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId) @@ -8282,6 +8395,9 @@ static void Cmd_various(void) case VARIOUS_ARGUMENT_STATUS_EFFECT: switch (gBattleMoves[gCurrentMove].argument) { + case STATUS1_SLEEP: + gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; + break; case STATUS1_BURN: gBattleScripting.moveEffect = MOVE_EFFECT_BURN; break; @@ -8829,23 +8945,20 @@ static void Cmd_various(void) else gBattlescriptCurrInstr += 7; // can heal return; - case VARIOUS_REMOVE_TERRAIN: + case VARIOUS_REMOVE_TERRAIN: + gFieldTimers.terrainTimer = 0; switch (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) { case STATUS_FIELD_MISTY_TERRAIN: - gFieldTimers.mistyTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0; break; case STATUS_FIELD_GRASSY_TERRAIN: - gFieldTimers.grassyTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 1; break; case STATUS_FIELD_ELECTRIC_TERRAIN: - gFieldTimers.electricTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 2; break; case STATUS_FIELD_PSYCHIC_TERRAIN: - gFieldTimers.psychicTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 3; break; default: @@ -8853,6 +8966,7 @@ static void Cmd_various(void) break; } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain + TryToRevertMimicry(); // restore the types of Pokémon with Mimicry break; case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE)) @@ -8993,6 +9107,61 @@ static void Cmd_various(void) else gBattlescriptCurrInstr += 9; return; + case VARIOUS_PHOTON_GEYSER_CHECK: + { + u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack; + u8 attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack; + + gSwapDamageCategory = FALSE; + + attackerAtkStat *= gStatStageRatios[attackerAtkStage][0]; + attackerAtkStat /= gStatStageRatios[attackerAtkStage][1]; + + attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + attackerSpAtkStat *= gStatStageRatios[attackerAtkStage][0]; + attackerSpAtkStat /= gStatStageRatios[attackerAtkStage][1]; + + if (attackerAtkStat > attackerSpAtkStat) + gSwapDamageCategory = TRUE; + break; + } + case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment + { + u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack; + u32 targetDefStat = gBattleMons[gBattlerTarget].defense; + u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack; + u32 targetSpDefStat = gBattleMons[gBattlerTarget].spDefense; + u8 statStage; + u32 physical; + u32 special; + + gSwapDamageCategory = FALSE; + + statStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + attackerAtkStat *= gStatStageRatios[statStage][0]; + attackerAtkStat /= gStatStageRatios[statStage][1]; + + statStage = gBattleMons[gBattlerTarget].statStages[STAT_DEF]; + targetDefStat *= gStatStageRatios[statStage][0]; + targetDefStat /= gStatStageRatios[statStage][1]; + + physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attackerAtkStat) / targetDefStat) / 50); + + statStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + attackerSpAtkStat *= gStatStageRatios[statStage][0]; + attackerSpAtkStat /= gStatStageRatios[statStage][1]; + + statStage = gBattleMons[gBattlerTarget].statStages[STAT_SPDEF]; + targetSpDefStat *= gStatStageRatios[statStage][0]; + targetSpDefStat /= gStatStageRatios[statStage][1]; + + special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attackerSpAtkStat) / targetSpDefStat) / 50); + + if (((physical > special) || (physical == special && (Random() % 2) == 0))) + gSwapDamageCategory = TRUE; + break; + } case VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED: if (IsLeafGuardProtected(gActiveBattler)) { @@ -9004,6 +9173,29 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; } return; + case VARIOUS_SET_ATTACKER_STICKY_WEB_USER: + // For Mirror Armor: "If the Pokémon with this Ability is affected by Sticky Web, the effect is reflected back to the Pokémon which set it up. + // If Pokémon which set up Sticky Web is not on the field, no Pokémon have their Speed lowered." + gBattlerAttacker = gBattlerTarget; // Initialize 'fail' condition + SET_STATCHANGER(STAT_SPEED, 1, TRUE); + if (gBattleStruct->stickyWebUser != 0xFF) + gBattlerAttacker = gBattleStruct->stickyWebUser; + break; + case VARIOUS_TRY_TO_APPLY_MIMICRY: + { + bool8 isMimicryDone = FALSE; + + if (GetBattlerAbility(gActiveBattler) == ABILITY_MIMICRY) + { + TryToApplyMimicry(gActiveBattler, TRUE); + isMimicryDone = TRUE; + } + if (!isMimicryDone) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + else + gBattlescriptCurrInstr += 7; + return; + } } gBattlescriptCurrInstr += 3; @@ -9026,32 +9218,32 @@ static void Cmd_setprotectlike(void) { if (gBattleMoves[gCurrentMove].effect == EFFECT_ENDURE) { - gProtectStructs[gBattlerAttacker].endured = 1; + gProtectStructs[gBattlerAttacker].endured = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BRACED_ITSELF; } else if (gCurrentMove == MOVE_DETECT || gCurrentMove == MOVE_PROTECT) { - gProtectStructs[gBattlerAttacker].protected = 1; + gProtectStructs[gBattlerAttacker].protected = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_SPIKY_SHIELD) { - gProtectStructs[gBattlerAttacker].spikyShielded = 1; + gProtectStructs[gBattlerAttacker].spikyShielded = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_KINGS_SHIELD) { - gProtectStructs[gBattlerAttacker].kingsShielded = 1; + gProtectStructs[gBattlerAttacker].kingsShielded = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_BANEFUL_BUNKER) { - gProtectStructs[gBattlerAttacker].banefulBunkered = 1; + gProtectStructs[gBattlerAttacker].banefulBunkered = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_OBSTRUCT) { - gProtectStructs[gBattlerAttacker].obstructed = 1; + gProtectStructs[gBattlerAttacker].obstructed = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } @@ -9216,7 +9408,7 @@ static void Cmd_trymirrormove(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr++; } } @@ -9537,8 +9729,9 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr bool32 certain = FALSE; bool32 notProtectAffected = FALSE; u32 index; + bool32 affectsUser = (flags & MOVE_EFFECT_AFFECTS_USER); - if (flags & MOVE_EFFECT_AFFECTS_USER) + if (affectsUser) gActiveBattler = gBattlerAttacker; else gActiveBattler = gBattlerTarget; @@ -9584,7 +9777,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; gBattlescriptCurrInstr = BattleScript_MistProtected; - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -9614,7 +9807,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlescriptCurrInstr = BattleScript_AbilityNoStatLoss; gLastUsedAbility = GetBattlerAbility(gActiveBattler); RecordAbilityBattle(gActiveBattler, gLastUsedAbility); - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -9634,13 +9827,14 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlerAbility = index - 1; gBattlescriptCurrInstr = BattleScript_FlowerVeilProtectsRet; gLastUsedAbility = ABILITY_FLOWER_VEIL; - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; } - else if (GetBattlerAbility(gActiveBattler) == ABILITY_KEEN_EYE - && !certain && statId == STAT_ACC) + else if (!certain + && ((GetBattlerAbility(gActiveBattler) == ABILITY_KEEN_EYE && statId == STAT_ACC) + || (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER && statId == STAT_ATK))) { if (flags == STAT_BUFF_ALLOW_PTR) { @@ -9653,17 +9847,16 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } return STAT_CHANGE_DIDNT_WORK; } - else if (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER - && !certain && statId == STAT_ATK) + else if (GetBattlerAbility(gActiveBattler) == ABILITY_MIRROR_ARMOR && !affectsUser && gBattlerAttacker != gBattlerTarget && gActiveBattler == gBattlerTarget) { if (flags == STAT_BUFF_ALLOW_PTR) { + SET_STATCHANGER(statId, GET_STAT_BUFF_VALUE(statValue) | STAT_BUFF_NEGATIVE, TRUE); BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; gBattlerAbility = gActiveBattler; - gBattlescriptCurrInstr = BattleScript_AbilityNoSpecificStatLoss; - gLastUsedAbility = GetBattlerAbility(gActiveBattler); - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + gBattlescriptCurrInstr = BattleScript_MirrorArmorReflect; + RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); } return STAT_CHANGE_DIDNT_WORK; } @@ -9708,7 +9901,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } else { - gProtectStructs[gActiveBattler].statFell = 1; // Eject pack, lash out + gProtectStructs[gActiveBattler].statFell = TRUE; // Eject pack, lash out gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } } @@ -9751,7 +9944,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr else { gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); - gProtectStructs[gActiveBattler].statRaised = 1; + gProtectStructs[gActiveBattler].statRaised = TRUE; } } @@ -10206,12 +10399,12 @@ static void Cmd_tryKO(void) if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < GetBattlerHoldEffectParam(gBattlerTarget)) { - gSpecialStatuses[gBattlerTarget].focusBanded = 1; + gSpecialStatuses[gBattlerTarget].focusBanded = TRUE; RecordItemEffectBattle(gBattlerTarget, holdEffect); } else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget)) { - gSpecialStatuses[gBattlerTarget].focusSashed = 1; + gSpecialStatuses[gBattlerTarget].focusSashed = TRUE; RecordItemEffectBattle(gBattlerTarget, holdEffect); } @@ -10625,7 +10818,7 @@ static void Cmd_counterdamagecalculator(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -10650,7 +10843,7 @@ static void Cmd_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the phy } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -11140,7 +11333,7 @@ static void Cmd_trysetspikes(void) if (gSideTimers[targetSide].spikesAmount == 3) { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else @@ -11559,6 +11752,7 @@ static void Cmd_setstickyweb(void) { gSideStatuses[targetSide] |= SIDE_STATUS_STICKY_WEB; gSideTimers[targetSide].stickyWebAmount = 1; + gBattleStruct->stickyWebUser = gBattlerAttacker; // For Mirror Armor gBattlescriptCurrInstr += 5; } } @@ -11749,13 +11943,15 @@ static void Cmd_callterrainattack(void) // nature power u16 GetNaturePowerMove(void) { if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) - return MOVE_MOONBLAST; + return MOVE_MOONBLAST; else if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) - return MOVE_THUNDERBOLT; + return MOVE_THUNDERBOLT; else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) - return MOVE_ENERGY_BALL; + return MOVE_ENERGY_BALL; else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) - return MOVE_PSYCHIC; + return MOVE_PSYCHIC; + else if (sNaturePowerMoves == MOVE_NONE) + return MOVE_TRI_ATTACK; return sNaturePowerMoves[gBattleTerrain]; } @@ -11834,7 +12030,7 @@ static void Cmd_trysethelpinghand(void) && !gProtectStructs[gBattlerAttacker].helpingHand && !gProtectStructs[gBattlerTarget].helpingHand) { - gProtectStructs[gBattlerTarget].helpingHand = 1; + gProtectStructs[gBattlerTarget].helpingHand = TRUE; gBattlescriptCurrInstr += 5; } else @@ -12254,28 +12450,28 @@ static void Cmd_assistattackselect(void) static void Cmd_trysetmagiccoat(void) { gBattlerTarget = gBattlerAttacker; - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattlerAttacker].bounceMove = 1; + gProtectStructs[gBattlerAttacker].bounceMove = TRUE; gBattlescriptCurrInstr += 5; } } static void Cmd_trysetsnatch(void) // snatch { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattlerAttacker].stealMove = 1; + gProtectStructs[gBattlerAttacker].stealMove = TRUE; gBattlescriptCurrInstr += 5; } } @@ -12339,39 +12535,114 @@ static void Cmd_jumpifhasnohp(void) static void Cmd_getsecretpowereffect(void) { - switch (gBattleTerrain) - { - case BATTLE_TERRAIN_GRASS: - gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; - break; - case BATTLE_TERRAIN_LONG_GRASS: - gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; - break; - case BATTLE_TERRAIN_SAND: - gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1; - break; - case BATTLE_TERRAIN_UNDERWATER: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_WATER: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_POND: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_MOUNTAIN: - gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1; - break; - case BATTLE_TERRAIN_CAVE: - gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; - break; - default: - gBattleScripting.moveEffect = MOVE_EFFECT_PARALYSIS; - break; - } + gBattleScripting.moveEffect = GetSecretPowerMoveEffect(); gBattlescriptCurrInstr++; } +u16 GetSecretPowerMoveEffect(void) +{ + u16 moveEffect; + u32 fieldTerrain = gFieldStatuses & STATUS_FIELD_TERRAIN_ANY; + if (fieldTerrain) + { + switch (fieldTerrain) + { + case STATUS_FIELD_MISTY_TERRAIN: + moveEffect = MOVE_EFFECT_SP_ATK_MINUS_1; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + moveEffect = MOVE_EFFECT_SLEEP; + break; + case STATUS_FIELD_ELECTRIC_TERRAIN: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + break; + default: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + } + } + else + { + switch (gBattleTerrain) + { + case BATTLE_TERRAIN_GRASS: + #if B_SECRET_POWER_EFFECT >= GEN_4 + moveEffect = MOVE_EFFECT_SLEEP; + #else + moveEffect = MOVE_EFFECT_POISON; + #endif + break; + case BATTLE_TERRAIN_LONG_GRASS: + moveEffect = MOVE_EFFECT_SLEEP; + break; + case BATTLE_TERRAIN_SAND: + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + break; + case BATTLE_TERRAIN_UNDERWATER: + #if B_SECRET_POWER_EFFECT >= GEN_6 + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + moveEffect = MOVE_EFFECT_DEF_MINUS_1; + #endif + break; + case BATTLE_TERRAIN_WATER: + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + break; + case BATTLE_TERRAIN_POND: + #if B_SECRET_POWER_EFFECT >= GEN_4 + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + #endif + break; + case BATTLE_TERRAIN_MOUNTAIN: + #if B_SECRET_POWER_EFFECT >= GEN_5 + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + #elif B_SECRET_POWER_EFFECT == GEN_4 + moveEffect = MOVE_EFFECT_FLINCH; + #else + moveEffect = MOVE_EFFECT_CONFUSION; + #endif + break; + case BATTLE_TERRAIN_CAVE: + case BATTLE_TERRAIN_BURIAL_GROUND: + case BATTLE_TERRAIN_SPACE: + moveEffect = MOVE_EFFECT_FLINCH; + break; + case BATTLE_TERRAIN_SOARING: + case BATTLE_TERRAIN_SKY_PILLAR: + case BATTLE_TERRAIN_MARSH: + case BATTLE_TERRAIN_SWAMP: + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + break; + case BATTLE_TERRAIN_PUDDLE: + #if B_SECRET_POWER_EFFECT >= GEN_5 + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + #else + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + #endif + break; + case BATTLE_TERRAIN_SNOW: + case BATTLE_TERRAIN_ICE: + moveEffect = MOVE_EFFECT_FREEZE; + break; + case BATTLE_TERRAIN_VOLCANO: + moveEffect = MOVE_EFFECT_BURN; + break; + case BATTLE_TERRAIN_ULTRA_SPACE: + moveEffect = MOVE_EFFECT_DEF_MINUS_1; + break; + default: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + } + } + return moveEffect; +} + static void Cmd_pickup(void) { s32 i; @@ -12599,10 +12870,30 @@ bool32 CanCamouflage(u8 battlerId) static void Cmd_settypetoterrain(void) { - if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain])) + u8 terrainType; + switch(gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) { - SET_BATTLER_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain]); - PREPARE_TYPE_BUFFER(gBattleTextBuff1, sTerrainToType[gBattleTerrain]); + case STATUS_FIELD_ELECTRIC_TERRAIN: + terrainType = TYPE_ELECTRIC; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + terrainType = TYPE_GRASS; + break; + case STATUS_FIELD_MISTY_TERRAIN: + terrainType = TYPE_FAIRY; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + terrainType = TYPE_PSYCHIC; + break; + default: + terrainType = sTerrainToType[gBattleTerrain]; + break; + } + + if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, terrainType)) + { + SET_BATTLER_TYPE(gBattlerAttacker, terrainType); + PREPARE_TYPE_BUFFER(gBattleTextBuff1, terrainType); gBattlescriptCurrInstr += 5; } @@ -12802,7 +13093,7 @@ static void Cmd_handleballthrow(void) gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 0; if (CriticalCapture(odds)) { - maxShakes = 1; //critical capture doesn't gauarantee capture + maxShakes = 1; //critical capture doesn't guarantee capture gBattleSpritesDataPtr->animationData->isCriticalCapture = 1; } else @@ -13265,7 +13556,7 @@ static void Cmd_metalburstdamagecalculator(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -13302,4 +13593,3 @@ static bool32 CriticalCapture(u32 odds) return FALSE; #endif } - diff --git a/src/battle_util.c b/src/battle_util.c index 224cb1af1..7e06b55d1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -256,7 +256,7 @@ void HandleAction_UseMove(void) // choose move if (gProtectStructs[gBattlerAttacker].noValidMoves) { - gProtectStructs[gBattlerAttacker].noValidMoves = 0; + gProtectStructs[gBattlerAttacker].noValidMoves = FALSE; gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); @@ -388,9 +388,9 @@ void HandleAction_UseMove(void) gActiveBattler = gBattlerByTurnOrder[var]; RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); if (gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD) - gSpecialStatuses[gActiveBattler].lightningRodRedirected = 1; + gSpecialStatuses[gActiveBattler].lightningRodRedirected = TRUE; else if (gBattleMons[gActiveBattler].ability == ABILITY_STORM_DRAIN) - gSpecialStatuses[gActiveBattler].stormDrainRedirected = 1; + gSpecialStatuses[gActiveBattler].stormDrainRedirected = TRUE; gBattlerTarget = gActiveBattler; } } @@ -1618,7 +1618,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1633,7 +1633,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingTormentedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1648,7 +1648,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveTauntInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1663,7 +1663,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveThroatChopInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1678,7 +1678,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1693,7 +1693,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravityInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1708,7 +1708,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlockInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1723,7 +1723,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1754,7 +1754,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1768,7 +1768,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1796,7 +1796,7 @@ u8 TrySetCantSelectMoveBattleScript(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1859,12 +1859,12 @@ bool8 AreAllMovesUnusable(void) if (unusable == 0xF) // All moves are unusable. { - gProtectStructs[gActiveBattler].noValidMoves = 1; + gProtectStructs[gActiveBattler].noValidMoves = TRUE; gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft; } else { - gProtectStructs[gActiveBattler].noValidMoves = 0; + gProtectStructs[gActiveBattler].noValidMoves = FALSE; } return (unusable == 0xF); @@ -1894,6 +1894,57 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move) return imprisonedMoves; } +void RestoreBattlerOriginalTypes(u8 battlerId) +{ + gBattleMons[battlerId].type1 = gBaseStats[gBattleMons[battlerId].species].type1; + gBattleMons[battlerId].type2 = gBaseStats[gBattleMons[battlerId].species].type2; +} + +void TryToApplyMimicry(u8 battlerId, bool8 various) +{ + u32 moveType, move; + + GET_MOVE_TYPE(move, moveType); + switch (gFieldStatuses) + { + case STATUS_FIELD_ELECTRIC_TERRAIN: + moveType = TYPE_ELECTRIC; + break; + case STATUS_FIELD_MISTY_TERRAIN: + moveType = TYPE_FAIRY; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + moveType = TYPE_GRASS; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + moveType = TYPE_PSYCHIC; + break; + default: + moveType = 0; + break; + } + + if (moveType != 0 && !IS_BATTLER_OF_TYPE(battlerId, moveType)) + { + SET_BATTLER_TYPE(battlerId, moveType); + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, battlerId, gBattlerPartyIndexes[battlerId]) + PREPARE_TYPE_BUFFER(gBattleTextBuff2, moveType); + if (!various) + BattleScriptPushCursorAndCallback(BattleScript_MimicryActivatesEnd3); + } +} + +void TryToRevertMimicry(void) +{ + s32 i; + + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } +} + enum { ENDTURN_ORDER, @@ -2275,9 +2326,10 @@ 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.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); + TryToRevertMimicry(); BattleScriptExecute(BattleScript_ElectricTerrainEnds); effect++; } @@ -2285,9 +2337,10 @@ 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.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN); + TryToRevertMimicry(); BattleScriptExecute(BattleScript_MistyTerrainEnds); effect++; } @@ -2297,9 +2350,11 @@ u8 DoFieldEndTurnEffects(void) if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) { if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) - && (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)) + && (gFieldTimers.terrainTimer == 0 || --gFieldTimers.terrainTimer == 0)) + { gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN); - + TryToRevertMimicry(); + } BattleScriptExecute(BattleScript_GrassyTerrainHeals); effect++; } @@ -2307,9 +2362,10 @@ 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.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN); + TryToRevertMimicry(); BattleScriptExecute(BattleScript_PsychicTerrainEnds); effect++; } @@ -3269,7 +3325,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_FLINCH: // flinch if (gBattleMons[gBattlerAttacker].status2 & STATUS2_FLINCHED) { - gProtectStructs[gBattlerAttacker].flinchImmobility = 1; + gProtectStructs[gBattlerAttacker].flinchImmobility = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3280,7 +3336,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_DISABLED: // disabled move if (gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != 0) { - gProtectStructs[gBattlerAttacker].usedDisabledMove = 1; + gProtectStructs[gBattlerAttacker].usedDisabledMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsDisabled; @@ -3292,7 +3348,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_HEAL_BLOCKED: if (gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(gBattlerAttacker, gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedHealBlockedMove = 1; + gProtectStructs[gBattlerAttacker].usedHealBlockedMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedHealBlockPrevents; @@ -3304,7 +3360,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_GRAVITY: if (gFieldStatuses & STATUS_FIELD_GRAVITY && IsGravityPreventingMove(gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedGravityPreventedMove = 1; + gProtectStructs[gBattlerAttacker].usedGravityPreventedMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedGravityPrevents; @@ -3316,7 +3372,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_TAUNTED: // taunt if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0) { - gProtectStructs[gBattlerAttacker].usedTauntedMove = 1; + gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsTaunted; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3327,7 +3383,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_IMPRISONED: // imprisoned if (GetImprisonedMovesCount(gBattlerAttacker, gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedImprisonedMove = 1; + gProtectStructs[gBattlerAttacker].usedImprisonedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3346,7 +3402,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); - gProtectStructs[gBattlerAttacker].confusionSelfDmg = 1; + gProtectStructs[gBattlerAttacker].confusionSelfDmg = TRUE; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; } else @@ -3368,7 +3424,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_PARALYSED: // paralysis if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) { - gProtectStructs[gBattlerAttacker].prlzImmobility = 1; + gProtectStructs[gBattlerAttacker].prlzImmobility = TRUE; // This is removed in Emerald for some reason //CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; @@ -3389,7 +3445,7 @@ u8 AtkCanceller_UnableToUseMove(void) { BattleScriptPush(BattleScript_MoveUsedIsInLoveCantAttack); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gProtectStructs[gBattlerAttacker].loveImmobility = 1; + gProtectStructs[gBattlerAttacker].loveImmobility = TRUE; CancelMultiTurnMoves(gBattlerAttacker); } gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove; @@ -3469,7 +3525,7 @@ u8 AtkCanceller_UnableToUseMove(void) GET_MOVE_TYPE(gCurrentMove, moveType); if (moveType == TYPE_FIRE) { - gProtectStructs[gBattlerAttacker].powderSelfDmg = 1; + gProtectStructs[gBattlerAttacker].powderSelfDmg = TRUE; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; gBattlescriptCurrInstr = BattleScript_MoveUsedPowder; effect = 1; @@ -3480,7 +3536,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_THROAT_CHOP: if (gDisableStructs[gBattlerAttacker].throatChopTimer && gBattleMoves[gCurrentMove].flags & FLAG_SOUND) { - gProtectStructs[gBattlerAttacker].usedThroatChopPreventedMove = 1; + gProtectStructs[gBattlerAttacker].usedThroatChopPreventedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsThroatChopPrevented; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -4015,7 +4071,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_MOLDBREAKER; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4024,7 +4080,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_TERAVOLT; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4033,7 +4089,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_TURBOBLAZE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4043,7 +4099,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { gDisableStructs[battler].slowStartTimer = 5; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_SLOWSTART; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4052,7 +4108,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_UNNERVE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4062,7 +4118,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ASONE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_ActivateAsOne); effect++; } @@ -4074,11 +4130,21 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move u32 i; gEffectBattler = BATTLE_PARTNER(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_CURIOUS_MEDICINE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } break; + case ABILITY_PASTEL_VEIL: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + gBattlerTarget = battler; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; + BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); + effect++; + gSpecialStatuses[battler].switchInAbilityDone = 1; + } + break; case ABILITY_ANTICIPATION: if (!gSpecialStatuses[battler].switchInAbilityDone) { @@ -4104,7 +4170,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (effect) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ANTICIPATION; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); } } @@ -4112,7 +4178,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_FRISK: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_FriskActivates); // Try activate effect++; } @@ -4122,7 +4188,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { ForewarnChooseMove(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_FOREWARN; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4152,7 +4218,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move else statId = STAT_SPATK; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; if (CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN)) { @@ -4169,7 +4235,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PRESSURE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4178,7 +4244,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_DARKAURA; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4187,7 +4253,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_FAIRYAURA; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4196,7 +4262,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_AURABREAK; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4205,7 +4271,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_COMATOSE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4214,7 +4280,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone && TryRemoveScreens(battler)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_SCREENCLEANER; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4272,28 +4338,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_ELECTRIC_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_ElectricSurgeActivates); effect++; } break; case ABILITY_GRASSY_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.grassyTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_GrassySurgeActivates); effect++; } break; case ABILITY_MISTY_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_MISTY_TERRAIN, &gFieldTimers.mistyTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_MISTY_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_MistySurgeActivates); effect++; } break; case ABILITY_PSYCHIC_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_PSYCHIC_TERRAIN, &gFieldTimers.psychicTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_PSYCHIC_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_PsychicSurgeActivates); effect++; @@ -4303,7 +4369,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gSpecialStatuses[battler].intimidatedMon)) { gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_INTIMIDATED; - gSpecialStatuses[battler].intimidatedMon = 1; + gSpecialStatuses[battler].intimidatedMon = TRUE; } break; case ABILITY_FORECAST: @@ -4319,14 +4385,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gSpecialStatuses[battler].traced)) { gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_TRACED; - gSpecialStatuses[battler].traced = 1; + gSpecialStatuses[battler].traced = TRUE; } break; case ABILITY_CLOUD_NINE: case ABILITY_AIR_LOCK: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_AnnounceAirLockCloudNine); effect++; } @@ -4344,7 +4410,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_INTREPID_SWORD: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_ATK, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn); effect++; @@ -4353,7 +4419,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_DAUNTLESS_SHIELD: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_DEF, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn); effect++; @@ -4380,6 +4446,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_MIMICRY: + if (gBattleMons[battler].hp != 0 && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) + { + TryToApplyMimicry(battler, FALSE); + effect++; + } + break; } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -4562,6 +4635,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_HUNGER_SWITCH: + if (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) + { + if (gBattleMons[battler].species == SPECIES_MORPEKO) + { + gBattleMons[battler].species = SPECIES_MORPEKO_HANGRY; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3NoPopup); + } + else if (gBattleMons[battler].species == SPECIES_MORPEKO_HANGRY) + { + gBattleMons[battler].species = SPECIES_MORPEKO; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3NoPopup); + } + effect++; + } + break; } } break; @@ -4799,7 +4888,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move || CompareStat(battler, STAT_DEF, MIN_STAT_STAGE, CMP_GREATER_THAN))) // Don't activate if defense cannot be lowered { if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE && CanBattlerSwitch(gBattlerAttacker)) - gProtectStructs[battler].disableEjectPack = 1; // Set flag for target + gProtectStructs[battler].disableEjectPack = TRUE; // Set flag for target BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_WeakArmorActivates; @@ -4827,7 +4916,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && IsBattlerAlive(gBattlerAttacker) && TARGET_TURN_DAMAGED - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) + && (IsMoveMakingContact(move, gBattlerAttacker))) { switch (gBattleMons[gBattlerAttacker].ability) { @@ -4918,15 +5007,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_TANGLING_HAIR: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 - && CompareStat(gBattlerAttacker, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN) + && (CompareStat(gBattlerAttacker, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN) || GetBattlerAbility(gBattlerAttacker) == ABILITY_MIRROR_ARMOR) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && IsMoveMakingContact(move, gBattlerAttacker)) { - gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_SPD_MINUS_1; + SET_STATCHANGER(STAT_SPEED, 1, TRUE); + gBattleScripting.moveEffect = MOVE_EFFECT_SPD_MINUS_1; PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; + gBattlescriptCurrInstr = BattleScript_GooeyActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; effect++; } @@ -5012,7 +5102,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && CanBePoisoned(gBattlerAttacker) + && CanBePoisoned(gBattlerAttacker, gBattlerTarget) && IsMoveMakingContact(move, gBattlerAttacker) && (Random() % 3) == 0) { @@ -5045,7 +5135,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && TARGET_TURN_DAMAGED && CanBeBurned(gBattlerAttacker) && (Random() % 3) == 0) @@ -5061,7 +5151,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && TARGET_TURN_DAMAGED && gBattleMons[gBattlerTarget].hp != 0 && (Random() % 3) == 0 @@ -5137,7 +5227,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && IsBattlerAlive(battler) - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && !(gStatuses3[gBattlerAttacker] & STATUS3_PERISH_SONG)) { if (!(gStatuses3[battler] & STATUS3_PERISH_SONG)) @@ -5199,8 +5289,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerTarget].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && CanBePoisoned(gBattlerTarget) + && CanBePoisoned(gBattlerAttacker, gBattlerTarget) && IsMoveMakingContact(move, gBattlerAttacker) + && TARGET_TURN_DAMAGED // Need to actually hit the target && (Random() % 3) == 0) { gBattleScripting.moveEffect = MOVE_EFFECT_POISON; @@ -5247,7 +5338,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && gBattlerAttacker != battler) { // Set bit and save Dancer mon's original target - gSpecialStatuses[battler].dancerUsedMove = 1; + gSpecialStatuses[battler].dancerUsedMove = TRUE; gSpecialStatuses[battler].dancerOriginalTarget = *(gBattleStruct->moveTarget + battler) | 0x4; gBattleStruct->atkCancellerTracker = 0; gBattlerAttacker = gBattlerAbility = battler; @@ -5380,8 +5471,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY)) { gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN); - if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) - gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + #if B_SYNCHRONIZE_TOXIC < GEN_5 + if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) + gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + #endif gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerAbility = gBattlerTarget; @@ -5640,18 +5733,19 @@ bool32 CanSleep(u8 battlerId) return TRUE; } -bool32 CanBePoisoned(u8 battlerId) +bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget) { - u16 ability = GetBattlerAbility(battlerId); - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON) - || IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || gBattleMons[battlerId].status1 & STATUS1_ANY + u16 ability = GetBattlerAbility(battlerTarget); + + if (!(CanPoisonType(battlerAttacker, battlerTarget)) + || gSideStatuses[GetBattlerSide(battlerTarget)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battlerTarget].status1 & STATUS1_ANY || ability == ABILITY_IMMUNITY || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || IsAbilityOnSide(battlerTarget, ABILITY_PASTEL_VEIL) + || gBattleMons[battlerTarget].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerTarget) + || IsBattlerTerrainAffected(battlerTarget, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } @@ -5854,7 +5948,7 @@ static u8 TrySetMicleBerry(u32 battlerId, u32 itemId, bool32 end2) { if (HasEnoughHpToEatBerry(battlerId, 4, itemId)) { - gProtectStructs[battlerId].micle = TRUE; // battler's next attack has increased accuracy + gProtectStructs[battlerId].usedMicleBerry = TRUE; // battler's next attack has increased accuracy if (end2) { @@ -6256,7 +6350,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (effect) { - gSpecialStatuses[battlerId].switchInItemDone = 1; + gSpecialStatuses[battlerId].switchInItemDone = TRUE; gActiveBattler = gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; switch (effect) { @@ -7112,7 +7206,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget) { targetBattler ^= BIT_FLANK; RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability); - gSpecialStatuses[targetBattler].lightningRodRedirected = 1; + gSpecialStatuses[targetBattler].lightningRodRedirected = TRUE; } else if (gBattleMoves[move].type == TYPE_WATER && IsAbilityOnOpposingSide(gBattlerAttacker, ABILITY_STORM_DRAIN) @@ -7120,7 +7214,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget) { targetBattler ^= BIT_FLANK; RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability); - gSpecialStatuses[targetBattler].stormDrainRedirected = 1; + gSpecialStatuses[targetBattler].stormDrainRedirected = TRUE; } } break; @@ -7319,13 +7413,24 @@ u32 GetBattlerHoldEffectParam(u8 battlerId) bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) { if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) - return FALSE; + { + if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory) + return TRUE; + else + return FALSE; + } else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH) + { return FALSE; + } else if (GetBattlerHoldEffect(battlerAtk, TRUE) == HOLD_EFFECT_PROTECTIVE_PADS) + { return FALSE; + } else + { return TRUE; + } } bool32 IsBattlerGrounded(u8 battlerId) @@ -7647,7 +7752,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_ASSURANCE: - if (gProtectStructs[battlerDef].physicalDmg != 0 || gProtectStructs[battlerDef].specialDmg != 0 || gProtectStructs[battlerDef].confusionSelfDmg != 0) + if (gProtectStructs[battlerDef].physicalDmg != 0 || gProtectStructs[battlerDef].specialDmg != 0 || gProtectStructs[battlerDef].confusionSelfDmg) basePower *= 2; break; case EFFECT_TRUMP_CARD: @@ -7760,6 +7865,11 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) if (gFieldStatuses & STATUS_FIELD_GRAVITY) MulModifier(&basePower, UQ_4_12(1.5)); break; + case EFFECT_TERRAIN_PULSE: + if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) + && IsBattlerGrounded(gBattlerAttacker)) + basePower *= 2; + break; } // move-specific base power changes @@ -7833,7 +7943,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, UQ_4_12(1.3)); break; case ABILITY_TOUGH_CLAWS: - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + if (IsMoveMakingContact(move, battlerAtk)) MulModifier(&modifier, UQ_4_12(1.3)); break; case ABILITY_STRONG_JAW: @@ -7983,7 +8093,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)) + #if B_SOUL_DEW_BOOST >= GEN_7 + if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) + #else + if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) + #endif MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: @@ -8396,6 +8510,14 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, if (!usesDefStat) MulModifier(&modifier, UQ_4_12(1.5)); break; +#if B_SOUL_DEW_BOOST <= GEN_6 + case HOLD_EFFECT_SOUL_DEW: + if ((gBattleMons[battlerDef].species == SPECIES_LATIAS || gBattleMons[battlerDef].species == SPECIES_LATIOS) + && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + && !usesDefStat) + MulModifier(&modifier, UQ_4_12(1.5)); + break; +#endif } // sandstorm sp.def boost for rock types @@ -8548,7 +8670,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else MulModifier(&finalModifier, UQ_4_12(0.5)); if (updateFlags) - gSpecialStatuses[battlerDef].berryReduced = 1; + gSpecialStatuses[battlerDef].berryReduced = TRUE; } break; } @@ -8953,33 +9075,31 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) { u32 i, currSpecies; struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; - static const u16 species[][2] = // changed form id, default form id + static const u16 species[][3] = { - {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}, - {SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE}, - {SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN}, - {SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO}, - {SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE}, - {SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET}, - {SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW}, - {SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI}, - {SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT}, - {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT}, + // Changed Form ID Default Form ID Should change on switch + {SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU, FALSE}, + {SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND, FALSE}, + {SPECIES_MELOETTA_PIROUETTE, SPECIES_MELOETTA, FALSE}, + {SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH, TRUE}, + {SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN, TRUE}, + {SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED, TRUE}, + {SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE, TRUE}, + {SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN, TRUE}, + {SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO, TRUE}, + {SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE, TRUE}, + {SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET, TRUE}, + {SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW, TRUE}, + {SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI, TRUE}, + {SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT, TRUE}, + {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT, TRUE}, + {SPECIES_MORPEKO_HANGRY, SPECIES_MORPEKO, TRUE}, }; - if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out - i = 2; - else - i = 0; - currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL); - for (; i < ARRAY_COUNT(species); i++) + for (i = 0; i < ARRAY_COUNT(species); i++) { - if (currSpecies == species[i][0]) + if (currSpecies == species[i][0] && (!isSwitchingOut || species[i][2] == TRUE)) { SetMonData(&party[monId], MON_DATA_SPECIES, &species[i][1]); CalculateMonStats(&party[monId]); @@ -9119,7 +9239,9 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) u8 GetBattleMoveSplit(u32 moveId) { - if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) + if (gSwapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky + return SPLIT_PHYSICAL; + else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) return gBattleMoves[moveId].split; else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 97d61202a..60e2923c6 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -378,7 +378,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -649,7 +649,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -2460,7 +2460,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -7267,7 +7267,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -8367,7 +8367,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -8575,7 +8575,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -8614,7 +8614,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_RELIC_SONG] = { - .effect = EFFECT_SLEEP_HIT, + .effect = EFFECT_RELIC_SONG, .power = 75, .type = TYPE_NORMAL, .accuracy = 100, @@ -8624,6 +8624,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, + .argument = STATUS1_SLEEP, }, [MOVE_SECRET_SWORD] = @@ -10454,7 +10455,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_PHOTON_GEYSER] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_PHOTON_GEYSER, .power = 100, .type = TYPE_PSYCHIC, .accuracy = 100, @@ -10462,7 +10463,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, .split = SPLIT_SPECIAL, }, @@ -10726,9 +10727,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_DOUBLE_IRON_BASH] = { #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, #endif .effect = EFFECT_DOUBLE_IRON_BASH, .power = 60, @@ -10850,7 +10851,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -11038,7 +11039,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_AURA_WHEEL] = { - .effect = EFFECT_SPEED_UP_HIT, + .effect = EFFECT_AURA_WHEEL, .power = 110, .type = TYPE_ELECTRIC, .accuracy = 100, @@ -11290,12 +11291,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_SHELL_SIDE_ARM] = { - .effect = EFFECT_PLACEHOLDER, //TODO + .effect = EFFECT_SHELL_SIDE_ARM, .power = 90, .type = TYPE_POISON, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, @@ -11346,7 +11347,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_TERRAIN_PULSE] = { - .effect = EFFECT_PLACEHOLDER, //TODO + .effect = EFFECT_TERRAIN_PULSE, .power = 50, .type = TYPE_NORMAL, .accuracy = 100, @@ -11480,7 +11481,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, diff --git a/src/data/contest_moves.h b/src/data/contest_moves.h index 2e8fd8089..169e55991 100644 --- a/src/data/contest_moves.h +++ b/src/data/contest_moves.h @@ -1158,7 +1158,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = [MOVE_BUBBLE] = { .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, - .contestCategory = CONTEST_CATEGORY_COOL, + .contestCategory = CONTEST_CATEGORY_CUTE, .comboStarterId = 0, .comboMoves = {COMBO_STARTER_RAIN_DANCE}, }, @@ -4633,7 +4633,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_SMART, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_GRASSY_TERRAIN, .comboMoves = {0} }, @@ -4641,7 +4641,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_CUTE, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_MISTY_TERRAIN, .comboMoves = {0} }, @@ -4825,7 +4825,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_BEAUTY, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_ELECTRIC_TERRAIN, .comboMoves = {0} }, @@ -5115,7 +5115,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_SMART, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_PSYCHIC_TERRAIN, .comboMoves = {0} }, @@ -5398,6 +5398,526 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .comboStarterId = 0, .comboMoves = {0} }, + + [MOVE_DYNAMAX_CANNON] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SNIPE_SHOT] = + { + .effect = CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_JAW_LOCK] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STUFF_CHEEKS] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_NO_RETREAT] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_TAR_SHOT] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_MAGIC_POWDER] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRAGON_DARTS] = + { + .effect = CONTEST_EFFECT_REPETITION_NOT_BORING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_TEATIME] = + { + .effect = CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_OCTOLOCK] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BOLT_BEAK] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FISHIOUS_REND] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_COURT_CHANGE] = + { + .effect = CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_CLANGOROUS_SOUL] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BODY_PRESS] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DECORATE] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRUM_BEATING] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_SNAP_TRAP] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_PYRO_BALL] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BEHEMOTH_BLADE] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_BEHEMOTH_BASH] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_AURA_WHEEL] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BREAKING_SWIPE] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_BRANCH_POKE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_OVERDRIVE] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_APPLE_ACID] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_GRAV_APPLE] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SPIRIT_BREAK] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STRANGE_STEAM] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_FRONT_MON, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_LIFE_DEW] = + { + .effect = CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_OBSTRUCT] = + { + .effect = CONTEST_EFFECT_AVOID_STARTLE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_FALSE_SURRENDER] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_METEOR_ASSAULT] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_ETERNABEAM] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STEEL_BEAM] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_EXPANDING_FORCE] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {COMBO_STARTER_PSYCHIC_TERRAIN} + }, + + [MOVE_STEEL_ROLLER] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SCALE_SHOT] = + { + .effect = CONTEST_EFFECT_NEXT_APPEAL_EARLIER, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_METEOR_BEAM] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SHELL_SIDE_ARM] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_MISTY_EXPLOSION] = + { + .effect = CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {COMBO_STARTER_MISTY_TERRAIN} + }, + + [MOVE_GRASSY_GLIDE] = + { + .effect = CONTEST_EFFECT_NEXT_APPEAL_EARLIER, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {COMBO_STARTER_GRASSY_TERRAIN} + }, + + [MOVE_RISING_VOLTAGE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {COMBO_STARTER_ELECTRIC_TERRAIN} + }, + + [MOVE_TERRAIN_PULSE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {COMBO_STARTER_ELECTRIC_TERRAIN, COMBO_STARTER_MISTY_TERRAIN, COMBO_STARTER_GRASSY_TERRAIN, COMBO_STARTER_PSYCHIC_TERRAIN}, + }, + + [MOVE_SKITTER_SMACK] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BURNING_JEALOUSY] = + { + .effect = CONTEST_EFFECT_STARTLE_MON_WITH_JUDGES_ATTENTION, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_LASH_OUT] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MON, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_POLTERGEIST] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_CORROSIVE_GAS] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_COACHING] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FLIP_TURN] = + { + .effect = CONTEST_EFFECT_AVOID_STARTLE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_TRIPLE_AXEL] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DUAL_WINGBEAT] = + { + .effect = CONTEST_EFFECT_REPETITION_NOT_BORING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SCORCHING_SANDS] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_JUNGLE_HEALING] = + { + .effect = CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_WICKED_BLOW] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_SURGING_STRIKES] = + { + .effect = CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_THUNDER_CAGE] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRAGON_ENERGY] = + { + .effect = CONTEST_EFFECT_BETTER_WHEN_LATER, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FREEZING_GLARE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FIERY_WRATH] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_THUNDEROUS_KICK] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_GLACIAL_LANCE] = + { + .effect = CONTEST_EFFECT_BETTER_IF_LAST, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_ASTRAL_BARRAGE] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_EERIE_SPELL] = + { + .effect = CONTEST_EFFECT_BETTER_WHEN_LATER, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, }; const struct ContestEffect gContestEffects[] = diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index e204fb196..037261e32 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -2839,7 +2839,7 @@ static const u8 sMETEOR_BEAMDescription[] = _( "Sp. Attack before attacking."); static const u8 sSHELL_SIDE_ARMDescription[] = _( - "Uses higher of physical and\n" + "Deals better of physical and\n" "special damage. May poison."); static const u8 sMISTY_EXPLOSIONDescription[] = _( diff --git a/src/graphics.c b/src/graphics.c index 5dccdd2c2..1621f9d5b 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1396,10 +1396,6 @@ const u32 gBattleAnimBgPalette_MagmaStorm[] = INCBIN_U32("graphics/battle_anims/ //new battle bgs -//const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.4bpp.lz"); -//const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.gbapal.lz"); -//const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room_map.bin.lz"); - const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.4bpp.lz"); const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.gbapal.lz"); const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.bin.lz"); @@ -1415,11 +1411,6 @@ const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.4bpp.lz"); const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend.gbapal.lz"); -const u32 gBattleAnimBgImage_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.4bpp.lz"); -const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.gbapal.lz"); -const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.bin.lz"); - - const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sludge_wave.gbapal.lz"); const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_tiles.4bpp.lz"); @@ -1444,10 +1435,6 @@ const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.gbapal.lz"); const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin.lz"); -//const u32 gBattleAnimBgImage_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.4bpp.lz"); -//const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); -//const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); - const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dynamax_cannon.gbapal.lz"); const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.4bpp.lz"); @@ -1492,8 +1479,6 @@ const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.gbapal.lz"); const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.bin.lz"); -const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); - const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.4bpp.lz"); const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.gbapal.lz"); const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.bin.lz"); @@ -1548,6 +1533,10 @@ const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.gbapal.lz"); const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.bin.lz"); +const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); + +const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); + const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.4bpp.lz"); const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.gbapal.lz"); const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.bin.lz"); @@ -1560,7 +1549,8 @@ const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.gbapal.lz"); const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.bin.lz"); -const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); +const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.4bpp.lz"); const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.gbapal.lz");