コード例 #1
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);
                //                }
            }
        }