merge with be

This commit is contained in:
ghoulslash 2021-10-06 13:32:59 -04:00
commit 4382420dd2
31 changed files with 2075 additions and 485 deletions

View File

@ -1764,7 +1764,7 @@
various BS_ATTACKER, VARIOUS_TOTEM_BOOST various BS_ATTACKER, VARIOUS_TOTEM_BOOST
.4byte \ptr .4byte \ptr
.endm .endm
.macro tryactivategrimneigh, battler:req .macro tryactivategrimneigh, battler:req
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
.endm .endm
@ -1782,7 +1782,51 @@
.macro pickpocketsteal .macro pickpocketsteal
various 0, VARIOUS_PICKPOCKET various 0, VARIOUS_PICKPOCKET
.endm .endm
.macro doterrainseed battler:req, ptr:req
various \battler, VARIOUS_TERRAIN_SEED
.4byte \ptr
.endm
.macro makeinvisible battler:req
various \battler, VARIOUS_MAKE_INVISIBLE
.endm
.macro tryroomservice battler:req, ptr:req
various \battler, VARIOUS_ROOM_SERVICE
.4byte \ptr
.endm
.macro jumpifterrainaffected battler:req, terrainFlags:req, ptr:req
various \battler, VARIOUS_JUMP_IF_TERRAIN_AFFECTED
.4byte \terrainFlags
.4byte \ptr
.endm
.macro jumpifpranksterblocked battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED
.4byte \ptr
.endm
.macro eeriespellppreduce ptr:req
various BS_TARGET, VARIOUS_EERIE_SPELL_PP_REDUCE
.4byte \ptr
.endm
.macro jumpifteamhealthy battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_TEAM_HEALTHY
.4byte \ptr
.endm
.macro tryhealquarterhealth battler:req, ptr:req
various \battler, VARIOUS_TRY_HEAL_QUARTER_HP
.4byte \ptr
.endm
.macro removeterrain
various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
@ -1887,6 +1931,12 @@
1: 1:
.endm .endm
.macro jumpifflowerveilattacker jumpptr:req
jumpifnottype BS_ATTACKER, TYPE_GRASS, 1f
jumpifability BS_ATTACKER_SIDE, ABILITY_FLOWER_VEIL, \jumpptr
1:
.endm
.macro setallytonexttarget jumpptr:req .macro setallytonexttarget jumpptr:req
jumpifbyte CMP_GREATER_THAN, gBattlerTarget, 0x1, 1f jumpifbyte CMP_GREATER_THAN, gBattlerTarget, 0x1, 1f
addbyte gBattlerTarget, 0x2 addbyte gBattlerTarget, 0x2

View File

@ -532,7 +532,7 @@ gBattleAnims_Moves::
.4byte Move_QUASH .4byte Move_QUASH
.4byte Move_ACROBATICS .4byte Move_ACROBATICS
.4byte Move_REFLECT_TYPE .4byte Move_REFLECT_TYPE
.4byte Move_RETALITATE .4byte Move_RETALIATE
.4byte Move_FINAL_GAMBIT .4byte Move_FINAL_GAMBIT
.4byte Move_BESTOW .4byte Move_BESTOW
.4byte Move_INFERNO .4byte Move_INFERNO
@ -822,6 +822,7 @@ gBattleAnims_General::
.4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN .4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN
.4byte General_RestoreBg @ B_ANIM_RESTORE_BG .4byte General_RestoreBg @ B_ANIM_RESTORE_BG
.4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE .4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE
.4byte General_GulpMissile @ B_ANIM_GULP_MISSILE
.align 2 .align 2
gBattleAnims_Special:: gBattleAnims_Special::
@ -5610,7 +5611,7 @@ Move_REFLECT_TYPE:
blendoff blendoff
end end
Move_RETALITATE: Move_RETALIATE:
loadspritegfx ANIM_TAG_CUT @Cut loadspritegfx ANIM_TAG_CUT @Cut
monbg ANIM_DEF_PARTNER monbg ANIM_DEF_PARTNER
setalpha 9, 8 setalpha 9, 8
@ -13481,7 +13482,7 @@ Move_BODY_PRESS::
end end
Move_DECORATE:: Move_DECORATE::
end @to do: goto Move_FLOWER_SHIELD
Move_DRUM_BEATING:: Move_DRUM_BEATING::
loadspritegfx ANIM_TAG_MUSIC_NOTES loadspritegfx ANIM_TAG_MUSIC_NOTES
@ -13957,7 +13958,7 @@ Move_EXPANDING_FORCE::
end @to do: end @to do:
Move_STEEL_ROLLER:: Move_STEEL_ROLLER::
end @to do: goto Move_GYRO_BALL
Move_SCALE_SHOT:: Move_SCALE_SHOT::
end @to do: end @to do:
@ -13984,7 +13985,7 @@ Move_SKITTER_SMACK::
end @to do: end @to do:
Move_BURNING_JEALOUSY:: Move_BURNING_JEALOUSY::
end @to do: goto Move_OVERHEAT
Move_LASH_OUT:: Move_LASH_OUT::
end @to do: end @to do:
@ -14011,7 +14012,7 @@ Move_SCORCHING_SANDS::
end @to do: end @to do:
Move_JUNGLE_HEALING:: Move_JUNGLE_HEALING::
end @to do: goto Move_AROMATHERAPY
Move_WICKED_BLOW:: Move_WICKED_BLOW::
end @to do: end @to do:
@ -24397,6 +24398,20 @@ General_TotemFlare::
clearmonbg ANIM_ATTACKER clearmonbg ANIM_ATTACKER
end end
General_GulpMissile: @ Tackle anim (placeholder)
loadspritegfx ANIM_TAG_IMPACT
monbg ANIM_ATTACKER
setalpha 12, 8
createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 4
delay 6
createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_ATTACKER, 2
createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 3, 0, 6, 1
playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET
waitforvisualfinish
clearmonbg ANIM_ATTACKER
blendoff
end
RainbowEndureEffect: RainbowEndureEffect:
launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2
delay 0x3 delay 0x3

View File

