Esempio n. 1
0
        void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 2, 2);

            Console.WriteLine(goblin);

            var root = new CreatureModifier(goblin);

            root.Add(new NoBonusesModifier(goblin));

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

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

            root.Handle();

            Console.WriteLine(goblin);
        }
Esempio n. 2
0
 public void Add(CreatureModifier cm) // Creating the chain.
 {
     if (next != null)
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }
Esempio n. 3
0
 public void Add(CreatureModifier cm)
 {
     if (next != null)
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }