Jump to content
  • 0

Read character's vit for damage reduction. How?


aleph075

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.71
  • Content Count:  48
  • Reputation:   0
  • Joined:  04/10/24
  • Last Seen:  

I am trying to reduce the defense power by items armor and trying change this:
 

/**
 * RE DEF Reduction
 * Damage = Attack * (4000+eDEF)/(4000+eDEF*10) - sDEF
 * Pierce defence gains 1 atk per def/2
 */
if( def1 == -400 ) /* -400 creates a division by 0 and subsequently crashes */
    def1 = -399;
ATK_ADD2(wd->damage, wd->damage2,
    is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) ? (def1*battle_calc_attack_skill_ratio(wd, src, target, skill_id, skill_lv))/200 : 0,
    is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) ? (def1*battle_calc_attack_skill_ratio(wd, src, target, skill_id, skill_lv))/200 : 0
);
if( !attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_R) && !is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) )
    wd->damage = wd->damage * (4000+def1) / (4000+10*def1) - vit_def;   <-------- ///Here///
if( is_attack_left_handed(src, skill_id) && !attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_L) && !is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) )
    wd->damage2 = wd->damage2 * (4000+def1) / (4000+10*def1) - vit_def;

The 4000 constants to 5000. But i want to add a plus damage reduction by users VIT stat (no vit_def)

How can i do that, wich sintaxis?  Or it's not even here in the code?

And, I can't find where is the code that defines vit_def (see photo)

Thx!

 

def.png

Edited by aleph075
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   236
  • Joined:  01/30/13
  • Last Seen:  

Are you running your server in renewal after all? Because that's the renewal defense code.

There is not a single function that calculates VIT_DEF at the moment, but it's basically calculated right above the code you quoted.

It uses DEF2 from status.cpp as input. Just search for "def2" in that file (calculation depends on bl type).

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...