Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: negative bonus effects #2200

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cydyn
Copy link

@cydyn cydyn commented Mar 25, 2024

Added the ability to set negative bonus effect values.
Negative CDR increases spell cooldown.
Negative Tenacity increases the duration of effect, e.g. stun, but does not cause the damage to be duplicated over time.
A negative exp and luck bonus results in lower chances of drops and lower exp for the player.
Lifesteal and manasteal are negative, it works like 0, but if other equipment adds lifesteal or manasteal, it is known that the minus value takes it into account. PS: Works as 0 because healing spells have minus values, which causes a minus lifesteal to double the healing
The characterwindow has also been changed so that negative values ​​can be shown

@cydyn cydyn changed the title Negative bonus effect values ​​and correct operation feat: Negative bonus effect values ​​and correct operation Mar 25, 2024
@cydyn cydyn changed the title feat: Negative bonus effect values ​​and correct operation enhancement: negative bonus effects Mar 25, 2024
@@ -2084,6 +2084,10 @@ public virtual void TryAttack(Entity target)
if (this is Player && !(enemy is Resource))
{
var lifestealRate = thisPlayer.GetEquipmentBonusEffect(ItemEffect.Lifesteal) / 100f;
if (lifestealRate < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this if, regardless of the value being negative, it will not pass the next check on the line 2094

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why he shouldn't pass the next inspection? After all, this is just an exception which, if there is a minus value, sets it to 0, i.e. the default basic amount. This change must be made, otherwise lifesteal will not work properly, as I have already explained. unless I don't understand what you mean

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will explain this further. If we didn't have this "if", then if we had -30% lifesteal and used a healing spell whose formula had e.g. -10 to heal by 10, then there would be an error in the code. because lifestealrate -30% * basedamage -10, gives a positive result, which causes additional treatment.

@@ -2099,6 +2103,10 @@ public virtual void TryAttack(Entity target)
}

var manastealRate = (thisPlayer.GetEquipmentBonusEffect(ItemEffect.Manasteal) / 100f);
if (manastealRate < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this if, regardless of the value being negative, it will not pass the next check on the line 2113

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same situation here. After all, it's just an exception that checks whether the lifestealrate or manastealrate is minus. if so, change it to 0, i.e. the default value. So it should not interfere with the next check regarding +0msg

@cydyn
Copy link
Author

cydyn commented Mar 27, 2024

Okay, I know what weylon means. I will make sure that the treatment works properly and lifesteal takes the user's life with a negative value.

@cydyn
Copy link
Author

cydyn commented Mar 28, 2024

Two changes are introduced.
One adds options in the code
if (baseDamage > 0 && this != enemy)

This means that if we do not deal damage and if we deal damage to ourselves, e.g. a trap that uses a self spell that deals damage, then neither lifesteal nor manasteal works.

Moreover, I added options in the characterwindow so that if lifesteal or manasteal had a negative value, it does not show them, it only shows 0.

I don't know how to do it via the server.
The calculation of all effects is not separate, but common, so....
public int GetEquipmentBonusEffect(ItemEffect effect)
{
var value = 0;

        foreach (var item in EquippedItems)
        {
            if (!item.Descriptor.EffectsEnabled.Contains(effect))
            {
                continue;
            }
            value += item.Descriptor.GetEffectPercentage(effect);
        }

        return value;
    }

@cydyn
Copy link
Author

cydyn commented Mar 29, 2024

How about adding that life theft would show negative values ​​in charcterwindows as 0 (lifestealrate). thanks to which we have both 0 and a negative value, thanks to which we know how much we currently have

@Arufonsu Arufonsu added the question Project information is requested label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Project information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants