Advertisement
pasta_la_wista

GL console

Jun 6th, 2025
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const INI_COEF = 0.05;
  2. const attackWeight = 3;
  3. const coefs = {
  4.     "двойной удар. ": 1.8,
  5.     "колун. ": 1.8,
  6.     "тройной удар. ": 2.7,
  7.     "штурм. ": 1.4,
  8.     "двойной выстрел. ": 2,
  9.     "стрельба без штрафов. ": 1.6
  10. }
  11. let creatures = [];
  12. [...Object.values(obj)].forEach(creature => {
  13.     let coef = 1;
  14.     for (const skill of creature.skills) {
  15.         if (Object.keys(coefs).includes(skill.toLowerCase())) {
  16.             coef *= coefs[skill.toLowerCase()];
  17.         }
  18.     }
  19.     let new_cre = creature
  20.     const [min_dmg, max_dmg] = new_cre.damage.split("-");
  21.     [new_cre.min_dmg, new_cre.max_dmg] = [parseInt(min_dmg), parseInt(max_dmg)];
  22.     ["attack", "defence", "maxinit"].forEach(attr => {
  23.         if (typeof creature[attr] === "string") creature[attr] = creature[attr].match(/\d+/)[0]
  24.     })
  25.     new_cre.practical_hp = 80000 / new_cre.cost * new_cre.maxhealth * (1 + (0.05 * new_cre.defence));
  26.     // new_cre.practical_hp = 80000 / new_cre.cost * new_cre.maxhealth;
  27.     new_cre.practical_dmg = 80000 / new_cre.cost * ((new_cre.min_dmg + new_cre.max_dmg) / 2 * (1 + 0.05 * new_cre.attack) * coef);
  28.     new_cre.hp_plus_dmg = new_cre.practical_hp + new_cre.practical_dmg * attackWeight;
  29.     new_cre.hp_dmg_plus_ini = new_cre.hp_plus_dmg * (1 + (new_cre.maxinit - 10) * INI_COEF);
  30.     new_cre.cost = creature.cost;
  31.     new_cre.index = Object.values(obj).indexOf(creature);
  32.     // if (new_cre.index === 98) console.log(coef);
  33.     creatures.push(new_cre);
  34. })
  35. let attribute = "hp_dmg_plus_ini"
  36. creatures = creatures.filter(cre => cre.shots !== "-");
  37. // creatures = creatures.filter(cre => cre.speed > 7);
  38.  
  39. creatures.sort((a, b) => b[attribute] - a[attribute])
  40. let list = creatures;
  41. let string = "";
  42. for (const cre of list) {
  43.     // if (list.indexOf(cre) > 100) break;
  44.     const row =
  45.         list.indexOf(cre) + " " +
  46.         cre.name + " " +
  47.         "❤️" + " " +
  48.         Math.round(cre.practical_hp) + " " + "||" +
  49.         "⚔️" + " " + Math.round(cre.practical_dmg) + "\n"
  50.     string += row;
  51. }
  52. console.log(string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement