Example #1
0
        private IWarrior GetWarriorAfterCollision(IWarrior warrior, IPiece piece)
        {
            if (piece is IFruit)
            {
                warrior.Eat((IFruit)piece);
                return(warrior);
            }
            else if (piece is IWarrior)
            {
                IWarrior defendingWarrrior = (IWarrior)piece;

                this.winner = warrior;

                if (warrior.Power > defendingWarrrior.Power)
                {
                    this.winner         = warrior;
                    this.gameIsFinished = true;
                }
                else if (warrior.Power < defendingWarrrior.Power)
                {
                    this.winner         = defendingWarrrior;
                    this.gameIsFinished = true;
                }
                else
                {
                    this.gameIsDraw     = true;
                    this.gameIsFinished = true;
                }
            }

            return(this.winner);
        }
Example #2
0
        public static void Main()
        {
            var   ninjaWithSword   = new Ninja(new Sword());
            Ninja ninjaWithNunjack = new Ninja(new Nunjucks());

            Trooper trooper = new Trooper();

            IWarrior[] warriors = new IWarrior[] { ninjaWithNunjack, ninjaWithSword, trooper };

            foreach (var warrior in warriors)
            {
                warrior.Move();
                warrior.Attack();
                if (warrior is IStealth)
                {
                    IStealth stealthWarior = ((IStealth)warrior);
                    stealthWarior.EnableInvisibility();
                }
            }

            // now I want my ninja to use nunjucks...use the interface IWarrior

            //now I want a human...create an IHuman that can move interface

            //Now I want to have a collection of all people: ninjas and humans.
            Console.ReadLine();
        }
        public Direction GetNextMove(IWarrior warrior)
        {
            Console.WriteLine($"Player{warrior.VisualSymbol}, make a move please!");

            var direction = new Direction();

            ConsoleKeyInfo keyInfo;

            while ((keyInfo = Console.ReadKey(true)).Key != ConsoleKey.Escape)
            {
                switch (keyInfo.Key)
                {
                case ConsoleKey.UpArrow:
                    direction = Direction.Up;
                    return(direction);

                case ConsoleKey.RightArrow:
                    direction = Direction.Right;
                    return(direction);

                case ConsoleKey.DownArrow:
                    direction = Direction.Down;
                    return(direction);

                case ConsoleKey.LeftArrow:
                    direction = Direction.Left;
                    return(direction);
                }
            }

            return(direction);
        }
Example #4
0
        public static XmlWarrior ToXml(this IWarrior warrior)
        {
            XmlWarrior xmlWarrior = new XmlWarrior()
            {
                TypeOfWarrior = warrior.TypeName,
                Name          = warrior.Name
            };

            xmlWarrior.EquipmentList.AddRange(warrior.Equipment.Select(x => x.Name).ToList());

            if (warrior is IHenchMen)
            {
                IHenchMen henchMan = warrior as IHenchMen;
                xmlWarrior.AmountInGroup = henchMan.AmountInGroup;
            }
            else if (warrior is IHero)
            {
                IHero hero = warrior as IHero;
                xmlWarrior.SkillList.AddRange(hero.Skills.Select(x => x.SkillName).ToList());
            }
            if (warrior is IWizard)
            {
                IWizard wizard = warrior as IWizard;
                xmlWarrior.SpellList.AddRange(wizard.DrawnSpells.Select(x => x.SpellName).ToList());
            }

            return(xmlWarrior);
        }
Example #5
0
    private void OnEnable()
    {
        if (character.GetComponent <IWarrior>() == null)
        {
            Debug.LogError("character needs to be of: " + typeof(IWarrior));
        }
        else
        {
            warrior = character.GetComponent <IWarrior>();
        }

        if (playerMovement == null)
        {
            if (GetComponent <Movement>() == null)
            {
                playerMovement = gameObject.AddComponent <Movement>();
            }
            else
            {
                playerMovement = GetComponent <Movement>();
            }
        }

        playerRigidbody.mass        = currMass();
        playerMovement.MovingObject = playerRigidbody;

        spriteRenderer = GetComponent <SpriteRenderer>();
        baseMat        = spriteRenderer.material;
    }
        public void FightBetween(IWarrior redFighter, IWarrior blueFighter)
        {
            this.Log("Fight started");

            bool redAttack = this.GetRandomBoolean();

            IWarrior attacker;
            IWarrior defender;

            if (redAttack)
            {
                attacker = redFighter;
                defender = blueFighter;
            }
            else
            {
                attacker = blueFighter;
                defender = redFighter;
            }

            attacker.Attacks(defender);

            var message = string.Format("{0} kills {1} with {2}", attacker, defender, attacker.Weapon);
            this.InvokeFightEvent(message);
            this.Log(message);

            this.Log("Fight ended");
        }
