started with calculation and added CR

This commit is contained in:
James 2022-09-29 08:22:37 +02:00
parent e89ff30e25
commit 87738ed91c

146
index.php
View File

@ -72,7 +72,13 @@
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Resources</span> <span>How healthy are your players?</span> <br /> <label> <input name="party_health" type="radio" checked /> <span>They just had a long rest (full)</span> </label> <br /> <label> <input name="party_health" type="radio" /> <span>Full after a short rest (missing some health)</span> </label> <br /> <label> <input name="party_health" type="radio" /> <span>They might be missing some spellslots, ammo... or arms (medium hp, low ammo) </span> </label><br /> <label> <input name="party_health" type="radio" /> <span>They roleplay a corpse (low Health, no resources)</span> </label> </div>
<div class="card-content white-text"> <span class="card-title">Resources</span>
<span>How healthy are your players?</span> <br />
<label> <input name="party_health" value="1" type="radio" checked /> <span>They just had a long rest (full)</span> </label> <br />
<label> <input name="party_health" value="2" type="radio" /> <span>Full after a short rest (missing some health)</span> </label> <br />
<label> <input name="party_health" value="3" type="radio" /> <span>They might be missing some spellslots, ammo... or arms (medium hp, low ammo) </span> </label><br />
<label> <input name="party_health" value="4" type="radio" /> <span>They roleplay a corpse (low Health, no resources)</span> </label>
</div>
</div>
</div>
</div>
@ -81,13 +87,28 @@
<div class="card green darken-4">
<div class="card-content white-text"> <span class="card-title">Skill calculator</span>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Knowledge</span> <span>Have your players played DND before?</span> <br /> <label> <input name="party_dndknowledge" type="radio" checked /> <span>Yes</span> </label> <br /> <label> <input name="party_dndknowledge" type="radio" /> <span>Some have</span> </label> <br /> <label> <input name="party_dndknowledge" type="radio" /> <span>No, what's a DND?</span> </label> </div>
<div class="card-content white-text"> <span class="card-title">Knowledge</span>
<span>Have your players played DND before?</span> <br />
<label> <input name="party_dndknowledge" value="1" type="radio" checked /> <span>Yes</span> </label> <br />
<label> <input name="party_dndknowledge" value="2" type="radio" /> <span>Some have</span> </label> <br />
<label> <input name="party_dndknowledge" value="3" type="radio" /> <span>No, what's a DND?</span> </label>
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Awareness</span> <span>Do your players use the enviroment for attacks?</span> <br /> <label> <input name="party_attention" type="radio" checked /> <span>Yes, but there is nothing around</span> </label> <br /> <label> <input name="party_attention" type="radio" /> <span>Yes, they could use this conventiently placed DEATHLAZOR</span> </label> <br /> <label> <input name="party_attention" type="radio" /> <span>No, my players are mindless robots.</span> </label> </div>
<div class="card-content white-text"> <span class="card-title">Awareness</span>
<span>Do your players use the enviroment for attacks?</span> <br />
<label> <input value="1" name="party_attention" type="radio" checked /> <span>Yes, but there is nothing around</span> </label> <br />
<label> <input value="2" name="party_attention" type="radio" /> <span>Yes, they could use this conventiently placed DEATHLAZOR</span> </label> <br />
<label> <input value="3" name="party_attention" type="radio" /> <span>No, my players are mindless robots.</span> </label>
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Strategies</span> <span>Do your players play any strategy games? (Chess counts)</span> <br /> <label> <input name="group3" type="radio" checked /> <span>Yes</span> </label> <br /> <label> <input name="group3" type="radio" /> <span>No</span> </label> </div>
<div class="card-content white-text"> <span class="card-title">Strategies</span>
<span>Do your players play any strategy games? (Chess counts)</span> <br />
<label> <input name="party_strategies" value="1" type="radio" checked /> <span>Yes</span> </label> <br />
<label> <input name="party_strategies" value="2" type="radio" checked /> <span>Yes, league</span> </label> <br />
<label> <input name="party_strategies" value="3" type="radio" /> <span>No</span> </label>
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Special rules</span> <span>Do you use rules, which assist in adding damage/advantage? (Flanking, Limb rule , Lingering Injuries, Massive Damage, yadayada)</span> <br /> <label> <input name="group4" type="radio" checked /> <span>Yes</span> </label><br /> <label> <input name="group4" type="radio" /> <span>Multiple</span> </label><br /> <label> <input name="group4" type="radio" /> <span>No</span> </label><br /><br />
@ -129,7 +150,19 @@
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Health kind</span> <span>Are we using Max, Average or rolled HP?</span><br /> <label> <input id="mob_hp_type_averages" name="mob_hp_type" type="radio" checked onchange="usingHPDice('average')" /> <span>Averages</span> </label> <label> <input id="mob_hp_type_rolled" name="mob_hp_type" type="radio" onchange="usingHPDice('dice')" /> <span>Hit Dice</span> </label> <label> <input id="mob_hp_type_max" name="mob_hp_type" type="radio" onchange="usingHPDice('max')" /> <span>Max</span> </label> </div>
<div class="card-content white-text"> <span class="card-title">Total CR</span>
<span>Whats the TOTAL CR Of all the mobs?</span>
<div class="input-field s3">
<input placeholder="Basically the enemies Level?" id="mob_CR" min="1" type="number" class="white-text validate" />
</div>
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Health kind</span> <span>Are we using Max, Average or rolled HP?</span><br />
<label> <input value="1" id="mob_hp_type_averages" name="mob_hp_type" type="radio" checked onchange="usingHPDice('average')" /> <span>Averages</span> </label>
<label> <input value="2" id="mob_hp_type_rolled" name="mob_hp_type" type="radio" onchange="usingHPDice('dice')" /> <span>Hit Dice</span> </label>
<label> <input value="3" id="mob_hp_type_max" name="mob_hp_type" type="radio" onchange="usingHPDice('max')" /> <span>Max</span> </label>
</div>
</div>
<div class="card black" id="HP_hitdice_card">
<div class="card-content white-text"> <span class="card-title">Health Rolls</span> <span>How many Dice are used for the calculation?</span>
@ -138,8 +171,10 @@
</div>
</div>
<div class="card black" id="HP_average_card">
<div class="card-content white-text"> <span class="card-title">Health Averages</span> <span>What's the average HP of the Enemy?</span>
<div class="input-field s1"> <input placeholder="42" id="mob_hp_avg" min="1" type="number" class="white-text validate" /> </div>
<div class="card-content white-text"> <span class="card-title">Health Averages</span>
<span>What's the average HP of the Enemy?</span>
<div class="input-field s1"> <input placeholder="42" id="mob_hp_avg" min="1" type="number" class="white-text validate" />
</div>
</div>
</div>
<div class="card black" id="HP_max_card">
@ -148,8 +183,11 @@
</div>
</div>
<div class="card black">
<div class="card-content white-text"> <span class="card-title">Armor Class</span> <span>What's the average Armorclass?</span>
<div class="input-field s3"> <input placeholder="Should be at least 1" id="party_level" min="1" type="number" class="white-text validate" /> </div>
<div class="card-content white-text"> <span class="card-title">Armor Class</span>
<span>What's the average Armorclass?</span>
<div class="input-field s3">
<input placeholder="Should be at least 1" id="mob_ac" min="1" type="number" class="white-text validate" />
</div>
</div>
</div>
</div>
@ -663,6 +701,96 @@
$("#diff_description").html("I was unable to find a calculation with those parameters.... or any programming at all... give me some time, i'm still working on this app, after all.");
$("#diff_summary").html("#err_notfound");
//MODIFIERS
//These are to influence how STRONK the weighting of the different
// thins are.... yes that helps...
//Set the Mob Modifier
modifier_encounter = 1
modifier_player = 1
//All Player Stats
//The Party itself, each variable can range form 1 to infinity
var party_meelee_fighters = $("#party_meelee").val();
var party_range_fighters = $("#party_long_range").val();
var party_magic_fighters = $("#party_magic").val();
var party_support_fighters = $("#party_support").val();
//This counts the amount of Party Members for convenience
var party_amount = party_meelee_fighters + party_range_fighters + party_magic_fighters + party_support_fighters;
//Party Weighting
//Too Lazy. I could add something like when the difference
//between two categories is a certain amount, they automatically
//get weightet with more power or something. Somethingsomething
//balance.
//Party Levels (1-20)
var party_level = $("#party_level").val();
//Party Health (1-4) 1=healthy 4=almost dead
var party_health = $("input[name='party_health']:checked").val();
var party_health_score = party_health * 5
//Party Skill
var party_skill_knowledge = $("input[name='party_dndknowledge']:checked").val();
var party_skill_knowledge_score = Math.round(party_skill_knowledge * 6.666666666666666666);
var party_skill_attention = $("input[name='party_attention']:checked").val();
var party_skill_attention_score = Math.round(party_skill_attention * 6.666666666666666666);
var party_skill_strategies = $("input[name='party_strategies']:checked").val();
var party_skill_strategies_score = Math.round(party_skill_attention * 6.666666666666666666);
var party_final_score = party_skill_strategies_score + party_skill_attention_score + party_skill_knowledge_score + party_health_score
//Monster Setup
//Monster amount
var encounter_amount = $("input[name='mob_ammount']:checked").val();
// A modifier, that applies the ratio of Enemies to players
var global_amount_modifier = encounter_amount/party_amount
// What HP Type is used? 1=average 2=rolled 3=max
var encounter_hp_type = $("input[name='mob_hp_type']:checked").val();
if (encounter_hp_type == 1) {
//IF Using Health Rolls
var encounter_hp_type_rolls_amount = $("#mob_hp_dice_ammount").val();
var encounter_hp_type_rolls_dice = $("#mob_hp_dice_type").val();
//Evaluate by adding the two scores.
//I Debated multiplying the points but that would just be the max HP value.
//In the end, it's always hard to give a fair result.
var encounter_hp_type_rolls_added = encounter_hp_type_rolls_amount + encounter_hp_type_rolls_dice
var encounter_hp_type_rolls_added_score = 20/(encounter_hp_type_rolls_added / party_amount)
} else if (encounter_hp_type == 2) {
//IF Using Averages
var encounter_hp_type_averages = $("#mob_hp_avg").val();
var encounter_hp_type_averages_score = 20/(encounter_hp_type_averages / party_amount)
} else if (encounter_hp_type == 3) {
//IF Using Averages
var encounter_hp_type_max = $("#mob_hp_max").val();
var encounter_hp_type_max_score = 20/(encounter_hp_type_max / party_amount)
}
// CR Calculation
var encounter_cr = $("#mob_CR").val();
var encounter_cr_per_player = encounter_cr / party_amount
var encounter_cr_score = (encounter_cr_per_player / party_level) / 20
//This sets the AC Score of the encounter. The AC Percentage defines the "Fair" Ammount of AC per Mob
var encounter_ac = $("#mob_ac").val();
var encounter_ac_score = (encounter_ac - 2) * global_amount_modifier;
}