/*************************** ** SPELL TEMPLATE METHODS ** ***************************/ //damaging spell template public void SpellTemplate(string spellName, float damageOrHealing, int manaCost, SpellType spellType) { if (spellType == SpellType.DamageAll) { if (casterObj.attributes.manaVar >= manaCost) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(casterObj.attributes.name + " cast " + spellName); Console.ForegroundColor = ConsoleColor.Gray; //return foreground color to default foreach (CombatEntity tar in combatManager.enemyList) { tar.TakeDamage(damageOrHealing); Console.WriteLine(tar.attributes.name + " was dealt " + damageOrHealing + " spelldamage by " + casterObj.attributes.name); } casterObj.attributes.manaVar -= manaCost; casterObj.attributes.TurnSpeedSubtract(-2); casterObj.EndTurn(); } else { Console.WriteLine("Not enough mana to cast spell!"); } } if (spellType == SpellType.DamageTarget) { if (casterObj.attributes.manaVar >= manaCost) { string enteredText = null; Console.WriteLine("Choose target for " + spellName); enteredText = PlayerControl.ReadText(enteredText, availableTargets); //minus 1 to fit in list spots int enemyNumber = int.Parse(enteredText) - 1; //check if target is in eenemy list if (enemyNumber <= combatManager.enemyList.Count - 1) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(casterObj.attributes.name + " cast " + spellName); Console.ForegroundColor = ConsoleColor.Gray; //return foreground color to default combatManager.enemyList[enemyNumber].TakeDamage(damageOrHealing); Console.WriteLine(combatManager.enemyList[enemyNumber].attributes.name + " was dealt " + damageOrHealing + " spelldamage by " + casterObj.attributes.name); casterObj.attributes.manaVar -= manaCost; casterObj.attributes.TurnSpeedSubtract(-1); casterObj.EndTurn(); } else { Console.WriteLine("Invalid Target"); } } else { Console.WriteLine("Not enough mana to cast spell!"); } } if (spellType == SpellType.HealingTarget) { if (casterObj.attributes.manaVar >= manaCost) { string enteredText = null; Console.WriteLine("Choose target for " + spellName); enteredText = PlayerControl.ReadText(enteredText, availableTargets); //minus 1 to fit in list spots int friendNumber = int.Parse(enteredText) - 1; //check if target is in eenemy list if (friendNumber <= combatManager.playerList.Count - 1) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(casterObj.attributes.name + " cast " + spellName); Console.ForegroundColor = ConsoleColor.Gray; //return foreground color to default combatManager.playerList[friendNumber].TakeDamage(-damageOrHealing); Console.WriteLine(combatManager.playerList[friendNumber].attributes.name + " was given " + damageOrHealing + " points of healing by " + casterObj.attributes.name); casterObj.attributes.manaVar -= manaCost; casterObj.attributes.TurnSpeedSubtract(-1); casterObj.EndTurn(); } else { Console.WriteLine("Invalid Target"); } } else { Console.WriteLine("Not enough mana to cast spell!"); } } }