Added Eternity, my dev weapon Changed the Sulf Sea worldgen a bit (a wip, more sprites needed) Added a ton of Acid Rain weapons and enemies Added a ton of summon weapons Added some early-game Sulf Sea weapons
63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using CalamityMod.Items.Weapons.Magic;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class EternityHoming : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Eternity");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 2;
|
|
projectile.height = 2;
|
|
projectile.friendly = true;
|
|
projectile.tileCollide = false;
|
|
projectile.ignoreWater = true;
|
|
projectile.timeLeft = 120;
|
|
projectile.alpha = 255;
|
|
projectile.magic = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
NPC target = null;
|
|
float distance = 4400f;
|
|
for (int index = 0; index < Main.npc.Length; index++)
|
|
{
|
|
if (Main.npc[index].CanBeChasedBy(null, false))
|
|
{
|
|
if (Main.npc[index].boss && Vector2.Distance(projectile.Center, Main.npc[index].Center) <= 4400f)
|
|
{
|
|
target = Main.npc[index];
|
|
break;
|
|
}
|
|
if (Vector2.Distance(projectile.Center, Main.npc[index].Center) < distance)
|
|
{
|
|
distance = Vector2.Distance(projectile.Center, Main.npc[index].Center);
|
|
target = Main.npc[index];
|
|
}
|
|
}
|
|
}
|
|
if (target != null)
|
|
{
|
|
projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(target.Center) * 10f) / 8f;
|
|
}
|
|
projectile.ai[0] += 0.18f;
|
|
float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
|
float pulse = (float)Math.Sin(projectile.ai[0]);
|
|
float radius = 10f;
|
|
Vector2 offset = angle.ToRotationVector2() * pulse * radius;
|
|
Dust dust = Dust.NewDustPerfect(projectile.Center + offset, Eternity.dustID, Vector2.Zero, 0, Eternity.pinkColor);
|
|
dust.noGravity = true;
|
|
dust = Dust.NewDustPerfect(projectile.Center - offset, Eternity.dustID, Vector2.Zero, 0, Eternity.blueColor);
|
|
dust.noGravity = true;
|
|
}
|
|
}
|
|
} |