Ejemplo n.º 1
0
        //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");
                }
            }
        }
Ejemplo n.º 2
0
        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);
                //                }
            }
        }
Ejemplo n.º 3
0
        //Fazer Decompose

        public override void ApplyActionEffects(WorldModelDST worldModel)
        {
            worldModel.Cycle += this.Duration;

            worldModel.AddToEquipped(this.InvObject);
            worldModel.RemoveFromPossessedItems(this.InvObject, 1);
            worldModel.RemoveAction("Equip_" + this.InvObject);
        }
Ejemplo n.º 4
0
        //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);
        }
Ejemplo n.º 5
0
        public override void ApplyActionEffects(WorldModelDST worldModel)
        {
            worldModel.Cycle += this.Duration;

            if (FoodConverter.ContainsKey(this.InvObject))
            {
                worldModel.RemoveFromPossessedItems(this.InvObject, 1);
                worldModel.AddToPossessedItems(FoodConverter[this.InvObject], 1);

                if (!worldModel.Possesses(this.InvObject))
                {
                    worldModel.RemoveAction(string.Concat("Cook_", this.InvObject));
                }
            }
        }
Ejemplo n.º 6
0
        public override void ApplyActionEffects(WorldModelDST worldModel)
        {
            worldModel.Cycle += this.Duration;
            worldModel.IncreaseHunger(1);
            string usedfuel = worldModel.Fuel[0].Item1;

            worldModel.RemoveFromPossessedItems(usedfuel, 1);
            worldModel.RemoveFromFuel(usedfuel);

            worldModel.Walter.Position = worldModel.GetNextPosition(this.Target, "fire");

            ActionDST action;

            if (usedfuel == "twigs")
            {
                if (!worldModel.Possesses("twigs", 2))
                {
                    worldModel.RemoveAction("Build_torch");
                    worldModel.RemoveAction("Build_pickaxe");
                }
                if (!worldModel.Possesses("twigs", 1))
                {
                    worldModel.RemoveAction("Build_axe");
                }
            }
            else if (usedfuel == "log")
            {
                if (!worldModel.Possesses("log", 2))
                {
                    worldModel.RemoveAction("Build_firepit");
                    worldModel.RemoveAction("Build_campfire");
                }
            }
            else if (usedfuel == "cutgrass")
            {
                if (!worldModel.Possesses("cutgrass", 3))
                {
                    worldModel.RemoveAction("Build_campfire");
                }
                if (!worldModel.Possesses("cutgrass", 2))
                {
                    action = new Build("torch");
                    worldModel.RemoveAction("Build_torch");
                }
            }
        }
Ejemplo n.º 7
0
        public override void ApplyActionEffects(WorldModelDST worldModel)
        {
            worldModel.Cycle += this.Duration;

            if (this.Target == "torch")
            {
                worldModel.RemoveFromPossessedItems("torch", 1);
                worldModel.AddToEquipped("torch");

                ActionDST action = new Unequip("torch");
                worldModel.AddAction(action);

                if (!worldModel.Possesses("torch"))
                {
                    worldModel.RemoveAction("Equip_torch");
                }
            }
        }
Ejemplo n.º 8
0
        //Fazer Decompose

        public override void ApplyActionEffects(WorldModelDST worldModel)
        {
            worldModel.Cycle += this.Duration;

            //<OPTIMIZATION - Dict instead of chained if's>
            if (FoodIndex.ContainsKey(this.Target))
            {
                worldModel.RemoveFromPossessedItems(this.Target, 1);

                int[] foodValues = FoodIndex[this.Target];
                int   HungerVal  = foodValues[0];

                if (HungerVal > 0)
                {
                    worldModel.DecreaseHunger(foodValues[0]);
                }
                else if (HungerVal < 0)
                {
                    worldModel.IncreaseHunger(Math.Abs(foodValues[0]));
                }

                if (foodValues.Length > 1)
                {
                    int HPVal = foodValues[1];
                    if (HPVal > 0)
                    {
                        worldModel.IncreaseHP(foodValues[1]);
                    }
                    else if (HPVal < 0)
                    {
                        worldModel.DecreaseHP(Math.Abs(foodValues[1]));
                    }
                }

                if (!worldModel.Possesses(this.Target))
                {
                    worldModel.RemoveAction("Eat_" + this.Target);
                }
            }
        }
Ejemplo n.º 9
0
        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");
                }
            }
        }