Fixes Triple Kick effect and Z move damage calc (#2983)

This commit is contained in:
BuffelSaft 2023-05-31 22:25:16 +12:00 committed by GitHub
commit 2e08277a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 40 deletions

View File

@ -822,47 +822,47 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness,
else else
dmg = (critDmg + normalDmg * (critChance - 1)) / critChance; dmg = (critDmg + normalDmg * (critChance - 1)) / critChance;
// Handle dynamic move damage if (!gBattleStruct->zmove.active)
switch (gBattleMoves[move].effect)
{ {
case EFFECT_LEVEL_DAMAGE: // Handle dynamic move damage
case EFFECT_PSYWAVE: switch (gBattleMoves[move].effect)
dmg = gBattleMons[battlerAtk].level * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); {
break; case EFFECT_LEVEL_DAMAGE:
case EFFECT_DRAGON_RAGE: case EFFECT_PSYWAVE:
dmg = 40 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); dmg = gBattleMons[battlerAtk].level * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1);
break; break;
case EFFECT_SONICBOOM: case EFFECT_DRAGON_RAGE:
dmg = 20 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); dmg = 40 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1);
break; break;
case EFFECT_MULTI_HIT: case EFFECT_SONICBOOM:
dmg *= (AI_DATA->abilities[battlerAtk] == ABILITY_SKILL_LINK ? 5 : 3); dmg = 20 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1);
break; break;
case EFFECT_TRIPLE_KICK: case EFFECT_MULTI_HIT:
dmg *= (AI_DATA->abilities[battlerAtk] == ABILITY_SKILL_LINK ? 6 : 5); dmg *= (AI_DATA->abilities[battlerAtk] == ABILITY_SKILL_LINK ? 5 : 3);
break; break;
case EFFECT_ENDEAVOR: case EFFECT_ENDEAVOR:
// If target has less HP than user, Endeavor does no damage // If target has less HP than user, Endeavor does no damage
dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp);
break; break;
case EFFECT_SUPER_FANG: case EFFECT_SUPER_FANG:
dmg = (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND dmg = (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND
? max(2, gBattleMons[battlerDef].hp * 3 / 4) ? max(2, gBattleMons[battlerDef].hp * 3 / 4)
: max(1, gBattleMons[battlerDef].hp / 2)); : max(1, gBattleMons[battlerDef].hp / 2));
break; break;
case EFFECT_FINAL_GAMBIT: case EFFECT_FINAL_GAMBIT:
dmg = gBattleMons[battlerAtk].hp; dmg = gBattleMons[battlerAtk].hp;
break; break;
}
// Handle other multi-strike moves
if (gBattleMoves[move].flags & FLAG_TWO_STRIKES)
dmg *= 2;
else if (gBattleMoves[move].flags & FLAG_THREE_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH))
dmg *= 3;
if (dmg == 0)
dmg = 1;
} }
// Handle other multi-strike moves
if (gBattleMoves[move].flags & FLAG_TWO_STRIKES)
dmg *= 2;
else if (gBattleMoves[move].flags & FLAG_THREE_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH))
dmg *= 3;
if (dmg == 0)
dmg = 1;
} }
else else
{ {

View File

@ -8499,7 +8499,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = gBattleStruct->presentBasePower; basePower = gBattleStruct->presentBasePower;
break; break;
case EFFECT_TRIPLE_KICK: case EFFECT_TRIPLE_KICK:
basePower *= (4 - gMultiHitCounter); if (gMultiHitCounter == 0) // Calc damage with max BP for move consideration
basePower *= 6;
else
basePower *= (4 - gMultiHitCounter);
break; break;
case EFFECT_SPIT_UP: case EFFECT_SPIT_UP:
basePower = 100 * gDisableStructs[battlerAtk].stockpileCounter; basePower = 100 * gDisableStructs[battlerAtk].stockpileCounter;