Merge branch 'battle_engine' into Photon_Geyser

This commit is contained in:
MissingNoL 2021-06-05 16:46:28 -07:00 committed by GitHub
commit 9cd522d254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 10967 additions and 8415 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6713,7 +6713,7 @@ Move_SEARING_SHOT:
launchtemplate gSearingShotEruptionRockTemplate 0x2 0x5 0x1 0x80 0x1e 0x19 0xffec
delay 0x2
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xa0 0x1e 0x19 0xffec
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 SOUND_PAN_ATTACKER 0x1e 0x19 0xffec
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xa0 0x1e 0x19 0xffec
delay 0x2
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xe0 0x1e 0x19 0xffec
delay 0xF
@ -6727,7 +6727,7 @@ Move_SEARING_SHOT:
launchtemplate gSearingShotEruptionRockTemplate 0x2 0x5 0x1 0x80 0x1e 0x19 0x0
delay 0x2
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xa0 0x1e 0x19 0x0
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 SOUND_PAN_ATTACKER 0x1e 0x19 0x0
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xa0 0x1e 0x19 0x0
delay 0x2
launchtemplate gSearingShotEruptionRockTemplate 0x42 0x5 0x1 0xe0 0x1e 0x19 0x0
delay 0x15
@ -9063,11 +9063,11 @@ Move_EERIE_IMPULSE::
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 16, 30, 0, 40, 0
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 16, 30, 0, 40, 1
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 16, 30, 0, 40, 0
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 16, 30, SOUND_PAN_ATTACKER, 40, 2
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 16, 30, 0, 40, 2
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 32, 30, 0, 40, 0
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 32, 30, 0, 40, 1
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 32, 30, 0, 40, 0
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 32, 30, SOUND_PAN_ATTACKER, 40, 2
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 32, 30, 0, 40, 2
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 48, 30, 0, 40, 0
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 48, 30, 0, 40, 1
launchtemplate gZapCannonSparkSpriteTemplate, ANIM_TARGET, 7, 10, 0, 48, 30, 0, 40, 0
@ -10966,11 +10966,11 @@ PollenPuffAlly:
monbg ANIM_TARGET
launchtemplate gPollenPuffPinkSparkleTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0xa0 0x28 0x0
launchtemplate gPollenPuffPinkSparkleTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x120 0x28 0x0
launchtemplate gPollenPuffPinkSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e SOUND_PAN_ATTACKER 0x28 0x0
launchtemplate gPollenPuffPinkSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x90 0x28 0x0
launchtemplate gPollenPuffPinkSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x110 0x28 0x0
launchtemplate gPollenPuffYellowSparkleTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0xa0 0x28 0x0
launchtemplate gPollenPuffYellowSparkleTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x120 0x28 0x0
launchtemplate gPollenPuffYellowSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e SOUND_PAN_ATTACKER 0x28 0x0
launchtemplate gPollenPuffYellowSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x90 0x28 0x0
launchtemplate gPollenPuffYellowSparkleTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x110 0x28 0x0
delay 0x1
launchtemplate gPollenPuffSporeTemplate 0x82 0x6 0xa 0x0 0x0 0x0 0x19 0xffe0
@ -13015,7 +13015,7 @@ Move_PHOTON_GEYSER::
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x0
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x40 0x28 0x1
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x80 0x28 0x0
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e SOUND_PAN_ATTACKER 0x28 0x2
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x2
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x20 0x28 0x0
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x60 0x28 0x1
launchtemplate gPhotonGeyserZapCannonSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0xa0 0x28 0x0
@ -13326,11 +13326,11 @@ Move_BOLT_BEAK::
call BoltBeakSparks
waitforvisualfinish
launchtask AnimTask_BlendColorCycle 0x2 0x6 0x3 0xffe1 0x1 0x0 0x0 0x5bff
launchtemplate gHorizontalLungeSpriteTemplate 0x2 0x2 0x4 0x4
createsprite gHorizontalLungeSpriteTemplate, 0x2, 0x2, 0x4, 0x4
delay 0x4
launchtemplate gHornHitSpriteTemplate 0x84 0x3 0x8 0x8 0xa
createsprite gHornHitSpriteTemplate, 0x84, 0x3, 0x8, 0x8, 0xa
waitforvisualfinish
launchtemplate gFlashingHitSplatSpriteTemplate 0x83 0x4 0x0 0x0 0x1 0x1
createsprite gFlashingHitSplatSpriteTemplate, 0x83, 0x4, 0x0, 0x0, 0x1, 0x1
playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET
launchtask AnimTask_ShakeMon 0x2 0x5 0x1 0x3 0x0 0x6 0x1
waitforvisualfinish
@ -13340,32 +13340,32 @@ Move_BOLT_BEAK::
end
BoltBeakSparks:
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
launchtemplate gSparkElectricitySpriteTemplate 0x0 0x7 0x20 0x18 0xbe 0xc 0x0 0x1 0x0
createsprite gSparkElectricitySpriteTemplate, 0x0, 0x7, 0x20, 0x18, 0xbe, 0xc, 0x0, 0x1, 0x0
delay 0x0
launchtemplate gBoltBeakBlueSparkTemplate 0x0 0x7 0x50 0x18 0x16 0xc 0x0 0x1 0x0
launchtemplate gSparkElectricitySpriteTemplate 0x0 0x7 0x9c 0x18 0x79 0xd 0x0 0x1 0x1
createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0x50, 0x18, 0x16, 0xc, 0x0, 0x1, 0x0
createsprite gSparkElectricitySpriteTemplate, 0x0, 0x7, 0x9c, 0x18, 0x79, 0xd, 0x0, 0x1, 0x1
delay 0x0
launchtask AnimTask_BlendColorCycle 0x2 0x6 0x3 0xffe1 0x1 0x0 0x0 0x5bff
delay 0xa
launchtask AnimTask_BlendColorCycle 0x2 0x6 0x3 0xffe1 0x1 0x5 0x5 0x5bff
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
launchtemplate gBoltBeakBlueSparkTemplate 0x0 0x7 0x64 0x18 0x3c 0xa 0x0 0x1 0x0
launchtemplate gSparkElectricitySpriteTemplate 0x0 0x7 0xaa 0x18 0x2a 0xb 0x0 0x1 0x1
createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0x64, 0x18, 0x3c, 0xa, 0x0, 0x1, 0x0
createsprite gSparkElectricitySpriteTemplate, 0x0, 0x7, 0xaa, 0x18, 0x2a, 0xb, 0x0, 0x1, 0x1
delay 0x0
launchtemplate gBoltBeakBlueSparkTemplate 0x0 0x7 0xee 0x18 0xa5 0xa 0x0 0x1 0x1
createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0xee, 0x18, 0xa5, 0xa, 0x0, 0x1, 0x1
delay 0x0
launchtask AnimTask_BlendColorCycle 0x2 0x6 0x3 0xffe1 0x1 0x0 0x0 0x76E1
delay 0x14
launchtask AnimTask_BlendColorCycle 0x2 0x6 0x3 0xffe1 0x1 0x4 0x4 0x76E1
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
launchtemplate gSparkElectricityFlashingSpriteTemplate 0x4 0x8 0x0 0x0 0x20 0xc 0x0 0x14 0x0 0x0
launchtemplate gBoltBeakBlueFlashingSparkTemplate 0x4 0x8 0x0 0x0 0x20 0xc 0x40 0x14 0x1 0x0
launchtemplate gSparkElectricityFlashingSpriteTemplate 0x4 0x8 0x0 0x0 0x20 0xc 0x80 0x14 0x0 0x0
launchtemplate gBoltBeakBlueFlashingSparkTemplate 0x4 0x8 0x0 0x0 0x20 0xc SOUND_PAN_ATTACKER 0x14 0x2 0x0
launchtemplate gSparkElectricityFlashingSpriteTemplate 0x4 0x8 0x0 0x0 0x10 0xc 0x20 0x14 0x0 0x0
launchtemplate gBoltBeakBlueFlashingSparkTemplate 0x4 0x8 0x0 0x0 0x10 0xc 0x60 0x14 0x1 0x0
launchtemplate gSparkElectricityFlashingSpriteTemplate 0x4 0x8 0x0 0x0 0x10 0xc 0xa0 0x14 0x0 0x0
launchtemplate gBoltBeakBlueFlashingSparkTemplate 0x4 0x8 0x0 0x0 0x10 0xc 0xe0 0x14 0x2 0x0
createsprite gSparkElectricityFlashingSpriteTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x0, 0x14, 0x0, 0x0
createsprite gBoltBeakBlueFlashingSparkTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x40, 0x14, 0x1, 0x0
createsprite gSparkElectricityFlashingSpriteTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x80, 0x14, 0x0, 0x0
createsprite gBoltBeakBlueFlashingSparkTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x0, 0x14, 0x2, 0x0
createsprite gSparkElectricityFlashingSpriteTemplate, 0x4, 0x8, 0x0, 0x0, 0x10, 0xc, 0x20, 0x14, 0x0, 0x0
createsprite gBoltBeakBlueFlashingSparkTemplate, 0x4, 0x8, 0x0, 0x0, 0x10, 0xc, 0x60, 0x14, 0x1, 0x0
createsprite gSparkElectricityFlashingSpriteTemplate, 0x4, 0x8, 0x0, 0x0, 0x10, 0xc, 0xa0, 0x14, 0x0, 0x0
createsprite gBoltBeakBlueFlashingSparkTemplate, 0x4, 0x8, 0x0, 0x0, 0x10, 0xc, 0xe0, 0x14, 0x2, 0x0
delay 0x4
return

View File

@ -369,6 +369,10 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectSleepHit
.4byte BattleScript_EffectPhotonGeyser
.4byte BattleScript_EffectShellSideArm
.4byte BattleScript_EffectAttackerDefenseDownHit
.4byte BattleScript_EffectBodyPress
.4byte BattleScript_EffectPhotonGeyser
.4byte BattleScript_EffectShellSideArm
BattleScript_EffectShellSideArm:
shellsidearmcheck
@ -377,6 +381,9 @@ BattleScript_EffectShellSideArm:
BattleScript_EffectPhotonGeyser:
photongeysercheck
BattleScript_EffectAttackerDefenseDownHit:
setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectSleepHit:
@ -893,10 +900,11 @@ BattleScript_EffectFlameBurst:
BattleScript_MoveEffectFlameBurst::
tryfaintmon BS_TARGET, FALSE, NULL
copybyte sBATTLER, sSAVED_BATTLER
printstring STRINGID_BURSTINGFLAMESHIT
waitmessage B_WAIT_TIME_LONG
savetarget
copybyte gBattlerTarget, sBATTLER
copybyte gBattlerTarget, sSAVED_BATTLER
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
tryfaintmon BS_TARGET, FALSE, NULL
@ -2062,6 +2070,7 @@ BattleScript_EffectChangeTypeOnItem:
BattleScript_EffectFusionCombo:
BattleScript_EffectRevelationDance:
BattleScript_EffectBelch:
BattleScript_EffectBodyPress:
BattleScript_HitFromAtkCanceler::
attackcanceler
@ -4200,6 +4209,15 @@ BattleScript_NotAffected::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_NotAffectedAbilityPopUp::
copybyte gBattlerAbility, gBattlerTarget
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
resultmessage
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectUproar::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -7414,6 +7432,18 @@ BattleScript_AbilityCuredStatus::
updatestatusicon BS_SCRIPTING
return
BattleScript_BattlerShookOffTaunt::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSHOOKOFFTHETAUNT
waitmessage B_WAIT_TIME_LONG
return
BattleScript_BattlerGotOverItsInfatuation::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNGOTOVERITSINFATUATION
waitmessage B_WAIT_TIME_LONG
return
BattleScript_IgnoresWhileAsleep::
printstring STRINGID_PKMNIGNORESASLEEP
waitmessage B_WAIT_TIME_LONG

View File

@ -239,8 +239,35 @@ struct AI_SavedBattleMon
u16 species;
};
struct AiLogicData
{
//attacker data
u16 atkAbility;
u16 atkItem;
u16 atkHoldEffect;
u8 atkParam;
u16 atkSpecies;
// target data
u16 defAbility;
u16 defItem;
u16 defHoldEffect;
u8 defParam;
u16 defSpecies;
// attacker partner data
u8 battlerAtkPartner;
u16 partnerMove;
u16 atkPartnerAbility;
u16 atkPartnerHoldEffect;
bool32 targetSameSide;
// target partner data
u8 battlerDefPartner;
u16 defPartnerAbility;
u16 defPartnerHoldEffect;
};
struct AI_ThinkingStruct
{
struct AiLogicData data;
u8 aiState;
u8 movesetIndex;
u16 moveConsidered;
@ -293,11 +320,14 @@ struct BattleResources
struct StatsArray* beforeLvlUp;
struct AI_ThinkingStruct *ai;
struct BattleHistory *battleHistory;
struct BattleScriptsStack *AI_ScriptsStack;
u8 bufferA[MAX_BATTLERS_COUNT][0x200];
u8 bufferB[MAX_BATTLERS_COUNT][0x200];
};
#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(gBattleResources->ai))
#define AI_DATA ((struct AiLogicData *)(&gBattleResources->ai->data))
#define BATTLE_HISTORY ((struct BattleHistory *)(gBattleResources->battleHistory))
struct BattleResults
{
u8 playerFaintCounter; // 0x0

30
include/battle_ai_main.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef GUARD_BATTLE_AI_MAIN_H
#define GUARD_BATTLE_AI_MAIN_H
// return values for BattleAI_ChooseMoveOrAction
// 0 - 3 are move idx
#define AI_CHOICE_FLEE 4
#define AI_CHOICE_WATCH 5
#define AI_CHOICE_SWITCH 7
#define RETURN_SCORE_PLUS(val) \
{ \
score += val; \
return score; \
}
#define RETURN_SCORE_MINUS(val) \
{ \
score -= val; \
return score; \
}
void BattleAI_SetupItems(void);
void BattleAI_SetupFlags(void);
void BattleAI_SetupAIData(u8 defaultScoreMoves);
u8 BattleAI_ChooseMoveOrAction(void);
extern u8 sBattler_AI;
#endif // GUARD_BATTLE_AI_MAIN_H

View File

@ -1,27 +0,0 @@
#ifndef GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
#define GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
// return values for BattleAI_ChooseMoveOrAction
// 0 - 3 are move idx
#define AI_CHOICE_FLEE 4
#define AI_CHOICE_WATCH 5
#define AI_CHOICE_SWITCH 7
s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef);
s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon);
u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
void BattleAI_SetupItems(void);
void BattleAI_SetupFlags(void);
void BattleAI_SetupAIData(u8 defaultScoreMoves);
u8 BattleAI_ChooseMoveOrAction(void);
bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler);
bool32 IsBattlerAIControlled(u32 battlerId);
void ClearBattlerMoveHistory(u8 battlerId);
void RecordLastUsedMoveBy(u32 battlerId, u32 move);
void RecordKnownMove(u8 battlerId, u32 move);
void RecordAbilityBattle(u8 battlerId, u16 abilityId);
void ClearBattlerAbilityHistory(u8 battlerId);
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect);
void ClearBattlerItemEffectHistory(u8 battlerId);
#endif // GUARD_BATTLE_AI_SCRIPT_COMMANDS_H

View File

@ -34,5 +34,6 @@ enum {
void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId);
void AI_TrySwitchOrUseItem(void);
u8 GetMostSuitableMonToSwitchInto(void);
bool32 ShouldSwitch(void);
#endif // GUARD_BATTLE_AI_SWITCH_ITEMS_H

168
include/battle_ai_util.h Normal file
View File

