Ejemplo n.º 1
0
 public void Add(CreatureModifier cm)
 {
     if (next != null)
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }
Ejemplo n.º 2
0
 public void Add(CreatureModifier cm)
 {
     if (next != null)  //ako sledeći postoji dodaj njemu cm kao sledeći
     {
         next.Add(cm);
     }
     else
     {
         next = cm;
     }
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Creature goblin = new Creature("Goblin", 2, 2);

            Console.WriteLine(goblin);
            var root = new CreatureModifier(goblin);

            root.Add(new NoBonusesModifier(goblin));
            Console.WriteLine("Adding Doubling the attack modifier");
            root.Add(new DoubleAttackModifier(goblin));
            Console.WriteLine("Adding Increasing the defence modifer");
            root.Add(new IncreaseDefenceModifier(goblin));
            root.Handle();
            Console.WriteLine(goblin);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 2, 2);

            WriteLine(goblin);
            var root = new CreatureModifier(goblin);

            WriteLine("Let's double the Goblin's attack.");
            root.Add(new DoubleAttackModifier(goblin));
            WriteLine("Let's put 'No Bonuses' spell on it...");
            root.Add(new NoBonusesModifier(goblin));
            WriteLine("Let's increment the Goblin's defense.");
            root.Add(new IncreaseDefenseModifier(goblin));
            root.Handle();
            WriteLine(goblin);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 2, 2);

            WriteLine(goblin);

            var root = new CreatureModifier(goblin);

            root.Add(new NoBonusesModifier(goblin));

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

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

            // eventually...
            root.Handle();
            WriteLine(goblin);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            var goblin = new Creature("Goblin", 1, 2);

            Console.WriteLine(goblin);

            var root = new CreatureModifier(goblin);

            root.Add(new DoubleAttackModifier(goblin));

            //kako prekinuti lanac?
            //dodajemo modifier koji zaustavlja handle() i posle njega se handle ne poziva()
            root.Add(new NoBuffModiefier(goblin));
            root.Add(new IncreaseDefenseModifier(goblin)); //nece se odraditi

            root.handle();                                 //odradi handle svih dodatih modifiera
            Console.WriteLine(goblin);


            Console.ReadLine();;
        }