Closed GabeHasWon closed 3 months ago
So what I'm thinking right now is making a handler for all tooltips, and having devs manually add their tooltip or their difference to that handler. It sucks that it's less automatic than the existing system, but realistically the existing system isn't automatic either; and requires using a field, which then needs to modify the stat, which is incredibly awkward.
Not very tested, but it's a great start. Affixes control their own localized comparison now, and the only code you'd add or change is this, per affix:
public override void ApplyTooltip(Player player, Item item, AffixTooltipsHandler handler)
{
handler.AddOrModify(GetType(), item,Value * 100, Language.GetText($"Mods.PathOfTerraria.Affixes.{GetType().Name}.Description"), null);
}
Example of a custom affix tooltip. Instead of the old system's "-1 Fall Damage immunity", it's nice and customized to fit the functionality.
Nice yeah I think that's a great idea. Gives us more control and is less black magic and obvious how it works.
Summary
At the moment, Affixes only can compare (i.e. say "+x% buff" or the opposite) when there are pre-defined values in EntityModifier, even when doing so is deeply inconvenient.
Using the AffixPlayer class, create a system that does this comparison using
StrengthOf(someAffix)
alongside some localization tools inAffix
to compare and create difference tooltips without necessitating being in EntityModifier. Ideally, this would also allow for more customization, such as sayingYou take fall damage
when losing a no fall damage affix instead of- fall damage immunity
.Reasonings
In my experience, the current comparison system in EntityModifier is really awkward to use and is very commonly a roadblock in creating affixes that do not modify simple stats. For example, a "deal additional damage to poisoned monsters" affix would require a dictionary of StatModifiers indexed by buff ID, and then be very inflexible as to how it's displayed regardless. A better system would significantly streamline development and make it way easier to customize how affixes are written, displayed and compared.