Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Steely Spirit from an ally #652

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions calc/src/desc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface RawDesc {
isAuroraVeil?: boolean;
isFlowerGiftAttacker?: boolean;
isFlowerGiftDefender?: boolean;
isSteelySpiritAttacker?: boolean;
isFriendGuard?: boolean;
isHelpingHand?: boolean;
isCritical?: boolean;
Expand Down Expand Up @@ -939,6 +940,9 @@ function buildDescription(description: RawDesc, attacker: Pokemon, defender: Pok
if (description.isFlowerGiftAttacker) {
output += 'with an ally\'s Flower Gift ';
}
if (description.isSteelySpiritAttacker) {
output += 'with an ally\'s Steely Spirit ';
}
if (description.isBattery) {
output += 'Battery 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 @@ -91,6 +91,7 @@ export class Side implements State.Side {
isAuroraVeil: boolean;
isBattery: boolean;
isPowerSpot: boolean;
isSteelySpirit: boolean;
isSwitching?: 'out' | 'in';

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

Expand Down
8 changes: 8 additions & 0 deletions calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,14 @@ export function calculateAtModsSMSSSV(
desc.isFlowerGiftAttacker = true;
}

if (
field.attackerSide.isSteelySpirit &&
move.hasType('Steel')
) {
atMods.push(6144);
desc.isSteelySpiritAttacker = true;
}

if ((defender.hasAbility('Thick Fat') && move.hasType('Fire', 'Ice')) ||
(defender.hasAbility('Water Bubble') && move.hasType('Fire')) ||
(defender.hasAbility('Purifying Salt') && move.hasType('Ghost'))) {
Expand Down
1 change: 1 addition & 0 deletions calc/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export namespace State {
isAuroraVeil?: boolean;
isBattery?: boolean;
isPowerSpot?: boolean;
isSteelySpirit?: boolean;
isSwitching?: 'out' | 'in';
}
}
32 changes: 32 additions & 0 deletions calc/src/test/calc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,38 @@ describe('calc', () => {
});
});
});

inGens(8, 9, ({gen, calculate, Pokemon, Move, Field}) => {
test('Steely Spirit should boost Steel-type moves as a field effect.', () => {
const pokemon = Pokemon('Perrserker', {
ability: 'Battle Armor',
});

const move = Move('Iron Head');

let result = calculate(pokemon, pokemon, move);

expect(result.desc()).toBe(
'0 Atk Perrserker Iron Head vs. 0 HP / 0 Def Perrserker: 46-55 (16.3 - 19.5%) -- possible 6HKO'
);

const field = Field({attackerSide: {isSteelySpirit: true}});

result = calculate(pokemon, pokemon, move, field);

expect(result.desc()).toBe(
'0 Atk Perrserker with an ally\'s Steely Spirit Iron Head vs. 0 HP / 0 Def Perrserker: 70-83 (24.9 - 29.5%) -- 99.9% chance to 4HKO'
);

pokemon.ability = 'Steely Spirit' as AbilityName;

result = calculate(pokemon, pokemon, move, field);

expect(result.desc()).toBe(
'0 Atk Steely Spirit Perrserker with an ally\'s Steely Spirit Iron Head vs. 0 HP / 0 Def Perrserker: 105-124 (37.3 - 44.1%) -- guaranteed 3HKO'
);
});
});
});


