1 // NAME : include_leeks
5 include("include_basic_global_variables");
6 include("include_ground");
7 include("include_STUFFS_G");
9 global LEEKS_CONSTANT_CARAC_G = [];
10 global CARAC_ITEMS = 0;
11 global CARAC_CORES = 1;
12 global CARAC_FREQUENCY = 2;
14 global LEEKS_VARIABLE_CARAC_G = [];
15 global CARAC_LIFE = 0;
16 global CARAC_FORCE = 1;
17 global CARAC_AGILITY = 2;
18 global CARAC_ABSOLUTE_SHIELD = 3;
19 global CARAC_RELATIVE_SHIELD = 4;
22 global CARAC_LAST_TURN_USED_CHIP = 7;
26 function initLeeksCarac(){
28 var leeks_l = ALL_LEEKS;
29 for(var leekIt_l in leeks_l){
30 LEEKS_VARIABLE_CARAC_G[leekIt_l] = [];
31 LEEKS_VARIABLE_CARAC_G[leekIt_l][0] = [getLife(leekIt_l), 0, 0, 0, 0, 8, 4, []];
33 LEEKS_VARIABLE_CARAC_G[leekIt_l][0][CARAC_FORCE] = getForce(leekIt_l);
34 LEEKS_VARIABLE_CARAC_G[leekIt_l][0][CARAC_AGILITY] = getAgility(leekIt_l);
35 }else if(leekIt_l === ME_G){
36 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_FORCE] = getForce();
37 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_AGILITY] = getAgility();
40 LEEKS_VARIABLE_CARAC_G[leekIt_l][0][CARAC_TP] = getTP(leekIt_l);
41 LEEKS_VARIABLE_CARAC_G[leekIt_l][0][CARAC_MP] = getMP(leekIt_l);
42 }else if(leekIt_l === ME_G){
43 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_TP] = getTP();
44 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_MP] = getMP();
47 LEEKS_CONSTANT_CARAC_G[leekIt_l] = [[], 1, 100];
49 LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_CORES] = getCores(leekIt_l);
50 LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_FREQUENCY] = getFrequency(leekIt_l);
51 }else if(leekIt_l === ME_G){
52 LEEKS_CONSTANT_CARAC_G[ME_G][CARAC_CORES] = CORES_G;
53 LEEKS_CONSTANT_CARAC_G[ME_G][CARAC_FREQUENCY] = getFrequency();
55 if(LEVEL_G >= 57 && CORES_G >= 2){
56 for(var weaponIt_l in getWeapons(leekIt_l)) {
57 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_ITEMS], weaponIt_l);
59 for(var chipIt_l in getChips(leekIt_l)) {
60 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_ITEMS], chipIt_l);
62 }else if(leekIt_l === ME_G){
63 for(var weaponIt_l in getWeapons()) {
64 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[ME_G][CARAC_ITEMS], weaponIt_l);
66 for(var chipIt_l in getChips()) {
67 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[ME_G][CARAC_ITEMS], chipIt_l);
75 function initLeeksCaracTurn(){
77 var leeks_l = ALL_LEEKS;
78 for(var leekIt_l in leeks_l){
79 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G] = [getLife(leekIt_l), -1, -1, -1, -1, -1, -1];
80 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_LIFE] = getLife(leekIt_l);
82 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_FORCE] = getForce(leekIt_l);
83 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_AGILITY] = getAgility(leekIt_l);
84 }else if(leekIt_l === ME_G){
85 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_FORCE] = getForce();
86 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_AGILITY] = getAgility();
89 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_TP] = getTP(leekIt_l);
90 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_MP] = getMP(leekIt_l);
91 }else if(leekIt_l === ME_G){
92 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_TP] = getTP();
93 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_MP] = getMP();
96 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_ABSOLUTE_SHIELD] = getAbsoluteShield(leekIt_l);
97 LEEKS_VARIABLE_CARAC_G[leekIt_l][TURN_G][CARAC_RELATIVE_SHIELD] = getRelativeShield(leekIt_l);
98 }else if(leekIt_l === ME_G && LEVEL_G >= 30){
99 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_ABSOLUTE_SHIELD] = getAbsoluteShield();
100 LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_RELATIVE_SHIELD] = getRelativeShield();
103 if(LEVEL_G >= 7 && leekIt_l !== ME_G){
104 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_ITEMS], getWeapon(leekIt_l));
107 updateInitialVariableCarac();
112 function updateInitialVariableCarac(){
114 var leeks_l = ALL_LEEKS;
115 for(var leekIt_l in leeks_l) {
116 if (LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_LIFE] < LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_LIFE]) {
117 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_LIFE] = LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_LIFE];
119 if (LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_FORCE] > LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_FORCE]) {
120 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_FORCE] = LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_FORCE];
122 if (LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_AGILITY] > LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_AGILITY]) {
123 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_AGILITY] = LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_AGILITY];
125 if (LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_TP] > LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_TP]) {
126 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_TP] = LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_TP];
128 if (LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_MP] > LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_MP]) {
129 LEEKS_VARIABLE_CARAC_G[ME_G][0][CARAC_MP] = LEEKS_VARIABLE_CARAC_G[ME_G][TURN_G][CARAC_MP];
136 function getItemsAttack(leek_p){
138 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
139 if(STUFFS_G[itemIt_l] !== null &&
140 STUFFS_G[itemIt_l][STUFF_DAMAGE_G][STUFF_VALUE_AVERAGE_G] != 0){
141 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_DAMAGE_G][STUFF_VALUE_AVERAGE_G];
144 assocSort(items_l, SORT_DESC);
150 function getItemsDefenseAbsolute(leek_p){
152 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
153 if(STUFFS_G[itemIt_l] !== null &&
154 STUFFS_G[itemIt_l][STUFF_ABSOLUTE_G] != 0){
155 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_ABSOLUTE_G];
158 assocSort(items_l, SORT_DESC);
164 function getItemsDefenseRelative(leek_p){
166 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
167 if(STUFFS_G[itemIt_l] !== null &&
168 STUFFS_G[itemIt_l][STUFF_RELATIVE_G] != 0){
169 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_RELATIVE_G];
172 assocSort(items_l, SORT_DESC);
178 function getItemsAgility(leek_p){
180 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
181 if(STUFFS_G[itemIt_l] !== null &&
182 STUFFS_G[itemIt_l][STUFF_AGILITY_G] != 0){
183 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_AGILITY_G];
186 assocSort(items_l, SORT_DESC);
192 function getItemsStrength(leek_p){
194 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
195 if(STUFFS_G[itemIt_l] !== null &&
196 STUFFS_G[itemIt_l][STUFF_STRENGTH_G] != 0){
197 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_STRENGTH_G];
200 assocSort(items_l, SORT_DESC);
206 function getItemsTP(leek_p){
208 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
209 if(STUFFS_G[itemIt_l] !== null &&
210 itemScoreTP(itemIt_l) != 0){
211 items_l[itemIt_l] = itemScoreTP(itemIt_l);
214 assocSort(items_l, SORT_DESC);
220 function getItemsMP(leek_p){
222 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
223 if(STUFFS_G[itemIt_l] !== null &&
224 itemScoreMP(itemIt_l) != 0){
225 items_l[itemIt_l] = itemScoreMP(itemIt_l);
228 assocSort(items_l, SORT_DESC);
234 function getItemsHeal(leek_p){
236 for(var itemIt_l in LEEKS_CONSTANT_CARAC_G[leek_p][CARAC_ITEMS]){
237 if(STUFFS_G[itemIt_l] !== null &&
238 STUFFS_G[itemIt_l][STUFF_HEAL_G][STUFF_VALUE_AVERAGE_G] != 0){
239 items_l[itemIt_l] = STUFFS_G[itemIt_l][STUFF_HEAL_G][STUFF_VALUE_AVERAGE_G];
242 assocSort(items_l, SORT_DESC);