@ -0,0 +1,168 @@
#ifndef GUARD_BATTLE_AI_UTIL_H
#define GUARD_BATTLE_AI_UTIL_H
// for IsAiFaster
#define AI_CHECK_FASTER 0 // if_user_faster
#define AI_CHECK_SLOWER 1 // if_target_faster
#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE)
bool32 AI_RandLessThan(u8 val);
void RecordLastUsedMoveByTarget(void);
bool32 IsBattlerAIControlled(u32 battlerId);
void ClearBattlerMoveHistory(u8 battlerId);
void RecordLastUsedMoveBy(u32 battlerId, u32 move);
void RecordKnownMove(u8 battlerId, u32 move);
void RecordAbilityBattle(u8 battlerId, u16 abilityId);
void ClearBattlerAbilityHistory(u8 battlerId);
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect);
void ClearBattlerItemEffectHistory(u8 battlerId);
void SaveBattlerData(u8 battlerId);
void SetBattlerData(u8 battlerId);
void RestoreBattlerData(u8 battlerId);
u32 GetTotalBaseStat(u32 species);
bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler);
bool32 AtMaxHp(u8 battler);
u32 GetHealthPercentage(u8 battler);
bool32 IsBattlerTrapped(u8 battler, bool8 switching);
bool32 IsAiFaster(u8 battler);
bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk);
bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits);
bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgMod);
s32 AI_GetAbility(u32 battlerId);
u16 AI_GetHoldEffect(u32 battlerId);
u32 AI_GetMoveAccuracy(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u8 atkHoldEffect, u8 defHoldEffect, u16 move);
bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move);
bool32 AI_WeatherHasEffect(void);
bool32 CanAttackerFaintTarget(u8 battlerAtk, u8 battlerDef, u8 index, u8 numHits);
bool32 AI_IsBattlerGrounded(u8 battlerId);
bool32 HasDamagingMove(u8 battlerId);
bool32 HasDamagingMoveOfType(u8 battlerId, u8 type);
u32 GetBattlerSecondaryDamage(u8 battlerId);
bool32 BattlerWillFaintFromWeather(u8 battler, u16 ability);
bool32 BattlerWillFaintFromSecondaryDamage(u8 battler, u16 ability);
bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u32 accuracy, u16 move);
bool32 ShouldUseRecoilMove(u8 battlerAtk, u8 battlerDef, u32 recoilDmg, u8 moveIndex);
u16 GetBattlerSideSpeedAverage(u8 battler);
bool32 ShouldAbsorb(u8 battlerAtk, u8 battlerDef, u16 move, s32 damage);
bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent);
bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect);
bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 moveIndex);
bool32 IsRecycleEncouragedItem(u16 item);
bool32 CanKnockOffItem(u8 battler, u16 item);
bool32 IsAbilityOfRating(u16 ability, s8 rating);
s8 GetAbilityRating(u16 ability);
// stat stage checks
bool32 AnyStatIsRaised(u8 battlerId);
bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat);
bool32 BattlerStatCanRise(u8 battler, u16 battlerAbility, u8 stat);
bool32 AreBattlersStatsMaxed(u8 battler);
bool32 BattlerHasAnyStatRaised(u8 battlerId);
u32 CountPositiveStatStages(u8 battlerId);
u32 CountNegativeStatStages(u8 battlerId);
bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility);
bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility);
// move checks
bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect);
bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split);
s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef);
u8 GetMoveDamageResult(u16 move);
u32 GetCurrDamageHpPercent(u8 battlerAtk, u8 battlerDef);
u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
u8 AI_GetMoveEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
u16 *GetMovesArray(u32 battler);
bool32 IsConfusionMoveEffect(u16 moveEffect);
bool32 HasMove(u32 battlerId, u32 move);
bool32 HasOnlyMovesWithSplit(u32 battlerId, u32 split, bool32 onlyOffensive);
bool32 HasMoveWithSplit(u32 battler, u32 split);
bool32 HasMoveWithType(u32 battler, u8 type);
bool32 HasMoveWithTypeAndSplit(u32 battler, u8 type, u8 split);
bool32 HasMoveEffect(u32 battlerId, u16 moveEffect);
bool32 HasMoveWithLowAccuracy(u8, u8, u8, bool32, u16, u16, u16, u16);
bool32 TestMoveFlagsInMoveset(u8 battler, u32 flags);
bool32 IsAromaVeilProtectedMove(u16 move);
bool32 IsNonVolatileStatusMoveEffect(u16 moveEffect);
bool32 IsStatLoweringMoveEffect(u16 moveEffect);
bool32 IsMoveRedirectionPrevented(u16 move, u16 atkAbility);
bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move);
bool32 IsHazardMoveEffect(u16 moveEffect);
bool32 MoveCallsOtherMove(u16 move);
bool32 MoveRequiresRecharging(u16 move);
bool32 IsInstructBannedMove(u16 move);
bool32 IsEncoreEncouragedEffect(u16 moveEffect);
void ProtectChecks(u8 battlerAtk, u8 battlerDef, u16 move, u16 predictedMove, s16 *score);
bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect);
bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect);
bool32 ShouldSetRain(u8 battlerAtk, u16 ability, u16 holdEffect);
bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect);
bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef);
bool32 IsHealingMoveEffect(u16 effect);
bool32 HasHealingEffect(u32 battler);
bool32 IsTrappingMoveEffect(u16 effect);
bool32 HasTrappingMoveEffect(u8 battler);
bool32 ShouldFakeOut(u8 battlerAtk, u8 battlerDef, u16 move);
bool32 HasThawingMove(u8 battlerId);
bool32 IsStatRaisingEffect(u16 effect);
bool32 IsStatLoweringEffect(u16 effect);
bool32 IsStatRaisingEffect(u16 effect);
bool32 IsAttackBoostMoveEffect(u16 effect);
bool32 IsUngroundingEffect(u16 effect);
bool32 IsSemiInvulnerable(u8 battlerDef, u16 move);
// status checks
bool32 CanBeBurned(u8 battler, u16 ability);
bool32 CanBePoisoned(u8 battler, u16 ability);
bool32 CanBeConfused(u8 battler, u16 ability);
bool32 CanSleep(u8 battler, u16 ability);
bool32 IsBattlerIncapacitated(u8 battler, u16 ability);
bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
bool32 ShouldPoisonSelf(u8 battler, u16 ability);
bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove);
bool32 ShouldBurnSelf(u8 battler, u16 ability);
bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove);
bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 atkGender, u8 defGender);
bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof);
u32 ShouldTryToFlinch(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move);
bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move);
bool32 IsWakeupTurn(u8 battler);
// partner logic
u16 GetAllyChosenMove(void);
bool32 IsValidDoubleBattle(u8 battlerAtk);
bool32 IsTargetingPartner(u8 battlerAtk, u8 battlerDef);
bool32 DoesPartnerHaveSameMoveEffect(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove);
bool32 PartnerHasSameMoveEffectWithoutTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove);
bool32 PartnerMoveEffectIsStatusSameTarget(u8 battlerAtkPartner, u8 battlerDef, u16 partnerMove);
bool32 PartnerMoveEffectIsWeather(u8 battlerAtkPartner, u16 partnerMove);
bool32 PartnerMoveEffectIsTerrain(u8 battlerAtkPartner, u16 partnerMove);
bool32 PartnerMoveIs(u8 battlerAtkPartner, u16 partnerMove, u16 moveCheck);
bool32 PartnerMoveIsSameAsAttacker(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove);
bool32 PartnerMoveIsSameNoTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove);
bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move);
// party logic
s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon);
s32 CountUsablePartyMons(u8 battlerId);
bool32 IsPartyFullyHealedExceptBattler(u8 battler);
bool32 PartyHasMoveSplit(u8 battlerId, u8 split);
bool32 SideHasMoveSplit(u8 battlerId, u8 split);
// score increases
void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score);
void IncreasePoisonScore(u8 battlerAtk, u8 battlerdef, u16 move, s16 *score);
void IncreaseBurnScore(u8 battlerAtk, u8 battlerdef, u16 move, s16 *score);
void IncreaseParalyzeScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
void IncreaseSleepScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
void IncreaseConfusionScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
#endif //GUARD_BATTLE_AI_UTIL_H

View File

@ -6,6 +6,12 @@
#define WINDOW_CLEAR 0x1
#define WINDOW_x80 0x80
struct StatFractions
{
u8 dividend;
u8 divisor;
};
s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility);
u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move);
u8 GetBattlerTurnOrderNum(u8 battlerId);
@ -27,8 +33,11 @@ u32 IsLeafGuardProtected(u32 battler);
bool32 IsShieldsDownProtected(u32 battler);
u32 IsAbilityStatusProtected(u32 battler);
bool32 TryResetBattlerStatChanges(u8 battler);
bool32 CanCamouflage(u8 battlerId);
u16 GetNaturePowerMove(void);
extern void (* const gBattleScriptingCommandsTable[])(void);
extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];
extern const struct StatFractions gAccuracyStageRatios[];
#endif // GUARD_BATTLE_SCRIPT_COMMANDS_H

View File

@ -367,5 +367,8 @@ extern const u8 BattleScript_CustapBerryActivation[];
extern const u8 BattleScript_MicleBerryActivateEnd2[];
extern const u8 BattleScript_MicleBerryActivateRet[];
extern const u8 BattleScript_JabocaRowapBerryActivates[];
extern const u8 BattleScript_NotAffectedAbilityPopUp[];
extern const u8 BattleScript_BattlerShookOffTaunt[];
extern const u8 BattleScript_BattlerGotOverItsInfatuation[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -131,6 +131,21 @@ void ClearIllusionMon(u32 battlerId);
bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId);
bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
u8 GetBattleMoveSplit(u32 moveId);
bool32 TestMoveFlags(u16 move, u32 flag);
struct Pokemon *GetBattlerPartyData(u8 battlerId);
bool32 CanFling(u8 battlerId);
bool32 IsTelekinesisBannedSpecies(u16 species);
bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
bool32 IsThawingMove(u8 battlerId, u16 move);
bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId);
// ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
bool32 IsRolePlayBannedAbility(u16 ability);
bool32 IsSkillSwapBannedAbility(u16 ability);
bool32 IsWorrySeedBannedAbility(u16 ability);
bool32 IsGastroAcidBannedAbility(u16 ability);
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
#endif // GUARD_BATTLE_UTIL_H

View File

@ -220,6 +220,9 @@
#define SIDE_STATUS_CRAFTY_SHIELD (1 << 20)
#define SIDE_STATUS_MAT_BLOCK (1 << 21)
#define SIDE_STATUS_HAZARDS_ANY (SIDE_STATUS_SPIKES | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_STEALTH_ROCK)
#define SIDE_STATUS_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)
// Field affecting statuses.
#define STATUS_FIELD_MAGIC_ROOM (1 << 0)
#define STATUS_FIELD_TRICK_ROOM (1 << 1)

View File

@ -35,20 +35,29 @@
#define MOVE_POWER_GOOD 2 // Similar dmg range with best.
#define MOVE_POWER_WEAK 3 // Significantly lower than best and good.
// script's table id to bit
#define AI_SCRIPT_CHECK_BAD_MOVE (1 << 0)
#define AI_SCRIPT_TRY_TO_FAINT (1 << 1)
#define AI_SCRIPT_CHECK_VIABILITY (1 << 2)
#define AI_SCRIPT_SETUP_FIRST_TURN (1 << 3)
#define AI_SCRIPT_RISKY (1 << 4)
#define AI_SCRIPT_PREFER_STRONGEST_MOVE (1 << 5)
#define AI_SCRIPT_PREFER_BATON_PASS (1 << 6)
#define AI_SCRIPT_DOUBLE_BATTLE (1 << 7)
#define AI_SCRIPT_HP_AWARE (1 << 8)
#define AI_SCRIPT_UNKNOWN (1 << 9)
// 10 - 28 are not used
#define AI_SCRIPT_ROAMING (1 << 29)
#define AI_SCRIPT_SAFARI (1 << 30)
#define AI_SCRIPT_FIRST_BATTLE (1 << 31)
// AI Flags. Most run specific functions to update score, new flags are used for internal logic in other scripts
#define AI_FLAG_CHECK_BAD_MOVE (1 << 0)
#define AI_FLAG_TRY_TO_FAINT (1 << 1)
#define AI_FLAG_CHECK_VIABILITY (1 << 2)
#define AI_FLAG_SETUP_FIRST_TURN (1 << 3)
#define AI_FLAG_RISKY (1 << 4)
#define AI_FLAG_PREFER_STRONGEST_MOVE (1 << 5)
#define AI_FLAG_PREFER_BATON_PASS (1 << 6)
#define AI_FLAG_DOUBLE_BATTLE (1 << 7) // removed, split between AI_FLAG_CHECK_BAD_MOVE & AI_FLAG_CHECK_GOOD_MOVE
#define AI_FLAG_HP_AWARE (1 << 8)
// New, Trainer Handicap Flags
#define AI_FLAG_NEGATE_UNAWARE (1 << 9) // AI is NOT aware of negating effects like wonder room, mold breaker, etc
#define AI_FLAG_WILL_SUICIDE (1 << 10) // AI will use explosion / self destruct / final gambit / etc
// New, Trainer Strategy Flags
#define AI_FLAG_HELP_PARTNER (1 << 11) // AI can try to help partner. If not set, will tend not to target partner
#define AI_FLAG_PREFER_STATUS_MOVES (1 << 12) // AI gets a score bonus for status moves. Should be combined with AI_FLAG_CHECK_BAD_MOVE to prevent using only status moves
#define AI_FLAG_STALL (1 << 13) // AI stalls battle and prefers secondary damage/trapping/etc. TODO not finished
#define AI_FLAG_SCREENER (1 << 14) // AI prefers screening effects like reflect, mist, etc. TODO unfinished
#define AI_FLAG_SMART_SWITCHING (1 << 15) // AI includes a lot more switching checks
// 'other' ai logic flags
#define AI_FLAG_ROAMING (1 << 29)
#define AI_FLAG_SAFARI (1 << 30)
#define AI_FLAG_FIRST_BATTLE (1 << 31)
#endif // GUARD_CONSTANTS_BATTLE_AI_H

View File

@ -76,59 +76,59 @@
#endif
// Calculation settings
#define B_CRIT_CHANCE GEN_6 // Chances of a critical hit landing. See CalcCritChanceStage.
#define B_CRIT_MULTIPLIER GEN_6 // In Gen6+, critical hits multiply damage by 1.5 instead of 2.
#define B_EXP_CATCH GEN_6 // In Gen6+, Pokémon get experience from catching.
#define B_TRAINER_EXP_MULTIPLIER GEN_6 // In Gen7+, trainer battles no longer give a 1.5 multiplier to exp gain.
#define B_SPLIT_EXP GEN_5 // In Gen6+, all participating mon get full experience.
#define B_SCALED_EXP GEN_6 // In Gen5 and Gen7+, experience is weighted by level difference.
#define B_BURN_DAMAGE GEN_6 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
#define B_PARALYSIS_SPEED GEN_6 // In Gen7+, speed is decreased by 50% instead of 75%.
#define B_TERRAIN_TYPE_BOOST GEN_6 // In Gen8+, damage is boosted by 30% instead of 50%.
#define B_BINDING_DAMAGE GEN_6 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
#define B_CONFUSION_SELF_DMG_CHANCE GEN_6 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%.
#define B_MULTI_HIT_CHANCE GEN_6 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
#define B_RECOIL_IF_MISS_DMG GEN_6 // In Gen5+, Jump Kick and Hi Jump Kick will always do half of the user's max HP when missing.
#define B_PSYWAVE_DMG GEN_6 // Psywave's damage formula. See Cmd_psywavedamageeffect.
#define B_BADGE_BOOST GEN_6 // In Gen4+, Gym Badges no longer boost a Pokémon's stats
#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage.
#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2.
#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching.
#define B_TRAINER_EXP_MULTIPLIER GEN_7 // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain.
#define B_SPLIT_EXP GEN_7 // In Gen6+, all participating mon get full experience.
#define B_SCALED_EXP GEN_7 // In Gen5 and Gen7+, experience is weighted by level difference.
#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%.
#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%.
#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%.
#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing.
#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect.
#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats.
// Move data settings
#define B_UPDATED_MOVE_DATA GEN_7 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.
#define B_PHYSICAL_SPECIAL_SPLIT GEN_6 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this.
#define B_FELL_STINGER_STAT_RAISE GEN_6 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint.
#define B_KINGS_SHIELD_LOWER_ATK GEN_6 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.
#define B_PHYSICAL_SPECIAL_SPLIT GEN_7 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this.
#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint.
#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage.
#define B_WATER_SHURIKEN_SPLIT GEN_8 // In Gen7, Water Shuriken was changed from Physical to Special.
// Other move settings
#define B_SOUND_SUBSTITUTE GEN_6 // In Gen6+, sound moves bypass Substitute.
#define B_TOXIC_NEVER_MISS GEN_6 // In Gen6+, if Toxic is used by a Poison type, it will never miss.
#define B_PAYBACK_SWITCH_BOOST GEN_6 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
#define B_BINDING_TURNS GEN_6 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.)
#define B_UPROAR_TURNS GEN_6 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns.
#define B_DISABLE_TURNS GEN_6 // Disable's turns. See Cmd_disablelastusedattack.
#define B_INCINERATE_GEMS GEN_6 // In Gen6+, Incinerate can destroy Gems.
#define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
#define B_PP_REDUCED_BY_SPITE GEN_6 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5.
#define B_CAN_SPITE_FAIL GEN_6 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP.
#define B_CRASH_IF_TARGET_IMMUNE GEN_6 // In Gen4+, The user of Jump Kick or Hi Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
#define B_TAILWIND_TIMER GEN_5 // In Gen5+, Tailwind lasts 4 turns instead of 3.
#define B_MEMENTO_FAIL GEN_4 // 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_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute.
#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss.
#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.)
#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns.
#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack.
#define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems.
#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
#define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5.
#define B_CAN_SPITE_FAIL GEN_7 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP.
#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
#define B_TAILWIND_TIMER GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3.
#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6.
// Ability settings
#define B_ABILITY_WEATHER GEN_6 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move.
#define B_GALE_WINGS GEN_6 // In Gen7+ requires full HP to trigger.
#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.
#define B_GHOSTS_ESCAPE GEN_6 // In Gen6+, ghosts can escape even when blocked by abilities such as Shadow Tag.
#define B_MOODY_ACC_EVASION GEN_6 // In Gen8+, Moody CANNOT raise Accuray and Evasion any more.
#define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before.
#define B_SYNCHRONIZE_NATURE GEN_6 // In Gen8+, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag.
#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore.
#define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before.
#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities.
// Item settings
#define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end.
#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end.
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
#define B_MENTAL_HERB GEN_5 // In Gen5+, mental herb cures Taunt, Encore, Heal Block, and Disable
// Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
@ -153,10 +153,10 @@
// Other
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
#define B_SLEEP_TURNS GEN_6 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
#define B_PARALYZE_ELECTRIC GEN_6 // In Gen6+, Electric-type Pokémon can't be paralyzed.
#define B_POWDER_GRASS GEN_6 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves.
#define B_STEEL_RESISTANCES GEN_6 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark and Ghost moves.
#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed.
#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves.
#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves.
#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8.
// Animation Settings
@ -176,8 +176,8 @@
#define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette.
#define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette.
#define B_HIDE_HEALTHBOXES_DURING_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
#define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#define B_HIDE_HEALTHBOXES_DURING_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
#define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H

