Files
CalamityModPublic/Projectiles/Magic/EventHorizonStar.cs
T
mountaindrew10 4626974709 1 - Inferna Cutter now inflicts Hellfire instead of On Fire! and no longer inflicts Brimstone Flames.
2 - Mantis Claws now inflict Hellfire.
3 - Vulcanite Lance now inflicts Hellfire instead of On Fire!
4 - Fault Line now inflicts Hellfire instead of On Fire!
5 - Blood Bath now inflicts Burning Blood.
6 - Shaderain Staff no longer inflicts any debuffs.
7 - Icicle Trident no longer inflicts Glacial State.
8 - Infernal Rift now inflicts Hellfire instead of Brimstone Flames.
9 - Vesuvius no longer buffs the player with Molten and now inflicts Hellfire.
10 - Deathhail Staff now inflicts God Slayer Inferno instead of On Fire! and Frostburn.
11 - Divine Retribution no longer inflicts Crush Depth.
12 - Elemental Ray no longer inflicts any debuffs.
13 - Helium Flash no longer inflicts Irradiated.
14 - Ice Barrage no longer inflicts Exo Freeze.
15 - Sanguine Flare no longer inflicts any debuffs.
16 - Soul Piercer now inflicts God Slayer Inferno.
17 - Staff of Blushie now only inflicts Daybroken.
18 - Ultra Liquidator no longer inflicts any debuffs and no longer requires Ichor/Cursed Flames to craft.
19 - Venusian Trident now inflicts Daybroken instead of On Fire!
20 - The Wand now only inflicts Dragonfire.
21 - Gatling Laser no longer inflicts any debuffs.
22 - Ion Blaster no longer inflicts any debuffs.
23 - Lazhar now inflicts Daybroken instead of On Fire!
24 - Aetherflux Cannon now inflicts Holy Flames.
25 - Apoctosis Array no longer inflicts any debuffs.
26 - Plasma Caster no longer inflicts any debuffs.
27 - Purge Guzzler no longer inflicts On Fire!
28 - Death Valley Duster now inflicts Armor Crunch.
29 - Forbidden Sun now inflicts Hellfire instead of On Fire!
30 - Frigidflash Bolt now inflicts Hellfire instead of On Fire!
31 - Poseidon now inflicts Eutrophication.
32 - Primordial Earth now inflicts Armor Crunch.
33 - Seething Discharge now inflicts Brimstone Flames.
34 - Tome of Fates no longer inflicts Brimstone Flames.
35 - Apotheosis no longer inflicts Armor Crunch, Demon Flames and Exo Freeze, but now inflicts Whispering Death.
36 - Augur of the Elements no longer inflicts any debuffs.
37 - Event Horizon no longer inflicts any debuffs.
38 - Nuclear Fury no longer inflicts any debuffs.
39 - Primordial Ancient now inflicts Armor Crunch.
40 - Recitation of the Beast no longer inflicts any debuffs.
41 - Arctic Bear Paw no longer inflicts Confused.
42 - Mad Alchemist's Cocktail Glove no longer inflicts Poisoned, On Fire!, Cursed Inferno, Shadowflame and Frostburn, but now inflicts Electrified and the debuff durations have been doubled.
43 - Yharim's Crystal now inflicts Dragonfire.
2022-12-05 02:47:40 -06:00

141 lines
5.2 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class EventHorizonStar : ModProjectile
{
private bool initialized = false;
Vector2 initialPosition;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Event Horizon Star");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.DamageType = DamageClass.Magic;
Projectile.tileCollide = false;
Projectile.timeLeft = 300;
Projectile.alpha = 180;
}
public override void AI()
{
//rotation
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
//sound effects
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 20 + Main.rand.Next(40);
if (Main.rand.NextBool(5))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
//dust effects
if (Main.rand.NextBool(10))
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 262, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 0, default, 0.75f);
}
Projectile.localAI[0]++;
Vector2 playerCenter = Main.player[Projectile.owner].Center;
float centerX = Projectile.Center.X;
float centerY = Projectile.Center.Y;
if (!initialized)
{
initialPosition = playerCenter;
initialized = true;
}
else if (playerCenter != initialPosition)
{
playerCenter = initialPosition;
}
float xDist = playerCenter.X - centerX;
float yDist = playerCenter.Y - centerY;
float radius = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist));
if (Projectile.localAI[0] > 10 && Projectile.localAI[0] < 100)
{
Projectile.ai[1] += 1f / 60f;
if (Projectile.ai[1] > 0)
{
Projectile.ai[0] += MathHelper.ToRadians(5f) / Projectile.ai[1];
Projectile.Center = playerCenter + Projectile.ai[0].ToRotationVector2() * radius;
}
}
//homing
if (Projectile.localAI[0] >= 100)
{
Vector2 center = Projectile.Center;
float homingRange = 325f;
bool homeIn = false;
float inertia = 25f;
float homingSpeed = 23f;
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].CanBeChasedBy(Projectile, false))
{
float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2);
if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (homingRange + extraDistance))
{
center = Main.npc[i].Center;
homeIn = true;
break;
}
}
}
if (homeIn)
{
Projectile.extraUpdates = 1;
Vector2 homeInVector = Projectile.SafeDirectionTo(center, Vector2.UnitY);
Projectile.velocity = (Projectile.velocity * inertia + homeInVector * homingSpeed) / (inertia + 1f);
}
else
Projectile.extraUpdates = 0;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<EventHorizonBlackhole>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void PostDraw(Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), new Color(255, 255, 255, 127), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
}
}
}