mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald into multistrike
This commit is contained in:
commit
e59be67023
@ -1768,6 +1768,11 @@
|
||||
.macro tryactivategrimneigh, battler:req
|
||||
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
|
||||
.endm
|
||||
|
||||
.macro consumeberry battler:req, restoreItem=FALSE
|
||||
various \battler, VARIOUS_CONSUME_BERRY
|
||||
.byte \restoreItem
|
||||
.endm
|
||||
|
||||
.macro activateitemeffects battler:req
|
||||
various \battler, VARIOUS_MOVEEND_ITEM_EFFECTS
|
||||
@ -1825,6 +1830,20 @@
|
||||
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
|
||||
.endm
|
||||
|
||||
.macro getrototillertargets ptr:req
|
||||
various BS_ATTACKER, VARIOUS_GET_ROTOTILLER_TARGETS
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifnotrototilleraffected battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro tryactivatebattlebond battler:req
|
||||
various \battler, VARIOUS_TRY_ACTIVATE_BATTLE_BOND
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
|
||||
|
@ -380,6 +380,30 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT
|
||||
.4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT
|
||||
.4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25
|
||||
.4byte BattleScript_EffectStuffCheeks @ EFFECT_STUFF_CHEEKS
|
||||
|
||||
BattleScript_EffectStuffCheeks::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifnotberry BS_ATTACKER, BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
BattleScript_StuffCheeksEatBerry:
|
||||
setbyte sBERRY_OVERRIDE, TRUE
|
||||
orword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
consumeberry BS_ATTACKER
|
||||
bicword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, FALSE
|
||||
setstatchanger STAT_DEF, 2, FALSE
|
||||
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_StuffCheeksEnd
|
||||
setgraphicalstatchangevalues
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_StuffCheeksEnd @ cant raise def
|
||||
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_StuffCheeksEnd:
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectDecorate:
|
||||
attackcanceler
|
||||
@ -641,6 +665,11 @@ BattleScript_MoveEffectIncinerate::
|
||||
BattleScript_MoveEffectBugBite::
|
||||
printstring STRINGID_BUGBITE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
orword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, TRUE @ override the requirements for eating berries
|
||||
consumeberry BS_ATTACKER, TRUE @ consume the berry, then restore the item from changedItems
|
||||
bicword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||
setbyte sBERRY_OVERRIDE, FALSE
|
||||
return
|
||||
|
||||
BattleScript_EffectCoreEnforcer:
|
||||
@ -952,27 +981,24 @@ BattleScript_FlowerShieldMoveTargetEnd:
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_FlowerShieldLoop
|
||||
end
|
||||
|
||||
|
||||
BattleScript_EffectRototiller:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
selectfirstvalidtarget
|
||||
BattleScript_RototillerLoop:
|
||||
movevaluescleanup
|
||||
jumpifnotgrounded BS_TARGET, BattleScript_RototillerNoEffect
|
||||
jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_RototillerLoop2
|
||||
BattleScript_RototillerNoEffect:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NOEFFECTONTARGET
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
BattleScript_RototillerLoop2:
|
||||
jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_RototillerDoMoveAnim
|
||||
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, MAX_STAT_STAGE, BattleScript_RototillerCantRaiseMultipleStats
|
||||
BattleScript_RototillerDoMoveAnim::
|
||||
getrototillertargets BattleScript_ButItFailed
|
||||
@ at least one battler is affected
|
||||
attackanimation
|
||||
waitanimation
|
||||
savetarget
|
||||
setbyte gBattlerTarget, 0
|
||||
BattleScript_RototillerLoop:
|
||||
movevaluescleanup
|
||||
jumpifstat BS_TARGET, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_RototillerCheckAffected
|
||||
jumpifstat BS_TARGET, CMP_EQUAL, STAT_SPATK, MAX_STAT_STAGE, BattleScript_RototillerCantRaiseMultipleStats
|
||||
BattleScript_RototillerCheckAffected:
|
||||
jumpifnotrototilleraffected BS_TARGET, BattleScript_RototillerNoEffect
|
||||
BattleScript_RototillerAffected:
|
||||
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, 0
|
||||
setstatchanger STAT_ATK, 1, FALSE
|
||||
@ -988,13 +1014,22 @@ BattleScript_RototillerTrySpAtk::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_RototillerMoveTargetEnd:
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_RototillerLoop
|
||||
addbyte gBattlerTarget, 1
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_RototillerLoop
|
||||
end
|
||||
|
||||
BattleScript_RototillerCantRaiseMultipleStats:
|
||||
copybyte gBattlerAttacker, gBattlerTarget
|
||||
printstring STRINGID_STATSWONTINCREASE2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
|
||||
BattleScript_RototillerNoEffect:
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_NOEFFECTONTARGET
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_RototillerMoveTargetEnd
|
||||
|
||||
BattleScript_EffectBestow:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON
|
||||
@ -3861,6 +3896,7 @@ BattleScript_PerishSongLoopIncrement::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_PerishSongBlocked::
|
||||
copybyte sBATTLER, gBattlerTarget
|
||||
printstring STRINGID_PKMNSXBLOCKSY2
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_PerishSongLoopIncrement
|
||||
@ -5236,6 +5272,7 @@ BattleScript_FaintTarget::
|
||||
tryactivatemoxie BS_ATTACKER @ and chilling neigh, as one ice rider
|
||||
tryactivatebeastboost BS_ATTACKER
|
||||
tryactivategrimneigh BS_ATTACKER @ and as one shadow rider
|
||||
tryactivatebattlebond BS_ATTACKER
|
||||
trytrainerslidefirstdownmsg BS_TARGET
|
||||
return
|
||||
|
||||
@ -6339,6 +6376,10 @@ BattleScript_SelectingNotAllowedMoveGravity::
|
||||
printselectionstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
endselectionscript
|
||||
|
||||
BattleScript_SelectingNotAllowedStuffCheeks::
|
||||
printselectionstring STRINGID_STUFFCHEEKSCANTSELECT
|
||||
endselectionscript
|
||||
|
||||
BattleScript_SelectingNotAllowedBelch::
|
||||
printselectionstring STRINGID_BELCHCANTSELECT
|
||||
endselectionscript
|
||||
@ -6746,7 +6787,7 @@ BattleScript_PowderMoveNoEffect::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
jumpiftype BS_TARGET, TYPE_GRASS, BattleScript_PowderMoveNoEffectPrint
|
||||
jumpifability BS_TARGET, ABILITY_OVERCOAT, BattleScript_PowderMoveNoEffectOvercoat
|
||||
printstring STRINGID_SAFETYGOOGLESPROTECTED
|
||||
printstring STRINGID_SAFETYGOGGLESPROTECTED
|
||||
goto BattleScript_PowderMoveNoEffectWaitMsg
|
||||
BattleScript_PowderMoveNoEffectOvercoat:
|
||||
call BattleScript_AbilityPopUp
|
||||
@ -7466,6 +7507,7 @@ BattleScript_MoveStatDrain::
|
||||
waitanimation
|
||||
printstring STRINGID_TARGETABILITYSTATRAISE
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
clearsemiinvulnerablebit
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
@ -8164,22 +8206,22 @@ BattleScript_HangedOnMsgRet:
|
||||
return
|
||||
|
||||
BattleScript_BerryConfuseHealEnd2::
|
||||
jumpifability BS_ATTACKER, ABILITY_RIPEN, BattleScript_BerryConfuseHealEnd2_AbilityPopup
|
||||
jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_BerryConfuseHealEnd2_AbilityPopup
|
||||
goto BattleScript_BerryConfuseHealEnd2_Anim
|
||||
BattleScript_BerryConfuseHealEnd2_AbilityPopup:
|
||||
call BattleScript_AbilityPopUp
|
||||
BattleScript_BerryConfuseHealEnd2_Anim:
|
||||
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
|
||||
printstring STRINGID_PKMNSITEMRESTOREDHEALTH
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
||||
healthbarupdate BS_ATTACKER
|
||||
datahpupdate BS_ATTACKER
|
||||
healthbarupdate BS_SCRIPTING
|
||||
datahpupdate BS_SCRIPTING
|
||||
printstring STRINGID_FORXCOMMAYZ
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER
|
||||
seteffectprimary
|
||||
removeitem BS_ATTACKER
|
||||
removeitem BS_SCRIPTING
|
||||
end2
|
||||
|
||||
BattleScript_BerryConfuseHealRet::
|
||||
@ -8196,9 +8238,9 @@ BattleScript_BerryConfuseHealRet_Anim:
|
||||
datahpupdate BS_SCRIPTING
|
||||
printstring STRINGID_FORXCOMMAYZ
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER
|
||||
setmoveeffect MOVE_EFFECT_CONFUSION | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
removeitem BS_SCRIPTING
|
||||
removeitem BS_TARGET
|
||||
return
|
||||
|
||||
BattleScript_BerryStatRaiseEnd2::
|
||||
|
19
graphics/battle_interface/ability_pop_up.pal
Normal file
19
graphics/battle_interface/ability_pop_up.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
1 177 91
|
||||
143 129 149
|
||||
103 91 111
|
||||
79 65 85
|
||||
59 31 81
|
||||
103 89 109
|
||||
231 239 245
|
||||
249 253 255
|
||||
0 0 0
|
||||
0 0 0
|
||||
107 115 115
|
||||
74 66 82
|
||||
0 0 0
|
||||
214 214 206
|
||||
132 140 140
|
||||
0 0 0
|
BIN
graphics/battle_interface/last_used_ball_l.png
Normal file
BIN
graphics/battle_interface/last_used_ball_l.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 214 B |
BIN
graphics/battle_interface/last_used_ball_r.png
Normal file
BIN
graphics/battle_interface/last_used_ball_r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 223 B |
@ -37,6 +37,7 @@
|
||||
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
||||
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
|
||||
#define B_ACTION_DEBUG 20
|
||||
#define B_ACTION_THROW_BALL 21 // R to throw last used ball
|
||||
#define B_ACTION_NONE 0xFF
|
||||
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
@ -165,20 +166,21 @@ struct SpecialStatus
|
||||
u8 traced:1;
|
||||
u8 ppNotAffectedByPressure:1;
|
||||
u8 flag40:1;
|
||||
// end of byte
|
||||
u8 focusBanded:1;
|
||||
u8 focusBanded:1;
|
||||
// End of byte
|
||||
u8 focusSashed:1;
|
||||
u8 sturdied:1;
|
||||
u8 stormDrainRedirected:1;
|
||||
u8 switchInAbilityDone:1;
|
||||
u8 switchInItemDone:1;
|
||||
// end of byte, two bits unused
|
||||
u8 instructedChosenTarget:3;
|
||||
// End of byte
|
||||
u8 berryReduced:1;
|
||||
u8 gemBoost:1;
|
||||
u8 rototillerAffected:1; // to be affected by rototiller
|
||||
u8 parentalBondOn:2;
|
||||
u8 multiHitOn:1;
|
||||
// end of byte
|
||||
// End of byte, two bits unused
|
||||
u8 gemParam;
|
||||
u8 damagedMons:4; // Mons that have been damaged directly by using a move, includes substitute.
|
||||
u8 dancerUsedMove:1;
|
||||
@ -607,6 +609,7 @@ struct BattleStruct
|
||||
u8 quickClawBattlerId;
|
||||
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
|
||||
u8 blunderPolicy:1; // should blunder policy activate
|
||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||
};
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
@ -681,6 +684,7 @@ struct BattleScripting
|
||||
bool8 fixedPopup; // Force ability popup to stick until manually called back
|
||||
u16 abilityPopupOverwrite;
|
||||
u8 switchCase; // Special switching conditions, eg. red card
|
||||
u8 overrideBerryRequirements;
|
||||
};
|
||||
|
||||
// rom_80A5C6C
|
||||
@ -910,5 +914,6 @@ extern u8 gNumberOfMovesToChoose;
|
||||
extern u8 gBattleControllerData[MAX_BATTLERS_COUNT];
|
||||
extern bool8 gHasFetchedBall;
|
||||
extern u8 gLastUsedBall;
|
||||
extern u16 gLastThrownBall;
|
||||
|
||||
#endif // GUARD_BATTLE_H
|
||||
|
@ -93,5 +93,9 @@ u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
|
||||
u8 GetHPBarLevel(s16 hp, s16 maxhp);
|
||||
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle);
|
||||
void DestroyAbilityPopUp(u8 battlerId);
|
||||
bool32 CanThrowLastUsedBall(void);
|
||||
void TryHideLastUsedBall(void);
|
||||
void TryRestoreLastUsedBall(void);
|
||||
void TryAddLastUsedBallItemSprites(void);
|
||||
|
||||
#endif // GUARD_BATTLE_INTERFACE_H
|
||||
|
@ -298,6 +298,7 @@ extern const u8 BattleScript_ProteanActivates[];
|
||||
extern const u8 BattleScript_DazzlingProtected[];
|
||||
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
|
||||
extern const u8 BattleScript_MoveUsedPowder[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedBelch[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
|
||||
extern const u8 BattleScript_PsychicSurgeActivates[];
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define ITEMEFFECT_TARGET 0x5
|
||||
#define ITEMEFFECT_ORBS 0x6
|
||||
#define ITEMEFFECT_LIFEORB_SHELLBELL 0x7
|
||||
#define ITEMEFFECT_BATTLER_MOVE_END 0x8 // move end effects for just the battler, not whole field
|
||||
|
||||
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
|
||||
|
||||
@ -47,6 +48,7 @@ struct TypePower
|
||||
|
||||
extern const struct TypePower gNaturalGiftTable[];
|
||||
|
||||
void HandleAction_ThrowBall(void);
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move);
|
||||
void HandleAction_UseMove(void);
|
||||
void HandleAction_Switch(void);
|
||||
@ -152,7 +154,7 @@ bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||
bool32 TryRoomService(u8 battlerId);
|
||||
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
||||
void DoBurmyFormChange(u32 monId);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
||||
bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId);
|
||||
|
||||
// ability checks
|
||||
|
@ -384,4 +384,6 @@
|
||||
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
|
||||
#define MOVE_TARGET_ALLY 0x80
|
||||
|
||||
#define MOVE_TARGET_ALL_BATTLERS (MOVE_TARGET_BOTH | MOVE_TARGET_OPPONENTS_FIELD)
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_H
|
||||
|
@ -124,6 +124,7 @@
|
||||
#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
|
||||
#define B_TAILWIND_TIMER GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3.
|
||||
#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6.
|
||||
#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs.
|
||||
|
||||
// Ability settings
|
||||
#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
|
||||
@ -168,6 +169,10 @@
|
||||
// Item Theft Settings
|
||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||
|
||||
// Last Used Ball
|
||||
#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented
|
||||
#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball.
|
||||
|
||||
// Other
|
||||
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
|
||||
#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
|
||||
|
@ -364,7 +364,8 @@
|
||||
#define EFFECT_SNIPE_SHOT 358
|
||||
#define EFFECT_TRIPLE_HIT 359
|
||||
#define EFFECT_RECOIL_HP_25 360
|
||||
#define EFFECT_STUFF_CHEEKS 361
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 361
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 362
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
|
||||
#define sABILITY_OVERWRITE gBattleScripting + 0x34
|
||||
#define sSWITCH_CASE gBattleScripting + 0x36
|
||||
#define sBERRY_OVERRIDE gBattleScripting + 0x37
|
||||
|
||||
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
||||
#define cMISS_TYPE gBattleCommunication + 6
|
||||
@ -185,6 +186,10 @@
|
||||
#define VARIOUS_REMOVE_TERRAIN 113
|
||||
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
|
||||
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
|
||||
#define VARIOUS_GET_ROTOTILLER_TARGETS 116
|
||||
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 117
|
||||
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 118
|
||||
#define VARIOUS_CONSUME_BERRY 119
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -523,7 +523,7 @@
|
||||
#define STRINGID_GRASSYTERRAINHEALS 519
|
||||
#define STRINGID_ELECTRICTERRAINPREVENTS 520
|
||||
#define STRINGID_PSYCHICTERRAINPREVENTS 521
|
||||
#define STRINGID_SAFETYGOOGLESPROTECTED 522
|
||||
#define STRINGID_SAFETYGOGGLESPROTECTED 522
|
||||
#define STRINGID_FLOWERVEILPROTECTED 523
|
||||
#define STRINGID_SWEETVEILPROTECTED 524
|
||||
#define STRINGID_AROMAVEILPROTECTED 525
|
||||
@ -592,8 +592,9 @@
|
||||
#define STRINGID_STRONGWINDSDISSIPATED 588
|
||||
#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 589
|
||||
#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 590
|
||||
#define STRINGID_STUFFCHEEKSCANTSELECT 591
|
||||
|
||||
#define BATTLESTRINGS_COUNT 591
|
||||
#define BATTLESTRINGS_COUNT 592
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -130,7 +130,7 @@
|
||||
// Gen6 hold effects
|
||||
#define HOLD_EFFECT_FAIRY_POWER 139
|
||||
#define HOLD_EFFECT_MEGA_STONE 140
|
||||
#define HOLD_EFFECT_SAFETY_GOOGLES 141
|
||||
#define HOLD_EFFECT_SAFETY_GOGGLES 141
|
||||
#define HOLD_EFFECT_LUMINOUS_MOSS 142
|
||||
#define HOLD_EFFECT_SNOWBALL 143
|
||||
#define HOLD_EFFECT_WEAKNESS_POLICY 144
|
||||
|
@ -33,5 +33,6 @@ void ItemUseInBattle_EnigmaBerry(u8);
|
||||
void Task_UseDigEscapeRopeOnField(u8 taskId);
|
||||
u8 CanUseDigOrEscapeRopeOnCurMap(void);
|
||||
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
|
||||
u32 CanThrowBall(void);
|
||||
|
||||
#endif // GUARD_ITEM_USE_H
|
||||
|
@ -824,21 +824,17 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_DEFENSE_UP_2:
|
||||
if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES)
|
||||
score -= 10;
|
||||
case EFFECT_STUFF_CHEEKS:
|
||||
if (ItemId_GetPocket(gBattleMons[battlerAtk].item) != POCKET_BERRIES)
|
||||
return 0; // cannot even select
|
||||
//fallthrough
|
||||
case EFFECT_DEFENSE_UP:
|
||||
case EFFECT_DEFENSE_UP_2:
|
||||
case EFFECT_DEFENSE_UP_3:
|
||||
case EFFECT_DEFENSE_CURL:
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_DEF))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_SPEED_UP:
|
||||
case EFFECT_SPEED_UP_2:
|
||||
if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPEED))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_SPECIAL_ATTACK_UP:
|
||||
case EFFECT_SPECIAL_ATTACK_UP_2:
|
||||
case EFFECT_SPECIAL_ATTACK_UP_3:
|
||||
|
@ -643,7 +643,7 @@ bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect)
|
||||
{
|
||||
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -1448,7 +1448,7 @@ bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect)
|
||||
|| ability == ABILITY_SAND_FORCE
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| ability == ABILITY_MAGIC_GUARD
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_ROCK)
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_STEEL)
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_GROUND)
|
||||
@ -1473,7 +1473,7 @@ bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect)
|
||||
|| ability == ABILITY_SLUSH_RUSH
|
||||
|| ability == ABILITY_MAGIC_GUARD
|
||||
|| ability == ABILITY_OVERCOAT
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOOGLES
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
||||
|| HasMove(battler, MOVE_BLIZZARD)
|
||||
|| HasMoveEffect(battler, EFFECT_AURORA_VEIL)
|
||||
@ -2273,7 +2273,7 @@ static u32 GetWeatherDamage(u8 battlerId)
|
||||
{
|
||||
if (BattlerAffectedBySandstorm(battlerId, ability)
|
||||
&& !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
if (damage == 0)
|
||||
@ -2284,7 +2284,7 @@ static u32 GetWeatherDamage(u8 battlerId)
|
||||
{
|
||||
if (BattlerAffectedByHail(battlerId, ability)
|
||||
&& !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& holdEffect != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
if (damage == 0)
|
||||
|
@ -249,7 +249,8 @@ static void HandleInputChooseAction(void)
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
|
||||
TryHideLastUsedBall();
|
||||
|
||||
switch (gActionSelectionCursor[gActiveBattler])
|
||||
{
|
||||
case 0:
|
||||
@ -336,6 +337,15 @@ static void HandleInputChooseAction(void)
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_DEBUG, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
TryHideLastUsedBall();
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_THROW_BALL, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void UnusedEndBounceEffect(void)
|
||||
@ -372,6 +382,7 @@ static void HandleInputChooseTarget(void)
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||
TryHideLastUsedBall();
|
||||
HideMegaTriggerSprite();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
@ -485,6 +496,19 @@ static void HandleInputChooseTarget(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void HideAllTargets(void)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (IsBattlerAlive(i) && gBattleSpritesDataPtr->healthBoxesData[i].healthboxIsBouncing)
|
||||
{
|
||||
gSprites[gBattlerSpriteIds[i]].callback = SpriteCb_HideAsMoveTarget;
|
||||
EndBounceEffect(i, BOUNCE_HEALTHBOX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HideShownTargets(void)
|
||||
{
|
||||
s32 i;
|
||||
@ -498,6 +522,34 @@ static void HideShownTargets(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleInputShowEntireFieldTargets(void)
|
||||
{
|
||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||
gPlayerDpadHoldFrames++;
|
||||
else
|
||||
gPlayerDpadHoldFrames = 0;
|
||||
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
HideAllTargets();
|
||||
if (gBattleStruct->mega.playerSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
HideAllTargets();
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
|
||||
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
|
||||
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleInputShowTargets(void)
|
||||
{
|
||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||
@ -514,6 +566,7 @@ static void HandleInputShowTargets(void)
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
TryHideLastUsedBall();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||
@ -589,27 +642,40 @@ static void HandleInputChooseMove(void)
|
||||
}
|
||||
|
||||
// Show all available targets for multi-target moves
|
||||
if (B_SHOW_TARGETS && moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
|
||||
if (B_SHOW_TARGETS)
|
||||
{
|
||||
TryShowAsTarget(gMultiUsePlayerCursor);
|
||||
TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor));
|
||||
if (moveTarget & MOVE_TARGET_FOES_AND_ALLY)
|
||||
TryShowAsTarget(BATTLE_PARTNER(gActiveBattler));
|
||||
canSelectTarget = 2;
|
||||
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
|
||||
{
|
||||
u32 i = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
TryShowAsTarget(i);
|
||||
|
||||
canSelectTarget = 3;
|
||||
}
|
||||
else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
|
||||
{
|
||||
TryShowAsTarget(gMultiUsePlayerCursor);
|
||||
TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor));
|
||||
if (moveTarget & MOVE_TARGET_FOES_AND_ALLY)
|
||||
TryShowAsTarget(BATTLE_PARTNER(gActiveBattler));
|
||||
canSelectTarget = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (canSelectTarget == 0)
|
||||
|
||||
switch (canSelectTarget)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
if (gBattleStruct->mega.playerSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
HideMegaTriggerSprite();
|
||||
TryHideLastUsedBall();
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (canSelectTarget == 1)
|
||||
{
|
||||
break;
|
||||
case 1:
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
|
||||
|
||||
if (moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
|
||||
@ -620,10 +686,13 @@ static void HandleInputChooseMove(void)
|
||||
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
|
||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
case 2:
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputShowTargets;
|
||||
break;
|
||||
case 3: // Entire field
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputShowEntireFieldTargets;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
||||
@ -2696,6 +2765,7 @@ static void PlayerHandleChooseAction(void)
|
||||
for (i = 0; i < 4; i++)
|
||||
ActionSelectionDestroyCursorAt(i);
|
||||
|
||||
TryRestoreLastUsedBall();
|
||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);
|
||||
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
|
||||
|
@ -1951,7 +1951,7 @@ static const u8 sText_HoldEffectAbsorbBulb[] = _("Absorb Bulb");
|
||||
static const u8 sText_HoldEffectCellBattery[] = _("Cell Battery");
|
||||
static const u8 sText_HoldEffectFairyPower[] = _("Fairy Power");
|
||||
static const u8 sText_HoldEffectMegaStone[] = _("Mega Stone");
|
||||
static const u8 sText_HoldEffectSafetyGoogles[] = _("Safety Googles");
|
||||
static const u8 sText_HoldEffectSafetyGoggles[] = _("Safety Goggles");
|
||||
static const u8 sText_HoldEffectLuminousMoss[] = _("Luminous Moss");
|
||||
static const u8 sText_HoldEffectSnowball[] = _("Snowball");
|
||||
static const u8 sText_HoldEffectWeaknessPolicy[] = _("Weakness Policy");
|
||||
@ -2091,7 +2091,7 @@ static const u8 *const sHoldEffectNames[] =
|
||||
[HOLD_EFFECT_CELL_BATTERY] = sText_HoldEffectCellBattery,
|
||||
[HOLD_EFFECT_FAIRY_POWER] = sText_HoldEffectFairyPower,
|
||||
[HOLD_EFFECT_MEGA_STONE] = sText_HoldEffectMegaStone,
|
||||
[HOLD_EFFECT_SAFETY_GOOGLES] = sText_HoldEffectSafetyGoogles,
|
||||
[HOLD_EFFECT_SAFETY_GOGGLES] = sText_HoldEffectSafetyGoggles,
|
||||
[HOLD_EFFECT_LUMINOUS_MOSS] = sText_HoldEffectLuminousMoss,
|
||||
[HOLD_EFFECT_SNOWBALL] = sText_HoldEffectSnowball,
|
||||
[HOLD_EFFECT_WEAKNESS_POLICY] = sText_HoldEffectWeaknessPolicy,
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "constants/battle_config.h"
|
||||
#include "data.h"
|
||||
#include "pokemon_summary_screen.h"
|
||||
#include "item_icon.h"
|
||||
#include "item_use.h"
|
||||
#include "item.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
enum
|
||||
{ // Corresponds to gHealthboxElementsGfxTable (and the tables after it) in graphics.c
|
||||
@ -196,6 +200,9 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32
|
||||
static void SpriteCb_AbilityPopUp(struct Sprite *sprite);
|
||||
static void Task_FreeAbilityPopUpGfx(u8 taskId);
|
||||
|
||||
static void SpriteCB_LastUsedBall(struct Sprite *sprite);
|
||||
static void SpriteCB_LastUsedBallWin(struct Sprite *sprite);
|
||||
|
||||
// const rom data
|
||||
static const struct OamData sUnknown_0832C138 =
|
||||
{
|
||||
@ -723,6 +730,12 @@ u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId)
|
||||
return gSprites[spriteId].hOther_IndicatorSpriteId;
|
||||
}
|
||||
|
||||
static void InitLastUsedBallAssets(void)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
{
|
||||
s16 data6 = 0;
|
||||
@ -812,6 +825,9 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
gSprites[megaIndicatorSpriteId].invisible = TRUE;
|
||||
}
|
||||
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
|
||||
return healthboxLeftSpriteId;
|
||||
}
|
||||
|
||||
@ -3123,3 +3139,200 @@ static void Task_FreeAbilityPopUpGfx(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
// last used ball
|
||||
#define LAST_BALL_WINDOW_TAG 0xD721
|
||||
|
||||
static const struct OamData sOamData_LastUsedBall =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = SPRITE_SHAPE(32x32),
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = SPRITE_SIZE(32x32),
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow =
|
||||
{
|
||||
.tileTag = LAST_BALL_WINDOW_TAG,
|
||||
.paletteTag = ABILITY_POP_UP_TAG,
|
||||
.oam = &sOamData_LastUsedBall,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCB_LastUsedBallWin
|
||||
};
|
||||
|
||||
#if B_LAST_USED_BALL_BUTTON == R_BUTTON
|
||||
static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp");
|
||||
#else
|
||||
static const u8 sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp");
|
||||
#endif
|
||||
static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
|
||||
{
|
||||
sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG
|
||||
};
|
||||
|
||||
#define LAST_USED_BALL_X_F 15
|
||||
#define LAST_USED_BALL_X_0 -15
|
||||
#define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68)
|
||||
|
||||
#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1)
|
||||
#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0)
|
||||
#define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8)
|
||||
|
||||
#define sHide data[0]
|
||||
|
||||
bool32 CanThrowLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == FALSE
|
||||
return FALSE;
|
||||
#else
|
||||
return (!(CanThrowBall() != 0
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
|| !CheckBagHasItem(gLastThrownBall, 1)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TryAddLastUsedBallItemSprites(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gLastThrownBall == 0
|
||||
|| (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)))
|
||||
{
|
||||
// we're out of the last used ball, so just set it to the first ball in the bag
|
||||
// we have to compact the bag first bc it is typically only compacted when you open it
|
||||
CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]);
|
||||
gLastThrownBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId;
|
||||
}
|
||||
|
||||
if (CanThrowBall() != 0
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
|| !CheckBagHasItem(gLastThrownBall, 1))
|
||||
return;
|
||||
|
||||
// ball
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gLastThrownBall);
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0;
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y;
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall;
|
||||
}
|
||||
|
||||
// window
|
||||
LoadSpritePalette(&sSpritePalette_AbilityPopUp);
|
||||
if (GetSpriteTileStartByTag(LAST_BALL_WINDOW_TAG) == 0xFFFF)
|
||||
LoadSpriteSheet(&sSpriteSheet_LastUsedBallWindow);
|
||||
|
||||
if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[1] = CreateSprite(&sSpriteTemplate_LastUsedBallWindow,
|
||||
LAST_BALL_WIN_X_0,
|
||||
LAST_USED_WIN_Y, 5);
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallWinGfx(struct Sprite *sprite)
|
||||
{
|
||||
FreeSpriteTilesByTag(LAST_BALL_WINDOW_TAG);
|
||||
FreeSpritePaletteByTag(ABILITY_POP_UP_TAG);
|
||||
DestroySprite(sprite);
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallGfx(struct Sprite *sprite)
|
||||
{
|
||||
FreeSpriteTilesByTag(102);
|
||||
FreeSpritePaletteByTag(102);
|
||||
DestroySprite(sprite);
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBallWin(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->sHide)
|
||||
{
|
||||
if (sprite->x != LAST_BALL_WIN_X_0)
|
||||
sprite->x--;
|
||||
|
||||
if (sprite->x == LAST_BALL_WIN_X_0)
|
||||
DestroyLastUsedBallWinGfx(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->x != LAST_BALL_WIN_X_F)
|
||||
sprite->x++;
|
||||
}
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBall(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->sHide)
|
||||
{
|
||||
if (sprite->x != LAST_USED_BALL_X_0)
|
||||
sprite->x--;
|
||||
|
||||
if (sprite->x == LAST_USED_BALL_X_0)
|
||||
DestroyLastUsedBallGfx(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->x != LAST_USED_BALL_X_F)
|
||||
sprite->x++;
|
||||
}
|
||||
}
|
||||
|
||||
static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
return;
|
||||
|
||||
switch (caseId)
|
||||
{
|
||||
case 0: // hide
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = TRUE; // hide
|
||||
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = TRUE; // hide
|
||||
break;
|
||||
case 1: // restore
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore
|
||||
if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES)
|
||||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryHideLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
TryHideOrRestoreLastUsedBall(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryRestoreLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
TryHideOrRestoreLastUsedBall(1);
|
||||
else
|
||||
TryAddLastUsedBallItemSprites();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -230,6 +230,7 @@ EWRAM_DATA u16 gPartnerSpriteId = 0;
|
||||
EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
|
||||
EWRAM_DATA u8 gLastUsedBall = 0;
|
||||
EWRAM_DATA u16 gLastThrownBall = 0;
|
||||
|
||||
// IWRAM common vars
|
||||
void (*gPreBattleCallback1)(void);
|
||||
@ -401,6 +402,7 @@ static void (* const sTurnActionsFuncsTable[])(void) =
|
||||
[B_ACTION_TRY_FINISH] = HandleAction_TryFinish,
|
||||
[B_ACTION_FINISHED] = HandleAction_ActionFinished,
|
||||
[B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted,
|
||||
[B_ACTION_THROW_BALL] = HandleAction_ThrowBall,
|
||||
};
|
||||
|
||||
static void (* const sEndTurnFuncsTable[])(void) =
|
||||
@ -4074,6 +4076,10 @@ static void HandleTurnActionSelectionState(void)
|
||||
case B_ACTION_SAFARI_BALL:
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
case B_ACTION_THROW_BALL:
|
||||
gBattleStruct->throwingPokeBall = TRUE;
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
break;
|
||||
case B_ACTION_SAFARI_POKEBLOCK:
|
||||
if ((gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)) != 0)
|
||||
{
|
||||
@ -4187,6 +4193,13 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (gBattleCommunication[ACTIONS_CONFIRMED_COUNT] == gBattlersCount)
|
||||
{
|
||||
sub_818603C(1);
|
||||
|
||||
if (WILD_DOUBLE_BATTLE && gBattleStruct->throwingPokeBall) {
|
||||
// if we choose to throw a ball with our second mon, skip the action of the first
|
||||
// (if we have chosen throw ball with first, second's is already skipped)
|
||||
gChosenActionByBattler[B_POSITION_PLAYER_LEFT] = B_ACTION_NOTHING_FAINTED;
|
||||
}
|
||||
|
||||
gBattleMainFunc = SetActionsAndBattlersTurnOrder;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
@ -4508,7 +4521,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
{
|
||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||
{
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH)
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM
|
||||
|| gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH
|
||||
|| gChosenActionByBattler[gActiveBattler] == B_ACTION_THROW_BALL)
|
||||
{
|
||||
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler];
|
||||
gBattlerByTurnOrder[turnOrderId] = gActiveBattler;
|
||||
@ -4517,7 +4532,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
}
|
||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||
{
|
||||
if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH)
|
||||
if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM
|
||||
&& gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH
|
||||
&& gChosenActionByBattler[gActiveBattler] != B_ACTION_THROW_BALL)
|
||||
{
|
||||
gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler];
|
||||
gBattlerByTurnOrder[turnOrderId] = gActiveBattler;
|
||||
@ -4533,7 +4550,9 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
if (gActionsByTurnOrder[i] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[i] != B_ACTION_SWITCH
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH)
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_SWITCH
|
||||
&& gActionsByTurnOrder[i] != B_ACTION_THROW_BALL
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_THROW_BALL)
|
||||
{
|
||||
if (GetWhoStrikesFirst(battler1, battler2, FALSE))
|
||||
SwapTurnOrder(i, j);
|
||||
|
@ -653,7 +653,7 @@ static const u8 sText_MistyTerrainPreventsStatus[] = _("{B_DEF_NAME_WITH_PREFIX}
|
||||
static const u8 sText_GrassyTerrainHeals[] = _("{B_ATK_NAME_WITH_PREFIX} is healed\nby the grassy terrain!");
|
||||
static const u8 sText_ElectricTerrainPreventsSleep[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith electrified terrain!");
|
||||
static const u8 sText_PsychicTerrainPreventsPriority[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith psychic terrain!");
|
||||
static const u8 sText_SafetyGooglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!");
|
||||
static const u8 sText_SafetyGogglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is not affected\nthanks to its {B_LAST_ITEM}!");
|
||||
static const u8 sText_FlowerVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of petals!");
|
||||
static const u8 sText_SweetVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of sweetness!");
|
||||
static const u8 sText_AromaVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby an aromatic veil!");
|
||||
@ -718,9 +718,11 @@ static const u8 sText_MysteriousAirCurrent[] = _("A mysterious air current is\np
|
||||
static const u8 sText_StrongWindsDissipated[] = _("The mysterious strong winds\nhave dissipated!{PAUSE 64}");
|
||||
static const u8 sText_MysteriousAirCurrentBlowsOn[] = _("The mysterious air current\nblows on regardless!");
|
||||
static const u8 sText_AttackWeakenedByStrongWinds[] = _("The mysterious strong winds\nweakened the attack!");
|
||||
static const u8 sText_StuffCheeksCantSelect[] = _("Stuff Cheeks cannot be\nselected without a Berry!\p");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_STUFFCHEEKSCANTSELECT - 12] = sText_StuffCheeksCantSelect,
|
||||
[STRINGID_ATTACKWEAKENEDBSTRONGWINDS - 12] = sText_AttackWeakenedByStrongWinds,
|
||||
[STRINGID_MYSTERIOUSAIRCURRENTBLOWSON - 12] = sText_MysteriousAirCurrentBlowsOn,
|
||||
[STRINGID_STRONGWINDSDISSIPATED - 12] = sText_StrongWindsDissipated,
|
||||
@ -780,7 +782,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_AROMAVEILPROTECTED - 12] = sText_AromaVeilProtected,
|
||||
[STRINGID_SWEETVEILPROTECTED - 12] = sText_SweetVeilProtected,
|
||||
[STRINGID_FLOWERVEILPROTECTED - 12] = sText_FlowerVeilProtected,
|
||||
[STRINGID_SAFETYGOOGLESPROTECTED - 12] = sText_SafetyGooglesProtected,
|
||||
[STRINGID_SAFETYGOGGLESPROTECTED - 12] = sText_SafetyGogglesProtected,
|
||||
[STRINGID_SPECTRALTHIEFSTEAL - 12] = sText_SpectralThiefSteal,
|
||||
[STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse,
|
||||
[STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText,
|
||||
|
@ -1485,7 +1485,7 @@ static void Cmd_attackcanceler(void)
|
||||
gProtectStructs[gBattlerTarget].bounceMove = 0;
|
||||
gProtectStructs[gBattlerTarget].usesBouncedMove = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker))
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE))
|
||||
{
|
||||
// Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker
|
||||
gBattlerTarget = gBattlerAttacker;
|
||||
@ -3372,16 +3372,22 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)
|
||||
if (ItemId_GetPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
// target loses their berry
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
gBattleMons[gEffectBattler].item = 0;
|
||||
CheckSetUnburden(gEffectBattler);
|
||||
|
||||
gActiveBattler = gEffectBattler;
|
||||
|
||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
|
||||
// attacker temporarily gains their item
|
||||
gBattleStruct->changedItems[gBattlerAttacker] = gBattleMons[gBattlerAttacker].item;
|
||||
gBattleMons[gBattlerAttacker].item = gLastUsedItem;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
||||
}
|
||||
@ -4526,12 +4532,13 @@ static void Cmd_endselectionscript(void)
|
||||
static void Cmd_playanimation(void)
|
||||
{
|
||||
const u16* argumentPtr;
|
||||
u8 animId = gBattlescriptCurrInstr[2];
|
||||
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||
argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
|
||||
#if B_TERRAIN_BG_CHANGE == FALSE
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_RESTORE_BG)
|
||||
if (animId == B_ANIM_RESTORE_BG)
|
||||
{
|
||||
// workaround for .if not working
|
||||
gBattlescriptCurrInstr += 7;
|
||||
@ -4539,28 +4546,28 @@ static void Cmd_playanimation(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_STATS_CHANGE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_MEGA_EVOLUTION
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_ILLUSION_OFF
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_FORM_CHANGE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SUBSTITUTE_FADE)
|
||||
if (animId == B_ANIM_STATS_CHANGE
|
||||
|| animId == B_ANIM_SNATCH_MOVE
|
||||
|| animId == B_ANIM_MEGA_EVOLUTION
|
||||
|| animId == B_ANIM_ILLUSION_OFF
|
||||
|| animId == B_ANIM_FORM_CHANGE
|
||||
|| animId == B_ANIM_SUBSTITUTE_FADE)
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else if (gHitMarker & HITMARKER_NO_ANIMATIONS)
|
||||
else if (gHitMarker & HITMARKER_NO_ANIMATIONS && animId != B_ANIM_RESTORE_BG)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 7);
|
||||
gBattlescriptCurrInstr = BattleScript_Pausex20;
|
||||
}
|
||||
else if (gBattlescriptCurrInstr[2] == B_ANIM_RAIN_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SUN_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SANDSTORM_CONTINUES
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_HAIL_CONTINUES)
|
||||
else if (animId == B_ANIM_RAIN_CONTINUES
|
||||
|| animId == B_ANIM_SUN_CONTINUES
|
||||
|| animId == B_ANIM_SANDSTORM_CONTINUES
|
||||
|| animId == B_ANIM_HAIL_CONTINUES)
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
@ -4570,7 +4577,7 @@ static void Cmd_playanimation(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr);
|
||||
BtlController_EmitBattleAnimation(0, animId, *argumentPtr);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
@ -5313,7 +5320,7 @@ static void Cmd_moveend(void)
|
||||
// Attacker is the damage-dealer, battler is mon to be switched out
|
||||
if (IsBattlerAlive(battler)
|
||||
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_BUTTON
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0)
|
||||
&& CountUsablePartyMons(battler) > 0) // Has mon to switch into
|
||||
{
|
||||
@ -5347,7 +5354,7 @@ static void Cmd_moveend(void)
|
||||
// Attacker is the one to be switched out, battler is one with red card
|
||||
if (battler != gBattlerAttacker
|
||||
&& IsBattlerAlive(battler)
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RED_CARD
|
||||
&& (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0)
|
||||
&& CanBattlerSwitch(gBattlerAttacker))
|
||||
@ -5414,7 +5421,7 @@ static void Cmd_moveend(void)
|
||||
if (battler != gBattlerAttacker // Cannot pickpocket yourself
|
||||
&& GetBattlerAbility(battler) == ABILITY_PICKPOCKET // Target must have pickpocket ability
|
||||
&& BATTLER_DAMAGED(battler) // Target needs to have been damaged
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) // Subsitute unaffected
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) // Subsitute unaffected
|
||||
&& IsBattlerAlive(battler) // Battler must be alive to pickpocket
|
||||
&& gBattleMons[battler].item == ITEM_NONE // Pickpocketer can't have an item already
|
||||
&& CanStealItem(battler, gBattlerAttacker, gBattleMons[gBattlerAttacker].item)) // Cannot steal plates, mega stones, etc
|
||||
@ -7509,6 +7516,21 @@ static u32 GetHighestStatId(u32 battlerId)
|
||||
return highestId;
|
||||
}
|
||||
|
||||
static bool32 IsRototillerAffected(u32 battlerId)
|
||||
{
|
||||
if (!IsBattlerAlive(battlerId))
|
||||
return FALSE;
|
||||
if (!IsBattlerGrounded(battlerId))
|
||||
return FALSE; // Only grounded battlers affected
|
||||
if (!IS_BATTLER_OF_TYPE(battlerId, TYPE_GRASS))
|
||||
return FALSE; // Only grass types affected
|
||||
if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE; // Rototiller doesn't affected semi-invulnerable battlers
|
||||
if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battlerId, FALSE))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void Cmd_various(void)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
@ -8917,7 +8939,7 @@ static void Cmd_various(void)
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler))
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE))
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
@ -8955,6 +8977,71 @@ static void Cmd_various(void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VARIOUS_GET_ROTOTILLER_TARGETS:
|
||||
// Gets the battlers to be affected by rototiller. If there are none, print 'But it failed!'
|
||||
{
|
||||
u32 count = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = FALSE;
|
||||
if (IsRototillerAffected(i))
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = TRUE;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // Rototiller fails
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED:
|
||||
if (gSpecialStatuses[gActiveBattler].rototillerAffected)
|
||||
{
|
||||
gSpecialStatuses[gActiveBattler].rototillerAffected = FALSE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // Unaffected by rototiller - print STRINGID_NOEFFECTONTARGET
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_ACTIVATE_BATTLE_BOND:
|
||||
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
|
||||
&& HasAttackerFaintedTarget()
|
||||
&& CalculateEnemyPartyCount() > 1)
|
||||
{
|
||||
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
|
||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
|
||||
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VARIOUS_CONSUME_BERRY:
|
||||
if (ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) == HOLD_EFFECT_NONE)
|
||||
{
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
}
|
||||
|
||||
gBattleScripting.battler = gEffectBattler = gBattlerTarget = gActiveBattler; // Cover all berry effect battlerId cases. e.g. ChangeStatBuffs uses target ID
|
||||
// Do move end berry effects for just a single battler, instead of looping through all battlers
|
||||
if (ItemBattleEffects(ITEMEFFECT_BATTLER_MOVE_END, gActiveBattler, FALSE))
|
||||
return;
|
||||
|
||||
if (gBattlescriptCurrInstr[3])
|
||||
{
|
||||
gBattleMons[gActiveBattler].item = gBattleStruct->changedItems[gActiveBattler];
|
||||
gBattleStruct->changedItems[gActiveBattler] = ITEM_NONE;
|
||||
gBattleResources->flags->flags[gActiveBattler] &= ~(RESOURCE_FLAG_UNBURDEN);
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 4;
|
||||
return;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
@ -10262,7 +10349,7 @@ static void Cmd_weatherdamage(void)
|
||||
&& ability != ABILITY_SAND_RUSH
|
||||
&& ability != ABILITY_OVERCOAT
|
||||
&& !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
@ -10287,7 +10374,7 @@ static void Cmd_weatherdamage(void)
|
||||
&& ability != ABILITY_OVERCOAT
|
||||
&& ability != ABILITY_ICE_BODY
|
||||
&& !(gStatuses3[gBattlerAttacker] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
@ -11116,7 +11203,7 @@ static void Cmd_trysetperishsong(void)
|
||||
{
|
||||
if (gStatuses3[i] & STATUS3_PERISH_SONG
|
||||
|| GetBattlerAbility(i) == ABILITY_SOUNDPROOF
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i))
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i, TRUE))
|
||||
{
|
||||
notAffectedCount++;
|
||||
}
|
||||
@ -11664,7 +11751,7 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
|
||||
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
|
||||
&& gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
|
||||
#else
|
||||
if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED
|
||||
if (gBattleCommunication[MISS_TYPE] == B_MSG_PROTECTED
|
||||
|| gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE
|
||||
|| IsBattlerProtected(gBattlerTarget, gCurrentMove)
|
||||
|| DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
@ -12656,7 +12743,8 @@ static void Cmd_handleballthrow(void)
|
||||
{
|
||||
u32 odds;
|
||||
u8 catchRate;
|
||||
|
||||
|
||||
gLastThrownBall = gLastUsedItem;
|
||||
if (gLastUsedItem == ITEM_SAFARI_BALL)
|
||||
catchRate = gBattleStruct->safariCatchFactor * 1275 / 100;
|
||||
else
|
||||
|
@ -788,6 +788,17 @@ void HandleAction_SafariZoneBallThrow(void)
|
||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||
}
|
||||
|
||||
void HandleAction_ThrowBall(void)
|
||||
{
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||
gBattle_BG0_X = 0;
|
||||
gBattle_BG0_Y = 0;
|
||||
gLastUsedItem = gLastThrownBall;
|
||||
RemoveBagItem(gLastUsedItem, 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BallThrow;
|
||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||
}
|
||||
|
||||
void HandleAction_ThrowPokeblock(void)
|
||||
{
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||
@ -1746,6 +1757,21 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
|
||||
{
|
||||
gCurrentMove = move;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace;
|
||||
gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeks;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gActiveBattler;
|
||||
if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
@ -1829,6 +1855,8 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND)
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
|
||||
unusableMoves |= gBitTable[i];
|
||||
}
|
||||
return unusableMoves;
|
||||
}
|
||||
@ -2255,7 +2283,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_ELECTRIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
|
||||
@ -2265,7 +2293,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_MISTY_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_MistyTerrainEnds);
|
||||
@ -2287,7 +2315,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
break;
|
||||
case ENDTURN_PSYCHIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
|
||||
@ -3420,9 +3448,10 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
gBattlerAbility = gBattlerTarget;
|
||||
effect = 1;
|
||||
}
|
||||
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOOGLES);
|
||||
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_SAFETY_GOGGLES);
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
effect = 1;
|
||||
}
|
||||
|
||||
@ -3458,7 +3487,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
gBattleStruct->atkCancellerTracker++;
|
||||
break;
|
||||
case CANCELLER_PRANKSTER:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget, TRUE)
|
||||
&& !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE))
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)))
|
||||
@ -4637,7 +4666,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_MOVES_BLOCK: // 2
|
||||
if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND)
|
||||
if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(gBattleMoves[move].target & MOVE_TARGET_USER))
|
||||
|| (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC))
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)
|
||||
@ -5003,7 +5032,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
case ABILITY_EFFECT_SPORE:
|
||||
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GRASS)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_OVERCOAT
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOOGLES)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
{
|
||||
i = Random() % 3;
|
||||
if (i == 0)
|
||||
@ -5256,18 +5285,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_BATTLE_BOND:
|
||||
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
|
||||
&& gBattleResults.opponentFaintCounter != 0
|
||||
&& CalculateEnemyPartyCount() > 1)
|
||||
{
|
||||
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
|
||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
|
||||
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis
|
||||
@ -5749,6 +5766,8 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
|
||||
|
||||
if (gBattleMons[battlerId].hp == 0)
|
||||
return FALSE;
|
||||
if (gBattleScripting.overrideBerryRequirements)
|
||||
return TRUE;
|
||||
// Unnerve prevents consumption of opponents' berries.
|
||||
if (isBerry && IsUnnerveAbilityOnOpposingSide(battlerId))
|
||||
return FALSE;
|
||||
@ -5781,7 +5800,7 @@ static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2)
|
||||
gBattleMoveDamage *= 2;
|
||||
gBattlerAbility = battlerId;
|
||||
}
|
||||
|
||||
gBattleScripting.battler = battlerId;
|
||||
if (end2)
|
||||
{
|
||||
if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavorId) < 0)
|
||||
@ -5952,7 +5971,8 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
|
||||
|
||||
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
|
||||
{
|
||||
if (HasEnoughHpToEatBerry(battlerId, 2, itemId))
|
||||
if (HasEnoughHpToEatBerry(battlerId, 2, itemId)
|
||||
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP))
|
||||
{
|
||||
if (percentHeal)
|
||||
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
|
||||
@ -6579,11 +6599,14 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEMEFFECT_BATTLER_MOVE_END:
|
||||
goto DO_ITEMEFFECT_MOVE_END; // this hurts a bit to do, but is an easy solution
|
||||
case ITEMEFFECT_MOVE_END:
|
||||
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
||||
{
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||
DO_ITEMEFFECT_MOVE_END:
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_MICLE_BERRY:
|
||||
@ -6996,7 +7019,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
if (TARGET_TURN_DAMAGED
|
||||
&& (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
|
||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battlerId)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
&& gBattleMons[gBattlerAttacker].item == ITEM_NONE)
|
||||
@ -7767,12 +7790,27 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
basePower *= 2;
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_HIDDEN_POWER:
|
||||
{
|
||||
#if B_HIDDEN_POWER_DMG < GEN_6
|
||||
u8 powerBits;
|
||||
|
||||
powerBits = ((gBattleMons[gBattlerAttacker].hpIV & 2) >> 1)
|
||||
| ((gBattleMons[gBattlerAttacker].attackIV & 2) << 0)
|
||||
| ((gBattleMons[gBattlerAttacker].defenseIV & 2) << 1)
|
||||
| ((gBattleMons[gBattlerAttacker].speedIV & 2) << 2)
|
||||
| ((gBattleMons[gBattlerAttacker].spAttackIV & 2) << 3)
|
||||
| ((gBattleMons[gBattlerAttacker].spDefenseIV & 2) << 4);
|
||||
|
||||
basePower = (40 * powerBits) / 63 + 30;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case EFFECT_BEAT_UP:
|
||||
#if B_BEAT_UP_DMG >= GEN_5
|
||||
basePower = CalcBeatUpPower();
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// move-specific base power changes
|
||||
@ -8954,6 +8992,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
static const u16 species[][2] = // changed form id, default form id
|
||||
{
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
|
||||
@ -8966,11 +9005,10 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
};
|
||||
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted when switching out
|
||||
i = 1;
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
|
||||
i = 2;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
@ -9552,18 +9590,23 @@ void DoBurmyFormChange(u32 monId)
|
||||
}
|
||||
}
|
||||
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget)
|
||||
{
|
||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||
if (gProtectStructs[battlerPrankster].pranksterElevated
|
||||
&& GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef)
|
||||
&& !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark-types can block Prankster'd
|
||||
&& !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
if (!gProtectStructs[battlerPrankster].pranksterElevated)
|
||||
return FALSE;
|
||||
if (GetBattlerSide(battlerPrankster) == GetBattlerSide(battlerDef))
|
||||
return FALSE;
|
||||
if (checkTarget && (gBattleMoves[move].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)))
|
||||
return FALSE;
|
||||
if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK))
|
||||
return FALSE;
|
||||
if (gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Move Checks
|
||||
|
@ -1789,7 +1789,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 30,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3101,7 +3101,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_SOUND,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3205,7 +3205,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3753,7 +3753,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_HIDDEN_POWER] =
|
||||
{
|
||||
#if B_UPDATED_MOVE_DATA >= GEN_6
|
||||
#if B_HIDDEN_POWER_DMG >= GEN_6
|
||||
.power = 60,
|
||||
#else
|
||||
.power = 1,
|
||||
@ -3809,7 +3809,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -3823,7 +3823,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -4130,7 +4130,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -4773,7 +4773,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -5513,7 +5513,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -5670,7 +5670,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -6884,7 +6884,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 5,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = -7,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -7487,7 +7487,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
@ -7579,7 +7579,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
@ -8847,7 +8847,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -8941,7 +8941,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 25,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 1,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9092,7 +9092,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER | MOVE_TARGET_FOES_AND_ALLY,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9106,7 +9106,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9120,7 +9120,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9204,7 +9204,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9454,7 +9454,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -9974,7 +9974,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -10780,7 +10780,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
|
||||
[MOVE_STUFF_CHEEKS] =
|
||||
{
|
||||
.effect = EFFECT_DEFENSE_UP_2,
|
||||
.effect = EFFECT_STUFF_CHEEKS,
|
||||
.power = 0,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 0,
|
||||
@ -10857,7 +10857,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
@ -10913,7 +10913,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.accuracy = 100,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MIRROR_MOVE_AFFECTED,
|
||||
.split = SPLIT_STATUS,
|
||||
|
@ -936,42 +936,46 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId)
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
u32 CanThrowBall(void)
|
||||
{
|
||||
if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) // There are two present pokemon.
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
|
||||
{
|
||||
static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\nThere are two pokemon out there!\p");
|
||||
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, textCantThrowPokeBall, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage);
|
||||
return 1; // There are two present pokemon.
|
||||
}
|
||||
else if (gBattlerInMenuId == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)
|
||||
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) // Attempting to throw a ball with the second pokemon while both are alive.
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
|
||||
{
|
||||
static const u8 textCantThrowPokeBall[] = _("Cannot throw a ball!\p");
|
||||
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, textCantThrowPokeBall, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, textCantThrowPokeBall, Task_CloseBattlePyramidBagMessage);
|
||||
return 2; // No room for mon
|
||||
}
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon?
|
||||
|
||||
return 0; // usable
|
||||
}
|
||||
|
||||
static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two pokemon out there!\p");
|
||||
void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
{
|
||||
switch (CanThrowBall())
|
||||
{
|
||||
case 0: // usable
|
||||
default:
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
if (!InBattlePyramid())
|
||||
Task_FadeAndCloseBagMenu(taskId);
|
||||
else
|
||||
CloseBattlePyramidBag(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
case 1: // There are two present pokemon.
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
case 2: // No room for mon
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "berry_powder.h"
|
||||
#include "mevent.h"
|
||||
#include "union_room_chat.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
extern const u8 EventScript_ResetAllMapFlags[];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user