Terra Flameburster and Elemental Eruption
Reworked both weapons charge up and then fire a stream of flames I did not balance these ones so they could be fucked up majorly in either direction
This commit is contained in:
1 parent
996039ae8a
commit
09268562dc
10 files changed
+388
-104
No files matched your search
@@ -46,11 +46,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(player.Calamity().RandomDebuffVisualSpot, speed, Main.rand.NextFloat(1.2f, 1.8f), effectcolor, Main.rand.Next(8, 14)));
|
||||
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(player.Calamity().RandomDebuffVisualSpot, dustType);
|
||||
dust.scale = (dustType == 91 ? 1.4f : 1.2f);
|
||||
dust.velocity = (dustType == 247 ? Vector2.Zero : new Vector2(0, Main.rand.NextFloat(-1.5f, 4f)) - player.velocity / 2);
|
||||
dust.noGravity = Main.rand.NextBool(4) && dustType == 91 ? false : true;
|
||||
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(4f, 8f)) - player.velocity / 2;
|
||||
dust.noGravity = true;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
@@ -71,12 +71,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(npcSize, speed, Main.rand.NextFloat(1.2f, 3.1f), effectcolor, Main.rand.Next(8, 14)));
|
||||
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
|
||||
dust.scale = (dustType == 91 ? 1.4f : 1.2f);
|
||||
dust.velocity = (dustType == 247 ? Vector2.Zero : new Vector2(0, Main.rand.NextFloat(-1.5f, 4f)) - npc.velocity / 2);
|
||||
dust.noGravity = Main.rand.NextBool(4) && dustType == 91 ? false : true;
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f)) - npc.velocity / 2;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
@@ -90,11 +89,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
_ => Color.Violet,
|
||||
};
|
||||
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
|
||||
dust.scale = (dustType == 91 ? 0.9f : 1.4f);
|
||||
dust.scale = (dustType == 66 ? 0.9f : 1.4f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f));
|
||||
dust.alpha = Main.rand.Next(35, 90);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
|
||||
@@ -21,65 +21,33 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 77;
|
||||
Item.damage = 83;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 64;
|
||||
Item.height = 34;
|
||||
Item.useAnimation = Item.useTime = 30;
|
||||
Item.useAnimation = Item.useTime = 6;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 3.5f;
|
||||
Item.UseSound = SoundID.Item34;
|
||||
Item.value = CalamityGlobalItem.Rarity11BuyPrice;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<ElementalFire>();
|
||||
Item.shoot = ModContent.ProjectileType<ElementalEruptionHoldout>();
|
||||
Item.shootSpeed = 9f;
|
||||
Item.useAmmo = AmmoID.Gel;
|
||||
Item.consumeAmmoOnFirstShotOnly = true;
|
||||
Item.channel = true;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
// Left click functions as clockwork with bursts of three (adjust for rounding)
|
||||
public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 1f : 0.34f;
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
// Spawning the holdout cannot consume ammo
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Right-click: fires a small cluster of 3 sticky, non-homing flares
|
||||
if (player.altFunctionUse == 2f)
|
||||
{
|
||||
Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 48f;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
newPos += Main.rand.NextVector2Circular(24f, 24f);
|
||||
Projectile flare = Projectile.NewProjectileDirect(source, newPos, velocity, ModContent.ProjectileType<ElementalFlare>(), damage, knockback, player.whoAmI, ai2: 1f);
|
||||
flare.penetrate = -1;
|
||||
flare.usesLocalNPCImmunity = true;
|
||||
flare.localNPCHitCooldown = 30;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Left-click
|
||||
// Fires a pair of homing rainbow flares
|
||||
FlareCounter++;
|
||||
if (FlareCounter >= 3)
|
||||
{
|
||||
FlareCounter = 0;
|
||||
Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 36f;
|
||||
Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType<ElementalFlare>(), damage, knockback, player.whoAmI, velocity.Length(), -1f);
|
||||
Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType<ElementalFlare>(), damage, knockback, player.whoAmI, velocity.Length(), 1f);
|
||||
}
|
||||
|
||||
// Fires three flames, random colors and spread
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(8f));
|
||||
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI, Main.rand.NextFloat());
|
||||
}
|
||||
Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<TerraFlameburster>().
|
||||
AddIngredient<BlightSpewer>().
|
||||
AddIngredient(ItemID.LunarBar, 5).
|
||||
AddIngredient<LifeAlloy>(5).
|
||||
AddIngredient<GalacticaSingularity>(5).
|
||||
|
||||
@@ -13,51 +13,37 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
public int FlareCounter = 0;
|
||||
public int TerraUseTime = 8;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 55;
|
||||
Item.damage = 58;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 68;
|
||||
Item.height = 22;
|
||||
Item.useTime = 8;
|
||||
Item.useAnimation = 32;
|
||||
Item.useTime = TerraUseTime;
|
||||
Item.useAnimation = TerraUseTime;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 3.25f;
|
||||
Item.UseSound = SoundID.Item34;
|
||||
Item.value = CalamityGlobalItem.Rarity9BuyPrice;
|
||||
Item.rare = ItemRarityID.Yellow;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<TerraFire>();
|
||||
Item.shootSpeed = 8f;
|
||||
Item.shoot = ModContent.ProjectileType<TerraFlamebursterHoldout>();
|
||||
Item.shootSpeed = 10f;
|
||||
Item.useAmmo = AmmoID.Gel;
|
||||
Item.consumeAmmoOnFirstShotOnly = true;
|
||||
Item.channel = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
// Spawning the holdout cannot consume ammo
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Fires a pair of homing terra flares
|
||||
FlareCounter++;
|
||||
if (FlareCounter >= 4)
|
||||
{
|
||||
FlareCounter = 0;
|
||||
Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 36f;
|
||||
float randAngle = Main.rand.NextFloat(8f, 15f);
|
||||
Vector2 newVel = velocity.RotatedBy(MathHelper.ToRadians(randAngle)) * 1.5f;
|
||||
Projectile.NewProjectile(source, newPos, newVel, ModContent.ProjectileType<TerraFlare>(), damage, knockback, player.whoAmI);
|
||||
newVel = velocity.RotatedBy(MathHelper.ToRadians(-randAngle)) * 1.5f;
|
||||
Projectile.NewProjectile(source, newPos, newVel, ModContent.ProjectileType<TerraFlare>(), damage, knockback, player.whoAmI);
|
||||
}
|
||||
|
||||
// Fires two flames, green and blue, slightly randomly spread
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(6f));
|
||||
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI, i);
|
||||
}
|
||||
Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -440,9 +440,9 @@ ElementalEruption: {
|
||||
DisplayName: Elemental Eruption
|
||||
Tooltip:
|
||||
'''
|
||||
Spews rainbow flames and pairs of high-energy homing flares
|
||||
Press <right> to fire a dense cluster of sticky flares
|
||||
Charge and then spew rainbow flames and pairs of high-energy homing flares
|
||||
Uses gel for ammo
|
||||
70% chance to save ammo
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -1212,8 +1212,9 @@ TerraFlameburster: {
|
||||
DisplayName: Terra Flameburster
|
||||
Tooltip:
|
||||
'''
|
||||
Spews high-energy flames and pairs of homing flares
|
||||
Charge and then spew high-energy flames and pairs of homing flares
|
||||
Uses gel for ammo
|
||||
50% chance to save ammo
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using log4net.Core;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Mono.Cecil;
|
||||
using ReLogic.Utilities;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class ElementalEruptionHoldout : ModProjectile
|
||||
{
|
||||
// Take the name and texture from the weapon
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<ElementalEruption>();
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/ElementalEruption";
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
private ref float ShotsFired => ref Projectile.ai[1];
|
||||
private ref float ShootTimer => ref Projectile.ai[2];
|
||||
private ref int ShotDelay => ref Owner.ActiveItem().useTime; // 6
|
||||
public int ShotCooldown;
|
||||
public int FireBlobs = 0;
|
||||
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 64;
|
||||
Projectile.height = 34;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Owner.dead || ShotsFired >= 24) // destroy the holdout if the player dies or is out of shots
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
|
||||
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f;
|
||||
|
||||
// Kill if the owner stops channeling or otherwise cannot use the weapon.
|
||||
if (!OwnerCanShoot)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
var effectcolor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.DeepSkyBlue,
|
||||
1 => Color.MediumSpringGreen,
|
||||
2 => Color.DarkOrange,
|
||||
_ => Color.Violet,
|
||||
};
|
||||
|
||||
// While channeled, keep refreshing the projectile lifespan
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
ShootTimer++;
|
||||
if (ShootTimer >= 60)
|
||||
{
|
||||
if (ShotCooldown == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item34, Projectile.Center);
|
||||
Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextFloat() < 0.70f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, (Projectile.velocity * 10).RotatedByRandom(0.12f), ModContent.ProjectileType<ElementalFire>(), damage, knockback, Projectile.owner);
|
||||
}
|
||||
ShotsFired++;
|
||||
ShotCooldown = ShotDelay;
|
||||
if (FireBlobs == 0)
|
||||
{
|
||||
Vector2 newVel = (Projectile.velocity * 9);
|
||||
Vector2 newPos = tipPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 36f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType<ElementalFlare>(), damage, knockback, Projectile.owner, newVel.Length(), -1f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType<ElementalFlare>(), damage, knockback, Projectile.owner, newVel.Length(), 1f);
|
||||
FireBlobs = 3;
|
||||
}
|
||||
else
|
||||
FireBlobs--;
|
||||
}
|
||||
else
|
||||
ShotCooldown--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShootTimer == 1)
|
||||
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center);
|
||||
ShotsFired = 0;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
float rotMulti = Main.rand.NextFloat(0.3f, 1f);
|
||||
Dust dust = Dust.NewDustPerfect(tipPosition, dustType);
|
||||
dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.025f) - rotMulti * 0.1f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (ShootTimer * 0.025f);
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
UpdateProjectileHeldVariables(armPosition);
|
||||
ManipulatePlayerVariables();
|
||||
}
|
||||
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
float interpolant = Utils.GetLerpValue(5f, 25f, Projectile.Distance(Main.MouseWorld), true);
|
||||
Vector2 oldVelocity = Projectile.velocity;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
|
||||
}
|
||||
Projectile.Center = armPosition + Projectile.velocity * 20;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
}
|
||||
|
||||
private void ManipulatePlayerVariables()
|
||||
{
|
||||
Owner.ChangeDir(Projectile.direction);
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
|
||||
}
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -23,29 +23,64 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.penetrate = 5;
|
||||
Projectile.MaxUpdates = 4;
|
||||
Projectile.timeLeft = Lifetime; // 24 effectively
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 8;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
var effectcolor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.DeepSkyBlue,
|
||||
1 => Color.MediumSpringGreen,
|
||||
2 => Color.DarkOrange,
|
||||
_ => Color.Violet,
|
||||
};
|
||||
|
||||
Time++;
|
||||
ColorType += 0.02f;
|
||||
|
||||
// Determines particle size as well as hitbox
|
||||
if (Time >= 5f)
|
||||
if (Time >= 1f)
|
||||
Projectile.scale = 1.8f * Utils.GetLerpValue(5f, 30f, Time, true);
|
||||
else
|
||||
return; // Helps position it at the tip
|
||||
|
||||
if (Time == 1)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
float rotMulti = Main.rand.NextFloat(0.7f, 1.1f);
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType);
|
||||
dust.scale = Main.rand.NextFloat(1.8f, 2.5f) - rotMulti;
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Projectile.velocity.RotatedByRandom(0.5f * rotMulti) * Main.rand.NextFloat(0.5f, 1.8f) * rotMulti;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
}
|
||||
|
||||
if (Time > 9)
|
||||
{
|
||||
float dustArea = Main.rand.NextFloat(0.1f, 1.7f);
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9) + Projectile.velocity * Main.rand.NextFloat(-1.8f, 1.8f), dustType);
|
||||
dust.scale = (1.8f - dustArea) * 0.65f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity = new Vector2(4, 4).RotatedByRandom(100) * dustArea;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
|
||||
// Rainbow smokes of increasing opacity
|
||||
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
|
||||
float hue = 0.5f * (ColorType % 1f) + 0.5f * Utils.GetLerpValue(30f, Lifetime, Time, true) * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f);
|
||||
Color smokeColor = Main.hslToRgb(hue, 1f, 0.8f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.3f, smokeRot, true, required: true);
|
||||
Color smokeColor = Main.hslToRgb(hue, 1f, 0.7f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.45f, smokeRot, true, required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
// Overlay the glow on top, which is on the brighter side
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
float hue = 0.5f + 0.5f * i / (float)Projectile.oldPos.Length * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f);
|
||||
Color color = Main.hslToRgb(hue, 1f, 0.6f);
|
||||
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-15f, -15f);
|
||||
Color outerColor = color;
|
||||
Color outerColor = color * 2f;
|
||||
Color innerColor = Color.Lerp(color, Color.White, 0.2f) * 0.5f;
|
||||
float intensity = 0.9f + 0.15f * MathF.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi);
|
||||
|
||||
|
||||
@@ -22,19 +22,33 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.MaxUpdates = 4;
|
||||
Projectile.penetrate = 4;
|
||||
Projectile.MaxUpdates = 5;
|
||||
Projectile.timeLeft = Lifetime; // 24 effectively
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 8;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Time++;
|
||||
|
||||
if (Time == 1)
|
||||
{
|
||||
MediumMistParticle smoke2 = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 1f).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.2f, 2.1f), Color.Lime, Color.Turquoise, Main.rand.NextFloat(0.8f, 1.9f), 180, Main.rand.NextFloat(-3f, 3f));
|
||||
GeneralParticleHandler.SpawnParticle(smoke2);
|
||||
MediumMistParticle smoke3 = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 2).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.2f, 2.1f), Color.Lime, Color.Turquoise, Main.rand.NextFloat(0.4f, 1.1f), 180, Main.rand.NextFloat(-3f, 3f));
|
||||
GeneralParticleHandler.SpawnParticle(smoke3);
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 135 : 107);
|
||||
dust2.noGravity = true;
|
||||
dust2.velocity = Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.3f, 2.9f);
|
||||
dust2.scale = Main.rand.NextFloat(1.3f, 2.1f);
|
||||
}
|
||||
}
|
||||
// Determines particle size as well as hitbox
|
||||
if (Time >= 6f)
|
||||
if (Time >= 1f)
|
||||
Projectile.scale = 1.8f * Utils.GetLerpValue(6f, 30f, Time, true);
|
||||
else
|
||||
return; // Helps position it at the tip
|
||||
@@ -42,9 +56,21 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// Main smokes shifting between green to green-blue and back
|
||||
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
|
||||
float colorValue = CalamityUtils.Convert01To010(Utils.GetLerpValue(30f, Lifetime, Time, true));
|
||||
Color smokeColor = BlueFire ? Color.Lerp(Color.Cyan, Color.Aquamarine, colorValue) : Color.Lerp(Color.Lime, Color.SpringGreen, colorValue);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.3f, smokeRot, true, required: true);
|
||||
Color smokeColor = Color.Lerp(Color.Lime, Color.Turquoise, colorValue);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 18, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.4f, smokeRot, true, required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
if (Time > 4)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float dustArea = Main.rand.NextFloat(0.1f, 1.7f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9) + Projectile.velocity * Main.rand.NextFloat(-1.8f, 1.8f), Main.rand.NextBool(5) ? 135 : 107);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = new Vector2(6, 6).RotatedByRandom(100) * dustArea;
|
||||
dust.scale = (1.8f - dustArea) * 0.65f;
|
||||
}
|
||||
}
|
||||
|
||||
// Overlay a gold glow on top
|
||||
if (Main.rand.NextBool(5))
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using log4net.Core;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Mono.Cecil;
|
||||
using ReLogic.Utilities;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class TerraFlamebursterHoldout : ModProjectile
|
||||
{
|
||||
// Take the name and texture from the weapon
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<TerraFlameburster>();
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/TerraFlameburster";
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
private ref float ShotsFired => ref Projectile.ai[1];
|
||||
private ref float ShootTimer => ref Projectile.ai[2];
|
||||
private ref int ShotDelay => ref Owner.ActiveItem().useTime; // 8
|
||||
public int ShotCooldown;
|
||||
public int FireBlobs = 0;
|
||||
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 68;
|
||||
Projectile.height = 26;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Owner.dead || ShotsFired >= 16) // destroy the holdout if the player dies or is out of shots
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
|
||||
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f;
|
||||
|
||||
// Kill if the owner stops channeling or otherwise cannot use the weapon.
|
||||
if (!OwnerCanShoot)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
// While channeled, keep refreshing the projectile lifespan
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
ShootTimer++;
|
||||
if (ShootTimer >= 60)
|
||||
{
|
||||
if (ShotCooldown == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item34, Projectile.Center);
|
||||
Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextBool(2) ? true : false);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, (Projectile.velocity * 9).RotatedByRandom(0.08f), ModContent.ProjectileType<TerraFire>(), damage, knockback, Projectile.owner);
|
||||
ShotsFired++;
|
||||
ShotCooldown = ShotDelay;
|
||||
if (FireBlobs == 0)
|
||||
{
|
||||
float randAngle = Main.rand.NextFloat(8f, 15f);
|
||||
Vector2 newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(randAngle)) * 2f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, newVel, ModContent.ProjectileType<TerraFlare>(), damage, knockback, Projectile.owner);
|
||||
newVel = (Projectile.velocity * 9).RotatedBy(MathHelper.ToRadians(-randAngle)) * 2f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, newVel, ModContent.ProjectileType<TerraFlare>(), damage, knockback, Projectile.owner);
|
||||
FireBlobs = 3;
|
||||
}
|
||||
else
|
||||
FireBlobs--;
|
||||
}
|
||||
else
|
||||
ShotCooldown--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShootTimer == 1)
|
||||
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center);
|
||||
ShotsFired = 0;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float rotMulti = Main.rand.NextFloat(0.3f, 1f);
|
||||
Dust dust2 = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(5) ? 135 : 107);
|
||||
dust2.noGravity = true;
|
||||
dust2.velocity = new Vector2(0, -2).RotatedByRandom(rotMulti * 0.3f) * (Main.rand.NextFloat(1f, 2.9f) - rotMulti);
|
||||
dust2.scale = Main.rand.NextFloat(1.2f, 1.8f) * (ShootTimer * 0.015f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
UpdateProjectileHeldVariables(armPosition);
|
||||
ManipulatePlayerVariables();
|
||||
}
|
||||
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
float interpolant = Utils.GetLerpValue(5f, 25f, Projectile.Distance(Main.MouseWorld), true);
|
||||
Vector2 oldVelocity = Projectile.velocity;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
|
||||
}
|
||||
Projectile.Center = armPosition + Projectile.velocity * 20;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
}
|
||||
|
||||
private void ManipulatePlayerVariables()
|
||||
{
|
||||
Owner.ChangeDir(Projectile.direction);
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
|
||||
}
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -29,18 +29,19 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.MaxUpdates = 2;
|
||||
Projectile.timeLeft = 90 * Projectile.MaxUpdates;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI() => CalamityUtils.HomeInOnNPC(Projectile, false, 640f, 15f, 20f);
|
||||
public override void AI() => CalamityUtils.HomeInOnNPC(Projectile, true, 640f, 15f, 20f);
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
// Circular spread of clouds
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
|
||||
Color smokeColor = Main.rand.NextBool() ? Color.Lime : Color.Cyan;
|
||||
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f);
|
||||
Vector2 smokeVel = Main.rand.NextVector2Circular(8f, 8f);
|
||||
Color smokeColor = Main.rand.NextBool() ? Color.Lime : Color.Turquoise;
|
||||
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.4f, 0.8f), 200 - Main.rand.Next(60), 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
for (int i = 0; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
float colorInterpolation = MathF.Cos(Projectile.timeLeft / 16f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f;
|
||||
Color color = Color.Lerp(Color.Lime, Color.Cyan, colorInterpolation);
|
||||
Color color = Color.Lerp(Color.Lime, Color.Turquoise, colorInterpolation);
|
||||
Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-15f, -15f);
|
||||
Color outerColor = color;
|
||||
Color innerColor = Color.Lerp(color, Color.Gold, 0.8f) * 0.5f;
|
||||
|
||||
Reference in new issue
Block a user