public ChangeHealth(Enemy p1, Player p2, LightAttackAbility a1) : base(p1, p2, a1) { var temp = a1; this.DmgValue = temp.HealtDmg; this.ManaEffect = temp.ManaEffect; this.StaminaEffect = temp.StaminaEffect; }
public Enemy CreateEnemy() { string name = SelectRandomEnemyType(); int health = RndGenertor.Next(50, 101); int mana = RndGenertor.Next(0, 101); int stamina = RndGenertor.Next(0, 11); int dexterity = RndGenertor.Next(0, 11); int intelligence = RndGenertor.Next(10, 11); int strenght = RndGenertor.Next(0, 11); int defenceRation = RndGenertor.Next(0, 11); string imageLocation = string.Format("../../../Media/{0}.jpg", name); Enemy newEnemy = new Enemy(name, health, mana, stamina, dexterity, intelligence, strenght, imageLocation, defenceRation); newEnemy.AddAbility(new LightAttackAbility(RndGenertor.Next(10, 50), RndGenertor.Next(10, 50), RndGenertor.Next(10, 50), RndGenertor.Next(10, 50), "attack")); return newEnemy; }
private int DoAttack(Enemy target, Ability a) { if(a is LightAttackAbility) { var skill = (LightAttackAbility)a; var action = skill.CreatAction(this, target); var resolution = action; var r=resolution.Resolve(); return r; } else if(a is LightMagicAbility) { var skill = (LightMagicAbility)a; var action = skill.CreatAction(this, target); var resolution = action; var r=resolution.Resolve(); return r; } else { var skill = (HealAbility)a; var action = skill.CreatAction(this,null); var resolution = action; var r = resolution.Resolve(); return r; } }
public int DoAttack(Enemy target, int n) { var r = -1; int ch = n; if (ch < 0) { return -1; } var tempattack = (Ability)attacks[ch]; if (tempattack is LightAttackAbility) { if (this.Info.Stamina >= tempattack.StaminaEffect) { r = this.DoAttack(target, tempattack); } } else if ( tempattack is LightMagicAbility ) { if(this.Info.Mana>=tempattack.ManaEffect) { r = this.DoAttack(target, tempattack); } } else if (tempattack is HealAbility) { r = this.DoAttack(target, tempattack); } return r; }