Open yosef406 opened 2 years ago
I found a commit that mentions trying to make it so you can't stack haste and buff: https://github.com/spacechase0/StardewValleyMods/commit/f90bdd61dc9597d932225ab3253838f297f9c44c
It seems the buff spell removes all buff bonuses without actually removing buffs, and then adds itself as a buff, and when the buffs are over they substract their bonuses. I checked the public void removeBuffAttributes(int[] buffAttributes)
method and it seems it has checks so some bonuses never go negative, for example farming level:
if (buffAttributes[0] != 0)
{
addedFarmingLevel.Value = Math.Max(0, (int)addedFarmingLevel - buffAttributes[0]);
}
However, speed and attack do not have that Max with 0 to ensure they're not negative:
if (buffAttributes[9] != 0)
{
if (buffAttributes[9] < 0)
{
base.addedSpeed += Math.Abs(buffAttributes[9]);
}
else
{
base.addedSpeed -= buffAttributes[9];
}
}
if (buffAttributes[11] != 0)
{
if (buffAttributes[11] < 0)
{
attack += Math.Abs(buffAttributes[11]);
}
else
{
attack -= buffAttributes[11];
}
}
I assume this is to allow debuffs (Like the slime speed debuff). I think there's another "bug" with this spell, since if you cast Buff and then haste, I think you'll be able to stack them, which seems unintentional.
@spacechase0 , could you clarify what the intended behaviour is here? I can send a patch in a pull request to fix this but I'm not 100% sure what the intended behaviour is. Here are some options I see:
removeBuffAttributes()
call and attack = 0
, allow stackingremoveBuffAttributes
do addedSpeed = Max(0, addedSpeed)
to ensure speed is not made negative (This might have a "bug" where Buff can be cast to disable speed debuffs)
When casting haste, then if i cast Buff the effect of haste gets removed but the icon for haste still appears but when the icon is gone (the spell time is over) the player becomes very slow, as if when the spell is over it removes the effect of haste, but in reality the effect is gone because of casting Buff, that makes it drop the speed below the normal rate, its like: normal speed = 5 haste speed = 7 haste and buff speed = 5 haste is over after casting buff speed = 3 (example not sure how much it really is
https://user-images.githubusercontent.com/63299984/153964557-78c42c69-4cf6-4fd7-9e1c-68b0eaed426d.mp4
)