Gauss Rifle -> Compact Railgun
This commit is contained in:
1 parent
1aded6f633
commit
b716c5caad
19 files changed
+594
-215
No files matched your search
@@ -84,8 +84,6 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<PulseRifle>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<GaussRifle>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/GaussRifleGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<SoulPiercer>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<StarburstShiv>())
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace CalamityMod.Items.DraedonMisc
|
||||
meleeDisplay.OverrideColor = new Color(149, 243, 43);
|
||||
list.Insert(insertIndex + 1, meleeDisplay);
|
||||
|
||||
int rangedItem = ModContent.ItemType<GaussRifle>();
|
||||
int rangedItem = ModContent.ItemType<CompactRailgun>();
|
||||
TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}");
|
||||
rangedDisplay.OverrideColor = new Color(236, 255, 31);
|
||||
list.Insert(insertIndex + 2, rangedDisplay);
|
||||
|
||||
+30
-43
@@ -3,22 +3,24 @@ using System.Collections.Generic;
|
||||
using CalamityMod.CustomRecipes;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
{
|
||||
public class GaussRifle : ModItem, ILocalizedModType
|
||||
[LegacyName("GaussRifle")]
|
||||
public class CompactRailgun : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
|
||||
public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/LargeMechGaussRifle");
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
|
||||
ItemID.Sets.IsRangedSpecialistWeapon[Type] = true;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
CalamityGlobalItem modItem = Item.Calamity();
|
||||
@@ -26,62 +28,47 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
Item.width = 70;
|
||||
Item.height = 30;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.damage = 100;
|
||||
Item.knockBack = 0.2f;
|
||||
Item.useTime = Item.useAnimation = 10;
|
||||
Item.damage = 60;
|
||||
Item.knockBack = 7f;
|
||||
Item.useTime = Item.useAnimation = 8;
|
||||
Item.autoReuse = true;
|
||||
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/GaussFire") with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) };
|
||||
Item.noMelee = true;
|
||||
Item.channel = true;
|
||||
Item.noUseGraphic = true;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
|
||||
Item.rare = ItemRarityID.Yellow;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<GaussRifleBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<CompactRailgunHoldout>();
|
||||
Item.shootSpeed = 7f;
|
||||
|
||||
modItem.UsesCharge = true;
|
||||
modItem.MaxCharge = 135f;
|
||||
modItem.ChargePerUse = 0.0225f;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
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 bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position + velocity * 6, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType<GaussRifleBlast>(), damage, knockback, player.whoAmI);
|
||||
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;
|
||||
}
|
||||
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/GaussRifleGlow").Value);
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/CompactRailgunGlow").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;
|
||||
|
||||
Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f;
|
||||
Vector2 itemSize = new Vector2(70, 30);
|
||||
Vector2 itemOrigin = new Vector2(-18, 6);
|
||||
|
||||
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;
|
||||
if (animProgress < 0.4f)
|
||||
rotation += -0.025f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation);
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3);
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -1,3 +1,16 @@
|
||||
CompactRailgun: {
|
||||
DisplayName: Compact Railgun
|
||||
Tooltip:
|
||||
'''
|
||||
A magnet powered energy railgun that fires rapidly, creating lingering magnetic implosions that pull in weak enemies on hit
|
||||
Only one implosion can exist at a time
|
||||
Press <right> to begin charging a devastating energy beam that always crits and will fire once ready
|
||||
This charge attack can not be interrupted once started and has a long cooldown
|
||||
[c/1FFBFF:'Many soldiers underestimate the destructive capabilities of magnetism.]
|
||||
[c/1FFBFF:This railgun has reliably pulled in skeptics of its crushing efficiency.']
|
||||
'''
|
||||
}
|
||||
|
||||
FrequencyManipulator: {
|
||||
DisplayName: Frequency Manipulator
|
||||
Tooltip:
|
||||
@@ -48,17 +61,6 @@ GaussPistol: {
|
||||
'''
|
||||
}
|
||||
|
||||
GaussRifle: {
|
||||
DisplayName: Gauss Rifle
|
||||
Tooltip:
|
||||
'''
|
||||
A magnet powered energy rifle that fires piercing shots, creating magnetic implosions that pull in weak enemies on hit
|
||||
Implosions only spawn on the first enemy hit by the beam
|
||||
[c/1FFBFF:'Many soldiers underestimate the destructive capabilities of magnetism.]
|
||||
[c/1FFBFF:This rifle has reliably pulled in skeptics of its crushing efficiency.']
|
||||
'''
|
||||
}
|
||||
|
||||
HolofiberImmolator: {
|
||||
DisplayName: Holofiber Immolator
|
||||
Tooltip:
|
||||
|
||||
@@ -12,8 +12,8 @@ GatlingLaserShot.DisplayName: Gatling Laser
|
||||
GaussEnergy.DisplayName: Gauss Energy
|
||||
GaussFlux.DisplayName: Gauss Flux
|
||||
GaussPistolShot.DisplayName: Gauss Shot
|
||||
GaussRifleBlast.DisplayName: Gauss Blast
|
||||
GaussRifleExplosion.DisplayName: Gauss Explosion
|
||||
GaussRailgunBlast.DisplayName: Gauss Beam
|
||||
GaussRailgunExplosion.DisplayName: Gauss Explosion
|
||||
ImmolationArrow.DisplayName: Immolation Arrow
|
||||
ImmolationBurst.DisplayName: Immolation Burst
|
||||
ImmolationSpray.DisplayName: Immolation Spray
|
||||
@@ -75,3 +75,4 @@ PlagueShot.DisplayName: Plague Shot
|
||||
PlagueShotBuffer.DisplayName: Plague Shot
|
||||
WaterShot.DisplayName: Water Shot
|
||||
WaterShotBuffer.DisplayName: Water Shot
|
||||
GaussRailgunBigShot.DisplayName: Gauss Railgun Big Shot
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,245 @@
|
||||
using System;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class CompactRailgunHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override int AssociatedItemID => ModContent.ItemType<CompactRailgun>();
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float offsetBase = 30;
|
||||
public override float MaxOffsetLengthFromArm => offsetBase;
|
||||
public override float RecoilResolveSpeed => (shootingTimer < 0) ? 0.02f : 0.1f;
|
||||
public override float OffsetXUpwards => 0f;
|
||||
public override float BaseOffsetY => 0f;
|
||||
public override float OffsetYDownwards => 0f;
|
||||
public override float WeaponTurnSpeed => charging? 0.6f : 0.25f;
|
||||
public SlotId SoundSlot;
|
||||
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 => 222;
|
||||
public int time = 0;
|
||||
public float lightSine = 0;
|
||||
float charge = 0; // multiplier for vfx based on charge of the weapon
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
if (Owner.dead)
|
||||
{
|
||||
StopSounds();
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
public void StopSounds()
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(SoundSlot, out var audio2) && audio2.IsPlaying)
|
||||
{
|
||||
audio2?.Stop();
|
||||
}
|
||||
}
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
OffsetLengthFromArm = offsetBase;
|
||||
if (!charging)
|
||||
shootingTimer = fireRate;
|
||||
}
|
||||
|
||||
if (shootingTimer < 0)
|
||||
{
|
||||
shootingTimer++;
|
||||
if (shootingTimer == 0)
|
||||
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
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalGaussColor.ToVector3() * 2f * MathHelper.Lerp(Math.Abs(lightSine), 0.5f, 0.3f));
|
||||
|
||||
if (chargeTimer == 0)
|
||||
{
|
||||
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/GaussRailgunCharge");
|
||||
SoundSlot = SoundEngine.PlaySound(sound with { Volume = 0.9f }, Projectile.Center);
|
||||
}
|
||||
if (chargeTimer == chargeRate) // Reached max charge
|
||||
{
|
||||
Shoot(true);
|
||||
}
|
||||
else
|
||||
chargeTimer++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Owner.Calamity().mouseRight && !Main.mouseLeft && shootingTimer > 0)
|
||||
{
|
||||
StopSounds();
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
if (shootingTimer > 0)
|
||||
shootingTimer--;
|
||||
|
||||
time++;
|
||||
|
||||
if (SoundEngine.TryGetActiveSound(SoundSlot, out var ChargeSound) && ChargeSound.IsPlaying)
|
||||
ChargeSound.Position = Projectile.Center;
|
||||
charge = (float)(Math.Pow(chargeTimer / chargeRate, 3));
|
||||
}
|
||||
public void Shoot(bool isBig)
|
||||
{
|
||||
if (isBig)
|
||||
{
|
||||
Owner.velocity += -Projectile.velocity * 12;
|
||||
OffsetLengthFromArm -= 15;
|
||||
StopSounds();
|
||||
Owner.Calamity().arsenalCooldown = 540;
|
||||
Owner.AddCooldown(ArsenalPower.ID, 540);
|
||||
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY);
|
||||
int chargeDamage = (int)(Projectile.damage * 55);
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 6, ModContent.ProjectileType<GaussRailgunBigShot>(), chargeDamage, 0, Projectile.owner);
|
||||
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/GaussRailgunBigShot");
|
||||
for (int i = 0; i < 2; i++)
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.9f, MaxInstances = 2, Pitch = (i == 0 ? -0.4f : 0) }, Projectile.Center);
|
||||
Owner.Calamity().GeneralScreenShakePower = 8f;
|
||||
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Main.rand.NextBool(3) ? ModContent.DustType<SquashDust>() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 25).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(1.2f, 1.9f));
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
}
|
||||
for (float i = 0.6f; i <= 1; i += 0.4f)
|
||||
{
|
||||
Particle pulse3 = new CustomSpark(Projectile.Center, Projectile.velocity * (20 - 10 * i), "CalamityMod/Particles/GlowSquareFading", false, 19, 0.9f * i, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1.2f, 0.7f), shrinkSpeed: -0.1f, extraRotation: MathHelper.Pi);
|
||||
GeneralParticleHandler.SpawnParticle(pulse3);
|
||||
}
|
||||
|
||||
shootingTimer = (-50);
|
||||
chargeTimer = 0;
|
||||
Projectile.ai[2] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
OffsetLengthFromArm -= 5;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/GaussFire");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) }, Projectile.Center);
|
||||
|
||||
// Holdout velocity weirdly can be a bit finnicky here. apparently.
|
||||
Vector2 shootVelocity = Projectile.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.UnitY) * 6f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType<GaussRailgunBlast>(), Projectile.damage, 0, Projectile.owner);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Main.rand.NextBool(3) ? ModContent.DustType<SquashDust>() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 4).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.1f));
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
}
|
||||
|
||||
shootingTimer = fireRate;
|
||||
}
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(SoundSlot, out var ChargeSound))
|
||||
ChargeSound?.Stop();
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time < 2)
|
||||
return false;
|
||||
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/CompactRailgun").Value;
|
||||
Texture2D glowTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/CompactRailgunGlow").Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3);
|
||||
|
||||
|
||||
float randSize = Main.rand.NextFloat(0.9f, 1f);
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Texture2D aimTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineThick").Value;
|
||||
Texture2D ringTex = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareFading").Value;
|
||||
Texture2D pointTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").Value;
|
||||
|
||||
if (charging)
|
||||
{
|
||||
drawPosition += Projectile.velocity * Main.rand.NextFloat(-6 * charge, 6 * charge);
|
||||
|
||||
for (int i = 1; i <= 5; i++) // Sightlines
|
||||
{
|
||||
float sine = (float)Math.Sin(((charge * 60f + time * 0.15f) + MathHelper.ToRadians(216) * i) / MathHelper.Pi);
|
||||
float angle = MathHelper.ToRadians(36) * sine * Math.Max(1 - charge * 1.06f, 0);
|
||||
Color lineColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * Math.Abs(sine) * Math.Min(chargeTimer / (chargeRate * 0.3f), 1) * 0.2f;
|
||||
Main.EntitySpriteDraw(aimTex, Projectile.Center - Main.screenPosition + Projectile.velocity * 10, null, lineColor, Projectile.rotation + angle - MathHelper.PiOver2, new Vector2(aimTex.Size().X * 0.5f, 0), new Vector2(0.2f - Math.Abs(sine) * 0.12f, 8) * 0.07f, SpriteEffects.FlipVertically, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Color auraColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * 0.25f * charge;
|
||||
Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 5 * charge;
|
||||
Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
}
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite);
|
||||
if (charging)
|
||||
{
|
||||
for (int i = 1; i <= 3; i++) // "Rings"
|
||||
{
|
||||
lightSine = (float)Math.Sin(((charge * 100f + time * 0.15f) + MathHelper.ToRadians(360) * i) / MathHelper.Pi);
|
||||
float angle = MathHelper.ToRadians(36) * lightSine * (1 - charge);
|
||||
Vector2 posOffset = Projectile.velocity * 20 * lightSine;
|
||||
Color lineColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * Math.Min(chargeTimer / (chargeRate * 0.3f), 1) * 0.7f;
|
||||
Main.EntitySpriteDraw(ringTex, Projectile.Center - Main.screenPosition + posOffset, null, lineColor, Projectile.rotation + MathHelper.PiOver2, ringTex.Size() * 0.5f, new Vector2(1, 1) * (0.10f + i * 0.025f), SpriteEffects.FlipVertically, 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class GaussRailgunBigShot : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int time = 0;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 60;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 900;
|
||||
Projectile.extraUpdates = 80;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
|
||||
|
||||
if (targetDist < 1400 && time > 7)
|
||||
{
|
||||
if (time % 2 == 0)
|
||||
{
|
||||
Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 48, 0.375f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.05f);
|
||||
GeneralParticleHandler.SpawnParticle(trail);
|
||||
}
|
||||
if (time % 3 == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), ModContent.DustType<SquashDust>());
|
||||
dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(10f, 30f);
|
||||
dust.scale = Main.rand.NextFloat(1.3f, 1.7f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
dust.noLightEmittence = time % 6 != 0;
|
||||
dust.fadeIn = -0.6f;
|
||||
}
|
||||
|
||||
if (time % 12 == 0)
|
||||
{
|
||||
Particle trail2 = new VelChangingSpark(Projectile.Center, -Projectile.velocity * 0.1f, -Projectile.velocity * 0.1f, "CalamityMod/Particles/GlowSquareFading", 35, 0.33f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 0.8f), shrinkSpeed: 0f, lerpRate: 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(trail2);
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (Vector2.Distance(Projectile.Center, projectile.Center) <= 20 && projectile.active && projectile.type == ModContent.ProjectileType<RicoshotCoin>())
|
||||
{
|
||||
projectile.Kill();
|
||||
Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center) * 6;
|
||||
Projectile.hostile = true;
|
||||
Projectile.friendly = false;
|
||||
}
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
impactDust();
|
||||
|
||||
bool onKill = (target.life <= 0 && target.realLife == -1);
|
||||
if (onKill && Projectile.numHits > 0)
|
||||
Projectile.numHits--;
|
||||
|
||||
modifiers.SetCrit();
|
||||
float minMult = 0.25f;
|
||||
int hitsToMinMult = 7;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 20;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
impactDust();
|
||||
}
|
||||
public void impactDust()
|
||||
{
|
||||
for (int i = 0; i < MathHelper.Clamp(12 - Projectile.numHits * 2, 1, 12); i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? ModContent.DustType<SquashDust>() : Effects.ArsenalEffects.ArsenalGaussDust);
|
||||
dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(14f, 37f);
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.5f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class GaussRailgunBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int time = 0;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 80;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
|
||||
|
||||
if (targetDist < 1400 && time > 7)
|
||||
{
|
||||
if (time % 3 == 0)
|
||||
{
|
||||
Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 8, 0.15f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2.5f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(trail);
|
||||
}
|
||||
if (time % 3 == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), Effects.ArsenalEffects.ArsenalGaussDust);
|
||||
dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f);
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 0.85f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
dust.noLightEmittence = time % 9 != 0;
|
||||
dust.fadeIn = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 8, MathHelper.Clamp(0.06f - Projectile.numHits * 0.01f, 0f, 0.06f), Effects.ArsenalEffects.ArsenalGaussColor * 0.9f, new Vector2(1f, 0.5f), true, true, 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Particle bolt2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 8, 1f, Effects.ArsenalEffects.ArsenalGaussColor * 0.6f, Vector2.One, true, true, glowOpacity: 0.5f, glowCenterScale: 1.15f, extraRotation: MathHelper.PiOver4);
|
||||
GeneralParticleHandler.SpawnParticle(bolt2);
|
||||
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
if (p.type == ModContent.ProjectileType<GaussRailgunExplosion>() && p.owner == Projectile.owner)
|
||||
{
|
||||
if (p.timeLeft > 10)
|
||||
p.timeLeft = 10;
|
||||
}
|
||||
}
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<GaussRailgunExplosion>(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0f, 0f);
|
||||
}
|
||||
impactDust();
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 6;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
impactDust();
|
||||
}
|
||||
public void impactDust()
|
||||
{
|
||||
for (int i = 0; i < MathHelper.Clamp(5 - Projectile.numHits, 1, 5); i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDust>());
|
||||
dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(8f, 13f);
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.35f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class GaussRailgunExplosion : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int time = 0;
|
||||
public float sine = 0;
|
||||
public float shrink = 1;
|
||||
public int strongTimer = 0;
|
||||
public bool strong => strongTimer < 10;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 250;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 420;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 15;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, ModContent.DustType<SquashDust>(), -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f));
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 0.05f;
|
||||
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
|
||||
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.CanBeMoved(true))
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 500)
|
||||
{
|
||||
Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
target.velocity = Vector2.Lerp(target.velocity, moveDir * 8, 0.12f);
|
||||
target.Center += moveDir * 1.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Projectile.rotation += 0.07f;
|
||||
if (shrink > 0)
|
||||
shrink -= strong ? 0.03f : 0.03f;
|
||||
else
|
||||
shrink = 1;
|
||||
|
||||
if (!strong)
|
||||
time++;
|
||||
strongTimer++;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (!strong)
|
||||
modifiers.SourceDamage *= 0.1f;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
float shrinkFade = Math.Min(Utils.GetLerpValue(1, 0.7f, shrink, true), Utils.GetLerpValue(0f, 0.3f, shrink, true));
|
||||
float sine = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.5f / MathHelper.Pi), 0.4f, 0.8f));
|
||||
float sine2 = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.7f / MathHelper.Pi), 0.4f, 0.8f));
|
||||
float fade = (float)Math.Pow(Utils.GetLerpValue(0, 10, Projectile.timeLeft, true), 3);
|
||||
float areaScale = (strong ? 1f : 1) * fade;
|
||||
Texture2D tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleBig").Value;
|
||||
Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade;
|
||||
|
||||
Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class GaussRifleBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 0;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.timeLeft == 600)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle Square = new GlowSquareParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(1f, 3f), false, 15, Main.rand.NextFloat(0.5f, 1.2f), Color.Goldenrod, false, Main.rand.NextFloat(-3, 3));
|
||||
GeneralParticleHandler.SpawnParticle(Square);
|
||||
}
|
||||
}
|
||||
if (Projectile.extraUpdates < 30 && Projectile.timeLeft % 3 == 0)
|
||||
Projectile.extraUpdates++;
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
|
||||
if (Projectile.timeLeft % 2 == 0 && targetDist < 1400 && Projectile.timeLeft <= 585)
|
||||
{
|
||||
float cLerp = Utils.GetLerpValue(500, 600, Projectile.timeLeft);
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.08f, Color.Lerp(Color.Gold, Color.Goldenrod, cLerp), new Vector2(0.3f, 1), true, true);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
if (Main.rand.NextBool(7))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 267);
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 1.1f);
|
||||
dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3);
|
||||
dust.noGravity = true;
|
||||
dust.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
|
||||
}
|
||||
if (Projectile.timeLeft == 600)
|
||||
{
|
||||
Particle pulse = new GlowSparkParticle(Projectile.Center, Projectile.velocity * 3, false, 8, 0.042f, Color.Goldenrod, new Vector2(1.5f, 0.9f), true);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 8, MathHelper.Clamp(0.06f - Projectile.numHits * 0.01f, 0f, 0.06f), Color.Goldenrod * 0.9f, new Vector2(1, 0.5f), true);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Particle bolt2 = new CustomPulse(target.Center, Vector2.Zero, Color.Gold * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 1.4f, 0, 23);
|
||||
GeneralParticleHandler.SpawnParticle(bolt2);
|
||||
Particle bolt3 = new CustomPulse(target.Center, Vector2.Zero, Color.Gold * 0.35f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 1.6f, 0, 18);
|
||||
GeneralParticleHandler.SpawnParticle(bolt3);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 dustVel = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(3f, 7f);
|
||||
Dust dust = Dust.NewDustPerfect(target.Center + dustVel * 5, 267, -dustVel * 0.5f, 0, default, Main.rand.NextFloat(0.5f, 1f));
|
||||
dust.noGravity = true;
|
||||
dust.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
|
||||
}
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType<GaussRifleExplosion>(), Projectile.damage / 3, 0, Projectile.owner);
|
||||
}
|
||||
for (int i = 0; i < MathHelper.Clamp(5 - Projectile.numHits, 1, 5); i++)
|
||||
{
|
||||
Particle Square = new GlowSquareParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(1f, 3f), false, 18, Main.rand.NextFloat(0.8f, 1.8f), Color.Goldenrod, false, Main.rand.NextFloat(-3, 3));
|
||||
GeneralParticleHandler.SpawnParticle(Square);
|
||||
}
|
||||
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.84f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5), 66);
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 1.1f);
|
||||
dust.velocity = Projectile.velocity.RotateRandom(0.3f) * Main.rand.NextFloat(1, 3);
|
||||
dust.noGravity = true;
|
||||
dust.color = Main.rand.NextBool() ? Color.LightYellow : Color.Gold;
|
||||
dust.noLight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class GaussRifleExplosion : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 200;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 12;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
if (target != null && !CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 5 && Vector2.Distance(target.Center, Projectile.Center) < 500)
|
||||
{
|
||||
target.velocity += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.4f;
|
||||
target.Center += target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.8f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(10))
|
||||
SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center);
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center);
|
||||
}
|
||||
|
||||
float idealFlyAcceleration = 0.18f;
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace CalamityMod.Projectiles.Summon.AndromedaUI
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center);
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center);
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center);
|
||||
int damage = (int)player.GetTotalDamage<SummonDamageClass>().ApplyTo(LaserBaseDamage);
|
||||
|
||||
// 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
@@ -353,7 +353,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
public void ExitChargeModeEarly(Player player)
|
||||
{
|
||||
RightIconCooldown = RightIconAttackTime;
|
||||
SoundEngine.PlaySound(GaussRifle.FireSound, Projectile.Center);
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/MechGaussRifle"), Projectile.Center);
|
||||
SpecialAttackExplosionDust(player);
|
||||
}
|
||||
public void SpecialAttackExplosionDust(Player player)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user