Skip to content

Commit

Permalink
Added Power Spot
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmagier committed Mar 27, 2021
1 parent 65886e0 commit b1c2f5b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 1 deletion.
4 changes: 4 additions & 0 deletions calc/src/desc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface RawDesc {
isProtected?: boolean;
isReflect?: boolean;
isBattery?: boolean;
isPowerSpot?: boolean;
isSwitching?: 'out' | 'in';
moveBP?: number;
moveName: string;
Expand Down Expand Up @@ -825,6 +826,9 @@ function buildDescription(description: RawDesc, attacker: Pokemon, defender: Pok
if (description.isBattery) {
output += ' Battery boosted ';
}
if (description.isPowerSpot) {
output += ' Power Spot boosted ';
}
if (description.isSwitching) {
output += ' switching boosted ';
}
Expand Down
2 changes: 2 additions & 0 deletions calc/src/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class Side implements State.Side {
isFriendGuard: boolean;
isAuroraVeil: boolean;
isBattery: boolean;
isPowerSpot: boolean;
isSwitching?: 'out' | 'in';

constructor(side: State.Side = {}) {
Expand All @@ -91,6 +92,7 @@ export class Side implements State.Side {
this.isFriendGuard = !!side.isFriendGuard;
this.isAuroraVeil = !!side.isAuroraVeil;
this.isBattery = !!side.isBattery;
this.isPowerSpot = !!side.isPowerSpot;
this.isSwitching = side.isSwitching;
}

Expand Down
5 changes: 5 additions & 0 deletions calc/src/mechanics/gen56.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ export function calculateBWXY(
desc.isBattery = true;
}

if (field.attackerSide.isPowerSpot) {
bpMods.push(0x14cc);
desc.isPowerSpot = true;
}

if (isAerilate || isPixilate || isRefrigerate || isNormalize) {
bpMods.push(0x14cd);
desc.attackerAbility = attacker.ability;
Expand Down
5 changes: 5 additions & 0 deletions calc/src/mechanics/gen78.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,11 @@ export function calculateBPModsSMSS(
desc.isBattery = true;
}

if (field.attackerSide.isPowerSpot) {
bpMods.push(0x14CD);
desc.isPowerSpot = true;
}

// Sheer Force does not power up max moves or remove the effects (SadisticMystic)
const analyticBoost = attacker.hasAbility('Analytic') &&
(turnOrder !== 'first' || field.defenderSide.isSwitching === 'out');
Expand Down
1 change: 1 addition & 0 deletions calc/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export namespace State {
isFriendGuard?: boolean;
isAuroraVeil?: boolean;
isBattery?: boolean;
isPowerSpot?: boolean;
isSwitching?: 'out' | 'in';
}
}
10 changes: 10 additions & 0 deletions src/honkalculate.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,16 @@
<input class="visually-hidden" type="checkbox" id="batteryR" />
<label class="btn btn-xxwide" for="batteryR">Battery</label>
</div>
<div class="btn-group gen-specific g8">
<div class="left" title="Has this Pok&eacute;mon's power been boosted by an ally's Power Spot ability?">
<input class="visually-hidden" type="checkbox" id="powerSpotL" />
<label class="btn btn-xxwide" for="powerSpotL">Power Spot</label>
</div>
<div class="right" title="Has this Pok&eacute;mon's power been boosted by an ally's Power Spot ability?">
<input class="visually-hidden" type="checkbox" id="powerSpotR" />
<label class="btn btn-xxwide" for="powerSpotR">Power Spot</label>
</div>
</div>
<div class="btn-group gen-specific g2 g3 g4 g5 g6 g7 g8">
<div class="left" title="Is the defending Pok&eacute;mon switching out?">
<input class="visually-hidden" type="checkbox" id="switchingL" />
Expand Down
11 changes: 11 additions & 0 deletions src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,17 @@
<label class="btn btn-xxwide" for="batteryR">Battery</label>
</div></td>
</tr>
<tr class="gen-specific g8">
<td><div class="left" title="Is the Pok&eacute;mon boosted by an ally's Power Spot ability?">
<div hidden id="selectPowerSpotInstruction">Is the Pok&eacute;mon boosted by an ally's Power Spot ability?</div>
<input aria-describedby="selectPowerSpotInstruction" class="visually-hidden calc-trigger" type="checkbox" id="powerSpotL" />
<label class="btn btn-xxwide" for="powerSpotL">Power Spot</label>
</div></td>
<td><div class="right" title="Is the Pok&eacute;mon boosted by an ally's Power Spot ability?">
<input aria-describedby="selectPowerSpotInstruction" class="visually-hidden calc-trigger" type="checkbox" id="powerSpotR" />
<label class="btn btn-xxwide" for="powerSpotR">Power Spot</label>
</div></td>
</tr>
<tr class="gen-specific g2 g3 g4 g5 g6 g7 g8">
<td><div class="left" title="Is the defending Pok&eacute;mon switching out?">
<div hidden id="selectSwitchingInstruction">Is the defending Pok&eacute;mon switching out?</div>
Expand Down
3 changes: 2 additions & 1 deletion src/js/shared_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ function createField() {
var isFriendGuard = [$("#friendGuardL").prop("checked"), $("#friendGuardR").prop("checked")];
var isAuroraVeil = [$("#auroraVeilL").prop("checked"), $("#auroraVeilR").prop("checked")];
var isBattery = [$("#batteryL").prop("checked"), $("#batteryR").prop("checked")];
var isPowerSpot = [$("#powerSpotL").prop("checked"), $("#powerSpotR").prop("checked")];
// TODO: support switching in as well!
var isSwitchingOut = [$("#switchingL").prop("checked"), $("#switchingR").prop("checked")];

Expand All @@ -856,7 +857,7 @@ function createField() {
isReflect: isReflect[i], isLightScreen: isLightScreen[i],
isProtected: isProtected[i], isSeeded: isSeeded[i], isForesight: isForesight[i],
isTailwind: isTailwind[i], isHelpingHand: isHelpingHand[i], isFriendGuard: isFriendGuard[i],
isAuroraVeil: isAuroraVeil[i], isBattery: isBattery[i], isSwitching: isSwitchingOut[i] ? 'out' : undefined
isAuroraVeil: isAuroraVeil[i], isBattery: isBattery[i], isPowerSpot: isPowerSpot[i], isSwitching: isSwitchingOut[i] ? 'out' : undefined
});
};
return new calc.Field({
Expand Down
11 changes: 11 additions & 0 deletions src/randoms.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,17 @@
<label class="btn btn-xxwide" for="batteryR">Battery</label>
</div></td>
</tr>
<tr class="gen-specific g8">
<td><div class="left" title="Is the Pok&eacute;mon boosted by an ally's Power Spot ability?">
<div hidden id="selectPowerSpotInstruction">Is the Pok&eacute;mon boosted by an ally's Power Spot ability?</div>
<input aria-describedby="selectPowerSpotInstruction" class="visually-hidden calc-trigger" type="checkbox" id="powerSpotL" />
<label class="btn btn-xxwide" for="powerSpotR">Power Spot</label>
</div></td>
<td><div class="right" title="Is the Pok&eacute;mon boosted by an ally's Power Spot ability?">
<input aria-describedby="selectPowerSpotInstruction" class="visually-hidden calc-trigger" type="checkbox" id="powerSpotR" />
<label class="btn btn-xxwide" for="powerSpotR">Power Spot</label>
</div></td>
</tr>
<tr class="gen-specific g2 g3 g4 g5 g6 g7 g8">
<td><div class="left" title="Is the defending Pok&eacute;mon switching out?">
<div hidden id="selectSwitchingInstruction">Is the defending Pok&eacute;mon switching out?</div>
Expand Down

0 comments on commit b1c2f5b

Please sign in to comment.