public void Fight(_Agent opponent) { try { Attack(opponent); opponent.Attack(this); } catch (NullReferenceException) { } }
public void Attack(_Agent opponent) { //opponent.health -= (int)attack / 2 + (int)attack * (baseHealth / 200); opponent.health -= attack; if (opponent.health < 0) { opponent.Die(); } }
public void RemoveEntity(_Entity entity) { if (entity is Player) { player = null; } else if (entity is _Agent) { agent = null; } else if (entity is Thing) { thing = null; } else { throw new BadEntityException("Tried to remove " + entity.ToString() + " from " + ToString()); } }
public void AssignEntity(_Entity entity) { if (entity is Player) { player = (Player)entity; } else if (entity is _Agent) { agent = (_Agent)entity; } else if (entity is Thing) { thing = (Thing)entity; } else { throw new BadEntityException("Tried to assign " + entity.ToString() + " to " + ToString()); } }