add support for bonus values (extra 10%), new poker interval

main
Mike Lee 3 years ago
parent 4e05c05f08
commit 2349985cfc
  1. 13
      english.js
  2. 13
      japanese.js
  3. 135
      muni.js
  4. 53
      parkingcalc.html

@ -9,8 +9,8 @@ function English(str) {
case 3:{ //Set up your options (Category Title)
return "Parking Configuration"
}break;
case 4:{ //Selection for event type: Poker/Raid
return "Poker/Raid"
case 4:{ //Selection for event type: Poker
return "Poker"
}break;
case 5:{ //Selection for event type: Bingo
return "Bingo"
@ -18,6 +18,9 @@ function English(str) {
case 6:{ //Selection for event type: Medley
return "Medley"
}break;
case 24:{ //Selection for event type: Raid
return "Raid"
}break;
case 7:{ //Label for team % selector (Include ":")
return "Event Team Bonus:"
}break;
@ -63,6 +66,12 @@ function English(str) {
case 21:{ //Tip: The "Flexible Team" option gives you the fastest park, but at the expense of more voltage.
return "The <b>\"Flexible Team\"</b> option gives you the fastest park, but at the expense of more voltage."
}break;
case 22:{ //Tip: The maximum score you can get from playing a song using "Free Live" (Use 0 for Rehearsals Only)
return "The maximum score you can get from playing a song using <font color=\"aqua\">Free Live</font>.<br> <sub>(Use 0 for Rehearsals Only)</sub>"
}break;
case 23:{ //See any issues? Contact Mirby#5516 on D4DJ discord
return "See any issues? Contact Mirby#5516 on D4DJ discord"
}break;
case "%INITIAL%":{ //This message is the first thing to display for a normal calculation.
//Sample message:
/*

@ -9,8 +9,8 @@ function Japanese(str) {
case 3:{ //Set up your options (Category Title)
return "Parking Configuration"
}break;
case 4:{ //Selection for event type: Poker/Raid
return "Poker/Raid"
case 4:{ //Selection for event type: Poker
return "Poker"
}break;
case 5:{ //Selection for event type: Bingo
return "Bingo"
@ -18,6 +18,9 @@ function Japanese(str) {
case 6:{ //Selection for event type: Medley
return "Medley"
}break;
case 24:{ //Selection for event type: Raid
return "Raid"
}break;
case 7:{ //Label for team % selector (Include ":")
return "Event Team Bonus:"
}break;
@ -63,6 +66,12 @@ function Japanese(str) {
case 21:{ //Tip: The "Flexible Team" option gives you the fastest park, but at the expense of more voltage.
return "The <b>\"Flexible Team\"</b> option gives you the fastest park, but at the expense of more voltage."
}break;
case 22:{ //Tip: The maximum score you can get from playing a song using "Free Live" (Use 0 for Rehearsals Only)
return "The maximum score you can get from playing a song using <font color=\"aqua\">Free Live</font>.<br> <sub>(Use 0 for Rehearsals Only)</sub>"
}break;
case 23:{ //See any issues? Contact Mirby#5516 on D4DJ discord
return "See any issues? Contact Mirby#5516 on D4DJ discord"
}break;
case "%INITIAL%":{ //This message is the first thing to display for a normal calculation.
//Sample message:
/*

@ -44,6 +44,29 @@ const MAXSTEPS= 10000
setTimeout(() => { document.getElementById("warningparktext").style.visibility=document.getElementById("flexible").checked?"visible":"hidden"},100)
}
function toggleBonus() {
var bonusOptions = {};
bonusOptions['noBonus'] = ['0','20','40','60','80','100','120','140','160'];
bonusOptions['bonus'] = ['0','20','40','50','60','70','80','90','100','110','120','140','150','170','200'];
var isBonus = document.getElementById("teambonus").checked;
var bonusList = document.getElementById("bonus");
while (bonusList.options.length) {
bonusList.remove(0);
}
if (isBonus) {
for (var i = 0; i < bonusOptions['bonus'].length; i++) {
var entry = new Option(bonusOptions['bonus'][i] + "%", bonusOptions['bonus'][i] / 100);
bonusList.options.add(entry);
}
} else {
for (var i = 0; i < bonusOptions['noBonus'].length; i++) {
var entry = new Option(bonusOptions['noBonus'][i] + "%", bonusOptions['noBonus'][i] / 100);
bonusList.options.add(entry);
}
}
}
/*function toggleBingo(){
setTimeout(() => { document.getElementById("hideBingo").style.visibility=document.getElementById("Bingo").checked?"visible":"hidden"},100)
}*/
@ -52,10 +75,12 @@ const MAXSTEPS= 10000
var start = Math.abs(Math.max(0,Number(document.getElementById("starting").value)))
var end = Math.abs(Math.max(0,Number(document.getElementById("ending").value)))
var bonus = Number(document.getElementById("team").value)
var bonus = Number(document.getElementById("bonus").value)
var isBonus = document.getElementById("teambonus").checked
var parameter = Math.abs(Math.max(0,Number(document.getElementById("parameter").value)))
var type = (document.getElementById("Bingo").checked?"Bingo":
document.getElementById("Poker").checked?"Poker/Raid":
document.getElementById("Poker").checked?"Poker":
document.getElementById("Raid").checked?"Raid":
"Medley")
var flexible = document.getElementById("flexible").checked
//document.getElementById("console").value=flexible+"...\n\n"
@ -64,7 +89,7 @@ const MAXSTEPS= 10000
var originalTarget=start
document.getElementById("console").value=""
var interval = (type=="Medley")?15000:10000
var interval = (type=="Medley")?15000:(type=="Poker")?4000:10000
var maxscore = Math.floor(Math.abs(Math.min(5000000,Math.max(0,Number(document.getElementById("maxscore").value))))/interval)*interval
@ -72,13 +97,16 @@ const MAXSTEPS= 10000
if (voltage>0) {
switch (type) {
case "Bingo":{
return voltage * Math.floor((1 + bonus)*Math.max(10,Math.floor(score/interval))+Math.floor((1 + bonus)*Math.floor(parameter/600)))
return voltage * Math.floor((1 + bonus) * (Math.max(10, Math.floor(score/interval)) + Math.floor(parameter/600)))
}break;
case "Medley":{
return voltage * Math.floor((1 + bonus)*(10+Math.floor(score/interval))+Math.floor((1 + bonus)*Math.floor(parameter/600)))
return voltage * Math.floor((1 + bonus) * (10 + Math.floor(score/interval) + Math.floor(parameter/600)))
}break;
case "Poker/Raid":{
return voltage * Math.floor((1 + bonus)*(50 + Math.floor(score/interval))+Math.floor((1 + bonus)*Math.floor(parameter/600)))
case "Poker":{
return voltage * Math.floor((1 + bonus) * (50 + Math.floor(score/interval) + Math.floor(parameter/600)))
}break;
case "Raid":{
return voltage * Math.floor((1 + bonus) * (50 + Math.floor(score/interval) + Math.floor(parameter/600)))
}break;
}
} else {
@ -86,6 +114,38 @@ const MAXSTEPS= 10000
}
}
// Generate a list of possible bonus values the user can have, based on the selected drop down value and whether extra 10% bonus is applied
var bonusOptions = [0,.2,.4,.5,.6,.7,.8,.9,1,1.1,1.2,1.4,1.5,1.7,2];
function GenerateBonusRange(bonusValue, isBonus) {
var array = [];
if (isBonus) {
for (var i=bonusValue;i>=0;i-=0.1) {
i = Math.round(i * 10) / 10 // Eliminate precision problems
if (bonusOptions.includes(i)) {
array.push(i)
}
}
} else {
for (var i=bonusValue;i>=0;i-=0.2) {
i = Math.round(i * 10) / 10
array.push(i)
}
}
return array
}
// During rehearsal, we can't use the odd bonus values, so return next lowest even value
function GetNextBonus(bonusValue) {
for (var i=bonusValue;i>=0;i-=0.1) {
i = Math.round(i * 10) / 10
if (bonusOptions.includes(i) && ((i*10)%2==0)) {
return i
}
}
}
var bonusRange = GenerateBonusRange(bonus, isBonus)
function EvenOdd(val) {
return val%2==0?"even":"odd"
}
@ -212,25 +272,47 @@ const MAXSTEPS= 10000
}
var voltage=0
if ((end-start)%2!==0) {
return undefined
if (isBonus && (end-start >= 21)) {
var gain = 0
// If rehearsing with an odd gap, use 110% to flip back to even - only exception is 29, need to use 90%
if (end-start==29){
gain=19
} else {
gain=21
}
start+=gain
document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:((gain-10)*10),epgain:gain,remaining:end-start})+"\n"
return true
} else {
return undefined
}
}
if (end-start>(10+Math.round(tbonus*10))+10) {
var gain=(10+Math.round(tbonus*10))
if (EvenOdd(end-start)!=EvenOdd(gain)) {
tbonus = GetNextBonus(tbonus)
gain=(10+Math.round(tbonus*10))
}
start+=gain
//document.getElementById("console").value+="1)"
document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:Math.round(tbonus*100),epgain:gain,remaining:end-start})+"\n"
/*"Step "+(step++)+") Use Rehearsal w/"+Math.round(tbonus*100)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n"*/
return true
} else
for (var j=tbonus;j>=0;j-=0.2) {
for (var j of GenerateBonusRange(tbonus,isBonus)) {
result = TryMatchingRehearsal(j)
if (!result) {
return false
}
}
if (end-start>=20) {
var gain=end-start-10
var gain = 0
if (isBonus && ((end-start)==38 || (end-start)==36)) { // If bonus exists, and gap is 36 or 38, need to do special exception because bonus teams can't reach 160% or 180%
gain = 24
} else {
gain = end-start-10
}
start+=gain
//document.getElementById("console").value+="2)"
document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:((gain-10)*10),epgain:gain,remaining:end-start})+"\n"
@ -297,7 +379,7 @@ const MAXSTEPS= 10000
var result=true
if (maxscore>0) {
if (flexible) {
for (var j=bonus;j>=0;j-=0.2) {
for (var j of bonusRange) {
while (TryBiggestGain(j)) {
//document.getElementById("console").value+=+start+" EP"+"\n"
}
@ -328,14 +410,15 @@ const MAXSTEPS= 10000
}
}
}
for (var j=bonus;j>=0;j-=0.2) {
for (var j of bonusRange) {
result = TryMatchingRehearsal(j)
if (!result) {
break;
}
}
if (result) {
for (var j=1.6;j>=0;j-=0.2) {
var maxBonus = (isBonus)?2.0:1.6
for (var j of GenerateBonusRange(maxBonus,isBonus)) {
result = TryMatchingRehearsal(j)
if (!result) {
break;
@ -344,25 +427,24 @@ const MAXSTEPS= 10000
}
if (result) {
do {
if (flexible) {
for (var j=bonus;j>=0;j-=0.2) {
var prevstart = 0
result = TryRehearsal(j)
if (start!==prevstart) {
break;
}
if (flexible) {
for (var j of bonusRange) {
var prevstart = 0
result = TryRehearsal(j)
if (start!==prevstart) {
break;
}
} else {
result = TryRehearsal(bonus)
}
} else {
result = TryRehearsal(bonus)
}
} while (result);
}
if (maxscore>0) {
if (flexible) {
for (var i=5;i>0;i--) {
for (var j=bonus;j>=0;j-=0.2) {
for (var j of bonusRange) {
while (result = TryEqualGain(i,j)) {
//document.getElementById("console").value+="Step "+(step++)+")"+start+" EP"+"\n"
}
@ -379,7 +461,7 @@ const MAXSTEPS= 10000
function ConvertEvent(str) {
switch (str) {
case "Poker/Raid":{
case "Poker":{
return LANGUAGE(4)
}break;
case "Bingo":{
@ -388,6 +470,9 @@ const MAXSTEPS= 10000
case "Medley":{
return LANGUAGE(6)
}break;
case "Raid":{
return LANGUAGE(24)
}break;
}
}

@ -15,8 +15,17 @@
<fieldset>
<legend>Parking Configuration</legend>
<!-- There's actually no difference between JP/EN scoring for now. But leaving this here if/when it does change again. -->
<label for="serverType">Server:</label>
<input type="radio" id="ServerJP" name="serverType" value="ServerJP" checked />
<label for="ServerJP">JP</label>
&nbsp;&nbsp;&nbsp;
<input type="radio" id="ServerEN" name="serverType" value="ServerEN" />
<label for="ServerEN">EN</label>
<br /><br />
<label for="type">Event Type:</label>
<input type="radio" id="Poker" name="type" value="Poker" checked />
<label for="Poker">Poker/Raid</label>
<label for="Poker">Poker</label>
&nbsp;&nbsp;&nbsp;
<input type="radio" id="Bingo" name="type" value="Bingo" />
<label for="Bingo">Bingo</label>
@ -24,9 +33,17 @@
<input type="radio" id="Medley" name="type" value="Medley" />
<label for="Medley">Medley</label>
&nbsp;&nbsp;&nbsp;
<input type="radio" id="Raid" name="type" value="Raid" />
<label for="Raid">Raid</label>
<hr />
<label for="team">Event Team Bonus:</label>
<select id="team" name="team">
&nbsp;&nbsp;
<span onclick="toggleBonus()" class="tooltip">
<label for="teambonus">Matching Bonus?</label>
<input id="teambonus" type="checkbox">
<span class="tooltiptext">Check this box if event gives extra 10% for matching both char and style.</span>
</span>
<select id="bonus">
<option value="0">0%</option>
<option value="0.2">20%</option>
<option value="0.4">40%</option>
@ -37,40 +54,33 @@
<option value="1.4">140%</option>
<option value="1.6" selected>160%</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;<span onClick="toggleWarning()" class="tooltip"><label for="flexible" alt="Yes"
><b>Flexible Team?</b></label
><input id="flexible" type="checkbox" />
<span class="tooltiptext">If turned on, calculates scoring options using lower % teams also.</span>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<span onClick="toggleWarning()" class="tooltip">
<label for="flexible" alt="Yes"><b>Flexible Team?</b></label>
<input id="flexible" type="checkbox" />
<span class="tooltiptext">If turned on, calculates scoring options using lower % teams also.</span>
</span>
<span id="warningparktext" style="visibility:hidden;"><font color="red"><b>WARNING!</b> If your team% changes as you are parking you will have to recalculate the <font color="black"><b><u>PARAMETER</u></b></font> value in the middle of parking!</font></span>
<br />
<br />
<span class="tooltip"><label for="maxscore"><b>Max Free Live Score: </b></label
><input id="maxscore" min="0" type="number" value="620000" /> <span class="tooltiptext translate22">
<span class="tooltip"><label for="maxscore"><b>Max Free Live Score: </b></label><input id="maxscore" min="0" type="number" value="620000" /> <span class="tooltiptext translate22">
The maximum score you can get from playing a song using <font color="aqua">Free Live</font>.<br>
<sub>(Use 0 for Rehearsals Only)</sub></span></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="parameter"><b>Parameter: </b></label
><input id="parameter" min="0" type="number" value="62000" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="parameter"><b>Parameter: </b></label><input id="parameter" min="0" type="number" value="62000" />
<i><a href="parameterbonus_instructions_small.png" target="_blank">How to find Parameter value???</a></i>
<hr />
<label for="starting"><b>Starting EP: </b></label
><input id="starting" min="0" type="number" value="100000" />
<label for="starting"><b>Starting EP: </b></label><input id="starting" min="0" type="number" value="100000" />
<span style="font-size: 32px; padding: 0px 10px 0px 10px"></span>
<label for="ending"><b>Target EP: </b></label
><input id="ending" min="0" type="number" value="104000" />
<label for="ending"><b>Target EP: </b></label><input id="ending" min="0" type="number" value="104000" />
<br />
<br />
<button
id="calculate"
style="
<button id="calculate" style="
background-color: #ccddff;
margin-left: 20px;
width: 240px;
height: 32px;
font-size: 18px;
"
onclick="test()"
>
" onclick="test()">
Calculate
</button>
</fieldset>
@ -82,6 +92,7 @@
<li class="translate19">Here's the Light on EX or Synchrogazer on Hard/EX difficulty are some of the highest scoring songs you can pick.</li>
<li class="translate20">When you get close to the score you need in Free Live, purposely fail the song. Notes are worth 10% their normal value when you have 0 health so you can finish easily.</li>
<li class="translate21">The <b>"Flexible Team"</b> option gives you the fastest park, but at the expense of more voltage.</li>
<li class="translate23">See any issues? Contact Mirby#5516 on D4DJ discord.</li>
</ul>
<script>

Loading…
Cancel
Save