# Discussion Attribute system

## Recommended Posts

Hello guysi m wonder how these numbers are working

and how i could increase % of dmg per  attribute stat

i did some changes but nothing happend

Quote

/**
* Calculates the attribute bonus with the following formula: <BR>
* diff > 0, so AttBonus = 1,025 + sqrt[(diff^3) / 2] * 0,0001, cannot be above 1,25! <BR>
* diff < 0, so AttBonus = 0,975 - sqrt[(diff^3) / 2] * 0,0001, cannot be below 0,75! <BR>
* diff == 0, so AttBonus = 1<br>
* It has been tested that physical skills do get affected by attack attribute even<br>
* if they don't have any attribute. In that case only the biggest attack attribute is taken.
* @param attacker
* @param target
* @param skill Can be {@code null} if there is no skill used for the attack.
* @return The attribute bonus
*/
public static double calcAttributeBonus(L2Character attacker, L2Character target, Skill skill)
{
int attack_attribute;
int defence_attribute;

if ((skill != null) && (skill.getAttributeType() != AttributeType.NONE))
{
attack_attribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
}
else
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement());
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
}

final int diff = attack_attribute - defence_attribute;
if (diff > 0)
{
return Math.min(1.025 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.25);
}
else if (diff < 0)
{
return Math.max(0.975 - (Math.sqrt(Math.pow(-diff, 3) / 2) * 0.0001), 0.75);
}

return 1;
}

Edited by Pamela32

##### Share on other sites

This probably calculate the bonus damage for each attack. Example if skill is fire and the player has Fire Attribute this probably does some check and return a number. 1 Is the default which mean no bonus.

The

`if (diff > 0...`

return something between 1.025 (+a square) and 1.25 which mean it multiply the attack dmg by that number

Let's say the dmg is 700 and it multiply by 1.025 which has a result of 717.25. Or if you multiply 700 with 1.25 has a result of 875

• 1

##### Share on other sites
2 hours ago, Kara` said:

This probably calculate the bonus damage for each attack. Example if skill is fire and the player has Fire Attribute this probably does some check and return a number. 1 Is the default which mean no bonus.

The

```
if (diff > 0...```

return something between 1.025 (+a square) and 1.25 which mean it multiply the attack dmg by that number

Let's say the dmg is 700 and it multiply by 1.025 which has a result of 717.25. Or if you multiply 700 with 1.25 has a result of 875

so  this is correct ?

Quote

return Math.min(1.07﻿5 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.75);

Quote

{
return Math.max(0.925 - (Math.sqrt(Math.pow(-diff, 3) / 2) * 0.0001), 0.25);
}

##### Share on other sites
2 minutes ago, Pamela32 said:

so  this is correct ?

﻿

I don't know from which aspect you ask if is correct. As values? I dont know, as coding yes it's fine. You might no see difference because the damage addon is way too low. In 350 it add barely 5-50 bonus damage +/-

Do the maths. Ex. 350 Dmg * 1.075 and see the bonus.

##### Share on other sites
1 minute ago, Kara` said:

I don't know from which aspect you ask if is correct. As values? I dont know, as coding yes it's fine. You might no see difference because the damage addon is way too low. In 350 it add barely 5-50 bonus damage +/-

Do the maths. Ex. 350 Dmg * 1.075 and see the bonus.

ok got it , thanks boy

##### Share on other sites

Topic cleaned, stay on topic otherwise penalties will be applied.

##### Share on other sites
On 12/22/2018 at 9:13 PM, Kara` said:

I don't know from which aspect you ask if is correct. As values? I dont know, as coding yes it's fine. You might no see difference because the damage addon is way too low. In 350 it add barely 5-50 bonus damage +/-

Do the maths. Ex. 350 Dmg * 1.075 and see the bonus.

solved , ty again can be locked