Re: Core Set
Posted: 04 Nov 2015, 20:57
The chance() method returns an integer value representing the chance to draw the card itself, not the following card this would not make sense.
The basic value is 100 (-> 100%).
It works because there is an instance for each card, created and pushed into a list at the start of the program, so when we draw a card we just iterate over all existing cards and call the chance() method.
Now we add them all together, choose a random number between 0 and the value we got and look which card is choosen.
Even if there would be no instance of each card all we would have to do is switching the method to static, but nevertheless we need to ask each card at the start of the program if it brings any new mods or items to the teaseviewer, so thats where the instance already comes from.
The basic value is 100 (-> 100%).
It works because there is an instance for each card, created and pushed into a list at the start of the program, so when we draw a card we just iterate over all existing cards and call the chance() method.
Now we add them all together, choose a random number between 0 and the value we got and look which card is choosen.
Even if there would be no instance of each card all we would have to do is switching the method to static, but nevertheless we need to ask each card at the start of the program if it brings any new mods or items to the teaseviewer, so thats where the instance already comes from.