Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 41ce33a
Author: Automated <[email protected]>
Date:   Sun Jan 19 23:28:34 2025 +0000

    Update sets

commit 0c07159
Author: Automated <[email protected]>
Date:   Thu Jan 16 23:29:43 2025 +0000

    Update sets

commit 5c410b8
Author: Zachary Perlmutter <[email protected]>
Date:   Thu Jan 16 14:56:44 2025 -0800

    Implement Psychic Noise's secondary effect (smogon#679)

commit 8338028
Author: Automated <[email protected]>
Date:   Mon Jan 13 23:28:48 2025 +0000

    Update sets

commit e26ca06
Author: Automated <[email protected]>
Date:   Fri Jan 10 23:29:45 2025 +0000

    Update sets

commit 85a2931
Author: Automated <[email protected]>
Date:   Tue Jan 7 23:29:27 2025 +0000

    Update sets

commit aea76b0
Author: William Jackson <[email protected]>
Date:   Tue Jan 7 13:30:17 2025 +0000

    Gen3: Impl type effectiveness in two stages (smogon#676)

    This avoids any issues arising from lack of truncation in certain cases

    Brings implementation inline with Gen1 & 4

    Fixes: smogon#675

commit a5095a9
Author: Automated <[email protected]>
Date:   Sat Jan 4 23:29:13 2025 +0000

    Update sets

commit 86c781b
Author: Waleed Hassan <[email protected]>
Date:   Fri Jan 3 13:14:04 2025 +0300

    Import: Fix VGC Sets

commit 085400c
Author: shrianshChari <[email protected]>
Date:   Fri Jan 3 01:34:55 2025 -0800

    Honkalculate: Fix Ubers sets (smogon#674)

commit 271c75f
Author: Automated <[email protected]>
Date:   Thu Jan 2 16:52:54 2025 +0000

    Update sets

commit 1f8bf67
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Jan 2 19:50:40 2025 +0300

    Bump cookie and express (smogon#673)

    Bumps [cookie](https://github.com/jshttp/cookie) to 0.7.1 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.

commit 0f84aef
Author: Waleed Hassan <[email protected]>
Date:   Thu Jan 2 19:47:30 2025 +0300

    Import: Update deps

commit 478b3bd
Author: Automated <[email protected]>
Date:   Wed Jan 1 23:30:01 2025 +0000

    Update sets

commit 49769a4
Author: Automated <[email protected]>
Date:   Tue Dec 31 23:29:12 2024 +0000

    Update sets

commit 13f9f50
Author: Automated <[email protected]>
Date:   Sat Dec 28 23:29:32 2024 +0000

    Update sets

commit ae1dc39
Author: Karthik Bandagonda <[email protected]>
Date:   Fri Dec 27 19:28:08 2024 -0500

    Fix EVs/IVs not getting used from randbats sets (smogon#671)

commit c0971e6
Author: Automated <[email protected]>
Date:   Wed Dec 25 23:29:44 2024 +0000

    Update sets

commit 97f79b2
Author: Automated <[email protected]>
Date:   Sun Dec 22 23:29:52 2024 +0000

    Update sets

commit cebb719
Author: Automated <[email protected]>
Date:   Thu Dec 19 23:30:05 2024 +0000

    Update sets

commit f20f224
Author: Automated <[email protected]>
Date:   Mon Dec 16 23:31:00 2024 +0000

    Update sets

commit d4a87ef
Author: Automated <[email protected]>
Date:   Fri Dec 13 23:30:59 2024 +0000

    Update sets

commit a783f09
Author: Automated <[email protected]>
Date:   Tue Dec 10 23:31:08 2024 +0000

    Update sets

commit 665efa2
Author: Automated <[email protected]>
Date:   Sat Dec 7 23:31:30 2024 +0000

    Update sets

commit efbdc7e
Author: Automated <[email protected]>
Date:   Wed Dec 4 23:31:16 2024 +0000

    Update sets

commit 2905a1a
Author: Automated <[email protected]>
Date:   Sun Dec 1 23:30:34 2024 +0000

    Update sets

commit 004cc8f
Author: Automated <[email protected]>
Date:   Thu Nov 28 23:30:38 2024 +0000

    Update sets

commit ad69b7e
Author: Automated <[email protected]>
Date:   Mon Nov 25 23:31:07 2024 +0000

    Update sets

commit a21f3ae
Author: Automated <[email protected]>
Date:   Fri Nov 22 23:32:23 2024 +0000

    Update sets

commit da2e760
Author: Automated <[email protected]>
Date:   Tue Nov 19 23:31:24 2024 +0000

    Update sets

commit 569bbe5
Author: Automated <[email protected]>
Date:   Sat Nov 16 23:30:40 2024 +0000

    Update sets

commit 425bff4
Author: Automated <[email protected]>
Date:   Wed Nov 13 23:30:10 2024 +0000

    Update sets

commit 839ea5b
Author: Automated <[email protected]>
Date:   Sun Nov 10 23:29:52 2024 +0000

    Update sets

commit f592b2f
Author: Automated <[email protected]>
Date:   Thu Nov 7 23:29:33 2024 +0000

    Update sets

commit 0d9de19
Author: Automated <[email protected]>
Date:   Mon Nov 4 23:30:51 2024 +0000

    Update sets

commit 417729b
Author: shrianshChari <[email protected]>
Date:   Sun Nov 3 18:27:45 2024 -0500

    Move Punching Glove base power modification to same block as other items (smogon#666)

commit 100b74d
Author: shrianshChari <[email protected]>
Date:   Sun Nov 3 18:25:22 2024 -0500

    Physical Shell Side Arm should make contact (smogon#667)

commit ffc46f6
Author: Waleed Hassan <[email protected]>
Date:   Sat Nov 2 21:10:44 2024 +0300

    Close <span> tags

commit 4117003
Author: shrianshChari <[email protected]>
Date:   Sat Nov 2 14:04:45 2024 -0400

    UI: Show total number of EVs allocated (smogon#660)

commit 9e8ca8e
Author: Automated <[email protected]>
Date:   Fri Nov 1 23:30:05 2024 +0000

    Update sets

commit effac17
Author: ShivaD173 <[email protected]>
Date:   Fri Nov 1 16:07:18 2024 -0400

    Fix Knock Off damage in Klutz/Magic Room (smogon#651)

    A `Pokemon#disabledItem` field is used to check Knock Off damage
    during Klutz/Magic Room.

commit cdb0195
Author: Automated <[email protected]>
Date:   Thu Oct 31 23:31:03 2024 +0000

    Update sets

commit 81f2e78
Author: Waleed Hassan <[email protected]>
Date:   Wed Oct 30 22:01:00 2024 +0300

    Deepclone specie when importing Pokemon

    Fixes smogon#661

commit 0fd323f
Author: Waleed Hassan <[email protected]>
Date:   Wed Oct 30 21:35:35 2024 +0300

    Imported HP IVs shouldn't be overwritten

    Fixes smogon#650

commit 18ca84e
Author: Automated <[email protected]>
Date:   Mon Oct 28 23:30:34 2024 +0000

    Update sets

commit 83d3831
Author: shrianshChari <[email protected]>
Date:   Sat Oct 26 19:07:10 2024 -0400

    Don't put multiple attributes of an object on the same line (smogon#658)

commit ae7af7d
Author: Austin Couturier <[email protected]>
Date:   Sat Oct 26 16:13:24 2024 -0600

    Jet Punch is not boosted by Sheer Force

commit 6c6ff28
Author: Automated <[email protected]>
Date:   Fri Oct 25 23:30:41 2024 +0000

    Update sets
  • Loading branch information
Celestia74 committed Jan 21, 2025
1 parent 0b7c3f8 commit 07bcea5
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 136 deletions.
1 change: 0 additions & 1 deletion calc/src/data/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4482,7 +4482,6 @@ const SV_PATCH: {[name: string]: DeepPartial<MoveData>} = {
makesContact: true,
isPunch: true,
priority: 1,
// Sheer Force boost implemented in gen789.ts
},
'Kowtow Cleave': {
bp: 85,
Expand Down
32 changes: 23 additions & 9 deletions calc/src/desc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,23 @@ function getEndOfTurn(
}

const loseItem = move.named('Knock Off') && !defender.hasAbility('Sticky Hold');
if (defender.hasItem('Leftovers') && !loseItem) {
// psychic noise should suppress all recovery effects
const healBlock = move.named('Psychic Noise') &&
!(
// suppression conditions
attacker.hasAbility('Sheer Force') ||
defender.hasItem('Covert Cloak') ||
defender.hasAbility('Shield Dust', 'Aroma Veil')
);
if (defender.hasItem('Leftovers') && !loseItem && !healBlock) {
damage += Math.floor(defender.maxHP() / 16);
texts.push('Leftovers recovery');
} else if (defender.hasItem('Black Sludge') && !loseItem) {
if (defender.hasType('Poison')) {
damage += Math.floor(defender.maxHP() / 16);
texts.push('Black Sludge recovery');
if (!healBlock) {
damage += Math.floor(defender.maxHP() / 16);
texts.push('Black Sludge recovery');
}
} else if (!defender.hasAbility('Magic Guard', 'Klutz')) {
damage -= Math.floor(defender.maxHP() / 8);
texts.push('Black Sludge damage');
Expand All @@ -603,31 +613,35 @@ function getEndOfTurn(
if (attacker.hasAbility('Liquid Ooze')) {
damage -= recovery;
texts.push('Liquid Ooze damage');
} else {
} else if (!healBlock) {
damage += recovery;
texts.push('Leech Seed recovery');
}
}

if (field.hasTerrain('Grassy')) {
if (isGrounded(defender, field)) {
if (isGrounded(defender, field) && !healBlock) {
damage += Math.floor(defender.maxHP() / 16);
texts.push('Grassy Terrain recovery');
}
}

if (defender.hasStatus('psn')) {
if (defender.hasAbility('Poison Heal')) {
damage += Math.floor(defender.maxHP() / 8);
texts.push('Poison Heal');
if (!healBlock) {
damage += Math.floor(defender.maxHP() / 8);
texts.push('Poison Heal');
}
} else if (!defender.hasAbility('Magic Guard')) {
damage -= Math.floor(defender.maxHP() / (gen.num === 1 ? 16 : 8));
texts.push('poison damage');
}
} else if (defender.hasStatus('tox')) {
if (defender.hasAbility('Poison Heal')) {
damage += Math.floor(defender.maxHP() / 8);
texts.push('Poison Heal');
if (!healBlock) {
damage += Math.floor(defender.maxHP() / 8);
texts.push('Poison Heal');
}
} else if (!defender.hasAbility('Magic Guard')) {
texts.push('toxic damage');
}
Expand Down
7 changes: 5 additions & 2 deletions calc/src/mechanics/gen3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ export function calculateADV(
desc.dwc = true;
}

baseDamage = Math.floor(baseDamage * typeEffectiveness);
baseDamage = Math.floor(baseDamage * type1Effectiveness);
baseDamage = Math.floor(baseDamage * type2Effectiveness);

result.damage = [];
for (let i = 85; i <= 100; i++) {
result.damage[i - 85] = Math.max(1, Math.floor((baseDamage * 92) / 100));
Expand Down Expand Up @@ -192,7 +194,8 @@ export function calculateADV(
Math.floor((Math.floor((2 * lv) / 5 + 2) * newAt * newBp) / df) / 50
);
newBaseDmg = calculateFinalModsADV(newBaseDmg, attacker, move, field, desc, isCritical);
newBaseDmg = Math.floor(newBaseDmg * typeEffectiveness);
newBaseDmg = Math.floor(baseDamage * type1Effectiveness);
newBaseDmg = Math.floor(baseDamage * type2Effectiveness);

let damageMultiplier = 92;
result.damage = result.damage.map(affectedAmount => {
Expand Down
18 changes: 10 additions & 8 deletions calc/src/mechanics/gen56.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,20 @@ export function calculateBPModsBWXY(
) {
const bpMods = [];

const defenderItem = (defender.item && defender.item !== '')
? defender.item : defender.disabledItem;
let resistedKnockOffDamage =
!defender.item ||
(defender.named('Giratina-Origin') && defender.hasItem('Griseous Orb')) ||
(defender.name.includes('Arceus') && defender.item.includes('Plate')) ||
(defender.name.includes('Genesect') && defender.item.includes('Drive')) ||
(defender.named('Groudon', 'Groudon-Primal') && defender.hasItem('Red Orb')) ||
(defender.named('Kyogre', 'Kyogre-Primal') && defender.hasItem('Blue Orb'));
!defenderItem ||
(defender.named('Giratina-Origin') && defenderItem === 'Griseous Orb') ||
(defender.name.includes('Arceus') && defenderItem.includes('Plate')) ||
(defender.name.includes('Genesect') && defenderItem.includes('Drive')) ||
(defender.named('Groudon', 'Groudon-Primal') && defenderItem === 'Red Orb') ||
(defender.named('Kyogre', 'Kyogre-Primal') && defenderItem === 'Blue Orb');

// The last case only applies when the Pokemon is holding the Mega Stone that matches its species
// (or when it's already a Mega-Evolution)
if (!resistedKnockOffDamage && defender.item) {
const item = gen.items.get(toID(defender.item))!;
if (!resistedKnockOffDamage && defenderItem) {
const item = gen.items.get(toID(defenderItem))!;
resistedKnockOffDamage = !!(item.megaEvolves && defender.name.includes(item.megaEvolves));
}

Expand Down
52 changes: 28 additions & 24 deletions calc/src/mechanics/gen789.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ export function calculateSMSSSV(
move.flags.contact = 0;
}

if (move.named('Shell Side Arm') &&
getShellSideArmCategory(attacker, defender) === 'Physical') {
move.flags.contact = 1;
}

const breaksProtect = move.breaksProtect || move.isZ || attacker.isDynamaxed ||
(attacker.hasAbility('Unseen Fist') && move.flags.contact);

Expand Down Expand Up @@ -1028,30 +1033,31 @@ export function calculateBPModsSMSSSV(
const bpMods = [];

// Move effects

const defenderItem = (defender.item && defender.item !== '')
? defender.item : defender.disabledItem;
let resistedKnockOffDamage =
(!defender.item || isQPActive(defender, field)) ||
(defender.named('Dialga-Origin') && defender.hasItem('Adamant Crystal')) ||
(defender.named('Palkia-Origin') && defender.hasItem('Lustrous Globe')) ||
(!defenderItem || isQPActive(defender, field)) ||
(defender.named('Dialga-Origin') && defenderItem === 'Adamant Crystal') ||
(defender.named('Palkia-Origin') && defenderItem === 'Lustrous Globe') ||
// Griseous Core for gen 9, Griseous Orb otherwise
(defender.name.includes('Giratina-Origin') && defender.item.includes('Griseous')) ||
(defender.name.includes('Arceus') && defender.item.includes('Plate')) ||
(defender.name.includes('Genesect') && defender.item.includes('Drive')) ||
(defender.named('Groudon', 'Groudon-Primal') && defender.hasItem('Red Orb')) ||
(defender.named('Kyogre', 'Kyogre-Primal') && defender.hasItem('Blue Orb')) ||
(defender.name.includes('Silvally') && defender.item.includes('Memory')) ||
defender.item.includes(' Z') ||
(defender.named('Zacian') && defender.hasItem('Rusted Sword')) ||
(defender.named('Zamazenta') && defender.hasItem('Rusted Shield')) ||
(defender.name.includes('Ogerpon-Cornerstone') && defender.hasItem('Cornerstone Mask')) ||
(defender.name.includes('Ogerpon-Hearthflame') && defender.hasItem('Hearthflame Mask')) ||
(defender.name.includes('Ogerpon-Wellspring') && defender.hasItem('Wellspring Mask')) ||
(defender.named('Venomicon-Epilogue') && defender.hasItem('Vile Vial'));
(defender.name.includes('Giratina-Origin') && defenderItem.includes('Griseous')) ||
(defender.name.includes('Arceus') && defenderItem.includes('Plate')) ||
(defender.name.includes('Genesect') && defenderItem.includes('Drive')) ||
(defender.named('Groudon', 'Groudon-Primal') && defenderItem === 'Red Orb') ||
(defender.named('Kyogre', 'Kyogre-Primal') && defenderItem === 'Blue Orb') ||
(defender.name.includes('Silvally') && defenderItem.includes('Memory')) ||
defenderItem.includes(' Z') ||
(defender.named('Zacian') && defenderItem === 'Rusted Sword') ||
(defender.named('Zamazenta') && defenderItem === 'Rusted Shield') ||
(defender.name.includes('Ogerpon-Cornerstone') && defenderItem === 'Cornerstone Mask') ||
(defender.name.includes('Ogerpon-Hearthflame') && defenderItem === 'Hearthflame Mask') ||
(defender.name.includes('Ogerpon-Wellspring') && defenderItem === 'Wellspring Mask') ||
(defender.named('Venomicon-Epilogue') && defenderItem === 'Vile Vial');

// The last case only applies when the Pokemon has the Mega Stone that matches its species
// (or when it's already a Mega-Evolution)
if (!resistedKnockOffDamage && defender.item) {
const item = gen.items.get(toID(defender.item))!;
if (!resistedKnockOffDamage && defenderItem) {
const item = gen.items.get(toID(defenderItem))!;
resistedKnockOffDamage = !!item.megaEvolves && defender.name.includes(item.megaEvolves);
}

Expand Down Expand Up @@ -1176,7 +1182,7 @@ export function calculateBPModsSMSSSV(
// Sheer Force does not power up max moves or remove the effects (SadisticMystic)
if (
(attacker.hasAbility('Sheer Force') &&
(move.secondaries || move.named('Jet Punch', 'Order Up')) && !move.isMax) ||
(move.secondaries || move.named('Order Up')) && !move.isMax) ||
(attacker.hasAbility('Sand Force') &&
field.hasWeather('Sand') && move.hasType('Rock', 'Ground', 'Steel')) ||
(attacker.hasAbility('Analytic') &&
Expand Down Expand Up @@ -1222,10 +1228,6 @@ export function calculateBPModsSMSSSV(
desc.attackerAbility = attacker.ability;
}

if (attacker.hasItem('Punching Glove') && move.flags.punch) {
bpMods.push(4506);
}

if (gen.num <= 8 && defender.hasAbility('Heatproof') && move.hasType('Fire')) {
bpMods.push(2048);
desc.defenderAbility = defender.ability;
Expand Down Expand Up @@ -1276,6 +1278,8 @@ export function calculateBPModsSMSSSV(
) {
bpMods.push(4505);
desc.attackerItem = attacker.item;
} else if (attacker.hasItem('Punching Glove') && move.flags.punch) {
bpMods.push(4506);
}
return bpMods;
}
Expand Down
1 change: 1 addition & 0 deletions calc/src/mechanics/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export function checkItem(pokemon: Pokemon, magicRoomActive?: boolean) {
pokemon.hasAbility('Klutz') && !EV_ITEMS.includes(pokemon.item!) ||
magicRoomActive
) {
pokemon.disabledItem = pokemon.item;
pokemon.item = '' as ItemName;
}
}
Expand Down
1 change: 1 addition & 0 deletions calc/src/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class Pokemon implements State.Pokemon {
alliesFainted?: number;
boostedStat?: I.StatIDExceptHP | 'auto';
item?: I.ItemName;
disabledItem?: I.ItemName;
teraType?: I.TypeName;

nature: I.NatureName;
Expand Down
23 changes: 23 additions & 0 deletions calc/src/test/calc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,23 @@ describe('calc', () => {
});
});

inGens(6, 9, ({gen, calculate, Pokemon, Move}) => {
test('Knock Off vs. Klutz', () => {
const weavile = Pokemon('Weavile');
const audino = Pokemon('Audino', {ability: 'Klutz', item: 'Leftovers'});
const audinoMega = Pokemon('Audino', {ability: 'Klutz', item: 'Audinite'});
const knockoff = Move('Knock Off');
const result = calculate(weavile, audino, knockoff);
expect(result.desc()).toBe(
'0 Atk Weavile Knock Off (97.5 BP) vs. 0 HP / 0 Def Audino: 139-165 (40 - 47.5%) -- guaranteed 3HKO'
);
const result2 = calculate(weavile, audinoMega, knockoff);
expect(result2.desc()).toBe(
'0 Atk Weavile Knock Off vs. 0 HP / 0 Def Audino: 93-111 (26.8 - 31.9%) -- guaranteed 4HKO'
);
});
});

inGens(5, 9, ({gen, calculate, Pokemon, Move}) => {
test(`Multi-hit interaction with Multiscale (gen ${gen})`, () => {
const result = calculate(
Expand Down Expand Up @@ -1417,6 +1434,12 @@ describe('calc', () => {
result = calculate(attacker, defender, Move('Revelation Dance'));
expect(result.move.type).toBe('Water');
});
test('Psychic Noise should disable healing effects', () => {
const attacker = Pokemon('Mewtwo');
const defender = Pokemon('Regigigas', {ability: 'Poison Heal', item: 'Leftovers', status: 'tox'});
const result = calculate(attacker, defender, Move('Psychic Noise'), Field({terrain: 'Grassy', attackerSide: {isSeeded: true}}));
expect(result.desc()).toBe('0 SpA Mewtwo Psychic Noise vs. 0 HP / 0 SpD Regigigas: 109-129 (30.1 - 35.7%) -- 31.2% chance to 3HKO');
});

test('Flower Gift, Power Spot, Battery, and switching boosts shouldn\'t have double spaces', () => {
const attacker = Pokemon('Weavile');
Expand Down
44 changes: 22 additions & 22 deletions import/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"repository": "github:smogon/damage-calc",
"license": "MIT",
"dependencies": {
"@pkmn/data": "^0.9.19",
"@pkmn/dex": "^0.9.19",
"@pkmn/sim": "^0.9.19",
"@pkmn/smogon": "^0.5.14"
"@pkmn/data": "^0.9.26",
"@pkmn/dex": "^0.9.26",
"@pkmn/sim": "^0.9.26",
"@pkmn/smogon": "^0.5.17"
},
"devDependencies": {
"@pkmn/eslint-config": "^8.4.0",
Expand Down
4 changes: 2 additions & 2 deletions import/src/set-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ function getSpecie(gen: Generation, specieName: SpeciesName): Specie | PSSpecie

function toPSFormat(formatID: ID): ID {
if (formatID === 'gen9vgc2024') {
return `${formatID}regh` as ID;
return `gen9vgc2025regg` as ID;
}
if (formatID === 'gen9battlestadiumsingles') {
return 'gen9bssregh' as ID;
return 'gen9bssregg' as ID;
}
return formatID;
}
Expand Down
Loading

0 comments on commit 07bcea5

Please sign in to comment.