Expand Down
11 changes: 11 additions & 0 deletions src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,17 @@
<label class="btn btn-xxwide" for="flowerGiftR">Flower Gift</label>
</div></td>
</tr>
<tr class="gen-specific g8 g9">
<td><div class="left" title="Is the Pok&eacute;mon affected by an ally's Steely Spirit?">
<div hidden id="selectSteelySpiritInstruction">Is the Pok&eacute;mon affected by an ally's Steely Spirit?</div>
<input aria-describedby="selectSteelySpiritInstruction" class="visually-hidden calc-trigger" type="checkbox" id="steelySpiritL" />
<label class="btn btn-xxwide" for="steelySpiritL">Steely Spirit</label>
</div></td>
<td><div class="right" title="Is the Pok&eacute;mon affected by an ally's Steely Spirit?">
<input aria-describedby="selectSteelySpiritInstruction" class="visually-hidden calc-trigger" type="checkbox" id="steelySpiritR" />
<label class="btn btn-xxwide" for="steelySpiritR">Steely Spirit</label>
</div></td>
</tr>
<tr class="gen-specific g5 g6 g7 g8 g9">
<td><div class="left" title="Is the Pok&eacute;mon protected by an ally's Friend Guard?">
<div hidden id="selectFriendGuardInstruction">Is the Pok&eacute;mon protected by an ally's Friend Guard?</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 @@ -1188,6 +1188,7 @@ function createField() {
var isHelpingHand = [$("#helpingHandL").prop("checked"), $("#helpingHandR").prop("checked")];
var isTailwind = [$("#tailwindL").prop("checked"), $("#tailwindR").prop("checked")];
var isFlowerGift = [$("#flowerGiftL").prop("checked"), $("#flowerGiftR").prop("checked")];
var isSteelySpirit = [$("#steelySpiritL").prop("checked"), $("#steelySpiritR").prop("checked")];
var isFriendGuard = [$("#friendGuardL").prop("checked"), $("#friendGuardR").prop("checked")];
var isAuroraVeil = [$("#auroraVeilL").prop("checked"), $("#auroraVeilR").prop("checked")];
var isBattery = [$("#batteryL").prop("checked"), $("#batteryR").prop("checked")];
Expand All @@ -1200,7 +1201,7 @@ function createField() {
spikes: spikes[i], isSR: isSR[i], steelsurge: steelsurge[i],
vinelash: vinelash[i], wildfire: wildfire[i], cannonade: cannonade[i], volcalith: volcalith[i],
isReflect: isReflect[i], isLightScreen: isLightScreen[i],
isProtected: isProtected[i], isSeeded: isSeeded[i], isForesight: isForesight[i],
isProtected: isProtected[i], isSeeded: isSeeded[i], isForesight: isForesight[i], isSteelySpirit: isSteelySpirit[i],
isTailwind: isTailwind[i], isHelpingHand: isHelpingHand[i], isFlowerGift: isFlowerGift[i], isFriendGuard: isFriendGuard[i],
isAuroraVeil: isAuroraVeil[i], isBattery: isBattery[i], isPowerSpot: isPowerSpot[i], isSwitching: isSwitchingOut[i] ? 'out' : undefined
});
Expand Down
11 changes: 11 additions & 0 deletions src/randoms.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,17 @@
<label class="btn btn-xxwide" for="flowerGiftR">Flower Gift</label>
</div></td>
</tr>
<tr class="gen-specific g8 g9 hide">
<td><div class="left" title="Is the Pok&eacute;mon affected by an ally's Steely Spirit?">
<div hidden id="selectSteelySpiritInstruction">Is the Pok&eacute;mon affected by an ally's Steely Spirit?</div>
<input aria-describedby="selectSteelySpiritInstruction" class="visually-hidden calc-trigger" type="checkbox" id="steelySpiritL" />
<label class="btn btn-xxwide" for="steelySpiritL">Steely Spirit</label>
</div></td>
<td><div class="right" title="Is the Pok&eacute;mon affected by an ally's Steely Spirit?">
<input aria-describedby="selectSteelySpiritInstruction" class="visually-hidden calc-trigger" type="checkbox" id="steelySpiritR" />
<label class="btn btn-xxwide" for="steelySpiritR">Steely Spirit</label>
</div></td>
</tr>
<tr class="gen-specific g5 g6 g7 g8 g9">
<td><div class="left" title="Is the Pok&eacute;mon protected by an ally's Friend Guard?">
<div hidden id="selectFriendGuardInstruction">Is the Pok&eacute;mon protected by an ally's Friend Guard?</div>
Expand Down
Loading