Post cherrypick corrections and improvements

-Made BattleScript_EffectTakeHeart use modifybattlerstatstage
-Optimized usage of BattleScript_EffectInfernalParade
-Tweaked the way in which Triple Arrows' increased crit. hit chance is handled
-Optimized syntax for case MOVE_EFFECT_TRIPLE_ARROWS in SetMoveEffect
-Optimized case EFFECT_INFERNAL_PARADE in CalcMoveBasePower
 -Infernal Parade is not known to interact with Comatose, so Eduardo and I will extrapolate that here
-Added AI conditionals for some of the effects
-Made Triage notice Jungle Healing and moves that use its effect
This commit is contained in:
LOuroboros 2023-03-26 20:09:21 -03:00
parent 000077f671
commit ed9e860400
7 changed files with 26 additions and 33 deletions

View File

@ -479,27 +479,14 @@ BattleScript_AxeKickHitFromAtkString:
end end
BattleScript_EffectTakeHeart:: BattleScript_EffectTakeHeart::
@ TO DO: Use modifybattlerstatstage here once PR #2470 is merged.
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
playstatchangeanimation BS_ATTACKER, BIT_SPATK, 0 modifybattlerstatstage BS_ATTACKER, STAT_SPATK, INCREASE, 1, BattleScript_TakeHeartTrySpDef, ANIM_ON
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TakeHeartTrySpDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_TakeHeartTrySpDef: BattleScript_TakeHeartTrySpDef:
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
playstatchangeanimation BS_ATTACKER, BIT_SPDEF, 0 modifybattlerstatstage BS_ATTACKER, STAT_SPDEF, INCREASE, 1, BattleScript_TakeHeart_MoveEnd, ANIM_ON
setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TakeHeart_MoveEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_TakeHeart_MoveEnd: BattleScript_TakeHeart_MoveEnd:
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectInfernalParade::
setmoveeffect MOVE_EFFECT_BURN
goto BattleScript_EffectHit
BattleScript_EffectTripleArrows:: BattleScript_EffectTripleArrows::
setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS
goto BattleScript_EffectHit goto BattleScript_EffectHit
@ -3527,6 +3514,7 @@ BattleScript_AbsorbHealBlock::
tryfaintmon BS_TARGET tryfaintmon BS_TARGET
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectInfernalParade::
BattleScript_EffectBurnHit:: BattleScript_EffectBurnHit::
setmoveeffect MOVE_EFFECT_BURN setmoveeffect MOVE_EFFECT_BURN
goto BattleScript_EffectHit goto BattleScript_EffectHit

View File

@ -457,11 +457,11 @@ extern const u8 BattleScript_DampPreventsAftermath[];
extern const u8 BattleScript_HealingWishActivates[]; extern const u8 BattleScript_HealingWishActivates[];
extern const u8 BattleScript_LunarDanceActivates[]; extern const u8 BattleScript_LunarDanceActivates[];
extern const u8 BattleScript_ShellTrapSetUp[]; extern const u8 BattleScript_ShellTrapSetUp[];
extern const u8 BattleScript_DefDown[];
extern const u8 BattleScript_CouldntFullyProtect[]; extern const u8 BattleScript_CouldntFullyProtect[];
extern const u8 BattleScript_MoveEffectStockpileWoreOff[]; extern const u8 BattleScript_MoveEffectStockpileWoreOff[];
extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_StealthRockActivates[];
extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_SpikesActivates[];
extern const u8 BattleScript_DefDown[];
// zmoves // zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[]; extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -1788,6 +1788,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
case EFFECT_RESTORE_HP: case EFFECT_RESTORE_HP:
case EFFECT_SOFTBOILED: case EFFECT_SOFTBOILED:
case EFFECT_ROOST: case EFFECT_ROOST:
case EFFECT_JUNGLE_HEALING:
if (AtMaxHp(battlerAtk)) if (AtMaxHp(battlerAtk))
score -= 10; score -= 10;
else if (AI_DATA->hpPercents[battlerAtk] >= 90) else if (AI_DATA->hpPercents[battlerAtk] >= 90)
@ -2610,6 +2611,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
if (gBattleMons[battlerAtk].hp <= gBattleMons[battlerAtk].maxHP / 3) if (gBattleMons[battlerAtk].hp <= gBattleMons[battlerAtk].maxHP / 3)
score -= 10; score -= 10;
break;*/ break;*/
case EFFECT_TAKE_HEART:
if (!AnyPartyMemberStatused(battlerAtk, FALSE) || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
score -= 10;
break;
case EFFECT_PLACEHOLDER: case EFFECT_PLACEHOLDER:
return 0; // cannot even select return 0; // cannot even select
} // move effect checks } // move effect checks
@ -3475,6 +3480,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT)
score++; score++;
break; break;
case EFFECT_JUNGLE_HEALING:
if (ShouldRecover(battlerAtk, battlerDef, move, 25)
|| (ShouldRecover(BATTLE_PARTNER(battlerAtk), battlerDef, move, 25) && ShouldRecover(BATTLE_PARTNER(battlerAtk), BATTLE_PARTNER(battlerDef), move, 25)))
score += 3;
break;
case EFFECT_TOXIC: case EFFECT_TOXIC:
case EFFECT_POISON: case EFFECT_POISON:
case EFFECT_BARB_BARRAGE: case EFFECT_BARB_BARRAGE:
@ -3721,8 +3731,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_WISH: case EFFECT_WISH:
case EFFECT_HEAL_BELL: case EFFECT_HEAL_BELL:
case EFFECT_TAKE_HEART:
if (ShouldUseWishAromatherapy(battlerAtk, battlerDef, move)) if (ShouldUseWishAromatherapy(battlerAtk, battlerDef, move))
score += 7; score += 3;
break; break;
case EFFECT_THIEF: case EFFECT_THIEF:
{ {

View File

@ -4726,6 +4726,7 @@ s8 GetMovePriority(u32 battlerId, u16 move)
case EFFECT_SOFTBOILED: case EFFECT_SOFTBOILED:
case EFFECT_ABSORB: case EFFECT_ABSORB:
case EFFECT_ROOST: case EFFECT_ROOST:
case EFFECT_JUNGLE_HEALING:
priority += 3; priority += 3;
break; break;
} }

