Merge: Megalodon Line Rework by Sunny
No files matched your search
@@ -433,6 +433,7 @@ namespace CalamityMod.CalPlayer
|
||||
public int murasamaHitCooldown = 0;
|
||||
public int giantShellPostHit = 0;
|
||||
public int tortShellPostHit = 0;
|
||||
public int sharkGunDamageScaling = 0;
|
||||
public int MiniSwarmerCooldown = 0;
|
||||
public float SulphWaterPoisoningLevel;
|
||||
public float holyInfernoFadeIntensity;
|
||||
|
||||
@@ -456,6 +456,15 @@ namespace CalamityMod.CalPlayer
|
||||
GungeonMusicSystem.GUN();
|
||||
}
|
||||
|
||||
// Used by Megalodon, Seadragon & Voidragon, allows bullets to track their damage scaling
|
||||
if (cgp.sharkBullets)
|
||||
{
|
||||
if (proj.numHits == 0)
|
||||
{
|
||||
sharkGunDamageScaling++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cgp.fireBullet)
|
||||
{
|
||||
target.AddBuff(BuffID.OnFire3, 60);
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
sampler noiseTexture : register(s1);
|
||||
sampler noiseTexture2 : register(s2);
|
||||
|
||||
float time;
|
||||
float glowPower;
|
||||
float overallColorStrength;
|
||||
float2 noiseScale;
|
||||
float2 edgeFadeoutThreshold;
|
||||
float3 innerColor;
|
||||
float3 outerColor;
|
||||
float3 overallColor;
|
||||
float3 tipColor;
|
||||
matrix uWorldViewProjection;
|
||||
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float3 TextureCoordinates : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Color : COLOR0;
|
||||
float3 TextureCoordinates : TEXCOORD0;
|
||||
};
|
||||
|
||||
VertexShaderOutput VertexShaderFunction(in VertexShaderInput input)
|
||||
{
|
||||
VertexShaderOutput output = (VertexShaderOutput) 0;
|
||||
float4 pos = mul(input.Position, uWorldViewProjection);
|
||||
output.Position = pos;
|
||||
output.Color = input.Color;
|
||||
output.TextureCoordinates = input.TextureCoordinates;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float InverseLerp(float from, float to, float x)
|
||||
{
|
||||
return saturate((x - from) / (to - from));
|
||||
}
|
||||
|
||||
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 color = input.Color;
|
||||
float2 coords = input.TextureCoordinates;
|
||||
|
||||
// Account for texture distortion artifacts.
|
||||
coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5;
|
||||
|
||||
// Fade out at the horizontal and vertical ends of the streak.
|
||||
float horizonatalDistanceFromCenter = distance(0.5, coords.y);
|
||||
float opacity = smoothstep(0.5, 0.5 - edgeFadeoutThreshold, horizonatalDistanceFromCenter);
|
||||
|
||||
// Calculate the main nosie color and distortion.
|
||||
float4 noiseDistortion = tex2D(noiseTexture, coords * float2(4, 2) + float2(time * -0.72, time * 0.51));
|
||||
float4 noiseColor = tex2D(noiseTexture, coords * noiseScale + float2(time * -2.42 - noiseDistortion.r * 0.8, time * -1.33 + noiseDistortion.r * 0.8));
|
||||
|
||||
// Calculate how much a pixel should glow from the center outwards.
|
||||
float glow = pow(0.1 / horizonatalDistanceFromCenter, glowPower);
|
||||
|
||||
// Render as white near the tip of the flame jet, then ease into the inner and outer colors of the jet.
|
||||
float3 flameBodyColor = lerp(tipColor, lerp(outerColor, innerColor, opacity), InverseLerp(0, 0.092, coords.x));
|
||||
float3 finalFlameColor = lerp(flameBodyColor, overallColor, overallColorStrength);
|
||||
|
||||
float4 returnColor = (color * float4(finalFlameColor, 1) + noiseColor * glow) * opacity;
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass LaserPass
|
||||
{
|
||||
VertexShader = compile vs_3_0 VertexShaderFunction();
|
||||
PixelShader = compile ps_3_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -254,6 +254,9 @@ namespace CalamityMod.Effects
|
||||
|
||||
// The distorted circular effect seen emanating from the distortion rift during DoG's fight.
|
||||
internal static Asset<Effect> DoGRiftAuraShader;
|
||||
|
||||
// The shader effect used for Voidragon's Abyssal Fire laser projectile.
|
||||
internal static Asset<Effect> AbyssalFireShader;
|
||||
#endregion
|
||||
|
||||
#region Big E's Shaders
|
||||
@@ -513,6 +516,9 @@ namespace CalamityMod.Effects
|
||||
|
||||
DoGRiftAuraShader = LoadShader("DoGRiftAuraShader");
|
||||
RegisterMiscShader(DoGRiftAuraShader, "DoGRiftAuraPass", "DoGRiftAura");
|
||||
|
||||
AbyssalFireShader = LoadShader("AbyssalFireShader");
|
||||
RegisterMiscShader(AbyssalFireShader, "LaserPass", "AbyssalFire");
|
||||
#endregion
|
||||
|
||||
#region Loading Big E's Shaders
|
||||
|
||||
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 212 B |
|
After Width: | Height: | Size: 315 B |
@@ -4,8 +4,8 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
@@ -65,7 +65,6 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent;
|
||||
}
|
||||
}
|
||||
@@ -2,72 +2,60 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Abyss;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class Megalodon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
private bool fireWater = false;
|
||||
public int sharkGunDamageScaling = 0;
|
||||
public static int AmmoSavedPercent = 50;
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 72;
|
||||
Item.height = 32;
|
||||
Item.damage = 29;
|
||||
Item.width = 102;
|
||||
Item.height = 43;
|
||||
Item.damage = 58;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 6;
|
||||
Item.useAnimation = 6;
|
||||
Item.useTime = 4;
|
||||
Item.useAnimation = 4;
|
||||
Item.channel = true;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 2.5f;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.UseSound = null;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<MegalodonShot>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.shoot = ModContent.ProjectileType<MegalodonHoldout>();
|
||||
Item.shootSpeed = 2f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Reposition to the gun's tip + add some inaccuracy
|
||||
Vector2 newPos = position + new Vector2(64f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(3f));
|
||||
|
||||
// Fire either the bullet or the water jet, depending on cadence.
|
||||
int projectileToFire = fireWater ? Item.shoot : type;
|
||||
Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI);
|
||||
|
||||
// Always fires a close range water blast.
|
||||
// It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous.
|
||||
int waterRingDamage = (int)(damage * 0.5f);
|
||||
float boostedKB = knockback + 7f; // Stronger guaranteed KB than Archerfish for mid-late Hardmode
|
||||
Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.5f, 0.6f), ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
|
||||
// Swap between firing bullets and water jets each shot.
|
||||
fireWater = !fireWater;
|
||||
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
|
||||
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Does not consume ammo when firing water jets.
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => !fireWater;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.Megashark).
|
||||
AddIngredient<Archerfish>().
|
||||
AddIngredient<Voidstone>(10).
|
||||
AddIngredient<DepthCells>(10).
|
||||
AddIngredient<DepthCells>(15).
|
||||
AddIngredient<PlantyMush>(10).
|
||||
AddTile(TileID.MythrilAnvil).
|
||||
Register();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -8,6 +8,7 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
@@ -15,83 +16,42 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public class Seadragon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
// Odd shots are bullets (including the first). Even shots are water jets.
|
||||
// The 9th shot adds a rocket. The 17th shot adds an ultra powerful muzzle blast, then resets the counter to 2.
|
||||
// This is intentional so you don't get the muzzle blast instantly when you start firing and have to play around it.
|
||||
private int shotCounter = 1;
|
||||
public static int AmmoSavedPercent = 66;
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 90;
|
||||
Item.height = 38;
|
||||
Item.damage = 60;
|
||||
Item.damage = 154;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 5;
|
||||
Item.useAnimation = 5;
|
||||
Item.useTime = 3;
|
||||
Item.useAnimation = 3;
|
||||
Item.channel = true;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 2.5f;
|
||||
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.UseSound = null;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<MegalodonShot>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.shoot = ModContent.ProjectileType<SeadragonHoldout>();
|
||||
Item.shootSpeed = 2f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Reposition to the gun's tip + add some inaccuracy
|
||||
Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f));
|
||||
|
||||
// Fire either the bullet or the water jet, depending on cadence.
|
||||
bool fireWater = shotCounter % 2 == 0;
|
||||
int projectileToFire = fireWater ? Item.shoot : type;
|
||||
Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI);
|
||||
|
||||
// Always fires a close range water blast.
|
||||
// It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous.
|
||||
int waterRingDamage = (int)(damage * 0.5f);
|
||||
float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying.
|
||||
Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
|
||||
// Check cadence position to determine which bonus projectile to add, if any.
|
||||
bool fireRocket = shotCounter == 9;
|
||||
bool muzzleBlast = shotCounter == 17;
|
||||
|
||||
// Rockets have their own more chaotic spread than bullets.
|
||||
if (fireRocket)
|
||||
{
|
||||
int rocketDamage = damage * 3;
|
||||
Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType<SeaDragonRocket>(), rocketDamage, knockback, player.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item109, player.Center);
|
||||
}
|
||||
|
||||
// Muzzle blasts are always directly in line with the gun's muzzle.
|
||||
if (muzzleBlast)
|
||||
{
|
||||
int muzzleBlastDamage = damage * 12; // "This might be too much but it's every 18th shot..." Narrator: 25x was in fact too much.
|
||||
float muzzleBlastKB = knockback + 12f;
|
||||
Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType<SeaDragonMuzzleBlast>(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI);
|
||||
|
||||
// Play additional sound for muzzle blasts
|
||||
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position);
|
||||
}
|
||||
|
||||
// Increment and then reset the shot counter so the pattern loops indefinitely. The muzzle blast replaces the first bullet in the repeating pattern.
|
||||
++shotCounter;
|
||||
if (shotCounter > 17)
|
||||
shotCounter = 2;
|
||||
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
|
||||
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Does not consume ammo when firing water jets.
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => shotCounter % 2 == 1;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -11,65 +11,54 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
[LegacyName("Megafleet")]
|
||||
// Long live Megafleet. You will be missed. Maybe one day we can revive you.
|
||||
[LegacyName("Megafleet")]
|
||||
public class Voidragon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
private int shotType = 1;
|
||||
|
||||
public static int AmmoSavedPercent = 50;
|
||||
public int sharkGunDamageScaling = 0;
|
||||
public static int AmmoSavedPercent = 66;
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 96;
|
||||
Item.height = 38;
|
||||
Item.damage = 240;
|
||||
Item.damage = 1400;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 5;
|
||||
Item.useAnimation = 5;
|
||||
Item.useTime = 3;
|
||||
Item.useAnimation = 3;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 5f;
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.UseSound = null;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
Item.shootSpeed = 18f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.shoot = ModContent.ProjectileType<VoidragonHoldout>();
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice;
|
||||
Item.rare = ModContent.RarityType<HotPink>();
|
||||
Item.Calamity().devItem = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
float SpeedX = velocity.X + (float)Main.rand.Next(-5, 6) * 0.05f;
|
||||
float SpeedY = velocity.Y + (float)Main.rand.Next(-5, 6) * 0.05f;
|
||||
|
||||
if (shotType > 2)
|
||||
shotType = 1;
|
||||
|
||||
if (shotType == 1)
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
||||
else
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<Projectiles.Ranged.Voidragon>(), damage, knockback, player.whoAmI);
|
||||
|
||||
shotType++;
|
||||
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<VoidragonTentacle>(), damage, knockback, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f));
|
||||
|
||||
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
|
||||
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent && shotType % 2 == 1;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<Seadragon>().
|
||||
AddIngredient<DragonsBreath>().
|
||||
AddIngredient<ShadowspecBar>(5).
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
|
||||
@@ -710,8 +710,10 @@ Megalodon: {
|
||||
DisplayName: Megalodon
|
||||
Tooltip:
|
||||
'''
|
||||
Rapidly fires alternating bullets and pressurized water jets
|
||||
Water jets consume no ammo
|
||||
Loads a 30 round magazine of bullets and pressurized water jets that are rapidly unleashed
|
||||
After firing, the gun unleashes a powerful homing rocket before reloading
|
||||
Rocket damage is based on how many shots hit
|
||||
{$CommonItemTooltip.PercentChanceToSaveAmmo}
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -1072,9 +1074,10 @@ Seadragon: {
|
||||
DisplayName: Seadragon
|
||||
Tooltip:
|
||||
'''
|
||||
Unleashes a deluge of alternating bullets and pressurized water jets
|
||||
Additionally fires rockets and emits devastating muzzle blasts
|
||||
Water jets consume no ammo
|
||||
Loads a 50 round magazine of alternating bullets and pressurized water jets
|
||||
Water jets summon small fish that swim around you
|
||||
When all bullets are fired, summoned fish swarm the cursor while you reload
|
||||
{$CommonItemTooltip.PercentChanceToSaveAmmo}
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -1485,9 +1488,11 @@ Voidragon: {
|
||||
DisplayName: Voidragon
|
||||
Tooltip:
|
||||
'''
|
||||
Fires [cbuff:CalamityMod/Voidfrost] blasts that explode every other shot
|
||||
Shoots demon flame tentacles alongside every shot
|
||||
Void blasts consume no ammo and bullets have a {0}% chance to save ammo
|
||||
Loads a 50 round magazine of alternating bullets and concentrated void blasts
|
||||
When all bullets are fired, the gun unleashes an enormous jet of abyssal fire
|
||||
The power of the abyssal fire scales with the amount of shots hit
|
||||
{$CommonItemTooltip.PercentChanceToSaveAmmo}
|
||||
[c/620BB0:'Fade to black']
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -267,6 +267,10 @@ WaterSpout.DisplayName: Spout
|
||||
WildfireBloomFire.DisplayName: Wildfire Fire
|
||||
WildfireBloomFlare.DisplayName: Wildfire Flare
|
||||
WulfrumScrapBullet.DisplayName: High Speed Scrap
|
||||
AbyssalFire.DisplayName: Abyssal Fire
|
||||
BlahajBlast.DisplayName: Blahaj Blast
|
||||
MegalodonRocket.DisplayName: Megalodon Rocket
|
||||
VoidBlast.DisplayName: Void Blast
|
||||
OmniSniperShot.DisplayName: Omni Sniper Shot
|
||||
OmniGrenade.DisplayName: Omni Grenade
|
||||
OmniShotgunShot.DisplayName: Omni Shotgun Shot
|
||||
@@ -150,6 +150,11 @@ namespace CalamityMod.Projectiles
|
||||
/// </summary>
|
||||
public bool fireBullet = false;
|
||||
/// <summary>
|
||||
/// If true, allows projectiles to track damage scaling.<br/>
|
||||
/// Used by Megalodon and Voidragon.
|
||||
/// </summary>
|
||||
public bool sharkBullets = false;
|
||||
/// <summary>
|
||||
/// If true, adds an ice trail to the projectile, and makes it inflict Frostbite.<br/>
|
||||
/// Used by Thermocline Blaster.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Packets.Entities;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.Utilities.Daybreak.Buffers;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
[PierceResistException]
|
||||
public class AbyssalFire : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
|
||||
public Vector2[] ControlPoints;
|
||||
|
||||
public static int MaxLaserControlPoints => 32;
|
||||
|
||||
public static int MaxLaserLength => 3330;
|
||||
|
||||
public static int MaxLaserWidth => 90;
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public Projectile VoidragonHoldout => Main.projectile[(int)Projectile.ai[0]];
|
||||
|
||||
public ref float LaserLength => ref Projectile.ai[1];
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = MaxLaserWidth;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
LaserLength = 0.05f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// If the owner is no longer able to cast the beam, kill it.
|
||||
if (Owner.CantUseHoldout() || VoidragonHoldout is null)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// Decide where to position the laserbeam.
|
||||
Vector2 circlePointDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction);
|
||||
Projectile.Center = VoidragonHoldout.ModProjectile<VoidragonHoldout>().GunTipPosition - ((Projectile.velocity * 12f).RotatedBy(-0.02f * Projectile.direction));
|
||||
|
||||
int beamTimer = VoidragonHoldout.ModProjectile<VoidragonHoldout>().beamTimer;
|
||||
float beamWidthInterpolant = Utils.GetLerpValue(0, 25, beamTimer, true);
|
||||
|
||||
// Set the control points for the primitive drawing.
|
||||
ControlPoints ??= new Vector2[MaxLaserControlPoints];
|
||||
for (int i = 0; i < MaxLaserControlPoints; i++)
|
||||
ControlPoints[i] = Projectile.Center + Projectile.velocity * i / (ControlPoints.Length - 1f) * MaxLaserLength;
|
||||
|
||||
// Grow and shrink depending on how long left the laser has to remain active.
|
||||
Projectile.scale = MathHelper.Lerp(0f, 1f, CalamityUtils.ExpOutEasing(beamWidthInterpolant, 2));
|
||||
LaserLength = MathHelper.Lerp(LaserLength, 1f, 0.032f);
|
||||
|
||||
// Update aim.
|
||||
UpdateAim();
|
||||
|
||||
// Spawn a bunch of particles along the length of the laser.
|
||||
if (Projectile.scale >= 0.25f)
|
||||
{
|
||||
BezierCurve curve = new(ControlPoints);
|
||||
float tipRatio = 0.042f;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 tipSpawnPosition = curve.Evaluate(Main.rand.NextFloat(0f, tipRatio));
|
||||
Vector2 bodySpawnPosition = curve.Evaluate(Main.rand.NextFloat(tipRatio, 1f));
|
||||
Vector2 fireVelocity = Owner.SafeDirectionTo(Main.MouseWorld).RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(25f, 30f);
|
||||
|
||||
Color fireColorBackground = Color.Lerp(Color.DarkViolet, Color.Black, 0.25f);
|
||||
|
||||
int fireLifetime = Main.rand.Next(45, 60);
|
||||
float fireScale = Main.rand.NextFloat(1.75f, 2.25f) * Projectile.scale;
|
||||
float fireOpacity = Main.rand.NextFloat(0.65f, 0.95f);
|
||||
|
||||
HeavySmokeParticle abyssalFlamesBodyBackground = new(bodySpawnPosition, fireVelocity, fireColorBackground, fireLifetime, fireScale, 1f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), false);
|
||||
GeneralParticleHandler.SpawnParticle(abyssalFlamesBodyBackground, true, GeneralDrawLayer.BeforeProjectiles);
|
||||
|
||||
HeavySmokeParticle abyssalFlamesBodyForeground = new(bodySpawnPosition, fireVelocity, Main.rand.NextBool(4) ? Color.White : Color.Purple, fireLifetime, fireScale * 0.6f, 0.8f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true);
|
||||
GeneralParticleHandler.SpawnParticle(abyssalFlamesBodyForeground, true, GeneralDrawLayer.AfterProjectiles);
|
||||
|
||||
HeavySmokeParticle abyssFlamesTip = new(tipSpawnPosition, fireVelocity, Color.White, fireLifetime, fireScale * 0.52f, 0.3f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true);
|
||||
GeneralParticleHandler.SpawnParticle(abyssFlamesTip, true, GeneralDrawLayer.AfterProjectiles);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 fireVelocity = Owner.SafeDirectionTo(Main.MouseWorld).RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(15f, 20f);
|
||||
HeavySmokeParticle whiteFlames = new(Projectile.Center - Projectile.velocity * 8f, fireVelocity, Color.White, Main.rand.Next(15, 20), 0.64f, 0.7f, Main.rand.NextFloat(0.02f, 0.1f) * Main.rand.NextBool().ToDirectionInt(), true);
|
||||
GeneralParticleHandler.SpawnParticle(whiteFlames, true, GeneralDrawLayer.AfterDusts);
|
||||
}
|
||||
}
|
||||
|
||||
// Shake the screen slightly.
|
||||
if (Owner.Calamity().GeneralScreenShakePower < 1.15f)
|
||||
Owner.Calamity().GeneralScreenShakePower = MathHelper.Lerp(0f, 1.15f, Projectile.scale / 2f);
|
||||
|
||||
// Make the beam cast light along its length. The brightness of the light is reliant on the scale of the beam.
|
||||
DelegateMethods.v3_1 = Color.DarkViolet.ToVector3() * Projectile.scale * 0.4f;
|
||||
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * MaxLaserLength, Projectile.width * Projectile.scale, DelegateMethods.CastLight);
|
||||
}
|
||||
|
||||
public void UpdateAim()
|
||||
{
|
||||
// Only execute the aiming code for the owner.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
Vector2 newAimDirection = VoidragonHoldout.velocity.SafeNormalize(Vector2.UnitY);
|
||||
|
||||
// Sync if the direction is different from the old one.
|
||||
// Spam caps are ignored due to the frequency of this happening.
|
||||
if (newAimDirection != Projectile.velocity)
|
||||
{
|
||||
Projectile.netUpdate = true;
|
||||
Projectile.netSpam = 0;
|
||||
}
|
||||
|
||||
Projectile.velocity = newAimDirection;
|
||||
}
|
||||
private float PrimitiveWidthFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = Projectile.scale * MaxLaserWidth * (1 + MathF.Pow(Utils.GetLerpValue(450, 500, VoidragonHoldout.ModProjectile<VoidragonHoldout>().beamTimer, true), 3.5f) * 4);
|
||||
float shrinkRatio = 0.018f;
|
||||
|
||||
//if (completionRatio < shrinkRatio)
|
||||
// width = MathF.Sin(completionRatio / shrinkRatio * MathHelper.PiOver2) * maxBodyWidth + shrinkRatio;
|
||||
//else
|
||||
// width = Utils.Remap(completionRatio, shrinkRatio, 1f, maxBodyWidth, 0f);
|
||||
|
||||
return maxBodyWidth * Utils.GetLerpValue(0f, 0.05f, completionRatio, true) * Utils.GetLerpValue(LaserLength, LaserLength - 0.1f, completionRatio, true);
|
||||
}
|
||||
|
||||
private Color PrimitiveColorFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
|
||||
return Color.White * Projectile.Opacity;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Asset<Texture2D> mainStreakTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise");
|
||||
int beamTimer = VoidragonHoldout.ModProjectile<VoidragonHoldout>().beamTimer;
|
||||
float beamWidthInterpolant = Utils.GetLerpValue(500, 460, beamTimer, true);
|
||||
|
||||
if (ControlPoints is null)
|
||||
return false;
|
||||
|
||||
Main.spriteBatch.End(out var snapshot);
|
||||
|
||||
var device = Main.instance.GraphicsDevice;
|
||||
using var lease = RenderTargetPool.Shared.Rent(
|
||||
device,
|
||||
Main.screenWidth / 2,
|
||||
Main.screenHeight / 2,
|
||||
RenderTargetDescriptor.Default
|
||||
);
|
||||
|
||||
using (lease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
MiscShaderData shader = GameShaders.Misc["CalamityMod:AbyssalFire"];
|
||||
shader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
|
||||
shader.Shader.Parameters["glowPower"].SetValue(0.8f);
|
||||
shader.Shader.Parameters["overallColorStrength"].SetValue(1f - beamWidthInterpolant);
|
||||
shader.Shader.Parameters["edgeFadeoutThreshold"].SetValue(0.46f);
|
||||
shader.Shader.Parameters["noiseScale"].SetValue(new Vector2(4f, 0.5f));
|
||||
shader.Shader.Parameters["innerColor"].SetValue(Color.DarkViolet.ToVector3());
|
||||
shader.Shader.Parameters["outerColor"].SetValue(Color.Black.ToVector3());
|
||||
shader.Shader.Parameters["overallColor"].SetValue(Color.White.ToVector3());
|
||||
shader.Shader.Parameters["tipColor"].SetValue(Color.White.ToVector3());
|
||||
|
||||
device.Textures[1] = mainStreakTexture.Value;
|
||||
|
||||
PrimitiveRenderer.RenderTrail(ControlPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: shader, useUnscaledMatrices: true, capStyle: PrimitiveCapStyle.Flat), ControlPoints.Length);
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.End();
|
||||
|
||||
Main.spriteBatch.Begin(snapshot);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * MaxLaserLength);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 180);
|
||||
int bonusDamage = 200 * Owner.Calamity().sharkGunDamageScaling;
|
||||
if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage)
|
||||
{
|
||||
target.Calamity().demonicFlamesBonusDamage = bonusDamage;
|
||||
target.AddBuff(ModContent.BuffType<DemonicFlames>(), 180);
|
||||
// Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
DemonicFlamesSyncPacket.Send(target);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class ArcherfishHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Archerfish>();
|
||||
public override float MaxOffsetLengthFromArm => 24f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -1f;
|
||||
public override float OffsetYDownwards => 5f;
|
||||
|
||||
public int Time = 0;
|
||||
public int shotCounter = 0;
|
||||
public int framesBetweenShots = 0;
|
||||
public bool PostVolley = false;
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
//If the player is dead, kill the holdout.
|
||||
if (Owner.CantUseHoldout() || !PostVolley && HeldItem.type != Owner.HeldItem.type)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
//Set the scaling to 0 as soon as the holdout spawns
|
||||
if (Time == 1)
|
||||
{
|
||||
Owner.Calamity().sharkGunDamageScaling = 0;
|
||||
}
|
||||
if (Time >= 10)
|
||||
{
|
||||
if (framesBetweenShots == 0 && shotCounter <= 25)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15;
|
||||
#region Debug Text Display
|
||||
//Main.NewText(shotCounter);
|
||||
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
|
||||
#endregion
|
||||
#region Visuals and Sounds
|
||||
SoundEngine.PlaySound(SoundID.Item85, Projectile.Center);
|
||||
#endregion
|
||||
|
||||
//How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate
|
||||
framesBetweenShots = 6;
|
||||
OffsetLengthFromArm -= 3f;
|
||||
//Here we detect which ammo the bullets will use
|
||||
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4));
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<ArcherfishShot>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
shotCounter++;
|
||||
//Frame time is much longer due to Archerfish working differently, and handling both the shot and the "reload" on the same step
|
||||
if (shotCounter == 25)
|
||||
framesBetweenShots = 100;
|
||||
}
|
||||
if (framesBetweenShots > 0)
|
||||
framesBetweenShots--;
|
||||
}
|
||||
if (shotCounter == 25 && framesBetweenShots > 0)
|
||||
{
|
||||
//Holdout cannot be killed during the final shot and cooldown
|
||||
PostVolley = true;
|
||||
Owner.channel = true;
|
||||
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the final shot doing 0 damage
|
||||
if (Owner.Calamity().sharkGunDamageScaling == 0)
|
||||
{
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
//Pauses before triggering the final water blast. This allows extra water streams time to hit. Increasing this number reduces the delay, but may also cause the gun to become inconsistent
|
||||
if (framesBetweenShots == 80)
|
||||
{
|
||||
SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), Owner.Center);
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), Owner.Center);
|
||||
//Fires the water jet. Damage is 20% of base, multiplied by how many shots hit.
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30, ModContent.ProjectileType<MantisClawJet>(), (int)(Projectile.damage * 0.2f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
#region Post Firing Visuals and Sounds
|
||||
//After the water blast is fired, make the fish "sweat" during the reload
|
||||
//I don't think this is how science works
|
||||
if (framesBetweenShots % 6 == 0 && framesBetweenShots <= 80)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
int bloodLifetime = Main.rand.Next(12, 15);
|
||||
float bloodScale = Main.rand.NextFloat(0.4f, 0.6f);
|
||||
Color bloodColor = Color.Lerp(Color.LightBlue * 0.7f, Color.LightBlue, Main.rand.NextFloat());
|
||||
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
|
||||
|
||||
if (Main.rand.NextBool(20))
|
||||
bloodScale *= 1.5f;
|
||||
|
||||
float randomSpeedMultiplier = Main.rand.NextFloat(0.8f, 1.5f);
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier;
|
||||
bloodVelocity.Y -= 3f;
|
||||
BloodParticle blood = new BloodParticle(Projectile.Center + (Projectile.velocity * 14f).RotatedBy(-0.8f * Projectile.direction), bloodVelocity, bloodLifetime, bloodScale, bloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
}
|
||||
//Takes a heavy breath every 25 frames after the final shot is fired
|
||||
if (framesBetweenShots % 25 == 0 && framesBetweenShots <= 75)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4;
|
||||
Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.White, Main.rand.Next(20, 40 + 1), Main.rand.NextFloat(0.2f, 0.3f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.Item111 with { Pitch = 0.05f, PitchVariance = 0.25f, MaxInstances = -1 }, Projectile.Center);
|
||||
OffsetLengthFromArm -= 4.5f;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
if (shotCounter == 25 && framesBetweenShots == 0)
|
||||
{
|
||||
if (framesBetweenShots == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.Center);
|
||||
//After firing the water blast, kill the projectile to allow left click to be held down
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Time < 2)
|
||||
return false;
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
using System.Composition.Hosting.Core;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class BlahajBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static int Lifetime = 600;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 8;
|
||||
Projectile.height = 8;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 4;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.MaxUpdates = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
|
||||
bubble.timeLeft = 9 + Main.rand.Next(7);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
if (Projectile.timeLeft <= Lifetime - 4)
|
||||
{
|
||||
if (Projectile.ai[0] == 0)
|
||||
{
|
||||
Particle transspark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1.1f, Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.DeepSkyBlue : Color.White) : Color.DeepPink);
|
||||
GeneralParticleHandler.SpawnParticle(transspark);
|
||||
}
|
||||
else
|
||||
{
|
||||
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1.1f, Color.Aquamarine);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
if (Main.rand.NextBool(8))
|
||||
{
|
||||
MediumMistParticle smoke = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(25, 25), -Projectile.velocity * 0.05f, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Color.DarkBlue, 0.5f, 180, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
}
|
||||
if (Projectile.timeLeft <= Lifetime - 8)
|
||||
{
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), ModContent.DustType<LightDust>(), -Projectile.velocity);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.9f, 1.1f);
|
||||
dust.color = Main.rand.NextBool() ? Color.DarkBlue : Color.DarkBlue * 0.5f;
|
||||
|
||||
Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 30, Main.rand.NextFloat(0.4f, 0.6f), Color.RoyalBlue);
|
||||
GeneralParticleHandler.SpawnParticle(trail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
// Bubbles
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411);
|
||||
bubble.timeLeft = 9 + Main.rand.Next(7);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
//Only spawn rocket on the first hit
|
||||
if (Projectile.numHits == 0 && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType<SeaDragonRocket>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
|
||||
fishy.ai[2] = ((Owner.Calamity().sharkGunDamageScaling + 1) * 0.02f) + 0.1f;
|
||||
}
|
||||
OnHitEffects();
|
||||
}
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
//Only spawn rocket on the first hit
|
||||
if (Projectile.numHits == 0 && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType<SeaDragonRocket>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
|
||||
fishy.ai[2] = ((Owner.Calamity().sharkGunDamageScaling + 1) * 0.02f) + 0.1f;
|
||||
}
|
||||
OnHitEffects();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHitEffects()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int bloodLifetime = Main.rand.Next(22, 25);
|
||||
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat());
|
||||
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
|
||||
|
||||
if (Main.rand.NextBool(20))
|
||||
bloodScale *= 2f;
|
||||
|
||||
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier;
|
||||
bloodVelocity.Y -= 5f;
|
||||
BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class MegalodonHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Megalodon>();
|
||||
public override float MaxOffsetLengthFromArm => 24f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -1f;
|
||||
public override float OffsetYDownwards => 5f;
|
||||
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 50).RotatedBy(0.13f * Projectile.direction);
|
||||
|
||||
public int Time = 0;
|
||||
public int shotCounter = 0;
|
||||
public int framesBetweenShots = 0;
|
||||
public bool swapType = false;
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
//If the player is dead, kill the holdout.
|
||||
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
//Pause to give the effect of reloading
|
||||
if (Time == 30)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "MegalodonMag";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
//Set the scaling to 0 whenever it reloads
|
||||
Owner.Calamity().sharkGunDamageScaling = 0;
|
||||
}
|
||||
if (Time >= 90)
|
||||
{
|
||||
if (framesBetweenShots == 0 && shotCounter <= 31)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
|
||||
#region Debug Text Display
|
||||
//Main.NewText(shotCounter);
|
||||
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
|
||||
#endregion
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.4f, PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center);
|
||||
Particle sparker = new CritSpark(GunTipPosition, Vector2.Zero, Color.Gold, Color.LightGoldenrodYellow, 1.7f, 3, 0.5f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker);
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate
|
||||
framesBetweenShots = 4;
|
||||
OffsetLengthFromArm -= 3f;
|
||||
//Here we detect which ammo the bullets will use
|
||||
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
|
||||
//Alternate between shooting bullets and water streams. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (!swapType)
|
||||
{
|
||||
Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
CalamityGlobalProjectile cgp = scalingShot.Calamity();
|
||||
cgp.sharkBullets = true;
|
||||
//Only eject casings from the gun if bullets are fired, preventing too many at once
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "MegalodonCasing";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
}
|
||||
if (swapType)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<MegalodonShot>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
swapType = !swapType;
|
||||
}
|
||||
shotCounter++;
|
||||
//Allow a pause before firing the rocket. This allows the final bullet a chance to hit before the rocket is fired. Lowering this number reduces the delay, but may also cause the gun to become inconsistent
|
||||
if (shotCounter == 30)
|
||||
framesBetweenShots = 18;
|
||||
}
|
||||
if (framesBetweenShots > 0)
|
||||
framesBetweenShots--;
|
||||
}
|
||||
if (shotCounter == 30 && framesBetweenShots == 0)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
|
||||
//Debug Text
|
||||
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0.2f }, Projectile.Center);
|
||||
for (int i = 0; i <= 13; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
|
||||
dust.noGravity = false;
|
||||
dust.color = Color.White;
|
||||
|
||||
Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f));
|
||||
dust2.noGravity = true;
|
||||
dust2.scale = Main.rand.NextFloat(0.52f, 0.72f);
|
||||
dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f));
|
||||
}
|
||||
for (int i = 0; i < 14; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.RoyalBlue, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
float rotation = Projectile.velocity.ToRotation();
|
||||
Particle pulse = new DirectionalPulseRing(GunTipPosition, shootVelocity / 4, Color.Gray, new Vector2(1f, 2.5f), rotation, 0.03f, 0.3f, 20);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
//Extra sound and muzzle flash if the scaling is at max
|
||||
if (Owner.Calamity().sharkGunDamageScaling == 30)
|
||||
{
|
||||
SoundStyle fireperfect = new("CalamityMod/Sounds/Item/ShadowboltReflect");
|
||||
SoundEngine.PlaySound(fireperfect with { Volume = 0.6f, Pitch = 0f }, GunTipPosition);
|
||||
GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 10, 2f, 2.68f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the rocket doing 0 damage
|
||||
if (Owner.Calamity().sharkGunDamageScaling == 0)
|
||||
{
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
//Fire the rocket. Damage is 50% of base, multiplied by how many shots the player hits
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<MegalodonRocket>(), (int)(Projectile.damage * 0.5f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner);
|
||||
|
||||
//After firing the rocket, reset all variables to allow left click to be held down
|
||||
Time = 2;
|
||||
shotCounter = 0;
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Time < 2)
|
||||
return false;
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Tiles.Abyss;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class MegalodonRocket : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public static int Lifetime = 600;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 46;
|
||||
Projectile.height = 38;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.timeLeft = 600;
|
||||
AIType = ProjectileID.Bullet;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//Rotation
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) * Projectile.direction;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f);
|
||||
if (Projectile.timeLeft <= Lifetime - 6)
|
||||
{
|
||||
AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.Gold * 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark2 = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, Main.rand.Next(9, 12 + 1), 0.4f, Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Torch, Projectile.velocity, 500, default, 0.5f);
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 1.5f);
|
||||
dust.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3);
|
||||
dust.noGravity = true;
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, DustID.Smoke, Projectile.velocity, 500, default, 0.5f);
|
||||
dust2.scale = Main.rand.NextFloat(0.7f, 1.5f);
|
||||
dust2.velocity = Projectile.velocity * Main.rand.NextFloat(-3, 3);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 12f, 20f);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MegalodonMissileMax") with { Volume = 1.5f }, Projectile.position);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundEngine.PlaySound(AbyssGravel.MineSound, Projectile.position);
|
||||
SoundEngine.PlaySound(GiantClam.SlamSound, Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.5f), Projectile.position);
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Volume = 0.6f, Pitch = 0.8f }, Projectile.position);
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 1f, 0f, 25));
|
||||
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 0.5f, 0f, 15));
|
||||
|
||||
for (int i = 0; i < 8; i++) GeneralParticleHandler.SpawnParticle(new BloodParticle2(Projectile.Center, new Vector2(Main.rand.NextFloat(6, 12), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), 12, Main.rand.NextFloat(0.3f, 0.4f), Color.DarkGoldenrod * 0.8f));
|
||||
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RoyalBlue * 0.5f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.CornflowerBlue, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.07f, 15);
|
||||
GeneralParticleHandler.SpawnParticle(pulse2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.5f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.6f, 1.5f), 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1004 B |
@@ -1,7 +1,8 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
@@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static int Lifetime = 600;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 8;
|
||||
@@ -20,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.MaxUpdates = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
@@ -28,7 +31,6 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Bubbles
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
|
||||
@@ -36,15 +38,25 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
|
||||
// Water trail
|
||||
for (int i = 0; i < 6; i++)
|
||||
if (Projectile.timeLeft <= Lifetime - 4)
|
||||
{
|
||||
Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Wet, 0f, 0f, 100);
|
||||
water.noGravity = true;
|
||||
water.velocity = Projectile.velocity * 0.5f;
|
||||
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1f, Color.RoyalBlue * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 45 : 56, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.01f, 0.3f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.5f, 0.9f);
|
||||
}
|
||||
}
|
||||
}
|
||||
//We use TileCollide and Onhit instead of OnKill due to it having pierce
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
|
||||
OnHitEffects();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
@@ -57,7 +69,55 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
//Only increase damage of the rocket on the first hit
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
OnHitEffects();
|
||||
}
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
{
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
OnHitEffects();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHitEffects()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int bloodLifetime = Main.rand.Next(22, 25);
|
||||
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat());
|
||||
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
|
||||
|
||||
if (Main.rand.NextBool(20))
|
||||
bloodScale *= 2f;
|
||||
|
||||
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier;
|
||||
bloodVelocity.Y -= 5f;
|
||||
BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SeaDragonMuzzleBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 80;
|
||||
Projectile.height = 80;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 8;
|
||||
Projectile.MaxUpdates = 4;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Belching smoke and flames copied from Handheld Tank with a few edits (lasts 8 frames, but all happens at once due to extra updates)
|
||||
for (int i = 0; i < 30; ++i)
|
||||
{
|
||||
// Pick a random type of fire (there's a little water mixed in)
|
||||
int dustID;
|
||||
switch (Main.rand.Next(6))
|
||||
{
|
||||
case 0:
|
||||
dustID = 170;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
dustID = 174;
|
||||
break;
|
||||
default:
|
||||
dustID = 33;
|
||||
break;
|
||||
}
|
||||
|
||||
// Choose a random speed and angle to belch out the fire
|
||||
float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f);
|
||||
float angleRandom = 0.07f;
|
||||
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation());
|
||||
dustVel = dustVel.RotatedBy(-angleRandom);
|
||||
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
|
||||
|
||||
// Pick a size for the fire particle
|
||||
float scale = Main.rand.NextFloat(0.7f, 1.8f);
|
||||
|
||||
// Actually spawn the fire
|
||||
int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale);
|
||||
Main.dust[idx].noGravity = true;
|
||||
Main.dust[idx].position = Projectile.Center;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.OnFire3, 240);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +1,205 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Tiles.Abyss;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static tModPorter.ProgressUpdate;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SeaDragonRocket : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
private bool beginStretchAnim = false;
|
||||
private float progress = -1;
|
||||
public bool attacking => Projectile.ai[1] == 5; // If the missile is launched at the enemy
|
||||
public ref float moveSpeed => ref Projectile.ai[2]; // Some speed variation applied to the missiles based on spawn order
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 18;
|
||||
Projectile.height = 18;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 95;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 0.25f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[1] == 0f)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[fire].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[fire].scale = 0.5f;
|
||||
Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
Projectile.ai[1] = 1f;
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.5f);
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3)
|
||||
|
||||
if (attacking) // Fly at the enemy
|
||||
{
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ai[1] = 0f;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.position.X = Projectile.Center.X;
|
||||
Projectile.position.Y = Projectile.Center.Y;
|
||||
Projectile.width = 200;
|
||||
Projectile.height = 200;
|
||||
Projectile.position.X -= (float)(Projectile.width / 2);
|
||||
Projectile.position.Y -= (float)(Projectile.height / 2);
|
||||
Projectile.knockBack = 10f;
|
||||
NPC chosenTarget = Projectile.Center.ClosestNPCAt(600);
|
||||
CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 1.4f + moveSpeed, 25, 0.985f);
|
||||
if (chosenTarget != null)
|
||||
Projectile.timeLeft++; // Don't die if you have a target to home in on
|
||||
}
|
||||
else
|
||||
else // Swarm around the player until ready to be fired
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f)
|
||||
Vector2 circle = Owner.Center + new Vector2(0, -195 + moveSpeed * 25).RotatedBy(time * 0.05f);
|
||||
Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 12)
|
||||
Projectile.velocity = Projectile.velocity * 0.97f + moveToEnemy * moveSpeed;
|
||||
else
|
||||
Projectile.velocity *= 0.9f;
|
||||
if (time % 2 == 0)
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66);
|
||||
trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f);
|
||||
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f);
|
||||
trailDust.color = Main.rand.NextBool() ? Color.AliceBlue : Color.SkyBlue;
|
||||
trailDust.noGravity = true;
|
||||
if (attacking)
|
||||
{
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
float halfX = 0f;
|
||||
float halfY = 0f;
|
||||
if (j == 1)
|
||||
{
|
||||
halfX = Projectile.velocity.X * 0.5f;
|
||||
halfY = Projectile.velocity.Y * 0.5f;
|
||||
}
|
||||
int explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
|
||||
Main.dust[explosion].velocity *= 0.2f;
|
||||
Main.dust[explosion].noGravity = true;
|
||||
explosion = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Water, 0f, 0f, 100, default, 0.5f);
|
||||
Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[explosion].velocity *= 0.05f;
|
||||
}
|
||||
Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue);
|
||||
GeneralParticleHandler.SpawnParticle(trail);
|
||||
}
|
||||
}
|
||||
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f);
|
||||
if (Main.rand.NextBool(8) && !attacking)
|
||||
{
|
||||
Particle Star = new CritSpark(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f), Color.SkyBlue, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Main.rand.NextFloat(0.4f, 0.7f), 30, 0.1f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
}
|
||||
|
||||
if (progress >= 0f && progress < 1f) // For spawn animation
|
||||
progress += 0.04f;
|
||||
|
||||
if (Projectile.scale < 1f)
|
||||
Projectile.scale += 0.05f;
|
||||
|
||||
time++;
|
||||
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<SeadragonHoldout>()] <= 0 && !attacking) // If no holdout exists and not attacking then die
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Vector2 velocity = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 3f;
|
||||
Dust ring = Dust.NewDustPerfect(Projectile.Center, 66, velocity);
|
||||
ring.noGravity = true;
|
||||
ring.scale = Main.rand.NextFloat(0.5f, 0.7f);
|
||||
ring.color = Color.CornflowerBlue;
|
||||
}
|
||||
beginStretchAnim = true;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
Projectile.ExpandHitboxBy(192);
|
||||
Projectile.maxPenetrate = -1;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.Damage();
|
||||
SoundEngine.PlaySound(SoundID.Item110, Projectile.position);
|
||||
for (int i = 0; i < 15; i++)
|
||||
// Explode on kill if attacking, else just poof out
|
||||
if (attacking)
|
||||
{
|
||||
int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[smoke].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position);
|
||||
SoundStyle hitSound2 = new("CalamityMod/Sounds/NPCHit/AnahitaHit", 3);
|
||||
SoundEngine.PlaySound(hitSound2 with { Volume = 1.1f }, Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.8f) with { Volume = 1.1f , MaxInstances = 2}, Projectile.position);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Main.dust[smoke].scale = 0.5f;
|
||||
Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
Particle Star = new CritSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 5), Color.SkyBlue, Main.rand.NextBool() ? Color.HotPink : Color.SeaGreen, Main.rand.NextFloat(0.6f, 0.9f), 30, 0.4f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
}
|
||||
int points = 4;
|
||||
float radians = MathHelper.TwoPi / points;
|
||||
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100);
|
||||
Color useColor = Main.rand.NextBool() ? Color.SkyBlue : Color.HotPink;
|
||||
for (int k = 0; k < points; k++)
|
||||
{
|
||||
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
|
||||
Particle spark = new GlowSparkParticle((Projectile.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.03f, useColor, new Vector2(1f, 0.4f), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 25; j++)
|
||||
else
|
||||
{
|
||||
int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[fire].noGravity = true;
|
||||
Main.dust[fire].velocity *= 5f;
|
||||
fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[fire].velocity *= 2f;
|
||||
}
|
||||
int projAmt = Main.rand.Next(2, 4);
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int k = 0; k < projAmt; k++)
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<RocketFire>(), (int)(Projectile.damage * 0.33), 0f, Projectile.owner);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 6));
|
||||
dust.noGravity = false;
|
||||
dust.scale = 0.8f;
|
||||
dust.color = Color.AliceBlue;
|
||||
dust.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool? CanDamage() => (attacking ? null : false); // Can't hit if not attacking
|
||||
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (beginStretchAnim)
|
||||
{
|
||||
progress = 0f;
|
||||
beginStretchAnim = false;
|
||||
}
|
||||
|
||||
if (progress >= 0f) // Squash n' stretch on spawn
|
||||
{
|
||||
float stretchFactorX, stretchFactorY;
|
||||
|
||||
if (progress < 0.5f) // Stretch
|
||||
{
|
||||
float completion = progress / 0.5f;
|
||||
stretchFactorX = MathHelper.Lerp(1.6f, 0.7f, completion);
|
||||
stretchFactorY = MathHelper.Lerp(0.7f, 1.6f, completion);
|
||||
}
|
||||
else // Squash
|
||||
{
|
||||
float completion = (progress - 0.5f) / 0.5f;
|
||||
stretchFactorX = MathHelper.Lerp(0.7f, 1f, completion);
|
||||
stretchFactorY = MathHelper.Lerp(1.6f, 1f, completion);
|
||||
}
|
||||
|
||||
if (progress >= 1f)
|
||||
{
|
||||
stretchFactorX = 1f;
|
||||
stretchFactorY = 1f;
|
||||
progress = -1f;
|
||||
}
|
||||
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f);
|
||||
Vector2 finalScale = new Vector2(stretchFactorX, stretchFactorY) * Projectile.scale;
|
||||
Vector2 finalPos = Projectile.Center - Main.screenPosition;
|
||||
|
||||
Main.spriteBatch.Draw(texture, finalPos, null, lightColor, Projectile.rotation, origin, finalScale, SpriteEffects.None, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Texture2D mainTexture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
Vector2 drawOrigin = mainTexture.Size() / 2f;
|
||||
float drawScale = Projectile.scale;
|
||||
float drawRotation = Projectile.rotation;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
|
||||
Main.spriteBatch.Draw(mainTexture, drawPosition, null, lightColor * (1f - Projectile.alpha / 255f), drawRotation, drawOrigin, drawScale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SeadragonHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Seadragon>();
|
||||
public override float MaxOffsetLengthFromArm => 24f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -1f;
|
||||
public override float OffsetYDownwards => 5f;
|
||||
|
||||
public int Time = 0;
|
||||
public int shotCounter = 0;
|
||||
public int framesBetweenShots = 0;
|
||||
public bool swapType = false;
|
||||
public bool transEffects = false;
|
||||
|
||||
public override Vector2 GunTipPosition => Projectile.Center - Vector2.UnitY + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.5f;
|
||||
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
//If the player is dead, kill the holdout.
|
||||
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
//Pause to give the effect of reloading
|
||||
if (Time == 30)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "SeadragonMag";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
//Set the scaling to 0 whenever it reloads
|
||||
Owner.Calamity().sharkGunDamageScaling = 0;
|
||||
//Has a 1 in 100 chance to set transEffects to true, changing the shot colors to be replaced by the transgender pride flag colors
|
||||
transEffects = Main.rand.NextBool(100);
|
||||
}
|
||||
if (Time >= 90)
|
||||
{
|
||||
if (framesBetweenShots == 0 && shotCounter <= 51)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
|
||||
#region Debug Text Display
|
||||
//Main.NewText(shotCounter);
|
||||
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
|
||||
#endregion
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.25f , PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center);
|
||||
Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 5, true, 0.8f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker);
|
||||
GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.SeaShell : Color.Silver * 0.9f, Color.HotPink, Main.rand.NextFloat(0.8f, 1.2f), 2, 0, 2.68f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker2);
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate
|
||||
framesBetweenShots = 3;
|
||||
OffsetLengthFromArm -= 2f;
|
||||
//Here we detect which ammo the bullets will use
|
||||
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
|
||||
//Alternate between shooting bullets and water streams. Despite not having damage scaling, the fish gain movement speed based on the scaling, so we still need a Global Projectile
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (!swapType)
|
||||
{
|
||||
Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
CalamityGlobalProjectile cgp = scalingShot.Calamity();
|
||||
cgp.sharkBullets = true;
|
||||
//Only eject casings from the gun if bullets are fired, preventing too many at once
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "SeadragonCasing";
|
||||
Vector2 spawnOffset = new Vector2(0, -11f);
|
||||
Vector2 spawnPosition = Projectile.Center + (-Projectile.velocity * 5) + spawnOffset;
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), spawnPosition, -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
}
|
||||
if (swapType)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<BlahajBlast>(), Projectile.damage, Projectile.knockBack, Projectile.owner, transEffects ? 0f : 1f);
|
||||
}
|
||||
swapType = !swapType;
|
||||
}
|
||||
shotCounter++;
|
||||
//Allow a pause before unleashing the fish. This allows the final bullet a chance to hit before the fish are unleashed. Lowering this number reduces the delay, but may also cause the gun to become inconsistent
|
||||
if (shotCounter == 50)
|
||||
framesBetweenShots = 18;
|
||||
if (Main.zenithWorld && shotCounter == 35)
|
||||
{
|
||||
SoundStyle joke = new("CalamityMod/Sounds/Custom/GFB/YouKnowWhatThatMeans");
|
||||
SoundEngine.PlaySound(joke with { Volume = 1f }, Projectile.Center);
|
||||
}
|
||||
}
|
||||
if (framesBetweenShots > 0)
|
||||
framesBetweenShots--;
|
||||
}
|
||||
if (shotCounter == 50 && framesBetweenShots == 0)
|
||||
{
|
||||
//Reset all variables to allow left click to be held down
|
||||
Time = 2;
|
||||
shotCounter = 0;
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
//Activate all fish to rush at the cursor and home in on the nearest enemy
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (projectile.active && projectile.type == ModContent.ProjectileType<SeaDragonRocket>() && projectile.ai[1] < 5)
|
||||
{
|
||||
projectile.ai[1] = 5;
|
||||
projectile.velocity = Utils.DirectionTo(projectile.Center, Owner.Calamity().mouseWorld) * 12;
|
||||
}
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
SoundStyle joke = new("CalamityMod/Sounds/Custom/GFB/FISH");
|
||||
SoundEngine.PlaySound(joke with { Volume = 0.35f, MaxInstances = -1 }, projectile.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
//If any fish projectiles are present, create an eye shine effect as they rush the enemy
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<SeaDragonRocket>()] > 0)
|
||||
{
|
||||
if (Time == 3)
|
||||
{
|
||||
SoundStyle hitSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples");
|
||||
SoundEngine.PlaySound(hitSound with { Volume = 0.5f, Pitch = 0.8f }, Projectile.Center);
|
||||
for (int b = 0; b < 12; b++)
|
||||
{
|
||||
int star = 4;
|
||||
for (int i = 0; i < star; i++)
|
||||
{
|
||||
float power = Main.rand.NextFloat(0.2f, 1f);
|
||||
Vector2 vel = (MathHelper.TwoPi * i / star).ToRotationVector2().RotatedBy(Projectile.rotation) * 6f;
|
||||
float size = (0.6f) * Main.rand.NextFloat(0.9f, 1.1f) * (1.1f - power);
|
||||
int dustStyle = DustType<SquashDust>();
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition + (-Projectile.velocity.RotatedBy(0.1 * Projectile.direction) * 29f), dustStyle);
|
||||
dust.scale = size;
|
||||
dust.velocity = vel * power * (0.7f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Color.Lerp(Color.Goldenrod, Color.OrangeRed, 0.5f) with { A = 1 };
|
||||
|
||||
if (b == 0)
|
||||
{
|
||||
Particle aura = new CustomSpark(GunTipPosition + (-Projectile.velocity.RotatedBy(0.1 * Projectile.direction) * 29f), Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 13, 0.2f, Color.Lerp(Color.Goldenrod, Color.OrangeRed, 0.5f) with { A = 1 }, new Vector2(0.65f, 1f), glowCenter: true, glowOpacity: 0.8f, glowCenterScale: 0.85f, extraRotation: Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0), shrinkSpeed: 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(aura);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Time < 2)
|
||||
return false;
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class VoidBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/GalaxiaBolt";
|
||||
public int time = 0;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 10;
|
||||
Projectile.height = 10;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction;
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f);
|
||||
|
||||
if (Projectile.timeLeft <= 597f)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * 0.5f, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 20, Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale, 0.8f, 0, false, 0, true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * 0.5f, Color.DarkOrchid, 20, Main.rand.NextFloat(0.4f, 0.8f) * Projectile.scale, 0.3f, 0, true, 0.005f, true);
|
||||
GeneralParticleHandler.SpawnParticle(smokeGlow);
|
||||
}
|
||||
Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 5, 0.052f, Color.Black, new Vector2(0.6f, 1.3f), false);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 3.5f, Projectile.velocity * 0.01f, false, 5, 1.2f * Projectile.scale, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
spark.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
}
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 180);
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
float blastSize = 170;
|
||||
float minMultiplier = 0.25f;
|
||||
int hitsToMinMult = -1;
|
||||
int debuff1 = ModContent.BuffType<WhisperingDeath>();
|
||||
int debuffTime = 180;
|
||||
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult);
|
||||
blast.localAI[0] = debuff1;
|
||||
blast.localAI[1] = debuffTime;
|
||||
blast.timeLeft = 2;
|
||||
blast.DamageType = Projectile.DamageType;
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.2f, 15, false);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
}
|
||||
|
||||
for (float k = 0; k < 3; k++)
|
||||
{
|
||||
float colorRando = Main.rand.NextFloat(0, 1);
|
||||
int partLifetime = Main.rand.Next(13, 15 + 1);
|
||||
float scale = Main.rand.NextFloat(0.10f, 0.16f);
|
||||
Vector2 spawnPos = Projectile.Center + (Main.rand.NextVector2Circular(20, 20) * (k + 1));
|
||||
Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, Color.Lerp(Color.DarkOrchid, Color.Indigo, colorRando) * 0.6f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, partLifetime);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
blastRing.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
}
|
||||
|
||||
Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.03f, 1f, 24, true);
|
||||
GeneralParticleHandler.SpawnParticle(innerGlow);
|
||||
innerGlow.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
|
||||
float offset = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2();
|
||||
Particle cross = new GlowSparkParticle(Projectile.Center, velocity, false, 12, 0.4f, Color.BlueViolet * 0.7f, new Vector2(0.07f, 0.08f), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(cross);
|
||||
cross.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
}
|
||||
for (float k = 0; k < 10; k++)
|
||||
{
|
||||
Particle spark = new CustomSpark(Projectile.Center, new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(2f, 4f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.1f, 1.3f), Color.Lerp(Color.MediumPurple, Color.Indigo, Main.rand.NextFloat(0.5f, 0.7f)), new Vector2(0.6f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.35f, 0.4f));
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
spark.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark").Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
float drawRotation = Projectile.rotation;
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Color.Indigo with { A = 0 }, drawRotation, rotationPoint, new Vector2(0.5f, 1.4f) * 0.025f * Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
@@ -1,117 +0,0 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class Voidragon : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 10;
|
||||
Projectile.height = 10;
|
||||
Projectile.alpha = 150;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.soundDelay == 0)
|
||||
{
|
||||
Projectile.soundDelay = 150 + Main.rand.Next(40);
|
||||
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
|
||||
}
|
||||
Projectile.localAI[0] += 1f;
|
||||
if (Projectile.localAI[0] == 12f)
|
||||
{
|
||||
Projectile.localAI[0] = 0f;
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f;
|
||||
dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
|
||||
dustVel = dustVel.RotatedBy((double)(Projectile.rotation - 1.57079637f), default);
|
||||
int shadowDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.ShadowbeamStaff, 0f, 0f, 160, default, 1f);
|
||||
Main.dust[shadowDust].scale = 1.1f;
|
||||
Main.dust[shadowDust].noGravity = true;
|
||||
Main.dust[shadowDust].position = Projectile.Center + dustVel;
|
||||
Main.dust[shadowDust].velocity = Projectile.velocity * 0.1f;
|
||||
Main.dust[shadowDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[shadowDust].position) * 1.25f;
|
||||
}
|
||||
}
|
||||
Projectile.alpha -= 15;
|
||||
int alphaControl = 150;
|
||||
if (Projectile.Center.Y >= Projectile.ai[1])
|
||||
{
|
||||
alphaControl = 0;
|
||||
}
|
||||
if (Projectile.alpha < alphaControl)
|
||||
{
|
||||
Projectile.alpha = alphaControl;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
|
||||
if (Main.rand.NextBool(16))
|
||||
{
|
||||
Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default);
|
||||
int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
|
||||
Main.dust[extraDust].velocity = value3 * 0.66f;
|
||||
Main.dust[extraDust].position = Projectile.Center + value3 * 12f;
|
||||
}
|
||||
if (Main.rand.NextBool(48) && !Main.dedServ)
|
||||
{
|
||||
int voidGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
|
||||
Main.gore[voidGore].velocity *= 0.66f;
|
||||
Main.gore[voidGore].velocity += Projectile.velocity * 0.3f;
|
||||
}
|
||||
if (Projectile.ai[1] == 1f)
|
||||
{
|
||||
Projectile.light = 0.9f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
|
||||
}
|
||||
if (Main.rand.NextBool(20) && !Main.dedServ)
|
||||
{
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
|
||||
}
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Voidfrost>(), 180);
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<PlasmaExplosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f);
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
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.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class VoidragonHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Voidragon>();
|
||||
public override float MaxOffsetLengthFromArm => 40f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -1f;
|
||||
public override float OffsetYDownwards => 5f;
|
||||
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 55).RotatedBy(-0.09f * Projectile.direction);
|
||||
public const float LaserAimLag = 0.92f; // Last Prism-esque aim lag. Higher = Slower. Last Prism is 0.92f.
|
||||
|
||||
public int Time = 0;
|
||||
public int beamTimer = 500;
|
||||
public int shotCounter = 0;
|
||||
public int framesBetweenShots = 0;
|
||||
public bool swapType = false;
|
||||
public bool firingBeam = false;
|
||||
public float chargeVisTimer = 0;
|
||||
public float maxChargeSpeed = 2;
|
||||
public float chargePulseTimer = 0;
|
||||
public bool playChargeSound = true;
|
||||
|
||||
public SlotId soundSlot;
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
//If the player is dead, kill the holdout.
|
||||
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
|
||||
Projectile.Kill();
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var ChargeSound))
|
||||
ChargeSound?.Stop();
|
||||
}
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var ChargeSound) && ChargeSound.IsPlaying)
|
||||
ChargeSound.Position = Projectile.Center;
|
||||
|
||||
//Spawn dust on the holdout's eyes based on the amount of damage scaling.
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int dustType = ModContent.DustType<VoidDustInverted>();
|
||||
float rotMulti = Main.rand.NextFloat(0.3f, 1f);
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition + (-Projectile.velocity.RotatedBy(0.15 * Projectile.direction) * 50), dustType);
|
||||
dust.scale = Main.rand.NextFloat(1.2f, 1.8f) * (Owner.Calamity().sharkGunDamageScaling * 0.02f) - rotMulti * 0.1f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity = new Vector2(-1.2f, -2).RotatedBy(Projectile.rotation + (Projectile.direction == -1 ? MathHelper.TwoPi * 0.75f : 0)).RotatedByRandom(rotMulti * 0.8f) * (Main.rand.NextFloat(1f, 3.2f) - rotMulti) * (Owner.Calamity().sharkGunDamageScaling * 0.015f);
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = Main.rand.NextBool() ? Color.Indigo : Color.DarkBlue;
|
||||
}
|
||||
//Smoothly scale down the gun visuals before reloading
|
||||
if (Time < 30)
|
||||
{
|
||||
if (Owner.Calamity().sharkGunDamageScaling > 0)
|
||||
Owner.Calamity().sharkGunDamageScaling--;
|
||||
}
|
||||
//Pause to give the effect of reloading
|
||||
if (Time == 30)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "VoidragonMag";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
//Set the scaling to 0 whenever it reloads
|
||||
Owner.Calamity().sharkGunDamageScaling = 0;
|
||||
}
|
||||
if (Time >= 90)
|
||||
{
|
||||
if (framesBetweenShots == 0 && shotCounter <= 50)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 28;
|
||||
#region Debug Text Display
|
||||
//Main.NewText(shotCounter);
|
||||
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
|
||||
#endregion
|
||||
//Do not look in here if you value your sanity
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.1f, PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center);
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
Particle smoke = new HeavySmokeParticle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Black : Color.Indigo * 0.6f, 10, 0.85f, 1.1f, 5f, false, 0, true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
Particle spark = new VoidSparkParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(1.2f, 1.5f), false, 25, 0.1f, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Purple, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 2, true, 0.8f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker);
|
||||
sparker.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet * 0.9f, Color.Indigo, Main.rand.NextFloat(1.4f, 1.6f), 2, 0, 2.22f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker2);
|
||||
sparker2.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
GenericSparkle sparker3 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.Indigo : Color.BlueViolet * 0.9f, Color.Indigo, Main.rand.NextFloat(2.5f, 2.6f), 2, 0, 2.68f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker3);
|
||||
Particle center = new SnowflakeSparkle(GunTipPosition, Vector2.Zero, Color.GhostWhite, Color.Indigo, 0.8f, 2, Main.rand.NextFloat(-10, 10), 0.5f, 7);
|
||||
GeneralParticleHandler.SpawnParticle(center);
|
||||
center.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
sparker3.DrawLayer = Enums.GeneralDrawLayer.AfterEverything;
|
||||
#endregion
|
||||
|
||||
//How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate
|
||||
framesBetweenShots = 3;
|
||||
OffsetLengthFromArm -= 2.5f;
|
||||
//Here we detect which ammo the bullets will use
|
||||
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
|
||||
//Alternate between shooting bullets and void blasts. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (!swapType)
|
||||
{
|
||||
Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
CalamityGlobalProjectile cgp = scalingShot.Calamity();
|
||||
cgp.sharkBullets = true;
|
||||
//Only eject casings from the gun if bullets are fired, preventing too many at once
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "VoidragonCasing";
|
||||
Vector2 spawnOffset = new Vector2(0, -13f);
|
||||
Vector2 spawnPosition = Projectile.Center + (-Projectile.velocity * 18) + spawnOffset;
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), spawnPosition, -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
}
|
||||
if (swapType)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<VoidBlast>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
swapType = !swapType;
|
||||
}
|
||||
shotCounter++;
|
||||
//Allow a pause before firing the laser. The long delay lets the laser's charge sound play in full
|
||||
if (shotCounter == 50)
|
||||
{
|
||||
framesBetweenShots = 150;
|
||||
shotCounter++;
|
||||
}
|
||||
}
|
||||
if (framesBetweenShots > 0)
|
||||
framesBetweenShots--;
|
||||
}
|
||||
if (shotCounter == 51 && !firingBeam) //Charging
|
||||
{
|
||||
SoundStyle charge = new("CalamityMod/Sounds/Item/VoidragonCharge");
|
||||
if (playChargeSound)
|
||||
soundSlot = SoundEngine.PlaySound(charge with { Volume = 0.7f, IsLooped = true, pitch = -0.5f }, Projectile.Center);
|
||||
playChargeSound = false;
|
||||
float chargeCompletion = Utils.GetLerpValue(150, 0, framesBetweenShots, true);
|
||||
chargeVisTimer = MathHelper.Lerp(0, maxChargeSpeed, chargeCompletion);
|
||||
chargePulseTimer += 0.6f + MathHelper.Lerp(0, maxChargeSpeed, MathF.Pow(chargeCompletion, 2.5f));
|
||||
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var sSound) && sSound.IsPlaying)
|
||||
sSound.Pitch = -0.85f + 1.5f * chargeCompletion;
|
||||
}
|
||||
else
|
||||
{
|
||||
chargePulseTimer = 0;
|
||||
chargeVisTimer = MathHelper.Lerp(chargeVisTimer, 0, 0.12f);
|
||||
}
|
||||
if (shotCounter == 51 && framesBetweenShots == 0)
|
||||
{
|
||||
//Main.NewText(beamTimer);
|
||||
float beamCompletion = Utils.GetLerpValue(500, 0, beamTimer, true);
|
||||
if (!firingBeam)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 10f;
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var cSound))
|
||||
cSound?.Stop();
|
||||
SoundStyle start = new("CalamityMod/Sounds/Item/VoidragonStrongStart");
|
||||
SoundStyle start2 = new("CalamityMod/Sounds/Item/MagnaCannonShot");
|
||||
for (int i = 0; i < 3; i++)
|
||||
SoundEngine.PlaySound((i > 0 ? start2 : start) with { Volume = 1f, pitch = 0f - 0.5f * i, MaxInstances = 3 }, Projectile.Center);
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/VoidragonLaser");
|
||||
soundSlot = SoundEngine.PlaySound(fire with { Volume = 1f, IsLooped = true, pitch = 0f }, Projectile.Center);
|
||||
}
|
||||
if (SoundEngine.TryGetActiveSound(soundSlot, out var sSound) && sSound.IsPlaying)
|
||||
{
|
||||
sSound.Pitch = 1f - 1.5f * MathF.Pow(beamCompletion, 10f) + 0.6f * beamCompletion;
|
||||
sSound.Volume = 1f - 1 * MathF.Pow(beamCompletion, 10f);
|
||||
}
|
||||
firingBeam = true;
|
||||
if (firingBeam && beamTimer > 0)
|
||||
{
|
||||
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the laser doing 0 damage
|
||||
if (Owner.Calamity().sharkGunDamageScaling == 0)
|
||||
{
|
||||
Owner.Calamity().sharkGunDamageScaling++;
|
||||
}
|
||||
//Spawn the laser only once at the start of the timer. Change beamTimer to edit its lifetime
|
||||
//I fucking hate this laser by the way
|
||||
if (Main.myPlayer == Projectile.owner && beamTimer == 500)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5, ModContent.ProjectileType<AbyssalFire>(), (int)(Projectile.damage * 0.05f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner, Projectile.whoAmI);
|
||||
beamTimer--;
|
||||
}
|
||||
else
|
||||
{
|
||||
firingBeam = false;
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
public override void ManageHoldout()
|
||||
{
|
||||
Vector2 storedVelocity = Projectile.velocity;
|
||||
base.ManageHoldout();
|
||||
|
||||
if (firingBeam)
|
||||
{
|
||||
Vector2 aimVector = (Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true)).SafeNormalize(Vector2.UnitY);
|
||||
aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(storedVelocity), LaserAimLag));
|
||||
|
||||
if (aimVector != storedVelocity)
|
||||
Projectile.netUpdate = true;
|
||||
Projectile.velocity = aimVector;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Time < 2)
|
||||
return false;
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Texture2D texture2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Texture2D texture3 = ModContent.Request<Texture2D>("CalamityMod/Particles/RoarPulse").Value;
|
||||
Texture2D texture4 = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowOrbParticle").Value;
|
||||
Texture2D sparkle = ModContent.Request<Texture2D>("CalamityMod/Particles/HalfStar").Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Vector2 shake = Main.rand.NextVector2Circular(6, 6);
|
||||
|
||||
float chargeVisual = MathF.Pow(Utils.GetLerpValue(0, maxChargeSpeed / 1.5f, chargeVisTimer, true), 1.5f);
|
||||
float finalChargeVisual = MathF.Pow(Utils.GetLerpValue(maxChargeSpeed / 1.5f, maxChargeSpeed, chargeVisTimer, true), 3f);
|
||||
|
||||
int max = 30;
|
||||
float ringScaling = MathF.Pow(1 - Utils.GetLerpValue(0, max, chargePulseTimer % max, true), 1.15f);
|
||||
float ringOpacity = 1 - MathF.Abs(Utils.GetLerpValue(0.5f, 1, ringScaling, false));
|
||||
|
||||
for (int i = 0; i < 22; i++)
|
||||
{
|
||||
Color auraColor = Color.Lerp(Color.Indigo, Color.BlueViolet, i * 0.01f) with { A = 0 } * 0.6f;
|
||||
Vector2 drawOffset = ((MathHelper.TwoPi * i / 22f).ToRotationVector2() * 5) + Main.rand.NextVector2Circular(7, 7);
|
||||
Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale * Main.rand.NextFloat(0.02f, 0.025f) * Owner.Calamity().sharkGunDamageScaling, flipSprite);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
|
||||
|
||||
//Black aura
|
||||
for (int i = 0; i < 15; i++)
|
||||
Main.EntitySpriteDraw(texture4, GunTipPosition - Main.screenPosition, null, Color.Lerp(Color.Black, Color.Indigo with { A = 0 }, finalChargeVisual) * (0.35f + ringOpacity * 0.65f), drawRotation + Main.rand.NextFloat(-4f, 4f), texture4.Size() / 2, new Vector2(0.85f + i * 0.065f, 0.85f - i * 0.065f) * (Projectile.scale + finalChargeVisual * 1.8f) * Owner.gravDir * chargeVisual * (4.25f - ringScaling * 2.5f), flipSprite);
|
||||
|
||||
for (int i = 0; i < 3; i ++) //Glow aura
|
||||
Main.EntitySpriteDraw(texture2, GunTipPosition - Main.screenPosition, null, Color.Lerp(Color.BlueViolet, Color.White, (i == 0 ? 0.8f : 0)) with { A = 0 }, drawRotation + Main.rand.NextFloat(-4f, 4f), texture2.Size() / 2, (Projectile.scale + finalChargeVisual * 1.8f) * Owner.gravDir * chargeVisual * 0.5f * (i == 0 ? 0.75f : 1), flipSprite);
|
||||
|
||||
//Pulse Rings
|
||||
Main.EntitySpriteDraw(texture3, GunTipPosition - Main.screenPosition, null, Color.BlueViolet with { A = 0 } * ringOpacity * 0.5f, drawRotation + Main.rand.NextFloat(-4f, 4f), texture3.Size() / 2, Projectile.scale * Owner.gravDir * chargeVisual * ringScaling * 0.5f, flipSprite);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class VoidragonTentacle : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 5;
|
||||
Projectile.MaxUpdates = 3;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.localAI[1]++;
|
||||
if (Projectile.velocity.X != Projectile.velocity.X)
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.X) < 1f)
|
||||
{
|
||||
Projectile.velocity.X = -Projectile.velocity.X;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (Projectile.velocity.Y != Projectile.velocity.Y)
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.Y) < 1f)
|
||||
{
|
||||
Projectile.velocity.Y = -Projectile.velocity.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
Vector2 center10 = Projectile.Center;
|
||||
Projectile.scale = 1f - Projectile.localAI[0];
|
||||
Projectile.width = (int)(20f * Projectile.scale);
|
||||
Projectile.height = Projectile.width;
|
||||
Projectile.position.X = center10.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = center10.Y - (float)(Projectile.height / 2);
|
||||
if (Projectile.localAI[0] < 0.1f)
|
||||
{
|
||||
Projectile.localAI[0] += 0.01f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.localAI[0] += 0.025f;
|
||||
}
|
||||
if (Projectile.localAI[0] >= 0.95f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f;
|
||||
if (Projectile.velocity.Length() > 16f)
|
||||
{
|
||||
Projectile.velocity.Normalize();
|
||||
Projectile.velocity *= 16f;
|
||||
}
|
||||
Projectile.ai[0] *= 1.05f;
|
||||
Projectile.ai[1] *= 1.05f;
|
||||
if (Projectile.scale < 1f && Projectile.localAI[1] > 5f)
|
||||
{
|
||||
int dustAmount = 0;
|
||||
while ((float)dustAmount < Projectile.scale * 10f)
|
||||
{
|
||||
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.3f);
|
||||
Main.dust[dust].position = (Main.dust[dust].position + Projectile.Center) / 2f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity *= 0.1f;
|
||||
Main.dust[dust].velocity -= Projectile.velocity * (1.1f - Projectile.scale);
|
||||
Main.dust[dust].fadeIn = (float)(125 + Projectile.owner);
|
||||
Main.dust[dust].scale += Projectile.scale * 0.75f;
|
||||
dustAmount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,8 @@ namespace CalamityMod.Systems.Collections
|
||||
public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateNamedSet("DoesNotGetHomingWithGrapeBeer")
|
||||
.Description("Prevents this projectile from receiving homing from Grape Beer.")
|
||||
.RegisterBoolSet(ProjectileType<NukeOfBliss>(), ProjectileType<PrismaticEnergyBlast>(), ProjectileType<PrismEnergyBullet>(), ProjectileType<PrismMine>(),
|
||||
ProjectileType<ScorchedEarthRocket>(), ProjectileType<UltimaRay>(), ProjectileType<SproutingArrowMain>());
|
||||
ProjectileType<ScorchedEarthRocket>(), ProjectileType<UltimaRay>(), ProjectileType<SproutingArrowMain>(), ProjectileType<MegalodonShot>(), ProjectileType<BlahajBlast>(),
|
||||
ProjectileType<VoidBlast>(), ProjectileType<AbyssalFire>());
|
||||
|
||||
/// <summary>
|
||||
/// If <see langword="true"/> for a projectile type, then that projectile will be unable to trigger Daawnlight Spirit Origin's bullseyes.<br/>
|
||||
|
||||