More TBB Earthen Tides stuff
* Enemy hits also create a shockwave; recolored shockwave to red-brown color to be more earth-themed * Replaced monoliths on tile collide with several dust blasts which appear around the player * Added additional visual effects for tile collisions
This commit is contained in:
1 parent
9394ef6c1e
commit
d2ae5f3852
11 files changed
+165
-315
No files matched your search
@@ -291,7 +291,7 @@ namespace CalamityMod.Balancing
|
||||
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<HiveNuke>()))));
|
||||
|
||||
// 20% resist to Earthen Tides (True Biome Blade).
|
||||
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<EarthenTides>(), ProjectileType<EarthenTidesMonolith>(), ProjectileType<EarthenTidesBlast>()))));
|
||||
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<EarthenTides>(), ProjectileType<EarthenTidesShockwave>(), ProjectileType<EarthenTidesBlast>()))));
|
||||
#endregion
|
||||
|
||||
#region Profaned Guardians
|
||||
|
||||
@@ -566,7 +566,7 @@ namespace CalamityMod.DataStructures
|
||||
if (UseTimer % 120 == 119)
|
||||
{
|
||||
int damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(OmegaBiomeBlade.ShockwaveAttunement_PassiveBaseDamage);
|
||||
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType<EarthenTidesBlast>(), damage, 10f, player.whoAmI, 2.25f);
|
||||
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType<EarthenTidesShockwave>(), damage, 10f, player.whoAmI, 2f);
|
||||
UseTimer++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public static int ShockwaveAttunement_DashHitIFrames = 20;
|
||||
public static float ShockwaveAttunement_FullChargeBoost = 2.5f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage.
|
||||
public static int ShockwaveAttunement_SigilTime = 1000;
|
||||
public static float ShockwaveAttunement_MonolithDamageBoost = 1.1f;
|
||||
public static float ShockwaveAttunement_MonolithDamageFalloff = 0.15f; //Damage multiplier for all subsequent hits after the first one.
|
||||
public static float ShockwaveAttunement_MonolithDamageBoost = 0.75f;
|
||||
|
||||
public static int ShockwaveAttunement_PassiveBaseDamage = 200;
|
||||
|
||||
@@ -89,8 +88,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public static float ShockwaveAttunement_SwordProc = 1f;
|
||||
public static float ShockwaveAttunement_SwordBeamProc = 0.05f;
|
||||
public static float ShockwaveAttunement_MonolithProc = 1f;
|
||||
public static float ShockwaveAttunement_BlastProc = 0.5f;
|
||||
public static float ShockwaveAttunement_BlastProc = 0.33f;
|
||||
public static float ShockwaveAttunement_ShockwaveProc = 0.33f;
|
||||
|
||||
public static float FlailBladeAttunement_BladeProc = 0.1f;
|
||||
public static float FlailBladeAttunement_ChainProc = 0.05f;
|
||||
|
||||
@@ -131,8 +131,8 @@ ShockwaveAttunement: {
|
||||
'''
|
||||
Charge an earth-shattering lunge, release to unleash a devastating blow
|
||||
Homing sword beams are emitted as the sword charges up
|
||||
Striking an enemy with the lunge marks them with an armor crunching sigil that sword beam homing will prioritize
|
||||
Striking the earth with the lunge will cause a massive shock wave on impact which raises a flood of stalagmites
|
||||
Striking an enemy with the lunge creates a shockwave and marks them with an armor crunching sigil that attracts sword beam homing
|
||||
Striking the earth with the lunge will cause several blasts of dust to erupt around you
|
||||
'''
|
||||
PassiveDesc: Periodically emit large shock waves while attacking
|
||||
}
|
||||
|
||||
@@ -98,9 +98,10 @@ DragonRageFireball.DisplayName: Dragon Rage Fireball
|
||||
EarthBoom.DisplayName: Earth's Judgement
|
||||
EarthMeteor.DisplayName: Gaia Meteor
|
||||
EarthenTides.DisplayName: Earthen Tides
|
||||
EarthenTidesBeam.DisplayName: Swordsmith's Projection
|
||||
EarthenTidesBeam.DisplayName: Earthen Projection
|
||||
EarthenTidesBlast.DisplayName: Earthen Tides Blast
|
||||
EarthenTidesMonolith.DisplayName: Earthen Tides Monolith
|
||||
EarthenTidesBlastSpawner.DisplayName: Blast Spawner
|
||||
EarthenTidesShockwave.DisplayName: Earthen Tides Shockwave
|
||||
ElementalGlassStar.DisplayName: Glass Star
|
||||
ElementBall.DisplayName: Elemental Ball
|
||||
EmpyreanKnife.DisplayName: Empyrean Knife
|
||||
|
||||
@@ -49,10 +49,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.localNPCHitCooldown = 16;
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
return (State == 1);
|
||||
}
|
||||
// Only deal damage while charging
|
||||
public override bool? CanDamage() => State == 1f;
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
@@ -73,17 +71,19 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao
|
||||
if (!initialized) //Initialization. Here it's literally just playing a sound
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
SoundEngine.PlaySound(SoundID.Item101, Projectile.Center);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// Attempt a charge if the player stops channeling the sword
|
||||
if (Owner.CantUseHoldout())
|
||||
{
|
||||
if (State == 0f)
|
||||
{
|
||||
// You need at least 25% charge duration to do a charge
|
||||
if (Charge / MaxCharge < 0.25f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item109, Projectile.Center);
|
||||
@@ -92,7 +92,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center);
|
||||
State = 1f;
|
||||
Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death
|
||||
@@ -151,9 +150,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Owner.Calamity().LungingDown = true;
|
||||
|
||||
if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10))
|
||||
Vector2 collisionCheckPos = Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f;
|
||||
if (Collision.SolidCollision(collisionCheckPos, 10, 10))
|
||||
{
|
||||
SlamDown();
|
||||
SlamDown(collisionCheckPos);
|
||||
Projectile.timeLeft = 0;
|
||||
Owner.Calamity().LungingDown = false;
|
||||
Projectile.active = false;
|
||||
@@ -190,59 +190,34 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Owner.itemAnimation = 2;
|
||||
}
|
||||
|
||||
public void SlamDown()
|
||||
public void SlamDown(Vector2 collisionSpot)
|
||||
{
|
||||
SoundEngine.PlaySound(GroundImpact, Projectile.Center);
|
||||
|
||||
|
||||
if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f)
|
||||
return;
|
||||
|
||||
// Sound and screenshake
|
||||
SoundEngine.PlaySound(GroundImpact, Projectile.Center);
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15;
|
||||
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType<EarthenTidesMonolith>(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f);
|
||||
proj.timeLeft = 81;
|
||||
// Dust and particles from the impact
|
||||
for (int d = 0; d < 13; d++)
|
||||
Dust.NewDustPerfect(collisionSpot, Main.rand.NextBool() ? DustID.Clay : DustID.Dirt, Main.rand.NextVector2CircularEdge(6f, 6f), Scale: 1.2f);
|
||||
|
||||
|
||||
SideSprouts(1, 150f, 1f * Charge / MaxCharge);
|
||||
SideSprouts(-1, 150f, 1f * Charge / MaxCharge);
|
||||
|
||||
}
|
||||
|
||||
public bool SideSprouts(float facing, float distance, float projSize)
|
||||
{
|
||||
float widestAngle = 0f;
|
||||
float widestSurfaceAngle = 0f;
|
||||
bool validPositionFound = false;
|
||||
for (float i = 0f; i < 1; i += 1 / distance)
|
||||
CustomPulse shatter = new(collisionSpot, Vector2.Zero, Color.SandyBrown, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.03f, 0.275f, 30);
|
||||
GeneralParticleHandler.SpawnParticle(shatter);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
|
||||
|
||||
if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid())
|
||||
widestAngle = i;
|
||||
|
||||
else if (widestAngle != 0)
|
||||
{
|
||||
validPositionFound = true;
|
||||
widestSurfaceAngle = widestAngle;
|
||||
}
|
||||
Vector2 rockVel = -(Owner.velocity * 0.55f).RotatedByRandom(MathHelper.Pi / 2.5f);
|
||||
StoneDebrisParticle rock = new(collisionSpot, rockVel, Color.White, 1f, 35);
|
||||
GeneralParticleHandler.SpawnParticle(rock);
|
||||
}
|
||||
|
||||
if (validPositionFound)
|
||||
{
|
||||
Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
|
||||
Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize));
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType<EarthenTidesMonolith>(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
|
||||
if (proj.ModProjectile is EarthenTidesMonolith monolith)
|
||||
{
|
||||
monolith.WaitTimer = (1 - projSize) * 34f;
|
||||
monolith.OriginDirection = direction;
|
||||
monolith.Facing = facing;
|
||||
}
|
||||
}
|
||||
// Spawn the blast spawner
|
||||
// Its duration scales with the current charge level
|
||||
int duration = 12 + (int)CurrentIndicator * 12;
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType<EarthenTidesBlastSpawner>(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 0f, Owner.whoAmI, duration);
|
||||
|
||||
return validPositionFound;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
@@ -253,6 +228,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind)
|
||||
WhirlwindAttunement.RealPassiveEffect(target);
|
||||
|
||||
if (!CalamityUtils.AnyProjectiles(ProjectileType<EarthenTidesShockwave>()))
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType<EarthenTidesShockwave>(), (int)(Projectile.damage * 0.5f), 0f, Owner.whoAmI, 1f);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class EarthenTidesBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/PrimordialAncientProjectile";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetStaticDefaults() => Main.projFrames[Type] = 6;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 140;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 72;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 40;
|
||||
Projectile.scale = 0.05f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0.9f, 0.45f, 0.05f);
|
||||
Projectile.rotation = Projectile.ai[0];
|
||||
if (Projectile.timeLeft > 12)
|
||||
{
|
||||
if (Projectile.scale < Projectile.ai[1])
|
||||
Projectile.scale += (Projectile.ai[1] - 0.05f) / 12f;
|
||||
}
|
||||
else
|
||||
Projectile.scale -= (Projectile.ai[1] - 0.05f) / 12f;
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 2)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame++;
|
||||
if (Projectile.frame >= Main.projFrames[Projectile.type])
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind)
|
||||
WhirlwindAttunement.RealPassiveEffect(target);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc)
|
||||
sword.OnHitProc = true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class EarthenTidesBlastSpawner : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 50;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Set how long the spawner will exist
|
||||
// 30-40-50-60 for 25%-50%-75%-100%
|
||||
if (Projectile.ai[1] == 0f)
|
||||
{
|
||||
Projectile.timeLeft = (int)Projectile.ai[0];
|
||||
Projectile.ai[1]++;
|
||||
}
|
||||
|
||||
// Constantly stay on top of the owner
|
||||
Projectile.Center = Main.player[Projectile.owner].Center;
|
||||
|
||||
// Spawn dust blasts
|
||||
if (Projectile.timeLeft % 6 == 3)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float randomX = Main.rand.NextFloat(-200f, 200f);
|
||||
float randomY = Main.rand.NextFloat(-200f, 200f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.Center.X + randomX, Projectile.Center.Y + randomY), Vector2.Zero, ModContent.ProjectileType<EarthenTidesBlast>(), Projectile.damage, Projectile.knockBack, Main.myPlayer, Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi), Main.rand.NextFloat(0.96f, 1.04f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class EarthenTidesMonolith : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float Timer => (100f - Projectile.timeLeft) / 100f;
|
||||
public ref float Variant => ref Projectile.ai[0]; //Yes
|
||||
public ref float Size => ref Projectile.ai[1]; //Yes
|
||||
public float WaitTimer; //How long until the monolith appears
|
||||
public Vector2 OriginDirection; //The direction of the original strike
|
||||
public float Facing; //The direction of the original strike
|
||||
public const float BaseWidth = 90f;
|
||||
public const float BaseHeight = 420f;
|
||||
|
||||
public CurveSegment StaySmall = new CurveSegment(EasingType.Linear, 0f, 0.2f, 0f);
|
||||
public CurveSegment GoBig = new CurveSegment(EasingType.SineOut, 0.25f, 0.2f, 1f);
|
||||
public CurveSegment GoNormal = new CurveSegment(EasingType.CircIn, 0.4f, 1.2f, -0.2f);
|
||||
public CurveSegment StayNormal = new CurveSegment(EasingType.Linear, 0.5f, 1f, 0f);
|
||||
|
||||
internal float Width() => PiecewiseAnimation(Timer, new CurveSegment[] { StaySmall, GoBig, GoNormal, StayNormal }) * BaseWidth * Size;
|
||||
|
||||
public CurveSegment Anticipate = new CurveSegment(EasingType.CircIn, 0f, 0f, 0.15f);
|
||||
public CurveSegment Overextend = new CurveSegment(EasingType.SineOut, 0.2f, 0.15f, 1f);
|
||||
public CurveSegment Unextend = new CurveSegment(EasingType.CircIn, 0.25f, 1.15f, -0.15f);
|
||||
public CurveSegment Hold = new CurveSegment(EasingType.ExpOut, 0.70f, 1f, -0.1f);
|
||||
internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight * Size;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.width = Projectile.height = 70;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 102;
|
||||
Projectile.hide = true;
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => WaitTimer <= 0;
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float collisionPoint = 0f;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + ((Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
|
||||
{
|
||||
behindNPCsAndTiles.Add(index);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.velocity != Vector2.Zero)
|
||||
{
|
||||
SurfaceUp();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
if (WaitTimer > 0)
|
||||
{
|
||||
Projectile.timeLeft = 102;
|
||||
WaitTimer--;
|
||||
}
|
||||
|
||||
if (Projectile.timeLeft == 100)
|
||||
{
|
||||
if (Size >= 1) //Big monoliths create sparkles even before sprouting up
|
||||
{
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Sparkle);
|
||||
}
|
||||
}
|
||||
|
||||
if (Size * 0.8 > 0.4 && Facing != 0)
|
||||
{
|
||||
SideSprouts(Facing, 150f, Size * 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.timeLeft == 80)
|
||||
{
|
||||
Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2();
|
||||
SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f);
|
||||
Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f);
|
||||
Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 30f);
|
||||
Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4));
|
||||
|
||||
Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f);
|
||||
GeneralParticleHandler.SpawnParticle(Rock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron.
|
||||
public void SurfaceUp()
|
||||
{
|
||||
for (float i = 0; i < 40; i += 0.5f)
|
||||
{
|
||||
Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i;
|
||||
if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid())
|
||||
{
|
||||
Projectile.Center = Projectile.Center + Projectile.velocity * i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
Projectile.Center = Projectile.Center + Projectile.velocity * 40f;
|
||||
}
|
||||
|
||||
public bool SideSprouts(float facing, float distance, float projSize)
|
||||
{
|
||||
float widestAngle = 0f;
|
||||
float widestSurfaceAngle = 0f;
|
||||
bool validPositionFound = false;
|
||||
for (float i = 0f; i < 1; i += 1 / distance)
|
||||
{
|
||||
Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
|
||||
|
||||
if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid())
|
||||
widestAngle = i;
|
||||
|
||||
else if (widestAngle != 0)
|
||||
{
|
||||
validPositionFound = true;
|
||||
widestSurfaceAngle = widestAngle;
|
||||
}
|
||||
}
|
||||
|
||||
if (validPositionFound)
|
||||
{
|
||||
Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
|
||||
Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize));
|
||||
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType<EarthenTidesMonolith>(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
|
||||
if (proj.ModProjectile is EarthenTidesMonolith monolith)
|
||||
{
|
||||
monolith.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f;
|
||||
monolith.OriginDirection = OriginDirection;
|
||||
monolith.Facing = facing;
|
||||
}
|
||||
}
|
||||
|
||||
return validPositionFound;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind)
|
||||
WhirlwindAttunement.RealPassiveEffect(target);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc)
|
||||
sword.OnHitProc = true;
|
||||
|
||||
if (Projectile.numHits > 0)
|
||||
modifiers.SourceDamage *= OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageFalloff;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (WaitTimer > 0)
|
||||
return false;
|
||||
|
||||
Texture2D tex = Request<Texture2D>("CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith").Value;
|
||||
|
||||
Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f;
|
||||
|
||||
float drawAngle = Projectile.rotation;
|
||||
Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420);
|
||||
|
||||
Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight);
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f;
|
||||
Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height);
|
||||
|
||||
float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f);
|
||||
|
||||
Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
public override void PostDraw(Color lightColor)
|
||||
{
|
||||
if (WaitTimer > 0)
|
||||
return;
|
||||
|
||||
Texture2D tex = Request<Texture2D>("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow").Value;
|
||||
|
||||
float drawAngle = Projectile.rotation;
|
||||
Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420);
|
||||
|
||||
Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight);
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f;
|
||||
Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height);
|
||||
|
||||
float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f);
|
||||
|
||||
Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0);
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(WaitTimer);
|
||||
writer.Write(Facing);
|
||||
writer.WriteVector2(OriginDirection);
|
||||
|
||||
}
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
WaitTimer = reader.ReadSingle();
|
||||
Facing = reader.ReadSingle();
|
||||
OriginDirection = reader.ReadVector2();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,12 @@ using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class EarthenTidesBlast : ModProjectile, ILocalizedModType
|
||||
public class EarthenTidesShockwave : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float Timer => (60f - Projectile.timeLeft) / 100f;
|
||||
public ref float Variant => ref Projectile.ai[0]; //Yes
|
||||
public ref float Size => ref Projectile.ai[0]; //Yes
|
||||
|
||||
public Particle BloomRing;
|
||||
@@ -53,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if (Projectile.timeLeft == 60)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item79, Projectile.Center);
|
||||
Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, Projectile.scale, 20, 0.2f, 2);
|
||||
Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.BurlyWood : Color.Brown, Projectile.scale, 20, 0.2f, 2);
|
||||
GeneralParticleHandler.SpawnParticle(Sparkle);
|
||||
}
|
||||
|
||||
@@ -63,21 +62,21 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center);
|
||||
|
||||
BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua, Projectile.scale, 40);
|
||||
BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Brown, Projectile.scale, 40);
|
||||
GeneralParticleHandler.SpawnParticle(BloomRing);
|
||||
|
||||
Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.Aqua * 0.6f : Color.SpringGreen * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20);
|
||||
Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.BurlyWood * 0.6f : Color.Brown * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20);
|
||||
GeneralParticleHandler.SpawnParticle(Bloom);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f);
|
||||
Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.SandyBrown : Color.LimeGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Sparkle);
|
||||
}
|
||||
|
||||
for (float i = 0f; i < 1; i += 0.05f)
|
||||
{
|
||||
float rotation = i * MathHelper.TwoPi;
|
||||
Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f);
|
||||
Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.SaddleBrown : Color.Brown, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Sparkle);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc)
|
||||
if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_ShockwaveProc)
|
||||
sword.OnHitProc = true;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 3.9 KiB |
Reference in new issue
Block a user