diff --git a/Buffs/Cooldowns/ResilienceCooldown.cs b/Buffs/Cooldowns/ResilienceCooldown.cs new file mode 100644 index 0000000000..66a4975223 --- /dev/null +++ b/Buffs/Cooldowns/ResilienceCooldown.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class ResilienceCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Resilience Cooldown"); + Description.SetDefault("You cannot re-summon a relic of resilience"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + } +} diff --git a/Buffs/Cooldowns/ResilienceCooldown.png b/Buffs/Cooldowns/ResilienceCooldown.png new file mode 100644 index 0000000000..abb0b76b86 Binary files /dev/null and b/Buffs/Cooldowns/ResilienceCooldown.png differ diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs new file mode 100644 index 0000000000..31f8cb212b --- /dev/null +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -0,0 +1,95 @@ +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Projectiles.Damageable; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Typeless +{ + public class RelicOfResilience : ModItem + { + public const int CooldownSeconds = 5; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Relic of Resilience"); + Tooltip.SetDefault("Summons a bulwark at the mouse position\n" + + "The bulwark takes damage from enemies and all projectiles.\n" + + "On death, the bulwark explodes into a burst of shards\n" + + "After a bit of time, the shards come together to reform the original bulwark.\n" + + $"This reformation can only happen {ArtifactOfResilienceBulwark.MaxReformations} times.\n" + + "You gain a small cooldown when summoning a new bulwark.\n" + + "If a bulwark or shard already exists, using this item will relocate them"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 34; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAnimation = item.useTime = 28; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item45; + item.autoReuse = true; + item.noMelee = true; + item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 0f; + } + public override bool CanUseItem(Player player) => !player.HasBuff(ModContent.BuffType()); + public override bool UseItem(Player player) + { + return true; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.AddBuff(ModContent.BuffType(), CooldownSeconds * 60); + if (player.ownedProjectileCounts[item.shoot] > 0 || + player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].type == item.shoot) + { + Main.projectile[i].Center = Main.MouseWorld; + Main.projectile[i].netUpdate = true; + } + else + { + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard1) + { + ((ArtifactOfResilienceShard1)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard2) + { + ((ArtifactOfResilienceShard2)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard3) + { + ((ArtifactOfResilienceShard3)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard4) + { + ((ArtifactOfResilienceShard4)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard5) + { + ((ArtifactOfResilienceShard5)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + if (Main.projectile[i].modProjectile is ArtifactOfResilienceShard6) + { + ((ArtifactOfResilienceShard6)Main.projectile[i].modProjectile).StartingPosition = Main.MouseWorld; + } + } + } + } + else + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Typeless/RelicOfResilience.png b/Items/Weapons/Typeless/RelicOfResilience.png new file mode 100644 index 0000000000..87d1ba1e64 Binary files /dev/null and b/Items/Weapons/Typeless/RelicOfResilience.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index c3a52b7001..c2c4f1e7c5 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -285,6 +286,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians return true; } + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + } + public override void BossLoot(ref string name, ref int potionType) { name = "A Profaned Guardian"; diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs new file mode 100644 index 0000000000..341ecdcff2 --- /dev/null +++ b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +namespace CalamityMod.Projectiles.Damageable +{ + public class ArtifactOfResilienceBulwark : DamageableProjectile + { + public int Reformations = 0; + public const int MaxReformations = 3; + public override int LifeMax => 30000; + public override int MaxDamageImmunityFrames => 5; + public override DamageSourceType DamageSources => DamageSourceType.FriendlyProjectiles | DamageSourceType.HostileProjectiles | DamageSourceType.HostileNPCs; + public override LegacySoundStyle HitSound => SoundID.NPCHit3; + public override LegacySoundStyle DeathSound => SoundID.NPCDeath14; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact of Resilience"); + } + + public override void SafeSetDefaults() + { + projectile.width = projectile.height = 76; + projectile.friendly = true; + projectile.penetrate = 20; + } + + public override void SafeAI() + { + projectile.rotation += MathHelper.ToRadians(8f); + Vector2 spawnPosition = projectile.Center + Utils.NextVector2Circular(Main.rand, projectile.width, projectile.height) / 2f; + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.ProfanedFire); + dust.velocity = projectile.DirectionFrom(spawnPosition); + dust.scale = Main.rand.NextFloat(1.1f, 1.5f); + dust.noGravity = true; + } + } + public override void HitEffectProjectile(int damage, Projectile target) + { + target.Kill(); + } + public override void DamageKillEffect() + { + Utils.PoofOfSmoke(projectile.Center); + } + public override void Kill(int timeLeft) + { + for (int i = 1; i <= 6; i++) + { + if (Main.myPlayer == projectile.owner) + { + float angle = MathHelper.TwoPi / 6f * (i - 1); + Projectile shard = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, mod.ProjectileType("ArtifactOfResilienceShard" + i.ToString()), projectile.damage, projectile.knockBack, projectile.owner); + shard.ai[0] = angle; + shard.frameCounter = projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. + } + } + } + } +} diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png b/Projectiles/Damageable/ArtifactOfResilienceBulwark.png new file mode 100644 index 0000000000..97f00c91bd Binary files /dev/null and b/Projectiles/Damageable/ArtifactOfResilienceBulwark.png differ diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs new file mode 100644 index 0000000000..55c4a7b67f --- /dev/null +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -0,0 +1,350 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Damageable +{ + [Flags] + public enum DamageSourceType + { + HostileProjectiles = 1 << 1, + FriendlyProjectiles = 1 << 2, // Does NOT include itself. + HostileNPCs = 1 << 3 + } + public abstract class DamageableProjectile : ModProjectile + { + #region General Fields + /// + /// Current life of the projectile. + /// + public int Life; + /// + /// Total damage immunity frames. This projectile cannot be hit if this is greater than 0. Descends to 0 every frame. + /// + public int DamageImmunityFrames; + #endregion + + #region Overridable Fields/Properties + + /// + /// Total life of the projectile. + /// + public abstract int LifeMax + { + get; + } + + /// + /// The sound the projectile makes on hit. + /// + public abstract LegacySoundStyle HitSound + { + get; + } + + /// + /// The sound the projectile makes on death. + /// + public abstract LegacySoundStyle DeathSound + { + get; + } + + /// + /// The various possibile damage sources for the projectile. + /// + public abstract DamageSourceType DamageSources + { + get; + } + + /// + /// A boolean which determines if the HP bar should be drawn at all. + /// + public virtual bool DrawHPBar + { + get; + set; + } = true; + + /// + /// A boolean which determines if the HP bar should be drawn if is equal to + /// + public virtual bool DrawHPBarAtFullHealth + { + get; + set; + } = false; + + /// + /// How many damage immunity frames this projectile should recieve on hit. + /// + public virtual int MaxDamageImmunityFrames + { + get; + set; + } = 10; + + /// + /// List of all enemies this projectile should ignore when checking if it's colliding with an enemy (assuming this is possible). + /// + public virtual List NPCsToIgnore + { + get; + set; + } = new List(); + + /// + /// List of all projectiles this projectile should ignore when checking if it's colliding with a projectile (assuming this is possible). + /// + public virtual List ProjectilesToIgnore + { + get; + set; + } = new List(); + #endregion + + #region Virtual Methods + Sealed Counterparts + + /// + /// Copy of with integrations for this custom type. + /// + public virtual void SafeSetDefaults() + { + } + public sealed override void SetDefaults() + { + SafeSetDefaults(); + Life = LifeMax; + } + public sealed override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + DrawHealthBar(); + MouseOverText(); + SafePostDraw(spriteBatch, lightColor); + } + + /// + /// Copy of with integrations for this custom type. + /// + public virtual void SafePostDraw(SpriteBatch spriteBatch, Color lightColor) + { + } + public sealed override void AI() + { + SafeAI(); + if (DamageImmunityFrames > 0) + { + DamageImmunityFrames--; + return; + } + bool wasHit = NPCCollisionCheck(); + if (!wasHit) + { + wasHit = ProjectileCollisionCheck(); + } + if (wasHit && Life > 0) + { + if (HitSound != null) + { + Main.PlaySound(HitSound, projectile.Center); + } + } + else if (Life <= 0) + { + if (DeathSound != null) + { + Main.PlaySound(DeathSound, projectile.Center); + } + DamageKillEffect(); + projectile.Kill(); + } + } + public virtual bool NPCCollisionCheck() + { + Player player = Main.player[projectile.owner]; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && !Main.npc[i].friendly && Main.npc[i].damage > 0 && DamageSources.HasFlag(DamageSourceType.HostileNPCs)) + { + if (Main.npc[i].Hitbox.Intersects(projectile.Hitbox) && !NPCsToIgnore.Contains(Main.npc[i].type)) + { + int damage = Main.DamageVar(Main.npc[i].damage); + int bannerBuffId = Item.NPCtoBanner(Main.npc[i].BannerID()); + if (bannerBuffId > 0 && player.NPCBannerBuff[bannerBuffId]) + { + if (Main.expertMode) + { + damage = (int)(damage * ItemID.Sets.BannerStrength[Item.BannerToItem(bannerBuffId)].ExpertDamageReceived); + } + else + { + damage = (int)(damage * ItemID.Sets.BannerStrength[Item.BannerToItem(bannerBuffId)].NormalDamageReceived); + } + } + CombatText.NewText(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), CombatText.DamagedFriendly, damage); + Life -= damage; + HitEffectNPC(damage, Main.npc[i]); + DamageImmunityFrames = MaxDamageImmunityFrames; + NetUpdate(true); + return true; + } + } + } + return false; + } + public virtual bool ProjectileCollisionCheck() + { + for (int i = 0; i < Main.projectile.Length; i++) + { + bool canBeHit = (Main.projectile[i].friendly && DamageSources.HasFlag(DamageSourceType.FriendlyProjectiles) || + Main.projectile[i].hostile && DamageSources.HasFlag(DamageSourceType.HostileProjectiles)) && + i != projectile.whoAmI; + if (Main.projectile[i].active && canBeHit && Main.projectile[i].damage > 0) + { + if (Main.projectile[i].Colliding(Main.projectile[i].Hitbox, projectile.Hitbox)) + { + int damage = Main.DamageVar(Main.projectile[i].damage) * 2; + damage = Main.expertMode ? (int)(damage * Main.expertDamage) : damage; + CombatText.NewText(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), CombatText.DamagedFriendly, damage); + Life -= damage; + HitEffectProjectile(damage, Main.projectile[i]); + DamageImmunityFrames = MaxDamageImmunityFrames; + if (projectile.usesIDStaticNPCImmunity) + DamageImmunityFrames = projectile.idStaticNPCHitCooldown; + if (projectile.usesLocalNPCImmunity) + DamageImmunityFrames = projectile.localNPCHitCooldown; + NetUpdate(true); + return true; + } + } + } + return false; + } + public virtual void DamageKillEffect() + { + } + /// + /// Copy of with integrations for this custom type. + /// + public virtual void SafeAI() + { + } + public sealed override void SendExtraAI(BinaryWriter writer) + { + SafeSendExtraAI(writer); + writer.Write(Life); + writer.Write(DamageImmunityFrames); + } + public sealed override void ReceiveExtraAI(BinaryReader reader) + { + SafeReceiveExtraAI(reader); + Life = reader.ReadInt32(); + DamageImmunityFrames = reader.ReadInt32(); + } + + /// + /// Copy of with integrations for this custom type. + /// The writer used to hold data which will be sent to the server. + /// + public virtual void SafeSendExtraAI(BinaryWriter writer) + { + } + + /// + /// Copy of with integrations for this custom type. + /// The reader used to obtain data which will be sent to the server. + /// + public virtual void SafeReceiveExtraAI(BinaryReader reader) + { + } + + /// + /// Syncs data from this npc to the server, and then to all clients. + /// + /// Whether net spam should be ignored and a net update should be forced. + /// The condition required for a forceful sync. Defaults to: Main.netMode != NetmodeID.MultiplayerClient + public virtual void NetUpdate(bool force = false, Func forceCondition = null) + { + if (forceCondition == null) + forceCondition = () => Main.netMode != NetmodeID.MultiplayerClient; + if (force) + { + if (forceCondition()) + { + NetMessage.SendData(MessageID.SyncProjectile, number: projectile.whoAmI); + } + } + else + projectile.netUpdate = true; + } + /// + /// Does things when the projectile is hit. + /// + /// The damage taken by the projectile. + /// The projectile which hit the target. + public virtual void HitEffectProjectile(int damage, Projectile target) + { + } + /// + /// Does things when the projectile is hit. + /// + /// The damage taken by the projectile. + /// The npc which hit the target. + public virtual void HitEffectNPC(int damage, NPC target) + { + } + #endregion + + #region Misc Functions + /// + /// Creates text, much akin to NPCs, when a mouse is over the projectile's hitbox. + /// + public void MouseOverText() + { + if (!Main.mouseText) + { + Rectangle mouseRectangle = new Rectangle((int)(Main.mouseX + Main.screenPosition.X), (int)(Main.mouseY + Main.screenPosition.Y), 1, 1); + if (Main.player[Main.myPlayer].gravDir == -1f) + { + mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; + } + if (projectile.Hitbox.Intersects(mouseRectangle)) + { + if (LifeMax > 1) + { + string lifeDataText = string.Concat(new object[] + { + projectile.Name, + ": ", + Life, + "/", + LifeMax + }); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, null, null, null, Main.UIScaleMatrix); + Main.instance.MouseTextHackZoom(lifeDataText); + } + } + } + } + /// + /// Draws a health bar below the projectile. + /// + public void DrawHealthBar() + { + if (Life == LifeMax && !DrawHPBarAtFullHealth) + return; + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, null, null, null, Main.UIScaleMatrix); + Main.instance.DrawHealthBar(projectile.Bottom.X, projectile.Bottom.Y, Life, LifeMax, 1f, 1f); + } + #endregion + } +} diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard1.png b/Projectiles/Typeless/ArtifactOfResilienceShard1.png new file mode 100644 index 0000000000..120152d7bc Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard1.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard2.png b/Projectiles/Typeless/ArtifactOfResilienceShard2.png new file mode 100644 index 0000000000..baf383fa7f Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard2.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard3.png b/Projectiles/Typeless/ArtifactOfResilienceShard3.png new file mode 100644 index 0000000000..d78a648d63 Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard3.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard4.png b/Projectiles/Typeless/ArtifactOfResilienceShard4.png new file mode 100644 index 0000000000..bf70a205ff Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard4.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard5.png b/Projectiles/Typeless/ArtifactOfResilienceShard5.png new file mode 100644 index 0000000000..d9098deb34 Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard5.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShard6.png b/Projectiles/Typeless/ArtifactOfResilienceShard6.png new file mode 100644 index 0000000000..85e3fa4eda Binary files /dev/null and b/Projectiles/Typeless/ArtifactOfResilienceShard6.png differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs new file mode 100644 index 0000000000..c638022950 --- /dev/null +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -0,0 +1,237 @@ +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Damageable; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ArtifactOfResilienceShard1 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const int MaxTimeLeft = 360; + public const int FallTime = 240; + public const float OutwardMovementTime = 85f; + public const float InwardReturnMovementTime = 100f; + public const float MaxRadius = 240f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + public static void ArtifactOfResilienceShardAI(Projectile projectile, ref Vector2 StartingPosition, ref int Timer) + { + // Spinning + if (projectile.localAI[1] == 0f) + { + if (projectile.localAI[0] == 0f) + { + StartingPosition = projectile.Center; + projectile.localAI[0] = 1f; + } + Timer++; + if (Timer < OutwardMovementTime) + { + projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, Timer / OutwardMovementTime); + } + if (Timer > MaxTimeLeft - InwardReturnMovementTime) + { + projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, (Timer - MaxTimeLeft) / -InwardReturnMovementTime); + } + projectile.ai[0] += MathHelper.Pi / (projectile.ai[1] / MathHelper.Pi + 1); + projectile.Center = StartingPosition + projectile.ai[0].ToRotationVector2() * projectile.ai[1]; + projectile.rotation = projectile.ai[0]; + if (projectile.timeLeft == 1) + { + for (int i = 0; i < 50; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); + dust.velocity = Utils.NextVector2Circular(Main.rand, 36f, 36f); + dust.scale = Main.rand.NextFloat(1.9f, 2.45f); + dust.noGravity = true; + } + projectile.timeLeft = FallTime; + projectile.tileCollide = true; + projectile.velocity = Utils.NextVector2Circular(Main.rand, 18f, 9f); + projectile.localAI[1] = 1; + } + } + // Falling + else + { + if (projectile.frameCounter <= ArtifactOfResilienceBulwark.MaxReformations) + { + // Reform + if (projectile.modProjectile is ArtifactOfResilienceShard1 && Main.myPlayer == projectile.owner) + { + Projectile reformedBulwark = Projectile.NewProjectileDirect(projectile.Center, + Vector2.Zero, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner); + reformedBulwark.frameCounter = projectile.frameCounter; // Incremented on death, not reformation. + } + projectile.Kill(); + return; + } + if (projectile.velocity.Y < 12f) + { + projectile.velocity.Y += 0.25f; + } + projectile.velocity.X *= 0.95f; + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.timeLeft < 60f) + { + projectile.alpha = 255 - (int)MathHelper.Lerp(0, 255, projectile.timeLeft / 60f); + } + } + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } + public class ArtifactOfResilienceShard2 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const float MaxRadius = 660f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } + public class ArtifactOfResilienceShard3 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const float MaxRadius = 660f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } + public class ArtifactOfResilienceShard4 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const float MaxRadius = 660f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } + public class ArtifactOfResilienceShard5 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const float MaxRadius = 660f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } + public class ArtifactOfResilienceShard6 : ModProjectile + { + public int Timer = 0; + public Vector2 StartingPosition; + public const float MaxRadius = 660f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Artifact Shard"); + Main.projFrames[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(projectile, ref StartingPosition, ref Timer); + } +}