mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into hunger_switch2
This commit is contained in:
commit
6df3975fc6
@ -1878,6 +1878,11 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro trytoapplymimicry battler:req, ptr:req
|
||||
various \battler, VARIOUS_TRY_TO_APPLY_MIMICRY
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
|
||||
|
@ -1916,6 +1916,23 @@ BattleScript_EffectPsychicTerrain:
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
call BattleScript_TerrainSeedLoop
|
||||
jumpifabilitypresent ABILITY_MIMICRY, BattleScript_ApplyMimicry
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_ApplyMimicry::
|
||||
savetarget
|
||||
setbyte gBattlerTarget, 0
|
||||
BattleScript_MimicryLoopIter:
|
||||
copybyte sBATTLER, gBattlerTarget
|
||||
trytoapplymimicry BS_TARGET, BattleScript_MimicryLoop_NextBattler
|
||||
copybyte gBattlerAbility, sBATTLER
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_BATTLERTYPECHANGEDTO
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_MimicryLoop_NextBattler:
|
||||
addbyte gBattlerTarget, 0x1
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_MimicryLoopIter
|
||||
restoretarget
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectTopsyTurvy:
|
||||
@ -8015,6 +8032,12 @@ BattleScript_ColorChangeActivates::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_MimicryActivatesEnd3::
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_BATTLERTYPECHANGEDTO
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
end3
|
||||
|
||||
BattleScript_ProteanActivates::
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_PKMNCHANGEDTYPE
|
||||
|
@ -54,6 +54,7 @@ bool32 IsRecycleEncouragedItem(u16 item);
|
||||
bool32 CanKnockOffItem(u8 battler, u16 item);
|
||||
bool32 IsAbilityOfRating(u16 ability, s8 rating);
|
||||
s8 GetAbilityRating(u16 ability);
|
||||
bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability);
|
||||
|
||||
// stat stage checks
|
||||
bool32 AnyStatIsRaised(u8 battlerId);
|
||||
@ -120,7 +121,6 @@ bool32 IsSemiInvulnerable(u8 battlerDef, u16 move);
|
||||
|
||||
// status checks
|
||||
bool32 AI_CanBeBurned(u8 battler, u16 ability);
|
||||
bool32 AI_CanBePoisoned(u8 battler, u16 ability);
|
||||
bool32 AI_CanBeConfused(u8 battler, u16 ability);
|
||||
bool32 AI_CanSleep(u8 battler, u16 ability);
|
||||
bool32 IsBattlerIncapacitated(u8 battler, u16 ability);
|
||||
|
@ -407,6 +407,8 @@ extern const u8 BattleScript_WanderingSpiritActivates[];
|
||||
extern const u8 BattleScript_MirrorArmorReflect[];
|
||||
extern const u8 BattleScript_GooeyActivates[];
|
||||
extern const u8 BattleScript_PastelVeilActivates[];
|
||||
extern const u8 BattleScript_MimicryActivatesEnd3[];
|
||||
extern const u8 BattleScript_ApplyMimicry[];
|
||||
extern const u8 BattleScript_AttackerFormChangeEnd3NoPopup[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -157,8 +157,11 @@ void DoBurmyFormChange(u32 monId);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
||||
u16 GetUsedHeldItem(u8 battler);
|
||||
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
|
||||
void TryToApplyMimicry(u8 battlerId, bool8 various);
|
||||
void TryToRevertMimicry(void);
|
||||
void RestoreBattlerOriginalTypes(u8 battlerId);
|
||||
|
||||
// ability checks
|
||||
// Ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
|
||||
bool32 IsRolePlayBannedAbility(u16 ability);
|
||||
bool32 IsSkillSwapBannedAbility(u16 ability);
|
||||
|
@ -198,6 +198,7 @@
|
||||
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125
|
||||
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126
|
||||
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127
|
||||
#define VARIOUS_TRY_TO_APPLY_MIMICRY 128
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -601,8 +601,9 @@
|
||||
#define STRINGID_SWAPPEDABILITIES 598
|
||||
#define STRINGID_PASTELVEILPROTECTED 599
|
||||
#define STRINGID_PASTELVEILENTERS 600
|
||||
#define STRINGID_BATTLERTYPECHANGEDTO 601
|
||||
|
||||
#define BATTLESTRINGS_COUNT 601
|
||||
#define BATTLESTRINGS_COUNT 602
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -308,6 +308,7 @@
|
||||
#define FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets
|
||||
#define FLAG_THAW_USER (1 << 25)
|
||||
#define FLAG_HIT_IN_SUBSTITUTE (1 << 26) // Hyperspace Fury
|
||||
#define FLAG_TWO_STRIKES (1 << 27) // A move with this flag will strike twice, and may apply its effect on each hit
|
||||
|
||||
// Split defines.
|
||||
#define SPLIT_PHYSICAL 0x0
|
||||
|
@ -3999,7 +3999,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
score += 2;
|
||||
break;
|
||||
case HOLD_EFFECT_TOXIC_ORB:
|
||||
if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility) && AI_CanBePoisoned(battlerDef, AI_DATA->defAbility))
|
||||
if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility))
|
||||
score += 2;
|
||||
break;
|
||||
case HOLD_EFFECT_FLAME_ORB:
|
||||
|
@ -733,28 +733,45 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
else
|
||||
dmg = (critDmg + normalDmg * (critChance - 1)) / critChance;
|
||||
|
||||
// handle dynamic move damage
|
||||
// Handle dynamic move damage
|
||||
switch (gBattleMoves[move].effect)
|
||||
{
|
||||
case EFFECT_LEVEL_DAMAGE:
|
||||
case EFFECT_PSYWAVE:
|
||||
//psywave's expected damage is equal to the user's level
|
||||
dmg = gBattleMons[battlerAtk].level;
|
||||
dmg = gBattleMons[battlerAtk].level * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1);
|
||||
break;
|
||||
case EFFECT_DRAGON_RAGE:
|
||||
dmg = 40;
|
||||
dmg = 40 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1);
|
||||
break;
|
||||
case EFFECT_SONICBOOM:
|
||||
dmg = 20;
|
||||
dmg = 20 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1);
|
||||
break;
|
||||
//case EFFECT_METAL_BURST:
|
||||
//case EFFECT_COUNTER:
|
||||
default:
|
||||
//do not add the random factor, it's an average case analysis
|
||||
//dmg *= (100 - (Random() % 10)) / 100; // add random factor
|
||||
case EFFECT_MULTI_HIT:
|
||||
dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 5 : 3);
|
||||
break;
|
||||
case EFFECT_TRIPLE_KICK:
|
||||
dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 6 : 5);
|
||||
break;
|
||||
case EFFECT_ENDEAVOR:
|
||||
// If target has less HP than user, Endeavor does no damage
|
||||
dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp);
|
||||
break;
|
||||
case EFFECT_SUPER_FANG:
|
||||
dmg = (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND
|
||||
? max(2, gBattleMons[battlerDef].hp * 3 / 4)
|
||||
: max(1, gBattleMons[battlerDef].hp / 2));
|
||||
break;
|
||||
case EFFECT_FINAL_GAMBIT:
|
||||
dmg = gBattleMons[battlerAtk].hp;
|
||||
break;
|
||||
}
|
||||
|
||||
// Handle other multi-strike moves
|
||||
if (gBattleMoves[move].flags & FLAG_TWO_STRIKES)
|
||||
dmg *= 2;
|
||||
else if (move == MOVE_SURGING_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH))
|
||||
dmg *= 3;
|
||||
|
||||
RestoreBattlerData(battlerAtk);
|
||||
RestoreBattlerData(battlerDef);
|
||||
|
||||
@ -1065,6 +1082,16 @@ bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgM
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability)
|
||||
{
|
||||
if (IsBattlerAlive(battlerId) && AI_GetAbility(battlerId) == ability)
|
||||
return TRUE;
|
||||
else if (IsBattlerAlive(BATTLE_PARTNER(battlerId)) && AI_GetAbility(BATTLE_PARTNER(battlerId)) == ability)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// does NOT include ability suppression checks
|
||||
s32 AI_GetAbility(u32 battlerId)
|
||||
{
|
||||
@ -2606,27 +2633,38 @@ bool32 AI_CanSleep(u8 battler, u16 ability)
|
||||
bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove)
|
||||
{
|
||||
if (!AI_CanSleep(battlerDef, defAbility)
|
||||
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|
||||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
|| PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 AI_CanBePoisoned(u8 battler, u16 ability)
|
||||
static bool32 AI_CanPoisonType(u8 battlerAttacker, u8 battlerTarget)
|
||||
{
|
||||
if (ability == ABILITY_IMMUNITY
|
||||
|| IsAbilityOnSide(battler, ABILITY_PASTEL_VEIL)
|
||||
|| gBattleMons[battler].status1 & STATUS1_ANY
|
||||
|| IsAbilityStatusProtected(battler)
|
||||
|| gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD)
|
||||
return ((AI_GetAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS)
|
||||
|| !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL)));
|
||||
}
|
||||
|
||||
static bool32 AI_CanBePoisoned(u8 battlerAtk, u8 battlerDef)
|
||||
{
|
||||
u16 ability = AI_GetAbility(battlerDef);
|
||||
|
||||
if (!(AI_CanPoisonType(battlerAtk, battlerDef))
|
||||
|| gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD
|
||||
|| gBattleMons[battlerDef].status1 & STATUS1_ANY
|
||||
|| ability == ABILITY_IMMUNITY
|
||||
|| ability == ABILITY_COMATOSE
|
||||
|| AI_IsAbilityOnSide(battlerDef, ABILITY_PASTEL_VEIL)
|
||||
|| gBattleMons[battlerDef].status1 & STATUS1_ANY
|
||||
|| IsAbilityStatusProtected(battlerDef)
|
||||
|| AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 ShouldPoisonSelf(u8 battler, u16 ability)
|
||||
{
|
||||
if (AI_CanBePoisoned(battler, ability) && (
|
||||
if (AI_CanBePoisoned(battler, battler) && (
|
||||
ability == ABILITY_MARVEL_SCALE
|
||||
|| ability == ABILITY_POISON_HEAL
|
||||
|| ability == ABILITY_QUICK_FEET
|
||||
@ -2641,7 +2679,7 @@ bool32 ShouldPoisonSelf(u8 battler, u16 ability)
|
||||
|
||||
bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove)
|
||||
{
|
||||
if (!AI_CanBePoisoned(battlerDef, defAbility)
|
||||
if (!AI_CanBePoisoned(battlerAtk, battlerDef)
|
||||
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|
||||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
|| PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove))
|
||||
@ -2654,7 +2692,7 @@ bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 CanBeParayzed(u8 battler, u16 ability)
|
||||
static bool32 AI_CanBeParalyzed(u8 battler, u16 ability)
|
||||
{
|
||||
if (ability == ABILITY_LIMBER
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_ELECTRIC)
|
||||
@ -2666,7 +2704,7 @@ static bool32 CanBeParayzed(u8 battler, u16 ability)
|
||||
|
||||
bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove)
|
||||
{
|
||||
if (!CanBeParayzed(battlerDef, defAbility)
|
||||
if (!AI_CanBeParalyzed(battlerDef, defAbility)
|
||||
|| AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0
|
||||
|| gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD
|
||||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
@ -2744,7 +2782,7 @@ bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 atkGe
|
||||
|| atkGender == defGender
|
||||
|| atkGender == MON_GENDERLESS
|
||||
|| defGender == MON_GENDERLESS
|
||||
|| IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL))
|
||||
|| AI_IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -727,9 +727,11 @@ static const u8 sText_AbilityAllowsOnlyMove[] = _("{B_ATK_ABILITY} allows the\nu
|
||||
static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped Abilities\nwith its target!");
|
||||
static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!");
|
||||
static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!");
|
||||
static const u8 sText_BattlerTypeChangedTo[] = _("{B_BUFF1}'s type\nchanged to {B_BUFF2}!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_BATTLERTYPECHANGEDTO - 12] = sText_BattlerTypeChangedTo,
|
||||
[STRINGID_PASTELVEILENTERS - 12] = sText_PastelVeilEnters,
|
||||
[STRINGID_PASTELVEILPROTECTED -12] = sText_PastelVeilProtected,
|
||||
[STRINGID_SWAPPEDABILITIES - 12] = sText_SwappedAbilities,
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "constants/rgb.h"
|
||||
#include "data.h"
|
||||
#include "constants/party_menu.h"
|
||||
#include "battle_util.h"
|
||||
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
extern struct Evolution gEvolutionTable[][EVOS_PER_MON];
|
||||
@ -8858,6 +8859,7 @@ static void Cmd_various(void)
|
||||
break;
|
||||
}
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
|
||||
TryToRevertMimicry(); // restore the types of Pokémon with Mimicry
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE))
|
||||
@ -9017,6 +9019,21 @@ static void Cmd_various(void)
|
||||
if (gBattleStruct->stickyWebUser != 0xFF)
|
||||
gBattlerAttacker = gBattleStruct->stickyWebUser;
|
||||
break;
|
||||
case VARIOUS_TRY_TO_APPLY_MIMICRY:
|
||||
{
|
||||
bool8 isMimicryDone = FALSE;
|
||||
|
||||
if (GetBattlerAbility(gActiveBattler) == ABILITY_MIMICRY)
|
||||
{
|
||||
TryToApplyMimicry(gActiveBattler, TRUE);
|
||||
isMimicryDone = TRUE;
|
||||
}
|
||||
if (!isMimicryDone)
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
@ -12817,7 +12834,7 @@ static void Cmd_handleballthrow(void)
|
||||
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 0;
|
||||
if (CriticalCapture(odds))
|
||||
{
|
||||
maxShakes = 1; //critical capture doesn't gauarantee capture
|
||||
maxShakes = 1; //critical capture doesn't guarantee capture
|
||||
gBattleSpritesDataPtr->animationData->isCriticalCapture = 1;
|
||||
}
|
||||
else
|
||||
|
@ -1894,6 +1894,57 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
|
||||
return imprisonedMoves;
|
||||
}
|
||||
|
||||
void RestoreBattlerOriginalTypes(u8 battlerId)
|
||||
{
|
||||
gBattleMons[battlerId].type1 = gBaseStats[gBattleMons[battlerId].species].type1;
|
||||
gBattleMons[battlerId].type2 = gBaseStats[gBattleMons[battlerId].species].type2;
|
||||
}
|
||||
|
||||
void TryToApplyMimicry(u8 battlerId, bool8 various)
|
||||
{
|
||||
u32 moveType, move;
|
||||
|
||||
GET_MOVE_TYPE(move, moveType);
|
||||
switch (gFieldStatuses)
|
||||
{
|
||||
case STATUS_FIELD_ELECTRIC_TERRAIN:
|
||||
moveType = TYPE_ELECTRIC;
|
||||
break;
|
||||
case STATUS_FIELD_MISTY_TERRAIN:
|
||||
moveType = TYPE_FAIRY;
|
||||
break;
|
||||
case STATUS_FIELD_GRASSY_TERRAIN:
|
||||
moveType = TYPE_GRASS;
|
||||
break;
|
||||
case STATUS_FIELD_PSYCHIC_TERRAIN:
|
||||
moveType = TYPE_PSYCHIC;
|
||||
break;
|
||||
default:
|
||||
moveType = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (moveType != 0 && !IS_BATTLER_OF_TYPE(battlerId, moveType))
|
||||
{
|
||||
SET_BATTLER_TYPE(battlerId, moveType);
|
||||
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, battlerId, gBattlerPartyIndexes[battlerId])
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff2, moveType);
|
||||
if (!various)
|
||||
BattleScriptPushCursorAndCallback(BattleScript_MimicryActivatesEnd3);
|
||||
}
|
||||
}
|
||||
|
||||
void TryToRevertMimicry(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
ENDTURN_ORDER,
|
||||
@ -2278,6 +2329,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
@ -2288,6 +2340,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_MistyTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
@ -2298,8 +2351,10 @@ u8 DoFieldEndTurnEffects(void)
|
||||
{
|
||||
if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT)
|
||||
&& (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
|
||||
|
||||
TryToRevertMimicry();
|
||||
}
|
||||
BattleScriptExecute(BattleScript_GrassyTerrainHeals);
|
||||
effect++;
|
||||
}
|
||||
@ -2310,6 +2365,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
@ -4390,6 +4446,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_MIMICRY:
|
||||
if (gBattleMons[battler].hp != 0 && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
|
||||
{
|
||||
TryToApplyMimicry(battler, FALSE);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_ENDTURN: // 1
|
||||
@ -8982,34 +9045,30 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
{
|
||||
u32 i, currSpecies;
|
||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||
static const u16 species[][2] = // changed form id, default form id
|
||||
static const u16 species[][3] =
|
||||
{
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
|
||||
{SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE},
|
||||
{SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN},
|
||||
{SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO},
|
||||
{SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE},
|
||||
{SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET},
|
||||
{SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW},
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
|
||||
{SPECIES_MORPEKO_HANGRY, SPECIES_MORPEKO}
|
||||
// Changed Form ID Default Form ID Should change on switch
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU, FALSE},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND, FALSE},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH, TRUE},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN, TRUE},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW, TRUE},
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI, TRUE},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT, TRUE},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT, TRUE},
|
||||
{SPECIES_MORPEKO_HANGRY, SPECIES_MORPEKO, TRUE},
|
||||
};
|
||||
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
|
||||
i = 2;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
||||
for (; i < ARRAY_COUNT(species); i++)
|
||||
for (i = 0; i < ARRAY_COUNT(species); i++)
|
||||
{
|
||||
if (currSpecies == species[i][0])
|
||||
if (currSpecies == species[i][0] && (!isSwitchingOut || species[i][2] == TRUE))
|
||||
{
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &species[i][1]);
|
||||
CalculateMonStats(&party[monId]);
|
||||
|
@ -378,7 +378,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -649,7 +649,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 20,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -2460,7 +2460,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -7267,7 +7267,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -8367,7 +8367,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -8575,7 +8575,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -10726,9 +10726,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
[MOVE_DOUBLE_IRON_BASH] =
|
||||
{
|
||||
#if B_UPDATED_MOVE_DATA >= GEN_8
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES,
|
||||
#else
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES,
|
||||
#endif
|
||||
.effect = EFFECT_DOUBLE_IRON_BASH,
|
||||
.power = 60,
|
||||
@ -10850,7 +10850,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
@ -11480,7 +11480,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
|
||||
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user