View File

@ -351,9 +351,11 @@
#define EFFECT_FAIRY_LOCK 345
#define EFFECT_ALLY_SWITCH 346
#define EFFECT_SLEEP_HIT 347 // Relic Song
#define EFFECT_PHOTON_GEYSER 348
#define EFFECT_SHELL_SIDE_ARM 349
#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348
#define EFFECT_BODY_PRESS 349
#define EFFECT_PHOTON_GEYSER 350
#define EFFECT_SHELL_SIDE_ARM 351
#define NUM_BATTLE_MOVE_EFFECTS 350
#define NUM_BATTLE_MOVE_EFFECTS 352
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -568,8 +568,10 @@
#define STRINGID_CURIOUSMEDICINEENTERS 564
#define STRINGID_CANACTFASTERTHANKSTO 565
#define STRINGID_MICLEBERRYACTIVATES 566
#define BATTLESTRINGS_COUNT 567
#define STRINGID_PKMNSHOOKOFFTHETAUNT 567
#define STRINGID_PKMNGOTOVERITSINFATUATION 568
#define BATTLESTRINGS_COUNT 569
// The below IDs are all indexes into battle message tables,
// used to determine which of a set of messages to print.

View File

@ -110,37 +110,46 @@
#define HOLD_EFFECT_ROWAP_BERRY 104
#define HOLD_EFFECT_KEE_BERRY 105
#define HOLD_EFFECT_MARANGA_BERRY 106
#define HOLD_EFFECT_PLATE 107
// Gen5 hold effects
#define HOLD_EFFECT_FLOAT_STONE 115
#define HOLD_EFFECT_EVIOLITE 116
#define HOLD_EFFECT_ASSAULT_VEST 117
#define HOLD_EFFECT_DRIVE 118
#define HOLD_EFFECT_GEMS 119
#define HOLD_EFFECT_ROCKY_HELMET 120
#define HOLD_EFFECT_AIR_BALLOON 121
#define HOLD_EFFECT_RED_CARD 122
#define HOLD_EFFECT_RING_TARGET 123
#define HOLD_EFFECT_BINDING_BAND 124
#define HOLD_EFFECT_EJECT_BUTTON 125
#define HOLD_EFFECT_ABSORB_BULB 126
#define HOLD_EFFECT_CELL_BATTERY 127
#define HOLD_EFFECT_FLOAT_STONE 117
#define HOLD_EFFECT_EVIOLITE 118
#define HOLD_EFFECT_ASSAULT_VEST 119
#define HOLD_EFFECT_DRIVE 120
#define HOLD_EFFECT_GEMS 121
#define HOLD_EFFECT_ROCKY_HELMET 122
#define HOLD_EFFECT_AIR_BALLOON 123
#define HOLD_EFFECT_RED_CARD 124
#define HOLD_EFFECT_RING_TARGET 125
#define HOLD_EFFECT_BINDING_BAND 126
#define HOLD_EFFECT_EJECT_BUTTON 127
#define HOLD_EFFECT_ABSORB_BULB 128
#define HOLD_EFFECT_CELL_BATTERY 129
// Gen6 hold effects
#define HOLD_EFFECT_FAIRY_POWER 129
#define HOLD_EFFECT_MEGA_STONE 130
#define HOLD_EFFECT_SAFETY_GOOGLES 131
#define HOLD_EFFECT_LUMINOUS_MOSS 132
#define HOLD_EFFECT_SNOWBALL 133
#define HOLD_EFFECT_WEAKNESS_POLICY 134
#define HOLD_EFFECT_FAIRY_POWER 139
#define HOLD_EFFECT_MEGA_STONE 140
#define HOLD_EFFECT_SAFETY_GOOGLES 141
#define HOLD_EFFECT_LUMINOUS_MOSS 142
#define HOLD_EFFECT_SNOWBALL 143
#define HOLD_EFFECT_WEAKNESS_POLICY 144
// Gen7 hold effects
#define HOLD_EFFECT_PROTECTIVE_PADS 149
#define HOLD_EFFECT_TERRAIN_EXTENDER 150
#define HOLD_EFFECT_SEEDS 151
#define HOLD_EFFECT_ADRENALINE_ORB 152
#define HOLD_EFFECT_MEMORY 153
#define HOLD_EFFECT_PLATE 154
#define HOLD_EFFECT_PROTECTIVE_PADS 154
#define HOLD_EFFECT_TERRAIN_EXTENDER 155
#define HOLD_EFFECT_SEEDS 156
#define HOLD_EFFECT_ADRENALINE_ORB 157
#define HOLD_EFFECT_MEMORY 158
#define HOLD_EFFECT_Z_CRYSTAL 159
// Gen8 hold effects
#define HOLD_EFFECT_UTILITY_UMBRELLA 169
#define HOLD_EFFECT_EJECT_PACK 170
#define HOLD_EFFECT_ROOM_SERVICE 171
#define HOLD_EFFECT_BLUNDER_POLICY 172
#define HOLD_EFFECT_HEAVY_DUTY_BOOTS 173
#define HOLD_EFFECT_THROAT_SPRAY 174
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))

View File

@ -312,9 +312,9 @@
#define FLAG_POWDER (1 << 19)
#define FLAG_TARGET_ABILITY_IGNORED (1 << 20)
#define FLAG_DANCE (1 << 21)
#define FLAG_DMG_IN_AIR (1 << 22) // X2 dmg on air, always hits target on air
#define FLAG_HIT_IN_AIR (1 << 23) // dmg is normal, always hits target on air
#define FLAG_DAMAGE_AIRBORNE (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets
#define FLAG_DMG_2X_IN_AIR (1 << 22) // If target is in the air, can hit and deal double damage.
#define FLAG_DMG_IN_AIR (1 << 23) // If target is in the air, can hit.
#define FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets
// Split defines.
#define SPLIT_PHYSICAL 0x0

View File

@ -74,5 +74,6 @@ ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
u8 ItemId_GetBattleUsage(u16 itemId);
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
bool32 IsPinchBerryItemEffect(u16 holdEffect);
#endif // GUARD_ITEM_H

View File

