コード例 #1
0
        protected Character GetRandomCharacter(TargetType targetType = TargetType.Opponents)
        {
            List <Character> validTargets = Battlefield.GetValidTargets(this, targetType);

            return(Helpers.GetRandomElement(validTargets));
        }
コード例 #2
0
 public MonsterParty(Battlefield battlefield, int monstersAmount, ICharacterController characterController)
     : base(battlefield, characterController, monstersAmount)
 {
 }
コード例 #3
0
 public MonsterParty(Battlefield battlefield, ICharacterController characterController)
     : base(battlefield, characterController)
 {
 }
コード例 #4
0
        public override void PerformSpecialAction()
        {
            List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents);
            int       randomIndex         = _random.Next(0, validTargets.Count - 1);
            Character target1             = validTargets[randomIndex];
            Character target2             = validTargets[randomIndex];
            Character target3             = validTargets[randomIndex];

            float spetialDamage   = (float)(Damage * 0.75);
            float spetialAccuracy = Accuracy / 2;

            if (target1.IsDead)
            {
                if (target2.IsDead)
                {
                    if (_random.NextDouble() > spetialAccuracy)
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target3.FullyQualifiedName}.");
                        return;
                    }
                    else
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target3.FullyQualifiedName} for {spetialDamage} damage.");
                        target3.CurrentHealth -= spetialDamage;
                    }
                }
                else
                {
                    if (_random.NextDouble() > spetialAccuracy)
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target2.FullyQualifiedName}.");
                    }
                    else
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target2.FullyQualifiedName} for {spetialDamage} damage.");
                        target2.CurrentHealth -= spetialDamage;
                    }


                    if (_random.NextDouble() > spetialAccuracy)
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target3.FullyQualifiedName}.");
                        return;
                    }
                    else
                    {
                        Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target3.FullyQualifiedName} for {spetialDamage} damage.");
                        target3.CurrentHealth -= spetialDamage;
                    }
                }
            }
            else
            {
                if (_random.NextDouble() > spetialAccuracy)
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target1.FullyQualifiedName}.");
                }
                else
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target1.FullyQualifiedName} for {spetialDamage} damage.");
                    target1.CurrentHealth -= spetialDamage;
                }



                if (_random.NextDouble() > spetialAccuracy)
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target2.FullyQualifiedName}.");
                }
                else
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target2.FullyQualifiedName} for {spetialDamage} damage.");
                    target2.CurrentHealth -= spetialDamage;
                }



                if (_random.NextDouble() > spetialAccuracy)
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target3.FullyQualifiedName}.");
                    return;
                }
                else
                {
                    Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target3.FullyQualifiedName} for {spetialDamage} damage.");
                    target3.CurrentHealth -= spetialDamage;
                }
            }
        }
コード例 #5
0
 public override void PerformSpecialAction()
 {
     // TODO: implement special action logic
     Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!");
 }
コード例 #6
0
        public void CreateNewCharacter(CharacterType characterType, ICharacterController controller, Battlefield battlefield, string customName = null)
        {
            Character newCharacter;
            switch (characterType)
            {
                case CharacterType.Barbarian: newCharacter = new Barbarian(); break;
                case CharacterType.Ranger: newCharacter = new Ranger(); break;
                case CharacterType.Mage: newCharacter = new Mage(); break;
                case CharacterType.Paladin: newCharacter = new Paladin(); break;
                case CharacterType.Troll: newCharacter = new Troll(); break;
                case CharacterType.Goblin: newCharacter = new Goblin(); break;
                case CharacterType.Warlock: newCharacter = new Warlock(); break;
                case CharacterType.Necromancer: newCharacter = new Necromancer(); break;
                case CharacterType.Skeleton: newCharacter = new Skeleton(); break;
                default: throw new NotSupportedException();
            }

            newCharacter.Initialize(battlefield, controller, customName);
            Characters.Insert(0, (TCharacter)newCharacter);
        }
コード例 #7
0
 public HeroParty(Battlefield battlefield, ICharacterController characterController, int alliesNumbers)
     : base(battlefield, characterController, alliesNumbers)
 {
 }
コード例 #8
0
 public HeroParty(Battlefield battlefield, CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int alliesAmount, ICharacterController aiController)
     : base(battlefield, aiController, alliesAmount)
 {
     CreateNewCharacter(userControlledCharacterType, playerController, battlefield, userControlledCharacterName);
 }
コード例 #9
0
 public HeroParty(Battlefield battlefield, ICharacterController characterController, int numberOfHeroes)
     : base(battlefield, characterController, numberOfHeroes)
 {
 }
コード例 #10
0
 public MonsterParty(Battlefield battlefield, ICharacterController characterController, int characterAmount)
     : base(battlefield, characterController, characterAmount)
 {
 }