public void Add(CreatureModifier cm)
 {
     if (next != null)
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }
示例#2
0
 public void Add(CreatureModifier cm) // this will add the modifier to the end of the linked list
 {
     if (next != null)
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 1, 1);

            WriteLine(goblin);

            var root = new CreatureModifier(goblin);

            //root.Add(new NoBonusesModifier(goblin));

            root.Add(new DoubleAttackModifier(goblin));
            root.Add(new DoubleAttackModifier(goblin));

            root.Add(new IncreaseDefenseModifier(goblin));

            // eventually...
            root.Handle();
            WriteLine(goblin);
        }