Example #7
0
        public void BuildRoster(IWarrior warrior)
        {
            _ExperienceList.Clear();
            this.m_StackPanel.Children.Clear();

            int numberOFRows = warrior.MaximumExperience / 10;

            int overallCounter = 1;

            for (int rowCounter = 0; rowCounter < numberOFRows; rowCounter++)
            {
                StackPanel panel = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                };

                for (int i = 0; i < warrior.MaximumExperience; i++)
                {
                    //mmmm TODO logic and knowledge of a domain model
                    bool        hasThickborder = warrior.IsLevelUp(overallCounter);
                    bool        isChecked      = overallCounter < warrior.CurrentExperience;
                    IExperience exp            = new Experience(overallCounter, hasThickborder, isChecked);
                    overallCounter++;
                    _ExperienceList.Add(exp);
                    panel.Children.Add(exp as Experience);
                }
                this.m_StackPanel.Children.Add(panel);
            }
        }
Example #8
0
        /// <summary>
        /// Maximums the close combat weapons reached.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <returns>true if the Maximum of 2 is reached</returns>
        public static bool MaximumCloseCombatWeaponsReached(this IWarrior warrior)
        {
            if (CountNumberOf <ICloseCombatWeapon>(warrior.Equipment) >= warrior.MaximumCloseCombatWeapons)
            {
                return(true);
            }

            List <ICloseCombatWeapon> closeCombatList = new List <ICloseCombatWeapon>();

            foreach (var item in warrior.Equipment)
            {
                if (item is ICloseCombatWeapon)
                {
                    ICloseCombatWeapon closeCombatWeapon = item as ICloseCombatWeapon;

                    if (closeCombatWeapon.CloseCombatSpecialRules.Any(x => x.Equals(CloseCombatWeaponRules.Pair)))
                    {
                        return(true);
                    }

                    closeCombatList.Add(item as ICloseCombatWeapon);
                }
            }

            return(false);
        }
        public void FightBetween(IWarrior redFighter, IWarrior blueFighter)
        {
            this.Log("Fight started");

            bool redAttack = this.GetRandomBoolean();

            IWarrior attacker;
            IWarrior defender;

            if (redAttack)
            {
                attacker = redFighter;
                defender = blueFighter;
            }
            else
            {
                attacker = blueFighter;
                defender = redFighter;
            }

            attacker.Attacks(defender);

            var message = string.Format("{0} kills {1} with {2}", attacker, defender, attacker.Weapon);

            this.InvokeFightEvent(message);
            this.Log(message);

            this.Log("Fight ended");
        }
Example #10
0
 protected void ValidateNinjaWarriorWithOverides(IWarrior warrior)
 {
     warrior.ShouldBeInstanceOf<Ninja>();
     warrior.Weapon.ShouldBeInstanceOf<Shuriken>();
     Ninja ninja = warrior as Ninja;
     ninja.SecondaryWeapon.ShouldBeInstanceOf<Sword>();
     ninja.VerySecretWeaponAccessor.ShouldBeInstanceOf<Sword>();
 }
Example #11
0
 protected void ValidateNinjaWarriorWithOverides(IWarrior warrior)
 {
     Assert.IsType<Ninja>(warrior);
     Assert.IsType<Shuriken>(warrior.Weapon);
     Ninja ninja = warrior as Ninja;
     Assert.IsType<Sword>(ninja.SecondaryWeapon);
     Assert.IsType<Sword>(ninja.SecretWeaponAccessor);
 }
Example #12
0
 public void Hit(IWarrior target)
 {
     if (target.Weapon == this)
     {
         throw new SuicidalException();
     }
     target.Defend(Damage);
 }