@ -252,7 +252,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_ROUND .4byte BattleScript_EffectHit @ EFFECT_ROUND
.4byte BattleScript_EffectHit @ EFFECT_BRINE .4byte BattleScript_EffectHit @ EFFECT_BRINE
.4byte BattleScript_EffectHit @ EFFECT_VENOSHOCK .4byte BattleScript_EffectHit @ EFFECT_VENOSHOCK
.4byte BattleScript_EffectHit @ EFFECT_RETALITATE .4byte BattleScript_EffectHit @ EFFECT_RETALIATE
.4byte BattleScript_EffectBulldoze @ EFFECT_BULLDOZE .4byte BattleScript_EffectBulldoze @ EFFECT_BULLDOZE
.4byte BattleScript_EffectHit @ EFFECT_FOUL_PLAY .4byte BattleScript_EffectHit @ EFFECT_FOUL_PLAY
.4byte BattleScript_EffectHit @ EFFECT_PSYSHOCK .4byte BattleScript_EffectHit @ EFFECT_PSYSHOCK
@ -369,6 +369,133 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT .4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT
.4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT .4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT
.4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS .4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS
.4byte BattleScript_EffectEerieSpell @ EFFECT_EERIE_SPELL
.4byte BattleScript_EffectJungleHealing @ EFFECT_JUNGLE_HEALING
.4byte BattleScript_EffectCoaching @ EFFECT_COACHING
.4byte BattleScript_EffectHit @ EFFECT_LASH_OUT
.4byte BattleScript_EffectHit @ EFFECT_GRASSY_GLIDE
.4byte BattleScript_EffectRemoveTerrain @ EFFECT_REMOVE_TERRAIN
.4byte BattleScript_EffectHit @ EFFECT_DYNAMAX_DOUBLE_DMG
.4byte BattleScript_EffectDecorate @ EFFECT_DECORATE
.4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT
.4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT
.4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25
BattleScript_EffectDecorate:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, 12, BattleScript_DecorateBoost
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPATK, 12, BattleScript_DecorateBoost
goto BattleScript_ButItFailed
BattleScript_DecorateBoost:
attackanimation
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, 0x0
setstatchanger STAT_ATK, 2, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_DecorateBoostSpAtk
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DecorateBoostSpAtk
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_DecorateBoostSpAtk:
setstatchanger STAT_SPATK, 2, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_MoveEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectRemoveTerrain:
attackcanceler
attackstring
ppreduce
jumpifword CMP_NO_COMMON_BITS, gFieldStatuses, STATUS_FIELD_TERRAIN_ANY, BattleScript_ButItFailed
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
removeterrain
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 4, BattleScript_MoveEnd
printfromtable gTerrainEndingStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
tryfaintmon BS_TARGET, FALSE, NULL
goto BattleScript_MoveEnd
BattleScript_EffectCoaching:
attackcanceler
attackstring
ppreduce
jumpifnoally BS_ATTACKER, BattleScript_ButItFailed
copybyte gBattlerTarget, gBattlerAttacker
setallytonexttarget EffectCoaching_CheckAllyStats
goto BattleScript_ButItFailed
EffectCoaching_CheckAllyStats:
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_CoachingWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_CoachingWorks
goto BattleScript_ButItFailed @ ally at max atk, def
BattleScript_CoachingWorks:
attackanimation
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, 0x0
setstatchanger STAT_ATK, 1, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_CoachingBoostDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CoachingBoostDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CoachingBoostDef:
setstatchanger STAT_DEF, 1, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_MoveEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectJungleHealing:
attackcanceler
attackstring
ppreduce
jumpifteamhealthy BS_ATTACKER, BattleScript_ButItFailed
attackanimation
waitanimation
copybyte gBattlerTarget, gBattlerAttacker
setbyte gBattleCommunication, 0
JungleHealing_RestoreTargetHealth:
copybyte gBattlerAttacker, gBattlerTarget
tryhealquarterhealth BS_TARGET, BattleScript_JungleHealing_TryCureStatus
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH
waitmessage B_WAIT_TIME_LONG
BattleScript_JungleHealing_TryCureStatus:
jumpifmove MOVE_LIFE_DEW, BattleScript_JungleHealingTryRestoreAlly @ life dew only heals
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_JungleHealingCureStatus
goto BattleScript_JungleHealingTryRestoreAlly
BattleScript_JungleHealingCureStatus:
curestatus BS_TARGET
updatestatusicon BS_TARGET
printstring STRINGID_PKMNSTATUSNORMAL
waitmessage B_WAIT_TIME_LONG
BattleScript_JungleHealingTryRestoreAlly:
jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd
addbyte gBattleCommunication, 1
jumpifnoally BS_TARGET, BattleScript_MoveEnd
setallytonexttarget JungleHealing_RestoreTargetHealth
goto BattleScript_MoveEnd
BattleScript_EffectAttackerDefenseDownHit: BattleScript_EffectAttackerDefenseDownHit:
setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
@ -1530,6 +1657,7 @@ BattleScript_EffectPsychicTerrain:
printfromtable gTerrainStringIds printfromtable gTerrainStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
call BattleScript_TerrainSeedLoop
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectTopsyTurvy: BattleScript_EffectTopsyTurvy:
@ -1852,6 +1980,26 @@ BattleScript_EffectMagnetRise:
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectTrickRoom: BattleScript_EffectTrickRoom:
attackcanceler
attackstring
ppreduce
setroom
attackanimation
waitanimation
printfromtable gRoomsStringIds
waitmessage B_WAIT_TIME_LONG
savetarget
setbyte gBattlerTarget, 0
BattleScript_RoomServiceLoop:
copybyte sBATTLER, gBattlerTarget
tryroomservice BS_TARGET, BattleScript_RoomServiceLoop_NextBattler
removeitem BS_TARGET
BattleScript_RoomServiceLoop_NextBattler:
addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_RoomServiceLoop
restoretarget
goto BattleScript_MoveEnd
BattleScript_EffectWonderRoom: BattleScript_EffectWonderRoom:
BattleScript_EffectMagicRoom: BattleScript_EffectMagicRoom:
attackcanceler attackcanceler
@ -2102,6 +2250,8 @@ BattleScript_EffectSleep::
jumpifleafguard BattleScript_LeafGuardProtects jumpifleafguard BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_ELECTRIC_TERRAIN, BattleScript_ElectricTerrainPrevents
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
attackanimation attackanimation
@ -2109,6 +2259,26 @@ BattleScript_EffectSleep::
setmoveeffect MOVE_EFFECT_SLEEP setmoveeffect MOVE_EFFECT_SLEEP
seteffectprimary seteffectprimary
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_TerrainPreventsEnd2::
pause B_WAIT_TIME_SHORT
printfromtable gTerrainPreventsStringIds
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_ElectricTerrainPrevents::
pause B_WAIT_TIME_SHORT
printstring STRINGID_ELECTRICTERRAINPREVENTS
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_MistyTerrainPrevents::
pause B_WAIT_TIME_SHORT
printstring STRINGID_MISTYTERRAINPREVENTS
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_FlowerVeilProtectsRet:: BattleScript_FlowerVeilProtectsRet::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
@ -2163,18 +2333,21 @@ BattleScript_AlreadyAsleep::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
printstring STRINGID_PKMNALREADYASLEEP printstring STRINGID_PKMNALREADYASLEEP
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_WasntAffected:: BattleScript_WasntAffected::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
printstring STRINGID_PKMNWASNTAFFECTED printstring STRINGID_PKMNWASNTAFFECTED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_CantMakeAsleep:: BattleScript_CantMakeAsleep::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
printfromtable gUproarAwakeStringIds printfromtable gUproarAwakeStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectPoisonHit: BattleScript_EffectPoisonHit:
@ -2621,6 +2794,7 @@ BattleScript_EffectToxic::
jumpifsubstituteblocks BattleScript_ButItFailed jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
@ -2761,6 +2935,16 @@ BattleScript_EffectTrap::
setmoveeffect MOVE_EFFECT_WRAP setmoveeffect MOVE_EFFECT_WRAP
goto BattleScript_EffectHit goto BattleScript_EffectHit
BattleScript_EffectTripleHit::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
setmultihitcounter 3
initmultihitstring
sethword sMULTIHIT_EFFECT, 0
goto BattleScript_MultiHitLoop
BattleScript_EffectDoubleHit:: BattleScript_EffectDoubleHit::
attackcanceler attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -2845,6 +3029,7 @@ BattleScript_EffectConfuse:
jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_OwnTempoPrevents jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_OwnTempoPrevents
jumpifsubstituteblocks BattleScript_ButItFailed jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus2 BS_TARGET, STATUS2_CONFUSION, BattleScript_AlreadyConfused jumpifstatus2 BS_TARGET, STATUS2_CONFUSION, BattleScript_AlreadyConfused
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
attackanimation attackanimation
@ -2963,6 +3148,7 @@ BattleScript_EffectPoison::
jumpifstatus BS_TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned jumpifstatus BS_TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected trypoisontype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
attackanimation attackanimation
@ -2988,6 +3174,7 @@ BattleScript_EffectParalyze:
jumpifstatus BS_TARGET, STATUS1_PARALYSIS, BattleScript_AlreadyParalyzed jumpifstatus BS_TARGET, STATUS1_PARALYSIS, BattleScript_AlreadyParalyzed
tryparalyzetype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected tryparalyzetype BS_ATTACKER, BS_TARGET, BattleScript_NotAffected
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
bichalfword gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE bichalfword gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
@ -3410,6 +3597,33 @@ BattleScript_EffectDestinyBond::
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectEerieSpell::
attackcanceler
attackstring
ppreduce
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
tryfaintmon BS_TARGET, FALSE, NULL
eeriespellppreduce BattleScript_MoveEnd
printstring STRINGID_PKMNREDUCEDPP
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectSpite:: BattleScript_EffectSpite::
attackcanceler attackcanceler
attackstring attackstring
@ -3460,6 +3674,13 @@ BattleScript_TripleKickLoop::
BattleScript_DoTripleKickAttack:: BattleScript_DoTripleKickAttack::
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE
movevaluescleanup movevaluescleanup
jumpifmove MOVE_SURGING_STRIKES, EffectTripleKick_DoDmgCalcs @ no power boost each hit
jumpifmove MOVE_TRIPLE_AXEL, EffectTripleKick_TripleAxelBoost @ triple axel gets +20 power
addbyte sTRIPLE_KICK_POWER, 10 @ triple kick gets +10 power
goto EffectTripleKick_DoDmgCalcs
EffectTripleKick_TripleAxelBoost:
addbyte sTRIPLE_KICK_POWER, 20
EffectTripleKick_DoDmgCalcs:
addbyte sTRIPLE_KICK_POWER, 10 addbyte sTRIPLE_KICK_POWER, 10
addbyte sMULTIHIT_STRING + 4, 1 addbyte sMULTIHIT_STRING + 4, 1
critcalc critcalc
@ -3647,19 +3868,25 @@ BattleScript_EffectPerishSong::
waitanimation waitanimation
printstring STRINGID_FAINTINTHREE printstring STRINGID_FAINTINTHREE
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte sBATTLER, 0 setbyte gBattlerTarget, 0
BattleScript_PerishSongLoop:: BattleScript_PerishSongLoop::
jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked
jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement:: BattleScript_PerishSongLoopIncrement::
addbyte sBATTLER, 1 addbyte gBattlerTarget, 1
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_PerishSongNotAffected:: BattleScript_PerishSongBlocked::
printstring STRINGID_PKMNSXBLOCKSY2 printstring STRINGID_PKMNSXBLOCKSY2
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
goto BattleScript_PerishSongLoopIncrement goto BattleScript_PerishSongLoopIncrement
BattleScript_PerishSongNotAffected:
printstring STRINGID_ITDOESNTAFFECT
waitmessage B_WAIT_TIME_LONG
goto BattleScript_PerishSongLoopIncrement
BattleScript_EffectSandstorm:: BattleScript_EffectSandstorm::
attackcanceler attackcanceler
attackstring attackstring
@ -4290,6 +4517,7 @@ BattleScript_EffectWillOWisp::
jumpifleafguard BattleScript_LeafGuardProtects jumpifleafguard BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsafeguard BattleScript_SafeguardProtected jumpifsafeguard BattleScript_SafeguardProtected
attackanimation attackanimation
@ -4682,6 +4910,12 @@ BattleScript_EffectRecoil50:
setmoveeffect MOVE_EFFECT_RECOIL_50 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN setmoveeffect MOVE_EFFECT_RECOIL_50 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit goto BattleScript_EffectHit
BattleScript_EffectRecoilHP25:
setmoveeffect MOVE_EFFECT_RECOIL_HP_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit
incrementgamestat GAME_STAT_USED_STRUGGLE
goto BattleScript_EffectHit
BattleScript_EffectTeeterDance:: BattleScript_EffectTeeterDance::
attackcanceler attackcanceler
attackstring attackstring
@ -5545,16 +5779,28 @@ BattleScript_RoarSuccessSwitch::
waitstate waitstate
printstring STRINGID_PKMNWASDRAGGEDOUT printstring STRINGID_PKMNWASDRAGGEDOUT
switchineffects BS_TARGET switchineffects BS_TARGET
jumpifbyte CMP_EQUAL, sSWITCH_CASE, B_SWITCH_RED_CARD, BattleScript_RoarSuccessSwitch_Ret
setbyte sSWITCH_CASE, B_SWITCH_NORMAL
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_RoarSuccessSwitch_Ret:
swapattackerwithtarget @ continuation of RedCardActivates
restoretarget
removeitem BS_TARGET
setbyte sSWITCH_CASE, B_SWITCH_NORMAL
return
BattleScript_RoarSuccessEndBattle:: BattleScript_RoarSuccessEndBattle::
call BattleScript_RoarSuccessRet call BattleScript_RoarSuccessRet
setbyte sSWITCH_CASE, B_SWITCH_NORMAL
setoutcomeonteleport BS_ATTACKER setoutcomeonteleport BS_ATTACKER
finishaction finishaction
BattleScript_RoarSuccessRet: BattleScript_RoarSuccessRet:
jumpifbyte CMP_EQUAL, sSWITCH_CASE, B_SWITCH_HIT, BattleScript_RoarSuccessRet_Ret
jumpifbyte CMP_EQUAL, sSWITCH_CASE, B_SWITCH_RED_CARD, BattleScript_RoarSuccessRet_Ret
attackanimation attackanimation
waitanimation waitanimation
BattleScript_RoarSuccessRet_Ret:
switchoutabilities BS_TARGET switchoutabilities BS_TARGET
returntoball BS_TARGET returntoball BS_TARGET
waitstate waitstate
@ -5599,6 +5845,21 @@ BattleScript_TargetItemStatRaise::
removeitem BS_TARGET removeitem BS_TARGET
BattleScript_TargetItemStatRaiseRemoveItemRet: BattleScript_TargetItemStatRaiseRemoveItemRet:
return return
BattleScript_AttackerItemStatRaise::
copybyte sBATTLER, gBattlerAttacker
statbuffchange MOVE_EFFECT_AFFECTS_USER, BattleScript_AttackerItemStatRaiseRet
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AttackerItemStatRaiseRet
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
waitanimation
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
waitanimation
printstring STRINGID_USINGITEMSTATOFPKMNROSE
waitmessage 0x40
removeitem BS_ATTACKER
BattleScript_AttackerItemStatRaiseRet:
return
BattleScript_MistProtected:: BattleScript_MistProtected::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
@ -5744,6 +6005,76 @@ BattleScript_PerishBodyActivates::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
return return
BattleScript_GulpMissileGorging::
call BattleScript_AbilityPopUp
playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL
waitanimation
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
effectivenesssound
hitanimation BS_ATTACKER
waitstate
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_GulpMissileNoDmgGorging
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL
getbattlerfainted BS_ATTACKER
jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGorging
BattleScript_GulpMissileNoDmgGorging:
handleformchange BS_TARGET, 0
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
swapattackerwithtarget
setmoveeffect MOVE_EFFECT_PARALYSIS
seteffectprimary
swapattackerwithtarget
return
BattleScript_GulpMissileNoSecondEffectGorging:
handleformchange BS_TARGET, 0
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
return
BattleScript_GulpMissileGulping::
call BattleScript_AbilityPopUp
playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL
waitanimation
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
effectivenesssound
hitanimation BS_ATTACKER
waitstate
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_GulpMissileNoDmgGulping
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL
getbattlerfainted BS_ATTACKER
jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGulping
jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping
jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping
jumpifability BS_ATTACKER, ABILITY_WHITE_SMOKE, BattleScript_GulpMissileNoSecondEffectGulping
jumpifflowerveilattacker BattleScript_GulpMissileNoSecondEffectGulping
BattleScript_GulpMissileNoDmgGulping:
handleformchange BS_TARGET, 0
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
swapattackerwithtarget @ to make gStatDownStringIds down below print the right battler
setstatchanger STAT_DEF, 1, TRUE
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_GulpMissileGorgingTargetDefenseCantGoLower
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
swapattackerwithtarget @ restore the battlers, just in case
return
BattleScript_GulpMissileNoSecondEffectGulping:
handleformchange BS_TARGET, 0
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
return
BattleScript_GulpMissileGorgingTargetDefenseCantGoLower:
printstring STRINGID_STATSWONTDECREASE
waitmessage B_WAIT_TIME_LONG
return
BattleScript_PerishSongCountGoesDown:: BattleScript_PerishSongCountGoesDown::
printstring STRINGID_PKMNPERISHCOUNTFELL printstring STRINGID_PKMNPERISHCOUNTFELL
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
@ -6078,6 +6409,17 @@ BattleScript_MagicCoatBounce::
setmagiccoattarget BS_ATTACKER setmagiccoattarget BS_ATTACKER
return return
BattleScript_MagicCoatBouncePrankster::
attackstring
ppreduce
pause B_WAIT_TIME_SHORT
printfromtable gMagicCoatBounceStringIds
waitmessage B_WAIT_TIME_LONG
printstring STRINGID_ITDOESNTAFFECT
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
goto BattleScript_MoveEnd
BattleScript_SnatchedMove:: BattleScript_SnatchedMove::
attackstring attackstring
ppreduce ppreduce
@ -6882,6 +7224,19 @@ BattleScript_SnowWarningActivates::
playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL
call BattleScript_WeatherFormChanges call BattleScript_WeatherFormChanges
end3 end3
BattleScript_TerrainSeedLoop:
savetarget
setbyte gBattlerTarget, 0
BattleScript_TerrainSeedLoopIter:
copybyte sBATTLER, gBattlerTarget
doterrainseed BS_TARGET, BattleScript_TerrainSeedLoop_NextBattler
removeitem BS_TARGET
BattleScript_TerrainSeedLoop_NextBattler:
addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter
restoretarget
return
BattleScript_ElectricSurgeActivates:: BattleScript_ElectricSurgeActivates::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
@ -6889,6 +7244,7 @@ BattleScript_ElectricSurgeActivates::
printstring STRINGID_TERRAINBECOMESELECTRIC printstring STRINGID_TERRAINBECOMESELECTRIC
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
call BattleScript_TerrainSeedLoop
end3 end3
BattleScript_MistySurgeActivates:: BattleScript_MistySurgeActivates::
@ -6897,6 +7253,7 @@ BattleScript_MistySurgeActivates::
printstring STRINGID_TERRAINBECOMESMISTY printstring STRINGID_TERRAINBECOMESMISTY
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
call BattleScript_TerrainSeedLoop
end3 end3
BattleScript_GrassySurgeActivates:: BattleScript_GrassySurgeActivates::
@ -6905,6 +7262,7 @@ BattleScript_GrassySurgeActivates::
printstring STRINGID_TERRAINBECOMESGRASSY printstring STRINGID_TERRAINBECOMESGRASSY
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
call BattleScript_TerrainSeedLoop
end3 end3
BattleScript_PsychicSurgeActivates:: BattleScript_PsychicSurgeActivates::
@ -6913,6 +7271,7 @@ BattleScript_PsychicSurgeActivates::
printstring STRINGID_TERRAINBECOMESPSYCHIC printstring STRINGID_TERRAINBECOMESPSYCHIC
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
call BattleScript_TerrainSeedLoop
end3 end3
BattleScript_BadDreamsActivates:: BattleScript_BadDreamsActivates::
@ -7064,6 +7423,7 @@ BattleScript_SoundproofProtected::
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXBLOCKSY printstring STRINGID_PKMNSXBLOCKSY
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_DazzlingProtected:: BattleScript_DazzlingProtected::
@ -7107,6 +7467,7 @@ BattleScript_AbilityNoSpecificStatLoss::
printstring STRINGID_PKMNSXPREVENTSYLOSS printstring STRINGID_PKMNSXPREVENTSYLOSS
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY
orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
return return
BattleScript_StickyHoldActivates:: BattleScript_StickyHoldActivates::
@ -7355,6 +7716,19 @@ BattleScript_AbilityStatusEffect::
seteffectsecondary seteffectsecondary
return return
BattleScript_BattleBondActivatesOnMoveEndAttacker::
pause 5
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
printstring STRINGID_ATTACKERBECAMEFULLYCHARGED
handleformchange BS_ATTACKER, 0
handleformchange BS_ATTACKER, 1
playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_ATTACKER, 2
printstring STRINGID_ATTACKERBECAMEASHSPECIES
return
BattleScript_DancerActivates:: BattleScript_DancerActivates::
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
waitmessage B_WAIT_TIME_SHORT waitmessage B_WAIT_TIME_SHORT
@ -7517,6 +7891,7 @@ BattleScript_BerryReduceDmg::
BattleScript_PrintBerryReduceString:: BattleScript_PrintBerryReduceString::
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
printstring STRINGID_BERRYDMGREDUCES printstring STRINGID_BERRYDMGREDUCES
waitmessage B_WAIT_TIME_LONG
return return
BattleScript_BerryCureConfusionEnd2:: BattleScript_BerryCureConfusionEnd2::
@ -7542,6 +7917,19 @@ BattleScript_BerryCureChosenStatusRet::
removeitem BS_SCRIPTING removeitem BS_SCRIPTING
return return
BattleScript_MentalHerbCureRet::
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
printfromtable gMentalHerbCureStringIds
waitmessage B_WAIT_TIME_LONG
updatestatusicon BS_SCRIPTING
removeitem BS_SCRIPTING
copybyte gBattlerAttacker, sSAVED_BATTLER @ restore the original attacker just to be safe
return
BattleScript_MentalHerbCureEnd2::
call BattleScript_MentalHerbCureRet
end2
BattleScript_WhiteHerbEnd2:: BattleScript_WhiteHerbEnd2::
call BattleScript_WhiteHerbRet call BattleScript_WhiteHerbRet
end2 end2
@ -7695,12 +8083,13 @@ BattleScript_BerryStatRaiseEnd2::
BattleScript_BerryStatRaiseEnd2_AbilityPopup: BattleScript_BerryStatRaiseEnd2_AbilityPopup:
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
BattleScript_BerryStatRaiseEnd2_Anim: BattleScript_BerryStatRaiseEnd2_Anim:
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseEnd2_End
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseDoStatUp setgraphicalstatchangevalues
BattleScript_BerryStatRaiseDoStatUp:: playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM
call BattleScript_StatUp call BattleScript_StatUp
removeitem BS_ATTACKER removeitem BS_ATTACKER
BattleScript_BerryStatRaiseEnd2_End::
end2 end2
BattleScript_BerryStatRaiseRet:: BattleScript_BerryStatRaiseRet::
@ -7709,12 +8098,13 @@ BattleScript_BerryStatRaiseRet::
BattleScript_BerryStatRaiseRet_AbilityPopup: BattleScript_BerryStatRaiseRet_AbilityPopup:
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
BattleScript_BerryStatRaiseRet_Anim: BattleScript_BerryStatRaiseRet_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseRet_End statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseRet_End
BattleScript_BerryStatRaiseRet_End: setgraphicalstatchangevalues
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM
call BattleScript_StatUp call BattleScript_StatUp
removeitem BS_SCRIPTING removeitem BS_SCRIPTING
BattleScript_BerryStatRaiseRet_End:
return return
BattleScript_BerryFocusEnergyEnd2:: BattleScript_BerryFocusEnergyEnd2::
@ -7968,3 +8358,69 @@ BattleScript_StickyBarbTransfer::
removeitem BS_TARGET removeitem BS_TARGET
return return
BattleScript_RedCardActivates::
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_REDCARDACTIVATE
waitmessage 0x40
swapattackerwithtarget
jumpifstatus3 BS_EFFECT_BATTLER, STATUS3_ROOTED, BattleScript_RedCardIngrain
jumpifability BS_EFFECT_BATTLER, ABILITY_SUCTION_CUPS, BattleScript_RedCardSuctionCups
setbyte sSWITCH_CASE, B_SWITCH_RED_CARD
forcerandomswitch BattleScript_RedCardEnd
@ changes the current battle script. the rest happens in BattleScript_RoarSuccessSwitch_Ret, if switch is successful
BattleScript_RedCardEnd:
return
BattleScript_RedCardIngrain:
printstring STRINGID_PKMNANCHOREDITSELF
waitmessage 0x40
removeitem BS_SCRIPTING
swapattackerwithtarget
return
BattleScript_RedCardSuctionCups:
printstring STRINGID_PKMNANCHORSITSELFWITH
waitmessage 0x40
removeitem BS_SCRIPTING
swapattackerwithtarget
return
BattleScript_EjectButtonActivates::
makevisible BS_ATTACKER
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_EJECTBUTTONACTIVATE
waitmessage 0x40
removeitem BS_SCRIPTING
makeinvisible BS_SCRIPTING
openpartyscreen BS_SCRIPTING, BattleScript_EjectButtonEnd
switchoutabilities BS_SCRIPTING
waitstate
switchhandleorder BS_SCRIPTING 0x2
returntoball BS_SCRIPTING
getswitchedmondata BS_SCRIPTING
switchindataupdate BS_SCRIPTING
hpthresholds BS_SCRIPTING
printstring 0x3
switchinanim BS_SCRIPTING 0x1
waitstate
switchineffects BS_SCRIPTING
BattleScript_EjectButtonEnd:
return
BattleScript_EjectPackActivate_Ret::
goto BattleScript_EjectButtonActivates
BattleScript_EjectPackActivate_End2::
call BattleScript_EjectPackActivate_Ret
end2
BattleScript_EjectPackActivates::
jumpifcantswitch BS_SCRIPTING, BattleScript_EjectButtonEnd
goto BattleScript_EjectPackActivate_Ret
BattleScript_DarkTypePreventsPrankster::
attackstring
ppreduce
pause B_WAIT_TIME_SHORT
printstring STRINGID_ITDOESNTAFFECT
waitmessage B_WAIT_TIME_LONG
orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
goto BattleScript_MoveEnd

