More corrections

This commit is contained in:
LOuroboros 2023-06-19 04:17:24 -03:00
parent 48c04f936a
commit 2bf88502a7
6 changed files with 9 additions and 22 deletions

View File

@ -1513,13 +1513,6 @@ BattleScript_DefDown::
BattleScript_DefDown_Ret: BattleScript_DefDown_Ret:
return return
BattleScript_ReduceDefenseAndFlinch::
modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDownAndFlinch_Ret, ANIM_ON
setmoveeffect MOVE_EFFECT_FLINCH
seteffectprimary
BattleScript_DefDownAndFlinch_Ret:
return
BattleScript_EffectPurify: BattleScript_EffectPurify:
attackcanceler attackcanceler
attackstring attackstring

View File

@ -471,7 +471,6 @@ extern const u8 BattleScript_SpikesActivates[];
extern const u8 BattleScript_BerserkGeneRet[]; extern const u8 BattleScript_BerserkGeneRet[];
extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[];
extern const u8 BattleScript_DefDown[]; extern const u8 BattleScript_DefDown[];
extern const u8 BattleScript_ReduceDefenseAndFlinch[];
// zmoves // zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[]; extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -236,6 +236,6 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId);
void RemoveConfusionStatus(u8 battlerId); void RemoveConfusionStatus(u8 battlerId);
u8 GetBattlerGender(u8 battlerId); u8 GetBattlerGender(u8 battlerId);
bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2); bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2);
u32 CalcMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance); u32 CalcSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -2639,16 +2639,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10; score -= 10;
break; break;
case EFFECT_JUNGLE_HEALING: case EFFECT_JUNGLE_HEALING:
if (AtMaxHp(battlerAtk) if (AtMaxHp(battlerAtk)
&& AtMaxHp(BATTLE_PARTNER(battlerAtk)) && AtMaxHp(BATTLE_PARTNER(battlerAtk))
&& !(gBattleMons[battlerAtk].status1 & STATUS1_ANY) && !(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
&& !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY)) && !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY))
score -= 10; score -= 10;
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; break;
case EFFECT_TAKE_HEART: case EFFECT_TAKE_HEART:
if ((!(gBattleMons[battlerAtk].status1 & STATUS1_ANY) if ((!(gBattleMons[battlerAtk].status1 & STATUS1_ANY)

View File

@ -3864,8 +3864,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
break; break;
case MOVE_EFFECT_TRIPLE_ARROWS: case MOVE_EFFECT_TRIPLE_ARROWS:
{ {
u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, CalcMoveSecondaryEffectChance(gBattlerAttacker, 50)); u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, CalcSecondaryEffectChance(gBattlerAttacker, 50));
u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, CalcMoveSecondaryEffectChance(gBattlerAttacker, 30)); u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, CalcSecondaryEffectChance(gBattlerAttacker, 30));
if (randomFlinchChance && battlerAbility != ABILITY_INNER_FOCUS && GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber) if (randomFlinchChance && battlerAbility != ABILITY_INNER_FOCUS && GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH]; gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
@ -3892,7 +3892,7 @@ static void Cmd_seteffectwithchance(void)
{ {
CMD_ARGS(); CMD_ARGS();
u32 percentChance = CalcMoveSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance); u32 percentChance = CalcSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance);
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleScripting.moveEffect) && gBattleScripting.moveEffect)

View File

@ -10930,7 +10930,7 @@ bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2)
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2); return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
} }
u32 CalcMoveSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance) u32 CalcSecondaryEffectChance(u8 battlerId, u8 secondaryEffectChance)
{ {
if (GetBattlerAbility(battlerId) == ABILITY_SERENE_GRACE) if (GetBattlerAbility(battlerId) == ABILITY_SERENE_GRACE)
secondaryEffectChance *= 2; secondaryEffectChance *= 2;