@ -213,7 +213,8 @@ SECTIONS {
src/decoration.o(.text);
src/slot_machine.o(.text);
src/contest_painting.o(.text);
src/battle_ai_script_commands.o(.text);
src/battle_ai_main.o(.text);
src/battle_ai_util.o(.text);
src/trader.o(.text);
src/starter_choose.o(.text);
src/wallclock.o(.text);
@ -345,7 +346,6 @@ SECTIONS {
data/battle_scripts_1.o(script_data);
data/field_effect_scripts.o(script_data);
data/battle_scripts_2.o(script_data);
data/battle_ai_scripts.o(script_data);
data/contest_ai_scripts.o(script_data);
data/mystery_event_script_cmd_table.o(script_data);
} =0
@ -587,7 +587,8 @@ SECTIONS {
src/decoration.o(.rodata);
src/slot_machine.o(.rodata);
src/contest_painting.o(.rodata);
src/battle_ai_script_commands.o(.rodata);
src/battle_ai_main.o(.rodata);
src/battle_ai_util.o(.rodata);
src/trader.o(.rodata);
src/starter_choose.o(.rodata);
src/wallclock.o(.rodata);

4976
src/battle_ai_main.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_ai_util.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_setup.h"
@ -416,7 +417,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent)
return FALSE;
}
static bool8 ShouldSwitch(void)
bool32 ShouldSwitch(void)
{
u8 battlerIn1, battlerIn2;
s32 firstId;

3463
src/battle_ai_util.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_interface.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_interface.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_arena.h"
#include "battle_controllers.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_message.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_interface.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_message.h"

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "battle_message.h"

View File

@ -18,7 +18,8 @@
#include "text_window.h"
#include "international_string_util.h"
#include "strings.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_ai_util.h"
#include "list_menu.h"
#include "decompress.h"
#include "trainer_pokemon_sprites.h"
@ -32,6 +33,7 @@
#include "constants/moves.h"
#include "constants/items.h"
#include "constants/rgb.h"
#include "constants/hold_effects.h"
#define MAX_MODIFY_DIGITS 4
@ -98,6 +100,7 @@ enum
LIST_ITEM_SIDE_STATUS,
LIST_ITEM_AI,
LIST_ITEM_AI_MOVES_PTS,
LIST_ITEM_AI_INFO,
LIST_ITEM_VARIOUS,
LIST_ITEM_COUNT
};
@ -149,7 +152,11 @@ enum
VARIOUS_IN_LOVE,
};
// Static Declarations
static const u8 *GetHoldEffectName(u16 holdEffect);
// const rom data
static const u8 sText_HoldEffect[] = _("Hold Effect");
static const u8 sText_Ability[] = _("Ability");
static const u8 sText_Moves[] = _("Moves");
static const u8 sText_Stats[] = _("Stats");
@ -222,6 +229,7 @@ static const u8 sText_HpAware[] = _("HP aware");
static const u8 sText_Unknown[] = _("Unknown");
static const u8 sText_InLove[] = _("In Love");
static const u8 sText_AIMovePts[] = _("AI Move Pts");
static const u8 sText_AiKnowledge[] = _("AI Info");
static const u8 sText_EffectOverride[] = _("Effect Override");
static const u8 sText_EmptyString[] = _("");
@ -319,6 +327,7 @@ static const struct ListMenuItem sMainListItems[] =
{sText_SideStatus, LIST_ITEM_SIDE_STATUS},
{sText_AI, LIST_ITEM_AI},
{sText_AIMovePts, LIST_ITEM_AI_MOVES_PTS},
{sText_AiKnowledge, LIST_ITEM_AI_INFO},
{sText_Various, LIST_ITEM_VARIOUS},
};
@ -737,9 +746,15 @@ static void Task_ShowAiPoints(u8 taskId)
{
if (i != data->aiBattlerId && IsBattlerAlive(i))
{
#ifndef POKEMON_EXPANSION
data->aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
SpriteCallbackDummy,
95 + (count * 60), 17, 0, 0, FALSE);
#else
data->aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
SpriteCallbackDummy,
95 + (count * 60), 17, 0, 0);
#endif
gSprites[data->aiIconSpriteIds[i]].data[0] = i; // battler id
count++;
}
@ -748,11 +763,19 @@ static void Task_ShowAiPoints(u8 taskId)
data->aiIconSpriteIds[i] = 0xFF;
}
}
#ifndef POKEMON_EXPANSION
data->aiMonSpriteId = CreateMonPicSprite_HandleDeoxys(gBattleMons[data->aiBattlerId].species,
gBattleMons[data->aiBattlerId].otId,
gBattleMons[data->aiBattlerId].personality,
TRUE,
39, 130, 15, 0xFFFF);
#else
data->aiMonSpriteId = CreateMonPicSprite(gBattleMons[data->aiBattlerId].species,
gBattleMons[data->aiBattlerId].otId,
gBattleMons[data->aiBattlerId].personality,
TRUE,
39, 130, 15, 0xFFFF);
#endif
data->aiViewState++;
break;
// Put text
@ -783,6 +806,128 @@ static void SwitchToAiPointsView(u8 taskId)
GetStructPtr(taskId)->aiViewState = 0;
}
static const u8 *const sAiInfoItemNames[] =
{
sText_Ability,
sText_HeldItem,
sText_HoldEffect,
};
static void PutAiInfoText(struct BattleDebugMenu *data)
{
u32 i, j, count;
u8 *text = malloc(0x50);
FillWindowPixelBuffer(data->aiMovesWindowId, 0x11);
// item names
for (i = 0; i < ARRAY_COUNT(sAiInfoItemNames); i++)
{
AddTextPrinterParameterized(data->aiMovesWindowId, 1, sAiInfoItemNames[i], 3, i * 15, 0, NULL);
}
// items info
for (i = 0; i < gBattlersCount; i++)
{
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
{
u16 ability = AI_GetAbility(i);
u16 holdEffect = AI_GetHoldEffect(i);
u16 item = gBattleMons[i].item;
u8 x = (i == B_POSITION_PLAYER_LEFT) ? 83 + (i) * 75 : 83 + (i-1) * 75;
AddTextPrinterParameterized(data->aiMovesWindowId, 0, gAbilityNames[ability], x, 0, 0, NULL);
AddTextPrinterParameterized(data->aiMovesWindowId, 0, ItemId_GetName(item), x, 15, 0, NULL);
AddTextPrinterParameterized(data->aiMovesWindowId, 0, GetHoldEffectName(holdEffect), x, 30, 0, NULL);
}
}
CopyWindowToVram(data->aiMovesWindowId, 3);
free(text);
}
static void Task_ShowAiKnowledge(u8 taskId)
{
u32 i, count;
struct WindowTemplate winTemplate;
struct BattleDebugMenu *data = GetStructPtr(taskId);
switch (data->aiViewState)
{
case 0:
HideBg(0);
ShowBg(1);
// Swap battler if it's player mon
data->aiBattlerId = data->battlerId;
while (!IsBattlerAIControlled(data->aiBattlerId))
{
if (++data->aiBattlerId >= gBattlersCount)
data->aiBattlerId = 0;
}
LoadMonIconPalettes();
for (count = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
{
#ifndef POKEMON_EXPANSION
data->aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
SpriteCallbackDummy,
95 + (count * 80), 17, 0, 0, FALSE);
#else
data->aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
SpriteCallbackDummy,
95 + (count * 80), 17, 0, 0);
#endif
gSprites[data->aiIconSpriteIds[i]].data[0] = i; // battler id
count++;
}
else
{
data->aiIconSpriteIds[i] = 0xFF;
}
}
#ifndef POKEMON_EXPANSION
data->aiMonSpriteId = CreateMonPicSprite_HandleDeoxys(gBattleMons[data->aiBattlerId].species,
gBattleMons[data->aiBattlerId].otId,
gBattleMons[data->aiBattlerId].personality,
TRUE,
39, 130, 15, 0xFFFF);
#else
data->aiMonSpriteId = CreateMonPicSprite(gBattleMons[data->aiBattlerId].species,
gBattleMons[data->aiBattlerId].otId,
gBattleMons[data->aiBattlerId].personality,
TRUE,
39, 130, 15, 0xFFFF);
#endif
data->aiViewState++;
break;
// Put text
case 1:
winTemplate = CreateWindowTemplate(1, 0, 4, 27, 14, 15, 0x200);
data->aiMovesWindowId = AddWindow(&winTemplate);
PutWindowTilemap(data->aiMovesWindowId);
PutAiInfoText(data);
data->aiViewState++;
break;
// Input
case 2:
if (gMain.newKeys & (SELECT_BUTTON | B_BUTTON))
{
SwitchToDebugView(taskId);
HideBg(1);
ShowBg(0);
return;
}
break;
}
}
static void SwitchToAiInfoView(u8 taskId)
{
gTasks[taskId].func = Task_ShowAiKnowledge;
GetStructPtr(taskId)->aiViewState = 0;
}
static void SwitchToDebugView(u8 taskId)
{
u32 i;
@ -844,6 +989,11 @@ static void Task_DebugMenuProcessInput(u8 taskId)
SwitchToAiPointsView(taskId);
return;
}
else if (listItemId == LIST_ITEM_AI_INFO && gMain.newKeys & A_BUTTON)
{
SwitchToAiInfoView(taskId);
return;
}
data->currentMainListItemId = listItemId;
// Create the secondary menu list.
@ -1040,6 +1190,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data)
itemsCount = ARRAY_COUNT(sSideStatusListItems);
break;
case LIST_ITEM_AI_MOVES_PTS:
case LIST_ITEM_AI_INFO:
return;
}
@ -1677,3 +1828,289 @@ static void UpdateMonData(struct BattleDebugMenu *data)
}
}
}
static const u8 sText_HoldEffectNone[] = _("????????");
static const u8 sText_HoldEffectRestoreHp[] = _("Restore Hp");
static const u8 sText_HoldEffectCurePar[] = _("Cure Par");
static const u8 sText_HoldEffectCureSlp[] = _("Cure Slp");
static const u8 sText_HoldEffectCurePsn[] = _("Cure Psn");
static const u8 sText_HoldEffectCureBrn[] = _("Cure Brn");
static const u8 sText_HoldEffectCureFrz[] = _("Cure Frz");
static const u8 sText_HoldEffectRestorePp[] = _("Restore Pp");
static const u8 sText_HoldEffectCureConfusion[] = _("Cure Confusion");
static const u8 sText_HoldEffectCureStatus[] = _("Cure Status");
static const u8 sText_HoldEffectConfuseSpicy[] = _("Confuse Spicy");
static const u8 sText_HoldEffectConfuseDry[] = _("Confuse Dry");
static const u8 sText_HoldEffectConfuseSweet[] = _("Confuse Sweet");
static const u8 sText_HoldEffectConfuseBitter[] = _("Confuse Bitter");
static const u8 sText_HoldEffectConfuseSour[] = _("Confuse Sour");
static const u8 sText_HoldEffectAttackUp[] = _("Attack Up");
static const u8 sText_HoldEffectDefenseUp[] = _("Defense Up");
static const u8 sText_HoldEffectSpeedUp[] = _("Speed Up");
static const u8 sText_HoldEffectSpAttackUp[] = _("Sp Attack Up");
static const u8 sText_HoldEffectSpDefenseUp[] = _("Sp Defense Up");
static const u8 sText_HoldEffectCriticalUp[] = _("Critical Up");
static const u8 sText_HoldEffectRandomStatUp[] = _("Random Stat Up");
static const u8 sText_HoldEffectEvasionUp[] = _("Evasion Up");
static const u8 sText_HoldEffectRestoreStats[] = _("Restore Stats");
static const u8 sText_HoldEffectMachoBrace[] = _("Macho Brace");
static const u8 sText_HoldEffectExpShare[] = _("Exp Share");
static const u8 sText_HoldEffectQuickClaw[] = _("Quick Claw");
static const u8 sText_HoldEffectFriendshipUp[] = _("Friendship Up");
static const u8 sText_HoldEffectMentalHerb[] = _("Mental Herb");
static const u8 sText_HoldEffectChoiceBand[] = _("Choice Band");
static const u8 sText_HoldEffectFlinch[] = _("Flinch");
static const u8 sText_HoldEffectBugPower[] = _("Bug Power");
static const u8 sText_HoldEffectDoublePrize[] = _("Double Prize");
static const u8 sText_HoldEffectRepel[] = _("Repel");
static const u8 sText_HoldEffectSoulDew[] = _("Soul Dew");
static const u8 sText_HoldEffectDeepSeaTooth[] = _("Deep Sea Tooth");
static const u8 sText_HoldEffectDeepSeaScale[] = _("Deep Sea Scale");
static const u8 sText_HoldEffectCanAlwaysRun[] = _("Can Always Run");
static const u8 sText_HoldEffectPreventEvolve[] = _("Prevent Evolve");
static const u8 sText_HoldEffectFocusBand[] = _("Focus Band");
static const u8 sText_HoldEffectLuckyEgg[] = _("Lucky Egg");
static const u8 sText_HoldEffectScopeLens[] = _("Scope Lens");
static const u8 sText_HoldEffectSteelPower[] = _("Steel Power");
static const u8 sText_HoldEffectLeftovers[] = _("Leftovers");
static const u8 sText_HoldEffectDragonScale[] = _("Dragon Scale");
static const u8 sText_HoldEffectLightBall[] = _("Light Ball");
static const u8 sText_HoldEffectGroundPower[] = _("Ground Power");
static const u8 sText_HoldEffectRockPower[] = _("Rock Power");
static const u8 sText_HoldEffectGrassPower[] = _("Grass Power");
static const u8 sText_HoldEffectDarkPower[] = _("Dark Power");
static const u8 sText_HoldEffectFightingPower[] = _("Fighting Power");
static const u8 sText_HoldEffectElectricPower[] = _("Electric Power");
static const u8 sText_HoldEffectWaterPower[] = _("Water Power");
static const u8 sText_HoldEffectFlyingPower[] = _("Flying Power");
static const u8 sText_HoldEffectPoisonPower[] = _("Poison Power");
static const u8 sText_HoldEffectIcePower[] = _("Ice Power");
static const u8 sText_HoldEffectGhostPower[] = _("Ghost Power");
static const u8 sText_HoldEffectPsychicPower[] = _("Psychic Power");
static const u8 sText_HoldEffectFirePower[] = _("Fire Power");
static const u8 sText_HoldEffectDragonPower[] = _("Dragon Power");
static const u8 sText_HoldEffectNormalPower[] = _("Normal Power");
static const u8 sText_HoldEffectUpGrade[] = _("Up Grade");
static const u8 sText_HoldEffectShellBell[] = _("Shell Bell");
static const u8 sText_HoldEffectLuckyPunch[] = _("Lucky Punch");
static const u8 sText_HoldEffectMetalPowder[] = _("Metal Powder");
static const u8 sText_HoldEffectThickClub[] = _("Thick Club");
static const u8 sText_HoldEffectStick[] = _("Stick");
static const u8 sText_HoldEffectChoiceScarf[] = _("Choice Scarf");
static const u8 sText_HoldEffectChoiceSpecs[] = _("Choice Specs");
static const u8 sText_HoldEffectDampRock[] = _("Damp Rock");
static const u8 sText_HoldEffectGripClaw[] = _("Grip Claw");
static const u8 sText_HoldEffectHeatRock[] = _("Heat Rock");
static const u8 sText_HoldEffectIcyRock[] = _("Icy Rock");
static const u8 sText_HoldEffectLightClay[] = _("Light Clay");
static const u8 sText_HoldEffectSmoothRock[] = _("Smooth Rock");
static const u8 sText_HoldEffectPowerHerb[] = _("Power Herb");
static const u8 sText_HoldEffectBigRoot[] = _("Big Root");
static const u8 sText_HoldEffectExpertBelt[] = _("Expert Belt");
static const u8 sText_HoldEffectLifeOrb[] = _("Life Orb");
static const u8 sText_HoldEffectMetronome[] = _("Metronome");
static const u8 sText_HoldEffectMuscleBand[] = _("Muscle Band");
static const u8 sText_HoldEffectWideLens[] = _("Wide Lens");
static const u8 sText_HoldEffectWiseGlasses[] = _("Wise Glasses");
static const u8 sText_HoldEffectZoomLens[] = _("Zoom Lens");
static const u8 sText_HoldEffectLaggingTail[] = _("Lagging Tail");
static const u8 sText_HoldEffectFocusSash[] = _("Focus Sash");
static const u8 sText_HoldEffectFlameOrb[] = _("Flame Orb");
static const u8 sText_HoldEffectToxicOrb[] = _("Toxic Orb");
static const u8 sText_HoldEffectStickyBarb[] = _("Sticky Barb");
static const u8 sText_HoldEffectIronBall[] = _("Iron Ball");
static const u8 sText_HoldEffectBlackSludge[] = _("Black Sludge");
static const u8 sText_HoldEffectDestinyKnot[] = _("Destiny Knot");
static const u8 sText_HoldEffectShedShell[] = _("Shed Shell");
static const u8 sText_HoldEffectQuickPowder[] = _("Quick Powder");
static const u8 sText_HoldEffectAdamantOrb[] = _("Adamant Orb");
static const u8 sText_HoldEffectLustrousOrb[] = _("Lustrous Orb");
static const u8 sText_HoldEffectGriseousOrb[] = _("Griseous Orb");
static const u8 sText_HoldEffectGracidea[] = _("Gracidea");
static const u8 sText_HoldEffectResistBerry[] = _("Resist Berry");
static const u8 sText_HoldEffectPowerItem[] = _("Power Item");
static const u8 sText_HoldEffectRestorePctHp[] = _("Restore Pct Hp");
static const u8 sText_HoldEffectMicleBerry[] = _("Micle Berry");
static const u8 sText_HoldEffectCustapBerry[] = _("Custap Berry");
static const u8 sText_HoldEffectJabocaBerry[] = _("Jaboca Berry");
static const u8 sText_HoldEffectRowapBerry[] = _("Rowap Berry");
static const u8 sText_HoldEffectKeeBerry[] = _("Kee Berry");
static const u8 sText_HoldEffectMarangaBerry[] = _("Maranga Berry");
static const u8 sText_HoldEffectFloatStone[] = _("Float Stone");
static const u8 sText_HoldEffectEviolite[] = _("Eviolite");
static const u8 sText_HoldEffectAssaultVest[] = _("Assault Vest");
static const u8 sText_HoldEffectDrive[] = _("Drive");
static const u8 sText_HoldEffectGems[] = _("Gems");
static const u8 sText_HoldEffectRockyHelmet[] = _("Rocky Helmet");
static const u8 sText_HoldEffectAirBalloon[] = _("Air Balloon");
static const u8 sText_HoldEffectRedCard[] = _("Red Card");
static const u8 sText_HoldEffectRingTarget[] = _("Ring Target");
static const u8 sText_HoldEffectBindingBand[] = _("Binding Band");
static const u8 sText_HoldEffectEjectButton[] = _("Eject Button");
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_HoldEffectLuminousMoss[] = _("Luminous Moss");
static const u8 sText_HoldEffectSnowball[] = _("Snowball");
static const u8 sText_HoldEffectWeaknessPolicy[] = _("Weakness Policy");
static const u8 sText_HoldEffectProtectivePads[] = _("Protective Pads");
static const u8 sText_HoldEffectTerrainExtender[] = _("Terrain Extender");
static const u8 sText_HoldEffectSeeds[] = _("Seeds");
static const u8 sText_HoldEffectAdrenalineOrb[] = _("Adrenaline Orb");
static const u8 sText_HoldEffectMemory[] = _("Memory");
static const u8 sText_HoldEffectPlate[] = _("Plate");
static const u8 sText_HoldEffectUtilityUmbrella[] = _("Utility Umbrella");
static const u8 sText_HoldEffectEjectPack[] = _("Eject Pack");
static const u8 sText_HoldEffectRoomService[] = _("Room Service");
static const u8 sText_HoldEffectBlunderPolicy[] = _("Blunder Policy");
static const u8 sText_HoldEffectHeavyDutyBoots[] = _("Heavy Duty Boots");
static const u8 sText_HoldEffectThroatSpray[] = _("Throat Spray");
static const u8 *const sHoldEffectNames[] =
{
[HOLD_EFFECT_NONE] = sText_HoldEffectNone,
[HOLD_EFFECT_RESTORE_HP] = sText_HoldEffectRestoreHp,
[HOLD_EFFECT_CURE_PAR] = sText_HoldEffectCurePar,
[HOLD_EFFECT_CURE_SLP] = sText_HoldEffectCureSlp,
[HOLD_EFFECT_CURE_PSN] = sText_HoldEffectCurePsn,
[HOLD_EFFECT_CURE_BRN] = sText_HoldEffectCureBrn,
[HOLD_EFFECT_CURE_FRZ] = sText_HoldEffectCureFrz,
[HOLD_EFFECT_RESTORE_PP] = sText_HoldEffectRestorePp,
[HOLD_EFFECT_CURE_CONFUSION] = sText_HoldEffectCureConfusion,
[HOLD_EFFECT_CURE_STATUS] = sText_HoldEffectCureStatus,
[HOLD_EFFECT_CONFUSE_SPICY] = sText_HoldEffectConfuseSpicy,
[HOLD_EFFECT_CONFUSE_DRY] = sText_HoldEffectConfuseDry,
[HOLD_EFFECT_CONFUSE_SWEET] = sText_HoldEffectConfuseSweet,
[HOLD_EFFECT_CONFUSE_BITTER] = sText_HoldEffectConfuseBitter,
[HOLD_EFFECT_CONFUSE_SOUR] = sText_HoldEffectConfuseSour,
[HOLD_EFFECT_ATTACK_UP] = sText_HoldEffectAttackUp,
[HOLD_EFFECT_DEFENSE_UP] = sText_HoldEffectDefenseUp,
[HOLD_EFFECT_SPEED_UP] = sText_HoldEffectSpeedUp,
[HOLD_EFFECT_SP_ATTACK_UP] = sText_HoldEffectSpAttackUp,
[HOLD_EFFECT_SP_DEFENSE_UP] = sText_HoldEffectSpDefenseUp,
[HOLD_EFFECT_CRITICAL_UP] = sText_HoldEffectCriticalUp,
[HOLD_EFFECT_RANDOM_STAT_UP] = sText_HoldEffectRandomStatUp,
[HOLD_EFFECT_EVASION_UP] = sText_HoldEffectEvasionUp,
[HOLD_EFFECT_RESTORE_STATS] = sText_HoldEffectRestoreStats,
[HOLD_EFFECT_MACHO_BRACE] = sText_HoldEffectMachoBrace,
[HOLD_EFFECT_EXP_SHARE] = sText_HoldEffectExpShare,
[HOLD_EFFECT_QUICK_CLAW] = sText_HoldEffectQuickClaw,
[HOLD_EFFECT_FRIENDSHIP_UP] = sText_HoldEffectFriendshipUp,
//[HOLD_EFFECT_MENTAL_HERB] = sText_HoldEffectMentalHerb,
[HOLD_EFFECT_CHOICE_BAND] = sText_HoldEffectChoiceBand,
[HOLD_EFFECT_FLINCH] = sText_HoldEffectFlinch,
[HOLD_EFFECT_BUG_POWER] = sText_HoldEffectBugPower,
[HOLD_EFFECT_DOUBLE_PRIZE] = sText_HoldEffectDoublePrize,
[HOLD_EFFECT_REPEL] = sText_HoldEffectRepel,
[HOLD_EFFECT_SOUL_DEW] = sText_HoldEffectSoulDew,
[HOLD_EFFECT_DEEP_SEA_TOOTH] = sText_HoldEffectDeepSeaTooth,
[HOLD_EFFECT_DEEP_SEA_SCALE] = sText_HoldEffectDeepSeaScale,
[HOLD_EFFECT_CAN_ALWAYS_RUN] = sText_HoldEffectCanAlwaysRun,
[HOLD_EFFECT_PREVENT_EVOLVE] = sText_HoldEffectPreventEvolve,
[HOLD_EFFECT_FOCUS_BAND] = sText_HoldEffectFocusBand,
[HOLD_EFFECT_LUCKY_EGG] = sText_HoldEffectLuckyEgg,
[HOLD_EFFECT_SCOPE_LENS] = sText_HoldEffectScopeLens,
[HOLD_EFFECT_STEEL_POWER] = sText_HoldEffectSteelPower,
[HOLD_EFFECT_LEFTOVERS] = sText_HoldEffectLeftovers,
[HOLD_EFFECT_DRAGON_SCALE] = sText_HoldEffectDragonScale,
[HOLD_EFFECT_LIGHT_BALL] = sText_HoldEffectLightBall,
[HOLD_EFFECT_GROUND_POWER] = sText_HoldEffectGroundPower,
[HOLD_EFFECT_ROCK_POWER] = sText_HoldEffectRockPower,
[HOLD_EFFECT_GRASS_POWER] = sText_HoldEffectGrassPower,
[HOLD_EFFECT_DARK_POWER] = sText_HoldEffectDarkPower,
[HOLD_EFFECT_FIGHTING_POWER] = sText_HoldEffectFightingPower,
[HOLD_EFFECT_ELECTRIC_POWER] = sText_HoldEffectElectricPower,
[HOLD_EFFECT_WATER_POWER] = sText_HoldEffectWaterPower,
[HOLD_EFFECT_FLYING_POWER] = sText_HoldEffectFlyingPower,
[HOLD_EFFECT_POISON_POWER] = sText_HoldEffectPoisonPower,
[HOLD_EFFECT_ICE_POWER] = sText_HoldEffectIcePower,
[HOLD_EFFECT_GHOST_POWER] = sText_HoldEffectGhostPower,
[HOLD_EFFECT_PSYCHIC_POWER] = sText_HoldEffectPsychicPower,
[HOLD_EFFECT_FIRE_POWER] = sText_HoldEffectFirePower,
[HOLD_EFFECT_DRAGON_POWER] = sText_HoldEffectDragonPower,
[HOLD_EFFECT_NORMAL_POWER] = sText_HoldEffectNormalPower,
[HOLD_EFFECT_UP_GRADE] = sText_HoldEffectUpGrade,
[HOLD_EFFECT_SHELL_BELL] = sText_HoldEffectShellBell,
[HOLD_EFFECT_LUCKY_PUNCH] = sText_HoldEffectLuckyPunch,
[HOLD_EFFECT_METAL_POWDER] = sText_HoldEffectMetalPowder,
[HOLD_EFFECT_THICK_CLUB] = sText_HoldEffectThickClub,
[HOLD_EFFECT_STICK] = sText_HoldEffectStick,
[HOLD_EFFECT_CHOICE_SCARF] = sText_HoldEffectChoiceScarf,
[HOLD_EFFECT_CHOICE_SPECS] = sText_HoldEffectChoiceSpecs,
[HOLD_EFFECT_DAMP_ROCK] = sText_HoldEffectDampRock,
[HOLD_EFFECT_GRIP_CLAW] = sText_HoldEffectGripClaw,
[HOLD_EFFECT_HEAT_ROCK] = sText_HoldEffectHeatRock,
[HOLD_EFFECT_ICY_ROCK] = sText_HoldEffectIcyRock,
[HOLD_EFFECT_LIGHT_CLAY] = sText_HoldEffectLightClay,
[HOLD_EFFECT_SMOOTH_ROCK] = sText_HoldEffectSmoothRock,
[HOLD_EFFECT_POWER_HERB] = sText_HoldEffectPowerHerb,
[HOLD_EFFECT_BIG_ROOT] = sText_HoldEffectBigRoot,
[HOLD_EFFECT_EXPERT_BELT] = sText_HoldEffectExpertBelt,
[HOLD_EFFECT_LIFE_ORB] = sText_HoldEffectLifeOrb,
[HOLD_EFFECT_METRONOME] = sText_HoldEffectMetronome,
[HOLD_EFFECT_MUSCLE_BAND] = sText_HoldEffectMuscleBand,
[HOLD_EFFECT_WIDE_LENS] = sText_HoldEffectWideLens,
[HOLD_EFFECT_WISE_GLASSES] = sText_HoldEffectWiseGlasses,
[HOLD_EFFECT_ZOOM_LENS] = sText_HoldEffectZoomLens,
[HOLD_EFFECT_LAGGING_TAIL] = sText_HoldEffectLaggingTail,
[HOLD_EFFECT_FOCUS_SASH] = sText_HoldEffectFocusSash,
[HOLD_EFFECT_FLAME_ORB] = sText_HoldEffectFlameOrb,
[HOLD_EFFECT_TOXIC_ORB] = sText_HoldEffectToxicOrb,
[HOLD_EFFECT_STICKY_BARB] = sText_HoldEffectStickyBarb,
[HOLD_EFFECT_IRON_BALL] = sText_HoldEffectIronBall,
[HOLD_EFFECT_BLACK_SLUDGE] = sText_HoldEffectBlackSludge,
[HOLD_EFFECT_DESTINY_KNOT] = sText_HoldEffectDestinyKnot,
[HOLD_EFFECT_SHED_SHELL] = sText_HoldEffectShedShell,
[HOLD_EFFECT_QUICK_POWDER] = sText_HoldEffectQuickPowder,
[HOLD_EFFECT_ADAMANT_ORB] = sText_HoldEffectAdamantOrb,
[HOLD_EFFECT_LUSTROUS_ORB] = sText_HoldEffectLustrousOrb,
[HOLD_EFFECT_GRISEOUS_ORB] = sText_HoldEffectGriseousOrb,
[HOLD_EFFECT_GRACIDEA] = sText_HoldEffectGracidea,
[HOLD_EFFECT_RESIST_BERRY] = sText_HoldEffectResistBerry,
[HOLD_EFFECT_POWER_ITEM] = sText_HoldEffectPowerItem,
[HOLD_EFFECT_RESTORE_PCT_HP] = sText_HoldEffectRestorePctHp,
//[HOLD_EFFECT_MICLE_BERRY] = sText_HoldEffectMicleBerry,
//[HOLD_EFFECT_CUSTAP_BERRY] = sText_HoldEffectCustapBerry,
//[HOLD_EFFECT_JABOCA_BERRY] = sText_HoldEffectJabocaBerry,
//[HOLD_EFFECT_ROWAP_BERRY] = sText_HoldEffectRowapBerry,
//[HOLD_EFFECT_KEE_BERRY] = sText_HoldEffectKeeBerry,
//[HOLD_EFFECT_MARANGA_BERRY] = sText_HoldEffectMarangaBerry,
[HOLD_EFFECT_FLOAT_STONE] = sText_HoldEffectFloatStone,
[HOLD_EFFECT_EVIOLITE] = sText_HoldEffectEviolite,
[HOLD_EFFECT_ASSAULT_VEST] = sText_HoldEffectAssaultVest,
[HOLD_EFFECT_DRIVE] = sText_HoldEffectDrive,
[HOLD_EFFECT_GEMS] = sText_HoldEffectGems,
[HOLD_EFFECT_ROCKY_HELMET] = sText_HoldEffectRockyHelmet,
[HOLD_EFFECT_AIR_BALLOON] = sText_HoldEffectAirBalloon,
[HOLD_EFFECT_RED_CARD] = sText_HoldEffectRedCard,
[HOLD_EFFECT_RING_TARGET] = sText_HoldEffectRingTarget,
[HOLD_EFFECT_BINDING_BAND] = sText_HoldEffectBindingBand,
[HOLD_EFFECT_EJECT_BUTTON] = sText_HoldEffectEjectButton,
[HOLD_EFFECT_ABSORB_BULB] = sText_HoldEffectAbsorbBulb,
[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_LUMINOUS_MOSS] = sText_HoldEffectLuminousMoss,
[HOLD_EFFECT_SNOWBALL] = sText_HoldEffectSnowball,
[HOLD_EFFECT_WEAKNESS_POLICY] = sText_HoldEffectWeaknessPolicy,
[HOLD_EFFECT_PROTECTIVE_PADS] = sText_HoldEffectProtectivePads,
[HOLD_EFFECT_TERRAIN_EXTENDER] = sText_HoldEffectTerrainExtender,
[HOLD_EFFECT_SEEDS] = sText_HoldEffectSeeds,
[HOLD_EFFECT_ADRENALINE_ORB] = sText_HoldEffectAdrenalineOrb,
[HOLD_EFFECT_MEMORY] = sText_HoldEffectMemory,
[HOLD_EFFECT_PLATE] = sText_HoldEffectPlate,
[HOLD_EFFECT_UTILITY_UMBRELLA] = sText_HoldEffectUtilityUmbrella,
[HOLD_EFFECT_EJECT_PACK] = sText_HoldEffectEjectPack,
[HOLD_EFFECT_ROOM_SERVICE] = sText_HoldEffectRoomService,
[HOLD_EFFECT_BLUNDER_POLICY] = sText_HoldEffectBlunderPolicy,
[HOLD_EFFECT_HEAVY_DUTY_BOOTS] = sText_HoldEffectHeavyDutyBoots,
[HOLD_EFFECT_THROAT_SPRAY] = sText_HoldEffectThroatSpray,
};
static const u8 *GetHoldEffectName(u16 holdEffect)
{
if (holdEffect > ARRAY_COUNT(sHoldEffectNames))
return sHoldEffectNames[0];
return sHoldEffectNames[holdEffect];
}