View File

@ -119,6 +119,7 @@ struct ProtectStruct
u32 spikyShielded:1; u32 spikyShielded:1;
u32 kingsShielded:1; u32 kingsShielded:1;
u32 banefulBunkered:1; u32 banefulBunkered:1;
u32 obstructed:1;
u32 endured:1; u32 endured:1;
u32 noValidMoves:1; u32 noValidMoves:1;
u32 helpingHand:1; u32 helpingHand:1;
@ -126,7 +127,7 @@ struct ProtectStruct
u32 stealMove:1; u32 stealMove:1;
u32 prlzImmobility:1; u32 prlzImmobility:1;
u32 confusionSelfDmg:1; u32 confusionSelfDmg:1;
u32 targetNotAffected:1; u32 targetAffected:1;
u32 chargingTurn:1; u32 chargingTurn:1;
u32 fleeFlag:2; // For RunAway and Smoke Ball. u32 fleeFlag:2; // For RunAway and Smoke Ball.
u32 usedImprisonedMove:1; u32 usedImprisonedMove:1;
@ -142,9 +143,13 @@ struct ProtectStruct
u32 usedGravityPreventedMove:1; u32 usedGravityPreventedMove:1;
u32 powderSelfDmg:1; u32 powderSelfDmg:1;
u32 usedThroatChopPreventedMove:1; u32 usedThroatChopPreventedMove:1;
u32 statRaised:1;
u32 micle:1; u32 micle:1;
u32 custap:1; // also quick claw u32 custap:1; // also quick claw
u32 touchedProtectLike:1; u32 touchedProtectLike:1;
u32 disableEjectPack:1;
u32 statFell:1;
u32 pranksterElevated:1;
u32 physicalDmg; u32 physicalDmg;
u32 specialDmg; u32 specialDmg;
u8 physicalBattlerId; u8 physicalBattlerId;
@ -596,6 +601,7 @@ struct BattleStruct
u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon. u16 changedSpecies[PARTY_SIZE]; // For Zygarde or future forms when multiple mons can change into the same pokemon.
u8 quickClawBattlerId; u8 quickClawBattlerId;
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member) struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
u8 blunderPolicy:1; // should blunder policy activate
}; };
#define GET_MOVE_TYPE(move, typeArg) \ #define GET_MOVE_TYPE(move, typeArg) \
@ -667,8 +673,9 @@ struct BattleScripting
u16 moveEffect; u16 moveEffect;
u16 multihitMoveEffect; u16 multihitMoveEffect;
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN. u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.
bool8 fixedPopup; // force ability popup to stick until manually called back bool8 fixedPopup; // Force ability popup to stick until manually called back
u16 abilityPopupOverwrite; u16 abilityPopupOverwrite;
u8 switchCase; // Special switching conditions, eg. red card
}; };
// rom_80A5C6C // rom_80A5C6C

View File

@ -119,10 +119,10 @@ bool32 IsUngroundingEffect(u16 effect);
bool32 IsSemiInvulnerable(u8 battlerDef, u16 move); bool32 IsSemiInvulnerable(u8 battlerDef, u16 move);
// status checks // status checks
bool32 CanBeBurned(u8 battler, u16 ability); bool32 AI_CanBeBurned(u8 battler, u16 ability);
bool32 CanBePoisoned(u8 battler, u16 ability); bool32 AI_CanBePoisoned(u8 battler, u16 ability);
bool32 CanBeConfused(u8 battler, u16 ability); bool32 AI_CanBeConfused(u8 battler, u16 ability);
bool32 CanSleep(u8 battler, u16 ability); bool32 AI_CanSleep(u8 battler, u16 ability);
bool32 IsBattlerIncapacitated(u8 battler, u16 ability); bool32 IsBattlerIncapacitated(u8 battler, u16 ability);
bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove); bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
bool32 ShouldPoisonSelf(u8 battler, u16 ability); bool32 ShouldPoisonSelf(u8 battler, u16 ability);

View File

@ -185,6 +185,7 @@ extern struct UnusedControllerStruct gUnusedControllerStruct;
void HandleLinkBattleSetup(void); void HandleLinkBattleSetup(void);
void SetUpBattleVarsAndBirchZigzagoon(void); void SetUpBattleVarsAndBirchZigzagoon(void);
void InitBattleControllers(void); void InitBattleControllers(void);
bool32 IsValidForBattle(struct Pokemon *mon);
void TryReceiveLinkBattleData(void); void TryReceiveLinkBattleData(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);

View File

@ -13,6 +13,7 @@ struct StatFractions
}; };
s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility); s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility);
s8 GetInverseCritChance(u8 battlerAtk, u8 battlerDef, u32 move);
u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move); u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move);
u8 GetBattlerTurnOrderNum(u8 battlerId); u8 GetBattlerTurnOrderNum(u8 battlerId);
bool32 NoAliveMonsForEitherParty(void); bool32 NoAliveMonsForEitherParty(void);

