示例#1
0
        public bool Perform()
        {
            if (Forest.Mana < Forest.GetValue(ManaCost))
            {
                Console.WriteLine("Not enough mana! " + Name + " costs " + Forest.GetValue(ManaCost));
                return(false);
            }
            if ((ResourceChange == null || ResourceChange.CanAfford(Forest, 1)) &&
                TestRequirements())
            {
                Forest.SpendMana(Forest.GetValue(ManaCost));
                if (ResourceChange != null)
                {
                    ResourceChange.Print(Forest, 1);
                    ResourceChange.Apply(Forest, 1);
                }
                foreach (CodeInject c in Injects["perform"])
                {
                    c(Forest, this, null);
                }
                Console.WriteLine(Text);
                Unlocked = RemainUnlocked;

                return(true);
            }
            else
            {
                Console.WriteLine(FailText);
                return(false);
            }
        }