1 // NAME : include_getWeakestAliveEnemy
4 // function getAliveEnemiesRobust()
5 // function getWeakestAliveEnemy()
7 include("include_basic_global_variables");
8 include("include_ground");
12 function getAliveEnemiesRobust(){
13 //debug(">>> getAliveEnemiesRobust()");
16 for(var enemyIt_l in ENEMIES_G){
17 if(isAlive(enemyIt_l)){
18 push(enemies_l, enemyIt_l);
21 //debug("<<< getAliveEnemiesRobust() = " + enemies_l);
27 function getWeakestAliveEnemy(){
28 //debug(">>> getWeakestAliveEnemy()");
30 var enemies_l = getAliveEnemiesRobust();
31 var warning_l = 0, force_l = 1, life_l = 0, inoffensiveness_l = 0;
32 var enemyToAttack_l = [getNearestEnemy(), -99999999999];
33 for(var itEnemy_l in enemies_l){
34 life_l = getTotalLife(itEnemy_l); //getLife ou getTotalLife
36 force_l += getForce(itEnemy_l);
38 inoffensiveness_l = force_l/((1+force_l/100)*life_l*life_l);
39 //debug("enemy = " + getName(itEnemy_l) + " inoffensiveness_l = " + inoffensiveness_l);
40 if(enemyToAttack_l[1] < inoffensiveness_l){
41 enemyToAttack_l = [itEnemy_l, inoffensiveness_l];
44 //debug("<<< getWeakestAliveEnemy() = " + getName(enemyToAttack_l[0]));
45 return enemyToAttack_l[0];