public void PerformBaseAttack() { if (this.Category == CharacterType.Paladin) { if (CurrentMana < MaxMana) { CurrentMana += 10; } } List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (this.UsedPaladinEffect = false && Battlefield.PaladinEffect == true) { this.Damage = this.Damage * 1.75f; this.UsedPaladinEffect = true; } if (_random.NextDouble() > Accuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} for {Damage} damage."); target.CurrentHealth -= Damage; if (this.UsedPaladinEffect = true && Battlefield.PaladinEffect == true) { Damage = Damage / 1.75f; } }
public override void PerformSpecialAction() { float _damageForThisAction = Damage * 2f; float _accuracyForThisAction = Accuracy * 0.5f; if (_random.NextDouble() > _accuracyForThisAction) { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); _damageForThisAction = 15; foreach (Character target in validTargets) { Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} with his SPECIAL ATTACK for {_damageForThisAction} damage."); ReduceTargetHealth(target, _damageForThisAction); } } else { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); _damageForThisAction = 20; foreach (Character target in validTargets) { Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} with his SPECIAL ATTACK for {_damageForThisAction} damage."); ReduceTargetHealth(target, _damageForThisAction); } } }
public override void PerformSpecialAction() { Random random = new Random(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = random.Next(0, 2); switch (randomIndex) { case (0): Battlefield.DisplayMessage($"{FullyQualifiedName} used a hellfire at the Heroes hitting them for {30} damage ."); foreach (Character target in validTargets) { target.CurrentHealth -= 20; } break; case (1): Battlefield.DisplayMessage($"{FullyQualifiedName} used a hellfire at the Heroes but he lost control of it and hits the Monsters for { 15} damage ."); validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); foreach (Character target in validTargets) { target.CurrentHealth -= 15; } break; } Character choosenTarget = this; }
protected override void PerformSpecialAction() { List <Character> opponents = Battlefield.GetValidTargets(this, TargetType.Opponents); int amountToTake = 3; if (opponents.Count < amountToTake) { amountToTake = opponents.Count; } List <Character> targets = new List <Character>(amountToTake); while (targets.Count < amountToTake) { Character newTarget = Helpers.GetRandomElement(opponents); if (!targets.Contains(newTarget)) { targets.Add(newTarget); } } foreach (Character target in targets) { Attack(target, Damage * 0.75f, Accuracy * 0.5f, "Triple shoot: "); } }
public override void PerformSpecialAction() { // TODO: implement special action logic var _random = new System.Random(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); Battlefield.DisplayMessage($"{FullyQualifiedName} now will attack 3 random opponents!"); for (int i = 0; i < 3; i++) { int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy / 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his {i} special attack against {target.FullyQualifiedName}."); } else { Battlefield.DisplayMessage($"{FullyQualifiedName} used his {i} special attack on {target.FullyQualifiedName} for {Damage * 0.75} damage!"); target.CurrentHealth -= Damage * 0.75f; } } //Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); }
public override void PerformSpecialAction() { float enemyDamage = 20; float allyDamage = 15; Boolean randomChance = false; if (_random.Next(0, 10) >= 5) { randomChance = true; } if (randomChance) { Battlefield.DisplayMessage($"{FullyQualifiedName} fireballed all alive enemies with his special move"); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); foreach (Character target in validTargets) { Battlefield.DisplayMessage($"{target.FullyQualifiedName} got bruned for {enemyDamage} damage."); target.CurrentHealth -= enemyDamage; } } else { Battlefield.DisplayMessage($"{FullyQualifiedName} fireballed his own allies and himself "); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); foreach (Character target in validTargets) { Battlefield.DisplayMessage($"{target.FullyQualifiedName} got bruned for {allyDamage} damage."); target.CurrentHealth -= allyDamage; } } }
public override void PerformSpecialAction() { // TODO: implement special action logic var _random = new System.Random(); List <Character> allies = Battlefield.GetValidTargets(this, TargetType.Allies); List <Character> ValidTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int r = _random.Next(0, 1); if (r == 0) { for (int i = 0; i < ValidTargets.Count; i++) { ValidTargets[i].CurrentHealth = ValidTargets[i].CurrentHealth - 20; } Battlefield.DisplayMessage($"{FullyQualifiedName} just attacked all the opponents for 20 damage!"); } if (r == 1) { for (int i = 0; i < allies.Count; i++) { allies[i].CurrentHealth = allies[i].CurrentHealth - 20; } Battlefield.DisplayMessage($"{FullyQualifiedName} just missed the opponents and attacked all the allies for 15 damage!"); } //Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); }
public Character ChooseTarget() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; return(target); }
public override void PerformSpecialAction() { mana = -manacost; List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); foreach (var allie in validTargets) { allie.damageIncrease = 0.75f; } }
protected override void PerformSpecialAction() { List <Character> allies = Battlefield.GetValidTargets(this, TargetType.Allies); allies.Remove(this); foreach (Character ally in allies) { ally.NextBaseAttackBoost = _blessBoost; } Battlefield.DisplayMessage($"{FullyQualifiedName} blessed his allies! On the next base attack, {string.Join(", ", allies)} will do {_blessBoost}x damage."); }
protected override void PerformSpecialAction() { bool success = Random.NextDouble() > 0.5f; TargetType targetType = success ? TargetType.Opponents : TargetType.Allies; List <Character> targets = Battlefield.GetValidTargets(this, targetType); Battlefield.DisplayMessage($"{FullyQualifiedName} {(success ? "successfully casted" : "failed to cast")} a fireball spell! {string.Join(", ", targets)} damaged by {_spellDamage}."); foreach (Character target in targets) { target.CurrentHealth -= _spellDamage; } }
public Character ChooseLowerHealthAlly() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); Character lowerHealthAlly = validTargets[0]; foreach (Character currentMember in validTargets) { if (currentMember.CurrentHealth < lowerHealthAlly.CurrentHealth) { lowerHealthAlly = currentMember; } } return(lowerHealthAlly); }
public override void PerformSpecialAction() { // TODO: implement special action logic //CurrentHealth = CurrentHealth + 30; List <Character> helpAllies = Battlefield.GetValidTargets(this, TargetType.Allies); for (int i = 0; i < helpAllies.Count; i++) { helpAllies[i].CurrentHealth = helpAllies[i].CurrentHealth + 30; } Battlefield.DisplayMessage($"{FullyQualifiedName} just added 30 of health at all his faction!"); //Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); }
public void PerformSpecialAction() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} for {Damage} damage."); target.CurrentHealth -= Damage; }
public override void PerformSpecialAction() { Random random = new Random(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (random.NextDouble() > Accuracy * 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} hits with a hammer {target.FullyQualifiedName} but he missed."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName}hits with a hammer {target.FullyQualifiedName} for {Damage * 0.75f} damage."); target.CurrentHealth -= Damage * 0.75f; }
public override void PerformSpecialAction() { var _random = new System.Random(); // TODO: implement special action logic List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy / 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his special attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} used special attack on {target.FullyQualifiedName} for {Damage*2} damage!"); target.CurrentHealth -= Damage * 2; //Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); }
public override void PerformSpecialAction() { float spetialDamage = 2 * Damage; float spetialAccuracy = Accuracy / 2; List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; Battlefield.DisplayMessage($"{FullyQualifiedName} just used his special action!"); if (_random.NextDouble() > spetialAccuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} successfully attacked {target.FullyQualifiedName} for {spetialDamage} damage."); target.CurrentHealth -= spetialDamage; }
public override void PerformSpecialAction() { float SpecialAccuracy = (1 / 3) * Accuracy; float SpecialDamage = 3 * Damage; List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > SpecialAccuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his special attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} super *bonked* {target.FullyQualifiedName} with his special attack for {SpecialDamage} damage."); target.CurrentHealth -= SpecialDamage; }
public override void PerformSpecialAction() { float heal = 30; List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); //NON SO PERCHè CRASHA Character lowestHealthChar = null; float min = 1000; foreach (Character t in validTargets) { if (t.CurrentHealth < min) { min = t.CurrentHealth; lowestHealthChar = t; } } Battlefield.DisplayMessage($"{FullyQualifiedName} healed {lowestHealthChar.FullyQualifiedName} for {heal} hp with his special attack."); lowestHealthChar.CurrentHealth += heal; }
public override void PerformSpecialAction() { Random random = new Random(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex; if (validTargets.Count >= 3) { for (int i = 0; i < 3; i++) { randomIndex = random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (random.NextDouble() > Accuracy / 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} throw a arrow at {target.FullyQualifiedName} but he missed."); } else { Battlefield.DisplayMessage($"{FullyQualifiedName} throw a arrow at {target.FullyQualifiedName} for {Damage * 0.75f} damage."); target.CurrentHealth -= Damage * 0.75f; } } } else { foreach (Character target in validTargets) { if (random.NextDouble() > Accuracy / 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} throw a arrow at {target.FullyQualifiedName} but he missed."); } else { Battlefield.DisplayMessage($"{FullyQualifiedName} throw a arrow at {target.FullyQualifiedName} for {Damage * 0.75f} damage."); target.CurrentHealth -= Damage * 0.75f; } } } }
public override void PerformSpecialAction() { //List<Character> targets = new List<Character>(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); for (int i = 0; i < 3; i++) { int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy / 2) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} for {Damage * 0.75} damage."); target.CurrentHealth -= Damage * (75 / 100); } }
public override void PerformSpecialAction() { float specialAccuracy = 0.5f * Accuracy; float specialDamage = 0.75f * Damage; int hits = 3; List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); switch (validTargets.Count) { case 1: hits = 1; break; case 2: hits = 2; break; case 0: hits = 0; break; default: hits = 3; break; } int randomIndex = 0; for (int i = 0; i < hits; i++) { randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > specialAccuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his special attack {i}. shot against {target.FullyQualifiedName}."); } else { Battlefield.DisplayMessage($"{FullyQualifiedName} shot {target.FullyQualifiedName} for {specialDamage} damage. ({i}. shot)"); target.CurrentHealth -= specialDamage; } } }
public override void PerformSpecialAction() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} just use his curative's power!"); return; } if (target == this) { Battlefield.DisplayMessage($"{FullyQualifiedName} just heal himself with 30 hp!"); } else { Battlefield.DisplayMessage($"{FullyQualifiedName} just heal {target.FullyQualifiedName} with 30 hp"); } target.CurrentHealth += 30; }
protected override void PerformSpecialAction() { List <Character> allies = Battlefield.GetValidTargets(this, TargetType.Allies); Character target = null; float lowerHealth = float.MaxValue; foreach (Character ally in allies) { if (ally.CurrentHealth >= lowerHealth) { continue; } lowerHealth = ally.CurrentHealth; target = ally; } Battlefield.DisplayMessage($"{FullyQualifiedName} healed {target} for {_healAmount} hp."); target.CurrentHealth += _healAmount; }
public override void PerformSpecialAction() { Random random = new Random(); List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Allies); int randomIndex = random.Next(0, validTargets.Count - 1); Character choosenTarget = this; foreach (Character target in validTargets) { if (choosenTarget.CurrentHealth < target.CurrentHealth) { choosenTarget = target; } } Battlefield.DisplayMessage($"{FullyQualifiedName} used a potion at {choosenTarget.FullyQualifiedName} for { 30} health ."); choosenTarget.CurrentHealth += 30; }
public void PerformBaseAttack() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; if (_random.NextDouble() > Accuracy) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}."); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} for {Damage} damage."); if (damageIncrease != 0) { Console.WriteLine("Attacco incrementato"); target.CurrentHealth -= Damage + damageIncrease; this.damageIncrease = 0; } target.CurrentHealth -= Damage; }
public virtual void PerformSpecialActionPaladin() { List <Character> validTargets = Battlefield.GetValidTargets(this, TargetType.Opponents); int randomIndex = _random.Next(0, validTargets.Count - 1); Character target = validTargets[randomIndex]; foreach (object i in validTargets) { if (_currentMana <= 30) { Battlefield.DisplayMessage($"{FullyQualifiedName} missed his attack against {target.FullyQualifiedName}. Not enough Mana"); return; } Battlefield.DisplayMessage($"{FullyQualifiedName} attacked {target.FullyQualifiedName} for {DamageSp} special damage."); target.CurrentHealth -= DamageSp; } _currentMana -= 30; // TODO: implement healing for Paladin }
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; } } }
protected Character GetRandomCharacter(TargetType targetType = TargetType.Opponents) { List <Character> validTargets = Battlefield.GetValidTargets(this, targetType); return(Helpers.GetRandomElement(validTargets)); }