Elemental Eruption line part 1

This commit is contained in:
Altixal committed 2023-10-14 18:35:44 +07:00
1 parent b3c4c9fc03
commit e7cc3f71db
12 files changed
+186 -371

No files matched your search

+7 -10
View File
@@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.DamageType = DamageClass.Ranged;
Item.width = 64;
Item.height = 34;
Item.useTime = 14;
Item.useAnimation = 14;
Item.useTime = 12;
Item.useAnimation = 36;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 3.5f;
@@ -29,24 +29,21 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.shoot = ModContent.ProjectileType<ElementalFire>();
Item.shootSpeed = 10f;
Item.useAmmo = AmmoID.Gel;
Item.consumeAmmoOnFirstShotOnly = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
int numFirestreams = Main.rand.Next(3, 5);
for (int index = 0; index < numFirestreams; ++index)
for (int i = 0; i < 2; i++)
{
float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f;
float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f);
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(8f));
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI);
}
return false;
return true; // Fires one directly with no randomness, totaling 3 projectiles
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.9f;
public override void AddRecipes()
{
CreateRecipe().
+9 -17
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public class Meowthrower : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
private bool Fire2 = false;
public override void SetDefaults()
{
Item.damage = 37;
@@ -27,29 +27,21 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.rare = ItemRarityID.LightRed;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<MeowFire>();
Item.shootSpeed = 5.5f;
Item.shootSpeed = 8f;
Item.useAmmo = AmmoID.Gel;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 85)
return false;
return true;
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 85;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f;
float SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f;
int projType = Fire2 ? ModContent.ProjectileType<MeowFire2>() : type;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projType, damage, knockback, player.whoAmI, 0.0f, 0.0f);
Fire2 = !Fire2;
for (int i = 0; i < 2; i++)
{
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(8f));
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI, i);
}
return false;
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.DamageType = DamageClass.Ranged;
Item.width = 76;
Item.height = 30;
Item.useTime = 6;
Item.useTime = 10;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
+6 -15
View File
@@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.DamageType = DamageClass.Ranged;
Item.width = 68;
Item.height = 22;
Item.useTime = 3;
Item.useAnimation = 15;
Item.useTime = 6;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 3.25f;
@@ -25,22 +25,13 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.value = CalamityGlobalItem.Rarity9BuyPrice;
Item.rare = ItemRarityID.Yellow;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<TerraFireGreen>();
Item.shootSpeed = 7.5f;
Item.shoot = ModContent.ProjectileType<TerraFire>();
Item.shootSpeed = 8f;
Item.useAmmo = AmmoID.Gel;
Item.consumeAmmoOnFirstShotOnly = true;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
}
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 80)
return false;
return true;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override void AddRecipes()
{
@@ -1185,11 +1185,7 @@ TelluricGlare: {
TerraFlameburster: {
DisplayName: Terra Flameburster
Tooltip:
'''
Uses gel for ammo
80% chance to save ammo
'''
Tooltip: Uses gel for ammo
}
TheBallista: {
@@ -119,7 +119,6 @@ MagnomalyRocket.DisplayName: Nuke
MarksmanShot.DisplayName: Marksman Shot
MechanicalBarracuda.DisplayName: Barracuda
MeowFire.DisplayName: Purr Fire
MeowFire2.DisplayName: Purr Fire
MiniatureFolly.DisplayName: Miniature Folly
MiniRocket.DisplayName: Rocket
MiniSharkron.DisplayName: Mini Sharkron
@@ -213,7 +212,7 @@ TerraArrowMain.DisplayName: Terra Arrow
TerraArrowSplit.DisplayName: Terra Arrow
TerraBulletMain.DisplayName: Terra Bullet
TerraBulletSplit.DisplayName: Terra Bullet
TerraFireGreen.DisplayName: Terra Fire
TerraFire.DisplayName: Terra Fire
TheMaelstromExplosion.DisplayName: Reaper Explosion
TheMaelstromShark.DisplayName: Reaper Shark
ThePackMinissile.DisplayName: Pack Minissile
+42 -48
View File
@@ -1,8 +1,11 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ElementalFire : ModProjectile, ILocalizedModType
@@ -10,6 +13,9 @@ namespace CalamityMod.Projectiles.Ranged
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static int Lifetime => 120;
public ref float Time => ref Projectile.ai[0];
public override void SetDefaults()
{
Projectile.width = 12;
@@ -18,66 +24,54 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 2;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 90;
Projectile.MaxUpdates = 4;
Projectile.timeLeft = Lifetime; // 30 effectively
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 9;
Projectile.localNPCHitCooldown = 12;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.15f, 0.45f, 0f);
if (Projectile.ai[0] > 7f)
{
float num296 = 1f;
if (Projectile.ai[0] == 8f)
{
num296 = 0.25f;
}
else if (Projectile.ai[0] == 9f)
{
num296 = 0.5f;
}
else if (Projectile.ai[0] == 10f)
{
num296 = 0.75f;
}
Projectile.ai[0] += 1f;
int num297 = 66;
if (Main.rand.NextBool())
{
for (int num298 = 0; num298 < 2; num298++)
{
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(3))
{
dust.noGravity = true;
dust.scale *= 1.75f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.noGravity = true;
dust.scale *= 0.5f;
}
dust.velocity.X *= 1.2f;
dust.velocity.Y *= 1.2f;
dust.scale *= num296;
dust.velocity += Projectile.velocity;
}
}
}
Time++;
// Determines particle size as well as hitbox
if (Time >= 5f)
Projectile.scale = 1.8f * Utils.GetLerpValue(5f, 30f, Time, true);
else
return; // Helps position it at the tip
// Rainbow smokes of increasing opacity
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
Color smokeColor = Color.Lerp(Color.Transparent, Main.DiscoColor, 0.6f + 0.4f * Utils.GetLerpValue(30f, Lifetime, Time, true));
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.8f, smokeRot, required: true);
GeneralParticleHandler.SpawnParticle(smoke);
// Overlay the glow on top, which is on the brighter side
if (Main.rand.NextBool(5))
{
Projectile.ai[0] += 1f;
Color glowColor = Color.Lerp(smokeColor, Color.White, 0.3f);
glowColor.A = smokeColor.A;
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true);
GeneralParticleHandler.SpawnParticle(smokeGlow);
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
Lighting.AddLight(Projectile.Center, smokeColor.ToVector3() * Projectile.scale * Utils.Remap(Time, 30f, Lifetime, 0.5f, 0.6f));
}
// Circular hitbox adjusted for the size of the smoke particles (which is 52 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<ElementalMix>(), 540);
// Circular spread of clouds on hit
for (int i = 0; i < 12; i++)
{
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, Main.DiscoColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
}
}
+43 -73
View File
@@ -1,8 +1,10 @@
using Microsoft.Xna.Framework;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
@@ -11,96 +13,64 @@ namespace CalamityMod.Projectiles.Ranged
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static int Lifetime => 96;
public bool PinkFire => Projectile.ai[0] == 1f;
public ref float Time => ref Projectile.ai[1];
public override void SetDefaults()
{
Projectile.width = 6;
Projectile.height = 6;
Projectile.width = Projectile.height = 6;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 5;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 95;
Projectile.MaxUpdates = 3;
Projectile.timeLeft = Lifetime;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
Projectile.idStaticNPCHitCooldown = 8;
}
public override void AI()
{
if (Projectile.ai[0] > 7f)
{
float dustScale = 1f;
if (Projectile.ai[0] == 8f)
{
dustScale = 0.25f;
}
else if (Projectile.ai[0] == 9f)
{
dustScale = 0.5f;
}
else if (Projectile.ai[0] == 10f)
{
dustScale = 0.75f;
}
Projectile.ai[0] += 1f;
for (int i = 0; i < 2; i++)
{
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(3))
{
dust.noGravity = true;
dust.scale *= 1.75f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.scale *= 0.5f;
}
dust.velocity.X *= 1.2f;
dust.velocity.Y *= 1.2f;
dust.scale *= dustScale;
dust.velocity += Projectile.velocity;
if (!dust.noGravity)
{
dust.velocity *= 0.5f;
}
}
}
Time++;
// Determines particle size as well as hitbox
if (Time >= 6f)
Projectile.scale = 1.5f * Utils.GetLerpValue(6f, 30f, Time, true);
else
return; // Helps position it at the tip
// Main smokes composing of blue or pink
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.4f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f));
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.8f, smokeRot, required: true);
GeneralParticleHandler.SpawnParticle(smoke);
// Overlay the glow on top, a bit brighter
if (Main.rand.NextBool(5))
{
Projectile.ai[0] += 1f;
Color glowColor = Color.Lerp(smokeColor, Color.White, 0.4f);
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true);
GeneralParticleHandler.SpawnParticle(smokeGlow);
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
Lighting.AddLight(Projectile.Center, smokeColor.ToVector3() * Projectile.scale * 0.5f);
}
// Circular hitbox adjusted for the size of the smoke particles (which is 52 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(SoundID.Item57, Projectile.position);
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 10;
Projectile.height = 10;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
for (int j = 0; j < 10; j++)
SoundEngine.PlaySound(PinkFire ? SoundID.Item58 : SoundID.Item57, Projectile.Center);
// Circular spread of clouds on hit
for (int i = 0; i < 12; i++)
{
int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int k = 0; k < 20; k++)
{
int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
Color smokeColor = PinkFire ? Color.Pink : Color.PowderBlue;
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
}
-107
View File
@@ -1,107 +0,0 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class MeowFire2 : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 6;
Projectile.height = 6;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 5;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 95;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override void AI()
{
if (Projectile.ai[0] > 7f)
{
float dustScale = 1f;
if (Projectile.ai[0] == 8f)
{
dustScale = 0.25f;
}
else if (Projectile.ai[0] == 9f)
{
dustScale = 0.5f;
}
else if (Projectile.ai[0] == 10f)
{
dustScale = 0.75f;
}
Projectile.ai[0] += 1f;
for (int i = 0; i < 2; i++)
{
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(3))
{
dust.noGravity = true;
dust.scale *= 1.75f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.scale *= 0.5f;
}
dust.velocity.X *= 1.2f;
dust.velocity.Y *= 1.2f;
dust.scale *= dustScale;
dust.velocity += Projectile.velocity;
if (!dust.noGravity)
{
dust.velocity *= 0.5f;
}
}
}
else
{
Projectile.ai[0] += 1f;
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(SoundID.Item58, Projectile.position);
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 10;
Projectile.height = 10;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
for (int j = 0; j < 10; j++)
{
int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int k = 0; k < 20; k++)
{
int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
}
}
}
}
+3 -3
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged
GeneralParticleHandler.SpawnParticle(smoke);
// Overlay the glow on top, which is on the brighter side
if (Main.rand.NextBool(3))
if (Main.rand.NextBool(5))
{
Color glowColor = Color.Lerp(smokeColor, Color.MidnightBlue, 0.25f);
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 15, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true);
@@ -54,8 +54,8 @@ namespace CalamityMod.Projectiles.Ranged
}
}
// Circular hitbox adjusted for the size of the smoke particles (which is 48 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 48 * Projectile.scale * 0.5f, targetHitbox);
// Circular hitbox adjusted for the size of the smoke particles (which is 52 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<BrainRot>(), 300);
}
+73
View File
@@ -0,0 +1,73 @@
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class TerraFire : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static int Lifetime => 120;
public ref float Time => ref Projectile.ai[0];
public override void SetDefaults()
{
Projectile.width = Projectile.height = 12;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.MaxUpdates = 4;
Projectile.timeLeft = Lifetime; // 30 effectively
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 6;
}
public override void AI()
{
Time++;
// Determines particle size as well as hitbox
if (Time >= 6f)
Projectile.scale = 1.8f * Utils.GetLerpValue(6f, 30f, Time, true);
else
return; // Helps position it at the tip
// Main smokes shifting between green to green-blue and back
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
Color smokeColor = Color.Lerp(Color.SpringGreen, Color.Aquamarine, CalamityUtils.Convert01To010(Utils.GetLerpValue(30f, Lifetime, Time, true)));
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.8f, smokeRot, required: true);
GeneralParticleHandler.SpawnParticle(smoke);
// Overlay the glow on top, shifted toward yellow
if (Main.rand.NextBool(5))
{
Color glowColor = Color.Lerp(smokeColor, Color.GreenYellow, 0.75f);
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true);
GeneralParticleHandler.SpawnParticle(smokeGlow);
}
Lighting.AddLight(Projectile.Center, smokeColor.ToVector3() * Projectile.scale * 0.5f);
}
// Circular hitbox adjusted for the size of the smoke particles (which is 52 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
// Circular spread of clouds on hit
for (int i = 0; i < 12; i++)
{
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
Color smokeColor = Color.Lerp(Color.SpringGreen, Color.Aquamarine, CalamityUtils.Convert01To010(Utils.GetLerpValue(30f, Lifetime, Time, true))) * 0.8f;
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
}
}
-90
View File
@@ -1,90 +0,0 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class TerraFireGreen : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.extraUpdates = 3;
Projectile.timeLeft = 120;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.45f / 255f, (255 - Projectile.alpha) * 0.05f / 255f);
if (Projectile.timeLeft > 120)
{
Projectile.timeLeft = 120;
}
if (Projectile.ai[0] > 7f)
{
float num296 = 1f;
if (Projectile.ai[0] == 8f)
{
num296 = 0.25f;
}
else if (Projectile.ai[0] == 9f)
{
num296 = 0.5f;
}
else if (Projectile.ai[0] == 10f)
{
num296 = 0.75f;
}
Projectile.ai[0] += 1f;
int num297 = 107;
if (Main.rand.NextBool())
{
for (int num298 = 0; num298 < 3; num298++)
{
int num299 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, num297, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 0.75f);
Dust dust = Main.dust[num299];
if (Main.rand.NextBool(3))
{
dust.noGravity = true;
dust.scale *= 2f;
dust.velocity.X *= 2f;
dust.velocity.Y *= 2f;
}
else
{
dust.scale *= 0.75f;
}
dust.velocity.X *= 1.2f;
dust.velocity.Y *= 1.2f;
dust.scale *= num296;
dust.velocity += Projectile.velocity;
if (!dust.noGravity)
{
dust.velocity *= 0.5f;
}
}
}
}
else
{
Projectile.ai[0] += 1f;
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 5;
target.AddBuff(BuffID.CursedInferno, 90);
}
}
}