public bool Do(Hero hero, IEnumerable<GameObject> objects) { var stones = objects.Where(o => o is Rock).Take(2).ToList(); if (stones.Count < 2) return true; stones.First().RemoveFromContainer(); var sharpStone = new SharpStone(); if (!hero.AddToBag(sharpStone)) { Game.Map.SetHObjectFromDestination(hero.Position, sharpStone); } return true; }
public bool Do(Hero hero, IEnumerable<GameObject> objects) { var branch = objects.SingleOrDefault(o => o is Branch); var stone = objects.SingleOrDefault(ao => ao.Properties.Contains(Property.Cutter)); if (branch == null || stone == null) return true; branch.RemoveFromContainer(); var diggingStick = new DiggingStick(); if (!hero.AddToBag(diggingStick)) { Game.Map.SetHObjectFromDestination(hero.Position, diggingStick); } return true; }
public bool Do(Hero hero, IEnumerable<GameObject> objects) { var branch = objects.SingleOrDefault(o => o is Branch); var stone = objects.SingleOrDefault(o => o is Rock); if (branch == null || stone == null) return true; branch.RemoveFromContainer(); stone.RemoveFromContainer(); var axe = new StoneAxe(); if (!hero.AddToBag(axe)) { Game.Map.SetHObjectFromDestination(hero.Position, axe); } return true; }
protected override void DoLast(Hero hero, IEnumerable<GameObject> objects) { var burnable = objects.FirstOrDefault(o => o is IBurnable); var twig = objects.OfType<Twig>().FirstOrDefault(); var roastable = objects.OfType<IRoastable>().ToList(); if (burnable == null || twig == null || !roastable.Any()) { return; } twig.RemoveFromContainer(); foreach (var r in roastable) { var roasted = r.GetRoasted(); if (!hero.AddToBag(roasted)) break; ((GameObject)r).RemoveFromContainer(); } }
public bool Do(Hero hero, IEnumerable<GameObject> objects) { hero.AddToBag(objects); return true; }