1 // NAME : include_STUFFS_G
5 // global STUFF_( COOLDOWN | COST | DURATION | RADIUS | FAILS | DAMAGE* | DAMAGEOVERTIME* | HEAL* | ABSOLUTE | RELATIVE | AGILITY | STRENGTH | TP | MP | LIBERATION | SCOPE** | TELEPORTATION )_G
6 // global STUFF_( VALUE_AVERAGECOOL | VALUE_MIN | VALUE_MAX )_G *
7 // global STUFF_( SCOPE_MIN | SCOPE_MAX | SCOPE_INLINE )_G **
9 // function itemScore(item_p, nbAttack_p, leek_p, isWithFail_p)
11 // TOWATCH : http://leekwars.com/forum/category-7/topic-429
13 include("include_basic_global_variables");
15 //Generated: Mon Dec 15 2014 22:12:11 GMT+0100 (CET)
17 global STUFF_COOLDOWN_G = 0;
18 global STUFF_COST_G = 1;
19 global STUFF_DURATION_G = 2;
20 global STUFF_RADIUS_G = 3;
21 global STUFF_FAILS_G = 4;
22 global STUFF_DAMAGE_G = 5;
23 global STUFF_DAMAGEOVERTIME_G = 6;
24 global STUFF_HEAL_G = 7;
25 global STUFF_ABSOLUTE_G = 8;
26 global STUFF_RELATIVE_G = 9;
27 global STUFF_AGILITY_G = 10;
28 global STUFF_STRENGTH_G = 11;
29 global STUFF_TP_G = 12;
30 global STUFF_MP_G = 13;
31 global STUFF_LIBERATION_G = 14;
32 global STUFF_SCOPE_G = 15;
33 global STUFF_TELEPORTATION_G = 16;
35 global STUFF_VALUE_AVERAGE_G = 0;
36 global STUFF_VALUE_MIN_G = 1;
37 global STUFF_VALUE_MAX_G = 2;
39 global STUFF_SCOPE_MIN_G = 0;
40 global STUFF_SCOPE_MAX_G = 1;
41 global STUFF_SCOPE_INLINE_G = 2;
43 global STUFFS_G = null;
45 if (STUFFS_G === null) {
47 STUFFS_G[WEAPON_PISTOL] = [0, 3, 1, 0, 5, [17.5, 15, 20], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 7, false], false];
48 STUFFS_G[WEAPON_MACHINE_GUN] = [0, 4, 1, 0, 7, [22, 20, 24], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 6, true], false];
49 STUFFS_G[WEAPON_DOUBLE_GUN] = [0, 4, 2, 0, 6, [21.5, 18, 25], [6.5, 5, 8], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, false], false];
50 STUFFS_G[WEAPON_SHOTGUN] = [0, 5, 1, 0, 10, [38, 33, 43], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 5, true], false];
51 STUFFS_G[WEAPON_MAGNUM] = [0, 5, 1, 0, 4, [32.5, 25, 40], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 8, false], false];
52 STUFFS_G[WEAPON_LASER] = [0, 6, 1, 0, 9, [51, 43, 59], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, true], false];
53 STUFFS_G[WEAPON_GRENADE_LAUNCHER] = [0, 6, 1, 2, 7, [49, 45, 53], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [4, 7, false], false];
54 STUFFS_G[WEAPON_FLAME_THROWER] = [0, 7, 3, 0, 10, [37.5, 35, 40], [14, 14, 14], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, true], false];
55 STUFFS_G[WEAPON_DESTROYER] = [0, 6, 1, 0, 6, [50, 40, 60], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 6, false], false];
56 STUFFS_G[WEAPON_GAZOR] = [0, 7, 4, 3, 9, [17.5, 15, 20], [17.5, 15, 20], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, true], false];
57 STUFFS_G[WEAPON_B_LASER] = [0, 5, 1, 0, 3, [55, 50, 60], [0, 0, 0], [55, 50, 60], 0, 0, 0, 0, 0, 0, false, [2, 8, true], false];
58 STUFFS_G[WEAPON_ELECTRISOR] = [0, 7, 1, 1, 12, [75, 70, 80], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [7, 7, false], false];
59 STUFFS_G[WEAPON_M_LASER] = [0, 8, 1, 0, 8, [95, 90, 100], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 15, true], false];
60 STUFFS_G[CHIP_SHOCK] = [0, 2, 1, 0, 30, [6, 5, 7], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [0, 6, false], false];
61 STUFFS_G[CHIP_PEBBLE] = [1, 2, 1, 0, 9, [9.5, 2, 17], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [0, 5, false], false];
62 STUFFS_G[CHIP_SPARK] = [0, 3, 1, 0, 4, [12, 8, 16], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [0, 10, false], false];
63 STUFFS_G[CHIP_ICE] = [0, 4, 1, 0, 5, [18, 17, 19], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [0, 8, false], false];
64 STUFFS_G[CHIP_BANDAGE] = [1, 2, 1, 0, 5, [0, 0, 0], [0, 0, 0], [12.5, 10, 15], 0, 0, 0, 0, 0, 0, false, [0, 6, false], false];
65 STUFFS_G[CHIP_HELMET] = [4, 4, 3, 0, 10, [0, 0, 0], [0, 0, 0], [0, 0, 0], 15, 0, 0, 0, 0, 0, false, [0, 4, false], false];
66 STUFFS_G[CHIP_ROCK] = [1, 5, 1, 0, 8, [30.5, 30, 31], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 6, false], false];
67 STUFFS_G[CHIP_STRETCHING] = [3, 3, 2, 0, 5, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 50, 0, 0, 0, false, [0, 5, false], false];
68 STUFFS_G[CHIP_WALL] = [5, 4, 2, 0, 6, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 15, 0, 0, 0, 0, false, [0, 3, false], false];
69 STUFFS_G[CHIP_PROTEIN] = [3, 3, 2, 0, 6, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 50, 0, 0, false, [0, 4, false], false];
70 STUFFS_G[CHIP_SHIELD] = [3, 3, 2, 0, 5, [0, 0, 0], [0, 0, 0], [0, 0, 0], 8, 0, 0, 0, 0, 0, false, [0, 4, false], false];
71 STUFFS_G[CHIP_CURE] = [2, 4, 1, 0, 8, [0, 0, 0], [0, 0, 0], [39, 35, 43], 0, 0, 0, 0, 0, 0, false, [0, 5, false], false];
72 STUFFS_G[CHIP_FLASH] = [1, 4, 1, 1, 1, [21.5, 19, 24], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 7, true], false];
73 STUFFS_G[CHIP_MOTIVATION] = [3, 3, 2, 0, 6, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 1, 0, false, [0, 5, false], false];
74 STUFFS_G[CHIP_LEATHER_BOOTS] = [3, 3, 2, 0, 5, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 1, false, [0, 5, false], false];
75 STUFFS_G[CHIP_FLAME] = [0, 4, 1, 0, 10, [26, 25, 27], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, false], false];
76 STUFFS_G[CHIP_RAMPART] = [4, 6, 3, 0, 5, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 25, 0, 0, 0, 0, false, [2, 7, false], false];
77 STUFFS_G[CHIP_STEROID] = [4, 6, 3, 0, 5, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 100, 0, 0, false, [0, 4, false], false];
78 STUFFS_G[CHIP_DRIP] = [3, 5, 1, 2, 7, [0, 0, 0], [0, 0, 0], [37.5, 35, 40], 0, 0, 0, 0, 0, 0, false, [2, 6, false], false];
79 STUFFS_G[CHIP_WARM_UP] = [4, 6, 3, 0, 8, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 100, 0, 0, 0, false, [0, 4, false], false];
80 STUFFS_G[CHIP_STALACTITE] = [3, 6, 1, 0, 20, [65.5, 64, 67], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 7, false], false];
81 STUFFS_G[CHIP_ARMOR] = [5, 6, 4, 0, 8, [0, 0, 0], [0, 0, 0], [0, 0, 0], 25, 0, 0, 0, 0, 0, false, [0, 4, false], false];
82 STUFFS_G[CHIP_WINGED_BOOTS] = [4, 4, 3, 1, 10, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 1, false, [0, 3, false], false];
83 STUFFS_G[CHIP_VACCINE] = [3, 6, 3, 0, 7, [0, 0, 0], [0, 0, 0], [36, 34, 38], 0, 0, 0, 0, 0, 0, false, [0, 6, false], false];
84 STUFFS_G[CHIP_LIGHTNING] = [0, 4, 1, 2, 7, [41, 35, 47], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [2, 5, true], false];
85 STUFFS_G[CHIP_FORTRESS] = [4, 8, 3, 0, 6, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 40, 0, 0, 0, 0, false, [0, 3, false], false];
86 STUFFS_G[CHIP_ADRENALINE] = [4, 5, 3, 1, 8, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 1, 0, false, [0, 5, false], false];
87 STUFFS_G[CHIP_ROCKFALL] = [1, 5, 1, 2, 8, [52, 48, 56], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [5, 7, false], false];
88 STUFFS_G[CHIP_LIBERATION] = [5, 5, 1, 0, 7, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, true, [0, 6, false], false];
89 STUFFS_G[CHIP_ICEBERG] = [3, 7, 1, 2, 5, [76, 72, 80], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [3, 5, true], false];
90 STUFFS_G[CHIP_RESURRECTION] = [0, 8, 1, 0, 25, [0, 0, 0], [0, 0, 0], [200, 200, 200], 0, 0, 0, 0, 0, 0, false, [0, 3, false], false];
91 STUFFS_G[CHIP_ARMORING] = [5, 5, 1, 0, 4, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [0, 3, false], false];
92 STUFFS_G[CHIP_METEORITE] = [3, 8, 1, 2, 4, [75, 70, 80], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [4, 8, false], false];
93 STUFFS_G[CHIP_REFLEXES] = [5, 8, 4, 0, 6, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 200, 0, 0, 0, false, [0, 3, false], false];
94 STUFFS_G[CHIP_DOPING] = [5, 7, 4, 0, 14, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 200, 0, 0, false, [0, 5, false], false];
95 STUFFS_G[CHIP_TELEPORTATION] = [10, 8, 1, 0, 19, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 20, false], true];
96 STUFFS_G[CHIP_SEVEN_LEAGUE_BOOTS] = [5, 6, 4, 0, 7, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 2, false, [0, 2, false], false];
97 STUFFS_G[CHIP_RAGE] = [5, 7, 4, 0, 12, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 2, 0, false, [0, 3, false], false];
98 STUFFS_G[CHIP_INVERSION] = [4, 6, 1, 0, 3, [0, 0, 0], [0, 0, 0], [0, 0, 0], 0, 0, 0, 0, 0, 0, false, [1, 16, false], false];
102 function getStuffFails(item_p){
104 return (STUFFS_G[item_p][STUFF_FAILS_G] - CORES_G + 1);
109 function getStuffCostBasic(item_p){
111 return (STUFFS_G[item_p][STUFF_COST_G]);
116 function getStuffCostComplete(item_p){
118 var additionalTP_l = 0;
119 if(isWeapon(item_p) && item_p !== getWeapon()){
122 return (additionalTP_l + getStuffCostBasic(item_p));
127 function getNbAttackBasic(item_p){
128 //debug(">>> getNbAttackBasic(" + getItemName(item_p) + ")");
130 var nbAttack_l = getTP() / getStuffCostBasic(item_p);
131 nbAttack_l = floor(nbAttack_l);
132 //debug("<<< getNbAttackBasic(" + getItemName(item_p) + ") = " + nbAttack_l);
138 function getNbAttackComplete(leek_p, item_p){
139 //debug(">>> getNbAttackComplete(" + getItemName(item_p) + ")");
142 var availableTP = 10;
144 availableTP = getTP(leek_p);
145 }else if(leek_p === ME_G){
146 availableTP = getTP();
148 if(availableTP > getStuffCostComplete(item_p)){
150 if(STUFFS_G[item_p][STUFF_COOLDOWN_G] === 0){
151 availableTP -= getStuffCostComplete(item_p);
152 nbAttack_l += availableTP / getStuffCostBasic(item_p);
153 nbAttack_l = floor(nbAttack_l);
156 //debug("<<< getNbAttackComplete(" + getItemName(item_p) + ") = " + nbAttack_l);
162 function expectedDamage(shootLeek_p, item_p, targetLeek_p, distance_p){
163 //debug(">>> expectedDamage(" + getItemName(item_p) + ", " + getName(enemy_p) + ")");
165 if(isDead(targetLeek_p) || targetLeek_p === null){
169 var ratioDistance_l = 1 - 0.5 * (distance_p / (STUFFS_G[item_p][STUFF_RADIUS_G] + 1));
170 if(distance_p > STUFFS_G[item_p][STUFF_RADIUS_G]){
174 var finalForce_l = 1;
175 if(shootLeek_p === ME_G) {
176 finalForce_l += (getForce() / 100);
177 }else if(LEVEL_G >= 5){
178 finalForce_l += (getForce(shootLeek_p) / 100);
181 var relativeShieldTarget_l = 0;
182 if(targetLeek_p === ME_G && LEVEL_G >= 30){
183 relativeShieldTarget_l = min(75, getRelativeShield());
184 }else if(LEVEL_G >= 38){
185 relativeShieldTarget_l = min(75, getRelativeShield(targetLeek_p));
187 var finalRelativeShieldEnemy_l = 1 - (relativeShieldTarget_l/100);
189 var absoluteShieldEnemy_l = 0;
190 if(targetLeek_p === ME_G && LEVEL_G >= 30){
191 absoluteShieldEnemy_l = getAbsoluteShield();
192 }else if(LEVEL_G >= 38){
193 absoluteShieldEnemy_l = getAbsoluteShield(targetLeek_p);
198 STUFFS_G[item_p][STUFF_DAMAGE_G][STUFF_VALUE_MIN_G],
200 finalRelativeShieldEnemy_l,
201 absoluteShieldEnemy_l,
205 STUFFS_G[item_p][STUFF_DAMAGE_G][STUFF_VALUE_MAX_G],
207 finalRelativeShieldEnemy_l,
208 absoluteShieldEnemy_l,
210 var expectedDamage_l = (damageMin_l + damageMax_l)/2;
212 for(var overtimeIt_l = 0;
213 overtimeIt_l < (STUFFS_G[item_p][STUFF_DURATION_G] - 1)
214 && (TURN_G + overtimeIt_l) <= MAX_TURNS;
216 var damageMinOvertime_l = 0;
217 if(item_p === WEAPON_FLAME_THROWER || item_p === WEAPON_GAZOR){
218 damageMinOvertime_l = STUFFS_G[item_p][STUFF_DAMAGEOVERTIME_G][STUFF_VALUE_MIN_G];
220 damageMinOvertime_l =
222 STUFFS_G[item_p][STUFF_DAMAGEOVERTIME_G][STUFF_VALUE_MIN_G],
224 finalRelativeShieldEnemy_l,
225 absoluteShieldEnemy_l,
228 var damageMaxOvertime_l = 0;
229 if(item_p === WEAPON_FLAME_THROWER || item_p === WEAPON_GAZOR){
230 damageMaxOvertime_l = STUFFS_G[item_p][STUFF_DAMAGEOVERTIME_G][STUFF_VALUE_MAX_G];
232 damageMaxOvertime_l =
234 STUFFS_G[item_p][STUFF_DAMAGEOVERTIME_G][STUFF_VALUE_MAX_G],
236 finalRelativeShieldEnemy_l,
237 absoluteShieldEnemy_l,
240 expectedDamage_l += (damageMinOvertime_l + damageMaxOvertime_l)/2;
243 if(expectedDamage_l < 0){
244 expectedDamage_l = 0;
246 //debug("<<< expectedDamage(" + getItemName(item_p) + ", " + getName(enemy_p) + ") = " + expectedDamage_l);
247 return expectedDamage_l;
252 function processDamage(baseDamage_p, finalForce_p, finalRelativeShieldEnemy_p, absoluteShieldEnemy_p, ratioDistance_p){
253 //debug(">>> processDamage(" + baseDamage_p + ", " + finalForce_p + ", " + finalRelativeShieldEnemy_p + ", " + absoluteShieldEnemy_p + ", " + ratioDistance_p + ")");
255 var processedDamage_l = baseDamage_p;
256 processedDamage_l *= finalForce_p;
257 processedDamage_l *= finalRelativeShieldEnemy_p;
258 processedDamage_l *= ratioDistance_p;
259 processedDamage_l -= absoluteShieldEnemy_p;
261 if(ratioDistance_p < 0.5){
262 processedDamage_l = 0;
264 //debug("<<< processDamage(" + baseDamage_p + ", " + finalForce_p + ", " + finalRelativeShieldEnemy_p + ", " + absoluteShieldEnemy_p + ", " + ratioDistance_p + ") = " + processedDamage_l);
265 return processedDamage_l;
270 function itemScore(item_p, distance_p, nbAttack_p, leek_p, isWithFail_p){
271 //debug(">>> itemScore(" + getItemName(item_p) + ", " + distance_p + ", " + nbAttack_p + ", " + getName(leek_p) + ", " + isWithFail_p + ")");
273 var score_l = nbAttack_p * expectedDamage(ME_G, item_p, leek_p, distance_p);
274 if(isWithFail_p === true){
275 score_l *= (1 - (getStuffFails(item_p)/100));
277 //debug("<<< itemScore(" + getItemName(item_p) + ", " + distance_p + ", " + nbAttack_p + ", " + getName(leek_p) + ", " + isWithFail_p + ") = " + score_l);
283 function itemScoreBasic(item_p, distance_p, leek_p, isWithFail_p){
285 return itemScore(item_p, distance_p, getNbAttackBasic(item_p), leek_p, isWithFail_p);
290 function itemScoreRatioBasic(item_p, leek_p){
291 //debug(">>> itemScoreRatioBasic(" + getItemName(item_p) + ", " + getName(leek_p) + ")");
293 var scoreRatioBasicCost_l = itemScore(item_p, 0, 1, leek_p, true) / getStuffCostBasic(item_p);
294 //debug("<<< itemScoreRatioBasic(" + getItemName(item_p) + ", " + getName(leek_p) + ") = " + scoreRatioBasicCost_l);
295 return scoreRatioBasicCost_l;
300 function itemScoreComplete(item_p, distance_p, leek_p, isWithFail_p){
302 return itemScore(item_p, distance_p, getNbAttackComplete(ME_G, item_p), leek_p, isWithFail_p);
307 function itemScoreTP(item_p){
309 return STUFFS_G[item_p][STUFF_TP_G] * STUFFS_G[item_p][STUFF_DURATION_G];
314 function itemScoreMP(item_p){
316 return STUFFS_G[item_p][STUFF_MP_G] * STUFFS_G[item_p][STUFF_DURATION_G];