Пример #1
0
 public void Add(CreatureModifier creatureModifier)
 {
     if (Next != null)
     {
         Next.Add(creatureModifier);
     }
     else
     {
         Next = creatureModifier;
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 2, 2);

            Console.WriteLine(goblin);

            var rootModifier = new CreatureModifier(goblin);

            Console.WriteLine("Disable adding bonuses!");
            rootModifier.Add(new NoBonusesModifier(goblin));

            Console.WriteLine("Let's double the goblin's attack");
            rootModifier.Add(new DoubleAttackModifier(goblin));

            Console.WriteLine("Let's increase the goblin's defense");
            rootModifier.Add(new IncreaseDefenseModifier(goblin));

            rootModifier.Handle();
            Console.WriteLine(goblin);
        }