View File

@ -2082,8 +2082,7 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi
#if B_AFFECTION_MECHANICS == TRUE #if B_AFFECTION_MECHANICS == TRUE
+ 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254) + 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254)
#endif #endif
+ (abilityAtk == ABILITY_SUPER_LUCK) + (abilityAtk == ABILITY_SUPER_LUCK);
+ (gBattleMoves[move].effect == EFFECT_TRIPLE_ARROWS);
if (critChance >= ARRAY_COUNT(sCriticalHitChance)) if (critChance >= ARRAY_COUNT(sCriticalHitChance))
critChance = ARRAY_COUNT(sCriticalHitChance) - 1; critChance = ARRAY_COUNT(sCriticalHitChance) - 1;
@ -3802,7 +3801,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
break; break;
case MOVE_EFFECT_TRIPLE_ARROWS: case MOVE_EFFECT_TRIPLE_ARROWS:
{ {
u32 randomChance = Random() % 100; u8 randomChance = Random() % 100;
if (randomChance < 50) // Chance to reduce a foe's Defense by 1 stat stage. if (randomChance < 50) // Chance to reduce a foe's Defense by 1 stat stage.
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -3810,15 +3809,12 @@ void SetMoveEffect(bool32 primary, u32 certain)
} }
if (randomChance >= 50 && randomChance <= 80) // Chance to cause a foe to flinch. if (randomChance >= 50 && randomChance <= 80) // Chance to cause a foe to flinch.
{ {
if (battlerAbility == ABILITY_INNER_FOCUS) if (battlerAbility == ABILITY_INNER_FOCUS && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{ {
if (primary == TRUE || certain == MOVE_EFFECT_CERTAIN) gLastUsedAbility = ABILITY_INNER_FOCUS;
{ gBattlerAbility = gEffectBattler;
gLastUsedAbility = ABILITY_INNER_FOCUS; RecordAbilityBattle(gEffectBattler, ABILITY_INNER_FOCUS);
gBattlerAbility = gEffectBattler; gBattlescriptCurrInstr = BattleScript_FlinchPrevention;
RecordAbilityBattle(gEffectBattler, ABILITY_INNER_FOCUS);
gBattlescriptCurrInstr = BattleScript_FlinchPrevention;
}
} }
else else
{ {

View File

@ -8627,6 +8627,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = 120 * gBattleMons[battlerDef].hp / gBattleMons[battlerDef].maxHP; basePower = 120 * gBattleMons[battlerDef].hp / gBattleMons[battlerDef].maxHP;
break; break;
case EFFECT_HEX: case EFFECT_HEX:
case EFFECT_INFERNAL_PARADE:
if (gBattleMons[battlerDef].status1 & STATUS1_ANY || GetBattlerAbility(battlerDef) == ABILITY_COMATOSE) if (gBattleMons[battlerDef].status1 & STATUS1_ANY || GetBattlerAbility(battlerDef) == ABILITY_COMATOSE)
basePower *= 2; basePower *= 2;
break; break;
@ -8780,10 +8781,6 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
if (IsBattlerTerrainAffected(gBattlerAttacker, STATUS_FIELD_ELECTRIC_TERRAIN)) if (IsBattlerTerrainAffected(gBattlerAttacker, STATUS_FIELD_ELECTRIC_TERRAIN))
MulModifier(&basePower, UQ_4_12(1.5)); MulModifier(&basePower, UQ_4_12(1.5));
break; break;
case EFFECT_INFERNAL_PARADE:
if (gBattleMons[battlerDef].status1 & STATUS1_ANY)
basePower *= 2;
break;
} }
// Move-specific base power changes // Move-specific base power changes

View File

@ -12737,7 +12737,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.secondaryEffectChance = 100, .secondaryEffectChance = 100,
.target = MOVE_TARGET_SELECTED, .target = MOVE_TARGET_SELECTED,
.priority = 0, .priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_HIGH_CRIT,
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
.zMoveEffect = Z_EFFECT_NONE, .zMoveEffect = Z_EFFECT_NONE,
}, },