Skip to content

Commit

Permalink
Deploying to gh-pages from @ c8e40a2 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
sunoru committed Jan 29, 2024
1 parent fc2a4a9 commit 954dcdd
Show file tree
Hide file tree
Showing 10 changed files with 2,361 additions and 235 deletions.
2 changes: 1 addition & 1 deletion deps/damagecalc/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VGC 2023 Damage Calculator
# VGC 2024 Damage Calculator
Originally the official Nuggetbridge damage calculator 2015-2016, later adapted for Trainer Tower 2017-2020, now adapted for Nimbasa City Post from 2021-present. Maintained and developed by nerd-of-now.

If there are inaccuracies please submit an issue or pull request!
Expand Down
36 changes: 19 additions & 17 deletions deps/damagecalc/index.html

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions deps/damagecalc/script_res/ap_calc.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ select.toxic-counter {
padding: 3px 3px;
margin-left: 0.3em;
}
.poke-info .xx-btn {
font-size: 0.8em;
width: 3.8em;
height: 1em;
padding: 3px 3px;
margin-left: 0.3em;
}
.poke-info .ev-total, .poke-info .ev-left {
font-size: 0.8em;
}
Expand Down
104 changes: 56 additions & 48 deletions deps/damagecalc/script_res/damage_MASTER.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,13 @@ function getFinalSpeed(pokemon, weather, terrain, tailwind) {
(pokemon.ability === "Sand Rush" && weather === "Sand") ||
(pokemon.ability === "Slush Rush" && ["Hail", "Snow"].indexOf(weather) > -1) ||
(pokemon.ability === "Surge Surfer" && terrain === "Electric") ||
(pokemon.ability === "Unburden" && (pokemon.item === "" || pokemon.item === terrain + " Seed"))) {
(pokemon.ability === "Unburden" && pokemon.item === "")) {
otherSpeedMods *= 2;
}
//g. Tailwind
if (tailwind) otherSpeedMods *= 2;
//h. Protosynthesis, Quark Drive
if (((pokemon.ability === "Protosynthesis" && (pokemon.item === "Booster Energy" || weather === "Sun" || manualProtoQuark))
|| (pokemon.ability === "Quark Drive" && (pokemon.item === "Booster Energy" || terrain === "Electric" || manualProtoQuark)))
&& pokemon.highestStat === 'sp')
if (pokemon.paradoxAbilityBoost && pokemon.highestStat === 'sp')
otherSpeedMods *= 1.5;

speed = pokeRound(speed * otherSpeedMods);
Expand Down Expand Up @@ -355,30 +353,30 @@ function checkKlutz(pokemon) {
}