View File

@ -877,13 +877,13 @@ u32 GetAiScriptsInBattleFactory(void)
int challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7;
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
return AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY;
return AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY;
else if (challengeNum < 2)
return 0;
else if (challengeNum < 4)
return AI_SCRIPT_CHECK_BAD_MOVE;
return AI_FLAG_CHECK_BAD_MOVE;
else
return AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY;
return AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY;
}
}

View File

@ -1,7 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_controllers.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_interface.h"

View File

@ -1,7 +1,8 @@
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_ai_util.h"
#include "battle_arena.h"
#include "battle_controllers.h"
#include "battle_interface.h"
@ -3034,6 +3035,7 @@ void SwitchInClearSetData(void)
ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler);
ClearBattlerItemEffectHistory(gActiveBattler);
}
void FaintClearSetData(void)
@ -3122,6 +3124,7 @@ void FaintClearSetData(void)
ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler);
ClearBattlerItemEffectHistory(gActiveBattler);
UndoFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler));
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
UndoMegaEvolution(gBattlerPartyIndexes[gActiveBattler]);

View File

@ -694,9 +694,13 @@ static const u8 sText_AsOneEnters[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} has two
static const u8 sText_CuriousMedicineEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s\nstat changes were reset!");
static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faster,\nthanks to {B_LAST_ITEM}!");
static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!");
static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!");
static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_PKMNGOTOVERITSINFATUATION - 12] = sText_PkmnGotOverItsInfatuation,
[STRINGID_PKMNSHOOKOFFTHETAUNT - 12] = sText_PkmnShookOffTheTaunt,
[STRINGID_MICLEBERRYACTIVATES - 12] = sText_MicleBerryActivates,
[STRINGID_CANACTFASTERTHANKSTO - 12] = sText_CanActFaster,
[STRINGID_CURIOUSMEDICINEENTERS - 12] = sText_CuriousMedicineEnters,

View File

