lundi 22 juillet 2019

What am i doing wrong? random number generation half working

I am writing a text game I have all the functions working so far except this... and it does work but it doesn't work I don't understand why I can 't make it work the way I want it to.

Made the code work using hard int input no problems.


if (response.ToUpper() == "PLAY") {
int damageCalc = Combat.Dice(Items.Slot1Damage);

Console.WriteLine("You roll a 40 Sided Dice! Damage! {0}",damageCalc);
  break;
}

//Items.Slot1Damage is a public Int that returns 40.

/*
  public static int Slot1Damage;
  Items.Slot1Damage = 40;
*\


//Combat.Dice calls Random.Next Function where the value in Combat.Dice is the high value - 
//Below is Combat.Dice
/*

public class Combat{

public static int Dice(int DiceValue = 0) {

Random r = new Random();

int result = r.Next(1,DiceValue);
return result;

}

public static string FireBall(string target) {

int fireBallDamage = Dice(100);
Console.WriteLine("You Inflicted {0} Damage with your Fire Ball Spell to {1}!",fireBallDamage, target);
return target;
}


}

*/


I want it to roll a 40 sided dice based on the value of the variable being 40




Aucun commentaire:

Enregistrer un commentaire