using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.GameContent; using Terraria.ID; namespace CalamityMod.DataStructures { /// /// This is used to store summon tag stats so they can be applied automatically. /// public class SummonTag { #region SummonTag data /// /// Flat tag damage from this summon tag /// public int FlatTagDamage = 0; /// /// This is tag damage that isn't added to the tooltip. Used for removing Vanilla whip tag damage. /// public int UnlistedTagDamage = 0; /// /// Multiplicative tag damage from this summon tag. Stacks additively with other tags. /// public float MultiplicativeTagDamage = 0; /// /// This is tag damage that isn't added to the tooltip. Used for removing Firecracker whip damage. /// public float UnlistedMultiplicativeTagDamage = 0; /// /// Tag critical strike chance from this stummon tag. Stacks additively with other tags. /// public float TagCritChance = 0; /// /// How much the Critical Strike damage multiplier should be adjusted with this tag. Stacks additively with other tags. /// public float TagCritDamage = 0; /// /// UNIMPLEMENTED. Need to add animation frame support before using. /// What the texture for the tag effect should be. /// public Asset TagTexture; /// /// What item inflicted this tag /// public int TagItem = -1; /// /// The ModifyHitByProjectileTag code to run. Defaults to just applying the tag effects. /// public ModifyHitByProjectileTag TagModifyHitEffects; /// /// Disable to stop tooltips from drawing automatically, for things that change TagModifyHitEffects /// public bool AutoDrawTooltip = true; /// /// Setting to true allows this tag to be used alongside other tag effects. /// public bool AllowsWhipStacking = false; /// /// The OnHitByProjectile code to run when this tag is applied. Defaults to nothing. /// public OnHitByProjectile TagOnHit = BlankOnHit; public SummonTag() { TagModifyHitEffects = ApplyTagModifyHit; } public SummonTag(int itemType) { TagItem = itemType; TagModifyHitEffects = ApplyTagModifyHit; } /// /// A modified version of ModifyHitByProjectile that incorporates tag damage multipliers and tag critical chance. /// This delegate is used for TagModifyHitEffects /// /// /// /// /// /// public delegate void ModifyHitByProjectileTag(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance); /// /// This delegate is used for TagOnHit /// /// /// /// /// public delegate void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone); /// /// The default tag damage functionality /// public void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) { modifiers.FlatBonusDamage += (FlatTagDamage + UnlistedTagDamage) * tagDamageMult; modifiers.ScalingBonusDamage += (MultiplicativeTagDamage + UnlistedMultiplicativeTagDamage) * tagDamageMult; critChance += TagCritChance; modifiers.CritDamage += TagCritDamage; } /// /// Due to how Firecracker works, this allows it to work with crit accessories. /// public static void FirecrackerModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) { modifiers.ScalingBonusDamage += (Firecracker.MultiplicativeTagDamage + Firecracker.UnlistedMultiplicativeTagDamage) * tagDamageMult; modifiers.CritDamage += Firecracker.TagCritDamage; } /// /// This is replaced by custom tag on hit effects. Does nothing. /// public static void BlankOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { } #endregion #region Vanilla whip stats public static SummonTag LeatherWhip = new SummonTag(ItemID.BlandWhip) { FlatTagDamage = 4, UnlistedTagDamage = -4 //Negative value cancels out vanilla tag damage }; public static SummonTag Snapthorn = new SummonTag(ItemID.ThornWhip) { FlatTagDamage = 4, UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage }; public static SummonTag SpinalTap = new SummonTag(ItemID.BoneWhip) { FlatTagDamage = 5, UnlistedTagDamage = -7 //Negative value cancels out vanilla tag damage }; public static SummonTag Firecracker = new SummonTag(ItemID.FireWhip) { MultiplicativeTagDamage = 1f, TagCritDamage = -1f, TagModifyHitEffects = FirecrackerModifyHit, UnlistedMultiplicativeTagDamage = -1.75f, //Cancels out the vanilla firecracker tag damage AutoDrawTooltip = false }; public static SummonTag CoolWhip = new SummonTag(ItemID.CoolWhip) { FlatTagDamage = 8, UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage }; public static SummonTag Durendal = new SummonTag(ItemID.SwordWhip) { FlatTagDamage = 5, TagCritChance = 0.05f, UnlistedTagDamage = -9 //Negative value cancels out vanilla tag damage }; public static SummonTag MorningStar = new SummonTag(ItemID.MaceWhip) { TagCritChance = 0.13f, UnlistedTagDamage = -8 //Negative value cancels out vanilla tag damage }; public static SummonTag DarkHarvest = new SummonTag(ItemID.ScytheWhip) { FlatTagDamage = 14, UnlistedTagDamage = -10, //Negative value cancels out vanilla tag damage //This has a unique on hit effect from vanilla. }; public static SummonTag Kaleidoscope = new SummonTag(ItemID.RainbowWhip) { FlatTagDamage = 10, TagCritChance = 0.10f, UnlistedTagDamage = -20 //Negative value cancels out vanilla tag damage }; #endregion } }