public virtual void Attack(Player hero) { int hDice = dice.LaunchDice(); int mDice = dice.LaunchDice(); if (mDice > hDice) { hero.TakeDmg(constdmg); //return true; } //return false; }
public override void Attack(Player hero) { base.Attack(hero); int hDice = dice.LaunchDice(); int mDice = dice.LaunchDice(); if (mDice > hDice) { int spellDmg = MagicAttack(); hero.TakeDmg(constdmg + spellDmg); //return true; } }
private static void jeu() { Player hero = new Player(); int scoreMonstreFacile = 0; int scoreMonstreDifficile = 0; int scorePoints = 0; EasyMonster monster; while (hero.IsAlive) { monster = selectRandomMonster(); while (monster.IsAlive && hero.IsAlive) { hero.Attack(monster); if (monster.IsAlive) monster.Attack(hero); } if (hero.IsAlive) { if (monster is EasyMonster) { scoreMonstreFacile++; } else { scoreMonstreDifficile++; } } else { Console.Write("ok you kill " + scoreMonstreFacile + " monstre facile et " + scoreMonstreDifficile + "monstre difficile pour un score de " + scorePoints); } } }