예제 #1
0
 public void Add(CreatureModifier modifier)
 {
     if (_creatureModifier == null)
     {
         _creatureModifier = modifier;
     }
     else
     {
         _creatureModifier._creatureModifier = modifier;
     }
 }
예제 #2
0
        public void Demo()
        {
            var goblin = new Creature("Goblin", 2, 2);

            Console.WriteLine(goblin);

            var root = new CreatureModifier(goblin);

            root.Add(new NoBonusModifier(goblin));

            Console.WriteLine("Let's double 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);
        }