@ -4,7 +4,8 @@
#include "constants/battle_script_commands.h"
#include "battle_message.h"
#include "battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_ai_util.h"
#include "battle_scripts.h"
#include "constants/moves.h"
#include "constants/abilities.h"
@ -814,13 +815,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_metalburstdamagecalculator, //0xFF
};
struct StatFractions
{
u8 dividend;
u8 divisor;
};
static const struct StatFractions sAccuracyStageRatios[] =
const struct StatFractions gAccuracyStageRatios[] =
{
{ 33, 100}, // -6
{ 36, 100}, // -5
@ -922,92 +917,167 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_NONE] = 0xFF, // Can't use a non-move lol
[MOVE_STRUGGLE] = 0xFF, // Neither Struggle
[MOVE_AFTER_YOU] = FORBIDDEN_METRONOME,
[MOVE_APPLE_ACID] = FORBIDDEN_METRONOME,
[MOVE_ASSIST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_ASTRAL_BARRAGE] = FORBIDDEN_METRONOME,
[MOVE_AURA_WHEEL] = FORBIDDEN_METRONOME,
[MOVE_BADDY_BAD] = FORBIDDEN_METRONOME,
[MOVE_BANEFUL_BUNKER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BEAK_BLAST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_BEHEMOTH_BASH] = FORBIDDEN_METRONOME | FORBIDDEN_COPYCAT,
[MOVE_BEHEMOTH_BLADE] = FORBIDDEN_METRONOME | FORBIDDEN_COPYCAT,
[MOVE_BELCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_BESTOW] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BIDE] = FORBIDDEN_SLEEP_TALK,
[MOVE_BODY_PRESS] = FORBIDDEN_METRONOME,
[MOVE_BOUNCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_BOUNCY_BUBBLE] = FORBIDDEN_METRONOME,
[MOVE_BRANCH_POKE] = FORBIDDEN_METRONOME,
[MOVE_BREAKING_SWIPE] = FORBIDDEN_METRONOME,
[MOVE_BUZZY_BUZZ] = FORBIDDEN_METRONOME,
[MOVE_CELEBRATE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_CHATTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK,
[MOVE_CIRCLE_THROW] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_CLANGOROUS_SOUL] = FORBIDDEN_METRONOME,
[MOVE_COPYCAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_COUNTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_COVET] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_CRAFTY_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_CRAFTY_SHIELD] = FORBIDDEN_METRONOME,
[MOVE_DECORATE] = FORBIDDEN_METRONOME,
[MOVE_DESTINY_BOND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DETECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DIG] = FORBIDDEN_ASSIST,
[MOVE_DIVE] = FORBIDDEN_ASSIST,
[MOVE_DRAGON_TAIL] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DIAMOND_STORM] = FORBIDDEN_METRONOME,
[MOVE_DIG] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_DIVE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_DOUBLE_IRON_BASH] = FORBIDDEN_METRONOME,
[MOVE_DRAGON_ASCENT] = FORBIDDEN_METRONOME,
[MOVE_DRAGON_ENERGY] = FORBIDDEN_METRONOME,
[MOVE_DRAGON_TAIL] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DRUM_BEATING] = FORBIDDEN_METRONOME,
[MOVE_DYNAMAX_CANNON] = FORBIDDEN_METRONOME | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_ENDURE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_ETERNABEAM] = FORBIDDEN_METRONOME,
[MOVE_FALSE_SURRENDER] = FORBIDDEN_METRONOME,
[MOVE_FEINT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_FIERY_WRATH] = FORBIDDEN_METRONOME,
[MOVE_FLEUR_CANNON] = FORBIDDEN_METRONOME,
[MOVE_FLY] = FORBIDDEN_ASSIST,
[MOVE_FLOATY_FALL] = FORBIDDEN_METRONOME,
[MOVE_FLY] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_FOCUS_PUNCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_FOLLOW_ME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_FREEZE_SHOCK] = FORBIDDEN_METRONOME,
[MOVE_FREEZE_SHOCK] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK,
[MOVE_FREEZING_GLARE] = FORBIDDEN_METRONOME,
[MOVE_FREEZY_FROST] = FORBIDDEN_METRONOME,
[MOVE_GEOMANCY] = FORBIDDEN_SLEEP_TALK,
[MOVE_GLACIAL_LANCE] = FORBIDDEN_METRONOME,
[MOVE_GLITZY_GLOW] = FORBIDDEN_METRONOME,
[MOVE_GRAV_APPLE] = FORBIDDEN_METRONOME,
[MOVE_HELPING_HAND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_HOLD_HANDS] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_HYPERSPACE_FURY] = FORBIDDEN_METRONOME,
[MOVE_HYPERSPACE_HOLE] = FORBIDDEN_METRONOME,
[MOVE_ICE_BURN] = FORBIDDEN_METRONOME,
[MOVE_ICE_BURN] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK,
[MOVE_INSTRUCT] = FORBIDDEN_METRONOME,
[MOVE_JUNGLE_HEALING] = FORBIDDEN_METRONOME,
[MOVE_KINGS_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_LIFE_DEW] = FORBIDDEN_METRONOME,
[MOVE_LIGHT_OF_RUIN] = FORBIDDEN_METRONOME,
[MOVE_MAT_BLOCK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_ME_FIRST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_METEOR_ASSAULT] = FORBIDDEN_METRONOME,
[MOVE_METRONOME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_MIMIC] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK,
[MOVE_MIND_BLOWN] = FORBIDDEN_METRONOME,
[MOVE_MIRROR_COAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_MIRROR_MOVE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_MOONGEIST_BEAM] = FORBIDDEN_METRONOME,
[MOVE_NATURE_POWER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_NATURES_MADNESS] = FORBIDDEN_METRONOME,
[MOVE_OBSTRUCT] = FORBIDDEN_METRONOME | FORBIDDEN_COPYCAT,
[MOVE_ORIGIN_PULSE] = FORBIDDEN_METRONOME,
[MOVE_OVERDRIVE] = FORBIDDEN_METRONOME,
[MOVE_PHANTOM_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_PHOTON_GEYSER] = FORBIDDEN_METRONOME,
[MOVE_PIKA_PAPOW] = FORBIDDEN_METRONOME,
[MOVE_PLASMA_FISTS] = FORBIDDEN_METRONOME,
[MOVE_PRECIPICE_BLADES] = FORBIDDEN_METRONOME,
[MOVE_PROTECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_PYRO_BALL] = FORBIDDEN_METRONOME,
[MOVE_QUASH] = FORBIDDEN_METRONOME,
[MOVE_QUICK_GUARD] = FORBIDDEN_METRONOME,
[MOVE_RAGE_POWDER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_RAZOR_WIND] = FORBIDDEN_SLEEP_TALK,
[MOVE_RELIC_SONG] = FORBIDDEN_METRONOME,
[MOVE_ROAR] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_SAPPY_SEED] = FORBIDDEN_METRONOME,
[MOVE_SECRET_SWORD] = FORBIDDEN_METRONOME,
[MOVE_SHADOW_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_SHELL_TRAP] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_SKETCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_SIZZLY_SLIDE] = FORBIDDEN_METRONOME,
[MOVE_SKETCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK,
[MOVE_SKULL_BASH] = FORBIDDEN_SLEEP_TALK,
[MOVE_SKY_ATTACK] = FORBIDDEN_SLEEP_TALK,
[MOVE_SKY_DROP] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK,
[MOVE_SLEEP_TALK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK,
[MOVE_SNAP_TRAP] = FORBIDDEN_METRONOME,
[MOVE_SNARL] = FORBIDDEN_METRONOME,
[MOVE_SNATCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_SNORE] = FORBIDDEN_METRONOME,
[MOVE_SOLAR_BEAM] = FORBIDDEN_SLEEP_TALK,
[MOVE_SOLAR_BLADE] = FORBIDDEN_SLEEP_TALK,
[MOVE_SPARKLY_SWIRL] = FORBIDDEN_METRONOME,
[MOVE_SPECTRAL_THIEF] = FORBIDDEN_METRONOME,
[MOVE_SPIKY_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_SPOTLIGHT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST,
[MOVE_SPIRIT_BREAK] = FORBIDDEN_METRONOME,
[MOVE_SPLISHY_SPLASH] = FORBIDDEN_METRONOME,
[MOVE_SPOTLIGHT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_STEAM_ERUPTION] = FORBIDDEN_METRONOME,
[MOVE_STEEL_BEAM] = FORBIDDEN_METRONOME,
[MOVE_STRANGE_STEAM] = FORBIDDEN_METRONOME,
[MOVE_SUNSTEEL_STRIKE] = FORBIDDEN_METRONOME,
[MOVE_SURGING_STRIKES] = FORBIDDEN_METRONOME,
[MOVE_SWITCHEROO] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_TECHNO_BLAST] = FORBIDDEN_METRONOME,
[MOVE_THIEF] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_THOUSAND_ARROWS] = FORBIDDEN_METRONOME,
[MOVE_THOUSAND_WAVES] = FORBIDDEN_METRONOME,
[MOVE_THUNDER_CAGE] = FORBIDDEN_METRONOME,
[MOVE_THUNDEROUS_KICK] = FORBIDDEN_METRONOME,
[MOVE_TRANSFORM] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC,
[MOVE_TRICK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_V_CREATE] = FORBIDDEN_METRONOME,
[MOVE_WIDE_GUARD] = FORBIDDEN_METRONOME,
[MOVE_WHIRLWIND] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_UPROAR] = FORBIDDEN_SLEEP_TALK,
[MOVE_V_CREATE] = FORBIDDEN_METRONOME,
[MOVE_VEEVEE_VOLLEY] = FORBIDDEN_METRONOME,
[MOVE_WHIRLWIND] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_WICKED_BLOW] = FORBIDDEN_METRONOME,
[MOVE_WIDE_GUARD] = FORBIDDEN_METRONOME,
[MOVE_ZIPPY_ZAP] = FORBIDDEN_METRONOME,
};
static const u16 sMoveEffectsForbiddenToInstruct[] =
{
EFFECT_ASSIST,
//EFFECT_BEAK_BLAST,
EFFECT_BELCH,
EFFECT_BIDE,
//EFFECT_CELEBRATE,
//EFFECT_CHATTER,
EFFECT_COPYCAT,
//EFFECT_DYNAMAX_CANNON,
EFFECT_FOCUS_PUNCH,
//EFFECT_GEOMANCY,
EFFECT_GEOMANCY,
//EFFECT_HOLD_HANDS,
EFFECT_INSTRUCT,
EFFECT_ME_FIRST,
EFFECT_METRONOME,
EFFECT_MIMIC,
EFFECT_MIRROR_MOVE,
EFFECT_NATURE_POWER,
//EFFECT_OBSTRUCT,
EFFECT_RAMPAGE,
EFFECT_RECHARGE,
EFFECT_RECOIL_25,
EFFECT_ROLLOUT,
EFFECT_SEMI_INVULNERABLE,
//EFFECT_SHELL_TRAP,
EFFECT_SKETCH,
@ -1017,21 +1087,22 @@ static const u16 sMoveEffectsForbiddenToInstruct[] =
EFFECT_SOLARBEAM,
EFFECT_TRANSFORM,
EFFECT_TWO_TURNS_ATTACK,
EFFECT_UPROAR,
FORBIDDEN_INSTRUCT_END
};
static const u16 sNaturePowerMoves[] =
{
[BATTLE_TERRAIN_GRASS] = MOVE_STUN_SPORE,
[BATTLE_TERRAIN_LONG_GRASS] = MOVE_RAZOR_LEAF,
[BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE,
[BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL,
[BATTLE_TERRAIN_LONG_GRASS] = MOVE_ENERGY_BALL,
[BATTLE_TERRAIN_SAND] = MOVE_EARTH_POWER,
[BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP,
[BATTLE_TERRAIN_WATER] = MOVE_SURF,
[BATTLE_TERRAIN_POND] = MOVE_BUBBLE_BEAM,
[BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE,
[BATTLE_TERRAIN_CAVE] = MOVE_SHADOW_BALL,
[BATTLE_TERRAIN_BUILDING] = MOVE_SWIFT,
[BATTLE_TERRAIN_PLAIN] = MOVE_SWIFT
[BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP,
[BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP,
[BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTH_POWER,
[BATTLE_TERRAIN_CAVE] = MOVE_POWER_GEM,
[BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK,
[BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK
};
static const u16 sPickupItems[] =
@ -1084,7 +1155,7 @@ static const u8 sTerrainToType[] =
[BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER,
[BATTLE_TERRAIN_WATER] = TYPE_WATER,
[BATTLE_TERRAIN_POND] = TYPE_WATER,
[BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK,
[BATTLE_TERRAIN_MOUNTAIN] = TYPE_GROUND,
[BATTLE_TERRAIN_CAVE] = TYPE_ROCK,
[BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL,
[BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL,
@ -1471,7 +1542,8 @@ static bool32 AccuracyCalcHelper(u16 move)
}
if ((gStatuses3[gBattlerTarget] & STATUS3_PHANTOM_FORCE)
|| (!(gBattleMoves[move].flags & FLAG_HIT_IN_AIR) && gStatuses3[gBattlerTarget] & STATUS3_ON_AIR)
|| (!(gBattleMoves[move].flags & FLAG_DMG_IN_AIR) && gStatuses3[gBattlerTarget] & STATUS3_ON_AIR)
|| (!(gBattleMoves[move].flags & FLAG_DMG_2X_IN_AIR) && gStatuses3[gBattlerTarget] & STATUS3_ON_AIR)
|| (!(gBattleMoves[move].flags & FLAG_DMG_UNDERGROUND) && gStatuses3[gBattlerTarget] & STATUS3_UNDERGROUND)
|| (!(gBattleMoves[move].flags & FLAG_DMG_UNDERWATER) && gStatuses3[gBattlerTarget] & STATUS3_UNDERWATER))
{
@ -1536,8 +1608,8 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
if (defAbility == ABILITY_WONDER_SKIN && gBattleMoves[move].power == 0)
moveAcc = 50;
calc = sAccuracyStageRatios[buff].dividend * moveAcc;
calc /= sAccuracyStageRatios[buff].divisor;
calc = gAccuracyStageRatios[buff].dividend * moveAcc;
calc /= gAccuracyStageRatios[buff].divisor;
if (atkAbility == ABILITY_COMPOUND_EYES)
calc = (calc * 130) / 100; // 1.3 compound eyes boost
@ -1563,7 +1635,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
calc = (calc * (100 + atkParam)) / 100;
else if (atkHoldEffect == HOLD_EFFECT_ZOOM_LENS && GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef));
calc = (calc * (100 + atkParam)) / 100;
if (gProtectStructs[battlerAtk].micle)
{
gProtectStructs[battlerAtk].micle = FALSE;
@ -3119,7 +3191,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
case MOVE_EFFECT_FLAME_BURST:
if (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)) && GetBattlerAbility(BATTLE_PARTNER(gBattlerTarget)) != ABILITY_MAGIC_GUARD)
{
gBattleScripting.battler = BATTLE_PARTNER(gBattlerTarget);
gBattleScripting.savedBattler = BATTLE_PARTNER(gBattlerTarget);
gBattleMoveDamage = gBattleMons[BATTLE_PARTNER(gBattlerTarget)].hp / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
@ -4415,7 +4487,7 @@ static void Cmd_playanimation(void)
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3);
#if B_TERRAIN_BG_CHANGE == FALSE
if (gBattlescriptCurrInstr[2] == B_ANIM_RESTORE_BG)
{
@ -7689,51 +7761,25 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7;
return;
case VARIOUS_SET_SIMPLE_BEAM:
switch (gBattleMons[gActiveBattler].ability)
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gActiveBattler].ability))
{
case ABILITY_SIMPLE:
case ABILITY_TRUANT:
case ABILITY_STANCE_CHANGE:
case ABILITY_DISGUISE:
case ABILITY_MULTITYPE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
break;
default:
}
else
{
gBattleMons[gActiveBattler].ability = ABILITY_SIMPLE;
gBattlescriptCurrInstr += 7;
break;
}
return;
case VARIOUS_TRY_ENTRAINMENT:
switch (gBattleMons[gBattlerTarget].ability)
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability))
{
case ABILITY_TRUANT:
case ABILITY_MULTITYPE:
case ABILITY_STANCE_CHANGE:
case ABILITY_SCHOOLING:
case ABILITY_COMATOSE:
case ABILITY_SHIELDS_DOWN:
case ABILITY_DISGUISE:
case ABILITY_RKS_SYSTEM:
case ABILITY_BATTLE_BOND:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
return;
}
switch (gBattleMons[gBattlerAttacker].ability)
{
case ABILITY_TRACE:
case ABILITY_FORECAST:
case ABILITY_FLOWER_GIFT:
case ABILITY_ZEN_MODE:
case ABILITY_ILLUSION:
case ABILITY_IMPOSTER:
case ABILITY_POWER_OF_ALCHEMY:
case ABILITY_RECEIVER:
case ABILITY_DISGUISE:
case ABILITY_POWER_CONSTRUCT:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
return;
}
if (gBattleMons[gBattlerTarget].ability == gBattleMons[gBattlerAttacker].ability)
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
@ -9191,17 +9237,17 @@ bool32 TryResetBattlerStatChanges(u8 battler)
{
u32 j;
bool32 ret = FALSE;
gDisableStructs[battler].stockpileDef = 0;
gDisableStructs[battler].stockpileSpDef = 0;
for (j = 0; j < NUM_BATTLE_STATS; j++)
{
if (gBattleMons[battler].statStages[j] != DEFAULT_STAT_STAGE)
ret = TRUE; // returns TRUE if any stat was reset
gBattleMons[battler].statStages[j] = DEFAULT_STAT_STAGE;
}
return ret;
}
@ -9746,7 +9792,7 @@ static void Cmd_tryinfatuating(void)
if (GetBattlerAbility(gBattlerTarget) == ABILITY_OBLIVIOUS)
{
gBattlescriptCurrInstr = BattleScript_ObliviousPreventsAttraction;
gBattlescriptCurrInstr = BattleScript_NotAffectedAbilityPopUp;
gLastUsedAbility = ABILITY_OBLIVIOUS;
RecordAbilityBattle(gBattlerTarget, ABILITY_OBLIVIOUS);
}
@ -11114,6 +11160,12 @@ static void Cmd_callterrainattack(void) // nature power
gBattlescriptCurrInstr++;
}
u16 GetNaturePowerMove(void)
{
//TODO terrain
return sNaturePowerMoves[gBattleTerrain];
}
static void Cmd_cureifburnedparalysedorpoisoned(void) // refresh
{
if (gBattleMons[gBattlerAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON))
@ -11153,7 +11205,13 @@ static void Cmd_jumpifnodamage(void)
static void Cmd_settaunt(void)
{
if (gDisableStructs[gBattlerTarget].tauntTimer == 0)
if (GetBattlerAbility(gBattlerTarget) == ABILITY_OBLIVIOUS)
{
gBattlescriptCurrInstr = BattleScript_NotAffectedAbilityPopUp;
gLastUsedAbility = ABILITY_OBLIVIOUS;
RecordAbilityBattle(gBattlerTarget, ABILITY_OBLIVIOUS);
}
else if (gDisableStructs[gBattlerTarget].tauntTimer == 0)
{
u8 turns = 4;
if (GetBattlerTurnOrderNum(gBattlerTarget) > GetBattlerTurnOrderNum(gBattlerAttacker))
@ -11280,18 +11338,20 @@ static void Cmd_tryswapitems(void) // trick
static void Cmd_trycopyability(void) // role play
{
switch (gBattleMons[gBattlerTarget].ability)
u16 defAbility = gBattleMons[gBattlerTarget].ability;
if (gBattleMons[gBattlerAttacker].ability == defAbility
|| defAbility == ABILITY_NONE
|| IsRolePlayBannedAbilityAtk(gBattleMons[gBattlerAttacker].ability)
|| IsRolePlayBannedAbility(defAbility))
{
case ABILITY_NONE:
case ABILITY_WONDER_GUARD:
case ABILITY_DISGUISE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
break;
default:
gBattleMons[gBattlerAttacker].ability = gBattleMons[gBattlerTarget].ability;
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
gBattlescriptCurrInstr += 5;
break;
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
else
{
gBattleMons[gBattlerAttacker].ability = defAbility;
gLastUsedAbility = defAbility;
gBattlescriptCurrInstr += 5;
}
}
@ -11345,28 +11405,14 @@ static void Cmd_settoxicspikes(void)
static void Cmd_setgastroacid(void)
{
switch (gBattleMons[gBattlerTarget].ability)
if (IsGastroAcidBannedAbility(gBattleMons[gBattlerTarget].ability))
{
case ABILITY_AS_ONE_ICE_RIDER:
case ABILITY_AS_ONE_SHADOW_RIDER:
case ABILITY_BATTLE_BOND:
case ABILITY_COMATOSE:
case ABILITY_DISGUISE:
case ABILITY_GULP_MISSILE:
case ABILITY_ICE_FACE:
case ABILITY_MULTITYPE:
case ABILITY_POWER_CONSTRUCT:
case ABILITY_RKS_SYSTEM:
case ABILITY_SCHOOLING:
case ABILITY_SHIELDS_DOWN:
case ABILITY_STANCE_CHANGE:
case ABILITY_ZEN_MODE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
break;
default:
}
else
{
gStatuses3[gBattlerTarget] |= STATUS3_GASTRO_ACID;
gBattlescriptCurrInstr += 5;
break;
}
}
@ -11435,20 +11481,9 @@ static void Cmd_setroom(void)
static void Cmd_tryswapabilities(void) // skill swap
{
switch (gBattleMons[gBattlerAttacker].ability)
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability))
{
case ABILITY_NONE:
case ABILITY_WONDER_GUARD:
case ABILITY_DISGUISE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
return;
}
switch (gBattleMons[gBattlerTarget].ability)
{
case ABILITY_NONE:
case ABILITY_WONDER_GUARD:
case ABILITY_DISGUISE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
return;
}
@ -11680,7 +11715,7 @@ static void Cmd_getsecretpowereffect(void)
switch (gBattleTerrain)
{
case BATTLE_TERRAIN_GRASS:
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
break;
case BATTLE_TERRAIN_LONG_GRASS:
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
@ -11689,16 +11724,16 @@ static void Cmd_getsecretpowereffect(void)
gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1;
break;
case BATTLE_TERRAIN_UNDERWATER:
gBattleScripting.moveEffect = MOVE_EFFECT_DEF_MINUS_1;
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_WATER:
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_POND:
gBattleScripting.moveEffect = MOVE_EFFECT_SPD_MINUS_1;
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_MOUNTAIN:
gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION;
gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1;
break;
case BATTLE_TERRAIN_CAVE:
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
@ -11925,6 +11960,13 @@ static void Cmd_tryrecycleitem(void)
}
}
bool32 CanCamouflage(u8 battlerId)
{
if (IS_BATTLER_OF_TYPE(battlerId, sTerrainToType[gBattleTerrain]))
return FALSE;
return TRUE;
}
static void Cmd_settypetoterrain(void)
{
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain]))
@ -12449,11 +12491,36 @@ static void Cmd_trainerslideout(void)
gBattlescriptCurrInstr += 2;
}
static const u16 sTelekinesisBanList[] =
{
SPECIES_DIGLETT,
SPECIES_DUGTRIO,
#ifdef POKEMON_EXPANSION
SPECIES_DIGLETT_ALOLAN,
SPECIES_DUGTRIO_ALOLAN,
SPECIES_SANDYGAST,
SPECIES_PALOSSAND,
SPECIES_GENGAR_MEGA,
#endif
};
bool32 IsTelekinesisBannedSpecies(u16 species)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sTelekinesisBanList); i++)
{
if (species == sTelekinesisBanList[i])
return TRUE;
}
return FALSE;
}
static void Cmd_settelekinesis(void)
{
if (gStatuses3[gBattlerTarget] & (STATUS3_TELEKINESIS | STATUS3_ROOTED | STATUS3_SMACKED_DOWN)
|| gFieldStatuses & STATUS_FIELD_GRAVITY
|| (gBattleMons[gBattlerTarget].species == SPECIES_DIGLETT || gBattleMons[gBattlerTarget].species == SPECIES_DUGTRIO))
|| IsTelekinesisBannedSpecies(gBattleMons[gBattlerTarget].species))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
@ -12521,19 +12588,14 @@ static void Cmd_trygetbaddreamstarget(void)
static void Cmd_tryworryseed(void)
{
switch (gBattleMons[gBattlerTarget].ability)
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability))
{
case ABILITY_INSOMNIA:
case ABILITY_MULTITYPE:
case ABILITY_TRUANT:
case ABILITY_STANCE_CHANGE:
case ABILITY_DISGUISE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
break;
default:
}
else
{
gBattleMons[gBattlerTarget].ability = ABILITY_INSOMNIA;
gBattlescriptCurrInstr += 5;
break;
}
}

View File

