using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { /// /// An abstract class that gives the baseline code needed to make a buff dedicated to a minion. /// public abstract class BaseSummonBuff : ModBuff { /// /// The correspondent minion's ID of this buff. /// protected abstract int MinionProjectileType { get; } /// /// The correspondent boolean field of this minion. /// protected abstract ref bool MinionBool { get; } /// /// The that possesses this buff (Read-only). /// protected Player BuffOwner { get; private set; } /// /// The that possesses this buff (Read-only). /// protected CalamityPlayer BuffModdedOwner { get; private set; } public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; } public override void Update(Player player, ref int buffIndex) { BuffOwner = player; BuffModdedOwner = player.Calamity(); if (player.ownedProjectileCounts[MinionProjectileType] > 0) MinionBool = true; if (!MinionBool) { player.DelBuff(buffIndex); buffIndex--; } else player.buffTime[buffIndex] = 18000; } } }