mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-30 14:20:42 +01:00
add some RecordItemEffect and RecordAbilityBattle situations, ai checks
This commit is contained in:
parent
bdb480765c
commit
5a26a69ccd
@ -2130,12 +2130,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:
|
||||||
@ -2146,14 +2148,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:
|
||||||
|
@ -2830,7 +2830,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||||||
&& !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
&& !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||||
&& !primary
|
&& !primary
|
||||||
&& (gBattleScripting.moveEffect <= MOVE_EFFECT_TRI_ATTACK || gBattleScripting.moveEffect >= MOVE_EFFECT_SMACK_DOWN)) // Exclude stat lowering effects
|
&& (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 <= MOVE_EFFECT_CONFUSION)
|
&& !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION)
|
||||||
@ -8818,9 +8824,14 @@ static void Cmd_various(void)
|
|||||||
return;
|
return;
|
||||||
case VARIOUS_SET_SIMPLE_BEAM:
|
case VARIOUS_SET_SIMPLE_BEAM:
|
||||||
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability)
|
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability)
|
||||||
|| gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE
|
|| gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE)
|
||||||
|| GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
|
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
|
||||||
@ -8834,13 +8845,18 @@ static void Cmd_various(void)
|
|||||||
return;
|
return;
|
||||||
case VARIOUS_TRY_ENTRAINMENT:
|
case VARIOUS_TRY_ENTRAINMENT:
|
||||||
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|
||||||
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability)
|
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
|| GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
@ -8850,6 +8866,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;
|
||||||
@ -10760,6 +10777,11 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
|||||||
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
|| activeBattlerAbility == ABILITY_WHITE_SMOKE)
|
||||||
&& !certain && gCurrentMove != MOVE_CURSE)
|
&& !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)
|
||||||
@ -13369,13 +13391,18 @@ static void Cmd_setroom(void)
|
|||||||
static void Cmd_tryswapabilities(void)
|
static void Cmd_tryswapabilities(void)
|
||||||
{
|
{
|
||||||
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|
||||||
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability)
|
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
|| GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
@ -13389,6 +13416,7 @@ static void Cmd_tryswapabilities(void)
|
|||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void Cmd_tryimprison(void)
|
static void Cmd_tryimprison(void)
|
||||||
{
|
{
|
||||||
@ -14742,9 +14770,14 @@ static void Cmd_unused(void)
|
|||||||
|
|
||||||
static void Cmd_tryworryseed(void)
|
static void Cmd_tryworryseed(void)
|
||||||
{
|
{
|
||||||
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability)
|
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||||
|| GetBattlerHoldEffect(gBattlerTarget, TRUE) == HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
|
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
|
||||||
@ -14810,6 +14843,7 @@ void BS_JumpIfHoldEffect(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RecordItemEffectBattle(battler, holdEffect);
|
||||||
gLastUsedItem = gBattleMons[battler].item; // For B_LAST_USED_ITEM
|
gLastUsedItem = gBattleMons[battler].item; // For B_LAST_USED_ITEM
|
||||||
gBattlescriptCurrInstr += 12;
|
gBattlescriptCurrInstr += 12;
|
||||||
}
|
}
|
||||||
|
@ -5363,8 +5363,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& IsBattlerAlive(gBattlerAttacker)
|
&& IsBattlerAlive(gBattlerAttacker)
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (IsMoveMakingContact(move, gBattlerAttacker))
|
&& (IsMoveMakingContact(move, gBattlerAttacker)))
|
||||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
switch (gBattleMons[gBattlerAttacker].ability)
|
switch (gBattleMons[gBattlerAttacker].ability)
|
||||||
{
|
{
|
||||||
@ -5380,6 +5379,11 @@ 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] = ABILITY_MUMMY;
|
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability = gBattleStruct->overwrittenAbilities[gBattlerAttacker] = ABILITY_MUMMY;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_MummyActivates;
|
gBattlescriptCurrInstr = BattleScript_MummyActivates;
|
||||||
@ -5392,8 +5396,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& IsBattlerAlive(gBattlerAttacker)
|
&& IsBattlerAlive(gBattlerAttacker)
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_ABILITY_SHIELD)
|
|
||||||
{
|
{
|
||||||
switch (gBattleMons[gBattlerAttacker].ability)
|
switch (gBattleMons[gBattlerAttacker].ability)
|
||||||
{
|
{
|
||||||
@ -5412,6 +5415,11 @@ 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user