Mnnielsen

From Wiki The-West EN
Jump to navigation

```js function MathArt(eins, zwei) {

 eins =
   Math.round(eins * zwei) /
   zwei;
 return eins;

} if ($('#calcBattle').length !== 0) {

 hide_ff_prem();
 var context = $('#calcBattle');
 var input_ff_skill_setting_traps = $(
   '<input type="number" style="width:150px;" class="west" placeholder="skill setting traps" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_skill_setting_traps'));
 var input_ff_skill_dodge = $(
   '<input type="number" style="width:150px;" class="west" placeholder="skill dodging" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_skill_dodge'));
 var input_ff_skill_hiding = $(
   '<input type="number" style="width:150px;" class="west" placeholder="skill hiding" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_skill_hiding'));
 var input_ff_skill_aiming = $(
   '<input type="number" style="width:150px;" class="west" placeholder="skill aiming" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_skill_aiming'));
 var input_ff_skill_leadership = $(
   '<input type="number" style="width:150px;" class="west" placeholder="skill leadership" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_skill_leadership'));
 var input_ff_lifes = $(
   '<input type="number" style="width:150px;" class="west" placeholder=" max health points" min="0" max="90000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 90000) {
       this.value = 90000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_lifes'));
 var input_ff_min_weapondamage = $(
   '<input type="number" style="width:150px;" class="west" placeholder="min rifledamage" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_min_weapondamage'));
 var input_ff_max_weapondamage = $(
   '<input type="number" style="width:150px;" class="west" placeholder="max rifledamage" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_max_weapondamage'));
 var input_ff_bonus_attack = $(
   '<input type="number" style="width:150px;" class="west" placeholder="bonus attack" min="0" max="900">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 900) {
       this.value = 900;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_bonus_attack'));
 var input_ff_bonus_defence = $(
   '<input type="number" style="width:150px;" class="west" placeholder="bonus defence" min="0" max="900">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 900) {
       this.value = 900;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_bonus_defence'));
 var input_ff_bonus_damage = $(
   '<input type="number" style="width:150px;" class="west" placeholder="bonus damage" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_bonus_damage'));
 var input_ff_bonus_resistance = $(
   '<input type="number" style="width:150px;" class="west" placeholder="bonus resistance" min="0" max="9000">'
 )
   .bind('propertychange keyup input paste', function () {
     if (this.value > 9000) {
       this.value = 9000;
     } else if (this.value < 0) {
       this.value = 0;
     }
     calcBattle();
   })
   .appendTo(context.find('.ff_bonus_resistance'));
 function hide_ff_prem() {
   document.getElementById('checked_ff_prem').innerHTML =
     ;
   document.getElementById('txt_ff_prem').innerHTML = ;
 }
 function show_ff_prem() {
   document.getElementById('checked_ff_prem').innerHTML =
     OnOrNoClick[0];
   document.getElementById('txt_ff_prem').innerHTML =
     ' Character bonus premium?';
 }
 var ff_prem_var = 0;
 var ff_worker_var = 0;
 var worker_ff = 1;
 var worker_vip_ff = 0;
 var ff_worker_list = [1, 1.2];
 var workervip_list = [0, 0.2];
 hide_ff_prem();
 checked_ff_worker.onclick = function () {
   if (ff_worker_var == 1) {
     ff_worker_var = ff_worker_var - 2;
     hide_ff_prem();
     worker_vip_ff = 0;
     ff_prem_var = 0;
   } else {
     show_ff_prem();
   }
   ff_worker_var = ff_worker_var + 1;
   document.getElementById('checked_ff_worker').innerHTML =
     OnOrNoClick[ff_worker_var];
   worker_ff = ff_worker_list[ff_worker_var];
   calcBattle();
 };
 checked_ff_prem.onclick = function () {
   if (ff_prem_var == 1) {
     ff_prem_var = ff_prem_var - 2;
   }
   ff_prem_var = ff_prem_var + 1;
   document.getElementById('checked_ff_prem').innerHTML =
     OnOrNoClick[ff_prem_var];
   worker_vip_ff = workervip_list[ff_prem_var];
   calcBattle();
 };
 function calcBattle() {
   var pit_ff = parseInt(
       input_ff_skill_setting_traps.val()
     ),
     dod_ff = parseInt(input_ff_skill_dodge.val()),
     hid_ff = parseInt(input_ff_skill_hiding.val()),
     aim_ff = parseInt(input_ff_skill_aiming.val()),
     lea_ff = parseInt(input_ff_skill_leadership.val()),
     hp_ff = parseInt(input_ff_lifes.val()),
     lDMG_ff = parseInt(input_ff_min_weapondamage.val()),
     hDMG_ff = parseInt(input_ff_max_weapondamage.val()),
     bonatt_ff = (parseInt(100 * input_ff_bonus_attack.val())) / 100,
     bondef_ff = (parseInt((100 * input_ff_bonus_defence.val())) / 100),
     bonDMG_ff = (parseInt((100 * input_ff_bonus_damage.val())) / 100),
     bonres_ff = (parseInt((100 * input_ff_bonus_resistance.val())) / 100);

if ( !(

   isNaN(pit_ff) ||
   isNaN(dod_ff) ||
   isNaN(hid_ff) ||
   isNaN(aim_ff) ||
   isNaN(lea_ff)

) ) { var print_general_list = 0; var print_hp_list = 0; var print_dmg_list = 0; var print_res_list = 0; var print_dmg_list2 = 0; if (isNaN(bonatt_ff)) {

   var ff_att_hit_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(aim_ff, 0.5) +
       Math.pow(hid_ff, 0.6) +
       25) *
   (worker_ff + worker_vip_ff), 100);
   var ff_def_hit_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(aim_ff, 0.5) +
       Math.pow(pit_ff, 0.6) +
       25) *
   (worker_ff + worker_vip_ff), 100);

} else {

   var ff_att_hit_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(aim_ff, 0.5) +
       Math.pow(hid_ff, 0.6) +
       25 +
       bonatt_ff) *
   (worker_ff + worker_vip_ff), 100);
   var ff_def_hit_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(aim_ff, 0.5) +
       Math.pow(pit_ff, 0.6) +
       25 +
       bonatt_ff) *
   (worker_ff + worker_vip_ff), 100);

} if (isNaN(bondef_ff)) {

   var ff_att_dodge_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(dod_ff, 0.5) +
       Math.pow(hid_ff, 0.6) +
       10) *
   (worker_ff + worker_vip_ff), 100);
   var ff_def_dodge_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(dod_ff, 0.5) +
       Math.pow(pit_ff, 0.6) +
       10) *
   (worker_ff + worker_vip_ff), 100);

} else {

   var ff_att_dodge_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(dod_ff, 0.5) +
       Math.pow(hid_ff, 0.6) +
       10 +
       bondef_ff) *
   (worker_ff + worker_vip_ff), 100);
   var ff_def_dodge_chance =
   MathArt(
   (Math.pow(lea_ff, 0.5) +
       Math.pow(dod_ff, 0.5) +
       Math.pow(pit_ff, 0.6) +
       10 +
       bondef_ff) *
   (worker_ff + worker_vip_ff), 100);

} if (!isNaN(hp_ff)) {

   var print_general_list = 1;
   var print_res_list = 1;
   var print_hp_list = 1;
   if (isNaN(bonres_ff)) {
   var ff_att_res = MathArt((300 * hid_ff) / hp_ff, 100);
   var ff_def_res = MathArt((300 * pit_ff) / hp_ff, 100);
   } else {
   var ff_att_res =
       MathArt((300 * hid_ff) / hp_ff + bonres_ff, 100);
   var ff_def_res =
       MathArt((300 * pit_ff) / hp_ff + bonres_ff, 100);
   }

if (!isNaN(lDMG_ff) || !isNaN(hDMG_ff)) {

 var print_dmg_list = 1;
 var print_dmg_list2 = 1;
 if (isNaN(bonDMG_ff)) {
   var ff_min_dmg = MathArt((lDMG_ff * lea_ff) / hp_ff + lDMG_ff, 1);
   var ff_max_dmg = MathArt((hDMG_ff * lea_ff) / hp_ff + hDMG_ff, 1);
 } else {
   var ff_min_dmg =
   MathArt(
     ((lDMG_ff + bonDMG_ff) * lea_ff) / hp_ff +
     (lDMG_ff + bonDMG_ff), 1);
   var ff_max_dmg =
   MathArt(
     ((hDMG_ff + bonDMG_ff) * lea_ff) / hp_ff +
     (hDMG_ff + bonDMG_ff), 1);
 }
 if (isNaN(lDMG_ff) && !isNaN(hDMG_ff)) {
   var print_dmg_list2 = 3;
 }
 if (isNaN(hDMG_ff) && !isNaN(lDMG_ff)) {
   var print_dmg_list2 = 2;
 }

} else {

 var print_dmg_list = 0;
 var print_dmg_list2 = 0;

} } else {

   var print_general_list = 0;
   var print_res_list = 0;
   var print_hp_list = 0;

} var print_att_res = [, 'Resistance']; var print_def_res = [, 'Resistance']; var print_att_res_val = [, '<img alt="Icon resistance.png" src="/images/7/78/Icon_resistance.png" decoding="async" width="16" height="16"> ' + ff_att_res + '']; var print_def_res_val = [, '<img alt="Icon resistance.png" src="/images/7/78/Icon_resistance.png" decoding="async" width="16" height="16"> ' + ff_def_res + '']; var print_dmg = [, 'damage']; var print_dmg_val = [, '<img alt="Damage.png" src="/images/thumb/6/6a/Damage.png/20px-Damage.png" decoding="async" srcset="/images/6/6a/Damage.png 1.5x" width="20" height="20"> ' + ff_min_dmg + ' - ' + ff_max_dmg + '', '<img alt="Damage.png" src="/images/thumb/6/6a/Damage.png/20px-Damage.png" decoding="async" srcset="/images/6/6a/Damage.png 1.5x" width="20" height="20"> ' + ff_min_dmg + '', '<img alt="Damage.png" src="/images/thumb/6/6a/Damage.png/20px-Damage.png" decoding="async" srcset="/images/6/6a/Damage.png 1.5x" width="20" height="20"> ' + ff_max_dmg + '']; var print_hp = [, 'health Points']; var print_hp_val = [, '<img alt="Icon lifes.png" src="/images/d/dc/Icon_lifes.png" decoding="async" width="20" height="18"> ' + hp_ff + '']; var print_general = [, 'general']; context

   .find('.ff_result')

.html('

<tbody></tbody>
attacker' + print_general[print_general_list] + 'defender
Attack value' + print_hp[print_hp_list] + 'Attack value
<img alt="Icon attacker.png" src="/images/8/86/Icon_attacker.png" decoding="async" width="18" height="11"> ' + ff_att_hit_chance + '' + print_hp_val[print_hp_list] + '<img alt="Icon attacker.png" src="/images/8/86/Icon_attacker.png" decoding="async" width="18" height="11"> ' + ff_def_hit_chance + '
Defense value' + print_dmg[print_dmg_list] + 'Defense value
<img alt="Icon defender.png" src="/images/0/00/Icon_defender.png" decoding="async" width="10" height="13"> ' + ff_att_dodge_chance + '' + print_dmg_val[print_dmg_list2] + '<img alt="Icon defender.png" src="/images/0/00/Icon_defender.png" decoding="async" width="10" height="13"> ' + ff_def_dodge_chance + '
' + print_att_res[print_res_list] + '' + print_def_res[print_res_list] + '
' + print_att_res_val[print_res_list] + '' + print_def_res_val[print_res_list] + '

');

} else { context

   .find('.ff_result')
   .html('Enter more Values to calculate');

}

 }

} ```