View File

@ -97,6 +97,7 @@ extern const u8 BattleScript_SelectingImprisonedMove[];
extern const u8 BattleScript_SelectingImprisonedMoveInPalace[]; extern const u8 BattleScript_SelectingImprisonedMoveInPalace[];
extern const u8 BattleScript_GrudgeTakesPp[]; extern const u8 BattleScript_GrudgeTakesPp[];
extern const u8 BattleScript_MagicCoatBounce[]; extern const u8 BattleScript_MagicCoatBounce[];
extern const u8 BattleScript_MagicCoatBouncePrankster[];
extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_SnatchedMove[];
extern const u8 BattleScript_EnduredMsg[]; extern const u8 BattleScript_EnduredMsg[];
extern const u8 BattleScript_OneHitKOMsg[]; extern const u8 BattleScript_OneHitKOMsg[];
@ -373,6 +374,20 @@ extern const u8 BattleScript_BattlerShookOffTaunt[];
extern const u8 BattleScript_BattlerGotOverItsInfatuation[]; extern const u8 BattleScript_BattlerGotOverItsInfatuation[];
extern const u8 BattleScript_Pickpocket[]; extern const u8 BattleScript_Pickpocket[];
extern const u8 BattleScript_StickyBarbTransfer[]; extern const u8 BattleScript_StickyBarbTransfer[];
extern const u8 BattleScript_AttackerItemStatRaise[];
extern const u8 BattleScript_RedCardActivates[];
extern const u8 BattleScript_EjectButtonActivates[];
extern const u8 BattleScript_EjectPackActivate_Ret[];
extern const u8 BattleScript_EjectPackActivate_End2[];
extern const u8 BattleScript_EjectPackActivates[];
extern const u8 BattleScript_MentalHerbCureRet[];
extern const u8 BattleScript_MentalHerbCureEnd2[];
extern const u8 BattleScript_TerrainPreventsEnd2[];
extern const u8 BattleScript_MistyTerrainPrevents[];
extern const u8 BattleScript_ElectricTerrainPrevents[];
extern const u8 BattleScript_DarkTypePreventsPrankster[];
extern const u8 BattleScript_GulpMissileGorging[];
extern const u8 BattleScript_GulpMissileGulping[];
extern const u8 BattleScript_BattleBondActivatesOnMoveEndAttacker[];
#endif // GUARD_BATTLE_SCRIPTS_H #endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -28,9 +28,10 @@
#define ITEMEFFECT_ON_SWITCH_IN 0x0 #define ITEMEFFECT_ON_SWITCH_IN 0x0
#define ITEMEFFECT_MOVE_END 0x3 #define ITEMEFFECT_MOVE_END 0x3
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4 #define ITEMEFFECT_KINGSROCK 0x4
#define ITEMEFFECT_TARGET 0x5 #define ITEMEFFECT_TARGET 0x5
#define ITEMEFFECT_ORBS 0x6 #define ITEMEFFECT_ORBS 0x6
#define ITEMEFFECT_LIFEORB_SHELLBELL 0x7
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK))) #define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
@ -46,7 +47,7 @@ struct TypePower
extern const struct TypePower gNaturalGiftTable[]; extern const struct TypePower gNaturalGiftTable[];
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide); bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move);
void HandleAction_UseMove(void); void HandleAction_UseMove(void);
void HandleAction_Switch(void); void HandleAction_Switch(void);
void HandleAction_UseItem(void); void HandleAction_UseItem(void);
@ -144,6 +145,14 @@ void TryRestoreStolenItems(void);
bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item); bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item);
void TrySaveExchangedItem(u8 battlerId, u16 stolenItem); void TrySaveExchangedItem(u8 battlerId, u16 stolenItem);
bool32 IsPartnerMonFromSameTrainer(u8 battlerId); bool32 IsPartnerMonFromSameTrainer(u8 battlerId);
u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute);
bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes);
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
bool32 TryRoomService(u8 battlerId);
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
void DoBurmyFormChange(u32 monId);
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef);
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags); bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
// ability checks // ability checks
@ -155,4 +164,12 @@ bool32 IsGastroAcidBannedAbility(u16 ability);
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability); bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability); bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
bool32 CanSleep(u8 battlerId);
bool32 CanBePoisoned(u8 battlerId);
bool32 CanBeBurned(u8 battlerId);
bool32 CanBeParalyzed(u8 battlerId);
bool32 CanBeFrozen(u8 battlerId);
bool32 CanBeConfused(u8 battlerId);
bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -239,7 +239,7 @@
#define STATUS_FIELD_FAIRY_LOCK (1 << 11) #define STATUS_FIELD_FAIRY_LOCK (1 << 11)
#define STATUS_FIELD_TERRAIN_PERMANENT (1 << 12) // Overworld thunderstorm generates electric terrain #define STATUS_FIELD_TERRAIN_PERMANENT (1 << 12) // Overworld thunderstorm generates electric terrain
#define STATUS_TERRAIN_ANY (STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN) #define STATUS_FIELD_TERRAIN_ANY (STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN)
// Flags describing move's result // Flags describing move's result
#define MOVE_RESULT_MISSED (1 << 0) #define MOVE_RESULT_MISSED (1 << 0)
@ -347,7 +347,8 @@
#define MOVE_EFFECT_THROAT_CHOP 0x43 #define MOVE_EFFECT_THROAT_CHOP 0x43
#define MOVE_EFFECT_INCINERATE 0x44 #define MOVE_EFFECT_INCINERATE 0x44
#define MOVE_EFFECT_BUG_BITE 0x45 #define MOVE_EFFECT_BUG_BITE 0x45
#define NUM_MOVE_EFFECTS 0x46 #define MOVE_EFFECT_RECOIL_HP_25 0x46
#define NUM_MOVE_EFFECTS 0x47
#define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000 #define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -523,6 +523,7 @@
#define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit #define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit
#define B_ANIM_RESTORE_BG 27 // for Terrain Endings #define B_ANIM_RESTORE_BG 27 // for Terrain Endings
#define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare #define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare
#define B_ANIM_GULP_MISSILE 29
// special animations table (gBattleAnims_Special) // special animations table (gBattleAnims_Special)
#define B_ANIM_LVL_UP 0 #define B_ANIM_LVL_UP 0

View File

@ -37,6 +37,14 @@
#define SPECIES_ZYGARDE 0 // 50% #define SPECIES_ZYGARDE 0 // 50%
#define SPECIES_ZYGARDE_10 10011 // 10 % #define SPECIES_ZYGARDE_10 10011 // 10 %
#define SPECIES_ZYGARDE_COMPLETE 10012 // 100 % #define SPECIES_ZYGARDE_COMPLETE 10012 // 100 %
#define SPECIES_BURMY 0
#define SPECIES_BURMY_SANDY_CLOAK 10013
#define SPECIES_BURMY_TRASH_CLOAK 10014
#define SPECIES_CRAMORANT 0
#define SPECIES_CRAMORANT_GORGING 10015
#define SPECIES_CRAMORANT_GULPING 10016
#define SPECIES_GRENINJA_BATTLE_BOND 0
#define SPECIES_GRENINJA_ASH 10017
#endif #endif
// Items with peculiar battle effects. // Items with peculiar battle effects.
@ -121,16 +129,18 @@
#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. #define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. #define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.
#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag. #define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag.
#define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation.
#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. #define B_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_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 the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities.
#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon.
// Item settings // Item settings
#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. #define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end.
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. #define B_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+, mental herb cures Taunt, Encore, Heal Block, and Disable #define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable
// Flag settings // Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.

View File

@ -236,7 +236,7 @@
#define EFFECT_ROUND 230 #define EFFECT_ROUND 230
#define EFFECT_BRINE 231 #define EFFECT_BRINE 231
#define EFFECT_VENOSHOCK 232 #define EFFECT_VENOSHOCK 232
#define EFFECT_RETALITATE 233 #define EFFECT_RETALIATE 233
#define EFFECT_BULLDOZE 234 #define EFFECT_BULLDOZE 234
#define EFFECT_FOUL_PLAY 235 #define EFFECT_FOUL_PLAY 235
#define EFFECT_PSYSHOCK 236 #define EFFECT_PSYSHOCK 236
@ -353,7 +353,18 @@
#define EFFECT_SLEEP_HIT 347 #define EFFECT_SLEEP_HIT 347
#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348 #define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348
#define EFFECT_BODY_PRESS 349 #define EFFECT_BODY_PRESS 349
#define EFFECT_EERIE_SPELL 350
#define EFFECT_JUNGLE_HEALING 351
#define EFFECT_COACHING 352
#define EFFECT_LASH_OUT 353
#define EFFECT_GRASSY_GLIDE 354
#define EFFECT_REMOVE_TERRAIN 355
#define EFFECT_DYNAMAX_DOUBLE_DMG 356
#define EFFECT_DECORATE 357
#define EFFECT_SNIPE_SHOT 358
#define EFFECT_TRIPLE_HIT 359
#define EFFECT_RECOIL_HP_25 360
#define NUM_BATTLE_MOVE_EFFECTS 350 #define NUM_BATTLE_MOVE_EFFECTS 361
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -37,6 +37,7 @@
#define sILLUSION_NICK_HACK gBattleScripting + 0x32 #define sILLUSION_NICK_HACK gBattleScripting + 0x32
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33 #define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
#define sABILITY_OVERWRITE gBattleScripting + 0x34 #define sABILITY_OVERWRITE gBattleScripting + 0x34
#define sSWITCH_CASE gBattleScripting + 0x36
#define cMULTISTRING_CHOOSER gBattleCommunication + 5 #define cMULTISTRING_CHOOSER gBattleCommunication + 5
#define cMISS_TYPE gBattleCommunication + 6 #define cMISS_TYPE gBattleCommunication + 6
@ -174,7 +175,16 @@
#define VARIOUS_TOTEM_BOOST 103 #define VARIOUS_TOTEM_BOOST 103
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104 #define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
#define VARIOUS_MOVEEND_ITEM_EFFECTS 105 #define VARIOUS_MOVEEND_ITEM_EFFECTS 105
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 106 #define VARIOUS_TERRAIN_SEED 106
#define VARIOUS_MAKE_INVISIBLE 107
#define VARIOUS_ROOM_SERVICE 108
#define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109
#define VARIOUS_EERIE_SPELL_PP_REDUCE 110
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 111
#define VARIOUS_TRY_HEAL_QUARTER_HP 112
#define VARIOUS_REMOVE_TERRAIN 113
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 115
// Cmd_manipulatedamage // Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0 #define DMG_CHANGE_SIGN 0
@ -229,16 +239,24 @@
#define MOVEEND_ITEM_EFFECTS_TARGET 13 #define MOVEEND_ITEM_EFFECTS_TARGET 13
#define MOVEEND_MOVE_EFFECTS2 14 #define MOVEEND_MOVE_EFFECTS2 14
#define MOVEEND_ITEM_EFFECTS_ALL 15 #define MOVEEND_ITEM_EFFECTS_ALL 15
#define MOVEEND_KINGSROCK_SHELLBELL 16 #define MOVEEND_KINGSROCK 16 // These item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 17 #define MOVEEND_SUBSTITUTE 17
#define MOVEEND_UPDATE_LAST_MOVES 18 #define MOVEEND_UPDATE_LAST_MOVES 18
#define MOVEEND_MIRROR_MOVE 19 #define MOVEEND_MIRROR_MOVE 19
#define MOVEEND_NEXT_TARGET 20 #define MOVEEND_NEXT_TARGET 20 // Everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_LIFE_ORB 21 #define MOVEEND_EJECT_BUTTON 21
#define MOVEEND_PICKPOCKET 22 #define MOVEEND_RED_CARD 22
#define MOVEEND_DANCER 23 #define MOVEEND_EJECT_PACK 23
#define MOVEEND_EMERGENCY_EXIT 24 #define MOVEEND_LIFEORB_SHELLBELL 24 // Includes shell bell, throat spray, etc
#define MOVEEND_CLEAR_BITS 25 #define MOVEEND_PICKPOCKET 25
#define MOVEEND_COUNT 26 #define MOVEEND_DANCER 26
#define MOVEEND_EMERGENCY_EXIT 27
#define MOVEEND_CLEAR_BITS 28
#define MOVEEND_COUNT 29
// switch cases
#define B_SWITCH_NORMAL 0
#define B_SWITCH_HIT 1 // dragon tail, circle throw
#define B_SWITCH_RED_CARD 2
#endif // GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H #endif // GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H

View File

