public static int GetSuffocationPerTurn(this VirtualCreature creature) { if (creature is VirtualIceTroll) { return(Constants.Game.IceTrollSuffocationPerTurn); } if (creature is VirtualLavaGiant) { return(Constants.Game.LavaGiantSuffocationPerTurn); } return(0); }
public static int PredictedDamageDoneToTarget(this VirtualCreature creature, GameObject target) { int timeToArrival = Mathf.CeilToInt((creature.location.DistanceF(target) - creature.GetSize() - target.GetSize()) / creature.GetMaxSpeed()); int timeToSuffocation = creature.GetMaxHealth() / creature.GetSuffocationPerTurn(); //if we will arrive before we die if (timeToArrival < timeToSuffocation) { int timeSpentAtTarget = timeToSuffocation - timeToArrival; int damageDone = timeSpentAtTarget * creature.GetAttackMultiplier(); return(damageDone); } else { return(0); } }