maj degats + calcul flamme/gazor
[multileek.git] / src / include_leeks__82747.lks
blob9bbbd15f12b86672313e2e651f1b21554fce71fc
1 // NAME : include_leeks
2 // DEFINITIONS :
3 //
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;
20 global CARAC_TP = 5;
21 global CARAC_MP = 6;
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, []];
32                 if(LEVEL_G >= 5){
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();
38                 }
39                 if(LEVEL_G >= 10){
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();
45                 }
47                 LEEKS_CONSTANT_CARAC_G[leekIt_l] = [[], 1, 100];
48                 if(LEVEL_G >= 8){
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();
54                 }
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);
58                         }
59                         for(var chipIt_l in getChips(leekIt_l)) {
60                                 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_ITEMS], chipIt_l);
61                         }
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);
65                         }
66                         for(var chipIt_l in getChips()) {
67                                 pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[ME_G][CARAC_ITEMS], chipIt_l);
68                         }
69                 }
70         }
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);
81                 if(LEVEL_G >= 5){
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();
87                 }
88                 if(LEVEL_G >= 10){
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();
94                 }
95                 if(LEVEL_G >= 38){
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();
101                 }
103                 if(LEVEL_G >= 7 && leekIt_l !== ME_G){
104                         pushIfAbsentAndNotNull(LEEKS_CONSTANT_CARAC_G[leekIt_l][CARAC_ITEMS], getWeapon(leekIt_l));
105                 }
106         }
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];
118                 }
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];
121                 }
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];
124                 }
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];
127                 }
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];
130                 }
131         }
136 function getItemsAttack(leek_p){
137         var items_l = [];
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];
142                 }
143         }
144         assocSort(items_l, SORT_DESC);
145         return items_l;
150 function getItemsDefenseAbsolute(leek_p){
151         var items_l = [];
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];
156                 }
157         }
158         assocSort(items_l, SORT_DESC);
159         return items_l;
164 function getItemsDefenseRelative(leek_p){
165         var items_l = [];
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];
170                 }
171         }
172         assocSort(items_l, SORT_DESC);
173         return items_l;
178 function getItemsAgility(leek_p){
179         var items_l = [];
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];
184                 }
185         }
186         assocSort(items_l, SORT_DESC);
187         return items_l;
192 function getItemsStrength(leek_p){
193         var items_l = [];
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];
198                 }
199         }
200         assocSort(items_l, SORT_DESC);
201         return items_l;
206 function getItemsTP(leek_p){
207         var items_l = [];
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);
212                 }
213         }
214         assocSort(items_l, SORT_DESC);
215         return items_l;
220 function getItemsMP(leek_p){
221         var items_l = [];
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);
226                 }
227         }
228         assocSort(items_l, SORT_DESC);
229         return items_l;
234 function getItemsHeal(leek_p){
235         var items_l = [];
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];
240                 }
241         }
242         assocSort(items_l, SORT_DESC);
243         return items_l;