protected Character GetRandomCharacter(TargetType targetType = TargetType.Opponents) { List <Character> validTargets = Battlefield.GetValidTargets(this, targetType); return(Helpers.GetRandomElement(validTargets)); }
public MonsterParty(Battlefield battlefield, int monstersAmount, ICharacterController characterController) : base(battlefield, characterController, monstersAmount) { }
public MonsterParty(Battlefield battlefield, ICharacterController characterController) : base(battlefield, characterController) { }
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; } } }
public override void PerformSpecialAction() { // TODO: implement special action logic Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); }
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); }
public HeroParty(Battlefield battlefield, ICharacterController characterController, int alliesNumbers) : base(battlefield, characterController, alliesNumbers) { }
public HeroParty(Battlefield battlefield, CharacterType userControlledCharacterType, string userControlledCharacterName, ICharacterController playerController, int alliesAmount, ICharacterController aiController) : base(battlefield, aiController, alliesAmount) { CreateNewCharacter(userControlledCharacterType, playerController, battlefield, userControlledCharacterName); }
public HeroParty(Battlefield battlefield, ICharacterController characterController, int numberOfHeroes) : base(battlefield, characterController, numberOfHeroes) { }
public MonsterParty(Battlefield battlefield, ICharacterController characterController, int characterAmount) : base(battlefield, characterController, characterAmount) { }