damage count
Nintenerd7 (0)

I've made a snippet of a Pokemon wild encounter. is there any way to make a random switch re-roll the chances of damage? i'm trying to make a Hp count of both wild and party Pokemon.

You are viewing a single comment. View All
mwilki7 (152)

You want to change the probability that something will hit?
For example, you want an attack to go from 50% hit chance, to, say, 80%?
Or do you want it to stay at a certain % and just keep playing in the same battle?

Nintenerd7 (0)

@mwilki7 something like the 80% chance of hitting, 40% on getting a crit and 20% for the wild Pokemon to dodge, I get the correct damage number of one move impacting the WP health points but once i use that move again it keeps showing the same random output that was rolled the first time. and i cant inflict more damage to the WP it always stays to 70 or 50. use charmander and the move ember for two turns. and you will see what happens

ash15khng (234)

@Nintenerd7 Could you post a link to the repl and tell us what language you're using?
Anyways, to (kind of) answer your question, you could do something like:

this isn't in any language this is just the logic behind what you're trying to do

hit = random(1, 100)
if hit > 20 {
    # move hits
    crit = random(1, 100)
    if crit > 60 {
        # move hits + crit
    }
    # move hits normally
}

You put the crit chance in the hit chance.

Nintenerd7 (0)

@ash15khng here you go and the language i'm using is C++ i will have my repl open for you to look at

https://repl.it/live/w042obXz3WIWFw

Nintenerd7 (0)

and the output i dont want looks like this