Example #13
0
        public IWarrior GetAnInstance()
        {
            IWarrior    newInstance = GetANewInstance();
            WarriorBase warriorBase = newInstance as WarriorBase;

            warriorBase.CreationDate = DateTime.Now;

            return(newInstance);
        }
        public WarriorViewModel(IWarrior warrior)
        {
            if (warrior == null)
            {
                throw new ArgumentNullException("Warrior is null");
            }
            Warrior = warrior;
            Warrior.PropertiesChanged      += Warrior_PropertiesChanged;
            ShowWeaponsPickerCommand        = new ShowWeaponsPicker(this);
            BuyWarriorCommand               = new BuyWarrior(this);
            RemoveWarriorCommand            = new RemoveWarrior(this);
            IncreaseWarriorBuyAmountCommand = new IncreaseBuyAmount(this);
            DecreaseWarriorBuyAmountCommand = new DecreaseBuyAmount(this);
            ShowSkillSelectorCommand        = new ShowSkillSelector(this);

            foreach (IEquipment item in warrior.Equipment)
            {
                EquippedWeapons.Add(new EquipmentSummaryViewModel(item));
            }

            foreach (var item in warrior.AllowedSkills)
            {
                //if (!warrior.Skills.Contains(item))
                //{
                AllowedSkills.Add(new SkillViewModel(item));
                //}
            }

            IWizard wizard = warrior as IWizard;

            if (wizard != null)
            {
                foreach (var item in wizard.DrawnSpells)
                {
                    Spells.Add(new SpellViewModel(item));
                }
            }

            IHero hero = warrior as IHero;

            if (hero != null)
            {
                foreach (var item in hero.Injuries)
                {
                    InjuryViewModel injuryModel = new InjuryViewModel(item);

                    Injuries.Add(injuryModel);
                    InjuriesSimple.Add(injuryModel);
                }

                foreach (var item in hero.Skills)
                {
                    Skills.Add(new SkillViewModel(item));
                    SkillsSimple.Add(new SkillViewModelSimple(item));
                }
            }
        }
Example #15
0
 public bool IsBetter(IWarrior other)
 {
     ++CompareCount;
     if (other == null || !(other is Warrior))
     {
         return(false);
     }
     return(m_internal >= (other as Warrior).m_internal);
 }
Example #16
0
        protected void ValidateNinjaWarriorWithOverides(IWarrior warrior)
        {
            Assert.IsType <Ninja>(warrior);
            Assert.IsType <Shuriken>(warrior.Weapon);
            Ninja ninja = warrior as Ninja;

            Assert.IsType <Sword>(ninja.SecondaryWeapon);
            Assert.IsType <Sword>(ninja.SecretWeaponAccessor);
        }
 /// <summary>
 /// ��֤սʿ
 /// </summary>
 /// <param name="warrior"></param>
 protected void ValidateWarrior(IWarrior warrior)
 {
     //���սʿ������һ������
     warrior.Should().BeOfType<FootSoldier>();
     //սʿ����������
     warrior.Weapon.Should().NotBeNull();
     //սʿ�����������Ƿ���
     warrior.Weapon.Should().BeOfType<Shuriken>();
 }
        protected void ValidateNinjaWarriorWithOverides(IWarrior warrior)
        {
            warrior.Should().BeOfType <Ninja>();
            warrior.Weapon.Should().BeOfType <Shuriken>();
            Ninja ninja = warrior as Ninja;

            ninja.SecondaryWeapon.Should().BeOfType <Sword>();
            ninja.VerySecretWeaponAccessor.Should().BeOfType <Sword>();
        }
Example #19
0
        public static void Main(string[] args)
        {
            IKernel kernel = new StandardKernel(new WarriorModule());

            IWarrior samurai = kernel.Get <IWarrior>();

            samurai.Attack("bad programmers");
            Console.ReadLine();
        }
Example #20
0
    // warriors is IWarrior[5]
    public static IWarrior SelectMedian(IWarrior[] warriors)
    {
        IWarrior a = warriors[0], b = warriors[1], c = warriors[2], d = warriors[3], e = warriors[4];
        IWarrior temp;

        if (b.IsBetter(a))
        {
            temp = b;
            b    = a;
            a    = temp;
        }
        if (d.IsBetter(c))
        {
            temp = d;
            d    = c;
            c    = temp;
        }
        if (c.IsBetter(a))
        {
            temp = a;
            a    = c;
            c    = temp;

            temp = b;
            b    = d;
            d    = temp;
        }
        if (e.IsBetter(b))
        {
            temp = e;
            e    = b;
            b    = temp;
        }
        if (b.IsBetter(c))
        {
            if (c.IsBetter(e))
            {
                return(c);
            }
            else
            {
                return(e);
            }
        }
        else
        {
            if (b.IsBetter(d))
            {
                return(b);
            }
            else
            {
                return(d);
            }
        }
    }
        public WarriorPlayView(IWarrior warrior) : this()
        {
            _ViewModel              = new WarriorViewModel(warrior);
            this.DataContext        = _ViewModel;
            _StatisticsView.Warrior = _ViewModel.Warrior;
            _ExpierenceView.BuildRoster(_ViewModel.Warrior);

            _AfflictionsView.ViewModel = new AfflictionsViewModel(_ViewModel.Warrior.Afflictions);
            _ViewModel.ExperienceList  = _ExpierenceView.ExperienceList;
        }
