Skip to content

Commit

Permalink
More Booster Energy improvements
Browse files Browse the repository at this point in the history
Treat Booster Energy as consumed when P/Q is active
+ #546 nits because Git wouldn't let me push to the branch.
  • Loading branch information
thejetou committed Sep 22, 2023
1 parent 08cfee4 commit ec49f1c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 67 deletions.
15 changes: 6 additions & 9 deletions calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export function calculateSMSSSV(
(move.named('Dream Eater') &&
(!(defender.hasStatus('slp') || defender.hasAbility('Comatose')))) ||
(move.named('Steel Roller') && !field.terrain) ||
(move.named('Poltergeist') && !defender.item)
(move.named('Poltergeist') && (!defender.item || isQPActive(defender, field)))
) {
return result;
}
Expand Down Expand Up @@ -706,7 +706,8 @@ export function calculateBasePowerSMSSSV(
desc.moveBP = basePower;
break;
case 'Acrobatics':
basePower = move.bp * (attacker.hasItem('Flying Gem') || !attacker.item ? 2 : 1);
basePower = move.bp * (attacker.hasItem('Flying Gem') ||
(!attacker.item || isQPActive(attacker, field)) ? 2 : 1);
desc.moveBP = basePower;
break;
case 'Assurance':
Expand Down Expand Up @@ -870,7 +871,7 @@ export function calculateBPModsSMSSSV(
// Move effects

let resistedKnockOffDamage =
!defender.item ||
(!defender.item || isQPActive(defender, field)) ||
(defender.named('Dialga-Origin') && defender.hasItem('Adamant Crystal')) ||
(defender.named('Palkia-Origin') && defender.hasItem('Lustrous Globe')) ||
// Griseous Core for gen 9, Griseous Orb otherwise
Expand Down Expand Up @@ -1266,9 +1267,7 @@ export function calculateAtModsSMSSSV(
atMods.push(3072);
}

if (
(isQPActive(attacker, field))
) {
if (isQPActive(attacker, field)) {
if (
(move.category === 'Physical' && getQPBoostedStat(attacker) === 'atk') ||
(move.category === 'Special' && getQPBoostedStat(attacker) === 'spa')
Expand Down Expand Up @@ -1417,9 +1416,7 @@ export function calculateDfModsSMSSSV(
dfMods.push(3072);
}

if (
(isQPActive(defender, field))
) {
if (isQPActive(defender, field)) {
if (
(hitsPhysical && getQPBoostedStat(defender) === 'def') ||
(!hitsPhysical && getQPBoostedStat(defender) === 'spd')
Expand Down
10 changes: 4 additions & 6 deletions calc/src/mechanics/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,23 +426,21 @@ export function getQPBoostedStat(
export function isQPActive(
pokemon: Pokemon,
field: Field
): boolean {
) {
if (!pokemon.boostedStat) {
return false;
}

const weather = field.weather || '';
const terrain = field.terrain;
if (

return (
(pokemon.hasAbility('Protosynthesis') &&
(weather.includes('Sun') || pokemon.hasItem('Booster Energy'))) ||
(pokemon.hasAbility('Quark Drive') &&
(terrain === 'Electric' || pokemon.hasItem('Booster Energy'))) ||
(pokemon.boostedStat !== 'auto')
) {
return true;
}
return false;
);
}

export function getFinalDamage(
Expand Down
35 changes: 17 additions & 18 deletions src/honkalculate.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,24 +411,23 @@
<label>Ability</label>
<select class="ability terrain-trigger"></select>
<input hidden type="checkbox" title= "Is this ability active?" class="abilityToggle">
<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>

<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>
</div>
<div class="gen-specific g2 g3 g4 g5 g6 g7 g8 g9">
<label>Item</label>
Expand Down
34 changes: 17 additions & 17 deletions src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,23 +461,23 @@
<label for="abilityL1">Ability</label>
<select class="ability terrain-trigger calc-trigger" id="abilityL1"></select>
<input hidden type="checkbox" title= "Is this ability active?" class="abilityToggle calc-trigger">
<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>
<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>
</div>
<div class="gen-specific g2 g3 g4 g5 g6 g7 g8 g9">
<label for="itemL1">Item</label>
Expand Down
34 changes: 17 additions & 17 deletions src/randoms.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,23 +460,23 @@
<label for="abilityL1">Ability</label>
<select class="ability terrain-trigger calc-trigger" id="abilityL1"></select>
<input hidden type="checkbox" title= "Is this ability active?" class="abilityToggle calc-trigger">
<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>
<select hidden aria-label="Allies fainted" class="alliesFainted calc-trigger">
<option value="0">Zero allies fainted</option>
<option value="1">One ally fainted</option>
<option value="2">Two allies fainted</option>
<option value="3">Three allies fainted</option>
<option value="4">Four allies fainted</option>
<option value="5">Five allies fainted</option>
</select>
<select hidden aria-label="Boosted Stat" title="What stat is boosted by this ability?" class="boostedStat calc-trigger">
<option value="auto">Auto-Select</option>
<option value="">Inactive</option>
<option value="atk">Attack</option>
<option value="def">Defense</option>
<option value="spa">Special Attack</option>
<option value="spd">Special Defense</option>
<option value="spe">Speed</option>
</select>
</div>
<div class="gen-specific g2 g3 g4 g5 g6 g7 g8 g9">
<label for="itemL1">Item</label>
Expand Down

0 comments on commit ec49f1c

Please sign in to comment.