Пример #1
0
 public void WarriorWins(IDragon dragon)
 {
     if (dragon.health < 0)
     {
         Console.WriteLine("Overkill!");
     }
     Console.WriteLine($"VICTORY, Warrior slained {dragon.DragonType}");
 }
Пример #2
0
        public void Clash(Warrior warrior, IDragon dragon)
        {
            while (warrior.health > 0 && dragon.health > 0)
            {
                Console.WriteLine("Choose from options: \n 1 - Sword Attack \n 2 - Shield Block  \n 3 - Sword Parry \n 4 - Shield Attack");
                string choice = Console.ReadLine();


                if (choice == "")
                {
                    Console.WriteLine("Enter options from 1-4");
                }
                else
                {
                    switch (choice)
                    {
                    case "1":
                        warrior.SwordAttack(sword, dragon.DragonType);
                        dragon.health -= 15;
                        BattleStatus(warrior, dragon);
                        break;

                    case "2":
                        dragon.DragonsBreath();
                        warrior.ShieldBlock(shield, dragon.DragonType);
                        warrior.health -= 15;
                        BattleStatus(warrior, dragon);
                        break;

                    case "3":
                        dragon.MeleeAttack();
                        warrior.SwordParry(sword, dragon.DragonType);
                        warrior.health -= 5;
                        BattleStatus(warrior, dragon);
                        break;

                    case "4":
                        warrior.ShieldAttack(sword, dragon.DragonType);
                        dragon.health -= 5;
                        dragon.MeleeAttack();
                        warrior.health -= 15;
                        BattleStatus(warrior, dragon);
                        break;

                    default:
                        Console.WriteLine("Choose options from 1-4");
                        break;
                    }
                }
            }
        }
Пример #3
0
 public void BattleOutcome(Warrior warrior, IDragon dragon)
 {
     if (warrior.health <= 0 && dragon.health <= 0)
     {
         Console.WriteLine("Both warrior and dragon have fallen.");
     }
     else if (warrior.health <= 0)
     {
         DragonWins(warrior);
     }
     else
     {
         WarriorWins(dragon);
     }
 }
Пример #4
0
        static void Main(string[] args)
        {
            Warrior     warrior = Generator.MakeWarrior();
            Preparation p       = Generator.MakePreperations();

            p.BattlePreperation();
            //Method DI
            warrior.EquipWeapon(new Weapon());
            warrior.EquipShield(new Shield());


            IDragon dragon = Generator.MakeDragon(p.dragonType);
            IBattle Battle = Generator.Battle(p.sword, p.shield);

            Battle.Clash(warrior, dragon);

            Battle.BattleOutcome(warrior, dragon);

            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            ISword  Sword  = Generator.Sword();
            IShield Shield = Generator.Shield();
            //Constructor DI
            Warrior     warrior = Generator.MakeWarrior(Sword, Shield);
            Preparation p       = Generator.MakePreperations();

            p.BattlePreperation();

            IDragon dragon = Generator.MakeDragon(p.dragonType);

            IBattle Battle = Generator.Battle(p.sword, p.shield);

            Battle.Clash(warrior, dragon);

            Battle.BattleOutcome(warrior, dragon);

            Console.ReadKey();
        }
Пример #6
0
        public static void Main(string[] args)
        {
            #region Service Provider

            serviceProvider = new ServiceCollection().AddSingleton <ICapsule, CapsuleService>()
                              .AddSingleton <ICore, CoreService>()
                              .AddSingleton <IDragon, DragonService>()
                              .AddSingleton <IHistory, HistoryService>()
                              .AddSingleton <IInfo, InfoService>()
                              .AddSingleton <ILandingPad, LandingPadService>()
                              .AddSingleton <ILaunch, LaunchService>()
                              .AddSingleton <ILaunchPad, LaunchPadService>()
                              .AddSingleton <IMission, MissionService>()
                              .AddSingleton <IPayload, PayloadService>()
                              .AddSingleton <IRocket, RocketService>()
                              .AddSingleton <IRoadster, RoadsterService>()
                              .AddSingleton <IShip, ShipService>()
                              .BuildServiceProvider();

            _capsule    = serviceProvider.GetService <ICapsule>();
            _core       = serviceProvider.GetService <ICore>();
            _dragon     = serviceProvider.GetService <IDragon>();
            _history    = serviceProvider.GetService <IHistory>();
            _info       = serviceProvider.GetService <IInfo>();
            _landingPad = serviceProvider.GetService <ILandingPad>();
            _launch     = serviceProvider.GetService <ILaunch>();
            _launchPad  = serviceProvider.GetService <ILaunchPad>();
            _mission    = serviceProvider.GetService <IMission>();
            _payload    = serviceProvider.GetService <IPayload>();
            _rocket     = serviceProvider.GetService <IRocket>();
            _roadster   = serviceProvider.GetService <IRoadster>();
            _ship       = serviceProvider.GetService <IShip>();

            #endregion
            InitializeApiService();
            Console.ReadLine();
        }
 public DragonDecorator(IDragon dragon)
 {
     this.dragon = dragon;
 }
 public DragonWindUpgrade(IDragon dragon)
     : base(dragon)
 {
 }
Пример #9
0
 public void BattleStatus(Warrior warrior, IDragon dragon)
 {
     Console.WriteLine($"Warrior hp: {warrior.health} | Dragon health: {dragon.health}");
 }
 public DragonFireUpgrade(IDragon dragon)
     : base(dragon)
 {
 }
 public DragonEarthUpgrade(IDragon dragon)
     : base(dragon)
 {
 }
 public DragonWaterUpgrade(IDragon dragon)
     : base(dragon)
 {
 }
Пример #13
0
 public UniverseProxy(IDragon dragon)
 {
     Dragon = dragon;
 }