Arsenal Improvements Part 1

Part of my attempt to create a visual identity for each arsenal energy type that can be consistently applied across all items once they are reworked

This commit changes:
Taser - New left click and previous function is on right click with arsenal cooldown, vfx overhaul
Scattershot Skewer - Completely re-coded the entire thing, now has right and left click separation and can perform a skewer dash, vfx overhaul
Pulse Pistol - Completely re-coded how the orb tracking and movement works, hits twice before splitting instead of once, vfx overhaul
Pulse Rifle - Same as Pulse Pistol, vfx overhaul

Added 4 more dust types

Changed the dusts and colors used by Effects.ArsenalEffects

Fixed Plama typo
This commit is contained in:
Xyk committed 2025-03-26 20:21:27 -07:00
1 parent cc6fec63d1
commit 86025c0712
33 files changed
+1246 -736

No files matched your search

+2
View File
@@ -1914,6 +1914,8 @@ namespace CalamityMod.CalPlayer
if (arsenalCooldown > 0)
arsenalCooldown--;
if (Main.zenithWorld)
arsenalCooldown = 0;
if (killModeCooldown > 0)
killModeCooldown--;
if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0)
+7 -2
View File
@@ -2,7 +2,6 @@
using Terraria;
using Terraria.Audio;
using Terraria.Localization;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Cooldowns
{
@@ -15,7 +14,13 @@ namespace CalamityMod.Cooldowns
public override Color OutlineColor => Color.White;
public override Color CooldownStartColor => Color.Sienna;
public override Color CooldownEndColor => Color.LightSlateGray;
public override void Tick()
{
if (Main.zenithWorld)
instance.timeLeft = -1;
}
public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/ArsenalOffCooldown");
public override SoundStyle? EndSound => (Main.zenithWorld ? null : new("CalamityMod/Sounds/Item/ArsenalOffCooldown"));
}
}
+63
View File
@@ -0,0 +1,63 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class DiamondDust : ModDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
}
public override bool Update(Dust dust)
{
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale -= 0.045f;
else
{
dust.scale -= 0.03f;
dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f);
}
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
if (!dust.noLightEmittence)
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
if (dust.scale <= 0)
dust.active = false;
dust.position += dust.velocity;
dust.fadeIn++; // Fade in is used for the time strech instead
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated").Value;
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
}
return false;
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
@@ -18,7 +17,7 @@ namespace CalamityMod.Dusts
{
float fadeSpeed = (dust.fadeIn + 1);
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
dust.velocity *= 0.96f * fadeSpeed;
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale -= 0.045f * fadeSpeed;
else
+7 -8
View File
@@ -1,5 +1,4 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
@@ -16,15 +15,14 @@ namespace CalamityMod.Dusts
public override bool Update(Dust dust)
{
float fadeSpeed = (dust.fadeIn + 1);
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
dust.velocity *= 0.96f * fadeSpeed;
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale -= 0.045f * fadeSpeed;
dust.scale -= 0.045f;
else
{
dust.scale -= 0.03f * fadeSpeed;
dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed;
dust.scale -= 0.03f;
dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f);
}
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
@@ -44,7 +42,8 @@ namespace CalamityMod.Dusts
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn);
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
+1 -2
View File
@@ -1,5 +1,4 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
+63
View File
@@ -0,0 +1,63 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class UnstableDust : ModDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
dust.rotation = Main.rand.NextFloat(-5, 5);
}
public override bool Update(Dust dust)
{
float rotDir = Math.Sign(dust.rotation);
dust.rotation += 0.5f * dust.scale * rotDir;
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale -= 0.045f;
else
{
dust.scale -= 0.03f;
dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f);
}
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
if (!dust.noLightEmittence)
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
if (dust.scale <= 0)
dust.active = false;
dust.position += dust.velocity;
// dust.fadeIn is used to change the shake intensity, -2 will negate it
dust.position += Main.rand.NextVector2Circular(dust.fadeIn + 2, dust.fadeIn + 2);
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/FullStar").Value;
Vector2 squash = new Vector2(0.4f, 1);
float texScaling = 6;
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
if (!dust.noLight)
{
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
}
return false;
}
}
}
+7 -16
View File
@@ -1,14 +1,5 @@
using System;
using System.Collections.Generic;
using CalamityMod.CustomRecipes;
using CalamityMod.Dusts;
using CalamityMod.Items.Materials;
using CalamityMod.TileEntities;
using CalamityMod.Tiles.DraedonSummoner;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Effects
@@ -18,19 +9,19 @@ namespace CalamityMod.Effects
public static int ArsenalDust = 278; // Colorable firework dust, simple and effective. Most visuals use a mix of the energy respective dust and this
// Plasma
public static int ArsenalPlamaDust = ModContent.DustType<SquashDustTileTouch>();
public static Color ArsenalPlamaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.35f);
public static int ArsenalPlasmaDust = ModContent.DustType<SquashDustTileTouch>();
public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f);
// Laser
public static int ArsenalLaserDust = ModContent.DustType<SquashDust>();
public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Firebrick, 0.35f);
public static int ArsenalLaserDust = ModContent.DustType<DiamondDust>();
public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f);
// Pulse
public static int ArsenalPulseDust = ModContent.DustType<SquashDustHollow>();
public static Color ArsenalPulseColor = Color.Lerp(Color.DarkOrchid, Color.Magenta, 0.35f);
// Electric
public static int ArsenalElectricDust = ModContent.DustType<LightDust>();
public static int ArsenalElectricDust = ModContent.DustType<UnstableDust>();
public static Color ArsenalElectricColor = Color.Lerp(Color.Aqua, Color.Aquamarine, 0.35f);
// Gauss
public static int ArsenalGaussDust = ModContent.DustType<SquareDust>();
public static Color ArsenalGaussColor = Color.Lerp(Color.Yellow, Color.Goldenrod, 0.35f);
public static Color ArsenalGaussColor = Color.Lerp(Color.Yellow, Color.Goldenrod, 0.25f);
}
}
+4 -7
View File
@@ -24,9 +24,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.DamageType = DamageClass.Magic;
Item.damage = 70;
Item.knockBack = 3f;
Item.useTime = Item.useAnimation = 44;
Item.useTime = 64;
Item.useAnimation = 64;
Item.autoReuse = true;
Item.mana = 3;
Item.mana = 15;
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = PulseRifle.FireSound with { Pitch = 0.3f, Volume = 0.7f };
@@ -37,15 +38,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.shoot = ModContent.ProjectileType<PulsePistolShot>();
Item.shootSpeed = 8.2f;
modItem.UsesCharge = true;
modItem.MaxCharge = 50f;
modItem.ChargePerUse = 0.01f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile.NewProjectile(source, position + velocity * 4, velocity, ModContent.ProjectileType<PulsePistolShot>(), damage, knockback, player.whoAmI, 0f, 3f);
Projectile.NewProjectile(source, position + velocity * 4, velocity, ModContent.ProjectileType<PulsePistolShot>(), damage, knockback, player.whoAmI);
return false;
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
+31 -4
View File
@@ -42,16 +42,43 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
Item.rare = ModContent.RarityType<DarkBlue>();
modItem.UsesCharge = true;
modItem.MaxCharge = 250f;
modItem.ChargePerUse = 0.24f;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value);
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir;
float pullback = 13f;
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
if (animProgress < 0.8f)
pullback -= (5.75f) * (float)Math.Pow((0.85f - animProgress) / 0.85f, 2);
Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback;
Vector2 itemSize = new Vector2(100, 32);
Vector2 itemOrigin = new Vector2(-44, 4);
CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin);
base.UseStyle(player, heldItemFrame);
}
public override void UseItemFrame(Player player)
{
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation);
}
public override Vector2? HoldoutOffset() => new Vector2(-15, 0);
@@ -7,7 +7,6 @@ using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -18,18 +17,20 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
public class ScattershotSkewer : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
ItemID.Sets.IsRangedSpecialistWeapon[Type] = true;
}
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
Item.width = 64;
Item.height = 36;
Item.DamageType = DamageClass.Ranged;
Item.damage = 196;
Item.damage = 135;
Item.knockBack = 4f;
Item.useTime = 45;
Item.useAnimation = 35;
Item.useTime = 30;
Item.useAnimation = 30;
Item.autoReuse = true;
Item.useStyle = ItemUseStyleID.Shoot;
@@ -42,20 +43,28 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.shoot = ModContent.ProjectileType<ScattershotSkewerHoldout>();
Item.shootSpeed = 5f;
modItem.UsesCharge = true;
modItem.MaxCharge = 190f;
modItem.ChargePerUse = 0.001f; // Charge depletion is done in the holdout, but it needs a small fee to prevent usage at 0%
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true;
public override bool AltFunctionUse(Player player) => true;
public override void HoldItem(Player player)
{
if (Main.myPlayer == player.whoAmI)
player.Calamity().rightClickListener = true;
player.Calamity().mouseWorldListener = true;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow").Value);
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<ScattershotSkewerHoldout>(), damage, knockback, player.whoAmI, 0, 1);
float gunType = 0;
if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0)
gunType = 5;
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType);
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
return false;
}
+79 -11
View File
@@ -4,10 +4,10 @@ using CalamityMod.CustomRecipes;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.SunkenSea;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,6 +17,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/TaserLaunch") { Volume = 0.6f };
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
ItemID.Sets.IsRangedSpecialistWeapon[Type] = true;
}
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
@@ -25,29 +30,92 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
Item.height = 24;
Item.DamageType = DamageClass.Ranged;
Item.damage = 20;
Item.knockBack = 0f;
Item.useTime = Item.useAnimation = 28;
Item.knockBack = 7f;
Item.useTime = Item.useAnimation = 7;
Item.autoReuse = true;
Item.reuseDelay = 15;
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = Fire;
Item.noMelee = true;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.shoot = ModContent.ProjectileType<TaserHook>();
Item.shoot = ModContent.ProjectileType<TaserShot>();
Item.shootSpeed = 6f;
}
public override float UseSpeedMultiplier(Player player)
{
if (player.altFunctionUse == 2)
return 0.3f;
modItem.UsesCharge = true;
modItem.MaxCharge = 50f;
modItem.ChargePerUse = 0.05f;
return 1f;
}
public override bool CanUseItem(Player player) => (player.altFunctionUse == 2 && player.ownedProjectileCounts[ModContent.ProjectileType<TaserHook>()] <= 0) || player.altFunctionUse == 0;
public override bool AltFunctionUse(Player player) => true;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.altFunctionUse == 2 && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0)
{
SoundEngine.PlaySound(Fire with { Pitch = -0.1f }, position);
Projectile hook = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType<TaserHook>(), (int)(damage * 1.2f), 0, player.whoAmI);
return false;
}
if (player.altFunctionUse == 0)
{
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall");
SoundEngine.PlaySound(fire with { Pitch = Main.rand.NextFloat(0.5f, 0.65f), Volume = 0.2f, MaxInstances = -1 }, position);
Projectile shot = Projectile.NewProjectileDirect(source, position + velocity - Vector2.UnitY * 5, (velocity * 1.5f).RotatedByRandom(0.15f), type, damage, 0, player.whoAmI);
return false;
}
return false;
}
public override void HoldItem(Player player)
{
if (Main.myPlayer == player.whoAmI)
player.Calamity().rightClickListener = true;
player.Calamity().mouseWorldListener = true;
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
if (player.altFunctionUse == 0)
{
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir;
float pullback = 7f;
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
if (animProgress < 0.4f)
pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2);
Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback;
Vector2 itemSize = new Vector2(42, 24);
Vector2 itemOrigin = new Vector2(-24, 4);
CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin);
base.UseStyle(player, heldItemFrame);
}
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override void UseItemFrame(Player player)
{
if (player.altFunctionUse == 0)
{
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
public override Vector2? HoldoutOffset() => new Vector2(5f, 0f);
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
if (animProgress < 0.4f)
rotation += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction;
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation);
}
}
public override Vector2? HoldoutOffset() => new Vector2(0f, 0f);
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1);
public override void AddRecipes()
{
@@ -64,9 +64,9 @@ HolofiberImmolator: {
Tooltip:
'''
Fires three gravity-affected plasma drops which dissolve through foes
Holding <left> quickly charges the bow, firing a homing plasma arrow
Holding <left> quickly charges the bow, firing a high-speed plasma arrow
Plasma arrows will detonate after impact, creating stronger explosions if stuck into tiles
Holding <right> will repeatedly fire uncharged shots
Holding <right> while firing will repeatedly fire uncharged shots
[c/1FFBFF:'The elegance of holofibre is unmatched.]
[c/1FFBFF:However, mechanical tension may have produced more consistent results.']
'''
@@ -142,8 +142,8 @@ PulsePistol: {
Tooltip:
'''
Fires a pulse orb that tracks nearby targets
After hitting an enemy, the pulse orb will split in two
Pulse orb pierce will not decrease when killing enemies
After hitting an enemy twice, the pulse orb will split in two
Pulse orb pierce will increase when killing enemies
'''
}
@@ -174,9 +174,9 @@ ScattershotSkewer: {
Tooltip:
'''
Fires a spread of lasers
Holding <left> charges the weapon, allowing it to thrust forward and impale enemies with an energy spear
Holding <right> charges the weapon, allowing it to thrust forward and impale enemies with an energy spear
Holding <left> when firing the charge attack will launch you forward at high speeds and deal extra damage
Using the charged attack has a short cooldown
Holding <right> will repeatedly fire uncharged shots
[c/1FFBFF:'There was much call from Yharim's forces for close range armaments.]
[c/1FFBFF:A laser lance with which to gore their foes was met with thunderous applause.']
'''
@@ -217,8 +217,10 @@ Taser: {
DisplayName: Taser
Tooltip:
'''
Shoots a hook that attaches to enemies and rapidly electrocutes them before returning
After electrocuting an enemy enough, the hook will create a large electric burst on it
Press <left> to rapidly fire stunning bolts with high knockback
Press <right> to shoot a hook that attaches to enemies and rapidly electrocutes them
After electrocuting an enemy enough, the hook will create a shock explosion before returning to you
Successful hook attacks have a short cooldown that is applied unless the hook kills an enemy
'''
}
@@ -262,3 +262,4 @@ LeviatitanMeteor.DisplayName: Leviatitan Meteor
LeviatitanExplosion.DisplayName: Leviatitan Explosion
SulphuricDrop.DisplayName: Sulphuric Drop
AcidRocket.DisplayName: Acid Rocket
TaserShot.DisplayName: Taser Shot
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -78,9 +78,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
for (int i = 0; i <= 25; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlamaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f));
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlasmaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
CurrentChargingFrames = 0;
}
@@ -99,9 +99,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
}
for (int i = 0; i <= 4; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlamaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.3f));
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlasmaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.3f));
dust.noGravity = false;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
dust.fadeIn = 2;
}
CurrentChargingFrames = 0;
@@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
float particleScale = Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true);
float strength = particleScale;
Vector3 DustLight = Effects.ArsenalEffects.ArsenalPlamaColor.ToVector3();
Vector3 DustLight = Effects.ArsenalEffects.ArsenalPlasmaColor.ToVector3();
Lighting.AddLight(GunTipPosition, DustLight * strength);
}
@@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
chargefull.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4f + Owner.velocity * 0.5f;
chargefull.scale = Main.rand.NextFloat(0.6f, 0.8f);
chargefull.noGravity = false;
chargefull.color = Effects.ArsenalEffects.ArsenalPlamaColor;
chargefull.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorChargeLoop");
ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center);
@@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
chargefull.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(5, 9);
chargefull.scale = Main.rand.NextFloat(0.2f, 0.4f);
chargefull.noGravity = true;
chargefull.color = Effects.ArsenalEffects.ArsenalPlamaColor;
chargefull.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
}
@@ -184,10 +184,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (CurrentChargingFrames > 0 && downtime == 0)
{
float randSize = Main.rand.NextFloat(0.8f, 1.2f);
Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.15f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite);
Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite);
}
return false;
}
+16 -16
View File
@@ -87,23 +87,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
if (Main.rand.NextBool(3) && canStick)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity);
dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f);
dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
if (targetDist < 1400f)
{
Particle spark = new SparkParticle(Projectile.Center, -Projectile.velocity, false, 13, 1.3f, Effects.ArsenalEffects.ArsenalPlamaColor * 0.7f);
Particle spark = new SparkParticle(Projectile.Center, -Projectile.velocity, false, 13, 1.3f, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.7f);
GeneralParticleHandler.SpawnParticle(spark);
if (Main.rand.NextBool(6))
{
Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(12, 12);
float speed = Main.rand.NextFloat(0.2f, 0.7f);
Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlamaColor);
Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlasmaColor);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
@@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (Main.rand.NextBool(8))
{
float speed = Main.rand.NextFloat(0.2f, 1.5f);
Particle spark = new SparkParticle(Projectile.Center, -storedVelocity * speed, false, 23, 0.7f * speed, Effects.ArsenalEffects.ArsenalPlamaColor * 0.7f);
Particle spark = new SparkParticle(Projectile.Center, -storedVelocity * speed, false, 23, 0.7f * speed, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.7f);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Main.rand.NextBool())
@@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f);
dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
}
time++;
@@ -185,12 +185,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.velocity = Vector2.Zero;
for (int i = 0; i < 12; i++)
{
int dustStyle = Effects.ArsenalEffects.ArsenalPlamaDust;
int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust;
Dust dust = Dust.NewDustPerfect(Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 38 + Main.rand.NextVector2Circular(12, 12), dustStyle, Projectile.velocity);
dust.scale = Main.rand.NextFloat(0.7f, 1.3f);
dust.velocity = storedVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.4f, 1.5f);
dust.noGravity = false;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
dust.fadeIn = 1.5f;
}
SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorPreExplode");
@@ -204,20 +204,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
float explosionDamage = (stuckInGround ? 2.3f : 0.5f);
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ImmolationBurst>(), (int)(Projectile.damage * explosionDamage), Projectile.knockBack * 2, Projectile.owner, 0, stuckInGround ? 1 : 0);
blast.scale = (stuckInGround ? 2 : 1);
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlamaColor * 0.75f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.2f * bonus, 26);
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.2f * bonus, 26);
GeneralParticleHandler.SpawnParticle(bolt2);
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlamaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * bonus, 16);
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * bonus, 16);
GeneralParticleHandler.SpawnParticle(bolt3);
for (int i = 0; i < (int)(15 * bonus); i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : stuckInGround ? ModContent.DustType<SquashDust>() : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : stuckInGround ? ModContent.DustType<SquashDust>() : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity);
dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.9f, 1.8f);
dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer);
dust.noGravity = false;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
if (dust.type == Effects.ArsenalEffects.ArsenalPlamaDust)
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
if (dust.type == Effects.ArsenalEffects.ArsenalPlasmaDust)
dust.fadeIn = 2f;
}
@@ -233,17 +233,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/ImmolationArrow");
if (!stuckInGround && !stuckInTarget && false)
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 }, 1, tex.Value);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 }, 1, tex.Value);
float randSize = Main.rand.NextFloat(0.8f, 1.1f);
for (int i = 0; i < 20; i++)
{
Vector2 scale = Projectile.scale * new Vector2(0.5f, 1) * 1.5f * randSize;
Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 3;
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.2f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.2f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None);
}
Vector2 scale2 = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize;
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale2, SpriteEffects.None);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale2, SpriteEffects.None);
if (stuckInTarget || stuckInGround)
{
Vector2 scale = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize;
@@ -46,14 +46,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(8, 8);
float speed = Main.rand.NextFloat(0.2f, 0.7f);
Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlamaColor);
Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlasmaColor);
GeneralParticleHandler.SpawnParticle(spark);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlasmaDust, -Projectile.velocity);
dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.2f, 0.5f) : Main.rand.NextFloat(0.4f, 1.1f);
dust.velocity = (new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
}
}
time++;
@@ -74,13 +74,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (targetDist < 1400)
{
Vector2 vel = oldVelocity.SafeNormalize(Vector2.UnitX);
int dustStyle = Effects.ArsenalEffects.ArsenalPlamaDust;
int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust;
for (int i = 0; i < 6; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 5, dustStyle, (-vel * Main.rand.NextFloat(5, 8)).RotatedByRandom(0.7f));
dust.scale = Main.rand.NextFloat(0.7f, 1.3f);
dust.noGravity = false;
dust.color = Effects.ArsenalEffects.ArsenalPlamaColor;
dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor;
dust.fadeIn = 1.2f;
}
}
@@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
float squash = Utils.GetLerpValue(-3, 10, Projectile.velocity.Length(), true);
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.6f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, squash) * 0.045f * (i == 0 ? 0.6f : 1), SpriteEffects.None);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * 0.6f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, squash) * 0.045f * (i == 0 ? 0.6f : 1), SpriteEffects.None);
return false;
}
}
+140 -145
View File
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -13,13 +15,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
public new string LocalizationCategory => "Projectiles.Misc";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private Color mainColor = Color.Orchid;
private bool doDamage = false;
private NPC closestTarget = null;
private NPC lastTarget = null;
private float distance;
private int timesItCanHit = 1;
public ref float time => ref Projectile.ai[0];
public bool onSpawn = true;
private NPC targeted = null;
private NPC lastHitTarget = null;
private int timesItCanHit = 2;
public bool startAttackEffects = true;
public int attackTime = 160; // The amount of time an orb spends slowing before it attacks
public override void SetDefaults()
{
Projectile.width = 16;
@@ -27,8 +29,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = -1;
Projectile.extraUpdates = 1;
Projectile.timeLeft = 1240;
Projectile.extraUpdates = 5;
Projectile.timeLeft = 600;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 20;
@@ -36,186 +38,179 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public override void AI()
{
// If it's hit targeted enemies enough, kill it
if (timesItCanHit <= 0)
{
if (Projectile.ai[1] < 5)
{
Projectile uwa = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedBy(0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, 5);
Projectile uwaAgain = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedBy(-0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, 5);
uwa.penetrate = 1;
uwaAgain.penetrate = 1;
}
Projectile.Kill();
return;
}
Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f);
Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseColor.ToVector3() * 0.5f);
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
Projectile.rotation = Projectile.velocity.ToRotation();
float createDustVar = 10f;
if (Projectile.localAI[0] == 0)
if (onSpawn)
{
if (Projectile.ai[1] == 1)
if (Projectile.ai[1] == 0)
SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = 1.7f, Pitch = 0.3f }, Projectile.Center);
}
if (targetDist < 1400f)
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
if (targetDist < 1400f && Main.rand.NextBool())
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.localAI[0] > 90)
{
// Velocity must look like it has stoped, but can't actually be zero otherwise homing code doesn't work
if (Projectile.localAI[0] == 91)
Projectile.velocity *= 0.001f;
// When they begin the homing after a hit of spawning, do a few visuals
if (Projectile.localAI[0] == 120)
for (int i = 0; i <= 8; i++)
{
distance = 3000;
SoundStyle fire = new("CalamityMod/Sounds/Item/PulseSound");
SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center);
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, mainColor, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0f, 0.5f, 15);
GeneralParticleHandler.SpawnParticle(pulse);
for (int k = 0; k < 6; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 66);
dust.scale = Main.rand.NextFloat(0.6f, 1.1f);
dust.velocity = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust);
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(5f, 7f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 1;
}
// Homing code
if (Projectile.localAI[0] > 120)
for (int i = 0; i <= 6; i++)
{
// Do damage if it's near its target otherwise don't, this is to prevent excessive hits as orbs rail through worm bosses and such
if (closestTarget is not null)
doDamage = Vector2.Distance(Projectile.Center, closestTarget.Center) < 10;
else
doDamage = false;
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDust>());
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(7f, 9f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 0.3f;
}
// Tracking code, originally was going to try only tracking the closest target not including the last target you hit, but I couldn't make it work
// Eventually I settled on how it works now and it seems to home consistently so I'm happy enough there
float projectileSpeed = 9.5f;
if (closestTarget is not null && closestTarget.active)
{
float targetDirectionRotation = Projectile.SafeDirectionTo(closestTarget.Center).ToRotation();
float turningRate = 10f + Projectile.localAI[0] * 0.00008f;
Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed;
}
else
{
Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed;
Projectile.velocity *= 0.999f;
}
if (closestTarget is not null && Vector2.Distance(Projectile.Center, closestTarget.Center) < 10)
{
closestTarget = null;
distance = 3000;
}
onSpawn = false;
}
// Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects
Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.3f);
if (time >= attackTime) // home in on enemy
{
// Find a target
if (targeted == null)
{
Projectile.velocity *= 0.9f;
startAttackEffects = true;
NPC chosenTarget = null;
float distance = 2500;
for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits.
{
// Actual homing movement
NPC searchedTarget = Main.npc[index];
if (searchedTarget.CanBeChasedBy(null, false))
{
if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && (lastHitTarget != null ? searchedTarget != lastHitTarget : true) && searchedTarget.active && searchedTarget.life > 0)
{
distance = Vector2.Distance(Projectile.Center, searchedTarget.Center);
chosenTarget = searchedTarget;
}
}
}
if (chosenTarget == null) // If no target was found, check again but accept last hit targets as viable.
{
if (lastHitTarget != null)
Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0;
for (int index = 0; index < Main.npc.Length; index++)
{
if (Main.npc[index].CanBeChasedBy(null, false) || Main.npc[index] == lastTarget)
NPC searchedTarget = Main.npc[index];
if (searchedTarget.CanBeChasedBy(null, false))
{
float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2);
if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < (distance + extraDistance))
if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && searchedTarget.active && searchedTarget.life > 0)
{
closestTarget = Main.npc[index];
distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center);
distance = Vector2.Distance(Projectile.Center, searchedTarget.Center);
chosenTarget = searchedTarget;
}
}
}
}
targeted = chosenTarget;
}
else // Home in on selected target
{
// Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects
Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.6f);
if (Projectile.timeLeft < 110 * Projectile.extraUpdates)
Projectile.timeLeft = 110 * Projectile.extraUpdates;
CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.5f, 15, 0.97f);
if (startAttackEffects)
{
Projectile.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center) * 10;
SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound");
SoundEngine.PlaySound(pulse with { Volume = 0.25f, Pitch = Math.Max(0.6f, Main.rand.NextFloat(0.3f, 0.4f) + Projectile.numHits * 0.1f), MaxInstances = 5 }, Projectile.Center);
for (int k = 0; k < 6; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust);
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center).RotatedByRandom(0.5f) * Main.rand.NextFloat(5f, 9f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 1;
}
startAttackEffects = false;
}
if (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy())
targeted = null;
}
}
else
{
// Minor dust trail for when they first spawn
if (Main.rand.NextBool(5))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66);
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
Projectile.velocity *= 0.98f;
Projectile.velocity *= Projectile.numHits > 0 ? 0.955f : 0.97f;
}
// Visuals for the shot as it exits the tip of the rifle
if (Projectile.localAI[0] == createDustVar)
PulseBurst(4f, 5f);
float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true);
if (targetDist < 1400f && squash > 0.2f && (Projectile.ai[1] == 0 || time > 5)) // The trail
{
Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/DualTrail", false, 13, 0.075f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor * 0.6f * squash, new Vector2(1 - 0.15f * squash, 1.5f), true, false, shrinkSpeed: 0.2f * squash);
GeneralParticleHandler.SpawnParticle(trail);
}
Projectile.localAI[0]++;
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
time++;
}
public override bool? CanHitNPC(NPC target) => doDamage ? null : false;
public override bool? CanHitNPC(NPC target) => (target == targeted) ? null : false;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
bool onKill = target.life <= 0;
bool onKill = (target.life <= 0 && target.realLife == -1);
// Set some values to get ready for it to home again for its next hit
lastTarget = target;
distance = 3000;
Projectile.localAI[0] = 60;
Projectile.velocity *= MathHelper.Clamp(1.5f - Projectile.numHits * 0.5f, 1f, 1.5f);
lastHitTarget = target;
targeted = null;
time = 0;
timesItCanHit--;
Projectile.velocity *= 0.8f;
for (int i = 0; i <= 2; i++)
for (int i = 0; i <= 5; i++)
{
SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(20, 30 + 1), 0.25f, 2f);
GeneralParticleHandler.SpawnParticle(energy);
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDust>());
dust.scale = Main.rand.NextFloat(1.7f, 2.4f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 9f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 0.3f;
}
if (target == closestTarget)
timesItCanHit--;
if (onKill)
{
timesItCanHit += 2;
Projectile.timeLeft += 90;
// If it's hit targeted enemies enough, kill it
if (timesItCanHit <= 0)
{
if (Projectile.ai[1] == 0 && Main.myPlayer == Projectile.owner)
{
Projectile pulseOrb1 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10).RotatedBy(0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, 1);
Projectile pulseOrb2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10).RotatedBy(-0.3f) * 0.5f, Projectile.type, Projectile.damage / 4, Projectile.knockBack / 2, Projectile.owner, 0, -1);
pulseOrb1.penetrate = 1;
pulseOrb1.scale = 0.7f;
pulseOrb2.penetrate = 1;
pulseOrb2.scale = 0.7f;
}
Projectile.Kill();
}
}
private void PulseBurst(float speed1, float speed2)
public override bool PreDraw(ref Color lightColor)
{
for (int i = 0; i <= 8; i++)
Asset<Texture2D> orb = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 2f));
float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, 40 * Projectile.extraUpdates, Projectile.timeLeft, true), 5);
for (int i = 0; i < 6; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 66);
dust.scale = Main.rand.NextFloat(0.4f, 1.4f);
dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
for (int i = 0; i <= 8; i++)
{
SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.2f, 0.6f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(30, 40 + 1), 0.25f, 2f);
GeneralParticleHandler.SpawnParticle(energy);
Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalPulseColor, Color.White, i * 0.07f) with { A = 0 } * 0.5f;
Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f + i * 0.01f) * 3;
Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None);
}
return false;
}
}
}
+185 -204
View File
@@ -1,7 +1,9 @@
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Typeless;
using System;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -15,13 +17,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public new string LocalizationCategory => "Projectiles.Misc";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private Color mainColor = Color.Orchid;
private bool notSplit;
private bool doDamage = false;
private NPC closestTarget = null;
private NPC lastTarget = null;
private float distance;
public ref float time => ref Projectile.ai[0];
public bool isBeam => Projectile.ai[1] == 0;
public bool onSpawn = true;
private NPC targeted = null;
private NPC lastHitTarget = null;
private int timesItCanHit = 3;
public bool startAttackEffects = true;
public bool dead = false;
public int attackTime => (int)(180 + Projectile.ai[1]); // The amount of time an orb spends slowing before it attacks
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
public override void SetDefaults()
@@ -31,6 +35,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.extraUpdates = 7;
Projectile.timeLeft = 900;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
@@ -39,252 +44,228 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public override void AI()
{
// If it's hit targeted enemies enough, kill it
if (timesItCanHit <= 0)
Projectile.Kill();
notSplit = Projectile.ai[1] == 0f;
Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f);
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
Projectile.rotation = Projectile.velocity.ToRotation();
float createDustVar = 10f;
Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseColor.ToVector3() * 0.5f);
// Set split projectile stats
if (Projectile.localAI[0] == 0 && !notSplit)
if (onSpawn)
{
Projectile.extraUpdates = 1;
Projectile.timeLeft = 1240;
if (Projectile.ai[1] == 1)
SoundEngine.PlaySound(SoundID.DD2_DarkMageCastHeal with { Volume = 1.7f, Pitch = 0.3f }, Projectile.Center);
}
if (notSplit)
{
doDamage = true;
Projectile.extraUpdates = 100;
}
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > createDustVar && notSplit)
{
// Main projectile visual
float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.009f, 0, 3.5f);
if (targetDist < 1400f)
float fxPower = isBeam ? 2 : 0.5f;
if (isBeam)
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
Projectile.Center += Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(-0.05f * Math.Sign(Projectile.velocity.X)) * 60;
Projectile.extraUpdates = 100;
timesItCanHit = 1;
Owner.Calamity().GeneralScreenShakePower = 4f;
}
if (targetDist < 1400f && Main.rand.NextBool())
for (int i = 0; i <= 8 * fxPower; i++)
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 30, 1.1f - Projectile.ai[1] + sizeBonus, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
// A lingering trail of dust you can see after the particle trail disipates
if (Projectile.localAI[0] > 20 && Main.rand.NextBool())
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66);
dust.scale = Main.rand.NextFloat(0.7f, 1.5f);
dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust);
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.5f) * Main.rand.NextFloat(2f, 9f) * fxPower;
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 1;
}
for (int i = 0; i <= 6 * fxPower; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDust>());
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 15f) * fxPower;
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 0.3f;
}
onSpawn = false;
}
if (isBeam)
{
if (targetDist < 1400f && time > 0) // The main beam
{
Particle mainBeam = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 35, 0.55f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor * 0.5f, new Vector2(0.6f, 1f), true, true, shrinkSpeed: 0.2f, glowCenterScale: 0.7f, glowOpacity: 0.4f);
GeneralParticleHandler.SpawnParticle(mainBeam);
Projectile.scale += 0.007f;
if (time % 3 == 0)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3 * Projectile.scale, 3 * Projectile.scale), Effects.ArsenalEffects.ArsenalPulseDust);
dust.scale = Main.rand.NextFloat(0.7f, 1.2f) * Projectile.scale;
dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(7f, 25f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 0.6f;
}
}
}
#region Split Projectile AI
if (!notSplit)
else
{
// Split projectile visuals
if (targetDist < 1400f)
if (time >= attackTime) // home in on enemy
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
if (targetDist < 1400f && Main.rand.NextBool())
{
GlowOrbParticle spark = new GlowOrbParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2f, 2f), -Projectile.velocity * Main.rand.NextFloat(-0.01f, 0.01f), false, 5, 1.7f - Projectile.ai[1] * 0.18f, Main.rand.NextBool(3) ? Color.DarkViolet : mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.localAI[0] > 90)
{
// Velocity must look like it has stoped, but can't actually be zero otherwise homing code doesn't work
if (Projectile.localAI[0] == 91)
Projectile.velocity *= 0.001f;
// When they begin the homing after a hit of spawning, do a few visuals
if (Projectile.localAI[0] == 120)
// Find a target
if (targeted == null)
{
distance = 3000;
Projectile.velocity *= 0.9f;
SoundStyle fire = new("CalamityMod/Sounds/Item/PulseSound");
SoundEngine.PlaySound(fire with { Volume = 0.35f, Pitch = 0.3f, MaxInstances = -1 }, Projectile.Center);
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, mainColor, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0f, 0.5f, 15);
GeneralParticleHandler.SpawnParticle(pulse);
for (int k = 0; k < 6; k++)
startAttackEffects = true;
NPC chosenTarget = null;
float distance = 2500;
for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit in the last two hits.
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 66);
dust.scale = Main.rand.NextFloat(0.6f, 1.1f);
dust.velocity = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
NPC searchedTarget = Main.npc[index];
if (searchedTarget.CanBeChasedBy(null, false))
{
if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && (lastHitTarget != null ? searchedTarget != lastHitTarget : true) && searchedTarget.active && searchedTarget.life > 0)
{
distance = Vector2.Distance(Projectile.Center, searchedTarget.Center);
chosenTarget = searchedTarget;
}
}
}
}
// Homing code
if (Projectile.localAI[0] > 120)
{
// Do damage if it's near its target otherwise don't, this is to prevent excessive hits as orbs rail through worm bosses and such
if (closestTarget is not null)
doDamage = Vector2.Distance(Projectile.Center, closestTarget.Center) < 10;
else
doDamage = false;
if (chosenTarget == null) // If no target was found, check again but accept last hit targets as viable.
{
if (lastHitTarget != null)
Projectile.localNPCImmunity[lastHitTarget.whoAmI] = 0;
// Tracking code, originally was going to try only tracking the closest target not including the last target you hit, but I couldn't make it work
// Eventually I settled on how it works now and it seems to home consistently so I'm happy enough there
float projectileSpeed = 9.5f;
if (closestTarget is not null && closestTarget.active)
{
float targetDirectionRotation = Projectile.SafeDirectionTo(closestTarget.Center).ToRotation();
float turningRate = 10f + Projectile.localAI[0] * 0.00008f;
Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed;
}
else
{
Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed;
Projectile.velocity *= 0.999f;
}
if (closestTarget is not null && Vector2.Distance(Projectile.Center, closestTarget.Center) < 10)
{
closestTarget = null;
distance = 3000;
}
// Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects
Projectile.extraUpdates = 5 + (int)(Projectile.numHits * 0.3f);
{
// Actual homing movement
for (int index = 0; index < Main.npc.Length; index++)
{
if (Main.npc[index].CanBeChasedBy(null, false) || Main.npc[index] == lastTarget)
NPC searchedTarget = Main.npc[index];
if (searchedTarget.CanBeChasedBy(null, false))
{
float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2);
if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < (distance + extraDistance))
if (Vector2.Distance(Projectile.Center, searchedTarget.Center) < distance && searchedTarget.active && searchedTarget.life > 0)
{
closestTarget = Main.npc[index];
distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center);
distance = Vector2.Distance(Projectile.Center, searchedTarget.Center);
chosenTarget = searchedTarget;
}
}
}
}
targeted = chosenTarget;
}
else // Home in on selected target
{
// Add extra updates as it hits more times, this smoothy increases the speed without destroying velocity based visual effects
Projectile.extraUpdates = 7 + (int)(Projectile.numHits * 0.6f);
if (Projectile.timeLeft < 110 * Projectile.extraUpdates)
Projectile.timeLeft = 110 * Projectile.extraUpdates;
CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.4f, 15, 0.97f);
if (startAttackEffects)
{
Projectile.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center) * 10;
SoundStyle pulse = new("CalamityMod/Sounds/Item/PulseSound");
SoundEngine.PlaySound(pulse with { Volume = 0.35f, Pitch = Math.Max(0.5f, Main.rand.NextFloat(0.1f, 0.3f) + Projectile.numHits * 0.2f), MaxInstances = 5 }, Projectile.Center);
Particle pulse3 = new CustomSpark(Projectile.Center, Projectile.velocity * 0.5f, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 13, 0.05f * Projectile.scale, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(1.2f, 0.7f), shrinkSpeed: 0.4f);
GeneralParticleHandler.SpawnParticle(pulse3);
for (int k = 0; k < 6; k++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalPulseDust);
dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * Projectile.scale;
dust.velocity = Utils.DirectionTo(Projectile.Center, targeted.Center).RotatedByRandom(0.5f) * Main.rand.NextFloat(5f, 9f);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 1;
}
startAttackEffects = false;
}
if (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy())
targeted = null;
}
}
else
{
// Minor dust trail for when they first spawn
if (Main.rand.NextBool(5))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66);
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.5f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
Projectile.velocity *= 0.98f;
Projectile.velocity *= 0.985f;
}
float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true);
if (targetDist < 1400f && squash > 0.1f && time > 5) // The trail
{
Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.01f, "CalamityMod/Particles/DualTrail", false, 13, 0.075f, Effects.ArsenalEffects.ArsenalPulseColor * 0.6f * squash, new Vector2(1 - 0.15f * squash, 1.5f), true, false, shrinkSpeed: 0.2f * squash);
GeneralParticleHandler.SpawnParticle(trail);
}
}
#endregion
// Visuals for the shot as it exits the tip of the rifle
if (Projectile.localAI[0] == createDustVar && notSplit)
PulseBurst(4f, 5f);
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
time++;
}
public override bool? CanDamage() => (doDamage ? null : false);
public override bool? CanHitNPC(NPC target) => ((target == targeted) || isBeam) ? null : false;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
bool onKill = (target.life <= 0 && target.realLife == -1);
if (notSplit)
timesItCanHit--;
float fxVel = isBeam ? 3f : 1f;
for (int i = 0; i <= 5 * fxVel; i++)
{
for (int i = 0; i <= 9; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 66);
dust.scale = Main.rand.NextFloat(0.4f, 1.1f);
dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
// Since the beam looks wider as it travels, these hit particles scale a bit to fit that
float sizeBonus = MathHelper.Clamp(Projectile.localAI[0] * 0.01f, 0, 3.5f);
for (int k = 0; k < 9; k++)
{
SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(8, 8) - Projectile.velocity * 7, Projectile.velocity * Main.rand.NextFloat(0.7f, 3.1f), false, 30, 0.9f * Main.rand.NextFloat(0.9f, 1.1f) + sizeBonus, mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
// Spawn the 4 energy orbs
// These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit
// This is so it can better proc its on kill effect
int numProj = 4;
int projectileDamage = (int)(Projectile.damage * 0.5f);
for (int i = 0; i < numProj; i++)
{
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.Zero) * (14f - i * 0.7f)) * ((i + 1) * 0.25f), Projectile.type, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 1f + i);
}
Projectile.Kill();
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDust>());
dust.scale = Main.rand.NextFloat(1.7f, 2.4f) * Projectile.scale;
dust.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotateRandom(0.3f) * Main.rand.NextFloat(4f, 9f) * fxVel;
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalPulseColor;
dust.fadeIn = 0.3f * fxVel;
}
// Split projectile on hit effects
else
// Set some values to get ready for it to home again for its next hit
if (!isBeam)
{
// Set some values to get ready for it to home again for its next hit
lastTarget = target;
distance = 3000;
Projectile.localAI[0] = 60;
Projectile.velocity *= MathHelper.Clamp(1.5f - Projectile.numHits * 0.5f, 1f, 1.5f);
for (int i = 0; i <= 2; i++)
{
SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(20, 30 + 1), 0.25f, 2f);
GeneralParticleHandler.SpawnParticle(energy);
}
if (hit.Damage > 2 && target == closestTarget)
timesItCanHit--;
Projectile.ai[1] = -50;
lastHitTarget = target;
targeted = null;
time = 0;
Projectile.velocity *= 0.9f;
if (onKill)
timesItCanHit += 3;
}
else
{
if (Main.myPlayer == Projectile.owner)
{
timesItCanHit += 2;
Projectile.timeLeft += 90;
// Spawn the 4 energy orbs
// These should do a large fraction of the beam's damage so they will easily kill even some decently bulky enemies regular enemies in one hit
// This is so it can better proc its on kill effect
int numProj = 4;
int projectileDamage = (int)(Projectile.damage * 0.5f);
for (int i = 1; i < numProj + 1; i++)
{
Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.Zero) * (10 / numProj * i), Projectile.type, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, 28 * i);
orb.scale = 1.4f - i * 0.2f;
}
}
Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
Particle pulse3 = new CustomSpark(Projectile.Center, vel * 7, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 16, 0.065f, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.2f);
GeneralParticleHandler.SpawnParticle(pulse3);
Particle pulse4 = new CustomSpark(Projectile.Center, vel * 13, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 12, 0.04f, Effects.ArsenalEffects.ArsenalPulseColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.2f);
GeneralParticleHandler.SpawnParticle(pulse4);
}
// If it's hit targeted enemies enough, kill it
if (timesItCanHit <= 0)
Projectile.Kill();
}
private void PulseBurst(float speed1, float speed2)
public override bool PreDraw(ref Color lightColor)
{
for (int i = 0; i <= 15; i++)
if (isBeam)
return false;
Asset<Texture2D> orb = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 5, 10, 1, 2f));
float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, 40 * Projectile.extraUpdates, Projectile.timeLeft, true), 5);
for (int i = 0; i < 7; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 66);
dust.scale = Main.rand.NextFloat(0.4f, 1.4f);
dust.velocity = (Projectile.velocity * 4).RotateRandom(0.6f) * Main.rand.NextFloat(0.2f, 0.9f);
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.DarkViolet : mainColor;
dust.noLight = true;
}
for (int i = 0; i <= 15; i++)
{
SquishyLightParticle energy = new SquishyLightParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.4f), Main.rand.NextFloat(0.2f, 0.6f), Main.rand.NextBool(3) ? Color.DarkViolet : mainColor, Main.rand.Next(30, 40 + 1), 0.25f, 2f);
GeneralParticleHandler.SpawnParticle(energy);
Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalPulseColor, Color.White, i * 0.07f) with { A = 0 } * 0.5f;
Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f + i * 0.01f) * 3;
Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None);
}
return false;
}
}
}
+102 -37
View File
@@ -4,7 +4,6 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
@@ -16,6 +15,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public Vector2 startVel = Vector2.Zero;
public int time = 0;
public bool didDash => Projectile.ai[2] == 5;
public override void SetDefaults()
{
Projectile.width = 35;
@@ -23,63 +23,121 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.timeLeft = 11;
Projectile.timeLeft = 10;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.tileCollide = false;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, Color.Red.ToVector3());
Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserColor.ToVector3());
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
if (time == 0)
{
startVel = Projectile.velocity;
for (int i = 0; i <= 9; i++)
{
Particle spark = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.2f, 1.8f), Color.Red);
GeneralParticleHandler.SpawnParticle(spark);
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1f), false, 25, Main.rand.NextFloat(0.1f, 0.8f), Color.White);
GeneralParticleHandler.SpawnParticle(spark2);
}
for (int i = 0; i <= 15; i++)
{
Dust chargefull = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(40, 40), 278);
chargefull.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 2f);
Dust chargefull = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(40, 40), Effects.ArsenalEffects.ArsenalLaserDust);
chargefull.velocity = (Projectile.velocity * 10).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 2f);
chargefull.scale = Main.rand.NextFloat(0.4f, 0.8f);
chargefull.noGravity = true;
chargefull.color = Color.Red;
chargefull.color = Effects.ArsenalEffects.ArsenalLaserColor;
}
for (int i = 0; i < 20; i++)
{
Vector2 place = Projectile.Center + startVel * 20 + Main.rand.NextVector2Circular(5, 5);
int dir = Main.rand.NextBool() ? 1 : -1;
Particle chargeParticles = new CustomSpark(place, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(12, 35), "CalamityMod/Particles/BloomLineSoftEdge", false, 7, 0.025f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 0.7f), shrinkSpeed: 1.3f);
GeneralParticleHandler.SpawnParticle(chargeParticles);
if (i % 2 == 0)
{
Dust dust = Dust.NewDustPerfect(place, Effects.ArsenalEffects.ArsenalLaserDust, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(4, 20), 0, default, Main.rand.NextFloat(0.7f, 1.2f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
}
}
}
Projectile.rotation = startVel.ToRotation() + MathHelper.PiOver2;
Projectile.velocity = Vector2.Zero;
Projectile.Center = Owner.Center + startVel * 30;
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
bool onKill = (target.life <= 0 && target.realLife == -1);
Player Owner = Main.player[Projectile.owner];
float distMult = Utils.GetLerpValue(400, 10, Utils.Distance(target.Center, Projectile.Center), true);
Vector2 launchVel = startVel;
target.MoveNPC(launchVel, 10 + 35 * distMult, true);
if (Projectile.numHits == 0)
{
if (!onKill || !didDash)
{
for (int i = -5; i <= 5; i++)
{
if (i == 0)
i++;
Particle spark2 = new CustomSpark(target.Center, startVel * i * 2, "CalamityMod/Particles/BloomLineSoftEdge", false, 12, 0.085f - Math.Abs(i) * 0.012f, Effects.ArsenalEffects.ArsenalLaserColor * 1f, new Vector2((6 - Math.Abs(i)) * 0.4f, 1), true, true, 0, false, false, 1.2f, glowOpacity: 0.6f);
GeneralParticleHandler.SpawnParticle(spark2);
}
if (Projectile.timeLeft > 10)
Projectile.timeLeft = 10;
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
if (projectile.active && projectile.type == ModContent.ProjectileType<ScattershotSkewerHoldout>() && projectile.owner == Projectile.owner)
{
projectile.localAI[0] = distMult; // Tell the holdout that you hit a target and how much recoil
}
}
}
else if (didDash)
{
int extention = 25;
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
if (projectile.active && projectile.type == ModContent.ProjectileType<ScattershotSkewerHoldout>() && projectile.owner == Projectile.owner && projectile.ai[0] > -extention)
{
projectile.ai[0] -= extention;
}
}
if (Projectile.timeLeft < extention)
Projectile.timeLeft = extention;
}
SoundStyle sound = new("CalamityMod/Sounds/Item/MeldShoot");
SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center);
}
for (int i = 0; i < MathHelper.Clamp(25 - Projectile.numHits * 3, 1, 10); i++)
{
Vector2 velocity = startVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(8f, 20f);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserDust, velocity, 0, default, Main.rand.NextFloat(0.9f, 1.8f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
dust.fadeIn = -3;
}
if (onKill)
Projectile.numHits--;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits == 0)
{
SoundStyle sound = new("CalamityMod/Sounds/Item/MeldShoot");
SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center);
//Particle spark = new GlowSparkParticle(target.Center, startVel.SafeNormalize(Vector2.UnitY) * 20, false, 9, 0.1f, Color.Red, new Vector2(1f, 1.1f), true, true, 0.8f);
//GeneralParticleHandler.SpawnParticle(spark);
}
for (int i = 0; i < MathHelper.Clamp(25 - Projectile.numHits * 4, 1, 10); i++)
{
Vector2 velocity = startVel.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.4f);
Particle nanoDust = new NanoParticle(target.Center, velocity, Main.rand.NextBool(3) ? Color.Crimson : Color.Red, Main.rand.NextFloat(0.4f, 1f), 35, Main.rand.NextBool(), true);
GeneralParticleHandler.SpawnParticle(nanoDust);
}
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.88f);
if (Projectile.damage < 1)
Projectile.damage = 1;
float minMult = 0.4f;
int hitsToMinMult = 10;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
Player Owner = Main.player[Projectile.owner];
if (startVel == Vector2.Zero)
return false;
// If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough.
@@ -87,18 +145,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
return true;
// Otherwise, perform an AABB line collision check to check the whole beam.
float _ = float.NaN;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + startVel * 12, Projectile.width * Projectile.scale, ref _);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Projectile.Center + startVel * 145, Projectile.width * Projectile.scale, ref _);
}
public override bool PreDraw(ref Color lightColor)
{
if (time < 1)
return false;
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").Value;
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineFade").Value;
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
float fade = Utils.GetLerpValue(0, 5, Projectile.timeLeft, true);
for (int i = 0; i < 5; i++)
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (startVel * (2 + (i * 2)) * fade), null, Color.Red with { A = 0 } * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.4f, 0.9f) * (0.12f - (i * 0.0165f)), SpriteEffects.None);
for (int i = 0; i < 5; i++)
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (startVel * (2 + (i * 2)) * fade), null, Color.White with { A = 0 } * 0.8f * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.4f, 0.9f) * (0.12f - (i * 0.0165f)) * 0.7f, SpriteEffects.None);
Vector2 distVel = startVel * 10;
for (int i = 0; i < 6; i++)
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (distVel * (3 + i)), null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.5f * (1 - i * 0.08f) * fade, 0.8f * (1 + i * 0.07f)) * 0.11f, SpriteEffects.None);
for (int i = 0; i < 6; i++)
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition + (distVel * (3 + i)), null, Color.White with { A = 0 } * 0.8f * fade, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.5f * (1 - i * 0.08f) * fade, 0.8f * (1 + i * 0.07f)) * 0.07f, SpriteEffects.None);
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade, Projectile.rotation, bloomTexture.Size() * 0.5f, new Vector2(0.6f, 1) * 0.8f, SpriteEffects.None);
Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fade, Projectile.rotation, bloomTexture.Size() * 0.5f, new Vector2(0.5f, 1) * 0.65f, SpriteEffects.None);
return false;
}
}
+28 -16
View File
@@ -1,9 +1,7 @@
using System;
using CalamityMod.Particles;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
@@ -22,45 +20,59 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.extraUpdates = 9;
Projectile.extraUpdates = 7;
Projectile.timeLeft = 600;
Projectile.tileCollide = false;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * 0.4f);
Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserColor.ToVector3() * 0.4f);
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
if (time > 15 && targetDist < 1400)
{
if (Projectile.timeLeft % 6 == 0)
if (Projectile.timeLeft % 3 == 0)
{
Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 8, 1.7f, Color.Red);
Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 8, 1.7f * Projectile.ai[0], Effects.ArsenalEffects.ArsenalLaserColor);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.timeLeft % 5 == 0)
if (Projectile.timeLeft % 2 == 0)
{
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 3, 0.7f, Color.White);
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 3, 0.7f * Projectile.ai[0], Color.White);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
time++;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i < 3; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserDust, (Projectile.velocity * 4).RotatedByRandom(0.1f) * Main.rand.NextFloat(0.3f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.3f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
dust.fadeIn = -3;
}
}
public override bool PreDraw(ref Color lightColor)
{
if (time < 1)
return false;
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowBlade").Value;
float fade = Utils.GetLerpValue(0, 15, Projectile.timeLeft, true);
for (int i = 0; i < 4; i++)
{
Vector2 velocity = (Projectile.velocity * 5).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f);
Particle nanoDust = new NanoParticle(Projectile.Center, velocity, Main.rand.NextBool(3) ? Color.Crimson : Color.Red, Main.rand.NextFloat(0.4f, 1f), 20, Main.rand.NextBool(), true);
GeneralParticleHandler.SpawnParticle(nanoDust);
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, (Projectile.velocity * 5).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.3f, 0.5f));
dust.noGravity = true;
dust.color = Color.Red;
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fade * 0.4f, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.7f - i * 0.1f, 1 + i * 0.15f) * 0.018f * Projectile.ai[0], SpriteEffects.None);
Main.EntitySpriteDraw(pointTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fade * 0.2f, Projectile.rotation, pointTexture.Size() * 0.5f, new Vector2(0.7f - i * 0.1f, 1 + i * 0.15f) * 0.013f * Projectile.ai[0], SpriteEffects.None);
}
return false;
}
}
}
@@ -1,17 +1,13 @@
using System;
using CalamityMod.Cooldowns;
using CalamityMod.Items;
using CalamityMod.Items.Weapons.DraedonsArsenal;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
@@ -20,200 +16,297 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
public new string LocalizationCategory => "Projectiles.Misc";
public override int AssociatedItemID => ModContent.ItemType<ScattershotSkewer>();
public override float MaxOffsetLengthFromArm => 30f;
public override float RecoilResolveSpeed => 0.1f;
public override float OffsetXUpwards => -0f;
public override float BaseOffsetY => -0f;
public override float OffsetYDownwards => 0f;
public static float BulletSpeed = 12f;
public Player Owner => Main.player[Projectile.owner];
public float offsetBase = 30;
public override float MaxOffsetLengthFromArm => doingChargeAttack ? 100f : offsetBase;
public override float RecoilResolveSpeed => doingChargeAttack ? 2f : (shootingTimer < 0) ? 0.2f : 0.1f;
public override float OffsetXUpwards => 0f;
public override float BaseOffsetY => 0f;
public override float OffsetYDownwards => 0f;
public override float WeaponTurnSpeed => (shootingTimer < 0 ? 0 : 0.35f);
public SlotId ChargeSlot;
public SlotId StartSlot;
public Color mainColor = Color.Lerp(Color.Red, Color.White, 0f);
public int time = 0;
public int chargeAttackTimer = 10;
public bool charging => Projectile.ai[2] == 5;
public ref float shootingTimer => ref Projectile.ai[0];
public ref float chargeTimer => ref Projectile.ai[1];
public int fireRate => Owner.HeldItem.useAnimation;
public int chargeRate => 65;
public bool fullyCharged = false;
public bool doingChargeAttack = false;
public ref float CurrentChargingFrames => ref Projectile.ai[0];
public int chargeMax = 0;
public int downtime = 0;
public bool ChargeLV1 => CurrentChargingFrames >= chargeMax;
public bool startChargeLoop = true;
public int time = 0;
float charge = 0; // multiplier for vfx based on charge of the weapon
public bool didDash = false;
public override void KillHoldoutLogic()
{
if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)
Projectile.Kill();
}
public override void OnSpawn(IEntitySource source)
{
OffsetLengthFromArm = 30;
Player Owner = Main.player[Projectile.owner];
chargeMax = (int)(Owner.itemAnimationMax * 2.1f);
if (Owner.Calamity().arsenalCooldown <= 0)
if (Owner.dead)
{
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotCharge");
StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
StopSounds();
Projectile.Kill();
}
}
public void StopSounds()
{
if (SoundEngine.TryGetActiveSound(StartSlot, out var audio) && audio.IsPlaying)
{
audio?.Stop();
}
if (SoundEngine.TryGetActiveSound(ChargeSlot, out var audio2) && audio2.IsPlaying)
{
audio2?.Stop();
}
}
public override void HoldoutAI()
{
CalamityGlobalItem modItem = Owner.ActiveItem().Calamity();
Vector2 mountedCenter = Owner.MountedCenter;
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter;
if (time == 0)
{
OffsetLengthFromArm = offsetBase;
if (!charging)
shootingTimer = fireRate;
}
if (shootingTimer < 0)
{
if (Projectile.localAI[0] > 0)
{
Owner.velocity = -Projectile.velocity * (didDash ? 25 : (5 + 10 * Projectile.localAI[0]));
didDash = false;
Projectile.localAI[0] = 0;
}
if (didDash)
{
Owner.velocity = Projectile.velocity * 25;
if (!Collision.SolidCollision(GunTipPosition, 10, 10))
{
Owner.Center += Projectile.velocity * 40;
Projectile.Center += Projectile.velocity * 40;
}
float fxScale = Utils.GetLerpValue(10, 25, Owner.velocity.Length(), true);
for (int i = 0; i < 3; i++)
{
Particle spark2 = new CustomSpark(Owner.Center + Main.rand.NextVector2Circular(20, 20), -Owner.velocity * Main.rand.NextFloat(0.4f, 1.2f), "CalamityMod/Particles/BloomLineSoftEdge", false, 12, Main.rand.NextFloat(0.02f, 0.03f) * fxScale, Effects.ArsenalEffects.ArsenalLaserColor * 0.8f, new Vector2(1, 1), true, false, 0, false, false, 1f * fxScale);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
Owner.direction = Projectile.direction;
shootingTimer++;
if (shootingTimer == 0)
{
didDash = false;
shootingTimer = fireRate;
}
return;
}
if (HeldItem.type != Owner.ActiveItem().type)
{
StopSounds();
Projectile.Kill();
return;
}
if (!charging)
{
StopSounds();
}
if (shootingTimer == 0)
{
if (!charging || Owner.Calamity().arsenalCooldown > 0)
{
if (Owner.Calamity().mouseRight)
{
Projectile.ai[2] = 5;
shootingTimer = 1; // This is just so you dont fire when you stop using it
return;
}
Shoot(false);
}
else // Charging mode
{
if (Owner.Calamity().mouseRight && !doingChargeAttack) // Charge up the skewer
{
for (int i = 0; i < 4; i++)
{
Vector2 place = GunTipPosition + Main.rand.NextVector2Circular(5, 5) + Projectile.velocity * 12;
int dir = Main.rand.NextBool() ? 1 : -1;
Particle chargeParticles = new CustomSpark(place, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(8, 30), "CalamityMod/Particles/BloomLineSoftEdge", false, 6, 0.015f * charge, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 0.7f), shrinkSpeed: 1.4f);
GeneralParticleHandler.SpawnParticle(chargeParticles);
if (i % 2 == 0)
{
Dust dust = Dust.NewDustPerfect(place, Effects.ArsenalEffects.ArsenalLaserDust, -Projectile.velocity.RotatedBy(0.42f * dir).RotatedByRandom(0.1f) * Main.rand.NextFloat(4, 20), 0, default, Main.rand.NextFloat(0.4f, 0.9f) * charge);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
}
}
bool soundPlaying = (SoundEngine.TryGetActiveSound(StartSlot, out var audio) && audio != null);
if (chargeTimer == chargeRate && (!SoundEngine.TryGetActiveSound(ChargeSlot, out var audio3) || !audio3.IsPlaying))
{
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeLoop");
ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center);
}
if ((!soundPlaying || !audio.IsPlaying) && startChargeLoop)
{
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotCharge");
StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
startChargeLoop = false;
}
if (chargeTimer == chargeRate) // Reached max charge
{
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeMax");
StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center);
fullyCharged = true;
chargeTimer = 0;
OffsetLengthFromArm -= 7f;
}
if (!fullyCharged)
chargeTimer++;
}
else
{
if (fullyCharged)
{
doingChargeAttack = true;
int chargeAnimMax = (int)(chargeRate * 0.2f);
float completion = (chargeTimer / chargeAnimMax);
if (chargeTimer <= chargeAnimMax) // Do the pullback pre fire animation here
{
float inMin = 10;
float outMax = 60;
float inOutPoint = 0.5f;
if (completion >= inOutPoint)
{
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(inOutPoint, 1f, completion, true), 5);
OffsetLengthFromArm = MathHelper.Lerp(inMin, outMax, completionLerp);
}
else
{
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, inOutPoint, completion, true), 3);
OffsetLengthFromArm = MathHelper.Lerp(offsetBase, inMin, completionLerp);
}
}
if (chargeTimer == chargeAnimMax)
{
Shoot(true);
fullyCharged = false;
startChargeLoop = true;
doingChargeAttack = false;
chargeTimer = 0;
Projectile.ai[2] = 0; // Return to regular firing mode
}
chargeTimer++;
}
else // Failure to full charge
{
shootingTimer = (int)(-fireRate * 0.5f);
chargeTimer = 0;
startChargeLoop = true;
Projectile.ai[2] = 0; // Return to regular firing mode
}
}
}
}
else
{
if (!Owner.Calamity().mouseRight && !Main.mouseLeft && shootingTimer > 0)
{
StopSounds();
Projectile.Kill();
}
}
if (shootingTimer > 0)
shootingTimer--;
time++;
if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying)
ChargeSound.Position = Projectile.Center;
if (SoundEngine.TryGetActiveSound(StartSlot, out var StartSound) && StartSound.IsPlaying)
{
StartSound.Position = Projectile.Center;
// Fire if the owner stops channeling or otherwise cannot use the weapon.
if (((Owner.CantUseHoldout() || (Owner.Calamity().mouseRight || Owner.Calamity().arsenalCooldown > 0)) && downtime == 0 && time >= 1) || doingChargeAttack)
{
KeepRefreshingLifetime = false;
Projectile.timeLeft = Owner.Calamity().mouseRight ? Owner.itemAnimationMax * 2 : Owner.itemAnimationMax;
downtime = Owner.itemAnimationMax;
// Big Shot mode
if ((ChargeLV1 && Owner.Calamity().arsenalCooldown <= 0) || doingChargeAttack)
{
if (chargeAttackTimer == 10)
{
doingChargeAttack = true;
Projectile.timeLeft += chargeAttackTimer;
OffsetLengthFromArm -= 20;
}
else
{
if (chargeAttackTimer == 3)
{
OffsetLengthFromArm += 35;
ChargeSound?.Stop();
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeShoot");
SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
Owner.Calamity().GeneralScreenShakePower = 6f;
}
if (chargeAttackTimer <= 0)
{
Owner.Calamity().arsenalCooldown = 500;
Owner.AddCooldown(ArsenalPower.ID, 500);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed;
int charge2Damage = (int)(Projectile.damage * 60); // Seems high but its on a cooldown and is a melee attack so might be okay
float charge2KB = Projectile.knockBack * 3f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType<ScattershotLance>(), charge2Damage, charge2KB, Projectile.owner);
for (int i = 0; i <= 25; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 267, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f));
dust.noGravity = true;
dust.color = mainColor;
}
CurrentChargingFrames = 0;
if (modItem.Charge > 0)
modItem.Charge -= 0.25f;
else
Projectile.Kill();
chargeAttackTimer = 10;
doingChargeAttack = false;
}
}
if (doingChargeAttack)
chargeAttackTimer--;
}
// Spread Fire mode
else
{
StartSound?.Stop();
OffsetLengthFromArm -= 10;
ChargeSound?.Stop();
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotShoot");
SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed * 0.3f;
float angle1 = MathHelper.ToRadians(3f);
for (int i = 0; i < 2; i++)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 8, shootVelocity.RotatedBy(angle1), ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 4, shootVelocity.RotatedBy(angle1 * 0.7f) * 0.9f, ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
angle1 *= -1;
}
float angle2 = MathHelper.ToRadians(5f);
for (int i = 0; i < 2; i++)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 8, shootVelocity.RotatedBy(angle2) * 0.95f, ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
angle2 *= -1;
}
CurrentChargingFrames = 0;
if (modItem.Charge > 0)
modItem.Charge -= 0.1f;
else
Projectile.Kill();
}
}
else if (downtime == 0)
charge = (float)(fullyCharged ? 1 : Math.Pow(chargeTimer / chargeRate, 4));
}
public void Shoot(bool isSkewer)
{
if (isSkewer)
{
CurrentChargingFrames++;
// Charge-up visuals
if (CurrentChargingFrames >= 10)
if (Main.mouseLeft)
{
float particleScale = Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true);
float strength = particleScale;
Vector3 DustLight = mainColor.ToVector3();
Lighting.AddLight(GunTipPosition, DustLight * strength);
SoundStyle sound2 = new("CalamityMod/Sounds/Item/LauncherHeavyShot");
SoundEngine.PlaySound(sound2 with { Volume = 0.9f, Pitch = 0.4f }, Projectile.Center);
Particle pulse3 = new CustomSpark(Owner.Center, Projectile.velocity * 7, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 26, 0.09f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: 0.1f);
GeneralParticleHandler.SpawnParticle(pulse3);
didDash = true;
}
StopSounds();
Owner.Calamity().arsenalCooldown = 300;
Owner.AddCooldown(ArsenalPower.ID, 300);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY);
int chargeDamage = (int)(Projectile.damage * (50 + (didDash ? 10 : 0))); // Seems high but its on a cooldown and is a melee attack so might be okay
float chargeKB = Projectile.knockBack * 3f;
Projectile skewer = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType<ScattershotLance>(), chargeDamage, chargeKB, Projectile.owner,0,0, (didDash ? 5 : 0));
skewer.timeLeft = (didDash ? 25 : 10);
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeShoot");
SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
Owner.Calamity().GeneralScreenShakePower = 6f;
float mult = didDash ? 2 : 1;
for (int i = 0; i < 20 * mult; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalLaserDust, (shootVelocity * 20).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f) * mult, 0, default, Main.rand.NextFloat(0.5f, 1.3f) * mult);
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
}
// Full charge dusts
if (CurrentChargingFrames == chargeMax)
{
OffsetLengthFromArm += 10;
ChargeSound?.Stop();
for (int i = 0; i < 20; i++)
{
Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 66);
chargefull.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4f + Owner.velocity * 0.5f;
chargefull.scale = Main.rand.NextFloat(0.6f, 0.8f);
chargefull.noGravity = true;
chargefull.color = mainColor;
}
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeLoop");
ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center);
}
if (CurrentChargingFrames > 10)
{
for (int i = 0; i < 2; i++)
{
Vector2 spawnPos = Projectile.Center + Main.rand.NextVector2Circular(25, 25);
Particle spark = new LineParticle(spawnPos, (GunTipPosition - spawnPos).SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(1, 4), false, 4, Main.rand.NextFloat(0.3f, 0.45f), Color.Red);
GeneralParticleHandler.SpawnParticle(spark);
}
}
shootingTimer = (didDash ? -25 : -10);
}
if (!doingChargeAttack)
else
{
if (downtime == 1 && !Owner.Calamity().mouseRight)
Projectile.Kill();
OffsetLengthFromArm -= 10;
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotShoot");
SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center);
if (downtime > 0)
downtime--;
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 6f;
if ((Owner.Calamity().mouseRight || Owner.Calamity().arsenalCooldown > 0))
CurrentChargingFrames = 0;
if (Owner.Calamity().mouseRight)
float angle1 = MathHelper.ToRadians(2f);
for (int i = 0; i < 2; i++)
{
StartSound?.Stop();
Vector2 corVel1 = shootVelocity.RotatedBy(angle1 * 1.25f) * 0.8f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 2, corVel1, ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1);
Vector2 corVel2 = shootVelocity.RotatedBy(angle1 * 0.75f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 10, corVel2, ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0.65f);
angle1 *= -1;
}
float angle2 = MathHelper.ToRadians(5f);
for (int i = 0; i < 2; i++)
{
Vector2 corVel3 = shootVelocity.RotatedBy(angle2) * 0.9f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 4, corVel3, ModContent.ProjectileType<ScattershotLaser>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0.8f);
angle2 *= -1;
}
for (int i = 0; i < 9; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalLaserDust, (shootVelocity * 5).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.5f, 0.8f));
dust.noGravity = true;
dust.color = Effects.ArsenalEffects.ArsenalLaserColor;
dust.alpha = 100;
}
shootingTimer = fireRate;
}
time++;
}
public override void OnKill(int timeLeft)
{
@@ -227,44 +320,47 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (time < 2)
return false;
float fade = Utils.GetLerpValue(chargeMax / 3, chargeMax, CurrentChargingFrames, true);
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/ScattershotSkewer").Value;
Texture2D glowTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/ScattershotSkewerGlow").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3);
if (CurrentChargingFrames > 10 && !Owner.CantUseHoldout() && !Owner.Calamity().mouseRight && CurrentChargingFrames < chargeMax)
{
float rumble = Utils.GetLerpValue(10, chargeMax, CurrentChargingFrames, true);
drawPosition += Main.rand.NextVector2Circular(5 * rumble, 5 * rumble);
}
float randSize = Main.rand.NextFloat(0.9f, 1f);
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D rechargeTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Texture2D rechargeTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/ArchSmear").Value;
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").Value;
if (charging)
{
float rumble = (fullyCharged ? 0 : charge);
drawPosition += Main.rand.NextVector2Circular(5 * rumble, 5 * rumble);
for (int i = 0; i < 8; i++)
{
float thin = (1 - i * 0.15f);
float fat = (1 + i * 0.3f) * charge;
Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * 0.35f * charge, Projectile.rotation + MathHelper.PiOver2, rechargeTexture.Size() * 0.5f, new Vector2(thin, fat) * 0.3f * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, Color.White with { A = 0 } * 0.25f * charge, Projectile.rotation + MathHelper.PiOver2, rechargeTexture.Size() * 0.5f, new Vector2(thin, fat) * 0.2f * randSize, SpriteEffects.None, 0);
}
}
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
if (CurrentChargingFrames > 10 && downtime == 0)
if (charging)
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < 4; i++)
{
Color auraColor = Color.White with { A = 0 } * Utils.GetLerpValue(10, chargeMax, CurrentChargingFrames, true) * 0.6f;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 40f).ToRotationVector2();
Color auraColor = Color.White with { A = 0 } * 0.6f * charge;
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 48f).ToRotationVector2() * charge;
rotationalDrawOffset *= 3;
Main.EntitySpriteDraw(glowTexture, drawPosition + rotationalDrawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
}
float randSize = Main.rand.NextFloat(0.4f, 0.9f);
Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition + Projectile.velocity * 5, null, mainColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition + Projectile.velocity * 5, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.15f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
//Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, mainColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite);
}
Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite);
return false;
+12 -8
View File
@@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Ranged
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public float radius = 100;
public float radius = 200;
public override void SetDefaults()
{
Projectile.width = 200;
@@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ignoreWater = false;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 2;
Projectile.timeLeft = 10;
Projectile.DamageType = DamageClass.Ranged;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
@@ -26,16 +26,20 @@ namespace CalamityMod.Projectiles.Ranged
{
target.AddBuff(ModContent.BuffType<StaticDischarge>(), 300);
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.8f);
if (Projectile.damage < 1)
Projectile.damage = 1;
float minMult = 0.2f;
int hitsToMinMult = 7;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
Player Owner = Main.player[Projectile.owner];
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
target.MoveNPC(launchVel, 12, true);
}
public override void AI()
{
if (Projectile.ai[0] == 0)
radius = 200;
}
public override bool PreDraw(ref Color lightColor)
+70 -27
View File
@@ -1,4 +1,5 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
@@ -14,6 +15,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
public new string LocalizationCategory => "Projectiles.Misc";
public static readonly SoundStyle Explode = new("CalamityMod/Sounds/Item/ElectricBurst") { Volume = 0.8f };
public bool giveCooldown = false;
public bool onSpawn = true;
public enum TaserAIState
{
Firing,
@@ -49,8 +52,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = 2;
Projectile.extraUpdates = 3;
Projectile.tileCollide = true;
Projectile.extraUpdates = 8;
Projectile.tileCollide = false;
Projectile.ownerHitCheck = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.usesLocalNPCImmunity = true;
@@ -59,6 +62,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
public override void AI()
{
if (onSpawn)
{
for (int i = 0; i < 15; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, Effects.ArsenalEffects.ArsenalElectricDust);
dust.scale = Main.rand.NextBool(7) ? 1.5f : 0.9f;
dust.noGravity = true;
dust.fadeIn = 2;
dust.color = Effects.ArsenalEffects.ArsenalElectricColor;
dust.velocity = Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.9f, 2.8f);
}
onSpawn = false;
}
if (AIState != TaserAIState.Firing)
Time++;
Player player = Main.player[Projectile.owner];
@@ -72,7 +88,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
GoToAIState(TaserAIState.ReelingBack);
break;
case TaserAIState.Electrocuting:
if (distanceFromPlayer > 800f)
if (distanceFromPlayer > 2000f)
GoToAIState(TaserAIState.ReelingBack);
if (SoundEngine.TryGetActiveSound(Hum, out var hum) && hum.IsPlaying)
@@ -83,23 +99,33 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
// electric explosion;
if (Time == 150 || !Main.npc[ElectrocutionTarget].active)
{
if (!Main.npc[ElectrocutionTarget].active)
giveCooldown = false;
SoundEngine.PlaySound(Explode, Projectile.Center);
Projectile.localNPCHitCooldown = 15;
for (int i = 0; i < 30; i++)
for (int i = 0; i < 25; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f));
dust.scale = Main.rand.NextFloat(0.6f, 0.9f);
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 66, new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f));
dust2.scale = Main.rand.NextFloat(0.9f, 1.4f);
dust2.noGravity = true;
dust2.color = Color.Cyan;
}
DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Cyan * 0.5f, new Vector2(1, 1), 0, 0, 3.5f, 13);
GeneralParticleHandler.SpawnParticle(pulse);
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f));
dust.scale = Main.rand.NextFloat(0.9f, 1.4f);
dust.noGravity = false;
dust.color = Effects.ArsenalEffects.ArsenalElectricColor;
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<TaserExplosion>(), Projectile.damage * 2, Projectile.knockBack * 5, Projectile.owner, 0);
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.75f, 1f));
dust2.scale = Main.rand.NextFloat(1.7f, 2.1f);
dust2.noGravity = true;
dust2.color = Effects.ArsenalEffects.ArsenalElectricColor;
}
DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalElectricColor * 0.5f, new Vector2(1f, 1), 0, 0.5f, 3f, 18);
GeneralParticleHandler.SpawnParticle(pulse);
Particle bloom = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 10, 1.3f, Effects.ArsenalEffects.ArsenalElectricColor, Vector2.One, true, true);
GeneralParticleHandler.SpawnParticle(bloom);
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<TaserExplosion>(), Projectile.damage * 8, 0, Projectile.owner, 0);
Time = 0;
Projectile.velocity = Projectile.SafeDirectionTo(player.Center);
GoToAIState(TaserAIState.ReelingBack);
return;
}
@@ -114,13 +140,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
}
if (Projectile.Hitbox.Intersects(player.Hitbox))
{
if (giveCooldown)
{
player.Calamity().arsenalCooldown = 180;
player.AddCooldown(ArsenalPower.ID, 180);
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center);
Projectile.Kill();
return;
}
Projectile.tileCollide = false;
Projectile.extraUpdates = 5;
Projectile.velocity = Projectile.SafeDirectionTo(player.Center) * (ReelbackSpeed / Projectile.extraUpdates);
Projectile.extraUpdates = 8;
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(player.Center) * (ReelbackSpeed / Projectile.extraUpdates), 0.02f);
break;
}
@@ -153,7 +184,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
Player player = Main.player[Projectile.owner];
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Utils.DrawLine(Main.spriteBatch, player.MountedCenter, Projectile.Center, hookColor, hookColor, 3);
Texture2D lineTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineSoftEdge").Value;
Vector2 altPos = player.Center - Vector2.UnitY * 3;
float distance = Utils.Distance(altPos, Projectile.Center);
int drawSeperation = 10;
int startSeperation = drawSeperation;
Vector2 toPoint = Utils.DirectionTo(altPos, Projectile.Center);
for (int i = startSeperation; i < distance; i += drawSeperation)
{
Main.EntitySpriteDraw(lineTex, Projectile.Center - Main.screenPosition - toPoint * i, null, hookColor with { A = 0 }, toPoint.ToRotation() + MathHelper.PiOver2, lineTex.Size() * 0.5f, new Vector2(1, 1.3f) * Projectile.scale * 0.01f, SpriteEffects.None);
}
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
@@ -168,19 +209,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (AIState == TaserAIState.Firing)
{
giveCooldown = true;
Projectile.Center = target.Center;
Projectile.extraUpdates = 0;
Projectile.extraUpdates = 1;
if (!Main.dedServ)
{
for (int i = 0; i < 50; i++)
for (int i = 0; i < 30; i++)
{
float angle = MathHelper.TwoPi / 50f * i + Utils.GetLerpValue(90f, 150f, Time, true) * MathHelper.ToRadians(1080f);
Dust dust = Dust.NewDustPerfect(target.Center + angle.ToRotationVector2() * 10f, 226);
dust.velocity = Vector2.Zero;
if (Main.rand.NextBool(6))
dust.velocity = target.SafeDirectionTo(dust.position) * 4.5f;
dust.noGravity = true;
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 0.9f));
dust2.scale = Main.rand.NextFloat(0.9f, 1.2f);
dust2.noGravity = true;
dust2.color = Effects.ArsenalEffects.ArsenalElectricColor;
}
}
ElectrocutionTarget = target.whoAmI;
@@ -191,8 +230,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
GoToAIState(TaserAIState.Electrocuting);
}
}
// If it kills an enemy, don't give cooldown
if (giveCooldown && (target.life <= 0 && target.realLife == -1))
giveCooldown = false;
}
public override bool? CanHitNPC(NPC target) => (Projectile.numHits == 0 || target == Main.npc[ElectrocutionTarget]) ? null : false;
public override bool OnTileCollide(Vector2 oldVelocity)
{
GoToAIState(TaserAIState.ReelingBack);
+89
View File
@@ -0,0 +1,89 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class TaserShot : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public int time = 0;
public Vector2 position;
public Vector2 oldPos;
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.timeLeft = 180;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 2;
Projectile.extraUpdates = 5;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.ArmorPenetration = 10;
}
public override void AI()
{
if (time == 0)
{
for (int i = 0; i < 7; i++)
{
bool is278 = Main.rand.NextBool(4);
Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, is278 ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalElectricDust);
dust.scale = is278 ? 0.7f : Main.rand.NextBool(7) ? 1.2f : 0.8f;
dust.noGravity = true;
if (!is278)
dust.fadeIn = 2;
dust.color = Effects.ArsenalEffects.ArsenalElectricColor;
dust.velocity = Projectile.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.6f, 2.3f) * (is278 ? 0.3f : 1);
}
}
if (time > 4)
{
if (Projectile.timeLeft % 2 == 0)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Effects.ArsenalEffects.ArsenalElectricDust);
dust.scale = Main.rand.NextBool(7) ? 1f : 0.55f;
dust.noGravity = true;
dust.fadeIn = 2;
dust.color = Effects.ArsenalEffects.ArsenalElectricColor;
dust.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 1.5f);
}
if (Projectile.timeLeft % 2 == 0)
{
SparkParticle tip = new SparkParticle(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5, Projectile.velocity, false, (Projectile.timeLeft < 50 ? 20 : 6), 0.6f, Effects.ArsenalEffects.ArsenalElectricColor);
GeneralParticleHandler.SpawnParticle(tip);
}
if (Projectile.timeLeft % 3 == 0)
{
float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true);
Particle trail = new BoltParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, Projectile.velocity * 0.01f, false, 7, 0.2f, Effects.ArsenalEffects.ArsenalElectricColor * 0.8f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.5f * squash);
GeneralParticleHandler.SpawnParticle(trail);
}
}
Projectile.velocity *= 0.987f;
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Player Owner = Main.player[Projectile.owner];
target.AddBuff(ModContent.BuffType<StaticDischarge>(), 40);
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
target.MoveNPC(launchVel, 8, false);
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.7f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
}
}
@@ -1,8 +1,8 @@
using CalamityMod.Particles;
using CalamityMod.NPCs;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using CalamityMod.NPCs;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
@@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Rogue
{
float finalHitMult = 1; // If it is the last hit of a stealth strike, this is increased.
if (Projectile.Calamity().stealthStrike && !doneHitting) // Stealth strike bounce code, TODO: port this over to Pulse Rifle/Pusle Pistol because this is just a more functional version of theirs.
if (Projectile.Calamity().stealthStrike && !doneHitting) // Stealth strike bounce code
{
NPC chosenTarget = null;
float distance = 2500;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.