Example #22
0
        private int NumberOffWarriorsOfThisTypeInRoster(IWarrior warrior)
        {
            int total = 0;

            foreach (var item in Warriors)
            {
                total += item.AmountOfThisType(warrior);
            }
            return(total);
        }
Example #23
0
        public void Attack(IWarrior target)
        {
            Random r = new Random();
            List<IArmor> armors = new List<IArmor> { target.MainArmor, target.SideArmor };
            var defense = armors
                .Where(a => a != null && a.Type == ArmorType.Ranged)
                .Sum(a => a.Defense);

            var actualDamage = weapon.Damage - defense;
            target.HealthPoints -= (int)(actualDamage * (0.5+r.NextDouble()));
        }
Example #24
0
 public static IWarrior[] SortWarrior(IWarrior warrior1, IWarrior warrior2)
 {
     if (warrior1.IsBetter(warrior2))
     {
         return(new IWarrior[] { warrior1, warrior2 });
     }
     else
     {
         return(new IWarrior[] { warrior2, warrior1 });
     }
 }
Example #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Characteristic"/> class.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="characteristicValue">The characteristic value.</param>
        /// <param name="baseValue">The base value.</param>
        /// <exception cref="ArgumentNullException">IWarrrior is null</exception>
        public Characteristic(IWarrior owner, Characteristics characteristicValue, int baseValue)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("IWarrrior is null");
            }

            _Warrior            = (WarriorBase)owner;
            CharacteristicValue = characteristicValue;
            BaseValue           = baseValue;
        }
 /// <summary>
 /// ͨ����д�󣬶��ձ�����������֤
 /// </summary>
 /// <param name="warrior"></param>
 protected void ValidateNinjaWarriorWithOverides(IWarrior warrior)
 {
     //սʿ�����ձ���ʿ
     warrior.Should().BeOfType<Ninja>();
     //սʿ�����������Ƿ���
     warrior.Weapon.Should().BeOfType<Shuriken>();
     Ninja ninja = warrior as Ninja;
     //�ձ���ʿ�ĸ������������ǵ�
     ninja.SecondaryWeapon.Should().BeOfType<Sword>();
     //�ձ���ʿ�ĵ���Ӧ���ǵ�
     ninja.VerySecretWeaponAccessor.Should().BeOfType<Sword>();
 }
Example #27
0
        public void Attack(IWarrior target)
        {
            var r = new Random();
            List<IArmor> armors = new List<IArmor> { target.MainArmor, target.SideArmor };
            var armorType = BattleHelper.GetNeededArmorType(Weapon);

            var defense = armors
                .Where(a => a != null && a.Type == armorType)
                .Sum(a => a.Defense);

            var actualDamage = Weapon.Damage - defense;
            target.HealthPoints -= (int)(actualDamage * (0.8 + r.NextDouble() * 0.4));
        }
Example #28
0
        public void Initialize()
        {
            this.warriors = this.input.GetWarriors(2);

            this.AddWarriorsToBoard();

            this.AddFruitsToBoard();

            this.currentWarriorIndex = 0;
            this.currentTurnsLeft    = 0;
            this.gameIsFinished      = false;
            this.gameIsDraw          = false;
            this.winner = null;
        }
Example #29
0
        public int AmountOfThisType(IWarrior warrior)
        {
            if (this.TypeName.Equals(warrior.TypeName))
            {
                IHenchMen henchMan = this as IHenchMen;

                if (henchMan != null)
                {
                    return(henchMan.AmountInGroup);
                }
                return(1);
            }
            return(0);
        }
 public EngineWarrior(IWarrior warrior, EngineCore core, int index)
 {
     SourceWarrior = warrior;
     warriorIndex  = index;
     if (Pin == PSpace.UNSHARED)
     {
         PSpaceIndex = PSpace.UNSHARED;
     }
     else
     {
         PSpaceIndex = PSpace.PIN_APPEARED;
     }
     Tasks     = new Queue <int>();
     this.core = core;
 }
