internal IReadOnlyList<Item> FindNear(Creature creature) { var items = from item in arena.InternalItems where CalculateDistance(creature, item) <= MaxDistance select item; return items.ToList(); }
internal IReadOnlyList<Creature> FindNear(Creature creature) { var creatures = from c in arena.Creatures where c != creature && CalculateDistance(creature, c) <= MaxDistance select c; return creatures.ToList(); }
internal override bool PickUp(Creature creature) { Arena.Log.Add(String.Format( "{0} picks up an armor.", creature.Name)); creature.Defense = defense; creature.SkipTurnCount += 2; return true; }
internal override bool PickUp(Creature creature) { Arena.Log.Add(String.Format( "{0} picks up a weapon.", creature.Name)); creature.Attack = attack; creature.SkipTurnCount = 1; return true; }
internal override bool PickUp(Creature creature) { if (creature.Health < 10) { Arena.Log.Add(String.Format( "{0} picks up a health pack and receives {1} HP.", creature.Name, healthPoints)); creature.Health += healthPoints; creature.SkipTurnCount += 3; return true; } return false; }
internal MoveCommand(Creature creature, Direction direction) : base(creature) { this.direction = direction; }
internal AttackCommand(Creature creature, Creature enemy) : base(creature) { this.enemy = enemy; }
internal IdleCommand(Creature creature) : base(creature) { }
private int CalculateDistance(Creature creature, Creature candidate) { int xDistance = Math.Abs(creature.X - candidate.X); int yDistance = Math.Abs(creature.Y - candidate.Y); return xDistance + yDistance; }
internal Command(Creature creature) { Creature = creature; }
private bool IsCloseTo(Creature creature, int x, int y) { int xDistance = Math.Abs(creature.X - x); int yDistance = Math.Abs(creature.Y - y); return xDistance + yDistance < 10; }
private int CalculateDistance(Creature creature, Item item) { int xDistance = Math.Abs(creature.X - item.X); int yDistance = Math.Abs(creature.Y - item.Y); return xDistance + yDistance; }
protected void Hit(Creature enemy) { var command = new AttackCommand(this, enemy); commands.Add(command); }