Star of Destruction Completion
This commit is contained in:
1 parent
3b31e64f55
commit
ebe091dc42
12 files changed
+392
-79
No files matched your search
@@ -82,8 +82,11 @@ namespace CalamityMod.Items.Tools
|
||||
Vector2 partVel = dustVel * Main.rand.NextFloat(0.1f, 0.3f);
|
||||
Particle spark3 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale, Color.Black, false, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
Particle spark2 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale * 0.5f, Color.LightGreen, true, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle spark2 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale * 0.5f, Color.LightGreen, true, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection);
|
||||
@@ -91,11 +94,6 @@ namespace CalamityMod.Items.Tools
|
||||
float partScale2 = Main.rand.NextFloat(0.5f, 0.8f);
|
||||
Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.1f, 0.7f);
|
||||
|
||||
//Particle smoke = new GlowOrbParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, false, 9, Main.rand.NextFloat(0.3f, 0.5f), Color.LightGreen);
|
||||
//GeneralParticleHandler.SpawnParticle(smoke);
|
||||
//Particle smoke2 = new GlowOrbParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, false, 9, Main.rand.NextFloat(0.3f, 0.5f), Color.Black, false, false, false);
|
||||
//GeneralParticleHandler.SpawnParticle(smoke2);
|
||||
|
||||
Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(8, 8), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 13, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Item.width = 130;
|
||||
Item.height = 130;
|
||||
Item.damage = 100;
|
||||
Item.damage = 96;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = 30;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
Item.width = 48;
|
||||
Item.height = 48;
|
||||
Item.damage = 140;
|
||||
Item.damage = 132;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 17;
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.autoReuse = true;
|
||||
Item.rare = ItemRarityID.Red;
|
||||
Item.shoot = ModContent.ProjectileType<AntumbraShardProjectile>();
|
||||
Item.shootSpeed = 13f;
|
||||
Item.shootSpeed = 14f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = Item.height = 94;
|
||||
Item.damage = 550;
|
||||
Item.damage = 580;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = Item.useTime = 75;
|
||||
Item.useAnimation = Item.useTime = 120;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 10f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
@@ -29,17 +29,39 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
public override float StealthDamageMultiplier => 0.8f;
|
||||
public override float StealthDamageMultiplier => 0.3f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
float rot = -0.5f + 0.25f * i;
|
||||
Vector2 vel = velocity.RotatedBy(rot) * (i == 0 ? 0.7f : i == 4 ? 0.7f : i == 1 ? 0.85f : i == 3 ? 0.85f : 1);
|
||||
int proj = Projectile.NewProjectile(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i == 2 ? 1 : 0);
|
||||
if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].ai[2] = 1; // This counts as a stealth strike in this case
|
||||
bool spawner = true;
|
||||
for (int t = 0; t < 4; t++)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(-36f) + MathHelper.ToRadians(18f) * i;
|
||||
Vector2 vel = velocity.RotatedBy(rot) * (i == 0 ? 0.7f : i == 4 ? 0.7f : i == 1 ? 0.85f : i == 3 ? 0.85f : 1);
|
||||
int proj = Projectile.NewProjectile(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i);
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].ai[2] = 1; // This counts as a stealth strike in this case
|
||||
if (spawner && i == 4)
|
||||
{
|
||||
Main.projectile[proj].ai[2] = 15;
|
||||
spawner = false;
|
||||
}
|
||||
}
|
||||
velocity = velocity.RotatedBy(MathHelper.ToRadians(90f));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
float rot = -0.8f + 0.4f * i;
|
||||
Vector2 vel = velocity.RotatedBy(rot) * (i == 0 ? 0.7f : i == 4 ? 0.7f : i == 1 ? 0.85f : i == 3 ? 0.85f : 1);
|
||||
int proj = Projectile.NewProjectile(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -47,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<MeldConstruct>(10).
|
||||
AddIngredient<MeldConstruct>(18).
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -328,3 +328,4 @@ WrathwingCinder.DisplayName: Wrathwing Eruption
|
||||
WrathwingFireball.DisplayName: Wrathwing Fireball
|
||||
WrathwingSpear.DisplayName: Wrathwing
|
||||
WulfrumKnifeProj.DisplayName: Wulfrum Knife
|
||||
DestructionExplosion.DisplayName: Destruction Explosion
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 8;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 8 * Projectile.extraUpdates;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -24,10 +25,14 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.width = 50;
|
||||
Projectile.height = 50;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.penetrate = 5;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.timeLeft = 450;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
@@ -59,39 +64,54 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
if (time >= 5)
|
||||
{
|
||||
NPC target = Projectile.Center.ClosestNPCAt(320);
|
||||
|
||||
if (target == null)
|
||||
if (Projectile.numHits < 1)
|
||||
{
|
||||
Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 14)
|
||||
Projectile.velocity += moveToMouse * 0.3f;
|
||||
else
|
||||
Projectile.velocity *= 0.8f;
|
||||
NPC target = Projectile.Center.ClosestNPCAt(320);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 14)
|
||||
Projectile.velocity += moveToMouse * 0.3f;
|
||||
else
|
||||
Projectile.velocity *= 0.8f;
|
||||
|
||||
if (time % waveOften == 0)
|
||||
spinDir *= -1;
|
||||
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 14)
|
||||
Projectile.velocity += moveToEnemy * 0.8f;
|
||||
else
|
||||
Projectile.velocity *= 0.7f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (time % waveOften == 0)
|
||||
spinDir *= -1;
|
||||
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 14)
|
||||
Projectile.velocity += moveToEnemy * 0.8f;
|
||||
else
|
||||
Projectile.velocity *= 0.7f;
|
||||
}
|
||||
}
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.extraUpdates = 2;
|
||||
time++;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
if (Projectile.numHits > 0 && Projectile.numHits < 2)
|
||||
{
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/MeldBurn");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center);
|
||||
}
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int i = 0; i <= 9; i++)
|
||||
{
|
||||
int dustStyle = Main.rand.NextBool() ? 66 : 263;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public bool jitter = false;
|
||||
public Vector2 portalSpot;
|
||||
public Vector2 shadowPlacement;
|
||||
public int clones = 9; // This is just a counter for the clones, it will not change how many spawn
|
||||
NPC closestTarget;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -167,13 +168,24 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (Projectile.Calamity().stealthStrike && time % 20 == 0)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2CircularEdge(450, 450) * Main.rand.NextFloat(0.7f, 1.3f), Vector2.Zero, ModContent.ProjectileType<AntumbraShardProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1, 5);
|
||||
clones--;
|
||||
}
|
||||
|
||||
stuckTimer--;
|
||||
if (Projectile.ai[2] == 0)
|
||||
{
|
||||
if (chosenTarget.life <= 0 || chosenTarget == null)
|
||||
{
|
||||
if (clones > 0 && Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
for (int i = 0; i < clones; i++)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2CircularEdge(450, 450) * Main.rand.NextFloat(0.7f, 1.3f), Vector2.Zero, ModContent.ProjectileType<AntumbraShardProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1, 5);
|
||||
}
|
||||
clones = 0;
|
||||
}
|
||||
stuckTimer = 0;
|
||||
}
|
||||
}
|
||||
if (stuckTimer <= 0)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -17,39 +19,74 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public float CenterY;
|
||||
public float MouseX;
|
||||
public float MouseY;
|
||||
public int timerOffset;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 12;
|
||||
Projectile.height = 12;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 15;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Projectile.velocity *= 0.988f;
|
||||
if (time >= 120)
|
||||
Projectile.velocity *= 0.99f;
|
||||
if (time == 0)
|
||||
{
|
||||
if (time == 120)
|
||||
MouseX = Projectile.Center.X;
|
||||
MouseY = Projectile.Center.Y;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
timerOffset = (int)(60 - Projectile.ai[1] * 15);
|
||||
time += timerOffset;
|
||||
}
|
||||
if (time == 180 + timerOffset)
|
||||
{
|
||||
MouseX = Owner.Calamity().mouseWorld.X;
|
||||
MouseY = Owner.Calamity().mouseWorld.Y;
|
||||
}
|
||||
else if (time < 180)
|
||||
{
|
||||
MouseX = Projectile.Center.X;
|
||||
MouseY = Projectile.Center.Y;
|
||||
}
|
||||
if (time >= (180 - timerOffset))
|
||||
{
|
||||
if (time == (180 + timerOffset))
|
||||
{
|
||||
CenterX = Projectile.Center.X;
|
||||
CenterY = Projectile.Center.Y;
|
||||
MouseX = Owner.Calamity().mouseWorld.X;
|
||||
MouseY = Owner.Calamity().mouseWorld.Y;
|
||||
}
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.rotation = (new Vector2(MouseX, MouseY) - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2;
|
||||
Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, MouseX, Utils.GetLerpValue(120, 145, time, true)), MathHelper.Lerp(CenterY, MouseY, Utils.GetLerpValue(120, 145, time, true)));
|
||||
if (time >= 180 + timerOffset)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp((new Vector2(MouseX, MouseY) - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2, 0.2f);
|
||||
Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, MouseX, Utils.GetLerpValue(180 + timerOffset, 300, time, true)), MathHelper.Lerp(CenterY, MouseY, Utils.GetLerpValue(180 + timerOffset, 300, time, true)));
|
||||
}
|
||||
}
|
||||
else
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
{
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.08f);
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity);
|
||||
dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f);
|
||||
dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Color.LightGreen;
|
||||
}
|
||||
|
||||
time++;
|
||||
if (time >= 145)
|
||||
if (time >= 300)
|
||||
Projectile.Kill();
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
@@ -58,17 +95,40 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.ai[1] >= 1)
|
||||
if ((Projectile.ai[1] >= 4 && Projectile.ai[2] == 0) || (Projectile.ai[1] == 4 && Projectile.ai[2] == 15))
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<DestructionStar>(), Projectile.damage, Projectile.knockBack * 5, Projectile.owner);
|
||||
if (Projectile.ai[2] == 1)
|
||||
if (Projectile.ai[2] >= 1)
|
||||
proj.Calamity().stealthStrike = true;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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), Projectile.ai[1] * 0.25f, Projectile.ai[1] * 0.2f, 10, false);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/DestructionBoltGhost");
|
||||
Asset<Texture2D> tex3 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
float fading = Utils.GetLerpValue(180, 90, time, true);
|
||||
float fading2 = Utils.GetLerpValue(240, 180, time, true);
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fading, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * (1 - fading) * fading2, Projectile.rotation, tex2.Size() / 2f, Projectile.scale * fading2, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(tex3.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * (1 - fading2), Projectile.rotation, tex3.Size() / 2f, Projectile.scale / 3, SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class DestructionExplosion : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
private float ExplosionRadius = 400f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
//These shouldn't matter because its circular
|
||||
Projectile.width = 200;
|
||||
Projectile.height = 200;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[0] == 1)
|
||||
ExplosionRadius = 800;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.88f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics.PackedVector;
|
||||
@@ -15,68 +18,218 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/StarofDestruction";
|
||||
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
private float Radius = 47f;
|
||||
|
||||
public float fade = 0;
|
||||
public int beepTimerMax = 50;
|
||||
public int beepTimer = 0;
|
||||
public int stealthHitCooldown = 0;
|
||||
public bool makeReadySound = false;
|
||||
public int rotDirection = 1;
|
||||
public float rot = 0.01f;
|
||||
public bool setRot = true;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 94;
|
||||
Projectile.height = 94;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 16;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 5;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 25;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (setRot)
|
||||
{
|
||||
rotDirection = Main.rand.NextBool() ? 1 : -1;
|
||||
setRot = false;
|
||||
}
|
||||
Projectile.rotation += rot;
|
||||
rot += (Utils.Remap(Projectile.timeLeft, 0, 240, 0.02f, 0.0015f)) * rotDirection;
|
||||
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
if (Projectile.velocity.Length() < 6)
|
||||
Projectile.velocity += moveToMouse * 0.1f;
|
||||
else
|
||||
Projectile.velocity *= 0.8f;
|
||||
if (Projectile.numHits == 0 || Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 18 : 12) && time > 8)
|
||||
Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 0.8f : 0.35f);
|
||||
else if (time > 8)
|
||||
Projectile.velocity *= 0.9f;
|
||||
|
||||
if (Projectile.velocity.Length() > 3 && Main.rand.NextBool())
|
||||
{
|
||||
Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(70, 70);
|
||||
float speed = Main.rand.NextFloat(0.9f, 1.9f);
|
||||
Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black, false, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen, true, false, true);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
fade = MathHelper.Lerp(fade, 0, 0.088f);
|
||||
if (Projectile.timeLeft < 240)
|
||||
{
|
||||
if (beepTimer >= beepTimerMax)
|
||||
{
|
||||
beepTimerMax = (int)(beepTimerMax * 0.81f);
|
||||
fade = 1;
|
||||
rot *= -0.8f;
|
||||
rotDirection *= -1;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.7f * Utils.GetLerpValue(240, 0, Projectile.timeLeft, true) }, Projectile.Center);
|
||||
beepTimer = 0;
|
||||
}
|
||||
beepTimer++;
|
||||
}
|
||||
}
|
||||
else if (!Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
fade = 0;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
if (time == 8)
|
||||
Projectile.Kill();
|
||||
}
|
||||
//if (Projectile.Calamity().stealthStrike)
|
||||
|
||||
time++;
|
||||
if (stealthHitCooldown > 0)
|
||||
stealthHitCooldown--;
|
||||
|
||||
if (Projectile.Calamity().stealthStrike && Projectile.numHits > 0)
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
if (time == 8)
|
||||
{
|
||||
Projectile.numHits = 0;
|
||||
stealthHitCooldown = 45;
|
||||
makeReadySound = true;
|
||||
Explode(false);
|
||||
|
||||
Projectile.velocity += moveToMouse * 30;
|
||||
}
|
||||
}
|
||||
if (stealthHitCooldown == 0 && makeReadySound)
|
||||
{
|
||||
SoundStyle explo2 = new("CalamityMod/Sounds/Item/DeadSunRicochet");
|
||||
SoundEngine.PlaySound(explo2 with { Volume = 0.7f, Pitch = 0.2f }, Projectile.Center);
|
||||
for (int i = 0; i <= 15; i++)
|
||||
{
|
||||
int dustStyle = Main.rand.NextBool() ? 66 : 263;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity);
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1f);
|
||||
dust.velocity = new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f);
|
||||
dust.noGravity = true;
|
||||
dust.color = Color.LightGreen;
|
||||
}
|
||||
makeReadySound = false;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
|
||||
time = 0;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/DudFire");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = -0.4f }, Projectile.Center);
|
||||
|
||||
Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 3, 0f, 12, false);
|
||||
GeneralParticleHandler.SpawnParticle(orb7);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
/*
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.88f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
*/
|
||||
if (!Projectile.Calamity().stealthStrike)
|
||||
Explode(false);
|
||||
else
|
||||
Explode(true);
|
||||
|
||||
}
|
||||
|
||||
internal void Explode(bool big)
|
||||
{
|
||||
float sizeBonus = big ? 2 : 1;
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<DestructionExplosion>(), (int)((Projectile.damage * sizeBonus) * 0.75f), Projectile.knockBack * 1.5f, Projectile.owner);
|
||||
SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion");
|
||||
SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center);
|
||||
if (big)
|
||||
{
|
||||
SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor");
|
||||
SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center);
|
||||
|
||||
SoundStyle explo3 = new("CalamityMod/Sounds/Item/ExobladeDashImpact");
|
||||
SoundEngine.PlaySound(explo3 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center);
|
||||
}
|
||||
|
||||
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18);
|
||||
GeneralParticleHandler.SpawnParticle(bolt2);
|
||||
|
||||
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30);
|
||||
GeneralParticleHandler.SpawnParticle(bolt3);
|
||||
|
||||
Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30);
|
||||
GeneralParticleHandler.SpawnParticle(bolt4);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), (2.2f + i * 0.5f) * sizeBonus, 0f, 80, false);
|
||||
GeneralParticleHandler.SpawnParticle(orb7);
|
||||
}
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Particle spark3 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.LightGreen, true, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
Particle spark4 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.Black, false, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark4);
|
||||
}
|
||||
for (int i = 0; i < (25 * sizeBonus); i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278);
|
||||
dust.noGravity = false;
|
||||
dust.velocity = new Vector2(18, 18).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * sizeBonus;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.2f);
|
||||
dust.color = Color.LightGreen;
|
||||
}
|
||||
Owner.Calamity().GeneralScreenShakePower = 6f * (big ? 3 : 1);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Asset<Texture2D> portal = ModContent.Request<Texture2D>("CalamityMod/Particles/Light");
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/StarofDestructionGhost");
|
||||
Asset<Texture2D> portal = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
Main.EntitySpriteDraw(portal.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * Utils.GetLerpValue(45, 0, stealthHitCooldown), 0, portal.Size() * 0.5f, 1.1f * Utils.GetLerpValue(45, 0, stealthHitCooldown), SpriteEffects.None);
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Color auraColor = Color.Black;
|
||||
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
|
||||
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 2);
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f);
|
||||
Vector2 rotationalDrawOffset2 = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2();
|
||||
rotationalDrawOffset2 *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f - 2);
|
||||
Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
for (int b = 0; b < 2; b++)
|
||||
{
|
||||
Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset2, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
Main.EntitySpriteDraw(portal.Value, Projectile.Center - Main.screenPosition, null, Color.Black, 0, portal.Size() * 0.5f, 1.8f * 2, SpriteEffects.None);
|
||||
Main.EntitySpriteDraw(portal.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 }, 0, portal.Size() * 0.5f, 1.1f * 2, SpriteEffects.None);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * fade, Projectile.rotation, tex2.Size() / 2f, Projectile.scale * 1.1f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox);
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
|
||||
}
|
||||
public override bool? CanDamage() => stealthHitCooldown > 0 ? false : Projectile.numHits > 0 ? false : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user