mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 07:03:40 +01:00
Applied fixes and corrections (Jun 2023)
This commit is contained in:
parent
81bb299e7f
commit
9896f20eb8
@ -443,7 +443,7 @@ BattleScript_EffectTakeHeart::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
cureifburnedparalysedorpoisoned BattleScript_EffectTakeHeart_TryToRaiseStats
|
||||
cureifburnedparalysedorpoisoned BattleScript_CalmMindTryToRaiseStats
|
||||
attackanimation
|
||||
waitanimation
|
||||
updatestatusicon BS_ATTACKER
|
||||
@ -453,11 +453,6 @@ BattleScript_EffectTakeHeart::
|
||||
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CalmMindStatRaise
|
||||
goto BattleScript_CantRaiseMultipleStats
|
||||
|
||||
BattleScript_EffectTakeHeart_TryToRaiseStats:
|
||||
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
|
||||
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
|
||||
goto BattleScript_CantRaiseMultipleStats
|
||||
|
||||
BattleScript_EffectTripleArrows::
|
||||
setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS
|
||||
goto BattleScript_EffectHit
|
||||
@ -1520,7 +1515,6 @@ BattleScript_DefDown_Ret:
|
||||
|
||||
BattleScript_ReduceDefenseAndFlinch::
|
||||
modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDownAndFlinch_Ret, ANIM_ON
|
||||
jumpifability BS_TARGET, ABILITY_INNER_FOCUS, BattleScript_DefDownAndFlinch_Ret
|
||||
setmoveeffect MOVE_EFFECT_FLINCH
|
||||
seteffectprimary
|
||||
BattleScript_DefDownAndFlinch_Ret:
|
||||
@ -6389,6 +6383,7 @@ BattleScript_EffectCalmMind::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
BattleScript_CalmMindTryToRaiseStats::
|
||||
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
|
||||
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats
|
||||
BattleScript_CalmMindDoMoveAnim::
|
||||
|
@ -236,6 +236,6 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId);
|
||||
void RemoveConfusionStatus(u8 battlerId);
|
||||
u8 GetBattlerGender(u8 battlerId);
|
||||
bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2);
|
||||
u32 GetMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance);
|
||||
u32 CalcMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
@ -2644,8 +2644,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
&& !(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
|
||||
&& !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY))
|
||||
score -= 10;
|
||||
else if (AI_DATA->hpPercents[battlerAtk] >= 90 || AI_DATA->hpPercents[BATTLE_PARTNER(battlerAtk)] >= 90)
|
||||
score -= 9; //No point in healing, but should at least do it if nothing better
|
||||
else if (gBattleMons[battlerAtk].status1 & STATUS1_ANY
|
||||
|| gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY
|
||||
|| AI_DATA->hpPercents[battlerAtk] >= 90
|
||||
|| AI_DATA->hpPercents[BATTLE_PARTNER(battlerAtk)] >= 90)
|
||||
score -= 9; // No point in healing, but should at least do it if there's nothing better or if it's afflicted by a status ailment.
|
||||
break;
|
||||
case EFFECT_TAKE_HEART:
|
||||
if ((!(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
|
||||
@ -2654,6 +2657,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
|| PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_AROMATHERAPY))
|
||||
&& !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)
|
||||
&& !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_PLACEHOLDER:
|
||||
return 0; // cannot even select
|
||||
@ -4893,9 +4897,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
//break;
|
||||
case EFFECT_JUNGLE_HEALING:
|
||||
if (ShouldRecover(battlerAtk, battlerDef, move, 25)
|
||||
|| ShouldRecover(battlerAtk, BATTLE_PARTNER(battlerDef), move, 25)
|
||||
|| ShouldRecover(BATTLE_PARTNER(battlerAtk), battlerDef, move, 25)
|
||||
|| ShouldRecover(BATTLE_PARTNER(battlerAtk), BATTLE_PARTNER(battlerDef), move, 25)
|
||||
|| gBattleMons[battlerAtk].status1 & STATUS1_ANY
|
||||
|| gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY)
|
||||
score += 3;
|
||||
|
@ -3864,25 +3864,19 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
break;
|
||||
case MOVE_EFFECT_TRIPLE_ARROWS:
|
||||
{
|
||||
u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, GetMoveSecondaryEffectChance(gBattlerAttacker, 50));
|
||||
u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, GetMoveSecondaryEffectChance(gBattlerAttacker, 30));
|
||||
u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, CalcMoveSecondaryEffectChance(gBattlerAttacker, 50));
|
||||
u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, CalcMoveSecondaryEffectChance(gBattlerAttacker, 30));
|
||||
|
||||
if (randomLowerDefenseChance && randomFlinchChance)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_ReduceDefenseAndFlinch;
|
||||
}
|
||||
else if (randomLowerDefenseChance && !randomFlinchChance)
|
||||
if (randomFlinchChance && battlerAbility != ABILITY_INNER_FOCUS && GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
|
||||
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
|
||||
|
||||
if (randomLowerDefenseChance)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_DefDown;
|
||||
}
|
||||
else if (randomFlinchChance
|
||||
&& !randomLowerDefenseChance
|
||||
&& battlerAbility != ABILITY_INNER_FOCUS
|
||||
&& GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
|
||||
else
|
||||
{
|
||||
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
}
|
||||
@ -3898,7 +3892,7 @@ static void Cmd_seteffectwithchance(void)
|
||||
{
|
||||
CMD_ARGS();
|
||||
|
||||
u32 percentChance = GetMoveSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance);
|
||||
u32 percentChance = CalcMoveSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance);
|
||||
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleScripting.moveEffect)
|
||||
|
@ -10930,10 +10930,10 @@ bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2)
|
||||
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
|
||||
}
|
||||
|
||||
u32 GetMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance)
|
||||
u32 CalcMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance)
|
||||
{
|
||||
if (GetBattlerAbility(battlerId) == ABILITY_SERENE_GRACE)
|
||||
return (secondaryEffectChance * 2);
|
||||
secondaryEffectChance *= 2;
|
||||
|
||||
return secondaryEffectChance;
|
||||
}
|
||||
|
@ -12764,7 +12764,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
.secondaryEffectChance = 100,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.priority = 0,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_HIGH_CRIT,
|
||||
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_HIGH_CRIT,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
.zMoveEffect = Z_EFFECT_NONE,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user