@ -573,8 +573,15 @@
#define STRINGID_ITEMCANNOTBEREMOVED 569 #define STRINGID_ITEMCANNOTBEREMOVED 569
#define STRINGID_STICKYBARBTRANSFER 570 #define STRINGID_STICKYBARBTRANSFER 570
#define STRINGID_PKMNBURNHEALED 571 #define STRINGID_PKMNBURNHEALED 571
#define STRINGID_REDCARDACTIVATE 572
#define STRINGID_EJECTBUTTONACTIVATE 573
#define STRINGID_ATKGOTOVERINFATUATION 574
#define STRINGID_TORMENTEDNOMORE 575
#define STRINGID_HEALBLOCKEDNOMORE 576
#define STRINGID_ATTACKERBECAMEFULLYCHARGED 577
#define STRINGID_ATTACKERBECAMEASHSPECIES 578
#define BATTLESTRINGS_COUNT 572 #define BATTLESTRINGS_COUNT 579
// The below IDs are all indexes into battle message tables, // The below IDs are all indexes into battle message tables,
// used to determine which of a set of messages to print. // used to determine which of a set of messages to print.
@ -810,4 +817,17 @@
#define B_MSG_SWITCHIN_ASONE 13 #define B_MSG_SWITCHIN_ASONE 13
#define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14 #define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14
// gMentalHerbCureStringIds
#define B_MSG_MENTALHERBCURE_INFATUATION 0
#define B_MSG_MENTALHERBCURE_TAUNT 1
#define B_MSG_MENTALHERBCURE_ENCORE 2
#define B_MSG_MENTALHERBCURE_TORMENT 3
#define B_MSG_MENTALHERBCURE_HEALBLOCK 4
#define B_MSG_MENTALHERBCURE_DISABLE 5
// gTerrainPreventsStringIds
#define B_MSG_TERRAINPREVENTS_MISTY 0
#define B_MSG_TERRAINPREVENTS_ELECTRIC 1
#define B_MSG_TERRAINPREVENTS_PSYCHIC 2
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -29,7 +29,7 @@
#define HOLD_EFFECT_EXP_SHARE 25 #define HOLD_EFFECT_EXP_SHARE 25
#define HOLD_EFFECT_QUICK_CLAW 26 #define HOLD_EFFECT_QUICK_CLAW 26
#define HOLD_EFFECT_FRIENDSHIP_UP 27 #define HOLD_EFFECT_FRIENDSHIP_UP 27
#define HOLD_EFFECT_CURE_ATTRACT 28 #define HOLD_EFFECT_MENTAL_HERB 28
#define HOLD_EFFECT_CHOICE_BAND 29 #define HOLD_EFFECT_CHOICE_BAND 29
#define HOLD_EFFECT_FLINCH 30 #define HOLD_EFFECT_FLINCH 30
#define HOLD_EFFECT_BUG_POWER 31 #define HOLD_EFFECT_BUG_POWER 31
@ -154,4 +154,10 @@
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS)) #define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
// Terrain seed params
#define HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN 0
#define HOLD_EFFECT_PARAM_GRASSY_TERRAIN 1
#define HOLD_EFFECT_PARAM_MISTY_TERRAIN 2
#define HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN 3
#endif // GUARD_HOLD_EFFECTS_H #endif // GUARD_HOLD_EFFECTS_H

View File

