Scattershot Skewer Completed
This commit is contained in:
1 parent
e2537636c9
commit
f92f5c92bc
14 files changed
+337
-230
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 1016 B |
@@ -5,6 +5,7 @@ using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
@@ -17,59 +18,50 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
public class ScattershotSkewer : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
|
||||
public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/LaserRifleFire");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
CalamityGlobalItem modItem = Item.Calamity();
|
||||
|
||||
Item.width = 84;
|
||||
Item.height = 28;
|
||||
Item.width = 64;
|
||||
Item.height = 36;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.damage = 210;
|
||||
Item.damage = 196;
|
||||
Item.knockBack = 4f;
|
||||
Item.useTime = 25;
|
||||
Item.useAnimation = 25;
|
||||
Item.useTime = 45;
|
||||
Item.useAnimation = 35;
|
||||
Item.autoReuse = true;
|
||||
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.UseSound = FireSound;
|
||||
Item.noMelee = true;
|
||||
Item.channel = true;
|
||||
Item.noUseGraphic = true;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<LaserRifleShot>();
|
||||
Item.shoot = ModContent.ProjectileType<ScattershotSkewerHoldout>();
|
||||
Item.shootSpeed = 5f;
|
||||
|
||||
modItem.UsesCharge = true;
|
||||
modItem.MaxCharge = 190f;
|
||||
modItem.ChargePerUse = 0.125f;
|
||||
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 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)
|
||||
{
|
||||
if (velocity.Length() > 5f)
|
||||
{
|
||||
velocity.Normalize();
|
||||
velocity *= 5f;
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float SpeedX = velocity.X + Main.rand.Next(-1, 2) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-1, 2) * 0.05f;
|
||||
Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType<LaserRifleShot>(), damage, knockback, player.whoAmI, i, 0f);
|
||||
}
|
||||
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<ScattershotSkewerHoldout>(), damage, knockback, player.whoAmI, 0, 1);
|
||||
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 4);
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
{
|
||||
return new Vector2(-20, 0);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 256 B |
@@ -53,16 +53,6 @@ GaussRifle: {
|
||||
Tooltip: Fires a devastating powerful high-velocity blast with absurd knockback
|
||||
}
|
||||
|
||||
HeavyLaserRifle: {
|
||||
DisplayName: Heavy Laser Rifle
|
||||
Tooltip:
|
||||
'''
|
||||
Fires an incredibly accurate pair of destructive laser beams
|
||||
[c/1FFBFF:'Though Godseeker Knights are often brutish, not all prefer close quarters melee combat.]
|
||||
[c/1FFBFF:As such, Yharim personally requested that I create heavy weaponry for them despite being few in number.']
|
||||
'''
|
||||
}
|
||||
|
||||
HydraulicVoltCrasher: {
|
||||
DisplayName: Hydraulic Volt Crasher
|
||||
Tooltip:
|
||||
@@ -163,6 +153,19 @@ PulseTurretRemote: {
|
||||
'''
|
||||
}
|
||||
|
||||
ScattershotSkewer: {
|
||||
DisplayName: Scattershot Skewer
|
||||
Tooltip:
|
||||
'''
|
||||
Fires a spread of lasers
|
||||
Holding <left> charges the weapon, allowing it to thrust forward and impale enemies with an energy spear
|
||||
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.']
|
||||
'''
|
||||
}
|
||||
|
||||
SnakeEyes: {
|
||||
DisplayName: Snake Eyes
|
||||
Tooltip:
|
||||
|
||||
@@ -14,7 +14,6 @@ GaussFlux.DisplayName: Gauss Flux
|
||||
GaussPistolShot.DisplayName: Gauss Shot
|
||||
GaussRifleBlast.DisplayName: Gauss Blast
|
||||
GaussRifleExplosion.DisplayName: Gauss Explosion
|
||||
LaserRifleShot.DisplayName: Laser Rifle
|
||||
MassivePlasmaExplosion.DisplayName: Plasma Explosion
|
||||
MountedScannerLaser.DisplayName: Deathray
|
||||
MountedScannerSummon.DisplayName: Mounted Scanner
|
||||
@@ -28,6 +27,8 @@ PulsePistolShot.DisplayName: Pulse Bolt
|
||||
PulseRifleShot.DisplayName: Pulse Bolt
|
||||
PulseTurret.DisplayName: Pulse Turret
|
||||
PulseTurretShot.DisplayName: Pulse Bolt
|
||||
ScattershotLance.DisplayName: Laser Lance
|
||||
ScattershotLaser.DisplayName: Scattershot Laser
|
||||
SnakeEyesSummon.DisplayName: Snake Eyes
|
||||
SnakeEyesProjectile.DisplayName: Inescapable Bolt
|
||||
StarSwallowerAcid.DisplayName: Acid
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class LaserRifleShot : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
private int dust = 127;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 2;
|
||||
Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.extraUpdates = 100;
|
||||
Projectile.timeLeft = 600;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f);
|
||||
|
||||
float createDustVar = 12f;
|
||||
Projectile.localAI[0] += 1f;
|
||||
if (Projectile.localAI[0] > createDustVar)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int laserDust = Dust.NewDust(Projectile.Center, 0, 0, dust, 0f, 0f, 160, Projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f);
|
||||
Main.dust[laserDust].noGravity = true;
|
||||
Main.dust[laserDust].position = Projectile.Center;
|
||||
Main.dust[laserDust].velocity = Projectile.velocity;
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.localAI[0] == createDustVar)
|
||||
LaserBurst(1.8f, 3f);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
int height = 60;
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = height;
|
||||
Projectile.Center = Projectile.position;
|
||||
Projectile.maxPenetrate = -1;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.Damage();
|
||||
|
||||
LaserBurst(2.4f, 4.2f); // 60 dusts
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
int killDust = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f);
|
||||
float killDustX = Main.dust[killDust].velocity.X;
|
||||
float killDustY = Main.dust[killDust].velocity.Y;
|
||||
|
||||
if (killDustX == 0f && killDustY == 0f)
|
||||
killDustX = 1f;
|
||||
|
||||
float killDustVelocity = (float)Math.Sqrt(killDustX * killDustX + killDustY * killDustY);
|
||||
killDustVelocity = 4f / killDustVelocity;
|
||||
killDustX *= killDustVelocity;
|
||||
killDustY *= killDustVelocity;
|
||||
|
||||
Dust dust2 = Main.dust[killDust];
|
||||
dust2.velocity *= 0.5f;
|
||||
dust2.velocity.X = dust2.velocity.X + killDustX;
|
||||
dust2.velocity.Y = dust2.velocity.Y + killDustY;
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void LaserBurst(float speed1, float speed2)
|
||||
{
|
||||
float angleRandom = 0.05f;
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
float dustSpeed = Main.rand.NextFloat(speed1, speed2);
|
||||
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation());
|
||||
dustVel = dustVel.RotatedBy(-angleRandom);
|
||||
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
|
||||
|
||||
int burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f);
|
||||
Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f;
|
||||
Main.dust[burstDust].noGravity = true;
|
||||
|
||||
Dust dust2 = Main.dust[burstDust];
|
||||
dust2.velocity *= 3f;
|
||||
dust2 = Main.dust[burstDust];
|
||||
|
||||
burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f);
|
||||
Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f;
|
||||
|
||||
dust2 = Main.dust[burstDust];
|
||||
dust2.velocity *= 2f;
|
||||
|
||||
Main.dust[burstDust].noGravity = true;
|
||||
Main.dust[burstDust].fadeIn = 1f;
|
||||
Main.dust[burstDust].color = Color.Orange * 0.5f;
|
||||
|
||||
dust2 = Main.dust[burstDust];
|
||||
}
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
float dustSpeed = Main.rand.NextFloat(speed1, speed2);
|
||||
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation());
|
||||
dustVel = dustVel.RotatedBy(-angleRandom);
|
||||
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
|
||||
|
||||
int burstDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f);
|
||||
Main.dust[burstDust2].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f;
|
||||
Main.dust[burstDust2].noGravity = true;
|
||||
|
||||
Dust dust2 = Main.dust[burstDust2];
|
||||
dust2.velocity *= 0.5f;
|
||||
dust2 = Main.dust[burstDust2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class ScattershotLance : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public Vector2 startVel = Vector2.Zero;
|
||||
public int time = 0;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 35;
|
||||
Projectile.height = 35;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 11;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.Red.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);
|
||||
chargefull.scale = Main.rand.NextFloat(0.4f, 0.8f);
|
||||
chargefull.noGravity = true;
|
||||
chargefull.color = Color.Red;
|
||||
}
|
||||
}
|
||||
Projectile.rotation = startVel.ToRotation() + MathHelper.PiOver2;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
time++;
|
||||
}
|
||||
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;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
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.
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
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 _);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time < 1)
|
||||
return false;
|
||||
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").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);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class ScattershotLaser : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
private int dust = 127;
|
||||
public int time = 0;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 7;
|
||||
Projectile.height = 7;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.extraUpdates = 9;
|
||||
Projectile.timeLeft = 600;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
Lighting.AddLight(Projectile.Center, Color.Red.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)
|
||||
{
|
||||
Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 8, 1.7f, Color.Red);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
if (Projectile.timeLeft % 5 == 0)
|
||||
{
|
||||
SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 3, 0.7f, Color.White);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
using CalamityMod.Items;
|
||||
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;
|
||||
@@ -15,15 +20,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override int AssociatedItemID => ModContent.ItemType<ScattershotSkewer>();
|
||||
public override float MaxOffsetLengthFromArm => 15f;
|
||||
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 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 doingChargeAttack = false;
|
||||
|
||||
public ref float CurrentChargingFrames => ref Projectile.ai[0];
|
||||
public int chargeMax = 0;
|
||||
@@ -37,12 +46,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
OffsetLengthFromArm = 15;
|
||||
OffsetLengthFromArm = 30;
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
chargeMax = (int)(Owner.itemAnimationMax * 1.5f);
|
||||
chargeMax = (int)(Owner.itemAnimationMax * 2.1f);
|
||||
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorCharge");
|
||||
ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center);
|
||||
if (Owner.Calamity().arsenalCooldown <= 0)
|
||||
{
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotCharge");
|
||||
StartSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
|
||||
}
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
@@ -52,63 +64,93 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter;
|
||||
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) && downtime == 0 && time >= 1)
|
||||
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;
|
||||
if (Owner.Calamity().mouseRight)
|
||||
CurrentChargingFrames = 0;
|
||||
|
||||
// Big Shot mode
|
||||
if (ChargeLV1)
|
||||
if ((ChargeLV1 && Owner.Calamity().arsenalCooldown <= 0) || doingChargeAttack)
|
||||
{
|
||||
ChargeSound?.Stop();
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorFire");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = 0.3f }, Projectile.Center);
|
||||
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed;
|
||||
int charge2Damage = (int)(Projectile.damage * 2.5f);
|
||||
float charge2KB = Projectile.knockBack * 3f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType<ImmolationArrow>(), charge2Damage, charge2KB, Projectile.owner);
|
||||
|
||||
for (int i = 0; i <= 25; i++)
|
||||
if (chargeAttackTimer == 10)
|
||||
{
|
||||
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;
|
||||
doingChargeAttack = true;
|
||||
Projectile.timeLeft += chargeAttackTimer;
|
||||
OffsetLengthFromArm -= 20;
|
||||
}
|
||||
CurrentChargingFrames = 0;
|
||||
if (modItem.Charge > 0)
|
||||
modItem.Charge -= 0.06f;
|
||||
else
|
||||
Projectile.Kill();
|
||||
{
|
||||
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/ImmolatorFire");
|
||||
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;
|
||||
for (int i = 0; i < 3; i++)
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed * 0.3f;
|
||||
|
||||
float angle1 = MathHelper.ToRadians(3f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 fireVec = shootVelocity.RotatedBy((i == 0 ? 0.4f : i == 2 ? -0.4f : 0) * Utils.GetLerpValue(chargeMax * 1.1f, 0, CurrentChargingFrames, true));
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec * MathHelper.Clamp((2 * (Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true))), 0.5f, 2), ModContent.ProjectileType<ImmolationSpray>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
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;
|
||||
}
|
||||
for (int i = 0; i <= 4; i++)
|
||||
|
||||
float angle2 = MathHelper.ToRadians(5f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 267, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.4f, 1.1f));
|
||||
dust.noGravity = true;
|
||||
dust.color = mainColor;
|
||||
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.025f;
|
||||
modItem.Charge -= 0.1f;
|
||||
else
|
||||
Projectile.Kill();
|
||||
}
|
||||
@@ -128,54 +170,75 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
// Full charge dusts
|
||||
if (CurrentChargingFrames == chargeMax)
|
||||
{
|
||||
OffsetLengthFromArm += 10;
|
||||
ChargeSound?.Stop();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278);
|
||||
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 = false;
|
||||
chargefull.noGravity = true;
|
||||
chargefull.color = mainColor;
|
||||
}
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorChargeLoop");
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/ScattershotChargeLoop");
|
||||
ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center);
|
||||
}
|
||||
|
||||
if (CurrentChargingFrames > chargeMax && Main.rand.NextBool())
|
||||
if (CurrentChargingFrames > 10)
|
||||
{
|
||||
Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278);
|
||||
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 = mainColor;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (downtime == 1 && !Owner.Calamity().mouseRight)
|
||||
Projectile.Kill();
|
||||
if (!doingChargeAttack)
|
||||
{
|
||||
if (downtime == 1 && !Owner.Calamity().mouseRight)
|
||||
Projectile.Kill();
|
||||
|
||||
if (downtime > 0)
|
||||
downtime--;
|
||||
if (downtime > 0)
|
||||
downtime--;
|
||||
|
||||
if ((Owner.Calamity().mouseRight || Owner.Calamity().arsenalCooldown > 0))
|
||||
CurrentChargingFrames = 0;
|
||||
|
||||
if (Owner.Calamity().mouseRight)
|
||||
{
|
||||
StartSound?.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound))
|
||||
ChargeSound?.Stop();
|
||||
if (SoundEngine.TryGetActiveSound(StartSlot, out var StartSound))
|
||||
StartSound?.Stop();
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time < 2)
|
||||
return false;
|
||||
|
||||
Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(-0.05f * Projectile.direction) * 10f;
|
||||
|
||||
float fade = Utils.GetLerpValue(chargeMax / 3, chargeMax, CurrentChargingFrames, true);
|
||||
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolator").Value;
|
||||
Texture2D glowTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow").Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
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);
|
||||
}
|
||||
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
@@ -185,16 +248,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").Value;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
|
||||
if (CurrentChargingFrames > 0 && downtime == 0)
|
||||
if (CurrentChargingFrames > 10 && downtime == 0)
|
||||
{
|
||||
float randSize = Main.rand.NextFloat(0.8f, 1.2f);
|
||||
Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, 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, 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);
|
||||
for (int i = 0; i < 3; 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();
|
||||
rotationalDrawOffset *= 3;
|
||||
Main.EntitySpriteDraw(glowTexture, drawPosition + rotationalDrawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user