Exemplo n.º 1
0
        private static void TellTheStory(AbstractDragon dragon)
        {
            string name     = dragon.GetName();
            int    speed    = dragon.GetSpeed();
            int    strength = dragon.GetStrenght();
            string element  = dragon.GetElement();

            Console.WriteLine(name + " the " + element + "dragon was one of them.");
            Console.WriteLine("Although still being young, he could travel " + speed + " leagues with one swipe of his mighty wings.");
            Console.WriteLine("He was the chosen one, who was foretold to collect all elements into one...\n");

            Console.WriteLine("But for now he has to fight with his hydra brother Ezoeos. \n");

            Console.WriteLine("Tail slash!");
            if (dragon.GetRole("Air") != null)
            {
                Console.Write(((AirElementalDecorator)dragon.GetRole("Air")).WingFling());
            }
            if (dragon.GetRole("Fire") != null)
            {
                Console.Write(((FireElementalDecorator)dragon.GetRole("Fire")).FireBreath());
            }

            Console.WriteLine("Dragon bite!");
            Console.Write("And Ezoeos has lost " + strength + " of his lives.");
        }
Exemplo n.º 2
0
 public override int GetSpeed()
 {
     return(m_Speed + m_BaseDragon.GetSpeed());
 }