@ -520,6 +520,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
u32 i; u32 i;
u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
if (IsTargetingPartner(battlerAtk, battlerDef)) if (IsTargetingPartner(battlerAtk, battlerDef))
return score; return score;
@ -1204,7 +1207,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_DISABLE: case EFFECT_DISABLE:
if (gDisableStructs[battlerDef].disableTimer == 0 if (gDisableStructs[battlerDef].disableTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT) && (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)
&& !PartnerHasSameMoveEffectWithoutTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove)) && !PartnerHasSameMoveEffectWithoutTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove))
{ {
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first
@ -1224,7 +1227,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_ENCORE: case EFFECT_ENCORE:
if (gDisableStructs[battlerDef].encoreTimer == 0 if (gDisableStructs[battlerDef].encoreTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT) && (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)
&& !DoesPartnerHaveSameMoveEffect(AI_DATA->battlerAtkPartner, battlerDef, move, AI_DATA->partnerMove)) && !DoesPartnerHaveSameMoveEffect(AI_DATA->battlerAtkPartner, battlerDef, move, AI_DATA->partnerMove))
{ {
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // attacker should go first
@ -1458,7 +1461,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
} }
if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_CURE_ATTRACT) if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_MENTAL_HERB)
score -= 6; score -= 6;
break; break;
case EFFECT_WILL_O_WISP: case EFFECT_WILL_O_WISP:
@ -1570,7 +1573,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10; score -= 10;
break; break;
case EFFECT_REST: case EFFECT_REST:
if (!CanSleep(battlerAtk, AI_DATA->atkAbility)) if (!AI_CanSleep(battlerAtk, AI_DATA->atkAbility))
score -= 10; score -= 10;
//fallthrough //fallthrough
case EFFECT_RESTORE_HP: case EFFECT_RESTORE_HP:
@ -2472,7 +2475,10 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->atkAbility) < 0); bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->atkAbility) < 0);
bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0); bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0);
u16 predictedMove = gLastMoves[battlerDef]; //for now u16 predictedMove = gLastMoves[battlerDef]; //for now
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
// check what effect partner is using // check what effect partner is using
if (AI_DATA->partnerMove != 0) if (AI_DATA->partnerMove != 0)
{ {
@ -2686,7 +2692,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
case EFFECT_SWAGGER: case EFFECT_SWAGGER:
if (gBattleMons[battlerAtkPartner].statStages[STAT_ATK] < MAX_STAT_STAGE if (gBattleMons[battlerAtkPartner].statStages[STAT_ATK] < MAX_STAT_STAGE
&& HasMoveWithSplit(battlerAtkPartner, SPLIT_PHYSICAL) && HasMoveWithSplit(battlerAtkPartner, SPLIT_PHYSICAL)
&& (!CanBeConfused(battlerAtkPartner, TRUE) && (!AI_CanBeConfused(battlerAtkPartner, TRUE)
|| atkPartnerHoldEffect == HOLD_EFFECT_CURE_CONFUSION || atkPartnerHoldEffect == HOLD_EFFECT_CURE_CONFUSION
|| atkPartnerHoldEffect == HOLD_EFFECT_CURE_STATUS)) || atkPartnerHoldEffect == HOLD_EFFECT_CURE_STATUS))
{ {
@ -2696,7 +2702,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
case EFFECT_FLATTER: case EFFECT_FLATTER:
if (gBattleMons[battlerAtkPartner].statStages[STAT_SPATK] < MAX_STAT_STAGE if (gBattleMons[battlerAtkPartner].statStages[STAT_SPATK] < MAX_STAT_STAGE
&& HasMoveWithSplit(battlerAtkPartner, SPLIT_SPECIAL) && HasMoveWithSplit(battlerAtkPartner, SPLIT_SPECIAL)
&& (!CanBeConfused(battlerAtkPartner, TRUE) && (!AI_CanBeConfused(battlerAtkPartner, TRUE)
|| atkPartnerHoldEffect == HOLD_EFFECT_CURE_CONFUSION || atkPartnerHoldEffect == HOLD_EFFECT_CURE_CONFUSION
|| atkPartnerHoldEffect == HOLD_EFFECT_CURE_STATUS)) || atkPartnerHoldEffect == HOLD_EFFECT_CURE_STATUS))
{ {
@ -3248,7 +3254,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
} }
break; break;
case EFFECT_REST: case EFFECT_REST:
if (!(CanSleep(battlerAtk, AI_DATA->atkAbility))) if (!(AI_CanSleep(battlerAtk, AI_DATA->atkAbility)))
{ {
break; break;
} }
@ -3408,7 +3414,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_DISABLE: case EFFECT_DISABLE:
if (gDisableStructs[battlerDef].disableTimer == 0 if (gDisableStructs[battlerDef].disableTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)) // mental herb && (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)) // mental herb
{ {
if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // AI goes first if (GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0) // AI goes first
{ {
@ -3430,7 +3436,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_ENCORE: case EFFECT_ENCORE:
if (gDisableStructs[battlerDef].encoreTimer == 0 if (gDisableStructs[battlerDef].encoreTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_CURE_ATTRACT)) // mental herb && (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect != HOLD_EFFECT_MENTAL_HERB)) // mental herb
{ {
if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect)) if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect))
score += 3; score += 3;
@ -3937,11 +3943,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score += 2; score += 2;
break; break;
case HOLD_EFFECT_TOXIC_ORB: case HOLD_EFFECT_TOXIC_ORB:
if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility) && CanBePoisoned(battlerDef, AI_DATA->defAbility)) if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility) && AI_CanBePoisoned(battlerDef, AI_DATA->defAbility))
score += 2; score += 2;
break; break;
case HOLD_EFFECT_FLAME_ORB: case HOLD_EFFECT_FLAME_ORB:
if (!ShouldBurnSelf(battlerAtk, AI_DATA->atkAbility) && CanBeBurned(battlerAtk, AI_DATA->defAbility)) if (!ShouldBurnSelf(battlerAtk, AI_DATA->atkAbility) && AI_CanBeBurned(battlerAtk, AI_DATA->defAbility))
score += 2; score += 2;
break; break;
case HOLD_EFFECT_BLACK_SLUDGE: case HOLD_EFFECT_BLACK_SLUDGE:
@ -4751,7 +4757,10 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
{ {
u16 effect = gBattleMoves[move].effect; u16 effect = gBattleMoves[move].effect;
u8 moveType = gBattleMoves[move].type; u8 moveType = gBattleMoves[move].type;
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
if (IsTargetingPartner(battlerAtk, battlerDef)) if (IsTargetingPartner(battlerAtk, battlerDef))
{ {
if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY) if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY)

View File

@ -711,7 +711,8 @@ static bool32 AI_GetIfCrit(u32 move, u8 battlerAtk, u8 battlerDef)
s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef)
{ {
s32 dmg, moveType; s32 dmg, moveType, critDmg, normalDmg;
s8 critChance;
SaveBattlerData(battlerAtk); SaveBattlerData(battlerAtk);
SaveBattlerData(battlerDef); SaveBattlerData(battlerDef);
@ -722,12 +723,22 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef)
gBattleStruct->dynamicMoveType = 0; gBattleStruct->dynamicMoveType = 0;
SetTypeBeforeUsingMove(move, battlerAtk); SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType); GET_MOVE_TYPE(move, moveType);
dmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, AI_GetIfCrit(move, battlerAtk, battlerDef), FALSE, FALSE);
critChance = GetInverseCritChance(battlerAtk, battlerDef, move);
normalDmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, FALSE, FALSE, FALSE);
critDmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, TRUE, FALSE, FALSE);
if(critChance == -1)
dmg = normalDmg;
else
dmg = (critDmg + normalDmg * (critChance - 1)) / critChance;
// handle dynamic move damage // handle dynamic move damage
switch (gBattleMoves[move].effect) switch (gBattleMoves[move].effect)
{ {
case EFFECT_LEVEL_DAMAGE: 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;
break; break;
case EFFECT_DRAGON_RAGE: case EFFECT_DRAGON_RAGE:
@ -736,20 +747,11 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef)
case EFFECT_SONICBOOM: case EFFECT_SONICBOOM:
dmg = 20; dmg = 20;
break; break;
case EFFECT_PSYWAVE:
{
u32 randDamage;
if (B_PSYWAVE_DMG >= GEN_6)
randDamage = (Random() % 101);
else
randDamage = (Random() % 11) * 10;
dmg = gBattleMons[battlerAtk].level * (randDamage + 50) / 100;
}
break;
//case EFFECT_METAL_BURST: //case EFFECT_METAL_BURST:
//case EFFECT_COUNTER: //case EFFECT_COUNTER:
default: default:
dmg *= (100 - (Random() % 10)) / 100; // add random factor //do not add the random factor, it's an average case analysis
//dmg *= (100 - (Random() % 10)) / 100; // add random factor
break; break;
} }
@ -2589,7 +2591,7 @@ bool32 IsBattlerIncapacitated(u8 battler, u16 ability)
return FALSE; return FALSE;
} }
bool32 CanSleep(u8 battler, u16 ability) bool32 AI_CanSleep(u8 battler, u16 ability)
{ {
if (ability == ABILITY_INSOMNIA if (ability == ABILITY_INSOMNIA
|| ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_VITAL_SPIRIT
@ -2603,7 +2605,7 @@ bool32 CanSleep(u8 battler, u16 ability)
bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove)
{ {
if (!CanSleep(battlerDef, defAbility) if (!AI_CanSleep(battlerDef, defAbility)
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|| PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep
@ -2611,7 +2613,7 @@ bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move,
return TRUE; return TRUE;
} }
bool32 CanBePoisoned(u8 battler, u16 ability) bool32 AI_CanBePoisoned(u8 battler, u16 ability)
{ {
if (ability == ABILITY_IMMUNITY if (ability == ABILITY_IMMUNITY
|| ability == ABILITY_PASTEL_VEIL || ability == ABILITY_PASTEL_VEIL
@ -2624,7 +2626,7 @@ bool32 CanBePoisoned(u8 battler, u16 ability)
bool32 ShouldPoisonSelf(u8 battler, u16 ability) bool32 ShouldPoisonSelf(u8 battler, u16 ability)
{ {
if (CanBePoisoned(battler, ability) && ( if (AI_CanBePoisoned(battler, ability) && (
ability == ABILITY_MARVEL_SCALE ability == ABILITY_MARVEL_SCALE
|| ability == ABILITY_POISON_HEAL || ability == ABILITY_POISON_HEAL
|| ability == ABILITY_QUICK_FEET || ability == ABILITY_QUICK_FEET
@ -2639,7 +2641,7 @@ bool32 ShouldPoisonSelf(u8 battler, u16 ability)
bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove)
{ {
if (!CanBePoisoned(battlerDef, defAbility) if (!AI_CanBePoisoned(battlerDef, defAbility)
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|| PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove))
@ -2673,7 +2675,7 @@ bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u1
return TRUE; return TRUE;
} }
bool32 CanBeConfused(u8 battler, u16 ability) bool32 AI_CanBeConfused(u8 battler, u16 ability)
{ {
if ((gBattleMons[battler].status2 & STATUS2_CONFUSION) if ((gBattleMons[battler].status2 & STATUS2_CONFUSION)
|| (ability == ABILITY_OWN_TEMPO) || (ability == ABILITY_OWN_TEMPO)
@ -2684,7 +2686,7 @@ bool32 CanBeConfused(u8 battler, u16 ability)
bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove) bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove)
{ {
if (!CanBeConfused(battlerDef, defAbility) if (!AI_CanBeConfused(battlerDef, defAbility)
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|| gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
@ -2696,7 +2698,7 @@ bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtk
return TRUE; return TRUE;
} }
bool32 CanBeBurned(u8 battler, u16 ability) bool32 AI_CanBeBurned(u8 battler, u16 ability)
{ {
if (ability == ABILITY_WATER_VEIL if (ability == ABILITY_WATER_VEIL
|| ability == ABILITY_WATER_BUBBLE || ability == ABILITY_WATER_BUBBLE
@ -2710,7 +2712,7 @@ bool32 CanBeBurned(u8 battler, u16 ability)
bool32 ShouldBurnSelf(u8 battler, u16 ability) bool32 ShouldBurnSelf(u8 battler, u16 ability)
{ {
if (CanBeBurned(battler, ability) && ( if (AI_CanBeBurned(battler, ability) && (
ability == ABILITY_QUICK_FEET ability == ABILITY_QUICK_FEET
|| ability == ABILITY_HEATPROOF || ability == ABILITY_HEATPROOF
|| ability == ABILITY_MAGIC_GUARD || ability == ABILITY_MAGIC_GUARD
@ -2724,7 +2726,7 @@ bool32 ShouldBurnSelf(u8 battler, u16 ability)
bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove) bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove)
{ {
if (!CanBeBurned(battlerDef, defAbility) if (!AI_CanBeBurned(battlerDef, defAbility)
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|| PartnerMoveEffectIsStatusSameTarget(battlerAtkPartner, battlerDef, partnerMove)) || PartnerMoveEffectIsStatusSameTarget(battlerAtkPartner, battlerDef, partnerMove))

View File

@ -2213,6 +2213,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
case B_ANIM_DOOM_DESIRE_HIT: case B_ANIM_DOOM_DESIRE_HIT:
case B_ANIM_WISH_HEAL: case B_ANIM_WISH_HEAL:
case B_ANIM_MEGA_EVOLUTION: case B_ANIM_MEGA_EVOLUTION:
case B_ANIM_GULP_MISSILE:
hideHpBoxes = TRUE; hideHpBoxes = TRUE;
break; break;
default: default:
@ -3227,7 +3228,7 @@ static void LoadDefaultBg(void)
if (IsContest()) if (IsContest())
LoadContestBgAfterMoveAnim(); LoadContestBgAfterMoveAnim();
#if B_TERRAIN_BG_CHANGE == TRUE #if B_TERRAIN_BG_CHANGE == TRUE
else if (gFieldStatuses & STATUS_TERRAIN_ANY) else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
DrawTerrainTypeBattleBackground(); DrawTerrainTypeBattleBackground();
#endif #endif
else else

View File

@ -1422,7 +1422,7 @@ bool8 LoadChosenBattleElement(u8 caseId)
void DrawTerrainTypeBattleBackground(void) void DrawTerrainTypeBattleBackground(void)
{ {
switch (gFieldStatuses & STATUS_TERRAIN_ANY) switch (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
{ {
case STATUS_FIELD_GRASSY_TERRAIN: case STATUS_FIELD_GRASSY_TERRAIN:
LoadMoveBg(BG_GRASSY_TERRAIN); LoadMoveBg(BG_GRASSY_TERRAIN);

View File

@ -225,12 +225,18 @@ static void Intro_DelayAndEnd(void)
} }
} }
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active.
{
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]]));
}
static void Intro_WaitForShinyAnimAndHealthbox(void) static void Intro_WaitForShinyAnimAndHealthbox(void)
{ {
bool8 healthboxAnimDone = FALSE; bool8 healthboxAnimDone = FALSE;
bool8 twoMons; bool8 twoMons;
if (!IsDoubleBattle() || ((IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI) && !BATTLE_TWO_VS_ONE_OPPONENT) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) twoMons = TwoIntroMons(gActiveBattler);
if (!twoMons || ((twoMons && (gBattleTypeFlags & BATTLE_TYPE_MULTI) && !BATTLE_TWO_VS_ONE_OPPONENT) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)))
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
healthboxAnimDone = TRUE; healthboxAnimDone = TRUE;
@ -292,15 +298,17 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{ {
bool32 bgmRestored = FALSE; bool32 bgmRestored = FALSE;
bool32 battlerAnimsDone = FALSE; bool32 battlerAnimsDone = FALSE;
bool32 twoMons;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim)
TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]);
twoMons = TwoIntroMons(gActiveBattler);
if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
&& (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT) && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)
&& IsDoubleBattle() && twoMons
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim)
@ -310,7 +318,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{ {
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{ {
if (IsDoubleBattle() && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT))
{ {
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
@ -342,7 +350,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
bgmRestored = TRUE; bgmRestored = TRUE;
} }
if (!IsDoubleBattle() || (IsDoubleBattle() && gBattleTypeFlags & BATTLE_TYPE_MULTI && !BATTLE_TWO_VS_ONE_OPPONENT)) if (!twoMons || (twoMons && gBattleTypeFlags & BATTLE_TYPE_MULTI && !BATTLE_TWO_VS_ONE_OPPONENT))
{ {
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -363,7 +371,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
if (bgmRestored && battlerAnimsDone) if (bgmRestored && battlerAnimsDone)
{ {
if (IsDoubleBattle() && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT))
{ {
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES));
@ -469,7 +477,7 @@ static void SwitchIn_HandleSoundAndEnd(void)
{ {
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs())
{ {
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
|| gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2)
{ {
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
@ -1892,7 +1900,7 @@ static void Task_StartSendOutAnim(u8 taskId)
u8 savedActiveBank = gActiveBattler; u8 savedActiveBank = gActiveBattler;
gActiveBattler = gTasks[taskId].data[0]; gActiveBattler = gTasks[taskId].data[0];
if ((!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT) if ((!TwoIntroMons(gActiveBattler) || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT)
{ {
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE); StartSendOutAnim(gActiveBattler, FALSE);

View File

@ -1034,20 +1034,25 @@ static void Intro_DelayAndEnd(void)
} }
} }
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active.
{
return (IsDoubleBattle() && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]]));
}
static void Intro_WaitForShinyAnimAndHealthbox(void) static void Intro_WaitForShinyAnimAndHealthbox(void)
{ {
bool8 healthboxAnimDone = FALSE; bool8 healthboxAnimDone = FALSE;
// Check if healthbox has finished sliding in // Check if healthbox has finished sliding in
if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
healthboxAnimDone = TRUE; healthboxAnimDone = TRUE;
} }
else else
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
healthboxAnimDone = TRUE; healthboxAnimDone = TRUE;
} }
@ -1065,7 +1070,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(void)
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
if (IsDoubleBattle()) if (TwoIntroMons(gActiveBattler))
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
@ -1094,7 +1099,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
{ {
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted)
{ {
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK);
@ -1125,15 +1130,7 @@ static void Intro_TryShinyAnimShowHealthbox(void)
} }
// Wait for battler anims // Wait for battler anims
if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
{
battlerAnimsDone = TRUE;
}
}
else
{ {
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
@ -1143,11 +1140,19 @@ static void Intro_TryShinyAnimShowHealthbox(void)
battlerAnimsDone = TRUE; battlerAnimsDone = TRUE;
} }
} }
else
{
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
{
battlerAnimsDone = TRUE;
}
}
// Clean up // Clean up
if (bgmRestored && battlerAnimsDone) if (bgmRestored && battlerAnimsDone)
{ {
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]);
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
@ -3114,12 +3119,7 @@ static void Task_StartSendOutAnim(u8 taskId)
u8 savedActiveBattler = gActiveBattler; u8 savedActiveBattler = gActiveBattler;
gActiveBattler = gTasks[taskId].tBattlerId; gActiveBattler = gTasks[taskId].tBattlerId;
if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE);
}
else
{ {
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE); StartSendOutAnim(gActiveBattler, FALSE);
@ -3129,6 +3129,11 @@ static void Task_StartSendOutAnim(u8 taskId)
StartSendOutAnim(gActiveBattler, FALSE); StartSendOutAnim(gActiveBattler, FALSE);
gActiveBattler ^= BIT_FLANK; gActiveBattler ^= BIT_FLANK;
} }
else
{
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE);
}
gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox;
gActiveBattler = savedActiveBattler; gActiveBattler = savedActiveBattler;
DestroyTask(taskId); DestroyTask(taskId);

View File

@ -588,6 +588,14 @@ static void InitLinkBtlControllers(void)
} }
} }
bool32 IsValidForBattle(struct Pokemon *mon)
{
u32 species = GetMonData(mon, MON_DATA_SPECIES2);
return (species != SPECIES_NONE && species != SPECIES_EGG
&& GetMonData(mon, MON_DATA_HP) != 0
&& GetMonData(mon, MON_DATA_IS_EGG) == 0);
}
static void SetBattlePartyIds(void) static void SetBattlePartyIds(void)
{ {
s32 i, j; s32 i, j;
@ -602,10 +610,7 @@ static void SetBattlePartyIds(void)
{ {
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER) if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
{ {
if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0 if (IsValidForBattle(&gPlayerParty[j]))
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG
&& GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0)
{ {
gBattlerPartyIndexes[i] = j; gBattlerPartyIndexes[i] = j;
break; break;
@ -613,10 +618,7 @@ static void SetBattlePartyIds(void)
} }
else else
{ {
if (GetMonData(&gEnemyParty[j], MON_DATA_HP) != 0 if (IsValidForBattle(&gEnemyParty[j]))
&& GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG
&& GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0)
{ {
gBattlerPartyIndexes[i] = j; gBattlerPartyIndexes[i] = j;
break; break;
@ -627,11 +629,7 @@ static void SetBattlePartyIds(void)
{ {
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER) if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
{ {
if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0 if (IsValidForBattle(&gPlayerParty[j]) && gBattlerPartyIndexes[i - 2] != j)
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES) != SPECIES_NONE // Probably a typo by Game Freak. The rest use SPECIES2.
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG
&& GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0
&& gBattlerPartyIndexes[i - 2] != j)
{ {
gBattlerPartyIndexes[i] = j; gBattlerPartyIndexes[i] = j;
break; break;
@ -639,16 +637,18 @@ static void SetBattlePartyIds(void)
} }
else else
{ {
if (GetMonData(&gEnemyParty[j], MON_DATA_HP) != 0 if (IsValidForBattle(&gEnemyParty[j]) && gBattlerPartyIndexes[i - 2] != j)
&& GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG
&& GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0
&& gBattlerPartyIndexes[i - 2] != j)
{ {
gBattlerPartyIndexes[i] = j; gBattlerPartyIndexes[i] = j;
break; break;
} }
} }
// No valid mons were found. Add the empty slot.
if (gBattlerPartyIndexes[i - 2] == 0)
gBattlerPartyIndexes[i] = 1;
else
gBattlerPartyIndexes[i] = 0;
} }
} }
} }

View File

@ -1037,6 +1037,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]]) if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]])
{ {
objVram = ConvertIntToDecimalStringN(text, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); objVram = ConvertIntToDecimalStringN(text, lvl, STR_CONV_MODE_LEFT_ALIGN, 3);
xPos = 5 * (3 - (objVram - (text + 2))) - 1;
} }
else else
{ {
@ -1044,6 +1045,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
text[1] = CHAR_LV_2; text[1] = CHAR_LV_2;
objVram = ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); objVram = ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3);
xPos = 5 * (3 - (objVram - (text + 2)));
} }
xPos = 5 * (3 - (objVram - (text + 2))); xPos = 5 * (3 - (objVram - (text + 2)));
@ -1491,18 +1493,12 @@ void DestroyMegaTriggerSprite(void)
gBattleStruct->mega.triggerSpriteId = 0xFF; gBattleStruct->mega.triggerSpriteId = 0xFF;
} }
static const s8 sIndicatorPosSingles[][2] = static const s8 sIndicatorPositions[][2] =
{ {
[B_POSITION_PLAYER_LEFT] = {53, -8}, [B_POSITION_PLAYER_LEFT] = {52, -9},
[B_POSITION_OPPONENT_LEFT] = {45, -8}, [B_POSITION_OPPONENT_LEFT] = {44, -9},
}; [B_POSITION_PLAYER_RIGHT] = {52, -9},
[B_POSITION_OPPONENT_RIGHT] = {44, -9},
static const s8 sIndicatorPosDoubles[][2] =
{
[B_POSITION_PLAYER_LEFT] = {53, -8},
[B_POSITION_OPPONENT_LEFT] = {45, -8},
[B_POSITION_PLAYER_RIGHT] = {53, -8},
[B_POSITION_OPPONENT_RIGHT] = {45, -8},
}; };
u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which) u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which)
@ -1515,16 +1511,15 @@ u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which)
position = GetBattlerPosition(battlerId); position = GetBattlerPosition(battlerId);
GetBattlerHealthboxCoords(battlerId, &x, &y); GetBattlerHealthboxCoords(battlerId, &x, &y);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ x += sIndicatorPositions[position][0];
x += sIndicatorPosDoubles[position][0]; y += sIndicatorPositions[position][1];
y += sIndicatorPosDoubles[position][1];
} if (gBattleMons[battlerId].level >= 100)
else x -= 4;
{ else if (gBattleMons[battlerId].level < 10)
x += sIndicatorPosSingles[position][0]; x += 5;
y += sIndicatorPosSingles[position][1];
}
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_MegaIndicator, x, y, 0); spriteId = CreateSpriteAtEnd(&sSpriteTemplate_MegaIndicator, x, y, 0);
gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId; gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId;

View File

@ -3032,6 +3032,10 @@ void SwitchInClearSetData(void)
gBattleResources->flags->flags[gActiveBattler] = 0; gBattleResources->flags->flags[gActiveBattler] = 0;
gCurrentMove = 0; gCurrentMove = 0;
gBattleStruct->arenaTurnCounter = 0xFF; gBattleStruct->arenaTurnCounter = 0xFF;
// Reset damage to prevent things like red card activating if the switched-in mon is holding it
gSpecialStatuses[gActiveBattler].physicalDmg = 0;
gSpecialStatuses[gActiveBattler].specialDmg = 0;
ClearBattlerMoveHistory(gActiveBattler); ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler);
@ -3067,6 +3071,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].spikyShielded = 0; gProtectStructs[gActiveBattler].spikyShielded = 0;
gProtectStructs[gActiveBattler].kingsShielded = 0; gProtectStructs[gActiveBattler].kingsShielded = 0;
gProtectStructs[gActiveBattler].banefulBunkered = 0; gProtectStructs[gActiveBattler].banefulBunkered = 0;
gProtectStructs[gActiveBattler].obstructed = 0;
gProtectStructs[gActiveBattler].endured = 0; gProtectStructs[gActiveBattler].endured = 0;
gProtectStructs[gActiveBattler].noValidMoves = 0; gProtectStructs[gActiveBattler].noValidMoves = 0;
gProtectStructs[gActiveBattler].helpingHand = 0; gProtectStructs[gActiveBattler].helpingHand = 0;
@ -3074,7 +3079,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].stealMove = 0; gProtectStructs[gActiveBattler].stealMove = 0;
gProtectStructs[gActiveBattler].prlzImmobility = 0; gProtectStructs[gActiveBattler].prlzImmobility = 0;
gProtectStructs[gActiveBattler].confusionSelfDmg = 0; gProtectStructs[gActiveBattler].confusionSelfDmg = 0;
gProtectStructs[gActiveBattler].targetNotAffected = 0; gProtectStructs[gActiveBattler].targetAffected = 0;
gProtectStructs[gActiveBattler].chargingTurn = 0; gProtectStructs[gActiveBattler].chargingTurn = 0;
gProtectStructs[gActiveBattler].fleeFlag = 0; gProtectStructs[gActiveBattler].fleeFlag = 0;
gProtectStructs[gActiveBattler].usedImprisonedMove = 0; gProtectStructs[gActiveBattler].usedImprisonedMove = 0;
@ -3088,6 +3093,8 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].usesBouncedMove = 0; gProtectStructs[gActiveBattler].usesBouncedMove = 0;
gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0;
gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0;
gProtectStructs[gActiveBattler].statRaised = 0;
gProtectStructs[gActiveBattler].statFell = 0;
gDisableStructs[gActiveBattler].isFirstTurn = 2; gDisableStructs[gActiveBattler].isFirstTurn = 2;
@ -3457,6 +3464,16 @@ static void TryDoEventsBeforeFirstTurn(void)
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
// Set invalid mons as absent(for example when starting a double battle with only one pokemon).
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
{
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE)
gAbsentBattlerFlags |= gBitTable[i];
}
}
if (gBattleStruct->switchInAbilitiesCounter == 0) if (gBattleStruct->switchInAbilitiesCounter == 0)
{ {
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
@ -3668,7 +3685,7 @@ u8 IsRunningFromBattleImpossible(void)
return 0; return 0;
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
return 0; return 0;
if (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY) if (GetBattlerAbility(gActiveBattler) == ABILITY_RUN_AWAY)
return 0; return 0;
if ((i = IsAbilityPreventingEscape(gActiveBattler))) if ((i = IsAbilityPreventingEscape(gActiveBattler)))
@ -4083,10 +4100,10 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_WAIT_ACTION_CONFIRMED_STANDBY: case STATE_WAIT_ACTION_CONFIRMED_STANDBY:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler])
| (0xF << 28) | (0xF << 28)
| (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 4)
| (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 8)
| (gBitTable[gActiveBattler] << 12)))) | (gBitTable[gActiveBattler] << 12))))
{ {
if (AllAtActionConfirmed()) if (AllAtActionConfirmed())
@ -4289,6 +4306,7 @@ s8 GetChosenMovePriority(u32 battlerId)
{ {
u16 move; u16 move;
gProtectStructs[battlerId].pranksterElevated = 0;
if (gProtectStructs[battlerId].noValidMoves) if (gProtectStructs[battlerId].noValidMoves)
move = MOVE_STRUGGLE; move = MOVE_STRUGGLE;
else else
@ -4309,6 +4327,11 @@ s8 GetMovePriority(u32 battlerId, u16 move)
priority++; priority++;
} }
else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)) else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER && IS_MOVE_STATUS(move))
{
gProtectStructs[battlerId].pranksterElevated = 1;
priority++;
}
else if (gBattleMoves[move].effect == EFFECT_GRASSY_GLIDE && gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && IsBattlerGrounded(battlerId))
{ {
priority++; priority++;
} }
@ -4649,7 +4672,7 @@ static void CheckQuickClaw_CustapBerryActivation(void)
} }
} }
} }
// setup stuff before turns/actions // setup stuff before turns/actions
TryClearRageAndFuryCutter(); TryClearRageAndFuryCutter();
gCurrentTurnActionNumber = 0; gCurrentTurnActionNumber = 0;
@ -4886,6 +4909,7 @@ static void HandleEndTurn_FinishBattle(void)
{ {
UndoMegaEvolution(i); UndoMegaEvolution(i);
UndoFormChange(i, B_SIDE_PLAYER, FALSE); UndoFormChange(i, B_SIDE_PLAYER, FALSE);
DoBurmyFormChange(i);
} }
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions; gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
gCB2_AfterEvolution = BattleMainCB2; gCB2_AfterEvolution = BattleMainCB2;

