I have a static random member that when I use rand.next(1,2) I always get 1. I don't understand why.
static Random rand = new Random();
private static void Attack(Player player, Monster monster)
{
var pDamage = Convert.ToInt32(Math.Floor(player.Weapon.Attack * monster.Armor.DamageRedux));
Console.WriteLine("You strike the {0} for {1} damage.", monster.MonsterName, pDamage);
monster.Health -= pDamage;
for (int i = 0; i < 10; i++)
{
var hitRoll = rand.Next(1, 2);
Console.Write("{0}", hitRoll);
}
switch (1)
{
case 1:
var mDamage = Convert.ToInt32(Math.Floor(monster.Weapon.Attack * player.Armor.DamageRedux));
Console.WriteLine("The {0} swing back and hits you for {1} damage.", monster.MonsterName, mDamage);
player.Health -= mDamage;
break;
case 2:
Console.WriteLine("The {0} swings wildly at you and misses.", monster.MonsterName);
break;
}
}
Aucun commentaire:
Enregistrer un commentaire