@ -23,7 +23,8 @@
#include "trig.h"
#include "window.h"
#include "battle_message.h"
#include "battle_ai_script_commands.h"
#include "battle_ai_main.h"
#include "battle_ai_util.h"
#include "event_data.h"
#include "link.h"
#include "malloc.h"
@ -87,6 +88,134 @@ static const u8 sPkblToEscapeFactor[][3] = {
static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1};
static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4};
static const u16 sSkillSwapBannedAbilities[] =
{
ABILITY_WONDER_GUARD,
ABILITY_MULTITYPE,
ABILITY_ILLUSION,
ABILITY_STANCE_CHANGE,
ABILITY_SCHOOLING,
ABILITY_COMATOSE,
ABILITY_SHIELDS_DOWN,
ABILITY_DISGUISE,
ABILITY_RKS_SYSTEM,
ABILITY_BATTLE_BOND,
ABILITY_POWER_CONSTRUCT,
ABILITY_NEUTRALIZING_GAS,
ABILITY_ICE_FACE,
ABILITY_HUNGER_SWITCH,
ABILITY_GULP_MISSILE,
};
static const u16 sRolePlayBannedAbilities[] =
{
ABILITY_TRACE,
ABILITY_WONDER_GUARD,
ABILITY_FORECAST,
ABILITY_FLOWER_GIFT,
ABILITY_MULTITYPE,
ABILITY_ILLUSION,
ABILITY_ZEN_MODE,
ABILITY_IMPOSTER,
ABILITY_STANCE_CHANGE,
ABILITY_POWER_OF_ALCHEMY,
ABILITY_RECEIVER,
ABILITY_SCHOOLING,
ABILITY_COMATOSE,
ABILITY_SHIELDS_DOWN,
ABILITY_DISGUISE,
ABILITY_RKS_SYSTEM,
ABILITY_BATTLE_BOND,
ABILITY_POWER_CONSTRUCT,
ABILITY_ICE_FACE,
ABILITY_HUNGER_SWITCH,
ABILITY_GULP_MISSILE,
};
static const u16 sRolePlayBannedAttackerAbilities[] =
{
ABILITY_MULTITYPE,
ABILITY_ZEN_MODE,
ABILITY_STANCE_CHANGE,
ABILITY_SCHOOLING,
ABILITY_COMATOSE,
ABILITY_SHIELDS_DOWN,
ABILITY_DISGUISE,
ABILITY_RKS_SYSTEM,
ABILITY_BATTLE_BOND,
ABILITY_POWER_CONSTRUCT,
ABILITY_ICE_FACE,
ABILITY_GULP_MISSILE,
};
static const u16 sWorrySeedBannedAbilities[] =
{
ABILITY_MULTITYPE,
ABILITY_STANCE_CHANGE,
ABILITY_SCHOOLING,
ABILITY_COMATOSE,
ABILITY_SHIELDS_DOWN,
ABILITY_DISGUISE,
ABILITY_RKS_SYSTEM,
ABILITY_BATTLE_BOND,
ABILITY_POWER_CONSTRUCT,
ABILITY_TRUANT,
ABILITY_ICE_FACE,
ABILITY_GULP_MISSILE,
};
static const u16 sGastroAcidBannedAbilities[] =
{
ABILITY_AS_ONE_ICE_RIDER,
ABILITY_AS_ONE_SHADOW_RIDER,
ABILITY_BATTLE_BOND,
ABILITY_COMATOSE,
ABILITY_DISGUISE,
ABILITY_GULP_MISSILE,
ABILITY_ICE_FACE,
ABILITY_MULTITYPE,
ABILITY_POWER_CONSTRUCT,
ABILITY_RKS_SYSTEM,
ABILITY_SCHOOLING,
ABILITY_SHIELDS_DOWN,
ABILITY_STANCE_CHANGE,
ABILITY_ZEN_MODE,
};
static const u16 sEntrainmentBannedAttackerAbilities[] =
{
ABILITY_TRACE,
ABILITY_FORECAST,
ABILITY_FLOWER_GIFT,
ABILITY_ZEN_MODE,
ABILITY_ILLUSION,
ABILITY_IMPOSTER,
ABILITY_POWER_OF_ALCHEMY,
ABILITY_RECEIVER,
ABILITY_DISGUISE,
ABILITY_POWER_CONSTRUCT,
ABILITY_NEUTRALIZING_GAS,
ABILITY_ICE_FACE,
ABILITY_HUNGER_SWITCH,
ABILITY_GULP_MISSILE,
};
static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] =
{
ABILITY_TRUANT,
ABILITY_MULTITYPE,
ABILITY_STANCE_CHANGE,
ABILITY_SCHOOLING,
ABILITY_COMATOSE,
ABILITY_SHIELDS_DOWN,
ABILITY_DISGUISE,
ABILITY_RKS_SYSTEM,
ABILITY_BATTLE_BOND,
ABILITY_ICE_FACE,
ABILITY_GULP_MISSILE,
};
// Functions
void HandleAction_UseMove(void)
{
u32 i, side, moveType, var = 4;
@ -1407,11 +1536,11 @@ static bool32 IsGravityPreventingMove(u32 move)
}
}
static bool32 IsHealBlockPreventingMove(u32 battler, u32 move)
bool32 IsHealBlockPreventingMove(u32 battler, u32 move)
{
if (!(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
return FALSE;
switch (gBattleMoves[move].effect)
{
case EFFECT_ABSORB:
@ -2909,7 +3038,7 @@ void TryClearRageAndFuryCutter(void)
}
}
static bool32 IsThawingMove(u8 battlerId, u16 move)
bool32 IsThawingMove(u8 battlerId, u16 move)
{
switch (move)
{
@ -4971,10 +5100,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
break;
case ABILITY_OBLIVIOUS:
if (gBattleMons[battler].status2 & STATUS2_INFATUATION)
{
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
effect = 3;
}
else if (gDisableStructs[battler].tauntTimer != 0)
effect = 4;
break;
}
if (effect)
@ -4983,17 +5111,26 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
{
case 1: // status cleared
gBattleMons[battler].status1 = 0;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus;
break;
case 2: // get rid of confusion
gBattleMons[battler].status2 &= ~(STATUS2_CONFUSION);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus;
break;
case 3: // get rid of infatuation
gBattleMons[battler].status2 &= ~(STATUS2_INFATUATION);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BattlerGotOverItsInfatuation;
break;
case 4: // get rid of taunt
gDisableStructs[battler].tauntTimer = 0;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BattlerShookOffTaunt;
break;
}
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus;
gBattleScripting.battler = gActiveBattler = gBattlerAbility = battler;
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
@ -5716,10 +5853,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
u8 ppBonuses;
u16 move;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
else
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
mon = GetBattlerPartyData(battlerId);
for (i = 0; i < MAX_MON_MOVES; i++)
{
move = GetMonData(mon, MON_DATA_MOVE1 + i);
@ -7401,6 +7535,11 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b
atkStage = gBattleMons[battlerDef].statStages[STAT_SPATK];
}
}
if (gBattleMoves[move].effect == EFFECT_BODY_PRESS)
{
atkStat = gBattleMons[battlerAtk].defense;
atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF];
}
else
{
if (IS_MOVE_PHYSICAL(move))
@ -7518,7 +7657,7 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b
switch (GetBattlerAbility(BATTLE_PARTNER(battlerAtk)))
{
case ABILITY_FLOWER_GIFT:
if (gBattleMons[BATTLE_PARTNER(battlerAtk)].species == SPECIES_CHERRIM && IS_MOVE_PHYSICAL(move))
if (gBattleMons[BATTLE_PARTNER(battlerAtk)].species == SPECIES_CHERRIM && WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_SUN_ANY) && IS_MOVE_PHYSICAL(move))
MulModifier(&modifier, UQ_4_12(1.5));
break;
}
@ -7663,7 +7802,7 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType,
switch (GetBattlerAbility(BATTLE_PARTNER(battlerDef)))
{
case ABILITY_FLOWER_GIFT:
if (gBattleMons[BATTLE_PARTNER(battlerDef)].species == SPECIES_CHERRIM && !usesDefStat)
if (gBattleMons[BATTLE_PARTNER(battlerDef)].species == SPECIES_CHERRIM && WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY && !usesDefStat)
MulModifier(&modifier, UQ_4_12(1.5));
break;
}
@ -7849,7 +7988,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move
MulModifier(&finalModifier, UQ_4_12(2.0));
if (gBattleMoves[move].flags & FLAG_DMG_UNDERWATER && gStatuses3[battlerDef] & STATUS3_UNDERWATER)
MulModifier(&finalModifier, UQ_4_12(2.0));
if (gBattleMoves[move].flags & FLAG_DMG_IN_AIR && gStatuses3[battlerDef] & STATUS3_ON_AIR)
if (gBattleMoves[move].flags & FLAG_DMG_2X_IN_AIR && gStatuses3[battlerDef] & STATUS3_ON_AIR)
MulModifier(&finalModifier, UQ_4_12(2.0));
dmg = ApplyModifier(finalModifier, dmg);
@ -7964,7 +8103,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
&& gBattleMons[battlerDef].type3 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type3, battlerAtk, recordAbilities);
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) && !(gBattleMoves[move].flags & FLAG_DAMAGE_AIRBORNE))
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING))
{
modifier = UQ_4_12(0.0);
if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE)
@ -7978,7 +8117,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
}
// Thousand Arrows ignores type modifiers for flying mons
if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DAMAGE_AIRBORNE)
if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)
&& (gBattleMons[battlerDef].type1 == TYPE_FLYING || gBattleMons[battlerDef].type2 == TYPE_FLYING || gBattleMons[battlerDef].type3 == TYPE_FLYING))
{
modifier = UQ_4_12(1.0);
@ -8416,3 +8555,122 @@ static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId)
return TRUE;
return FALSE;
}
bool32 TestMoveFlags(u16 move, u32 flag)
{
if (gBattleMoves[move].flags & flag)
return TRUE;
return FALSE;
}
struct Pokemon *GetBattlerPartyData(u8 battlerId)
{
struct Pokemon *mon;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
else
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
return mon;
}
//Make sure the input bank is any bank on the specific mon's side
bool32 CanFling(u8 battlerId)
{
u16 item = gBattleMons[battlerId].item;
u16 itemEffect = ItemId_GetHoldEffect(item);
if (item == ITEM_NONE
|| GetBattlerAbility(battlerId) == ABILITY_KLUTZ
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|| gDisableStructs[battlerId].embargoTimer != 0
|| !CanBattlerGetOrLoseItem(battlerId, item)
//|| itemEffect == HOLD_EFFECT_PRIMAL_ORB
|| itemEffect == HOLD_EFFECT_GEMS
#ifdef ITEM_ABILITY_CAPSULE
|| item == ITEM_ABILITY_CAPSULE
#endif
|| (ItemId_GetPocket(item) == POCKET_BERRIES && IsAbilityOnSide(battlerId, ABILITY_UNNERVE))
|| GetPocketByItemId(item) == POCKET_POKE_BALLS)
return FALSE;
return TRUE;
}
// ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sRolePlayBannedAttackerAbilities); i++)
{
if (ability == sRolePlayBannedAttackerAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsRolePlayBannedAbility(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sRolePlayBannedAbilities); i++)
{
if (ability == sRolePlayBannedAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsSkillSwapBannedAbility(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sSkillSwapBannedAbilities); i++)
{
if (ability == sSkillSwapBannedAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsWorrySeedBannedAbility(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sWorrySeedBannedAbilities); i++)
{
if (ability == sWorrySeedBannedAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsGastroAcidBannedAbility(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sGastroAcidBannedAbilities); i++)
{
if (ability == sGastroAcidBannedAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sEntrainmentBannedAttackerAbilities); i++)
{
if (ability == sEntrainmentBannedAttackerAbilities[i])
return TRUE;
}
return FALSE;
}
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sEntrainmentTargetSimpleBeamBannedAbilities); i++)
{
if (ability == sEntrainmentTargetSimpleBeamBannedAbilities[i])
return TRUE;
}
return FALSE;
}

View File

