Describe the bug
A changed maximum value of an attribute (e.g. at attack speed) is not considered when requesting it from the AttributeSystem.
To Reproduce
Steps to reproduce the behavior:
- Add 5000 agility to the testgmDk character on the admin panel
- Change the maximum value of the AttackSpeed attribute on the admin panel to 300
- Log into the game (MuMain, extended protocol) with the testgm account and select the testgmDk character
- See that the attack speed reports as 200 (the default).
Expected behavior
The attack speed should be reported as 300.
Additional context
The fix is probably to use the actual attribute defintion at AttributeSystem.GetValueOfAttribute. Currently, the AttributeDefinition which is passed as argument is used. However, this is not the same instance as the one which is configured.
This should probably work (see AttributeSystem.cs):
/// <inheritdoc/>
public float GetValueOfAttribute(AttributeDefinition? attributeDefinition)
{
var element = this.GetAttribute(attributeDefinition);
if (element != null)
{
var actualDefinition = (element as BaseAttribute)?.Definition ?? attributeDefinition;
if (actualDefinition?.MaximumValue is { } maximumValue && element.Value > maximumValue)
{
return maximumValue;
}
return element.Value;
}
return 0;
}
Describe the bug
A changed maximum value of an attribute (e.g. at attack speed) is not considered when requesting it from the AttributeSystem.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The attack speed should be reported as 300.
Additional context
The fix is probably to use the actual attribute defintion at
AttributeSystem.GetValueOfAttribute. Currently, the AttributeDefinition which is passed as argument is used. However, this is not the same instance as the one which is configured.This should probably work (see AttributeSystem.cs):