Files
CalamityModPublic/Projectiles/Ranged/UniversalGenesisStarcaller.cs
T
mountaindrew10 96942111c3 1 - Bloodfire Arrows no longer inflict Brimstone Flames.
2 - Holy Fire Bullets no longer inflicts On Fire!
3 - Icy Bullets no longer inflict Glacial State.
4 - Toxibow now inflicts Irradiated for 8 seconds.
5 - Corroded Caustibow no longer inflicts Sulphuric Poisoning but increased duration of Irradiated to 8 seconds.
6 - Flarewing Bow bats now inflict Hellfire.
7 - Arterial Assault no longer inflicts Brimstone Flames.
8 - Contagion no longer inflicts Plague.
9 - Deathwind now inflicts God Slayer Inferno instead of On Fire! and Frostburn.
10 - Drataliornus now only inflicts Dragonfire.
11 - The Maelstrom now inflicts Crush Depth.
12 - Eviscerator now inflicts Burning Blood.
13 - Clamor Rifle now inflicts Eutrophication.
14 - Hellborn now inflicts Hellfire on gun hits.
15 - Helstorm now inflicts Hellfire on gun hits.
16 - Leviatitan no longer inflicts Poisoned.
17 - Needler now inflicts Acid Venom.
18 - Ace's High no longer inflicts Brimstone Flames.
19 - Auralis no longer inflicts Cursed Inferno and Ichor.
20 - Claret Cannon no longer inflicts Brimstone Flames.
21 - Dragon's Breath no longer inflicts On Fire!
22 - Karasawa no longer inflicts any debuffs.
23 - Spyker now inflicts Acid Venom.
24 - Universal Genesis no longer inflicts any debuffs.
25 - Mineral Mortar now inflicts Armor Crunch.
26 - Blissful Bombardier now inflicts Holy Flames instead of Dragonfire.
27 - Chicken Cannon now inflicts Dragonfire.
28 - Scorched Earth no longer inflicts On Fire!
29 - Dragoon Drizzlefish now inflicts Brimstone Flames for 1 second with primary fireballs and 0.5 seconds with split fireballs.
30 - Meowthrower no longer inflicts any debuffs.
31 - Blood Boiler no longer inflicts Brimstone Flames.
32 - Elemental Eruption no longer inflicts any debuffs.
33 - Flak Kraken now inflicts Crush Depth.
34 - Elemental Blaster no longer inflicts any debuffs.
35 - Heavy Laser Rifle no longer inflicts On Fire!
36 - Spetic Skewer no longer inflicts Acid Venom.
37 - Starmada no longer inflicts any debuffs.
38 - Sulphuric Acid Cannon now inflicts Sulphuric Poisoning.
2022-12-06 02:31:06 -06:00

134 lines
5.0 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class UniversalGenesisStarcaller : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Starcaller Shot");
Main.projFrames[Projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 18;
Projectile.aiStyle = ProjAIStyleID.Arrow;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 600;
Projectile.extraUpdates = 1;
AIType = ProjectileID.Bullet;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.23f, 0.19f, 0.25f);
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 4f)
{
if (Main.rand.NextBool(2))
{
int idx = Dust.NewDust(Projectile.position, 1, 1, 173, 0f, 0f, 0, default, 0.5f);
Main.dust[idx].alpha = Projectile.alpha;
Main.dust[idx].velocity *= 0f;
Main.dust[idx].noGravity = true;
}
}
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.frameCounter++;
if (Projectile.frameCounter > 3)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= Main.projFrames[Projectile.type])
{
Projectile.frame = 0;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Item11 with { PitchVariance = 0.05f } , Projectile.Center);
return true;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
return false;
}
// This projectile is always fullbright.
public override Color? GetAlpha(Color lightColor) => new Color(1f, 1f, 1f, 0f);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
SpawnStars();
}
private void SpawnStars()
{
// The patron said 10 blocks, but 10 blocks is like nothing... I'm sure they won't mind.
int maxDistance = 480; // 30 blocks
bool bossFound = false;
int life = 0;
Vector2 targetVec = Projectile.Center;
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC npc = Main.npc[i];
if (bossFound && !npc.IsABoss())
continue;
if (npc.CanBeChasedBy(Projectile, false))
{
float extraDist = (npc.width / 2) + (npc.height / 2);
//Calculate distance between target and the projectile to know if it's too far or not
float targetDist = Vector2.Distance(npc.Center, Projectile.Center);
if (targetDist < (maxDistance + extraDist) && (npc.IsABoss() || npc.life > life))
{
if (npc.IsABoss())
bossFound = true;
life = npc.life;
targetVec = npc.Center;
}
}
}
var source = Projectile.GetSource_FromThis();
for (int n = 0; n < 2; n++)
{
Projectile star = CalamityUtils.ProjectileRain(source, targetVec, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType<UniversalGenesisStar>(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner);
star.ai[0] = n;
}
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
if (Main.netMode != NetmodeID.Server)
{
for (int g = 0; g < 3; g++)
{
Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f);
}
}
}
}
}