Jump to content
  • 0

Source Question


jharick

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  77
  • Reputation:   3
  • Joined:  03/25/12
  • Last Seen:  

about this source:

skillratio += -50+10*skill_lv;

why -50 and 10 is separate

in normal computation it can be merge the -50 and 10 so it be 40.

like this:

skillratio += 40*skill_lv;

is anyone can explain how the computation of source works.

also this one:

md.damage = 1100 + 700 * skill_lv + sstatus->int_;

why it needs to be separate?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

skillratio += -50+10*skill_lv;

suppose to be calculate in this way

skillratio = skillratio + ( -50 + ( 10 * skill_lv ) );

not

skillratio = skillratio + ( ( -50 + 10 ) * skill_lv  );

the calculation is from RIGHT to LEFT

hope i am not mistaken about this...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Order of operations... -50 is a constant, 10*skill_lv is done first.

Edit: lol, 3 responses at the same time. xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  554
  • Reputation:   70
  • Joined:  04/04/12
  • Last Seen:  

because of arithmetic rules such as MDAS(Multiplication Division Addition and Subtraction)...

skillratio += -50+10*skill_lv;

remember skillratio holds a default value 100 so we need to negate 50 from it before/after processing the other integer....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  77
  • Reputation:   3
  • Joined:  03/25/12
  • Last Seen:  

so if I try to increase a Skill Damage it better to adjust/increase this 10*skill_lv;

from this:

skillratio += -50+10*skill_lv;

to this:

skillratio += -50+20*skill_lv;

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

any value behind the

skillratio +=  

will also affect it...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  77
  • Reputation:   3
  • Joined:  03/25/12
  • Last Seen:  

so its better to adjust both

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  554
  • Reputation:   70
  • Joined:  04/04/12
  • Last Seen:  

@Euphy

hahaha...exactly...

@jharick

if your adjustment is greater than 100 @ level 1 there is no need to add -50..

but if you still confuse better use skillratio = X...

example

skilratio += 20 * skilll_lv = 20% per skill level = 120 @ lvl1, 140 @ lvl2

or

skillratio = 100 + 20 * skilll_lv = 20% per skill level = 120 @ lvl1, 140 @ lvl2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  77
  • Reputation:   3
  • Joined:  03/25/12
  • Last Seen:  

I get it now.

thanks to all of you for clearing about my question /no1

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...