2 - True Melee is now two dedicated damage classes. One of them does not use melee speed. 3 - Fixed a bug where Warbanner of the Sun was only giving melee speed. 4 - Standardized defining whether an item is true melee. If it's one of the classes, it's true melee. Otherwise it's not. 5 - All items which are "classic true melee" (projectile-less melee) are re-classed as True Melee automatically. 6 - Renamed Yharon Soul Fragments internally. 7 - Can Fish In Lava is no longer a list; each item declares it individually. 8 - Removed the special true melee damage tooltip, as you will always see true melee damage on applicable weapons now.
55 lines
2.6 KiB
C#
55 lines
2.6 KiB
C#
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod
|
|
{
|
|
// True Melee is a subclass of Melee that is affected by melee speed.
|
|
// You can give players regular melee speed and it will affect true melee weapons of this damage class.
|
|
// If you want to give players attack speed which only affects true melee weapons, give them TrueMeleeDamageClass attack speed.
|
|
public class TrueMeleeDamageClass : DamageClass
|
|
{
|
|
internal static TrueMeleeDamageClass Instance;
|
|
|
|
public override void Load() => Instance = this;
|
|
public override void Unload() => Instance = null;
|
|
|
|
public override StatInheritanceData GetModifierInheritance(DamageClass damageClass)
|
|
{
|
|
if (damageClass == Melee || damageClass == Generic)
|
|
return StatInheritanceData.Full;
|
|
|
|
return StatInheritanceData.None;
|
|
}
|
|
|
|
// Does not inherit effects from MeleeNoSpeed, because that class already inherits directly from Melee itself.
|
|
public override bool GetEffectInheritance(DamageClass damageClass) => damageClass == Melee;
|
|
|
|
// SetDefaultStats not included, because the player gets 4% Melee crit by default, which carries over to this
|
|
}
|
|
|
|
// True Melee No Speed is a subclass of True Melee that, like MeleeNoSpeed, is NOT affected by melee speed.
|
|
// You should never give the player stat boosts to this class.
|
|
// Simply give them stat boosts to TrueMeleeDamageClass. This class will inherit everything but melee speed.
|
|
public class TrueMeleeNoSpeedDamageClass : DamageClass
|
|
{
|
|
internal static TrueMeleeNoSpeedDamageClass Instance;
|
|
|
|
public override void Load() => Instance = this;
|
|
public override void Unload() => Instance = null;
|
|
|
|
// This code lifted from the definition of MeleeNoSpeed, with the added change that it benefits from standard True Melee.
|
|
public override StatInheritanceData GetModifierInheritance(DamageClass damageClass)
|
|
{
|
|
if (damageClass == Generic || damageClass == Melee || damageClass == TrueMeleeDamageClass.Instance)
|
|
return StatInheritanceData.Full with { attackSpeedInheritance = 0 };
|
|
|
|
return StatInheritanceData.None;
|
|
}
|
|
|
|
// True Melee No Speed inherits effects from regular Melee, MeleeNoSpeed and regular True Melee.
|
|
public override bool GetEffectInheritance(DamageClass damageClass) =>
|
|
damageClass == Melee || damageClass == MeleeNoSpeed || damageClass == TrueMeleeDamageClass.Instance;
|
|
|
|
// SetDefaultStats not included, because the player gets 4% Melee crit by default, which carries over to this
|
|
}
|
|
}
|