Example #31
0
        /// <summary>
        /// Verifies if this and another warrior
        /// TODO obsolete, so remove
        /// </summary>
        /// <param name="warrior">The warrior.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">warrior is null</exception>
        public bool AreEqual(IWarrior warrior)
        {
            if (warrior == null)
            {
                throw new ArgumentNullException("warrior is null");
            }

            bool areEqual =
                warrior.GetType().Name.Equals(this.GetType().Name) &&
                warrior.CurrentExperience == this.CurrentExperience &&
                this.CreationDate != null &&
                this.GetHashCode() == warrior.GetHashCode();

            return(areEqual);
        }
Example #32
0
        protected override void InitializeMatch(IProject aProject)
        {
            project = aProject;
            base.InitializeMatch(project);
            if (project.Warriors.Count != rules.WarriorsCount)
            {
                throw new EngineException("Count of warriors differ from rules");
            }

            random = project.EngineOptions.Random;
            if (random == null)
            {
                random = new Random();
            }
            forcedAddresses = project.EngineOptions.ForcedAddresses;
            sourceWarriors  = project.Warriors;

            warriors        = new List <EngineWarrior>(rules.WarriorsCount);
            runningWarriors = new List <IRunningWarrior>(rules.WarriorsCount);
            iWarriors       = new List <IWarrior>(rules.WarriorsCount);

            for (int w = 0; w < rules.WarriorsCount; w++)
            {
                IWarrior sourceWarrior = sourceWarriors[w];
                if (!sourceWarrior.Rules.Equals(rules))
                {
                    throw new EngineException("Warrior was compiled under different rules");
                }
                EngineWarrior engineWarrior = new EngineWarrior(sourceWarrior, this, w);

                warriors.Add(engineWarrior);
                runningWarriors.Add(engineWarrior);
                iWarriors.Add(engineWarrior);
            }
            InitPSpaces();
            permutate = project.EngineOptions.Permutate;
            if (forcedAddresses != null && forcedAddresses.Count > 0)
            {
                seed = forcedAddresses[1] - rules.MinDistance;
            }
            else
            {
                seed = random.Next();
            }
        }
Example #33
0
 protected override IWarrior Parse(string filename)
 {
     if (cache.ContainsKey(filename))
     {
         return(cache[filename]);
     }
     else
     {
         Project tmpProj = new Project(project.Rules);
         tmpProj.ParserOptions = project.ParserOptions;
         tmpProj.WarriorFiles.Add(filename);
         ParseResult res = parser.Parse(tmpProj, console);
         res.Messages.AddRange(res.Messages);
         IWarrior warrior = tmpProj.Warriors[0];
         cache[filename] = warrior;
         return(warrior);
     }
 }
Example #34
0
        public Availabilities GetException(IWarrior warrior)
        {
            if (Exceptions != null)
            {
                foreach (Type item in Exceptions)
                {
                    if (item.IsInterface && warrior.GetType().GetInterfaces().Any(x => x.Equals(item)))
                    {
                        return(ExceptionAvailabilityRoll);
                    }
                    else if (item.Name.Equals(warrior.GetType().Name))
                    {
                        return(ExceptionAvailabilityRoll);
                    }
                }
            }

            return(AvailabilityRoll);
        }
Example #35
0
        public IWarrior AddWarrior(IWarrior warrior)
        {
            IWarrior newWarrior = warrior.GetAnInstance();

            Warriors.Add(newWarrior);

            newWarrior.PropertiesChanged += NewWarrior_PropertiesChanged;

            if (newWarrior is IHenchMen)
            {
                IHenchMen henchMan = newWarrior as IHenchMen;
                henchMan.IncreaseGroupByOne();
            }

            InvokeEvent(WarBandChanged);
            InvokeEvent(WarBandWariorListChanged);

            return(newWarrior);
        }
Example #36
0
        private IList <ResultsHelper> PrepareResults(IProject project, bool sort)
        {
            List <ResultsHelper> res = new List <ResultsHelper>();

            for (int w = 0; w < warriorsCount; w++)
            {
                IWarrior      warrior = project.Warriors[w];
                ResultsHelper r       = new ResultsHelper();
                r.originalIndex = w;
                r.score         = score[w];
                r.warrior       = warrior;
                res.Add(r);
            }
            if (sort)
            {
                res.Sort();
            }
            return(res);
        }
