Пример #1
0
        private static void FirstApproach()
        {
            var goblin = new Creature("Goblin", 2, 2);

            WriteLine(goblin);

            // we can treat the creatureModifier as a root object for any kind of modifier we want to add on top of a creature
            var root = new CreatureModifier(goblin);

            // ex goblin cannot get buffs
            root.Add(new NoBonusesModifiers(goblin));

            WriteLine("Lets double the goblin attack");
            root.Add(new DoubleAttackModifier(goblin));

            WriteLine("Lets double the goblin defense");
            root.Add(new IncreaseDefenseModifier(goblin));

            root.Handle(); // takes care of all the modifier, debug to see how we walk the chain

            WriteLine(goblin);
        }