Optimize target status

Easycore

New member
Messages
184
Points
0
Hi,

I want do that skill "SM_BASH" has damage x2 only when target have Vit = multiples by 5.
Then every 5,10,15,20,25,30,35,40,45,50,etc. Bash will deal damage x2.
 
My problem is how do that always read multiples, and not putting an infinity of numbers.
 
I don't want the following:
 
case MS_BASH: skillratio += 30 * skill_lv;                    if (tstatus->vit == 5||10||15||20||25||30||35||40||45||50||55||) //And infinity numbers...                    skillratio *= 2; break; 

This metod is too tedious.

Any know how simplify this?

Regards ~ and sorry for my bad english


 
Why don't you use the modulus operator(%)?
So if a number modulus 5 equals 0, then it's a mutiple of five.
For example:  if (25%5 == 0) -> True
                        if(26%5 ==0) -> False
25 / 5 = 5 it is an exact division, whereas 26/5 = 5  and we get 1 as a rest.

 
Last edited by a moderator:
I didn't know this
default_ohmy.png


Then... how can combine this with tstatus? (Sorry for noob question, but I don't know much of SRC)

 
Back
Top