//Assume he will pick the logs public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; worldModel.RemoveFromWorld(this.Target, 1); worldModel.AddToWorld("log", 2, worldModel.Walter.GetPosX(), worldModel.Walter.GetPosZ()); worldModel.AvailableActions.Add(new Pickup("log", 1)); }
public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; if (Recipes.ContainsKey(this.Recipe)) { foreach (var item in Recipes[this.Recipe]) { worldModel.RemoveFromPossessedItems(item.Key, item.Value); } if (this.X != "-" && this.Z != "-") { worldModel.AddToWorld(this.Recipe, 1, Convert.ToInt32(this.X), Convert.ToInt32(this.Z)); } else { if (!worldModel.IsEquipped("torch") && !worldModel.IsEquipped("pickaxe") && !worldModel.IsEquipped("axe")) { worldModel.AddToEquipped(this.Recipe); } worldModel.AddToPossessedItems(this.Recipe, 1); } // if (!worldModel.Possesses(this.Recipe)) // { // worldModel.RemoveAction("Build_" + this.Recipe); // } } }
//Fazer Decompose public override void ApplyActionEffects(WorldModelDST worldModel) { worldModel.Cycle += this.Duration; worldModel.RemoveFromPossessedItems(this.InvObject, 1); if (!worldModel.Possesses(this.InvObject)) { worldModel.RemoveAction("Drop_" + this.InvObject); } worldModel.AddToWorld(this.InvObject, this.Quantity, this.Position.Item1, this.Position.Item2); }
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"); } } }