It seems this method is failing for me? always seems to return false now. any clues?
public Creature FindTarget(){
//Creature a temp null creature
Creature temp = null;
//Get creatures only when they meet my requirements
foreach(var x in getCreatures().Where(x => validTarget(x)).ToList()){
//If this target is dead, not attackable or not an enemy continue to the next mob/
if(!isAttackable(x) || !isEnemy(x) || !x.isAlive()){
continue;
}
if(temp == null){
temp = x;
//Find the closest
}else if(x.dist(me) < temp.dist(me)){
temp = x;
}
}
return temp;
}
public bool validTarget(Creature x){
//Creature is not a player
//I have first tag or no one has tag
//Other situational cases. IE Ignore "Bunker" Mobs or the flying mobs.
if(x.type != BotTypes.Player && !x.name.Contains("Bunker") && !x.name.Contains("beak") && (x.firstHitter == null || x.firstHitter == me)){
return true;
}
return false;
}
public Creature FindTarget(Creature bad){
Creature temp = null;
foreach(var x in getCreatures().Where(x => validTarget(x)).ToList()){
if(!isAttackable(x) || !isEnemy(x) || !x.isAlive() || x == bad){
continue;
}
if(temp == null){
temp = x;
}else if(x.dist(me) < temp.dist(me)){
temp = x;
}
}
return temp;
}
It seems this method is failing for me? always seems to return false now. any clues?
i actually, did more testint and found out that isEnemy is working properly.... the problem was my code.
i did write my own isEnemy code and had the same issue.... it was a fault on my part.... (was overrithing the check)