Jump to content
  • 0
Sign in to follow this  
Easycore

Optimize target status

Question

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

 

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

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.

Edited by Gordis

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.