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 FFA spread move modifier support #445

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion calc/src/data/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type SpeciesName = string & As<'SpeciesName'>;

export type StatusName = 'slp' | 'psn' | 'brn' | 'frz' | 'par' | 'tox';

export type GameType = 'Singles' | 'Doubles';
export type GameType = 'Singles' | 'Doubles' | 'Free-For-All';
export type Terrain = 'Electric' | 'Grassy' | 'Psychic' | 'Misty';
export type Weather =
| 'Sand' | 'Sun' | 'Rain' | 'Hail' | 'Harsh Sunshine' | 'Heavy Rain' | 'Strong Winds';
Expand Down
3 changes: 2 additions & 1 deletion calc/src/mechanics/gen78.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ export function calculateSMSS(
const isSpread = field.gameType !== 'Singles' &&
['allAdjacent', 'allAdjacentFoes'].includes(move.target);
if (isSpread) {
baseDamage = pokeRound(OF32(baseDamage * 3072) / 4096);
const spreadModifier = field.gameType === 'Doubles' ? 3072 : 2048;
baseDamage = pokeRound(OF32(baseDamage * spreadModifier) / 4096);
}

if (attacker.hasAbility('Parental Bond (Child)')) {
Expand Down
7 changes: 5 additions & 2 deletions src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,15 @@
<div aria-label="Field information" role="region">
<fieldset class="field-info">
<legend align="center">Field</legend>
<div aria-labelledby="selectBattleFormatInstruction" class="gen-specific g3 g4 g5 g6 g7 g8" role="radiogroup" style="width: 10.6em; margin: 0 auto 5px;" title="Select the battle format.">
<div aria-labelledby="selectBattleFormatInstruction" class="gen-specific g3 g4 g5 g6 g7 g8" role="radiogroup" style="margin: 0 auto 5px;" title="Select the battle format.">
<span class="visually-hidden" id="selectBattleFormatInstruction">Select the battle format.</span>
<input class="visually-hidden calc-trigger" type="radio" name="format" value="Singles" id="singles-format" checked="checked" />
<label class="btn btn-left" for="singles-format">Singles</label>
<input class="visually-hidden calc-trigger" type="radio" name="format" value="Doubles" id="doubles-format" />
<label class="btn btn-right" for="doubles-format">Doubles</label>
<label class="btn btn-right gen-specific g3 g4 g5 g6 g7" for="doubles-format">Doubles</label>
<label class="btn btn-mid gen-specific g8" for="doubles-format">Doubles</label>
<input class="visually-hidden calc-trigger gen-specific g8" type="radio" name="format" value="Free-For-All" id="ffa-format" />
<label class="btn btn-right gen-specific g8" for="ffa-format" style = "width: auto;">Free-For-All</label>
</div>
<div aria-labelledby="selectTerrainInstruction" class="gen-specific g6 g7 g8" role="group" title="Select the current terrain.">
<span class="visually-hidden" id="selectTerrainInstruction">Select the current terrain.</span>
Expand Down
7 changes: 5 additions & 2 deletions src/randoms.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,15 @@
<div aria-label="Field information" role="region">
<fieldset class="field-info">
<legend align="center">Field</legend>
<div aria-labelledby="selectBattleFormatInstruction" class="gen-specific g3 g4 g5 g6 g7 g8" role="radiogroup" style="width: 10.6em; margin: 0 auto 5px;" title="Select the battle format.">
<div aria-labelledby="selectBattleFormatInstruction" class="gen-specific g3 g4 g5 g6 g7 g8" role="radiogroup" style="margin: 0 auto 5px;" title="Select the battle format.">
<span class="visually-hidden" id="selectBattleFormatInstruction">Select the battle format.</span>
<input class="visually-hidden calc-trigger" type="radio" name="format" value="Singles" id="singles-format" checked="checked" />
<label class="btn btn-left" for="singles-format">Singles</label>
<input class="visually-hidden calc-trigger" type="radio" name="format" value="Doubles" id="doubles-format" />
<label class="btn btn-right" for="doubles-format">Doubles</label>
<label class="btn btn-right gen-specific g3 g4 g5 g6 g7" for="doubles-format">Doubles</label>
<label class="btn btn-mid gen-specific g8" for="doubles-format">Doubles</label>
<input class="visually-hidden calc-trigger gen-specific g8" type="radio" name="format" value="Free-For-All" id="ffa-format" />
<label class="btn btn-right gen-specific g8" for="ffa-format" style = "width: auto;">Free-For-All</label>
</div>
<div aria-labelledby="selectTerrainInstruction" class="gen-specific g6 g7 g8" role="group" title="Select the current terrain.">
<span class="visually-hidden" id="selectTerrainInstruction">Select the current terrain.</span>
Expand Down