//Fazer Decompose public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; if (worldModel.Cycle > Convert.ToSingle(15 - (worldModel.CycleInfo[2] + worldModel.CycleInfo[1])) && worldModel.Possesses("torch")) { ActionDST action = new Equip("torch"); worldModel.AddAction(action); } if (this.Target == "berries") { worldModel.RemoveFromPossessedItems("berries", 1); worldModel.DecreaseHunger(9); if (!worldModel.Possesses("berries")) { worldModel.RemoveAction("Eat_berries"); } } else if (this.Target == "carrot") { worldModel.RemoveFromPossessedItems("carrot", 1); worldModel.DecreaseHunger(13); worldModel.IncreaseHP(1); if (!worldModel.Possesses("carrot")) { worldModel.RemoveAction("Eat_carrot"); } } }
public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; if (this.Target == "torch") { worldModel.RemoveFromEquipped("torch"); worldModel.AddToPossessedItems("torch", 1); ActionDST action = new Equip("torch"); worldModel.AddAction(action); } }
public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; worldModel.IncreaseHunger(1); worldModel.Walter.Position = worldModel.GetNextPosition(this.Target, "world"); if (this.Target == "tree") { worldModel.RemoveFromWorld("tree", 1); worldModel.AddToPossessedItems("log", 1); worldModel.AddToFuel("log", 1); ActionDST action; if (worldModel.Possesses("rocks", 12)) { action = new Build("firepit"); worldModel.AddAction(action); } if (worldModel.Possesses("cutgrass", 3)) { action = new Build("campfire"); worldModel.AddAction(action); } } else if (this.Target == "boulder") { worldModel.RemoveFromWorld("boulder", 1); worldModel.AddToPossessedItems("rocks", 2); worldModel.AddToPossessedItems("flint", 1); ActionDST action; if (worldModel.Possesses("log", 2) && worldModel.Possesses("rocks", 12)) { action = new Build("firepit"); worldModel.AddAction(action); } if (worldModel.Possesses("twigs", 1)) { action = new Build("axe"); worldModel.AddAction(action); } if (worldModel.Possesses("twigs", 2) && worldModel.Possesses("flint", 2)) { action = new Build("pickaxe"); worldModel.AddAction(action); } } else if (this.Target == "log") { worldModel.RemoveFromWorld("log", 1); worldModel.AddToPossessedItems("log", 1); worldModel.AddToFuel("log", 1); ActionDST action; if (worldModel.Possesses("log", 2) && worldModel.Possesses("cutgrass", 2)) { action = new Build("campfire"); worldModel.AddAction(action); } if (worldModel.Possesses("log", 2) && worldModel.Possesses("rocks", 12)) { action = new Build("firepit"); worldModel.AddAction(action); } } else if (this.Target == "twigs") { worldModel.RemoveFromWorld("twigs", 1); worldModel.AddToPossessedItems("twigs", 1); worldModel.AddToFuel("twigs", 1); ActionDST action; if (worldModel.Possesses("flint", 1)) { action = new Build("axe"); worldModel.AddAction(action); } if (worldModel.Possesses("flint", 2) && worldModel.Possesses("twigs", 2)) { action = new Build("pickaxe"); worldModel.AddAction(action); } } else if (this.Target == "sapling") { worldModel.RemoveFromWorld("sapling", 1); worldModel.AddToPossessedItems("twigs", 1); worldModel.AddToFuel("twigs", 1); ActionDST action; if (worldModel.Possesses("flint", 1)) { action = new Build("axe"); worldModel.AddAction(action); } if (worldModel.Possesses("flint", 2) && worldModel.Possesses("twigs", 2)) { action = new Build("pickaxe"); worldModel.AddAction(action); } } else if (this.Target == "flint") { worldModel.RemoveFromWorld("flint", 1); worldModel.AddToPossessedItems("flint", 1); ActionDST action; if (worldModel.Possesses("twigs", 1)) { action = new Build("axe"); worldModel.AddAction(action); } if (worldModel.Possesses("twigs", 2) && worldModel.Possesses("flint", 2)) { action = new Build("pickaxe"); worldModel.AddAction(action); } } else if (this.Target == "cutgrass") { worldModel.RemoveFromWorld("cutgrass", 1); worldModel.AddToPossessedItems("cutgrass", 1); worldModel.AddToFuel("cutgrass", 1); ActionDST action; if (worldModel.Possesses("cutgrass", 3) && worldModel.Possesses("log", 2)) { action = new Build("campfire"); worldModel.AddAction(action); } if (worldModel.Possesses("cutgrass", 2) && worldModel.Possesses("twigs", 2)) { action = new Build("torch"); worldModel.AddAction(action); } } else if (this.Target == "grass") { worldModel.RemoveFromWorld("grass", 1); worldModel.AddToPossessedItems("cutgrass", 1); worldModel.AddToFuel("cutgrass", 1); ActionDST action; if (worldModel.Possesses("cutgrass", 3) && worldModel.Possesses("log", 2)) { action = new Build("campfire"); worldModel.AddAction(action); } if (worldModel.Possesses("cutgrass", 2) && worldModel.Possesses("twigs", 2)) { action = new Build("torch"); worldModel.AddAction(action); } } else if (this.Target == "rocks") { worldModel.RemoveFromWorld("rocks", 1); worldModel.AddToPossessedItems("rocks", 1); ActionDST action; if (worldModel.Possesses("log", 2) && worldModel.Possesses("rocks", 12)) { action = new Build("firepit"); worldModel.AddAction(action); } } else if (this.Target == "berrybush") { worldModel.RemoveFromWorld("berrybush", 1); worldModel.AddToPossessedItems("berries", 2); ActionDST action = new Eat("berries"); worldModel.AddAction(action); } else if (this.Target == "carrot" || this.Target == "carrot_planted") { worldModel.RemoveFromWorld("carrot", 1); worldModel.AddToPossessedItems("carrot", 1); ActionDST action = new Eat("carrot"); worldModel.AddAction(action); } else if (this.Target == "berries") { worldModel.RemoveFromWorld("berries", 1); worldModel.AddToPossessedItems("berries", 1); ActionDST action = new Eat("berries"); worldModel.AddAction(action); } }
public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; if (this.Target == "torch") { worldModel.RemoveFromPossessedItems("twigs", 2); worldModel.RemoveFromPossessedItems("cutgrass", 2); worldModel.AddToPossessedItems("torch", 1); if (!worldModel.Possesses("twigs", 2)) { worldModel.RemoveAction("Build_pickaxe"); } if (!worldModel.Possesses("twigs", 1)) { worldModel.RemoveAction("Build_axe"); } if (!worldModel.Possesses("twigs", 2) || !worldModel.Possesses("cutgrass", 2)) { worldModel.RemoveAction("Build_torch"); } if (worldModel.EquippedItems.Count == 0) { ActionDST action = new Unequip("torch"); worldModel.AddAction(action); } } else if (this.Target == "pickaxe") { worldModel.RemoveFromPossessedItems("twigs", 2); worldModel.RemoveFromPossessedItems("flint", 2); worldModel.AddToPossessedItems("pickaxe", 1); if (!worldModel.Possesses("twigs", 2) || !worldModel.Possesses("flint", 2)) { worldModel.RemoveAction("Build_pickaxe"); } if (!worldModel.Possesses("twigs", 1) || !worldModel.Possesses("flint", 1)) { worldModel.RemoveAction("Build_axe"); } if (!worldModel.Possesses("twigs", 2)) { worldModel.RemoveAction("Build_torch"); } } else if (this.Target == "axe") { worldModel.RemoveFromPossessedItems("twigs", 1); worldModel.RemoveFromPossessedItems("flint", 1); worldModel.AddToPossessedItems("axe", 1); if (!worldModel.Possesses("twigs", 2) || !worldModel.Possesses("flint", 2)) { worldModel.RemoveAction("Build_pickaxe"); } if (!worldModel.Possesses("twigs", 1) || !worldModel.Possesses("flint", 1)) { worldModel.RemoveAction("Build_axe"); } if (!worldModel.Possesses("twigs", 2)) { worldModel.RemoveAction("Build_torch"); } } else if (this.Target == "campfire") { worldModel.RemoveFromPossessedItems("log", 2); worldModel.RemoveFromPossessedItems("cutgrass", 3); worldModel.AddToWorld("campfire", 1, worldModel.Walter.Position.Item1, worldModel.Walter.Position.Item2); worldModel.AddToFire("campfire", worldModel.Walter.Position.Item1, worldModel.Walter.Position.Item2); if (!worldModel.Possesses("log", 2)) { worldModel.RemoveAction("Build_firepit"); } if (!worldModel.Possesses("log", 2) || !worldModel.Possesses("cutgrass", 3)) { worldModel.RemoveAction("Build_campfire"); } if (!worldModel.Possesses("cutgrass", 2)) { worldModel.RemoveAction("Build_torch"); } } else if (this.Target == "firepit") { worldModel.RemoveFromPossessedItems("log", 2); worldModel.RemoveFromPossessedItems("rocks", 12); worldModel.AddToWorld("firepit", 1, worldModel.Walter.Position.Item1, worldModel.Walter.Position.Item2); worldModel.AddToFire("firepit", worldModel.Walter.Position.Item1, worldModel.Walter.Position.Item2); if (!worldModel.Possesses("log", 2) || !worldModel.Possesses("rocks", 12)) { worldModel.RemoveAction("Build_firepit"); } if (!worldModel.Possesses("log", 2)) { worldModel.RemoveAction("Build_campfire"); } } }