Hey guys, here's my question.
In this text rpg i'm making i'm trying to add a "critical strike" chance, so that the player hits more, i got the hitting more part down right, but my problem is that for example, say the player can hit from 1 to 5 HP, based on the player's stats and also random, since the lowest number is the player's attack, and highest is the player's strength, it looks like this.
Random hit = new Random();
int n = hit.Next(playerattack,playerstrength)
now, with the critical strike calculation, it's completely random from 1 to 100.
my problem is, that both numbers are somehow correlated, which is defenitely not what i want, when the critical strike random number is for example, 90. then the player hits pretty hard, in this case a 4 or 5, but when the critical random is 20, then he might hit 1 or 2.
The problem with this is that say the player's critical chance is 20%, that means that he will get a bonus if he hits 20% or lower of his hit calculation, which is dumb, since the critical strike bonus would then be way too low to matter.
Same thing if i turn it around, every hit that's 20% or above will be a critical strike, which is nice, but it won't affect even take place if the hit is lower than 20%.
public void Force()
{
Weaponcalculation();
Random hit = new Random();
h = hit.Next(playermaxattack, playermaxstrength);
Chance();
Console.WriteLine("chance {0}", c);
Console.WriteLine("hit {0}", h);
Console.ReadLine();
if (total > c)
{
h = h * 2;
Console.WriteLine("You've hit a critical blow!");
}
else
{
}
}
public void Chance()
{
Random ok = new Random();
c = ok.Next(1, 101);
}
total = player's chance to hit a critical strike
My question is.
How do i make two separate Random numbers at the same time?