Example #37
0
        /// <summary>
        /// Parse warrior files in project parameter considering parser options and rules
        /// </summary>
        /// <param name="aProject">files, rules, options</param>
        /// <param name="aConsole">output console, could be null</param>
        /// <returns>list of errors</returns>
        public virtual ParseResult Parse(IProject aProject, ISimpleOutput aConsole)
        {
            project = aProject;
            result  = new ParseResult();
            console = aConsole;
            project.Warriors.Clear();
            int succ = 0;

            foreach (string file in project.WarriorFiles)
            {
                if (project.ParserOptions.StatusLine && console != null)
                {
                    console.WriteLine("Parsing: " + file);
                }
                IWarrior warrior = Parse(file);
                project.Warriors.Add(warrior);
                if (warrior != null)
                {
                    succ++;
                    if (project.ParserOptions.DumpFiles)
                    {
                        StreamWriter sw = new StreamWriter(Path.ChangeExtension(file, project.ParserOptions.DumpExt));
                        warrior.Dump(new WrappedTextWriter(sw), project.ParserOptions);
                        sw.Close();
                    }
                    else if (console != null)
                    {
                        warrior.Dump(console, project.ParserOptions);
                    }
                }
                else
                {
                    result.Succesfull = false;
                }
            }
            if (project.ParserOptions.StatusLine && console != null)
            {
                console.WriteLine("========== Compiled " + project.WarriorFiles.Count + " warriors, " +
                                  (project.WarriorFiles.Count - succ) + " failed ==========");
            }
            return(result);
        }
Example #38
0
 public static bool Equals(IWarrior a, IWarrior b)
 {
     if (a.Length != b.Length) return false;
     if (a.StartOffset != b.StartOffset) return false;
     //if (a.Pin != b.Pin) return false;
     //if (a.Name != b.Name) return false;
     //if (a.Author != b.Author) return false;
     for (int adr = 0; adr < b.Length; adr++)
     {
         if (!a[adr].Equals(b[adr])) return false;
     }
     return true;
 }
Example #39
0
 public virtual int Attack(IWarrior warrior)
 {
     return warrior.SurviveAttackWith(this);
 }
 public AmphibiousAttack([Swimmer]IWarrior warrior)
 {
     Warrior = warrior;
 }
 public AmbiguiousAttack(IWarrior warrior)
 {
     Warrior = warrior;
 }
Example #42
0
 public int Attack(IWarrior target, IWeapon weapon)
 {
     return weapon.Attack(target);
 }
 public void Hit(IWarrior target)
 {
     target.GetsHit(this);
 }
Example #44
0
 private static void DumpWarrior(IWarrior w, ParserOptions opt)
 {
     StreamWriter sw = new StreamWriter(w.FileName);
     WrappedTextWriter wr=new WrappedTextWriter(sw);
     w.Dump(wr, opt);
     sw.Close();
 }
Example #45
0
 protected void ValidateWarrior(IWarrior warrior)
 {
     warrior.ShouldBeInstanceOf<FootSoldier>();
     warrior.Weapon.ShouldNotBeNull();
     warrior.Weapon.ShouldBeInstanceOf<Shuriken>();
 }
Example #46
0
 public void SetWarrior([Optional] IWarrior warrior)
 {
     this.Warrior = warrior;
 }
 public Barrack(IWarrior warrior)
 {
     this.Warrior = warrior;
 }
 public ShireArmy([Named("Short")] IWarrior warrior)
 {
     Warrior = warrior;
 }
 public NinjaBarracks( IWarrior warrior )
 {
     Warrior = warrior;
 }
 public Barracks( IWarrior warrior )
 {
     Warrior = warrior;
 }
 private static bool BothSidesHaveFighters(IWarrior redFighter, IWarrior blueFighter)
 {
     return redFighter != null && blueFighter != null;
 }
 public Barracks( IWarrior warrior, IWeapon weapon )
 {
     Warrior = warrior;
     Weapon = weapon;
 }
Example #53
0
 protected void ValidateWarrior(IWarrior warrior)
 {
     Assert.IsType<FootSoldier>(warrior);
     Assert.NotNull(warrior.Weapon);
     Assert.IsType<Shuriken>(warrior.Weapon);
 }
 protected void ValidateWarrior(IWarrior warrior)
 {
     warrior.Should().BeOfType<FootSoldier>();
     warrior.Weapon.Should().NotBeNull();
     warrior.Weapon.Should().BeOfType<Shuriken>();
 }