public void ApplyItemStats(Character character) { character.MaxHealth += this.HealthModifier; character.MaxMana += this.ManaModifier; character.AttackRating += this.AttackModifier; character.DefenseRating += this.DefenseModifier; }
protected override void DefaultSkillAction(Character caster, Character target) { Random rnd = new Random(); caster.CurrentMana -= this.ManaModifier; for (int i = 0; i <= 3; i++) { caster.Attack(target, rnd); } }
public override void ApplySkillStats(Character caster) { int under30 = (caster.CurrentHealth * 30) / 100; if (caster.CurrentHealth < under30) { caster.BlockChance += this.DefenseModifier; caster.DefenseRating += this.DefenseModifier / 2; } }
public override void DefaultItemAction(Character caster, Character target) { caster.CurrentMana += this.ManaModifier; if (caster.CurrentMana > caster.MaxMana) { caster.CurrentMana = caster.MaxMana; } GameEngine.Renderer.WriteLine("{0} used {1} regenerated {2} mana.", caster.Name, this.GetType().Name, this.ManaModifier); }
protected override void DefaultSkillAction(Character caster, Character target) { caster.CurrentMana -= this.ManaModifier; target.CurrentHealth -= this.AttackModifier; GameEngine.Renderer.WriteLine( string.Format( "{0} stabs {1} for {2} damage.", caster.Name, target.Name, this.AttackModifier)); }
protected override void DefaultSkillAction(Character caster, Character target) { int manaStolen = this.AttackModifier < target.CurrentMana ? this.AttackModifier : target.CurrentMana; target.CurrentMana -= manaStolen; if (manaStolen + caster.CurrentMana > caster.MaxMana) { caster.CurrentMana = caster.MaxMana; } else { caster.CurrentMana += manaStolen; } GameEngine.Renderer.WriteLine(string.Format("{0} steals {1} mana from {2}.", caster.Name, this.AttackModifier, target.Name)); }
public override void DefaultItemAction(Character caster, Character target) { caster.CurrentHealth += this.HealthModifier; if (caster.CurrentHealth > caster.MaxHealth) { caster.CurrentHealth = caster.MaxHealth; } GameEngine.Renderer.WriteLine( "{0} used {1} regenerated {2} health.", caster.Name, this.GetType().Name, this.HealthModifier); }
public static void Check(Character attacker, Character defender, int dmg) { foreach (var s in defender.PassiveSkills) { switch (s.GetType().Name) { case "Hedgehog": int returnDmg = dmg * s.AttackModifier / 100; attacker.CurrentHealth -= returnDmg; GameEngine.Renderer.WriteLine( string.Format("{0} damage bounces back at {1} beacuse of {2}'s {3}!", returnDmg, attacker.Name, defender.Name, s.GetType().Name)); break; } } }
public static void Check(Character attacker, Character defender) { foreach (var s in attacker.PassiveSkills) { switch (s.GetType().Name) { case "Lifesteal": int returnDmg = (attacker.AttackRating * s.HealthModifier) / 100; attacker.CurrentHealth += returnDmg; GameEngine.Renderer.WriteLine( string.Format("{0} steals {1} life from {2}!", attacker.Name, returnDmg, defender.Name)); break; } } }
private void ReturnDefaultStats(Character caster) { caster.MaxHealth -= this.HealthModifier; if (caster.CurrentHealth > caster.MaxHealth) { caster.CurrentHealth = caster.MaxHealth; } caster.DefenseRating -= this.DefenseModifier; GameEngine.Renderer.WriteLine( string.Format( "{0}'s {1} effect wears off.", caster.Name, this.GetType().Name)); }
protected override void DefaultSkillAction(Character caster, Character target) { caster.CurrentMana -= this.ManaModifier; caster.MaxHealth += this.HealthModifier; caster.CurrentHealth += this.HealthModifier / 2; caster.DefenseRating += this.DefenseModifier; GameEngine.Renderer.WriteLine( string.Format( "{0} casts {1} raising defensive stats.", caster.Name, this.GetType().Name)); Timer t = new Timer(Timeout); t.Elapsed += (source, e) => this.OnTimeout(source, e, caster); t.AutoReset = false; t.Enabled = true; }
protected override void DefaultSkillAction(Character caster, Character target) { caster.CurrentMana -= this.ManaModifier; int modifier = (target.AttackRating * this.AttackModifier) / 100; target.AttackRating -= modifier; GameEngine.Renderer.WriteLine( string.Format( "{0} curses {1} with {2} causing {1}'s {3} to drop by {4}.", caster.Name, target.Name, this.GetType().Name, target.AttackRating, modifier)); Timer t = new Timer(Timeout); t.Elapsed += (source, e) => this.OnTimeout(source, e, target, modifier); t.AutoReset = false; t.Enabled = true; }
protected override void DefaultSkillAction(Character caster, Character target) { int healed = this.HealthModifier; caster.CurrentMana -= this.ManaModifier; if (this.HealthModifier >= caster.MaxHealth - caster.CurrentHealth) { healed = caster.MaxHealth - caster.CurrentHealth; caster.CurrentHealth = caster.MaxHealth; } else { caster.CurrentHealth += this.HealthModifier; } GameEngine.Renderer.WriteLine( string.Format( "{0} casts {1} healing self for {2} health.", caster.Name, this.GetType().Name, healed)); }
public void Use(Character caster, Character target) { if (this.isReady) { if (caster.CurrentMana < this.ManaModifier) { GameEngine.Renderer.WriteLine(string.Format("Not enough mana to cast {0}!", this.GetType().Name)); return; } this.DefaultSkillAction(caster, target); this.isReady = false; Timer t = new Timer(this.CoolDown); t.Elapsed += this.OnCooldown; t.AutoReset = false; t.Enabled = true; } else { GameEngine.Renderer.WriteLine("{0} is not ready to use yet!", this.GetType().Name); } }
public override void DefaultItemAction(Character caster, Character target) { caster.CurrentHealth += this.HealthModifier; caster.CurrentMana += this.ManaModifier; caster.DefenseRating += this.DefenseModifier; if (caster.CurrentHealth > caster.MaxHealth) { caster.CurrentHealth = caster.MaxHealth; } if (caster.CurrentMana > caster.MaxMana) { caster.CurrentMana = caster.MaxMana; } Timer t = new Timer(Timeout); t.AutoReset = false; t.Enabled = true; t.Elapsed += (source, e) => this.OnTimeout(source, e, caster); GameEngine.Renderer.WriteLine( "{0} used {1} regenerated {2} health, {3} mana and increased Defense Rating with {4} for 5 seconds.", caster.Name, this.GetType().Name, this.HealthModifier, this.ManaModifier, this.DefenseModifier); }
protected override void DefaultSkillAction(Character caster, Character target) { int healed = this.HealthModifier; caster.CurrentMana -= this.ManaModifier; target.CurrentHealth -= this.AttackModifier; if (this.HealthModifier >= caster.MaxHealth - caster.CurrentHealth) { healed = caster.MaxHealth - caster.CurrentHealth; caster.CurrentHealth = caster.MaxHealth; } else { caster.CurrentHealth += this.HealthModifier; } GameEngine.Renderer.WriteLine( string.Format( "{0} uses {1} on {2} causing {3} damage and heals self in the meantime for {4} health.", caster.Name, this.GetType().Name, target.Name, this.AttackModifier, healed)); }
public override void ApplySkillStats(Character caster) { caster.BlockChance += this.DefenseModifier; }
protected abstract void DefaultSkillAction(Character caster, Character target);
private void ReturnDefaultStats(Character target, int modifier) { target.AttackRating += modifier; }
private void OnTimeout(object source, ElapsedEventArgs e, Character target, int modifier) { this.ReturnDefaultStats(target, modifier); var t = (Timer)source; t.Dispose(); }
private void UsePlayerSkill(string skill, Character enemy) { foreach (var s in this.player.ActiveSkills) { if (s.GetType().Name.ToLower() == skill) { s.Use(this.player, enemy); return; } } Renderer.WriteLine("No such skill available."); }
private void ShowEnemyStatus(Character enemy) { Renderer.WriteLine(enemy.ToString()); }
public override void ApplySkillStats(Character caster) { caster.AttackRating += this.AttackModifier; }
public override void ApplySkillStats(Character caster) { caster.DefenseRating += this.DefenseModifier; }
private void OnTimeout(object source, object o, Character caster) { caster.DefenseRating -= this.DefenseModifier; var t = (Timer)source; t.Dispose(); }
protected override void DefaultSkillAction(Character caster, Character target) { caster.CurrentMana -= this.ManaModifier; target.CurrentHealth -= this.AttackModifier; GameEngine.Renderer.WriteLine(string.Format("{0} shakes the ground with {1} causing {2} to suffer {3} damage.", caster.Name, this.GetType().Name, target.Name, this.AttackModifier)); }
public abstract void ApplySkillStats(Character caster);
public override void ApplySkillStats(Character caster) { }
public override void ApplySkillStats(Character caster) { caster.MaxHealth += this.HealthModifier; }
private void ExecuteBattleCommand(string[] userInput, Character enemy) { while (userInput.Length > 2) { Renderer.WriteLine("No command has more than one parameter, please re-enter."); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); } BattleCommands command; while (!Enum.TryParse(userInput[0], true, out command)) { Renderer.WriteLine("Unknown command, please re-enter."); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); } string parameter = "none"; if (userInput.Length == 2) { parameter = userInput[1]; } switch (command) { case BattleCommands.Help: ExecuteHelpCommand(); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Clear: Renderer.Clear(); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Exit: this.IsRunning = false; Renderer.WriteLine("Bye, noob!"); Environment.Exit(0); break; case BattleCommands.Class: this.ShowClassInfo(parameter); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Race: this.ShowRaceInfo(parameter); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Inventory: this.player.ShowInventory(); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Attack: this.player.Attack(enemy, Rand); break; case BattleCommands.Uses: this.UsePlayerSkill(parameter.ToLower(), enemy); break; case BattleCommands.Usei: this.player.UseItem(parameter.ToLower(), enemy); break; case BattleCommands.Enemy: this.ShowEnemyStatus(enemy); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; case BattleCommands.Status: Renderer.WriteLine(this.player.ToString()); userInput = Regex.Split(Reader.ReadLine(), @"\s+"); this.ExecuteBattleCommand(userInput, enemy); break; } }