Skip to content

Commit

Permalink
Sidebar Teams, Delete Individual Sets, more
Browse files Browse the repository at this point in the history
- The damage calculator now has a team sidebar! You can add, edit, and delete up to six Pokemon on each side for a shortcut to each Pokemon without needing to search for them every time!
- Custom sets can now be deleted individually instead of all of them at once
- The "Custom sets only" mode will now only show custom sets for Pokemon that have them and no Blank Sets
- The set list will now automatically update without the need to refresh the page
- Set lists have been reworked to dynamically change with each generation change instead of every gen setdex being loaded in the background
- Panels have an increased size to accommodate for the sidebars (sorry mobile users)
- Minor mechanics fixes: Protosynthesis and Quark Drive are no longer ignorable (but can still be suppressed) and Aeroblast is now a wind move
  • Loading branch information
nerd-of-now committed May 6, 2024
1 parent 0efd776 commit 29628a0
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 399 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/.vs
Binary file added image_res/save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image_res/trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 95 additions & 21 deletions index.html

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions script_res/ap_calc.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ body {
font: 12px Verdana, sans-serif;
background-color: #bbeedd;
padding: 0 1em;
min-width: 100em;
min-width: 120em;
}
fieldset {
float: left;
Expand Down Expand Up @@ -44,7 +44,7 @@ th {
}
.poke-info {
/*width: 33.1em;*/
width: 30em;
width: 37em;
}
.field-info {
width: 30em;
Expand Down Expand Up @@ -333,7 +333,21 @@ select.toxic-counter {
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}

button.pkmnsc {
width: 60px;
min-height: 44px;
text-align: center;
}
button.trashsc, button.editsc {
width: 24px;
height: 24px;
}
button.addsc {
width: 114.25px;
}
button.pkmnsc, button.trashsc, button.editsc, button.addsc{
cursor: pointer;
}

#mainResult {
visibility: visible;
Expand Down
120 changes: 80 additions & 40 deletions script_res/ap_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,15 @@ $(".set-selector").change(function() {
var itemObj = pokeObj.find("select.item");
if (pokemonName in setdex && setName in setdex[pokemonName]) {
var set = setdex[pokemonName][setName];
if (setdexCustom !== [] && pokemonName in setdexCustom && setName in setdexCustom[pokemonName])
if (setdexCustom !== [] && pokemonName in setdexCustom && setName in setdexCustom[pokemonName]
&& LEFT_SIDEBAR_NAMES.indexOf(setName) == -1 && RIGHT_SIDEBAR_NAMES.indexOf(setName) == -1) {
$(this).closest(".poke-info").find(".setCalc").val(setName);
else
$(this).closest(".poke-info").find(".delset").show();
}
else {
$(this).closest(".poke-info").find(".setCalc").val("My Calc Set");
$(this).closest(".poke-info").find(".delset").hide();
}
if(DOU) pokeObj.find(".level").val(100);
else pokeObj.find(".level").val(set.level);
pokeObj.find(".hp .evs").val((set.evs && typeof set.evs.hp !== "undefined") ? set.evs.hp : 0);
Expand Down Expand Up @@ -1263,8 +1268,8 @@ $(".gen").change(function () {
switch (gen) {
case 1: //Gen 1
pokedex = POKEDEX_RBY;
setdex = SETDEX_RBY;
setdexCustom = [];
//setdex = SETDEX_RBY;
//setdexCustom = [];
typeChart = TYPE_CHART_RBY;
moves = MOVES_RBY;
items = [];
Expand All @@ -1276,8 +1281,8 @@ $(".gen").change(function () {
break;
case 2: //Gen 2
pokedex = POKEDEX_GSC;
setdex = SETDEX_GSC;
setdexCustom = [];
//setdex = SETDEX_GSC;
//setdexCustom = [];
typeChart = TYPE_CHART_GSC;
moves = MOVES_GSC;
items = ITEMS_GSC;
Expand All @@ -1289,8 +1294,8 @@ $(".gen").change(function () {
break;
case 3: //Gen 3
pokedex = POKEDEX_ADV;
setdex = SETDEX_ADV;
setdexCustom = SETDEX_CUSTOM_ADV;
//setdex = SETDEX_ADV;
//setdexCustom = SETDEX_CUSTOM_ADV;
typeChart = TYPE_CHART_GSC;
moves = MOVES_ADV;
items = ITEMS_ADV;
Expand All @@ -1302,8 +1307,8 @@ $(".gen").change(function () {
break;
case 4: //Gen 4
pokedex = POKEDEX_DPP;
setdex = SETDEX_DPP;
setdexCustom = SETDEX_CUSTOM_DPP;
//setdex = SETDEX_DPP;
//setdexCustom = SETDEX_CUSTOM_DPP;
typeChart = TYPE_CHART_GSC;
moves = MOVES_DPP;
items = ITEMS_DPP;
Expand All @@ -1315,8 +1320,8 @@ $(".gen").change(function () {
break;
case 5: //Gen 5
pokedex = POKEDEX_BW;
setdex = SETDEX_BW;
setdexCustom = SETDEX_CUSTOM_BW;
//setdex = SETDEX_BW;
//setdexCustom = SETDEX_CUSTOM_BW;
typeChart = TYPE_CHART_BW;
moves = MOVES_BW;
items = ITEMS_BW;
Expand All @@ -1328,8 +1333,8 @@ $(".gen").change(function () {
break;
case 6: //Gen 6
pokedex = POKEDEX_XY;
setdex = SETDEX_XY;
setdexCustom = SETDEX_CUSTOM_XY;
//setdex = SETDEX_XY;
//setdexCustom = SETDEX_CUSTOM_XY;
typeChart = TYPE_CHART_XY;
moves = MOVES_XY;
items = ITEMS_XY;
Expand All @@ -1341,8 +1346,8 @@ $(".gen").change(function () {
break;
case 7: //Gen 7
pokedex = POKEDEX_SM;
setdex = SETDEX_SM;
setdexCustom = SETDEX_CUSTOM_SM;
//setdex = SETDEX_SM;
//setdexCustom = SETDEX_CUSTOM_SM;
typeChart = TYPE_CHART_XY;
moves = MOVES_SM;
items = ITEMS_SM;
Expand All @@ -1354,8 +1359,8 @@ $(".gen").change(function () {
break;
case 8: //Gen 8 SwSh+BDSP
pokedex = (localStorage.getItem("dex") == "natdex") ? POKEDEX_SS_NATDEX : POKEDEX_SS;
setdex = SETDEX_SS;
setdexCustom = SETDEX_CUSTOM_SS;
//setdex = SETDEX_SS;
//setdexCustom = SETDEX_CUSTOM_SS;
typeChart = TYPE_CHART_XY;
moves = (localStorage.getItem("dex") == "natdex") ? MOVES_SS_NATDEX : MOVES_SS;
items = (localStorage.getItem("dex") == "natdex") ? ITEMS_SS_NATDEX : ITEMS_SS;
Expand All @@ -1367,8 +1372,8 @@ $(".gen").change(function () {
break;
case 9: //Gen 9 SV
pokedex = (localStorage.getItem("dex") == "natdex") ? POKEDEX_SV_NATDEX : POKEDEX_SV;
setdex = SETDEX_SV;
setdexCustom = SETDEX_CUSTOM_SV;
//setdex = SETDEX_SV;
//setdexCustom = SETDEX_CUSTOM_SV;
typeChart = TYPE_CHART_SV;
moves = (localStorage.getItem("dex") == "natdex") ? MOVES_SV_NATDEX : MOVES_SV;
items = (localStorage.getItem("dex") == "natdex") ? ITEMS_SV_NATDEX : ITEMS_SV;
Expand All @@ -1379,6 +1384,11 @@ $(".gen").change(function () {
calcStat = CALC_STAT_ADV;
break;
}
if (gen in ALL_SETDEX_CUSTOM)
setdexCustom = ALL_SETDEX_CUSTOM[gen];
else
setdexCustom = [];
loadSetdexScript();
clearField();
$(".gen-specific.g" + gen).show();
$(".gen-specific").not(".g" + gen).hide();
Expand Down Expand Up @@ -1433,6 +1443,10 @@ $(".gen").change(function () {
$("#p1 .set-selector").change();
$("#p2 .set-selector").val(getSetOptions("#p2")[gen > 3 ? 1 : gen === 1 ? 5 : 3].id);
$("#p2 .set-selector").change();
$(".sidebarMon").hide();
$(".sidebarAdd").show();
loadSidebar(1);
loadSidebar(2);
});

function clearField() {
Expand Down Expand Up @@ -1504,31 +1518,55 @@ function getSetOptions(p) {
pokeNames.sort();
var setOptions = [];
var idNum = 0;
var setdexUsed = $(p + " .set-toggle").prop("checked") && gen >= 5 ? setdexCustom : setdex;
for (var i = 0; i < pokeNames.length; i++) {
var pokeName = pokeNames[i];
setOptions.push({
pokemon: pokeName,
text: pokeName
});
if (pokeName in setdexUsed) {
var setNames = Object.keys(setdexUsed[pokeName]);
for (var j = 0; j < setNames.length; j++) {
var setName = setNames[j];
var usesCustom = $(p + " .set-toggle").prop("checked") && gen >= 3;
var setdexUsed = usesCustom ? setdexCustom : setdex;
if (!usesCustom) {
for (var i = 0; i < pokeNames.length; i++) {
var pokeName = pokeNames[i];
setOptions.push({
pokemon: pokeName,
text: pokeName
});
if (pokeName in setdexUsed) {
var setNames = Object.keys(setdexUsed[pokeName]);
for (var j = 0; j < setNames.length; j++) {
var setName = setNames[j];
setOptions.push({
pokemon: pokeName,
set: setName,
text: pokeName + " (" + setName + ")",
id: pokeName + " (" + setName + ")"
});
}
}
setOptions.push({
pokemon: pokeName,
set: "Blank Set",
text: pokeName + " (Blank Set)",
id: pokeName + " (Blank Set)"
});
}
}
else {
for (var i = 0; i < pokeNames.length; i++) {
var pokeName = pokeNames[i];
if (pokeName in setdexUsed) {
setOptions.push({
pokemon: pokeName,
set: setName,
text: pokeName + " (" + setName + ")",
id: pokeName + " (" + setName + ")"
text: pokeName
});
var setNames = Object.keys(setdexUsed[pokeName]);
for (var j = 0; j < setNames.length; j++) {
var setName = setNames[j];
setOptions.push({
pokemon: pokeName,
set: setName,
text: pokeName + " (" + setName + ")",
id: pokeName + " (" + setName + ")"
});
}
}
}
setOptions.push({
pokemon: pokeName,
set: "Blank Set",
text: pokeName + " (Blank Set)",
id: pokeName + " (Blank Set)"
});
}
return setOptions;
}
Expand Down Expand Up @@ -1629,4 +1667,6 @@ $(document).ready(function () {
$("#p1 .set-selector").change();
$("#p2 .set-selector").val(getSetOptions("#p2")[gen > 3 ? 1 : gen === 1 ? 5 : 3].id);
$("#p2 .set-selector").change();
loadSidebar(1);
loadSidebar(2);
});
2 changes: 1 addition & 1 deletion script_res/damage_MASTER.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ function statusMoves(move, attacker, defender, description) {
}

function abilityIgnore(attacker, move, defAbility, description, defItem = "") {
if (['Shadow Shield', 'Full Metal Body', 'Prism Armor', 'As One',
if (['Shadow Shield', 'Full Metal Body', 'Prism Armor', 'As One', 'Protosynthesis', 'Quark Drive',
'Tablets of Ruin', 'Vessel of Ruin', 'Sword of Ruin', 'Beads of Ruin'].indexOf(defAbility) == -1 && defItem !== "Ability Shield") {
if (["Mold Breaker", "Teravolt", "Turboblaze"].indexOf(attacker.ability) !== -1) {
defAbility = "[ignored]"; //'[ignored]' is used as a check for ally abilities as well
Expand Down
1 change: 1 addition & 0 deletions script_res/move_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4915,6 +4915,7 @@ var MOVES_SV_NATDEX = $.extend(true, {}, MOVES_SS_NATDEX, {
'Hurricane': { isWind: true, },
'Petal Blizzard': { isWind: true, },
'Fairy Wind': { isWind: true, },
'Aeroblast': { isWind: true, },
'Wicked Blow': { bp: 75, },
'Grassy Glide': { bp: 55, },
'Glacial Lance': { bp: 120, },
Expand Down
2 changes: 1 addition & 1 deletion script_res/nb_calc.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ body, html {

.wrapper{
padding:0 1em;
max-width:1138px;
max-width:1300px;
margin:0 auto;
}

Expand Down
Loading

0 comments on commit 29628a0

Please sign in to comment.