@ -27,7 +27,6 @@ void AllocateBattleResources(void)
gBattleResources->beforeLvlUp = AllocZeroed(sizeof(*gBattleResources->beforeLvlUp));
gBattleResources->ai = AllocZeroed(sizeof(*gBattleResources->ai));
gBattleResources->battleHistory = AllocZeroed(sizeof(*gBattleResources->battleHistory));
gBattleResources->AI_ScriptsStack = AllocZeroed(sizeof(*gBattleResources->AI_ScriptsStack));
gLinkBattleSendBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
gLinkBattleRecvBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
@ -59,7 +58,6 @@ void FreeBattleResources(void)
FREE_AND_SET_NULL(gBattleResources->beforeLvlUp);
FREE_AND_SET_NULL(gBattleResources->ai);
FREE_AND_SET_NULL(gBattleResources->battleHistory);
FREE_AND_SET_NULL(gBattleResources->AI_ScriptsStack);
FREE_AND_SET_NULL(gBattleResources);
FREE_AND_SET_NULL(gLinkBattleSendBuffer);

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ static const u8 sPoisonPointDescription[] = _("Poisons foe on contact.");
static const u8 sInnerFocusDescription[] = _("Prevents flinching.");
static const u8 sMagmaArmorDescription[] = _("Prevents freezing.");
static const u8 sWaterVeilDescription[] = _("Prevents burns.");
static const u8 sMagnetPullDescription[] = _("Traps Steel-type POKéMON.");
static const u8 sMagnetPullDescription[] = _("Traps Steel-type Pokémon.");
static const u8 sSoundproofDescription[] = _("Avoids sound-based moves.");
static const u8 sRainDishDescription[] = _("Slight HP recovery in rain.");
static const u8 sSandStreamDescription[] = _("Summons a sandstorm.");
@ -255,7 +255,7 @@ static const u8 sGrimNeighDescription[] = _("KOs boost Sp. Atk stat.");
static const u8 sAsOneIceRiderDescription[] = _("Unnerve and Chilling Neigh.");
static const u8 sAsOneShadowRiderDescription[] = _("Unnerve and Grim Neigh.");
const u8 gAbilityNames[ABILITIES_COUNT_GEN8][ABILITY_NAME_LENGTH + 1] =
const u8 gAbilityNames[ABILITIES_COUNT][ABILITY_NAME_LENGTH + 1] =
{
[ABILITY_NONE] = _("-------"),
[ABILITY_STENCH] = _("Stench"),
@ -527,7 +527,7 @@ const u8 gAbilityNames[ABILITIES_COUNT_GEN8][ABILITY_NAME_LENGTH + 1] =
[ABILITY_AS_ONE_SHADOW_RIDER] = _("As One"),
};
const u8 *const gAbilityDescriptionPointers[ABILITIES_COUNT_GEN8] =
const u8 *const gAbilityDescriptionPointers[ABILITIES_COUNT] =
{
[ABILITY_NONE] = sNoneDescription,
[ABILITY_STENCH] = sStenchDescription,

View File

@ -55,7 +55,7 @@ static const u8 sRazorWindDescription[] = _(
static const u8 sSwordsDanceDescription[] = _(
"A fighting dance that\n"
"sharply raises ATTACK.");
"sharply raises Attack.");
static const u8 sCutDescription[] = _(
"Cuts the foe with sharp\n"
@ -155,7 +155,7 @@ static const u8 sDoubleEdgeDescription[] = _(
static const u8 sTailWhipDescription[] = _(
"Wags the tail to lower the\n"
"foe's DEFENSE.");
"foe's Defense.");
static const u8 sPoisonStingDescription[] = _(
"A toxic attack with barbs,\n"
@ -171,7 +171,7 @@ static const u8 sPinMissileDescription[] = _(
static const u8 sLeerDescription[] = _(
"Frightens the foe with a\n"
"leer to lower DEFENSE.");
"leer to lower Defense.");
static const u8 sBiteDescription[] = _(
"Bites with vicious fangs.\n"
@ -179,7 +179,7 @@ static const u8 sBiteDescription[] = _(
static const u8 sGrowlDescription[] = _(
"Growls cutely to reduce the\n"
"foe's ATTACK.");
"foe's Attack.");
static const u8 sRoarDescription[] = _(
"Makes the foe flee to end\n"
@ -203,7 +203,7 @@ static const u8 sDisableDescription[] = _(
static const u8 sAcidDescription[] = _(
"Sprays a hide-melting acid.\n"
"May lower DEFENSE.");
"May lower Defense.");
static const u8 sEmberDescription[] = _(
"A weak fire attack that may\n"
@ -243,11 +243,11 @@ static const u8 sPsybeamDescription[] = _(
static const u8 sBubbleBeamDescription[] = _(
"Forcefully sprays bubbles\n"
"that may lower SPEED.");
"that may lower Speed.");
static const u8 sAuroraBeamDescription[] = _(
"Fires a rainbow-colored\n"
"beam that may lower ATTACK.");
"beam that may lower Attack.");
static const u8 sHyperBeamDescription[] = _(
"Powerful, but leaves the\n"
@ -295,7 +295,7 @@ static const u8 sLeechSeedDescription[] = _(
static const u8 sGrowthDescription[] = _(
"Forces the body to grow\n"
"and heightens SP. ATK.");
"and heightens Sp. Atk.");
static const u8 sRazorLeafDescription[] = _(
"Cuts the enemy with leaves.\n"
@ -323,7 +323,7 @@ static const u8 sPetalDanceDescription[] = _(
static const u8 sStringShotDescription[] = _(
"Binds the foe with string\n"
"to reduce its SPEED.");
"to reduce its Speed.");
static const u8 sDragonRageDescription[] = _(
"Launches shock waves that\n"
@ -375,7 +375,7 @@ static const u8 sConfusionDescription[] = _(
static const u8 sPsychicDescription[] = _(
"A powerful psychic attack\n"
"that may lower SP. DEF.");
"that may lower Sp. Def.");
static const u8 sHypnosisDescription[] = _(
"A hypnotizing move that\n"
@ -383,18 +383,18 @@ static const u8 sHypnosisDescription[] = _(
static const u8 sMeditateDescription[] = _(
"Meditates in a peaceful\n"
"fashion to raise ATTACK.");
"fashion to raise Attack.");
static const u8 sAgilityDescription[] = _(
"Relaxes the body to sharply\n"
"boost SPEED.");
"boost Speed.");
static const u8 sQuickAttackDescription[] = _(
"An extremely fast attack\n"
"that always strikes first.");
static const u8 sRageDescription[] = _(
"Raises the user's ATTACK\n"
"Raises the user's Attack\n"
"every time it is hit.");
static const u8 sTeleportDescription[] = _(
@ -411,7 +411,7 @@ static const u8 sMimicDescription[] = _(
static const u8 sScreechDescription[] = _(
"Emits a screech to sharply\n"
"reduce the foe's DEFENSE.");
"reduce the foe's Defense.");
static const u8 sDoubleTeamDescription[] = _(
"Creates illusory copies to\n"
@ -423,7 +423,7 @@ static const u8 sRecoverDescription[] = _(
static const u8 sHardenDescription[] = _(
"Stiffens the body's \n"
"muscles to raise DEFENSE.");
"muscles to raise Defense.");
static const u8 sMinimizeDescription[] = _(
"Minimizes the user's size\n"
@ -439,19 +439,19 @@ static const u8 sConfuseRayDescription[] = _(
static const u8 sWithdrawDescription[] = _(
"Withdraws the body into its\n"
"hard shell to raise DEFENSE.");
"hard shell to raise Defense.");
static const u8 sDefenseCurlDescription[] = _(
"Curls up to conceal weak\n"
"spots and raise DEFENSE.");
"spots and raise Defense.");
static const u8 sBarrierDescription[] = _(
"Creates a barrier that\n"
"sharply raises DEFENSE.");
"sharply raises Defense.");
static const u8 sLightScreenDescription[] = _(
"Creates a wall of light that\n"
"lowers SP. ATK damage.");
"lowers Sp. Atk damage.");
static const u8 sHazeDescription[] = _(
"Creates a black haze that\n"
@ -471,7 +471,7 @@ static const u8 sBideDescription[] = _(
static const u8 sMetronomeDescription[] = _(
"Waggles a finger to use any\n"
"POKéMON move at random.");
"Pokémon move at random.");
static const u8 sMirrorMoveDescription[] = _(
"Counters the foe's attack\n"
@ -527,11 +527,11 @@ static const u8 sSpikeCannonDescription[] = _(
static const u8 sConstrictDescription[] = _(
"Constricts to inflict pain.\n"
"May lower SPEED.");
"May lower Speed.");
static const u8 sAmnesiaDescription[] = _(
"Forgets about something\n"
"and sharply raises SP. DEF.");
"and sharply raises Sp. Def.");
static const u8 sKinesisDescription[] = _(
"Distracts the foe.\n"
@ -579,7 +579,7 @@ static const u8 sTransformDescription[] = _(
static const u8 sBubbleDescription[] = _(
"An attack using bubbles.\n"
"May lower the foe's SPEED.");
"May lower the foe's Speed.");
static const u8 sDizzyPunchDescription[] = _(
"A rhythmic punch that may\n"
@ -603,7 +603,7 @@ static const u8 sSplashDescription[] = _(
static const u8 sAcidArmorDescription[] = _(
"Liquifies the user's body\n"
"to sharply raise DEFENSE.");
"to sharply raise Defense.");
static const u8 sCrabhammerDescription[] = _(
"Hammers with a pincer. Has a\n"
@ -635,7 +635,7 @@ static const u8 sHyperFangDescription[] = _(
static const u8 sSharpenDescription[] = _(
"Reduces the polygon count\n"
"and raises ATTACK.");
"and raises Attack.");
static const u8 sConversionDescription[] = _(
"Changes the user's type\n"
@ -711,7 +711,7 @@ static const u8 sAeroblastDescription[] = _(
static const u8 sCottonSporeDescription[] = _(
"Spores cling to the foe,\n"
"sharply reducing SPEED.");
"sharply reducing Speed.");
static const u8 sReversalDescription[] = _(
"Inflicts more damage when\n"
@ -735,7 +735,7 @@ static const u8 sMachPunchDescription[] = _(
static const u8 sScaryFaceDescription[] = _(
"Frightens with a scary face\n"
"to sharply reduce SPEED.");
"to sharply reduce Speed.");
static const u8 sFeintAttackDescription[] = _(
"Draws the foe close, then\n"
@ -746,7 +746,7 @@ static const u8 sSweetKissDescription[] = _(
"look. May cause confusion.");
static const u8 sBellyDrumDescription[] = _(
"Maximizes ATTACK while\n"
"Maximizes Attack while\n"
"sacrificing HP.");
static const u8 sSludgeBombDescription[] = _(
@ -778,12 +778,12 @@ static const u8 sDestinyBondDescription[] = _(
"is also made to faint.");
static const u8 sPerishSongDescription[] = _(
"Any POKéMON hearing this\n"
"Any Pokémon hearing this\n"
"song faints in 3 turns.");
static const u8 sIcyWindDescription[] = _(
"A chilling attack that\n"
"lowers the foe's SPEED.");
"lowers the foe's Speed.");
static const u8 sDetectDescription[] = _(
"Evades attack, but may fail\n"
@ -815,7 +815,7 @@ static const u8 sEndureDescription[] = _(
static const u8 sCharmDescription[] = _(
"Charms the foe and sharply\n"
"reduces its ATTACK.");
"reduces its Attack.");
static const u8 sRolloutDescription[] = _(
"An attack lasting 5 turns\n"
@ -827,7 +827,7 @@ static const u8 sFalseSwipeDescription[] = _(
static const u8 sSwaggerDescription[] = _(
"Confuses the foe, but also\n"
"sharply raises ATTACK.");
"sharply raises Attack.");
static const u8 sMilkDrinkDescription[] = _(
"Recovers up to half the\n"
@ -871,7 +871,7 @@ static const u8 sPresentDescription[] = _(
static const u8 sFrustrationDescription[] = _(
"An attack that is stronger\n"
"if the TRAINER is disliked.");
"if the Trainer is disliked.");
static const u8 sSafeguardDescription[] = _(
"A mystical force prevents\n"
@ -923,11 +923,11 @@ static const u8 sSweetScentDescription[] = _(
static const u8 sIronTailDescription[] = _(
"Attacks with a rock-hard\n"
"tail. May lower DEFENSE.");
"tail. May lower Defense.");
static const u8 sMetalClawDescription[] = _(
"A claw attack that may\n"
"raise the user's ATTACK.");
"raise the user's Attack.");
static const u8 sVitalThrowDescription[] = _(
"Makes the user's move last,\n"
@ -958,16 +958,16 @@ static const u8 sTwisterDescription[] = _(
"to tear at the foe.");
static const u8 sRainDanceDescription[] = _(
"Boosts the power of WATER-\n"
"Boosts the power of Water-\n"
"type moves for 5 turns.");
static const u8 sSunnyDayDescription[] = _(
"Boosts the power of FIRE-\n"
"Boosts the power of Fire-\n"
"type moves for 5 turns.");
static const u8 sCrunchDescription[] = _(
"Crunches with sharp fangs.\n"
"May lower DEFENSE.");
"May lower Defense.");
static const u8 sMirrorCoatDescription[] = _(
"Counters the foe's special\n"
@ -987,7 +987,7 @@ static const u8 sAncientPowerDescription[] = _(
static const u8 sShadowBallDescription[] = _(
"Hurls a black blob that may\n"
"lower the foe's SP. DEF.");
"lower the foe's Sp. Def.");
static const u8 sFutureSightDescription[] = _(
"Heightens inner power to\n"
@ -995,14 +995,14 @@ static const u8 sFutureSightDescription[] = _(
static const u8 sRockSmashDescription[] = _(
"A rock-crushing attack\n"
"that may lower DEFENSE.");
"that may lower Defense.");
static const u8 sWhirlpoolDescription[] = _(
"Traps and hurts the foe in\n"
"a whirlpool for 2 to 5 turns.");
static const u8 sBeatUpDescription[] = _(
"Summons party POKéMON to\n"
"Summons party Pokémon to\n"
"join in the attack.");
static const u8 sFakeOutDescription[] = _(
@ -1039,7 +1039,7 @@ static const u8 sTormentDescription[] = _(
static const u8 sFlatterDescription[] = _(
"Confuses the foe, but\n"
"raises its SP. ATK.");
"raises its Sp. Atk.");
static const u8 sWillOWispDescription[] = _(
"Inflicts a burn on the foe\n"
@ -1050,7 +1050,7 @@ static const u8 sMementoDescription[] = _(
"the foe's abilities.");
static const u8 sFacadeDescription[] = _(
"Boosts ATTACK when burned,\n"
"Boosts Attack when burned,\n"
"paralyzed, or poisoned.");
static const u8 sFocusPunchDescription[] = _(
@ -1170,27 +1170,27 @@ static const u8 sArmThrustDescription[] = _(
"strike the foe 2 to 5 times.");
static const u8 sCamouflageDescription[] = _(
"Alters the POKéMON's type\n"
"Alters the Pokémon's type\n"
"depending on the location.");
static const u8 sTailGlowDescription[] = _(
"Flashes a light that sharply\n"
"raises SP. ATK.");
"raises Sp. Atk.");
static const u8 sLusterPurgeDescription[] = _(
"Attacks with a burst of\n"
"light. May lower SP. DEF.");
"light. May lower Sp. Def.");
static const u8 sMistBallDescription[] = _(
"Attacks with a flurry of\n"
"down. May lower SP. ATK.");
"down. May lower Sp. Atk.");
static const u8 sFeatherDanceDescription[] = _(
"Envelops the foe with down\n"
"to sharply reduce ATTACK.");
"to sharply reduce Attack.");
static const u8 sTeeterDanceDescription[] = _(
"Confuses all POKéMON on\n"
"Confuses all Pokémon on\n"
"the scene.");
static const u8 sBlazeKickDescription[] = _(
@ -1223,7 +1223,7 @@ static const u8 sPoisonFangDescription[] = _(
static const u8 sCrushClawDescription[] = _(
"Tears at the foe with sharp\n"
"claws. May lower DEFENSE.");
"claws. May lower Defense.");
static const u8 sBlastBurnDescription[] = _(
"Powerful, but leaves the\n"
@ -1235,7 +1235,7 @@ static const u8 sHydroCannonDescription[] = _(
static const u8 sMeteorMashDescription[] = _(
"Fires a meteor-like punch.\n"
"May raise ATTACK.");
"May raise Attack.");
static const u8 sAstonishDescription[] = _(
"An attack that may shock\n"
@ -1251,7 +1251,7 @@ static const u8 sAromatherapyDescription[] = _(
static const u8 sFakeTearsDescription[] = _(
"Feigns crying to sharply\n"
"lower the foe's SP. DEF.");
"lower the foe's Sp. Def.");
static const u8 sAirCutterDescription[] = _(
"Hacks with razorlike wind.\n"
@ -1259,7 +1259,7 @@ static const u8 sAirCutterDescription[] = _(
static const u8 sOverheatDescription[] = _(
"Allows a full-power attack,\n"
"but sharply lowers SP. ATK.");
"but sharply lowers Sp. Atk.");
static const u8 sOdorSleuthDescription[] = _(
"Negates the foe's efforts\n"
@ -1267,7 +1267,7 @@ static const u8 sOdorSleuthDescription[] = _(
static const u8 sRockTombDescription[] = _(
"Stops the foe from moving\n"
"with rocks and cuts SPEED.");
"with rocks and cuts Speed.");
static const u8 sSilverWindDescription[] = _(
"A powdery attack that may\n"
@ -1275,7 +1275,7 @@ static const u8 sSilverWindDescription[] = _(
static const u8 sMetalSoundDescription[] = _(
"Emits a horrible screech\n"
"that sharply lowers SP. DEF.");
"that sharply lowers Sp. Def.");
static const u8 sGrassWhistleDescription[] = _(
"Lulls the foe into sleep\n"
@ -1283,10 +1283,10 @@ static const u8 sGrassWhistleDescription[] = _(
static const u8 sTickleDescription[] = _(
"Makes the foe laugh to\n"
"lower ATTACK and DEFENSE.");
"lower Attack and Defense.");
static const u8 sCosmicPowerDescription[] = _(
"Raises DEFENSE and SP. DEF\n"
"Raises Defense and Sp. Def\n"
"with a mystic power.");
static const u8 sWaterSpoutDescription[] = _(
@ -1335,7 +1335,7 @@ static const u8 sIcicleSpearDescription[] = _(
static const u8 sIronDefenseDescription[] = _(
"Hardens the body's surface\n"
"to sharply raise DEFENSE.");
"to sharply raise Defense.");
static const u8 sBlockDescription[] = _(
"Blocks the foe's way to\n"
@ -1343,7 +1343,7 @@ static const u8 sBlockDescription[] = _(
static const u8 sHowlDescription[] = _(
"Howls to raise the spirit\n"
"and boosts ATTACK.");
"and boosts Attack.");
static const u8 sDragonClawDescription[] = _(
"Slashes the foe with sharp\n"
@ -1355,7 +1355,7 @@ static const u8 sFrenzyPlantDescription[] = _(
static const u8 sBulkUpDescription[] = _(
"Bulks up the body to boost\n"
"both ATTACK and DEFENSE.");
"both Attack and Defense.");
static const u8 sBounceDescription[] = _(
"Bounces up, then down the\n"
@ -1363,7 +1363,7 @@ static const u8 sBounceDescription[] = _(
static const u8 sMudShotDescription[] = _(
"Hurls mud at the foe and\n"
"reduces SPEED.");
"reduces Speed.");
static const u8 sPoisonTailDescription[] = _(
"Has a high critical-hit\n"
@ -1386,7 +1386,7 @@ static const u8 sWaterSportDescription[] = _(
"raise resistance to fire.");
static const u8 sCalmMindDescription[] = _(
"Raises SP. ATK and SP. DEF\n"
"Raises Sp. Atk and Sp. Def\n"
"by focusing the mind.");
static const u8 sLeafBladeDescription[] = _(
@ -1395,7 +1395,7 @@ static const u8 sLeafBladeDescription[] = _(
static const u8 sDragonDanceDescription[] = _(
"A mystical dance that ups\n"
"ATTACK and SPEED.");
"Attack and Speed.");
static const u8 sRockBlastDescription[] = _(
"Hurls boulders at the foe\n"
@ -1415,7 +1415,7 @@ static const u8 sDoomDesireDescription[] = _(
static const u8 sPsychoBoostDescription[] = _(
"Allows a full-power attack,\n"
"but sharply lowers SP. ATK.");
"but sharply lowers Sp. Atk.");
static const u8 sROOSTDescription[] = _(
"Restores the user's HP by\n"
@ -1426,8 +1426,8 @@ static const u8 sGRAVITYDescription[] = _(
"negating levitation.");
static const u8 sMIRACLE_EYEDescription[] = _(
"Makes GHOSTS and evasive\n"
"foes easier to hit.");
"Negate evasiveness and\n"
"Dark-type's immunities.");
static const u8 sWAKE_UP_SLAPDescription[] = _(
"Powerful against sleeping\n"
@ -1718,7 +1718,7 @@ static const u8 sDEFOGDescription[] = _(
"lowers evasion.");
static const u8 sTRICK_ROOMDescription[] = _(
"Slower POKéMON get to move\n"
"Slower Pokémon get to move\n"
"first for 5 turns.");
static const u8 sDRACO_METEORDescription[] = _(
@ -2183,7 +2183,7 @@ static const u8 sBELCHDescription[] = _(
static const u8 sROTOTILLERDescription[] = _(
"Ups the Attack and Sp. Atk\n"
"of Grass-type POKéMON.");
"of Grass-type Pokémon.");
static const u8 sSTICKY_WEBDescription[] = _(
"Weaves a sticky net that\n"
@ -2243,7 +2243,7 @@ static const u8 sCRAFTY_SHIELDDescription[] = _(
static const u8 sFLOWER_SHIELDDescription[] = _(
"Raises the Defense of\n"
"Grass-type POKéMON.");
"Grass-type Pokémon.");
static const u8 sGRASSY_TERRAINDescription[] = _(
"The ground turns to grass\n"
@ -2315,7 +2315,7 @@ static const u8 sSPIKY_SHIELDDescription[] = _(
static const u8 sAROMATIC_MISTDescription[] = _(
"Raises the Sp. Def of a\n"
"partner POKéMON.");
"partner Pokémon.");
static const u8 sEERIE_IMPULSEDescription[] = _(
"Exposes the foe to a pulse\n"
@ -2431,7 +2431,7 @@ static const u8 sSPARKLING_ARIADescription[] = _(
static const u8 sICE_HAMMERDescription[] = _(
"Swings the fist to strike.\n"
"Lowers the user's SPEED.");
"Lowers the user's Speed.");
static const u8 sFLORAL_HEALINGDescription[] = _(
"Restores an ally's HP.\n"
@ -2455,7 +2455,7 @@ static const u8 sLEAFAGEDescription[] = _(
static const u8 sSPOTLIGHTDescription[] = _(
"Makes the foe attack the\n"
"spotlighted POKéMON.");
"spotlighted Pokémon.");
static const u8 sTOXIC_THREADDescription[] = _(
"Attacks with a thread that\n"

File diff suppressed because it is too large Load Diff

View File

@ -953,3 +953,26 @@ u8 ItemId_GetSecondaryId(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].secondaryId;
}
bool32 IsPinchBerryItemEffect(u16 holdEffect)
{
switch (holdEffect)
{
case HOLD_EFFECT_ATTACK_UP:
case HOLD_EFFECT_DEFENSE_UP:
case HOLD_EFFECT_SPEED_UP:
case HOLD_EFFECT_SP_ATTACK_UP:
case HOLD_EFFECT_SP_DEFENSE_UP:
case HOLD_EFFECT_CRITICAL_UP:
case HOLD_EFFECT_RANDOM_STAT_UP:
#ifdef HOLD_EFFECT_CUSTAP_BERRY
case HOLD_EFFECT_CUSTAP_BERRY:
#endif
#ifdef HOLD_EFFECT_MICLE_BERRY
case HOLD_EFFECT_MICLE_BERRY:
#endif
return TRUE;
}
return FALSE;
}

View File

@ -4454,7 +4454,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM0_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[i] & ITEM0_X_ATTACK;
@ -4472,7 +4472,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_DEFEND)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[i] & ITEM1_X_DEFEND) >> 4;
@ -4485,7 +4485,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[i] & ITEM1_X_SPEED;
@ -4500,7 +4500,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM2_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[i] & ITEM2_X_ACCURACY) >> 4;
@ -4513,7 +4513,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM2_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[i] & ITEM2_X_SPATK;
@ -4529,7 +4529,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1;
@ -4542,7 +4542,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_DEFENSE)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1;
@ -4555,7 +4555,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1;
@ -4568,7 +4568,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1;
@ -4581,7 +4581,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPDEF)
&& gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1;
@ -4594,7 +4594,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1;
@ -5148,7 +5148,7 @@ static void BufferStatRoseMessage(s32 arg0)
{
gBattlerTarget = gBattlerInMenuId;
StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[arg0]]);
if (B_X_ITEMS_BUFF == GEN_7)
if (B_X_ITEMS_BUFF >= GEN_7)
{
StringCopy(gBattleTextBuff2, gText_StatSharply);
StringAppend(gBattleTextBuff2, gText_StatRose);

View File

@ -897,7 +897,7 @@ void FillHillTrainersParties(void)
// hill trainers.
u32 GetTrainerHillAIFlags(void)
{
return (AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY);
return (AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY);
}
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)

View File

@ -91,7 +91,7 @@
.include "src/region_map.o"
.include "src/decoration.o"
.include "src/slot_machine.o"
.include "src/battle_ai_script_commands.o"
.include "src/battle_ai_main.o"
.include "src/fldeff_misc.o"
.include "src/pokeblock.o"
.include "src/field_specials.o"