Jump to content
  • 0
deitalk

attribute_recover isn't working properly

Question

I'm running the newest rathena on pre-re and negative values for elemental damage are being read as 1 or miss even with attribute_recover set to 1

battle.conf:

Spoiler

attribute_recover: yes

ratio on battle.cpp should determine if damage is a positive or negative value

battle.cpp:

Spoiler

int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv)
{
    struct status_change *sc = NULL, *tsc = NULL;
    int ratio;

    if (src) sc = status_get_sc(src);
    if (target) tsc = status_get_sc(target);

    if (!CHK_ELEMENT(atk_elem))
        atk_elem = rnd()%ELE_ALL;

    if (!CHK_ELEMENT(def_type) || !CHK_ELEMENT_LEVEL(def_lv)) {
        ShowError("battle_attr_fix: unknown attribute type: atk=%d def_type=%d def_lv=%d\n",atk_elem,def_type,def_lv);
        return damage;
    }

    ratio = attr_fix_table[def_lv-1][atk_elem][def_type];

battle.cpp:

Spoiler

if (battle_config.attr_recover == 0 && ratio < 0)
        ratio = 0;

#ifdef RENEWAL
    //In renewal, reductions are always rounded down so damage can never reach 0 unless ratio is 0
    damage = damage - (int64)((damage * (100 - ratio)) / 100);
#else
    damage = (int64)((damage*ratio)/100);
#endif

    //Damage can be negative, see battle_config.attr_recover
    return damage;

status.cpp:

Spoiler

while (fgets(line, sizeof(line), fp)) {
        int lv, i, j;
        if (line[0] == '/' && line[1] == '/')
            continue;

        lv = atoi(line);
        if (!CHK_ELEMENT_LEVEL(lv))
            continue;

        for (i = 0; i < ELE_ALL;) {
            char *p;
            if (!fgets(line, sizeof(line), fp))
                break;
            if (line[0]=='/' && line[1]=='/')
                continue;

            for (j = 0, p = line; j < ELE_ALL && p; j++) {
                while (*p == 32) //skipping space (32=' ')
                    p++;
                                //TODO seem unsafe to continue without check
                attr_fix_table[lv-1][j] = atoi(p);
                p = strchr(p,',');
                if(p)
                    *p++=0;
            }

            i++;
        }
        entries++;
    }

What should I change in order to read attr_fix_table/ratio/damage negative values and make them heal target's HP?

Edited by deitalk
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

BTW, pasana should only reduce 75% from total fire damage, I think... Evil Druid should reduce 125% from shadow/poison...

Link to comment
Share on other sites

  • 0

The conf switch must make any x > 100% protection (ratio < 0 on battle.c) to heal the target instead of miss, but the ratio isn't receiving negative values

Link to comment
Share on other sites

  • 0

Actually I'm running pre-re setup, so yeah, I'd appreciate that. I've made some tests and couldn't even force directly ratio (therefore damage) to assume negative values. Even when I put damage = -ratio; it seems to revert negative to positive (ok) and when it tries to revert positives I get 0/1 damage

Link to comment
Share on other sites

  • 0

Apparently at some point someone decided that it wouldn't exist negative damage on RO anymore and then we lost attr_recover option (on both re and pre-re)... I'm still searching where on src it caps all forms of damage to positive

Link to comment
Share on other sites

  • 0
On 4/17/2019 at 1:07 AM, deitalk said:

Apparently at some point someone decided that it wouldn't exist negative damage on RO anymore and then we lost attr_recover option (on both re and pre-re)... I'm still searching where on src it caps all forms of damage to positive

do you have any update on this?

 

Link to comment
Share on other sites

  • 0

I have the same problem, any solution?

On 6/3/2021 at 12:37 PM, Humble_Bee said:

The solution: go into rAthena folder -> rathena -> conf -> battle -> skill.conf . Look for "skill_min_damage" and set the answer to "0" (zero).

What is happening is that if you have this turned on, it changes how the damage is calculated, so everything does at least 1 damage. It was meant to make it so you do more damage to plants, but it messes up the ability for a person to heal from damage. I have my heal back already, though I don't have my client set yet to show green numbers from heal damage, so it just looks like a white powder hitting me when the enemy hits. If you set your resistance to something like high, like 200+, you will see your hp bar jump back up when hit with that element.

Note: I know this topic is older, but I guarantee others have the same problem, and it's incredibly frustrating. There is also no answer anywhere else on the boards.

thanks, but it didn't work for me. Only works with the neutral element, the rest of the elements do not work

Link to comment
Share on other sites

  • 0

The solution: go into rAthena folder -> rathena -> conf -> battle -> skill.conf . Look for "skill_min_damage" and set the answer to "0" (zero).

What is happening is that if you have this turned on, it changes how the damage is calculated, so everything does at least 1 damage. It was meant to make it so you do more damage to plants, but it messes up the ability for a person to heal from damage. I have my heal back already, though I don't have my client set yet to show green numbers from heal damage, so it just looks like a white powder hitting me when the enemy hits. If you set your resistance to something like high, like 200+, you will see your hp bar jump back up when hit with that element.

Note: I know this topic is older, but I guarantee others have the same problem, and it's incredibly frustrating. There is also no answer anywhere else on the boards.

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

Important Information

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