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

Make Weather Ball and Terrain Pulse work with Dynamax #621

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
32 changes: 22 additions & 10 deletions calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function calculateSMSSSV(
move.timesUsed === 1;

let type = move.type;
if (move.named('Weather Ball')) {
if (move.originalName === 'Weather Ball') {
const holdingUmbrella = attacker.hasItem('Utility Umbrella');
type =
field.hasWeather('Sun', 'Harsh Sunshine') && !holdingUmbrella ? 'Fire'
Expand All @@ -210,18 +210,26 @@ export function calculateSMSSSV(
desc.moveType = type;
} else if (move.named('Judgment') && attacker.item && attacker.item.includes('Plate')) {
type = getItemBoostType(attacker.item)!;
} else if (move.named('Techno Blast') && attacker.item && attacker.item.includes('Drive')) {
} else if (move.originalName === 'Techno Blast' &&
attacker.item && attacker.item.includes('Drive')) {
type = getTechnoBlast(attacker.item)!;
} else if (move.named('Multi-Attack') && attacker.item && attacker.item.includes('Memory')) {
if (move.isMax) {
desc.moveType = type;
ShivaD173 marked this conversation as resolved.
Show resolved Hide resolved
}
} else if (move.originalName === 'Multi-Attack' &&
attacker.item && attacker.item.includes('Memory')) {
type = getMultiAttack(attacker.item)!;
if (move.isMax) {
desc.moveType = type;
}
} else if (move.named('Natural Gift') && attacker.item?.endsWith('Berry')) {
const gift = getNaturalGift(gen, attacker.item)!;
type = gift.t;
desc.moveType = type;
desc.attackerItem = attacker.item;
} else if (
move.named('Nature Power') ||
(move.named('Terrain Pulse') && isGrounded(attacker, field))
(move.originalName === 'Terrain Pulse' && isGrounded(attacker, field))
) {
type =
field.hasTerrain('Electric') ? 'Electric'
Expand All @@ -231,14 +239,18 @@ export function calculateSMSSSV(
: 'Normal';
desc.terrain = field.terrain;

if (move.isMax) {
desc.moveType = type;
}

// If the Nature Power user has the ability Prankster, it cannot affect
// Dark-types or grounded foes if Psychic Terrain is active
if (!(move.named('Nature Power') && attacker.hasAbility('Prankster')) &&
(defender.types.includes('Dark') ||
(field.hasTerrain('Psychic') && isGrounded(defender, field)))) {
((defender.types.includes('Dark') ||
(field.hasTerrain('Psychic') && isGrounded(defender, field))))) {
desc.moveType = type;
}
} else if (move.named('Revelation Dance')) {
} else if (move.originalName === 'Revelation Dance') {
if (attacker.teraType) {
type = attacker.teraType;
} else {
Expand Down Expand Up @@ -280,15 +292,15 @@ export function calculateSMSSSV(
'Judgment',
'Nature Power',
'Techno Blast',
'Multi Attack',
'Multi-Attack',
'Natural Gift',
'Weather Ball',
'Terrain Pulse',
'Struggle',
) || (move.named('Tera Blast') && attacker.teraType);

if (!move.isZ && !noTypeChange) {
const normal = move.hasType('Normal');
const normal = type === 'Normal';
if ((isAerilate = attacker.hasAbility('Aerilate') && normal)) {
type = 'Flying';
} else if ((isGalvanize = attacker.hasAbility('Galvanize') && normal)) {
Expand Down Expand Up @@ -933,7 +945,7 @@ export function calculateBasePowerSMSSSV(
'Subzero Slammer', 'Supersonic Skystrike', 'Savage Spin-Out', 'Acid Downpour', 'Tectonic Rage',
'Continental Crush', 'All-Out Pummeling', 'Shattered Psyche', 'Never-Ending Nightmare',
'Devastating Drake', 'Black Hole Eclipse', 'Corkscrew Crash', 'Twinkle Tackle'
)) {
) || move.isMax) {
// show z-move power in description
desc.moveBP = move.bp;
}
Expand Down
12 changes: 8 additions & 4 deletions calc/src/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class Move implements State.Move {
if (options.useMax && data.maxMove) {
const maxMoveName: string = getMaxMoveName(
data.type,
data.name,
options.species,
!!(data.category === 'Status'),
options.ability
Expand Down Expand Up @@ -246,6 +247,7 @@ const ZMOVES_TYPING: {

export function getMaxMoveName(
moveType: I.TypeName,
moveName?: string,
pokemonSpecies?: string,
isStatus?: boolean,
pokemonAbility?: string
Expand All @@ -261,10 +263,12 @@ export function getMaxMoveName(
if (pokemonSpecies === 'Eevee-Gmax') return 'G-Max Cuddle';
if (pokemonSpecies === 'Meowth-Gmax') return 'G-Max Gold Rush';
if (pokemonSpecies === 'Snorlax-Gmax') return 'G-Max Replenish';
if (pokemonAbility === 'Pixilate') return 'Max Starfall';
if (pokemonAbility === 'Aerilate') return 'Max Airstream';
if (pokemonAbility === 'Refrigerate') return 'Max Hailstorm';
if (pokemonAbility === 'Galvanize') return 'Max Lightning';
if (!(moveName === 'Weather Ball' || moveName === 'Terrain Pulse')) {
if (pokemonAbility === 'Pixilate') return 'Max Starfall';
if (pokemonAbility === 'Aerilate') return 'Max Airstream';
if (pokemonAbility === 'Refrigerate') return 'Max Hailstorm';
if (pokemonAbility === 'Galvanize') return 'Max Lightning';
}
}
if (moveType === 'Fairy') {
if (pokemonSpecies === 'Alcremie-Gmax') return 'G-Max Finale';
Expand Down
Loading