using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class RadiantResolutionOrb : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Sun"); Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { Projectile.width = 62; Projectile.height = 64; Projectile.tileCollide = false; Projectile.friendly = true; Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.alpha = 255; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; } public override void AI() { if (Projectile.alpha > 0) { Projectile.alpha -= 9; if (Projectile.alpha < 0) Projectile.alpha = 0; } Player player = Main.player[Projectile.owner]; Projectile.frameCounter++; if (Projectile.frameCounter > 8) { Projectile.frame++; Projectile.frameCounter = 0; } if (Projectile.frame >= Main.projFrames[Projectile.type]) { Projectile.frame = 0; } if (Projectile.ai[0]++ < 30f) { Projectile.velocity *= 1.01f; } else { NPC potentialTarget = Projectile.Center.MinionHoming(2000f, player); if (potentialTarget != null) Projectile.velocity = (Projectile.velocity * 7f + Projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; } } } }