View File

@ -699,9 +699,23 @@ static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_P
static const u8 sText_ItemCannotBeRemoved[] = _("{B_ATK_NAME_WITH_PREFIX}'s item cannot be removed!"); static const u8 sText_ItemCannotBeRemoved[] = _("{B_ATK_NAME_WITH_PREFIX}'s item cannot be removed!");
static const u8 sText_StickyBarbTransfer[] = _("The {B_LAST_ITEM} attached itself to\n{B_ATK_NAME_WITH_PREFIX}!"); static const u8 sText_StickyBarbTransfer[] = _("The {B_LAST_ITEM} attached itself to\n{B_ATK_NAME_WITH_PREFIX}!");
static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s\nburn was healed."); static const u8 sText_PkmnBurnHealed[] = _("{B_DEF_NAME_WITH_PREFIX}'s\nburn was healed.");
static const u8 sText_RedCardActivate[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} held up its {B_LAST_ITEM}\nagainst {B_ATK_NAME_WITH_PREFIX}!");
static const u8 sText_EjectButtonActivate[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is switched\nout with the {B_LAST_ITEM}!");
static const u8 sText_AttackerGotOverInfatuation[] =_("{B_ATK_NAME_WITH_PREFIX} got over\nits infatuation!");
static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormented no more!");
static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!");
static const u8 sText_AttackerBecameFullyCharged[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its bond with its trainer!\p");
static const u8 sText_AttackerBecameAshSpecies[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_BUFF1}!\p");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
[STRINGID_ATTACKERBECAMEASHSPECIES - 12] = sText_AttackerBecameAshSpecies,
[STRINGID_ATTACKERBECAMEFULLYCHARGED - 12] = sText_AttackerBecameFullyCharged,
[STRINGID_HEALBLOCKEDNOMORE - 12] = sText_HealBlockedNoMore,
[STRINGID_TORMENTEDNOMORE - 12] = sText_TormentedNoMore,
[STRINGID_ATKGOTOVERINFATUATION - 12] = sText_AttackerGotOverInfatuation,
[STRINGID_EJECTBUTTONACTIVATE - 12] = sText_EjectButtonActivate,
[STRINGID_REDCARDACTIVATE - 12] = sText_RedCardActivate,
[STRINGID_PKMNBURNHEALED - 12] = sText_PkmnBurnHealed, [STRINGID_PKMNBURNHEALED - 12] = sText_PkmnBurnHealed,
[STRINGID_STICKYBARBTRANSFER - 12] = sText_StickyBarbTransfer, [STRINGID_STICKYBARBTRANSFER - 12] = sText_StickyBarbTransfer,
[STRINGID_ITEMCANNOTBEREMOVED - 12] = sText_ItemCannotBeRemoved, [STRINGID_ITEMCANNOTBEREMOVED - 12] = sText_ItemCannotBeRemoved,
@ -1264,14 +1278,31 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_SCREENCLEANERENTERS - 12] = sText_ScreenCleanerActivates, [STRINGID_SCREENCLEANERENTERS - 12] = sText_ScreenCleanerActivates,
}; };
const u16 gMentalHerbCureStringIds[] =
{
[B_MSG_MENTALHERBCURE_INFATUATION] = STRINGID_ATKGOTOVERINFATUATION,
[B_MSG_MENTALHERBCURE_TAUNT] = STRINGID_BUFFERENDS,
[B_MSG_MENTALHERBCURE_ENCORE] = STRINGID_PKMNENCOREENDED,
[B_MSG_MENTALHERBCURE_TORMENT] = STRINGID_TORMENTEDNOMORE,
[B_MSG_MENTALHERBCURE_HEALBLOCK] = STRINGID_HEALBLOCKEDNOMORE,
[B_MSG_MENTALHERBCURE_DISABLE] = STRINGID_PKMNMOVEDISABLEDNOMORE,
};
const u16 gTerrainStringIds[] = const u16 gTerrainStringIds[] =
{ {
STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC
}; };
const u16 gTerrainEndingStringIds[] =
{
STRINGID_MISTYTERRAINENDS, STRINGID_GRASSYTERRAINENDS, STRINGID_ELECTRICTERRAINENDS, STRINGID_PSYCHICTERRAINENDS
};
const u16 gTerrainPreventsStringIds[] = const u16 gTerrainPreventsStringIds[] =
{ {
STRINGID_MISTYTERRAINPREVENTS, STRINGID_ELECTRICTERRAINPREVENTS, STRINGID_PSYCHICTERRAINPREVENTS [B_MSG_TERRAINPREVENTS_MISTY] = STRINGID_MISTYTERRAINPREVENTS,
[B_MSG_TERRAINPREVENTS_ELECTRIC] = STRINGID_ELECTRICTERRAINPREVENTS,
[B_MSG_TERRAINPREVENTS_PSYCHIC] = STRINGID_PSYCHICTERRAINPREVENTS
}; };
const u16 gMagicCoatBounceStringIds[] = const u16 gMagicCoatBounceStringIds[] =
@ -2556,7 +2587,7 @@ void BufferStringBattle(u16 stringID)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY) if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
stringPtr = sText_LegendaryPkmnAppeared; stringPtr = sText_LegendaryPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) // interesting, looks like they had something planned for wild double battles else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) // interesting, looks like they had something planned for wild double battles
stringPtr = sText_TwoWildPkmnAppeared; stringPtr = sText_TwoWildPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
stringPtr = sText_WildPkmnAppearedPause; stringPtr = sText_WildPkmnAppearedPause;
@ -2567,7 +2598,7 @@ void BufferStringBattle(u16 stringID)
case STRINGID_INTROSENDOUT: // poke first send-out case STRINGID_INTROSENDOUT: // poke first send-out
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
{ {
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
stringPtr = sText_InGamePartnerSentOutZGoN; stringPtr = sText_InGamePartnerSentOutZGoN;
@ -2585,7 +2616,7 @@ void BufferStringBattle(u16 stringID)
} }
else else
{ {
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
{ {
if (BATTLE_TWO_VS_ONE_OPPONENT) if (BATTLE_TWO_VS_ONE_OPPONENT)
stringPtr = sText_Trainer1SentOutTwoPkmn; stringPtr = sText_Trainer1SentOutTwoPkmn;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2599,11 +2599,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
#if B_UPDATED_MOVE_DATA >= GEN_4 #if B_UPDATED_MOVE_DATA >= GEN_4
.accuracy = 0, .accuracy = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
.effect = EFFECT_RECOIL_HP_25,
#else #else
.accuracy = 100, .accuracy = 100,
.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,
.effect = EFFECT_RECOIL_25,
#endif #endif
.effect = EFFECT_RECOIL_25,
.power = 50, .power = 50,
.type = TYPE_NORMAL, .type = TYPE_NORMAL,
.pp = 1, .pp = 1,
@ -3424,6 +3425,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_HEAL_BELL] = [MOVE_HEAL_BELL] =
{ {
#if B_UPDATED_MOVE_DATA != GEN_5
.flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND,
#else
.flags = FLAG_SNATCH_AFFECTED,
#endif
.effect = EFFECT_HEAL_BELL, .effect = EFFECT_HEAL_BELL,
.power = 0, .power = 0,
.type = TYPE_NORMAL, .type = TYPE_NORMAL,
@ -3432,7 +3438,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_USER, .target = MOVE_TARGET_USER,
.priority = 0, .priority = 0,
.flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
}, },
@ -5338,6 +5343,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_HOWL] = [MOVE_HOWL] =
{ {
#if B_UPDATED_MOVE_DATA >= GEN_8
.flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND,
#else
.flags = FLAG_SNATCH_AFFECTED,
#endif
.effect = EFFECT_ATTACK_UP, .effect = EFFECT_ATTACK_UP,
.power = 0, .power = 0,
.type = TYPE_NORMAL, .type = TYPE_NORMAL,
@ -5346,7 +5356,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_USER, .target = MOVE_TARGET_USER,
.priority = 0, .priority = 0,
.flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
}, },
@ -8097,7 +8106,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_RETALIATE] = [MOVE_RETALIATE] =
{ {
.effect = EFFECT_RETALITATE, .effect = EFFECT_RETALIATE,
.power = 70, .power = 70,
.type = TYPE_NORMAL, .type = TYPE_NORMAL,
.accuracy = 100, .accuracy = 100,
@ -10226,7 +10235,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_PSYCHIC_FANGS] = [MOVE_PSYCHIC_FANGS] =
{ {
.effect = EFFECT_BRICK_BREAK, .effect = EFFECT_BRICK_BREAK,
.power = 75, .power = 85,
.type = TYPE_PSYCHIC, .type = TYPE_PSYCHIC,
.accuracy = 100, .accuracy = 100,
.pp = 15, .pp = 15,
@ -10743,7 +10752,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_SNIPE_SHOT] = [MOVE_SNIPE_SHOT] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_SNIPE_SHOT,
.power = 80, .power = 80,
.type = TYPE_WATER, .type = TYPE_WATER,
.accuracy = 100, .accuracy = 100,
@ -10751,7 +10760,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED, .target = MOVE_TARGET_SELECTED,
.priority = 0, .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_HIGH_CRIT,
.split = SPLIT_SPECIAL, .split = SPLIT_SPECIAL,
}, },
@ -10940,7 +10949,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_DECORATE] = [MOVE_DECORATE] =
{ {
.effect = EFFECT_PLACEHOLDER, // TODO .. EFFECT_DECORATE .effect = EFFECT_DECORATE,
.power = 0, .power = 0,
.type = TYPE_FAIRY, .type = TYPE_FAIRY,
.accuracy = 0, .accuracy = 0,
@ -10996,7 +11005,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BEHEMOTH_BLADE] = [MOVE_BEHEMOTH_BLADE] =
{ {
.effect = EFFECT_HIT, //TODO: 2x damage if dynamaxed? meh... .effect = EFFECT_DYNAMAX_DOUBLE_DMG,
.power = 100, .power = 100,
.type = TYPE_STEEL, .type = TYPE_STEEL,
.accuracy = 100, .accuracy = 100,
@ -11010,7 +11019,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BEHEMOTH_BASH] = [MOVE_BEHEMOTH_BASH] =
{ {
.effect = EFFECT_HIT, //TODO: 2x damage if dynamaxed? meh... .effect = EFFECT_DYNAMAX_DOUBLE_DMG,
.power = 100, .power = 100,
.type = TYPE_STEEL, .type = TYPE_STEEL,
.accuracy = 100, .accuracy = 100,
@ -11136,7 +11145,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_LIFE_DEW] = [MOVE_LIFE_DEW] =
{ {
.effect = EFFECT_RESTORE_HP, .effect = EFFECT_JUNGLE_HEALING,
.power = 0, .power = 0,
.type = TYPE_WATER, .type = TYPE_WATER,
.accuracy = 0, .accuracy = 0,
@ -11150,7 +11159,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_OBSTRUCT] = [MOVE_OBSTRUCT] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO. EFFECT_PROTECT? .effect = EFFECT_PROTECT,
.power = 0, .power = 0,
.type = TYPE_DARK, .type = TYPE_DARK,
.accuracy = 100, .accuracy = 100,
@ -11158,7 +11167,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_USER, .target = MOVE_TARGET_USER,
.priority = 4, .priority = 4,
.flags = 0, .flags = FLAG_PROTECTION_MOVE,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
}, },
@ -11234,7 +11243,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_STEEL_ROLLER] = [MOVE_STEEL_ROLLER] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_REMOVE_TERRAIN,
.power = 130, .power = 130,
.type = TYPE_STEEL, .type = TYPE_STEEL,
.accuracy = 100, .accuracy = 100,
@ -11290,7 +11299,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_MISTY_EXPLOSION] = [MOVE_MISTY_EXPLOSION] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_EXPLOSION,
.power = 100, .power = 100,
.type = TYPE_FAIRY, .type = TYPE_FAIRY,
.accuracy = 100, .accuracy = 100,
@ -11304,7 +11313,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_GRASSY_GLIDE] = [MOVE_GRASSY_GLIDE] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_GRASSY_GLIDE,
.power = 70, .power = 70,
.type = TYPE_GRASS, .type = TYPE_GRASS,
.accuracy = 100, .accuracy = 100,
@ -11360,12 +11369,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BURNING_JEALOUSY] = [MOVE_BURNING_JEALOUSY] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_BURN_HIT,
.power = 70, .power = 70,
.type = TYPE_FIRE, .type = TYPE_FIRE,
.accuracy = 100, .accuracy = 100,
.pp = 5, .pp = 5,
.secondaryEffectChance = 0, .secondaryEffectChance = 100,
.target = MOVE_TARGET_BOTH, .target = MOVE_TARGET_BOTH,
.priority = 0, .priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST,
@ -11374,7 +11383,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_LASH_OUT] = [MOVE_LASH_OUT] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_LASH_OUT,
.power = 75, .power = 75,
.type = TYPE_DARK, .type = TYPE_DARK,
.accuracy = 100, .accuracy = 100,
@ -11416,7 +11425,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_COACHING] = [MOVE_COACHING] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_COACHING,
.power = 0, .power = 0,
.type = TYPE_FIGHTING, .type = TYPE_FIGHTING,
.accuracy = 0, .accuracy = 0,
@ -11444,7 +11453,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_TRIPLE_AXEL] = [MOVE_TRIPLE_AXEL] =
{ {
.effect = EFFECT_TRIPLE_KICK, //TODO: Increase damage by 20 instead of 10 .effect = EFFECT_TRIPLE_KICK,
.power = 20, .power = 20,
.type = TYPE_ICE, .type = TYPE_ICE,
.accuracy = 90, .accuracy = 90,
@ -11486,7 +11495,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_JUNGLE_HEALING] = [MOVE_JUNGLE_HEALING] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO .effect = EFFECT_JUNGLE_HEALING,
.power = 0, .power = 0,
.type = TYPE_GRASS, .type = TYPE_GRASS,
.accuracy = 0, .accuracy = 0,
@ -11513,7 +11522,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_SURGING_STRIKES] = [MOVE_SURGING_STRIKES] =
{ {
.effect = EFFECT_PLACEHOLDER, //TODO (Multi hit + Always Crit) .effect = EFFECT_TRIPLE_HIT,
.power = 25, .power = 25,
.type = TYPE_WATER, .type = TYPE_WATER,
.accuracy = 100, .accuracy = 100,
@ -11625,7 +11634,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_EERIE_SPELL] = [MOVE_EERIE_SPELL] =
{ {
.effect = EFFECT_HIT, // To do. It's a copy of Spite that inflicts damage and reduced the target's last move's PP by 3 instead of 4. .effect = EFFECT_EERIE_SPELL,
.power = 80, .power = 80,
.type = TYPE_PSYCHIC, .type = TYPE_PSYCHIC,
.accuracy = 100, .accuracy = 100,

View File

@ -2262,7 +2262,7 @@ const struct Item gItems[] =
.name = _("MENTAL HERB"), .name = _("MENTAL HERB"),
.itemId = ITEM_MENTAL_HERB, .itemId = ITEM_MENTAL_HERB,
.price = 100, .price = 100,
.holdEffect = HOLD_EFFECT_CURE_ATTRACT, .holdEffect = HOLD_EFFECT_MENTAL_HERB,
.description = sMentalHerbDesc, .description = sMentalHerbDesc,
.pocket = POCKET_ITEMS, .pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU, .type = ITEM_USE_BAG_MENU,

View File

@ -1393,6 +1393,7 @@ static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES +
{gText_DexEmptyString, gTypeNames[TYPE_ICE]}, {gText_DexEmptyString, gTypeNames[TYPE_ICE]},
{gText_DexEmptyString, gTypeNames[TYPE_DRAGON]}, {gText_DexEmptyString, gTypeNames[TYPE_DRAGON]},
{gText_DexEmptyString, gTypeNames[TYPE_DARK]}, {gText_DexEmptyString, gTypeNames[TYPE_DARK]},
{gText_DexEmptyString, gTypeNames[TYPE_FAIRY]},
{}, {},
}; };
@ -1427,6 +1428,7 @@ static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] =
TYPE_ICE, TYPE_ICE,
TYPE_DRAGON, TYPE_DRAGON,
TYPE_DARK, TYPE_DARK,
TYPE_FAIRY,
}; };
// Number pairs are the task data for tracking the cursor pos and scroll offset of each option list // Number pairs are the task data for tracking the cursor pos and scroll offset of each option list