mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into be/ai_updates
This commit is contained in:
commit
201a38f487
@ -1883,6 +1883,36 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro trynoretreat battler:req, ptr:req
|
||||
various \battler, VARIOUS_TRY_NO_RETREAT
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro trytarshot battler:req, ptr:req
|
||||
various \battler, VARIOUS_TRY_TAR_SHOT
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro cantarshotwork battler:req, ptr:req
|
||||
various \battler, VARIOUS_CAN_TAR_SHOT_WORK
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro checkpoltergeist battler:req, ptr:req
|
||||
various \battler, VARIOUS_CHECK_POLTERGEIST
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro setoctolock battler:req, ptr:req
|
||||
various \battler, VARIOUS_SET_OCTOLOCK
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro cutonethirdhpraisestats ptr:req
|
||||
various BS_ATTACKER, VARIOUS_CUT_1_3_HP_RAISE_STATS
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro photongeysercheck
|
||||
various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK
|
||||
.endm
|
||||
|
@ -396,6 +396,13 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectPhotonGeyser @ EFFECT_PHOTON_GEYSER
|
||||
.4byte BattleScript_EffectShellSideArm @ EFFECT_SHELL_SIDE_ARM
|
||||
.4byte BattleScript_EffectHit @ EFFECT_TERRAIN_PULSE
|
||||
.4byte BattleScript_EffectJawLock @ EFFECT_JAW_LOCK
|
||||
.4byte BattleScript_EffectNoRetreat @ EFFECT_NO_RETREAT
|
||||
.4byte BattleScript_EffectTarShot @ EFFECT_TAR_SHOT
|
||||
.4byte BattleScript_EffectPoltergeist @ EFFECT_POLTERGEIST
|
||||
.4byte BattleScript_EffectOctolock @ EFFECT_OCTOLOCK
|
||||
.4byte BattleScript_EffectClangorousSoul @ EFFECT_CLANGOROUS_SOUL
|
||||
.4byte BattleScript_EffectHit @ EFFECT_BOLT_BEAK
|
||||
|
||||
BattleScript_EffectShellSideArm:
|
||||
shellsidearmcheck
|
||||
@ -433,6 +440,113 @@ BattleScript_EffectAuraWheel: @ Aura Wheel can only be used by Morpeko
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectClangorousSoul:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
cutonethirdhpraisestats BattleScript_ButItFailed
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_SKIP_DMG_TRACK | HITMARKER_PASSIVE_DAMAGE | HITMARKER_IGNORE_DISGUISE
|
||||
attackanimation
|
||||
waitanimation
|
||||
healthbarupdate BS_ATTACKER
|
||||
datahpupdate BS_ATTACKER
|
||||
call BattleScript_AllStatsUp
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectOctolock:
|
||||
attackcanceler
|
||||
jumpifsubstituteblocks BattleScript_ButItFailedAtkStringPpReduce
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
setoctolock BS_TARGET, BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
printstring STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_OctolockEndTurn::
|
||||
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||
jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_DEF, MIN_STAT_STAGE, BattleScript_OctolockLowerDef
|
||||
jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_SPDEF, MIN_STAT_STAGE, BattleScript_OctolockTryLowerSpDef
|
||||
goto BattleScript_OctolockEnd2
|
||||
BattleScript_OctolockLowerDef:
|
||||
jumpifability BS_TARGET, ABILITY_BIG_PECKS, BattleScript_OctolockTryLowerSpDef
|
||||
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE
|
||||
setbyte sSTAT_ANIM_PLAYED, TRUE
|
||||
setstatchanger STAT_DEF, 1, TRUE
|
||||
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_OctolockTryLowerSpDef
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_OctolockTryLowerSpDef
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_OctolockTryLowerSpDef:
|
||||
jumpifbyte CMP_EQUAL, sSTAT_ANIM_PLAYED, TRUE, BattleScript_OctolockSkipSpDefAnim
|
||||
playstatchangeanimation BS_ATTACKER, BIT_SPDEF, STAT_CHANGE_NEGATIVE
|
||||
BattleScript_OctolockSkipSpDefAnim:
|
||||
setstatchanger STAT_SPDEF, 1, TRUE
|
||||
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_OctolockEnd2
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_OctolockEnd2
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_OctolockEnd2::
|
||||
end2
|
||||
|
||||
BattleScript_EffectPoltergeist:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
checkpoltergeist BS_TARGET, BattleScript_ButItFailed
|
||||
printstring STRINGID_ABOUTTOUSEPOLTERGEIST
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_HitFromCritCalc
|
||||
|
||||
BattleScript_EffectTarShot:
|
||||
attackcanceler
|
||||
jumpifsubstituteblocks BattleScript_ButItFailedAtkStringPpReduce
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
cantarshotwork BS_TARGET, BattleScript_ButItFailedAtkStringPpReduce
|
||||
attackstring
|
||||
ppreduce
|
||||
setstatchanger STAT_SPEED, 1, TRUE
|
||||
attackanimation
|
||||
waitanimation
|
||||
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TryTarShot
|
||||
setgraphicalstatchangevalues
|
||||
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
|
||||
printfromtable gStatDownStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_TryTarShot:
|
||||
trytarshot BS_TARGET, BattleScript_MoveEnd
|
||||
printstring STRINGID_PKMNBECAMEWEAKERTOFIRE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectNoRetreat:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
trynoretreat BS_TARGET, BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
call BattleScript_AllStatsUp
|
||||
jumpifstatus2 BS_TARGET, STATUS2_ESCAPE_PREVENTION, BattleScript_MoveEnd
|
||||
setmoveeffect MOVE_EFFECT_PREVENT_ESCAPE
|
||||
seteffectprimary
|
||||
printstring STRINGID_CANTESCAPEDUETOUSEDMOVE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectJawLock:
|
||||
setmoveeffect MOVE_EFFECT_TRAP_BOTH | MOVE_EFFECT_CERTAIN
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_BothCanNoLongerEscape::
|
||||
printstring STRINGID_BOTHCANNOLONGERESCAPE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_EffectHyperspaceFury:
|
||||
jumpifspecies BS_ATTACKER, SPECIES_HOOPA_UNBOUND, BattleScript_EffectHyperspaceFuryUnbound
|
||||
jumpifspecies BS_ATTACKER, SPECIES_HOOPA, BattleScript_ButHoopaCantUseIt
|
||||
@ -1768,7 +1882,7 @@ BattleScript_EffectSoak:
|
||||
attackanimation
|
||||
waitanimation
|
||||
trysoak BattleScript_ButItFailed
|
||||
printstring STRINGID_TRANSFORMEDINTOWATERTYPE
|
||||
printstring STRINGID_TARGETCHANGEDTYPE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
@ -6367,7 +6481,7 @@ BattleScript_AttackerItemStatRaise::
|
||||
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
|
||||
waitanimation
|
||||
printstring STRINGID_USINGITEMSTATOFPKMNROSE
|
||||
waitmessage 0x40
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
removeitem BS_ATTACKER
|
||||
BattleScript_AttackerItemStatRaiseRet:
|
||||
return
|
||||
@ -9027,7 +9141,7 @@ BattleScript_StickyBarbTransfer::
|
||||
BattleScript_RedCardActivates::
|
||||
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
printstring STRINGID_REDCARDACTIVATE
|
||||
waitmessage 0x40
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
swapattackerwithtarget
|
||||
jumpifstatus3 BS_EFFECT_BATTLER, STATUS3_ROOTED, BattleScript_RedCardIngrain
|
||||
jumpifability BS_EFFECT_BATTLER, ABILITY_SUCTION_CUPS, BattleScript_RedCardSuctionCups
|
||||
@ -9038,13 +9152,13 @@ BattleScript_RedCardEnd:
|
||||
return
|
||||
BattleScript_RedCardIngrain:
|
||||
printstring STRINGID_PKMNANCHOREDITSELF
|
||||
waitmessage 0x40
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
removeitem BS_SCRIPTING
|
||||
swapattackerwithtarget
|
||||
return
|
||||
BattleScript_RedCardSuctionCups:
|
||||
printstring STRINGID_PKMNANCHORSITSELFWITH
|
||||
waitmessage 0x40
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
removeitem BS_SCRIPTING
|
||||
swapattackerwithtarget
|
||||
return
|
||||
@ -9053,7 +9167,7 @@ BattleScript_EjectButtonActivates::
|
||||
makevisible BS_ATTACKER
|
||||
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
printstring STRINGID_EJECTBUTTONACTIVATE
|
||||
waitmessage 0x40
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
removeitem BS_SCRIPTING
|
||||
makeinvisible BS_SCRIPTING
|
||||
openpartyscreen BS_SCRIPTING, BattleScript_EjectButtonEnd
|
||||
|
@ -112,6 +112,9 @@ struct DisableStruct
|
||||
u8 throatChopTimer;
|
||||
u8 usedMoves:4;
|
||||
u8 wrapTurns;
|
||||
u8 noRetreat:1;
|
||||
u8 tarShot:1;
|
||||
u8 octolock:1;
|
||||
};
|
||||
|
||||
struct ProtectStruct
|
||||
|
@ -411,5 +411,7 @@ extern const u8 BattleScript_MimicryActivatesEnd3[];
|
||||
extern const u8 BattleScript_ApplyMimicry[];
|
||||
extern const u8 BattleScript_AttackerFormChangeEnd3NoPopup[];
|
||||
extern const u8 BattleScript_AttackerFormChangeMoveEffect[];
|
||||
extern const u8 BattleScript_BothCanNoLongerEscape[];
|
||||
extern const u8 BattleScript_OctolockEndTurn[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -358,7 +358,8 @@
|
||||
#define MOVE_EFFECT_BUG_BITE 0x45
|
||||
#define MOVE_EFFECT_RECOIL_HP_25 0x46
|
||||
#define MOVE_EFFECT_RELIC_SONG 0x47
|
||||
#define NUM_MOVE_EFFECTS 0x48
|
||||
#define MOVE_EFFECT_TRAP_BOTH 0x48
|
||||
#define NUM_MOVE_EFFECTS 0x49
|
||||
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||
#define MOVE_EFFECT_CERTAIN 0x8000
|
||||
|
@ -171,6 +171,16 @@
|
||||
#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable
|
||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||
#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
||||
#define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
|
||||
#define B_DIVE_BALL_MODIFIER GEN_7 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing.
|
||||
#define B_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow.
|
||||
#define B_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3.
|
||||
#define B_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1
|
||||
#define B_DUSK_BALL_MODIFIER GEN_7 // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5.
|
||||
#define B_QUICK_BALL_MODIFIER GEN_7 // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4.
|
||||
#define B_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3.
|
||||
#define B_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow.
|
||||
#define B_DREAM_BALL_MODIFIER GEN_8 // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose.
|
||||
|
||||
// Flag settings
|
||||
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
|
||||
|
@ -379,7 +379,14 @@
|
||||
#define EFFECT_PHOTON_GEYSER 373
|
||||
#define EFFECT_SHELL_SIDE_ARM 374
|
||||
#define EFFECT_TERRAIN_PULSE 375
|
||||
#define EFFECT_JAW_LOCK 376
|
||||
#define EFFECT_NO_RETREAT 377
|
||||
#define EFFECT_TAR_SHOT 378
|
||||
#define EFFECT_POLTERGEIST 379
|
||||
#define EFFECT_OCTOLOCK 380
|
||||
#define EFFECT_CLANGOROUS_SOUL 381
|
||||
#define EFFECT_BOLT_BEAK 382
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 376
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 383
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
@ -201,6 +201,12 @@
|
||||
#define VARIOUS_TRY_TO_APPLY_MIMICRY 128
|
||||
#define VARIOUS_PHOTON_GEYSER_CHECK 129
|
||||
#define VARIOUS_SHELL_SIDE_ARM_CHECK 130
|
||||
#define VARIOUS_TRY_NO_RETREAT 131
|
||||
#define VARIOUS_TRY_TAR_SHOT 132
|
||||
#define VARIOUS_CAN_TAR_SHOT_WORK 133
|
||||
#define VARIOUS_CHECK_POLTERGEIST 134
|
||||
#define VARIOUS_SET_OCTOLOCK 135
|
||||
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 136
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -420,7 +420,7 @@
|
||||
#define STRINGID_HURLEDINTOTHEAIR 416
|
||||
#define STRINGID_HELDITEMSLOSEEFFECTS 417
|
||||
#define STRINGID_FELLSTRAIGHTDOWN 418
|
||||
#define STRINGID_TRANSFORMEDINTOWATERTYPE 419
|
||||
#define STRINGID_TARGETCHANGEDTYPE 419
|
||||
#define STRINGID_PKMNACQUIREDSIMPLE 420
|
||||
#define STRINGID_EMPTYSTRING5 421
|
||||
#define STRINGID_KINDOFFER 422
|
||||
@ -602,8 +602,13 @@
|
||||
#define STRINGID_PASTELVEILPROTECTED 599
|
||||
#define STRINGID_PASTELVEILENTERS 600
|
||||
#define STRINGID_BATTLERTYPECHANGEDTO 601
|
||||
#define STRINGID_BOTHCANNOLONGERESCAPE 602
|
||||
#define STRINGID_CANTESCAPEDUETOUSEDMOVE 603
|
||||
#define STRINGID_PKMNBECAMEWEAKERTOFIRE 604
|
||||
#define STRINGID_ABOUTTOUSEPOLTERGEIST 605
|
||||
#define STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE 606
|
||||
|
||||
#define BATTLESTRINGS_COUNT 602
|
||||
#define BATTLESTRINGS_COUNT 607
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -30,6 +30,8 @@ struct WildPokemonHeader
|
||||
};
|
||||
|
||||
extern const struct WildPokemonHeader gWildMonHeaders[];
|
||||
extern bool8 gIsFishingEncounter;
|
||||
extern bool8 gIsSurfingEncounter;
|
||||
|
||||
void DisableWildEncounters(bool8 disabled);
|
||||
bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavior);
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "trig.h"
|
||||
#include "tv.h"
|
||||
#include "util.h"
|
||||
#include "wild_encounter.h"
|
||||
#include "window.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/battle_config.h"
|
||||
@ -5021,6 +5022,8 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gIsFishingEncounter = FALSE;
|
||||
gIsSurfingEncounter = FALSE;
|
||||
ResetSpriteData();
|
||||
if (gLeveledUpInBattle && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT))
|
||||
{
|
||||
|
@ -549,7 +549,7 @@ static const u8 sText_BecameNimble[] =_("{B_ATK_NAME_WITH_PREFIX} became nimble!
|
||||
static const u8 sText_HurledIntoTheAir[] =_("{B_DEF_NAME_WITH_PREFIX} was hurled\ninto the air!");
|
||||
static const u8 sText_HeldItemsLoseEffects[] =_("It created a bizarre area in which\nPokémon's held items lose their effects!");
|
||||
static const u8 sText_FellStraightDown[] =_("{B_DEF_NAME_WITH_PREFIX} fell\nstraight down!");
|
||||
static const u8 sText_TransformedIntoWaterType[] =_("{B_DEF_NAME_WITH_PREFIX} transformed\ninto the water type!");
|
||||
static const u8 sText_TargetChangedType[] =_("{B_DEF_NAME_WITH_PREFIX} transformed\ninto the {B_BUFF1} type!");
|
||||
static const u8 sText_PkmnAcquiredSimple[] =_("{B_DEF_NAME_WITH_PREFIX} acquired\nSimple!");
|
||||
static const u8 sText_KindOffer[] =_("{B_DEF_NAME_WITH_PREFIX}\ntook the kind offer!");
|
||||
static const u8 sText_ResetsTargetsStatLevels[] =_("{B_DEF_NAME_WITH_PREFIX}'s stat changes\nwere removed!");
|
||||
@ -728,6 +728,11 @@ static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped A
|
||||
static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!");
|
||||
static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!");
|
||||
static const u8 sText_BattlerTypeChangedTo[] = _("{B_BUFF1}'s type\nchanged to {B_BUFF2}!");
|
||||
static const u8 sText_BothCanNoLongerEscape[] = _("Neither POKéMON can run away!");
|
||||
static const u8 sText_CantEscapeDueToUsedMove[] = _("{B_ATK_NAME_WITH_PREFIX} can no longer escape\nbecause it used {B_CURRENT_MOVE}!");
|
||||
static const u8 sText_PkmnBecameWeakerToFire[] = _("{B_DEF_NAME_WITH_PREFIX} became\nweaker to fire!");
|
||||
static const u8 sText_PkmnAboutToBeAttackedByItsItem[] = _("{B_DEF_NAME_WITH_PREFIX} is about\nto be attacked by its {B_BUFF1}!");
|
||||
static const u8 sText_CantEscapeBecauseOfCurrentMove[] = _("{B_DEF_NAME_WITH_PREFIX} can no longer escape\nbecause of {B_CURRENT_MOVE}!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
@ -1210,7 +1215,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_HURLEDINTOTHEAIR - 12] = sText_HurledIntoTheAir,
|
||||
[STRINGID_HELDITEMSLOSEEFFECTS - 12] = sText_HeldItemsLoseEffects,
|
||||
[STRINGID_FELLSTRAIGHTDOWN - 12] = sText_FellStraightDown,
|
||||
[STRINGID_TRANSFORMEDINTOWATERTYPE - 12] = sText_TransformedIntoWaterType,
|
||||
[STRINGID_TARGETCHANGEDTYPE - 12] = sText_TargetChangedType,
|
||||
[STRINGID_PKMNACQUIREDSIMPLE - 12] = sText_PkmnAcquiredSimple,
|
||||
[STRINGID_EMPTYSTRING5 - 12] = sText_EmptyString4,
|
||||
[STRINGID_KINDOFFER - 12] = sText_KindOffer,
|
||||
@ -1320,6 +1325,11 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_AURABREAKENTERS - 12] = sText_AuraBreakActivates,
|
||||
[STRINGID_COMATOSEENTERS - 12] = sText_ComatoseActivates,
|
||||
[STRINGID_SCREENCLEANERENTERS - 12] = sText_ScreenCleanerActivates,
|
||||
[STRINGID_BOTHCANNOLONGERESCAPE - 12] = sText_BothCanNoLongerEscape,
|
||||
[STRINGID_CANTESCAPEDUETOUSEDMOVE - 12] = sText_CantEscapeDueToUsedMove,
|
||||
[STRINGID_PKMNBECAMEWEAKERTOFIRE - 12] = sText_PkmnBecameWeakerToFire,
|
||||
[STRINGID_ABOUTTOUSEPOLTERGEIST - 12] = sText_PkmnAboutToBeAttackedByItsItem,
|
||||
[STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE - 12] = sText_CantEscapeBecauseOfCurrentMove,
|
||||
};
|
||||
|
||||
const u16 gMentalHerbCureStringIds[] =
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include "constants/battle_string_ids.h"
|
||||
#include "battle_setup.h"
|
||||
#include "overworld.h"
|
||||
#include "wild_encounter.h"
|
||||
#include "rtc.h"
|
||||
#include "party_menu.h"
|
||||
#include "constants/battle_config.h"
|
||||
#include "battle_arena.h"
|
||||
@ -1245,15 +1247,6 @@ static const u8 sTerrainToType[BATTLE_TERRAIN_COUNT] =
|
||||
#endif
|
||||
};
|
||||
|
||||
// - ITEM_ULTRA_BALL skips Master Ball and ITEM_NONE
|
||||
static const u8 sBallCatchBonuses[] =
|
||||
{
|
||||
[ITEM_ULTRA_BALL - ITEM_ULTRA_BALL] = 20,
|
||||
[ITEM_GREAT_BALL - ITEM_ULTRA_BALL] = 15,
|
||||
[ITEM_POKE_BALL - ITEM_ULTRA_BALL] = 10,
|
||||
[ITEM_SAFARI_BALL - ITEM_ULTRA_BALL] = 15
|
||||
};
|
||||
|
||||
// In Battle Palace, moves are chosen based on the pokemons nature rather than by the player
|
||||
// Moves are grouped into "Attack", "Defense", or "Support" (see PALACE_MOVE_GROUP_*)
|
||||
// Each nature has a certain percent chance of selecting a move from a particular group
|
||||
@ -3507,6 +3500,21 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_TRAP_BOTH:
|
||||
if (!(gBattleMons[gBattlerTarget].status2 & STATUS2_ESCAPE_PREVENTION) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_ESCAPE_PREVENTION))
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BothCanNoLongerEscape;
|
||||
}
|
||||
if (!gBattleMons[gBattlerTarget].status2 & STATUS2_ESCAPE_PREVENTION)
|
||||
gDisableStructs[gBattlerTarget].battlerPreventingEscape = gBattlerAttacker;
|
||||
|
||||
if (!(gBattleMons[gBattlerAttacker].status2 & STATUS2_ESCAPE_PREVENTION))
|
||||
gDisableStructs[gBattlerAttacker].battlerPreventingEscape = gBattlerTarget;
|
||||
|
||||
gBattleMons[gBattlerTarget].status2 |= STATUS2_ESCAPE_PREVENTION;
|
||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_ESCAPE_PREVENTION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8262,13 +8270,15 @@ static void Cmd_various(void)
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_SOAK:
|
||||
if (gBattleMons[gBattlerTarget].type1 == TYPE_WATER && gBattleMons[gBattlerTarget].type2 == TYPE_WATER)
|
||||
if (gBattleMons[gBattlerTarget].type1 == gBattleMoves[gCurrentMove].type
|
||||
&& gBattleMons[gBattlerTarget].type2 == gBattleMoves[gCurrentMove].type)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_BATTLER_TYPE(gBattlerTarget, TYPE_WATER);
|
||||
SET_BATTLER_TYPE(gBattlerTarget, gBattleMoves[gCurrentMove].type);
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, gBattleMoves[gCurrentMove].type);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
@ -9087,6 +9097,7 @@ static void Cmd_various(void)
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
}
|
||||
case VARIOUS_JUMP_IF_WEATHER_AFFECTED:
|
||||
{
|
||||
u32 weatherFlags = T1_READ_32(gBattlescriptCurrInstr + 3);
|
||||
@ -9096,7 +9107,6 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 11;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case VARIOUS_APPLY_PLASMA_FISTS:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
gStatuses4[i] |= STATUS4_PLASMA_FISTS;
|
||||
@ -9181,6 +9191,87 @@ static void Cmd_various(void)
|
||||
if (gBattleStruct->stickyWebUser != 0xFF)
|
||||
gBattlerAttacker = gBattleStruct->stickyWebUser;
|
||||
break;
|
||||
case VARIOUS_CUT_1_3_HP_RAISE_STATS:
|
||||
{
|
||||
bool8 atLeastOneStatBoosted = FALSE;
|
||||
u16 hpFraction = max(1, gBattleMons[gBattlerAttacker].maxHP / 3);
|
||||
|
||||
for (i = 1; i < NUM_STATS; i++)
|
||||
{
|
||||
if (CompareStat(gBattlerAttacker, i, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
atLeastOneStatBoosted = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (atLeastOneStatBoosted && gBattleMons[gBattlerAttacker].hp > hpFraction)
|
||||
{
|
||||
gBattleMoveDamage = hpFraction;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case VARIOUS_SET_OCTOLOCK:
|
||||
if (gDisableStructs[gActiveBattler].octolock)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
gDisableStructs[gActiveBattler].octolock = TRUE;
|
||||
gBattleMons[gActiveBattler].status2 |= STATUS2_ESCAPE_PREVENTION;
|
||||
gDisableStructs[gActiveBattler].battlerPreventingEscape = gBattlerAttacker;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_CHECK_POLTERGEIST:
|
||||
if (gBattleMons[gActiveBattler].item == ITEM_NONE
|
||||
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|
||||
|| GetBattlerAbility(gActiveBattler) == ABILITY_KLUTZ)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
PREPARE_ITEM_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].item);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_NO_RETREAT:
|
||||
if (gDisableStructs[gActiveBattler].noRetreat)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(gBattleMons[gActiveBattler].status2 & STATUS2_ESCAPE_PREVENTION))
|
||||
gDisableStructs[gActiveBattler].noRetreat = TRUE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_TAR_SHOT:
|
||||
if (gDisableStructs[gActiveBattler].tarShot)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
gDisableStructs[gActiveBattler].tarShot = TRUE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_CAN_TAR_SHOT_WORK:
|
||||
// Tar Shot will fail if it's already been used on the target and its speed can't be lowered further
|
||||
if (!gDisableStructs[gActiveBattler].tarShot
|
||||
&& CompareStat(gActiveBattler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
gBattlescriptCurrInstr += 7;
|
||||
else
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
return;
|
||||
case VARIOUS_TRY_TO_APPLY_MIMICRY:
|
||||
{
|
||||
bool8 isMimicryDone = FALSE;
|
||||
@ -9196,7 +9287,7 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // End of switch (gBattlescriptCurrInstr[2])
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
}
|
||||
@ -9834,7 +9925,8 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
||||
}
|
||||
else if (!certain
|
||||
&& ((GetBattlerAbility(gActiveBattler) == ABILITY_KEEN_EYE && statId == STAT_ACC)
|
||||
|| (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER && statId == STAT_ATK)))
|
||||
|| (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER && statId == STAT_ATK)
|
||||
|| (GetBattlerAbility(gActiveBattler) == ABILITY_BIG_PECKS && statId == STAT_DEF)))
|
||||
{
|
||||
if (flags == STAT_BUFF_ALLOW_PTR)
|
||||
{
|
||||
@ -12970,7 +13062,8 @@ u8 GetCatchingBattler(void)
|
||||
|
||||
static void Cmd_handleballthrow(void)
|
||||
{
|
||||
u8 ballMultiplier = 0;
|
||||
u8 ballMultiplier = 10;
|
||||
s8 ballAddition = 0;
|
||||
|
||||
if (gBattleControllerExecFlags)
|
||||
return;
|
||||
@ -12992,7 +13085,7 @@ static void Cmd_handleballthrow(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 odds;
|
||||
u32 odds, i;
|
||||
u8 catchRate;
|
||||
|
||||
gLastThrownBall = gLastUsedItem;
|
||||
@ -13001,53 +13094,193 @@ static void Cmd_handleballthrow(void)
|
||||
else
|
||||
catchRate = gBaseStats[gBattleMons[gBattlerTarget].species].catchRate;
|
||||
|
||||
if (gLastUsedItem > ITEM_SAFARI_BALL)
|
||||
#ifdef POKEMON_EXPANSION
|
||||
if (gBaseStats[gBattleMons[gBattlerTarget].species].flags & F_ULTRA_BEAST)
|
||||
{
|
||||
if (gLastUsedItem == ITEM_BEAST_BALL)
|
||||
ballMultiplier = 50;
|
||||
else
|
||||
ballMultiplier = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
|
||||
switch (gLastUsedItem)
|
||||
{
|
||||
case ITEM_ULTRA_BALL:
|
||||
ballMultiplier = 20;
|
||||
case ITEM_GREAT_BALL:
|
||||
case ITEM_SAFARI_BALL:
|
||||
#ifdef ITEM_EXPANSION
|
||||
case ITEM_SPORT_BALL:
|
||||
#endif
|
||||
ballMultiplier = 15;
|
||||
case ITEM_NET_BALL:
|
||||
if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG))
|
||||
#if B_NET_BALL_MODIFIER >= GEN_7
|
||||
ballMultiplier = 50;
|
||||
#else
|
||||
ballMultiplier = 30;
|
||||
else
|
||||
ballMultiplier = 10;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_DIVE_BALL:
|
||||
#if B_DIVE_BALL_MODIFIER >= GEN_4
|
||||
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter)
|
||||
ballMultiplier = 35;
|
||||
#else
|
||||
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
|
||||
ballMultiplier = 35;
|
||||
else
|
||||
ballMultiplier = 10;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_NEST_BALL:
|
||||
#if B_NEST_BALL_MODIFIER >= GEN_6
|
||||
//((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise.
|
||||
if (gBattleMons[gBattlerTarget].level < 30)
|
||||
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
|
||||
#elif B_NEST_BALL_MODIFIER == GEN_5
|
||||
//((41 - Pokémon's level) ÷ 10)×, minimum 1×
|
||||
if (gBattleMons[gBattlerTarget].level < 31)
|
||||
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
|
||||
#else
|
||||
//((40 - Pokémon's level) ÷ 10)×, minimum 1×
|
||||
if (gBattleMons[gBattlerTarget].level < 40)
|
||||
{
|
||||
ballMultiplier = 40 - gBattleMons[gBattlerTarget].level;
|
||||
if (ballMultiplier <= 9)
|
||||
ballMultiplier = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
ballMultiplier = 10;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ITEM_REPEAT_BALL:
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT))
|
||||
#if B_REPEAT_BALL_MODIFIER >= GEN_7
|
||||
ballMultiplier = 35;
|
||||
#else
|
||||
ballMultiplier = 30;
|
||||
else
|
||||
ballMultiplier = 10;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_TIMER_BALL:
|
||||
#if B_TIMER_BALL_MODIFIER >= GEN_5
|
||||
ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10;
|
||||
#else
|
||||
ballMultiplier = gBattleResults.battleTurnCounter + 10;
|
||||
#endif
|
||||
if (ballMultiplier > 40)
|
||||
ballMultiplier = 40;
|
||||
break;
|
||||
case ITEM_LUXURY_BALL:
|
||||
case ITEM_PREMIER_BALL:
|
||||
ballMultiplier = 10;
|
||||
#ifdef ITEM_EXPANSION
|
||||
case ITEM_DUSK_BALL:
|
||||
RtcCalcLocalTime();
|
||||
if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND)
|
||||
#if B_DUSK_BALL_MODIFIER >= GEN_7
|
||||
ballMultiplier = 30;
|
||||
#else
|
||||
ballMultiplier = 35;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_QUICK_BALL:
|
||||
if (gBattleResults.battleTurnCounter == 0)
|
||||
#if B_QUICK_BALL_MODIFIER >= GEN_5
|
||||
ballMultiplier = 50;
|
||||
#else
|
||||
ballMultiplier = 40;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_LEVEL_BALL:
|
||||
if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level)
|
||||
ballMultiplier = 80;
|
||||
else if (gBattleMons[gBattlerAttacker].level > 2 * gBattleMons[gBattlerTarget].level)
|
||||
ballMultiplier = 40;
|
||||
else if (gBattleMons[gBattlerAttacker].level > gBattleMons[gBattlerTarget].level)
|
||||
ballMultiplier = 20;
|
||||
break;
|
||||
case ITEM_LURE_BALL:
|
||||
if (gIsFishingEncounter)
|
||||
#if B_LURE_BALL_MODIFIER >= GEN_7
|
||||
ballMultiplier = 50;
|
||||
#else
|
||||
ballMultiplier = 30;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_MOON_BALL:
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
if (gEvolutionTable[gBattleMons[gBattlerTarget].species][i].method == EVO_ITEM
|
||||
&& gEvolutionTable[gBattleMons[gBattlerTarget].species][i].param == ITEM_MOON_STONE)
|
||||
ballMultiplier = 40;
|
||||
}
|
||||
break;
|
||||
case ITEM_LOVE_BALL:
|
||||
if (gBattleMons[gBattlerTarget].species == gBattleMons[gBattlerAttacker].species)
|
||||
{
|
||||
u8 gender1 = GetMonGender(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]);
|
||||
u8 gender2 = GetMonGender(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]);
|
||||
|
||||
if (gender1 != gender2 && gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS)
|
||||
ballMultiplier = 80;
|
||||
}
|
||||
break;
|
||||
case ITEM_FAST_BALL:
|
||||
if (gBaseStats[gBattleMons[gBattlerTarget].species].baseSpeed >= 100)
|
||||
ballMultiplier = 40;
|
||||
break;
|
||||
case ITEM_HEAVY_BALL:
|
||||
i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1);
|
||||
#if B_HEAVY_BALL_MODIFIER >= GEN_7
|
||||
if (i < 1000)
|
||||
ballAddition = -20;
|
||||
else if (i < 2000)
|
||||
ballAddition = 0;
|
||||
else if (i < 3000)
|
||||
ballAddition = 20;
|
||||
else
|
||||
ballMultiplier = sBallCatchBonuses[gLastUsedItem - ITEM_ULTRA_BALL];
|
||||
ballAddition = 30;
|
||||
#elif B_HEAVY_BALL_MODIFIER >= GEN_4
|
||||
if (i < 2048)
|
||||
ballAddition = -20;
|
||||
else if (i < 3072)
|
||||
ballAddition = 20;
|
||||
else if (i < 4096)
|
||||
ballAddition = 30;
|
||||
else
|
||||
ballAddition = 40;
|
||||
#else
|
||||
if (i < 1024)
|
||||
ballAddition = -20;
|
||||
else if (i < 2048)
|
||||
ballAddition = 0;
|
||||
else if (i < 3072)
|
||||
ballAddition = 20;
|
||||
else if (i < 4096)
|
||||
ballAddition = 30;
|
||||
else
|
||||
ballAddition = 40;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_DREAM_BALL:
|
||||
#if B_DREAM_BALL_MODIFIER >= GEN_8
|
||||
if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE)
|
||||
ballMultiplier = 40;
|
||||
#else
|
||||
ballMultiplier = 10;
|
||||
#endif
|
||||
break;
|
||||
case ITEM_BEAST_BALL:
|
||||
ballMultiplier = 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef POKEMON_EXPANSION
|
||||
}
|
||||
#endif
|
||||
|
||||
// catchRate is unsigned, which means that it may potentially overflow if sum is applied directly.
|
||||
if (catchRate < 21 && ballAddition == -20)
|
||||
catchRate = 1;
|
||||
else
|
||||
catchRate = catchRate + ballAddition;
|
||||
|
||||
odds = (catchRate * ballMultiplier / 10)
|
||||
* (gBattleMons[gBattlerTarget].maxHP * 3 - gBattleMons[gBattlerTarget].hp * 2)
|
||||
@ -13089,16 +13322,17 @@ static void Cmd_handleballthrow(void)
|
||||
u8 shakes;
|
||||
u8 maxShakes;
|
||||
|
||||
gBattleSpritesDataPtr->animationData->isCriticalCapture = 0; //initialize
|
||||
gBattleSpritesDataPtr->animationData->isCriticalCapture = 0;
|
||||
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 0;
|
||||
|
||||
if (CriticalCapture(odds))
|
||||
{
|
||||
maxShakes = 1; //critical capture doesn't guarantee capture
|
||||
maxShakes = BALL_1_SHAKE; // critical capture doesn't guarantee capture
|
||||
gBattleSpritesDataPtr->animationData->isCriticalCapture = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxShakes = 4;
|
||||
maxShakes = BALL_3_SHAKES_SUCCESS;
|
||||
}
|
||||
|
||||
if (gLastUsedItem == ITEM_MASTER_BALL)
|
||||
@ -13123,10 +13357,21 @@ static void Cmd_handleballthrow(void)
|
||||
UndoFormChange(gBattlerPartyIndexes[gBattlerTarget], GET_BATTLER_SIDE(gBattlerTarget), FALSE);
|
||||
gBattlescriptCurrInstr = BattleScript_SuccessBallThrow;
|
||||
SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_POKEBALL, &gLastUsedItem);
|
||||
|
||||
if (CalculatePlayerPartyCount() == PARTY_SIZE)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
|
||||
#ifdef ITEM_EXPANSION
|
||||
if (gLastUsedItem == ITEM_HEAL_BALL)
|
||||
{
|
||||
MonRestorePP(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]);
|
||||
HealStatusConditions(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], gBattlerPartyIndexes[gBattlerTarget], STATUS1_ANY, gBattlerTarget);
|
||||
gBattleMons[gBattlerTarget].hp = gBattleMons[gBattlerTarget].maxHP;
|
||||
SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_HP, &gBattleMons[gBattlerTarget].hp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // not caught
|
||||
{
|
||||
@ -13134,7 +13379,7 @@ static void Cmd_handleballthrow(void)
|
||||
gLastUsedBall = gLastUsedItem;
|
||||
|
||||
if (IsCriticalCapture())
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = shakes + 3;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = BALL_3_SHAKES_FAIL;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = shakes;
|
||||
|
||||
|
@ -2438,6 +2438,7 @@ enum
|
||||
ENDTURN_NIGHTMARES,
|
||||
ENDTURN_CURSE,
|
||||
ENDTURN_WRAP,
|
||||
ENDTURN_OCTOLOCK,
|
||||
ENDTURN_UPROAR,
|
||||
ENDTURN_THRASH,
|
||||
ENDTURN_FLINCH,
|
||||
@ -2708,6 +2709,18 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
}
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_OCTOLOCK:
|
||||
if (gDisableStructs[gActiveBattler].octolock
|
||||
&& !(GetBattlerAbility(gActiveBattler) == ABILITY_CLEAR_BODY
|
||||
|| GetBattlerAbility(gActiveBattler) == ABILITY_FULL_METAL_BODY
|
||||
|| GetBattlerAbility(gActiveBattler) == ABILITY_WHITE_SMOKE))
|
||||
{
|
||||
gBattlerTarget = gActiveBattler;
|
||||
BattleScriptExecute(BattleScript_OctolockEndTurn);
|
||||
effect++;
|
||||
}
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_UPROAR: // uproar
|
||||
if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR)
|
||||
{
|
||||
@ -6847,6 +6860,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
switch (atkHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_FLINCH:
|
||||
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE)
|
||||
atkHoldEffectParam *= 2;
|
||||
if (gBattleMoveDamage != 0 // Need to have done damage
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
@ -7788,7 +7803,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
if (weight >= ARRAY_COUNT(sHeatCrashPowerTable))
|
||||
basePower = sHeatCrashPowerTable[ARRAY_COUNT(sHeatCrashPowerTable) - 1];
|
||||
else
|
||||
basePower = sHeatCrashPowerTable[i];
|
||||
basePower = sHeatCrashPowerTable[weight];
|
||||
break;
|
||||
case EFFECT_PUNISHMENT:
|
||||
basePower = 60 + (CountBattlerStatIncreases(battlerDef, FALSE) * 20);
|
||||
@ -7823,6 +7838,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
&& (gDisableStructs[battlerDef].isFirstTurn != 2 || B_PAYBACK_SWITCH_BOOST < GEN_5))
|
||||
basePower *= 2;
|
||||
break;
|
||||
case EFFECT_BOLT_BEAK:
|
||||
if (GetBattlerTurnOrderNum(battlerAtk) < GetBattlerTurnOrderNum(battlerDef))
|
||||
basePower *= 2;
|
||||
break;
|
||||
case EFFECT_ROUND:
|
||||
if (gChosenMoveByBattler[BATTLE_PARTNER(battlerAtk)] == MOVE_ROUND && !(gAbsentBattlerFlags & gBitTable[BATTLE_PARTNER(battlerAtk)]))
|
||||
basePower *= 2;
|
||||
@ -8757,6 +8776,8 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt
|
||||
mod = UQ_4_12(2.0);
|
||||
if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef) && mod == UQ_4_12(0.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
if (moveType == TYPE_FIRE && gDisableStructs[battlerDef].tarShot)
|
||||
mod = UQ_4_12(2.0);
|
||||
|
||||
if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT)
|
||||
mod = UQ_4_12(1.0);
|
||||
|
@ -10772,7 +10772,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_JAW_LOCK] =
|
||||
{
|
||||
.effect = EFFECT_MEAN_LOOK,
|
||||
.effect = EFFECT_JAW_LOCK,
|
||||
.power = 80,
|
||||
.type = TYPE_DARK,
|
||||
.accuracy = 100,
|
||||
@ -10800,7 +10800,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_NO_RETREAT] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO
|
||||
.effect = EFFECT_NO_RETREAT,
|
||||
.power = 0,
|
||||
.type = TYPE_FIGHTING,
|
||||
.accuracy = 0,
|
||||
@ -10814,7 +10814,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_TAR_SHOT] =
|
||||
{
|
||||
.effect = EFFECT_SPEED_DOWN,
|
||||
.effect = EFFECT_TAR_SHOT,
|
||||
.power = 0,
|
||||
.type = TYPE_ROCK,
|
||||
.accuracy = 100,
|
||||
@ -10828,7 +10828,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_MAGIC_POWDER] =
|
||||
{
|
||||
.effect = EFFECT_THIRD_TYPE,
|
||||
.effect = EFFECT_SOAK,
|
||||
.power = 0,
|
||||
.type = TYPE_PSYCHIC,
|
||||
.accuracy = 100,
|
||||
@ -10871,7 +10871,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_OCTOLOCK] =
|
||||
{
|
||||
.effect = EFFECT_MEAN_LOOK,
|
||||
.effect = EFFECT_OCTOLOCK,
|
||||
.power = 0,
|
||||
.type = TYPE_FIGHTING,
|
||||
.accuracy = 100,
|
||||
@ -10885,7 +10885,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_BOLT_BEAK] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO
|
||||
.effect = EFFECT_BOLT_BEAK,
|
||||
.power = 85,
|
||||
.type = TYPE_ELECTRIC,
|
||||
.accuracy = 100,
|
||||
@ -10899,7 +10899,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_FISHIOUS_REND] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO. same as bolt beak
|
||||
.effect = EFFECT_BOLT_BEAK,
|
||||
.power = 85,
|
||||
.type = TYPE_WATER,
|
||||
.accuracy = 100,
|
||||
@ -10927,7 +10927,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_CLANGOROUS_SOUL] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO
|
||||
.effect = EFFECT_CLANGOROUS_SOUL,
|
||||
.power = 0,
|
||||
.type = TYPE_DRAGON,
|
||||
.accuracy = 100,
|
||||
@ -11403,7 +11403,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_POLTERGEIST] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO
|
||||
.effect = EFFECT_POLTERGEIST,
|
||||
.power = 110,
|
||||
.type = TYPE_GHOST,
|
||||
.accuracy = 90,
|
||||
|
@ -41,6 +41,8 @@ static bool8 IsAbilityAllowingEncounter(u8 level);
|
||||
// EWRAM vars
|
||||
EWRAM_DATA static u8 sWildEncountersDisabled = 0;
|
||||
EWRAM_DATA static u32 sFeebasRngValue = 0;
|
||||
EWRAM_DATA bool8 gIsFishingEncounter = 0;
|
||||
EWRAM_DATA bool8 gIsSurfingEncounter = 0;
|
||||
|
||||
#include "data/wild_encounters.h"
|
||||
|
||||
@ -652,6 +654,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
|
||||
{
|
||||
if (TryGenerateWildMon(gWildMonHeaders[headerId].waterMonsInfo, WILD_AREA_WATER, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
|
||||
{
|
||||
gIsSurfingEncounter = TRUE;
|
||||
if (TryDoDoubleWildBattle())
|
||||
{
|
||||
struct Pokemon mon1 = gEnemyParty[0];
|
||||
@ -803,6 +806,7 @@ void FishingWildEncounter(u8 rod)
|
||||
}
|
||||
IncrementGameStat(GAME_STAT_FISHING_CAPTURES);
|
||||
SetPokemonAnglerSpecies(species);
|
||||
gIsFishingEncounter = TRUE;
|
||||
BattleSetup_StartWildBattle();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user