public override bool canAttack(UnitAPI unit) { if (this.movePoints < 1 || unit.getRace() == this.getRace()) { return(false); } if (Game.INSTANCE.map.getTile(this.x, this.y).getType() == TileType.Mountain) { return(Map.distance(unit.x, unit.y, this.x, this.y) <= 2); } else { return(Map.distance(unit.x, unit.y, this.x, this.y) <= 1); } }
public override bool canAttack(UnitAPI unit) { return(unit.getRace() != this.getRace() && Map.distance(unit.x, unit.y, this.x, this.y) <= 2 && Map.inline(unit.x, unit.y, this.x, this.y) && this.movePoints >= 1); }
/// <summary> /// Humans can only attack at a distance of 1 /// </summary> /// <param name="unit"></param> /// <returns></returns> public override bool canAttack(UnitAPI unit) { return(this.canMove(unit.x, unit.y) && unit.getRace() != this.getRace() && Map.areAdjacent(unit.x, unit.y, this.x, this.y)); }