mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Merge pull request #2471 from ghoulslash/be/gen9items
Start Gen9 Hold Effects
This commit is contained in:
commit
1bfc922c72
@ -1311,6 +1311,13 @@
|
|||||||
.4byte \ptr
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro jumpifholdeffect battler:req, holdEffect:req, ptr:req
|
||||||
|
callnative BS_JumpIfHoldEffect
|
||||||
|
.byte \battler
|
||||||
|
.2byte \holdEffect
|
||||||
|
.4byte \ptr
|
||||||
|
.endm
|
||||||
|
|
||||||
@ various command changed to more readable macros
|
@ various command changed to more readable macros
|
||||||
.macro cancelmultiturnmoves battler:req
|
.macro cancelmultiturnmoves battler:req
|
||||||
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
|
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
|
||||||
|
@ -7171,6 +7171,7 @@ BattleScript_GulpMissileGulping::
|
|||||||
tryfaintmon BS_ATTACKER
|
tryfaintmon BS_ATTACKER
|
||||||
getbattlerfainted BS_ATTACKER
|
getbattlerfainted BS_ATTACKER
|
||||||
jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGulping
|
jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGulping
|
||||||
|
jumpifholdeffect BS_ATTACKER, HOLD_EFFECT_CLEAR_AMULET, BattleScript_GulpMissileNoSecondEffectGulping
|
||||||
jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping
|
jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping
|
||||||
jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping
|
jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping
|
||||||
jumpifability BS_ATTACKER, ABILITY_WHITE_SMOKE, BattleScript_GulpMissileNoSecondEffectGulping
|
jumpifability BS_ATTACKER, ABILITY_WHITE_SMOKE, BattleScript_GulpMissileNoSecondEffectGulping
|
||||||
@ -8488,6 +8489,7 @@ BattleScript_IntimidateLoop:
|
|||||||
jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_IntimidateLoopIncrement
|
jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_IntimidateLoopIncrement
|
||||||
jumpiftargetally BattleScript_IntimidateLoopIncrement
|
jumpiftargetally BattleScript_IntimidateLoopIncrement
|
||||||
jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateLoopIncrement
|
jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateLoopIncrement
|
||||||
|
jumpifholdeffect BS_TARGET, HOLD_EFFECT_CLEAR_AMULET, BattleScript_IntimidatePrevented_Item
|
||||||
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented
|
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented
|
||||||
jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented
|
jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented
|
||||||
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented
|
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented
|
||||||
@ -8518,6 +8520,7 @@ BattleScript_IntimidateEnd:
|
|||||||
BattleScript_IntimidatePrevented:
|
BattleScript_IntimidatePrevented:
|
||||||
call BattleScript_AbilityPopUp
|
call BattleScript_AbilityPopUp
|
||||||
pause B_WAIT_TIME_LONG
|
pause B_WAIT_TIME_LONG
|
||||||
|
BattleScript_IntimidatePrevented_Item:
|
||||||
setbyte gBattleCommunication STAT_ATK
|
setbyte gBattleCommunication STAT_ATK
|
||||||
stattextbuffer BS_TARGET
|
stattextbuffer BS_TARGET
|
||||||
printstring STRINGID_STATWASNOTLOWERED
|
printstring STRINGID_STATWASNOTLOWERED
|
||||||
|
@ -152,6 +152,14 @@
|
|||||||
#define HOLD_EFFECT_HEAVY_DUTY_BOOTS 173
|
#define HOLD_EFFECT_HEAVY_DUTY_BOOTS 173
|
||||||
#define HOLD_EFFECT_THROAT_SPRAY 174
|
#define HOLD_EFFECT_THROAT_SPRAY 174
|
||||||
|
|
||||||
|
// Gen9 hold effects
|
||||||
|
#define HOLD_EFFECT_ABILITY_SHIELD 175
|
||||||
|
#define HOLD_EFFECT_CLEAR_AMULET 176
|
||||||
|
#define HOLD_EFFECT_MIRROR_HERB 177 // Not implemented.
|
||||||
|
#define HOLD_EFFECT_PUNCHING_GLOVE 178
|
||||||
|
#define HOLD_EFFECT_COVERT_CLOAK 179
|
||||||
|
#define HOLD_EFFECT_LOADED_DICE 180
|
||||||
|
|
||||||
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
|
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
|
||||||
|
|
||||||
// Terrain seed params
|
// Terrain seed params
|
||||||
|
@ -2142,12 +2142,14 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
break;
|
break;
|
||||||
case EFFECT_SKILL_SWAP:
|
case EFFECT_SKILL_SWAP:
|
||||||
if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE || AI_DATA->abilities[battlerDef] == ABILITY_NONE
|
if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE || AI_DATA->abilities[battlerDef] == ABILITY_NONE
|
||||||
|| IsSkillSwapBannedAbility(AI_DATA->abilities[battlerAtk]) || IsSkillSwapBannedAbility(AI_DATA->abilities[battlerDef]))
|
|| IsSkillSwapBannedAbility(AI_DATA->abilities[battlerAtk]) || IsSkillSwapBannedAbility(AI_DATA->abilities[battlerDef])
|
||||||
|
|| AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
score -= 10;
|
score -= 10;
|
||||||
break;
|
break;
|
||||||
case EFFECT_WORRY_SEED:
|
case EFFECT_WORRY_SEED:
|
||||||
if (AI_DATA->abilities[battlerDef] == ABILITY_INSOMNIA
|
if (AI_DATA->abilities[battlerDef] == ABILITY_INSOMNIA
|
||||||
|| IsWorrySeedBannedAbility(AI_DATA->abilities[battlerDef]))
|
|| IsWorrySeedBannedAbility(AI_DATA->abilities[battlerDef])
|
||||||
|
|| AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
score -= 10;
|
score -= 10;
|
||||||
break;
|
break;
|
||||||
case EFFECT_GASTRO_ACID:
|
case EFFECT_GASTRO_ACID:
|
||||||
@ -2158,14 +2160,16 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
case EFFECT_ENTRAINMENT:
|
case EFFECT_ENTRAINMENT:
|
||||||
if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE
|
if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE
|
||||||
|| IsEntrainmentBannedAbilityAttacker(AI_DATA->abilities[battlerAtk])
|
|| IsEntrainmentBannedAbilityAttacker(AI_DATA->abilities[battlerAtk])
|
||||||
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef]))
|
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef])
|
||||||
|
|| AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
score -= 10;
|
score -= 10;
|
||||||
break;
|
break;
|
||||||
case EFFECT_CORE_ENFORCER:
|
case EFFECT_CORE_ENFORCER:
|
||||||
break;
|
break;
|
||||||
case EFFECT_SIMPLE_BEAM:
|
case EFFECT_SIMPLE_BEAM:
|
||||||
if (AI_DATA->abilities[battlerDef] == ABILITY_SIMPLE
|
if (AI_DATA->abilities[battlerDef] == ABILITY_SIMPLE
|
||||||
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef]))
|
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef])
|
||||||
|
|| AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
score -= 10;
|
score -= 10;
|
||||||
break;
|
break;
|
||||||
case EFFECT_SNATCH:
|
case EFFECT_SNATCH:
|
||||||
|
@ -1634,7 +1634,8 @@ bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat)
|
|||||||
if ((gBattleMons[battler].statStages[stat] > MIN_STAT_STAGE && battlerAbility != ABILITY_CONTRARY)
|
if ((gBattleMons[battler].statStages[stat] > MIN_STAT_STAGE && battlerAbility != ABILITY_CONTRARY)
|
||||||
|| (battlerAbility == ABILITY_CONTRARY && gBattleMons[battler].statStages[stat] < MAX_STAT_STAGE))
|
|| (battlerAbility == ABILITY_CONTRARY && gBattleMons[battler].statStages[stat] < MAX_STAT_STAGE))
|
||||||
{
|
{
|
||||||
if (battlerAbility == ABILITY_CLEAR_BODY
|
if (AI_DATA->holdEffects[battler] == HOLD_EFFECT_CLEAR_AMULET
|
||||||
|
|| battlerAbility == ABILITY_CLEAR_BODY
|
||||||
|| battlerAbility == ABILITY_WHITE_SMOKE
|
|| battlerAbility == ABILITY_WHITE_SMOKE
|
||||||
|| battlerAbility == ABILITY_FULL_METAL_BODY)
|
|| battlerAbility == ABILITY_FULL_METAL_BODY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1711,7 +1712,8 @@ bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_HYPER_CUTTER)
|
&& defAbility != ABILITY_HYPER_CUTTER
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1727,7 +1729,8 @@ bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_BIG_PECKS)
|
&& defAbility != ABILITY_BIG_PECKS
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1741,7 +1744,8 @@ bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CONTRARY
|
&& defAbility != ABILITY_CONTRARY
|
||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE)
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1756,7 +1760,8 @@ bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CONTRARY
|
&& defAbility != ABILITY_CONTRARY
|
||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE)
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1771,7 +1776,8 @@ bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CONTRARY
|
&& defAbility != ABILITY_CONTRARY
|
||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE)
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1785,7 +1791,8 @@ bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_KEEN_EYE)
|
&& defAbility != ABILITY_KEEN_EYE
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1799,7 +1806,8 @@ bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility)
|
|||||||
&& defAbility != ABILITY_CONTRARY
|
&& defAbility != ABILITY_CONTRARY
|
||||||
&& defAbility != ABILITY_CLEAR_BODY
|
&& defAbility != ABILITY_CLEAR_BODY
|
||||||
&& defAbility != ABILITY_FULL_METAL_BODY
|
&& defAbility != ABILITY_FULL_METAL_BODY
|
||||||
&& defAbility != ABILITY_WHITE_SMOKE)
|
&& defAbility != ABILITY_WHITE_SMOKE
|
||||||
|
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_CLEAR_AMULET)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2826,12 +2826,21 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||||||
// Just in case this flag is still set
|
// Just in case this flag is still set
|
||||||
gBattleScripting.moveEffect &= ~MOVE_EFFECT_CERTAIN;
|
gBattleScripting.moveEffect &= ~MOVE_EFFECT_CERTAIN;
|
||||||
|
|
||||||
if (battlerAbility == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
if ((battlerAbility == ABILITY_SHIELD_DUST
|
||||||
&& !primary && gBattleScripting.moveEffect <= 9)
|
|| GetBattlerHoldEffect(gEffectBattler, TRUE) == HOLD_EFFECT_COVERT_CLOAK)
|
||||||
|
&& !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||||
|
&& !primary
|
||||||
|
&& (gBattleScripting.moveEffect <= MOVE_EFFECT_TRI_ATTACK || gBattleScripting.moveEffect >= MOVE_EFFECT_SMACK_DOWN)) // Exclude stat lowering effects
|
||||||
|
{
|
||||||
|
if (battlerAbility == ABILITY_SHIELD_DUST)
|
||||||
|
RecordAbilityBattle(gEffectBattler, battlerAbility);
|
||||||
|
else
|
||||||
|
RecordItemEffectBattle(gEffectBattler, HOLD_EFFECT_COVERT_CLOAK);
|
||||||
INCREMENT_RESET_RETURN
|
INCREMENT_RESET_RETURN
|
||||||
|
}
|
||||||
|
|
||||||
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||||
&& !primary && gBattleScripting.moveEffect <= 7)
|
&& !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION)
|
||||||
INCREMENT_RESET_RETURN
|
INCREMENT_RESET_RETURN
|
||||||
|
|
||||||
if (TestSheerForceFlag(gBattlerAttacker, gCurrentMove) && affectsUser != MOVE_EFFECT_AFFECTS_USER)
|
if (TestSheerForceFlag(gBattlerAttacker, gCurrentMove) && affectsUser != MOVE_EFFECT_AFFECTS_USER)
|
||||||
@ -5019,6 +5028,7 @@ static void Cmd_playstatchangeanimation(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
|
else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
|
||||||
|
&& GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_CLEAR_AMULET
|
||||||
&& ability != ABILITY_CLEAR_BODY
|
&& ability != ABILITY_CLEAR_BODY
|
||||||
&& ability != ABILITY_FULL_METAL_BODY
|
&& ability != ABILITY_FULL_METAL_BODY
|
||||||
&& ability != ABILITY_WHITE_SMOKE
|
&& ability != ABILITY_WHITE_SMOKE
|
||||||
@ -8776,7 +8786,8 @@ static void Cmd_various(void)
|
|||||||
gBattlerAbility = BATTLE_PARTNER(gActiveBattler);
|
gBattlerAbility = BATTLE_PARTNER(gActiveBattler);
|
||||||
i = GetBattlerAbility(gBattlerAbility);
|
i = GetBattlerAbility(gBattlerAbility);
|
||||||
if (IsBattlerAlive(gBattlerAbility)
|
if (IsBattlerAlive(gBattlerAbility)
|
||||||
&& (i == ABILITY_RECEIVER || i == ABILITY_POWER_OF_ALCHEMY))
|
&& (i == ABILITY_RECEIVER || i == ABILITY_POWER_OF_ALCHEMY)
|
||||||
|
&& GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
{
|
{
|
||||||
switch (gBattleMons[gActiveBattler].ability)
|
switch (gBattleMons[gActiveBattler].ability)
|
||||||
{ // Can't copy these abilities.
|
{ // Can't copy these abilities.
|
||||||
@ -8882,6 +8893,12 @@ static void Cmd_various(void)
|
|||||||
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability)
|
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability)
|
||||||
|| gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE)
|
|| gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE)
|
||||||
{
|
{
|
||||||
|
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
|
}
|
||||||
|
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -8897,10 +8914,16 @@ static void Cmd_various(void)
|
|||||||
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|
||||||
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability))
|
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
{
|
{
|
||||||
|
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (gBattleMons[gBattlerTarget].ability == gBattleMons[gBattlerAttacker].ability)
|
if (gBattleMons[gBattlerTarget].ability == gBattleMons[gBattlerAttacker].ability)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
@ -8910,6 +8933,7 @@ static void Cmd_various(void)
|
|||||||
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = gBattleMons[gBattlerAttacker].ability;
|
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = gBattleMons[gBattlerAttacker].ability;
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case VARIOUS_SET_LAST_USED_ABILITY:
|
case VARIOUS_SET_LAST_USED_ABILITY:
|
||||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||||
@ -10906,11 +10930,17 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
gBattlescriptCurrInstr = BattleScript_ButItFailed;
|
gBattlescriptCurrInstr = BattleScript_ButItFailed;
|
||||||
return STAT_CHANGE_DIDNT_WORK;
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
}
|
}
|
||||||
else if ((activeBattlerAbility == ABILITY_CLEAR_BODY
|
else if ((GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET
|
||||||
|
|| activeBattlerAbility == ABILITY_CLEAR_BODY
|
||||||
|| activeBattlerAbility == ABILITY_FULL_METAL_BODY
|
|| activeBattlerAbility == ABILITY_FULL_METAL_BODY
|
||||||
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
||||||
&& !affectsUser && !certain && gCurrentMove != MOVE_CURSE)
|
&& !affectsUser && !certain && gCurrentMove != MOVE_CURSE)
|
||||||
{
|
{
|
||||||
|
if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gActiveBattler, HOLD_EFFECT_CLEAR_AMULET);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||||
{
|
{
|
||||||
if (gSpecialStatuses[gActiveBattler].statLowered)
|
if (gSpecialStatuses[gActiveBattler].statLowered)
|
||||||
@ -10981,6 +11011,12 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
}
|
}
|
||||||
else if (activeBattlerAbility == ABILITY_SHIELD_DUST && flags == 0)
|
else if (activeBattlerAbility == ABILITY_SHIELD_DUST && flags == 0)
|
||||||
{
|
{
|
||||||
|
RecordAbilityBattle(gActiveBattler, ABILITY_SHIELD_DUST);
|
||||||
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
|
}
|
||||||
|
else if (flags == 0 && GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_COVERT_CLOAK)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gActiveBattler, HOLD_EFFECT_COVERT_CLOAK);
|
||||||
return STAT_CHANGE_DIDNT_WORK;
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
}
|
}
|
||||||
else // try to decrease
|
else // try to decrease
|
||||||
@ -13530,10 +13566,16 @@ static void Cmd_tryswapabilities(void)
|
|||||||
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|
||||||
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability))
|
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
{
|
{
|
||||||
|
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
@ -13547,6 +13589,7 @@ static void Cmd_tryswapabilities(void)
|
|||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void Cmd_tryimprison(void)
|
static void Cmd_tryimprison(void)
|
||||||
{
|
{
|
||||||
@ -14883,6 +14926,12 @@ static void Cmd_tryworryseed(void)
|
|||||||
{
|
{
|
||||||
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability))
|
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
{
|
{
|
||||||
|
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
|
}
|
||||||
|
else if (GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerTarget, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -14937,6 +14986,23 @@ void BS_CalcMetalBurstDmg(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BS_JumpIfHoldEffect(void)
|
||||||
|
{
|
||||||
|
u8 battler = gBattlescriptCurrInstr[5];
|
||||||
|
u16 holdEffect = T1_READ_16(gBattlescriptCurrInstr + 6);
|
||||||
|
|
||||||
|
if (GetBattlerHoldEffect(battler, TRUE) == holdEffect)
|
||||||
|
{
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(battler, holdEffect);
|
||||||
|
gLastUsedItem = gBattleMons[battler].item; // For B_LAST_USED_ITEM
|
||||||
|
gBattlescriptCurrInstr += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool32 CriticalCapture(u32 odds)
|
static bool32 CriticalCapture(u32 odds)
|
||||||
{
|
{
|
||||||
#if B_CRITICAL_CAPTURE == TRUE
|
#if B_CRITICAL_CAPTURE == TRUE
|
||||||
|
@ -2882,7 +2882,8 @@ u8 DoBattlerEndTurnEffects(void)
|
|||||||
{
|
{
|
||||||
u16 battlerAbility = GetBattlerAbility(gActiveBattler);
|
u16 battlerAbility = GetBattlerAbility(gActiveBattler);
|
||||||
if (gDisableStructs[gActiveBattler].octolock
|
if (gDisableStructs[gActiveBattler].octolock
|
||||||
&& !(battlerAbility == ABILITY_CLEAR_BODY
|
&& !(GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET
|
||||||
|
|| battlerAbility == ABILITY_CLEAR_BODY
|
||||||
|| battlerAbility == ABILITY_FULL_METAL_BODY
|
|| battlerAbility == ABILITY_FULL_METAL_BODY
|
||||||
|| battlerAbility == ABILITY_WHITE_SMOKE))
|
|| battlerAbility == ABILITY_WHITE_SMOKE))
|
||||||
{
|
{
|
||||||
@ -3811,6 +3812,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
|||||||
{
|
{
|
||||||
SetRandomMultiHitCounter();
|
SetRandomMultiHitCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
|
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
|
||||||
}
|
}
|
||||||
else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES)
|
else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES)
|
||||||
@ -5441,6 +5443,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
case ABILITY_STANCE_CHANGE:
|
case ABILITY_STANCE_CHANGE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerAttacker, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
|
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_MummyActivates;
|
gBattlescriptCurrInstr = BattleScript_MummyActivates;
|
||||||
@ -5472,6 +5480,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
case ABILITY_ZEN_MODE:
|
case ABILITY_ZEN_MODE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
||||||
|
{
|
||||||
|
RecordItemEffectBattle(gBattlerAttacker, HOLD_EFFECT_ABILITY_SHIELD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability;
|
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability;
|
||||||
gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
|
gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = gBattleMons[gBattlerTarget].ability;
|
||||||
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = gLastUsedAbility;
|
gBattleMons[gBattlerTarget].ability = gBattleStruct->overwrittenAbilities[gBattlerTarget] = gLastUsedAbility;
|
||||||
@ -8186,6 +8200,8 @@ u32 GetBattlerHoldEffectParam(u8 battlerId)
|
|||||||
|
|
||||||
bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
|
bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
|
||||||
{
|
{
|
||||||
|
u16 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE);
|
||||||
|
|
||||||
if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||||
{
|
{
|
||||||
if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory)
|
if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory)
|
||||||
@ -8193,11 +8209,11 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
|
|||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH)
|
else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH || atkHoldEffect == HOLD_EFFECT_PUNCHING_GLOVE)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if (GetBattlerHoldEffect(battlerAtk, TRUE) == HOLD_EFFECT_PROTECTIVE_PADS)
|
else if (atkHoldEffect == HOLD_EFFECT_PROTECTIVE_PADS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -9072,6 +9088,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
|||||||
if (moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item))
|
if (moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item))
|
||||||
MulModifier(&modifier, holdEffectModifier);
|
MulModifier(&modifier, holdEffectModifier);
|
||||||
break;
|
break;
|
||||||
|
case HOLD_EFFECT_PUNCHING_GLOVE:
|
||||||
|
if (gBattleMoves[move].flags & FLAG_IRON_FIST_BOOST)
|
||||||
|
MulModifier(&modifier, UQ_4_12(1.1));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move effect
|
// move effect
|
||||||
@ -10864,4 +10884,10 @@ static void SetRandomMultiHitCounter()
|
|||||||
else
|
else
|
||||||
gMultiHitCounter += 2;
|
gMultiHitCounter += 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (gMultiHitCounter < 4 && GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LOADED_DICE)
|
||||||
|
{
|
||||||
|
// If roll 4 or 5 Loaded Dice doesn't do anything. Otherwise it rolls the number of hits as 5 minus a random integer from 0 to 1 inclusive.
|
||||||
|
gMultiHitCounter = 5 - (Random() & 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user