function checkSeeds(pokemon, terrain) {
if ((pokemon.item === "Psychic Seed" && terrain === "Psychic") || (pokemon.item === "Misty Seed" && terrain === "Misty")){
pokemon.boosts[SD] = Math.min(6, pokemon.boosts[SD] + 1);
}
else if ((pokemon.item === "Electric Seed" && terrain === "Electric") || (pokemon.item === "Grassy Seed" && terrain === "Grassy")) {
pokemon.boosts[DF] = Math.min(6, pokemon.boosts[DF] + 1);
if (pokemon.item === terrain + ' Seed') {
if (['Electric', 'Grassy'].indexOf(terrain) !== -1)
pokemon.boosts[DF] = Math.min(6, pokemon.boosts[DF] + 1);
else
pokemon.boosts[SD] = Math.min(6, pokemon.boosts[SD] + 1);
pokemon.item = '';
}
}

//function checkConsumedItem(pokemon, terrain) {
// if (pokemon.item === terrain + ' Seed') {
// if (['Electric', 'Grassy'].indexOf(terrain) !== -1)
// pokemon.boosts[DF] = Math.min(6, pokemon.boosts[DF] + 1);
// else
// pokemon.boosts[SD] = Math.min(6, pokemon.boosts[SD] + 1);
// pokemon.item = '';
// }
// else if (pokemon.item === 'Booster Energy'
// && (pokemon.ability === 'Protosynthesis' && weather !== 'Sun') || (pokemon.ability === 'Quark Drive' && terrain !== 'Electric')) {
// pokemon.item = '';
// }
//}
function checkParadoxAbilities(pokemon, terrain, weather) {
if (['Protosynthesis', 'Quark Drive'].indexOf(pokemon.ability) !== -1) {
if ((pokemon.ability === 'Protosynthesis' && weather === 'Sun')
|| (pokemon.ability === 'Quark Drive' && terrain === 'Electric')
|| (manualProtoQuark && pokemon.item !== 'Booster Energy'))
pokemon.paradoxAbilityBoost = true;
else if (pokemon.item === 'Booster Energy') {
pokemon.paradoxAbilityBoost = true;
pokemon.item = '';
}
}
}

function checkSupersweetSyrup(source, target) {
if (source.ability === 'Supersweet Syrup' && source.abilityOn) {
if (source.ability === 'Supersweet Syrup' && source.abilityOn && target.item !== 'Clear Amulet') {
if (target.ability === "Defiant") {
target.boosts[AT] = Math.min(6, target.boosts[AT] + 2);
}
Expand Down Expand Up @@ -414,6 +412,7 @@ function checkIntimidate(source, target) {
}
if (target.item === "Adrenaline Orb" && target.ability !== "Mirror Armor") {
target.boosts[SP] = Math.min(6, target.boosts[SP] + 1 * (1 + checkSimple));
target.item = '';
}
if (target.ability === "Rattled" && gen >= 8 && target.item !== "Clear Amulet") {
target.boosts[SP] = Math.min(6, target.boosts[SP] + 1);
Expand Down Expand Up @@ -474,10 +473,19 @@ function checkEvo(p1, p2){

function checkDownload(source, target) {
if (source.ability === "Download") {
if (target.stats[SD] <= target.stats[DF]) {
source.boosts[SA] = Math.min(6, source.boosts[SA] + 1);
} else {
source.boosts[AT] = Math.min(6, source.boosts[AT] + 1);
if (target.stats[DF] && target.stats[SD]) {
if (target.stats[SD] <= target.stats[DF]) {
source.boosts[SA] = Math.min(6, source.boosts[SA] + 1);
} else {
source.boosts[AT] = Math.min(6, source.boosts[AT] + 1);
}
}
else {
if (getModifiedStat(target.rawStats[SD], target.boosts[SD]) <= getModifiedStat(target.rawStats[DF], target.boosts[DF])) {
source.boosts[SA] = Math.min(6, source.boosts[SA] + 1);
} else {
source.boosts[AT] = Math.min(6, source.boosts[AT] + 1);
}
}
}
}
Expand Down Expand Up @@ -1091,11 +1099,11 @@ function basePowerFunc(move, description, turnOrder, attacker, defender, field,
//c.iii. Crush Grip, Wring Out, Hard Press
case "Crush Grip":
case "Wring Out":
basePower = Math.floor(pokeRound(120 * 100 * Math.floor(attacker.curHP * 0x1000 / attacker.maxHP) / 0x1000) / 100);
basePower = Math.floor(pokeRound(120 * 100 * Math.floor(defender.curHP * 0x1000 / defender.maxHP) / 0x1000) / 100);
description.moveBP = basePower;
break;
case "Hard Press":
basePower = Math.floor(pokeRound(100 * 100 * Math.floor(attacker.curHP * 0x1000 / attacker.maxHP) / 0x1000) / 100);
basePower = Math.floor(pokeRound(100 * 100 * Math.floor(defender.curHP * 0x1000 / defender.maxHP) / 0x1000) / 100);
description.moveBP = basePower;
break;

Expand Down Expand Up @@ -1124,8 +1132,7 @@ function basePowerFunc(move, description, turnOrder, attacker, defender, field,
//g. Dichotomous BP
//g.i. Acrobatics
case "Acrobatics":
basePower = ["Flying Gem", field.terrain + " Seed"].indexOf(attacker.item) !== -1
|| (attacker.item === "Booster Energy" && ["Protosynthesis", "Quark Drive"].indexOf(attacker.ability) !== -1)
basePower = attacker.item === 'Flying Gem'
|| attacker.item === "" ? 110 : 55;
if (basePower !== move.bp) description.moveBP = basePower;
break;
Expand Down Expand Up @@ -1513,24 +1520,31 @@ function calcAttack(move, attacker, defender, description, isCritical, defAbilit
var attackSource = move.name === "Foul Play" ? defender : attacker;
var usesDefenseStat = move.name === "Body Press";
var attackStat = usesDefenseStat ? DF : move.category === "Physical" ? AT : SA;
var isMidMoveAtkBoost = false;
description.attackEVs = attacker.evs[attackStat] +
(NATURES[attacker.nature][0] === attackStat ? "+" : NATURES[attacker.nature][1] === attackStat ? "-" : "") + " " +
toSmogonStat(attackStat);
//Spectral Thief and Meteor Beam aren't part of the calculations but are instead here to properly account for the boosts they give
if (move.name === "Spectral Thief" && defender.boosts[attackStat] > 0) {
attacker.boosts[attackStat] = Math.min(6, attacker.boosts[attackStat] + defender.boosts[attackStat]);
isMidMoveAtkBoost = true;
}
else if (["Meteor Beam", "Electro Shot"].indexOf(move.name) !== -1 && attacker.boosts[attackStat] < 6) {
attacker.boosts[attackStat] += 1;
isMidMoveAtkBoost = true;
}
//b. Unaware
if (defAbility === "Unaware" && attackSource.boosts[attackStat] !== 0) {
attack = attackSource.rawStats[attackStat];
description.defenderAbility = defAbility;
description.attackBoost = attackSource.boosts[attackStat];
}
//Spectral Thief and Meteor Beam aren't part of the calculations but are instead here to properly account for the boosts they give
else if (move.name === "Spectral Thief" && defender.boosts[attackStat] > 0) {
description.attackBoost = Math.min(6, attacker.boosts[attackStat] + defender.boosts[attackStat]);
attack = getModifiedStat(attackSource.rawStats[attackStat], Math.min(6, attacker.boosts[attackStat] + defender.boosts[attackStat]));
}
else if (["Meteor Beam", "Electro Shot"].indexOf(move.name) !== -1) {
description.attackBoost = Math.min(6, attackSource.boosts[attackStat] + 1);
attack = getModifiedStat(attackSource.rawStats[attackStat], Math.min(6, attackSource.boosts[attackStat] + 1));
} //c. Crit
else if (isMidMoveAtkBoost) {
description.attackBoost = attacker.boosts[attackStat];
attack = getModifiedStat(attackSource.rawStats[attackStat], attacker.boosts[attackStat]);
attacker.boosts[attackStat] -= 1;
}
//c. Crit
else if (attackSource.boosts[attackStat] === 0 || (isCritical && attackSource.boosts[attackStat] < 0)) {
attack = attackSource.rawStats[attackStat];
}
Expand Down Expand Up @@ -1614,10 +1628,7 @@ function calcAtMods(move, attacker, defAbility, description, field) {
description.weather = field.weather;
}
//e. 1.3x Abilities
//PROTOSYNTHESIS/QUARK DRIVE MIGHT BE APPLIED IN A DIFFERENT PLACE
else if (((attacker.ability === "Protosynthesis" && (attacker.item === "Booster Energy" || field.weather === "Sun" || manualProtoQuark))
|| (attacker.ability === "Quark Drive" && (attacker.item === "Booster Energy" || field.terrain === "Electric" || manualProtoQuark)))
&& ((attacker.highestStat === 'at' && move.category === "Physical") || (attacker.highestStat === 'sa' && move.category === "Special"))
else if (attacker.paradoxAbilityBoost && ((attacker.highestStat === 'at' && move.category === "Physical") || (attacker.highestStat === 'sa' && move.category === "Special"))
|| (attacker.ability === "Transistor" && move.type === "Electric" && gen >= 9)) {
atMods.push(0x14CD);
description.attackerAbility = attacker.ability;
Expand Down Expand Up @@ -1745,10 +1756,7 @@ function calcDefMods(move, defender, field, description, hitsPhysical, defAbilit
description.defenderAbility = defAbility;
}
//d. 1.3x Abilities
//PROTOSYNTHESIS/QUARK DRIVE MIGHT BE APPLIED IN A DIFFERENT PLACE
else if (((defAbility === "Protosynthesis" && (defender.item === "Booster Energy" || field.weather === "Sun" || manualProtoQuark))
|| (defAbility === "Quark Drive" && (defender.item === "Booster Energy" || field.terrain === "Electric" || manualProtoQuark)))
&& ((defender.highestStat === 'df' && hitsPhysical) || (defender.highestStat === 'sd' && !hitsPhysical))) {
else if (defender.paradoxAbilityBoost && ((defender.highestStat === 'df' && hitsPhysical) || (defender.highestStat === 'sd' && !hitsPhysical))) {
dfMods.push(0x14CD);
description.defenderAbility = defAbility;
}
Expand Down
4 changes: 3 additions & 1 deletion deps/damagecalc/script_res/damage_SV.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function CALCULATE_ALL_MOVES_SV(p1, p2, field) {
checkKlutz(p1);
checkKlutz(p2);
checkEvo(p1, p2);
checkParadoxAbilities(p1, field.getTerrain(), field.getWeather());
checkParadoxAbilities(p2, field.getTerrain(), field.getWeather());
checkSeeds(p1, field.getTerrain());
checkSeeds(p2, field.getTerrain());
checkSwordShield(p1);
Expand Down Expand Up @@ -77,7 +79,7 @@ function GET_DAMAGE_SV(attacker, defender, move, field) {

if (move.name == "Nature Power" && attacker.item !== 'Assault Vest')
[move, moveDescName] = NaturePower(move, field, moveDescName);
else if (move.name == 'Me First' && !move.isMeFirst && attacker.item !== 'Assault Vest')
else if (move.name == 'Me First' && !move.isMeFirst)
[move, moveDescName] = checkMeFirst(move, moveDescName);

if (move.isZ || move.isSignatureZ)
Expand Down
1 change: 0 additions & 1 deletion deps/damagecalc/script_res/item_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,6 @@ var LOCK_ITEM_LOOKUP = {
function cantRemoveItem(defItem, defSpecies, terrain) {
return defItem === null || defItem === "" || defItem.indexOf("ium Z") !== -1
|| LOCK_ITEM_LOOKUP[defSpecies] === defItem
|| defItem === terrain + " Seed"
|| (defSpecies === "Arceus" && defItem.indexOf(" Plate") !== -1)
|| (defSpecies === "Genesect" && defItem.indexOf(" Drive") !== -1)
|| (defSpecies === "Silvally" && defItem.indexOf(" Memory") !== -1);
Expand Down
4 changes: 2 additions & 2 deletions deps/damagecalc/script_res/move_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5425,7 +5425,6 @@ var MOVES_SV_NATDEX = $.extend(true, {}, MOVES_SS_NATDEX, {
makesContact: true,
isPunch: true,
isPriority: true,
hasSecondaryEffect: true, //it doesn't make sense but it's apparently boosted by Sheer Force
},
'Spicy Extract': {
type: 'Grass',
Expand Down Expand Up @@ -5709,7 +5708,7 @@ var MOVES_SV_NATDEX = $.extend(true, {}, MOVES_SS_NATDEX, {
bp: 130,
type: 'Electric',
category: 'Special',
hasSecondaryEffect: true, //like Jet Punch, no downsides with Sheer Force
hasSecondaryEffect: true, //no downsides with Sheer Force
},
'Tera Starstorm': {
bp: 120,
Expand Down Expand Up @@ -5776,6 +5775,7 @@ var MOVES_SV_NATDEX = $.extend(true, {}, MOVES_SS_NATDEX, {
type: 'Electric',
category: 'Physical',
makesContact: true,
hasRecoil: true,
},
'Psychic Noise': {
bp: 75,
Expand Down
4 changes: 3 additions & 1 deletion deps/damagecalc/script_res/pokedex.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ var POKEDEX_RBY = {
},
"w": 30.0,
"ab": "Static",
"canEvolve": true,
},
"Electrode": {
"t1": "Electric",
Expand Down Expand Up @@ -11412,6 +11413,7 @@ var POKEDEX_SM = $.extend(true, {}, POKEDEX_XY, {
"Venusaur": { "ab": "Chlorophyll" },
"Vanilluxe": { "ab": "Snow Warning", },
"Gigalith": { "ab": "Sand Stream", },
"Porygon2": { "ab": "Download", },

//hp buffs
"Magcargo": { "bs": { "hp": 60, "sa": 90 } },
Expand Down Expand Up @@ -17625,7 +17627,7 @@ var POKEDEX_SV_NATDEX = $.extend(true, {}, POKEDEX_LA, {
"sp": 85,
},
"w": 60.0,
"ab": "Stalwart",
"ab": "Stamina",
},
"Gouging Fire": {
"t1": "Fire",
Expand Down
Loading

0 comments on commit 954dcdd

Please sign in to comment.