09-29-2013, 08:23 PM
A trick I have read some MMOs using for critical/misses is what I am going to call the 'card draw' technique.
Here is an example of how it works; say your RPG has a skill that crits 20% of the time. When the player uses the skill, they draw from a set of five cards; four normal attack cards, and one critical hit card. That card is then discarded and the process is repeated every time the skill is used. Once all five cards have been drawn, they are added back into the skill's deck and reshuffled.
This technique insures that one out of every 5 attacks will critical; there will be no 'unfair' chains of no crits or several crits in a row. The card draw technique can be implemented as a simple array in Ruby, and .pop can be used to draw them (XP is Ruby 1.8 so no built in shuffling, however XV and up can do this natively).
The drawbacks to this technique is you need to have an array of cards per skill per actor. A significant memory increase than the normal method.
Here is an example of how it works; say your RPG has a skill that crits 20% of the time. When the player uses the skill, they draw from a set of five cards; four normal attack cards, and one critical hit card. That card is then discarded and the process is repeated every time the skill is used. Once all five cards have been drawn, they are added back into the skill's deck and reshuffled.
This technique insures that one out of every 5 attacks will critical; there will be no 'unfair' chains of no crits or several crits in a row. The card draw technique can be implemented as a simple array in Ruby, and .pop can be used to draw them (XP is Ruby 1.8 so no built in shuffling, however XV and up can do this natively).
The drawbacks to this technique is you need to have an array of cards per skill per actor. A significant memory increase than the normal method.