Skip to content

Commit

Permalink
Added ??? type, remember gen/level, 2x BP button, more nat dex field …
Browse files Browse the repository at this point in the history
…conditions, minor damage adjustments

- Added the ??? type to gens 2-4, yes it's different from no typing
- The calc will now remember the last level system and gen that the user used
- Changed the 2x attack field from a dropdown list to a button
- Removed Typeless from the options for Tera Type
- Changed where Aura Wheel checks for its type change
- Changed how the calc handles ignoring abilities so that the moves that ignore abilities will also affect things like Friend Guard and Aura Break
- Added a check for Struggle to Wonder Guard
- Fixed OHKO move logic (was reverse of what it was supposed to be)
- Fixed the Hydro Steam/Utility Umbrella interaction
- Fixed the Power-Up Punch/Parental Bond interaction (a +6 Power-Up Punch would incorrectly calc for a +7 second hit)
- The calc will correctly save and export male Indeedee now
- Added a few more default abilities
  • Loading branch information
nerd-of-now authored and kunyi731 committed Dec 28, 2023
1 parent faa8837 commit 90ebab0
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 101 deletions.
44 changes: 10 additions & 34 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,7 @@ <h4 class="panel-title">宝可梦#1</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleL1"/><label class="double-btn btn x-btn" for="doubleL1" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -444,10 +441,7 @@ <h4 class="panel-title">宝可梦#1</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleL2"/><label class="double-btn btn x-btn" for="doubleL2" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -501,10 +495,7 @@ <h4 class="panel-title">宝可梦#1</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleL3"/><label class="double-btn btn x-btn" for="doubleL3" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -558,10 +549,7 @@ <h4 class="panel-title">宝可梦#1</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleL4"/><label class="double-btn btn x-btn" for="doubleL4" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -681,7 +669,7 @@ <h4 class="panel-title">
<!-- Note: I know the html is clunky but it does make it look nicer so idk probably worth
I have the original code commented out anyways if I change my mind -->
<hr class="gen-specific g2 g3 g4 g5 g6 g7 g8 g9" />
<div class="btn-group gen-specific g7 g8">
<div class="btn-group gen-specific g7 g8" id="protect-field">
<div class="left" title="此宝可梦是否守住?">
<input class="btn-input calc-trigger" type="checkbox" id="protectL" /><label class="btn btn-xwide" for="protectL">守住</label>
</div>
Expand Down Expand Up @@ -769,7 +757,7 @@ <h4 class="panel-title">
<input class="btn-input calc-trigger" type="radio" name="spikesR" value="3" id="spikesR3" /><label class="btn btn-wide btn-right" for="spikesR3">3 撒菱</label>
</div>
</div>
<div class="btn-group gen-specific g4 g5 g6 g7 g8">
<div class="btn-group gen-specific g4 g5 g6 g7 g8" id="flower-gift">
<div class="left" title="是否受友方花之礼加成?">
<input class="btn-input calc-trigger" type="checkbox" id="flowerGiftL" /><label class="btn btn-xxwide" for="flowerGiftL">花之礼</label>
</div>
Expand Down Expand Up @@ -1166,10 +1154,7 @@ <h4 class="panel-title">宝可梦#2</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleR1"/><label class="double-btn btn x-btn" for="doubleR1" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -1223,10 +1208,7 @@ <h4 class="panel-title">宝可梦#2</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleR2"/><label class="double-btn btn x-btn" for="doubleR2" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -1280,10 +1262,7 @@ <h4 class="panel-title">宝可梦#2</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleR3"/><label class="double-btn btn x-btn" for="doubleR3" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down Expand Up @@ -1337,10 +1316,7 @@ <h4 class="panel-title">宝可梦#2</h4>
<option value="4">4次命中</option>
<option value="5">5次命中</option>
</select>
<select class="move-double calc-trigger hide">
<option value="0">正常威力</option>
<option value="1">2倍威力</option>
</select>
<input class="move-double calc-trigger btn-input hide" type="checkbox" id="doubleR4"/><label class="double-btn btn x-btn" for="doubleR4" title="计算时取2倍威力?">翻倍</label>
<select class="move-hits2 calc-trigger hide">
<option value="1">1次命中</option>
<option value="2">2次命中</option>
Expand Down
2 changes: 1 addition & 1 deletion script_res/ability_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ var ABILITIES_SV = ABILITIES_SS.concat([
//Teal Mask DLC new additions
"Mind's Eye", //Ignores evasion/accuracy and is Scrappy w/o Intimidate immunity
'Supersweet Syrup', //Intimidate but with evasion and only once
'Hospitality', //Heals HP, needs more info but probably has no calc functionality
'Hospitality', //Heals ally's HP, no calc functionality
'Toxic Chain', //Poison Touch but with badly poisoned instead, no calc functionality
'Embody Aspect', //Boosts Ogerpon's stats based on mask, needs for info for what kind of boost and how much
]);
Expand Down
49 changes: 43 additions & 6 deletions script_res/ap_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ $(".move-selector").change(function() {
moveGroupObj.children(".move-10hits").hide();
}

if (move.canDouble) moveGroupObj.children(".move-double").show();
else moveGroupObj.children(".move-double").hide();
if (move.canDouble) moveGroupObj.children(".double-btn").show();
else moveGroupObj.children(".double-btn").hide();

if (move.oneTwoHit) moveGroupObj.children(".move-hits2").show();
else moveGroupObj.children(".move-hits2").hide();
Expand Down Expand Up @@ -1031,7 +1031,7 @@ function getMoveDetails(moveInfo, maxMon) {
: (defaultDetails.isThreeHit && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? 3
: (moveName == "Beat Up" && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? 4
: 1,
isDouble: (defaultDetails.canDouble && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? ~~moveInfo.find(".move-double").val() : 0,
isDouble: (defaultDetails.canDouble && !moveInfo.find(".move-z").prop("checked") && !maxMon && moveInfo.find(".move-double").prop("checked")) ? 1 : 0,
tripleHits: (defaultDetails.isTripleHit && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? ~~moveInfo.find(".move-hits3").val() : 0,
combinePledge: (moveName.includes(" Pledge") && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? moveInfo.find(".move-pledge").val() : 0,
timesAffected: (defaultDetails.linearAddBP && !moveInfo.find(".move-z").prop("checked") && !maxMon) ? ~~moveInfo.find(".move-linearAddedBP").val() : 0,
Expand Down Expand Up @@ -1120,6 +1120,7 @@ var gen, pokedex, setdex, setdexCustom, typeChart, moves, abilities, items, STAT

$(".gen").change(function () {
gen = ~~$(this).val();
localStorage.setItem("gen", gen);

loadSVColors(document.getElementById('switchTheme').value); //

Expand Down Expand Up @@ -1180,7 +1181,7 @@ $(".gen").change(function () {
pokedex = POKEDEX_BW;
setdex = SETDEX_BW;
setdexCustom = SETDEX_CUSTOM_BW;
typeChart = TYPE_CHART_GSC;
typeChart = TYPE_CHART_BW;
moves = MOVES_BW;
items = ITEMS_BW;
abilities = ABILITIES_BW;
Expand Down Expand Up @@ -1252,17 +1253,42 @@ $(".gen").change(function () {
$('label[for="zL' + i + '"]').show();
$('label[for="zR' + i + '"]').show();
}
$('div #primal-weather').show();
}
else {
for (i = 1; i <= 4; i++) {
$('label[for="zL' + i + '"]').hide();
$('label[for="zR' + i + '"]').hide();
}
$('div #primal-weather').hide();
}
}
$("select.type1, select.move-type, select.tera-type").find("option").remove().end().append(typeOptions);
$("select.type2").find("option").remove().end().append("<option value=\"\">(无)</option>" + typeOptions);
var moveOptions = getSelectOptions(Object.keys(moves), true, undefined, translate_move);

if (gen >= 9) {
if (localStorage.getItem("dex") == "natdex") {
$('div #auras').show();
$('div #protect-field').show();
$('div #flower-gift').show();
}
else {
$('div #auras').hide();
$('div #protect-field').hide();
$('div #flower-gift').hide();
}
}
var types = Object.keys(typeChart);
types.splice(types.indexOf('Typeless'), 1);
var teraTypes = $.extend(true, [], types);
if (gen >= 2) types.push('Typeless');
var typeOptions = getSelectOptions(types, undefined, undefined, translate_type);
var teraTypeOptions = getSelectOptions(teraTypes, undefined, undefined, translate_type);
$("select.type1, select.move-type").find("option").remove().end().append(typeOptions);
$("select.type2").find("option").remove().end().append("<option value=\"\">(无)</option>" + typeOptions);
$("select.tera-type").find("option").remove().end().append(teraTypeOptions);
var moveOptions = getSelectOptions(Object.keys(moves), true, undefined, translate_move);
$("select.move-selector").find("option").remove().end().append(moveOptions);
var abilityOptions = getSelectOptions(abilities, true, undefined, translate_ability);
$("select.ability").find("option").remove().end().append("<option value=\"\">(其他)</option>" + abilityOptions);
Expand Down Expand Up @@ -1386,9 +1412,20 @@ function getSelectOptions(arr, sort, defaultIdx, transFunc) {
return r;
}

function getGen() {
var genLocalStor = localStorage.getItem("gen");
if (genLocalStor) {
$("#gen" + genLocalStor).prop("checked", true);
$("#gen" + genLocalStor).change();
}
else {
$("#gen9").prop("checked", true);
$("#gen9").change();
}
}

$(document).ready(function() {
$("#gen9").prop("checked", true);
$("#gen9").change();
getGen();
$(".terrain-trigger").bind("change keyup", getTerrainEffects);
$(".calc-trigger").bind("change keyup", calculate);
$(".set-selector").select2({
Expand Down
Loading

0 comments on commit 90ebab0

Please sign in to comment.