Throwing Brick retool + Gilded Gatherer improvements
This commit is contained in:
1 parent
dfd067b87d
commit
87bcf3a564
11 files changed
+81
-48
No files matched your search
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.width = 28;
|
||||
Item.height = 20;
|
||||
Item.damage = 17;
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shootSpeed = 15f;
|
||||
Item.shoot = ModContent.ProjectileType<Brick>();
|
||||
Item.useTime = Item.useAnimation = 35;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace CalamityMod.Particles
|
||||
private float Spin;
|
||||
private bool StrongVisual;
|
||||
private bool Glowing;
|
||||
private bool AffectedByLight = false;
|
||||
private float HueShift;
|
||||
static int FrameAmount = 6;
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ namespace CalamityMod.Particles
|
||||
public float Rotation;
|
||||
public float Scale;
|
||||
|
||||
/// <summary>
|
||||
/// Whether your particle is affected by light levels.
|
||||
/// </summary>
|
||||
public bool AffectedByLight = false;
|
||||
|
||||
public virtual int FrameVariants => 1;
|
||||
public int Variant = 0;
|
||||
public virtual string Texture => "";
|
||||
@@ -78,6 +83,7 @@ namespace CalamityMod.Particles
|
||||
/// </summary>
|
||||
public virtual bool UseHalfTransparency => false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes the particle from the handler
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace CalamityMod.Particles
|
||||
|
||||
public override string Texture => "CalamityMod/Particles/PointParticle";
|
||||
|
||||
public PointParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true)
|
||||
public PointParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true, bool affectedByLight = false)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
@@ -26,12 +26,17 @@ namespace CalamityMod.Particles
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = color;
|
||||
UseAltVisual = AddativeBlend;
|
||||
AffectedByLight = affectedByLight;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Scale *= 0.95f;
|
||||
Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D));
|
||||
if (AffectedByLight)
|
||||
{
|
||||
Color = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGBA(Color);
|
||||
}
|
||||
Velocity *= 0.95f;
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace CalamityMod.Particles
|
||||
private Color ColorFire;
|
||||
private Color ColorFade;
|
||||
private float Spin;
|
||||
private bool AffectedByLight = false;
|
||||
|
||||
public SmallSmokeParticle(Vector2 position, Vector2 velocity, Color colorFire, Color colorFade, float scale, float opacity, float rotationSpeed = 0f, bool affectedByLight = false)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace CalamityMod.Particles
|
||||
{
|
||||
public Color InitialColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool AffectedByLight = false;
|
||||
public bool FadeIn = false;
|
||||
public float FadeInScale = 0f;
|
||||
public override bool SetLifetime => true;
|
||||
|
||||
@@ -32,24 +32,24 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public NPC npcToTarget = null;
|
||||
public Vector2 latchOffset;
|
||||
public Vector2 mousePos;
|
||||
public override Vector2 SpriteOrigin => new(4,4);
|
||||
public override Vector2 SpriteOrigin => new(4, 7);
|
||||
public override int AssignedItemID => ModContent.ItemType<GildedGatherer>();
|
||||
|
||||
public int DamageOverTime => 12;
|
||||
public int DamageOverTime => 24;
|
||||
public int DoTDelay => 10;
|
||||
public int AirblastDamageMax => 50;
|
||||
public int AirblastDamageMin => 10;
|
||||
public int DoTDelay => 5;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
base.SetDefaults();
|
||||
Projectile.width = 16;
|
||||
Projectile.height = 16;
|
||||
Projectile.width = 42;
|
||||
Projectile.height = 14;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.height = 6;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hide = true;
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
@@ -124,10 +124,6 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
base.OnHitNPC(target, hit, damageDone);
|
||||
}
|
||||
public Vector2 ArmOffset()
|
||||
{
|
||||
return new Vector2(0, -6f * Main.player[Projectile.owner].direction).RotatedBy(Projectile.rotation);
|
||||
}
|
||||
public override void UseStyle()
|
||||
{
|
||||
DrawUnconditionally = true;
|
||||
@@ -263,7 +259,6 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.direction = Math.Sign(mousePos.X - player.Center.X);
|
||||
player.direction = Projectile.direction;
|
||||
player.itemAnimation = 2;
|
||||
Offset = ArmOffset();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
@@ -355,10 +350,10 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
for (float i = 0; i < LinePositions.Count; i++)
|
||||
{
|
||||
LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center + ArmOffset(), (i / (float)LinePositions.Count)),
|
||||
LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center, (i / (float)LinePositions.Count)),
|
||||
MathHelper.Clamp(CalamityUtils.CircInEasing(i / (float)LinePositions.Count, 1), 0f, 1f)
|
||||
);
|
||||
LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center + ArmOffset(), (i / (float)LinePositions.Count)),
|
||||
LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center, (i / (float)LinePositions.Count)),
|
||||
MathHelper.Lerp(1f,0f,CalamityUtils.CircOutEasing(i / (float)LinePositions.Count, 1))
|
||||
);
|
||||
}
|
||||
@@ -375,10 +370,14 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), lightColor, Projectile.rotation, new Vector2(12, 6), 1f, spriteEffects);
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, spriteEffects != SpriteEffects.None ? 4 : 0), tex.Frame(), lightColor, Projectile.rotation, new Vector2(12, 6), 1f, spriteEffects);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
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 ResetStyle()
|
||||
{
|
||||
|
||||
@@ -391,14 +390,12 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
if (poss.Count > 0)
|
||||
{
|
||||
poss[0] = AbsolutePosition + new Vector2(0, 6);
|
||||
poss[1] = AbsolutePosition + new Vector2(0, 6);
|
||||
|
||||
if (poss.Count > 1)
|
||||
{
|
||||
poss[poss.Count - 1] = Main.player[Projectile.owner].Center + ArmOffset();
|
||||
}
|
||||
if (poss.Count > 2)
|
||||
{
|
||||
poss[poss.Count - 2] = Main.player[Projectile.owner].Center + ArmOffset();
|
||||
poss[poss.Count - 1] = Main.player[Projectile.owner].Center;
|
||||
poss[poss.Count - 2] = Vector2.Lerp(poss[poss.Count - 2], Main.player[Projectile.owner].Center, 0.99f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,12 +408,15 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
poss[i] = vec2;
|
||||
}
|
||||
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/GildedGathererHarpoon_Line");
|
||||
|
||||
GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(tex);
|
||||
|
||||
GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(tex.Width());
|
||||
|
||||
PrimitiveRenderer.RenderTrail(poss, new PrimitiveSettings(W => { return 3f; },
|
||||
C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()).MultiplyRGB(new Color(50, 55, 85)); },
|
||||
null, false, true));
|
||||
PrimitiveRenderer.RenderTrail(poss, new PrimitiveSettings(W => { return 1f; },
|
||||
C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()).MultiplyRGB(new Color(155, 200, 255)); },
|
||||
null, false, true));
|
||||
C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()); },
|
||||
null, false, true, GameShaders.Misc["CalamityMod:PrimitiveTexture"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 313 B |
Binary file not shown.
|
After Width: | Height: | Size: 205 B |
+28
-15
@@ -1,4 +1,7 @@
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using System.Diagnostics;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -14,6 +17,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 19;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.height = 19;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
@@ -21,9 +25,14 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.ai[0] = Projectile.Calamity().stealthStrike ? 1 : 0;
|
||||
if (Main.rand.NextBool(3)) GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(12), 0).RotatedBy(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(Main.rand.NextFloat(-20, 20))), false, 10, Projectile.ai[0] == 1 ? 0.4f : 0.3f, Projectile.ai[0] == 1 ? Color.OrangeRed : Color.SaddleBrown, false));
|
||||
|
||||
Projectile.ai[1]++;
|
||||
//Constant rotation and gravity
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.3f;
|
||||
Projectile.velocity.X *= 0.98f;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + MathHelper.Clamp(Projectile.ai[1] / 40, 0, 0.6f);
|
||||
if (Projectile.velocity.Y > 16f)
|
||||
{
|
||||
Projectile.velocity.Y = 16f;
|
||||
@@ -37,35 +46,39 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
Projectile.ai[0] = Projectile.Calamity().stealthStrike ? 1 : 0;
|
||||
SoundEngine.PlaySound(SoundID.Item50, Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(0.5f, 1f)), Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(-1f, -0.5f)), Projectile.position);
|
||||
//Dust on impact
|
||||
int dust_splash = 0;
|
||||
while (dust_splash < 9)
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f);
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Projectile.ai[0] == 1 ? 1.2f : 0.6f, Projectile.ai[0] == 1 ? Color.OrangeRed : Color.SaddleBrown, false));
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, 0f, 0f, 0, default, 0.5f);
|
||||
dust_splash += 1;
|
||||
}
|
||||
// This only triggers if stealth is full
|
||||
if (Projectile.ai[0] == 1)
|
||||
{
|
||||
dust_splash = 0;
|
||||
while (dust_splash < 9)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(24), 0).RotatedByRandom(MathHelper.TwoPi), false, 6, 0.6f, Color.SaddleBrown, false));
|
||||
GeneralParticleHandler.SpawnParticle(new SmallSmokeParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), Color.SaddleBrown, Color.SaddleBrown, Main.rand.NextFloat(1f, 1.5f), 150, affectedByLight: true));
|
||||
dust_splash += 1;
|
||||
}
|
||||
int split = 0;
|
||||
while (split < 5)
|
||||
{
|
||||
//Calculate the velocity of the projectile
|
||||
float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.1f, .15f) + Main.rand.NextFloat(-3f, 3f);
|
||||
float shardspeedY = -Projectile.velocity.Y * Main.rand.NextFloat(.5f, .9f) + Main.rand.NextFloat(-6f, -3f);
|
||||
//Prevents the projectile speed from being too low
|
||||
if (shardspeedX < 1f && shardspeedX > -1f)
|
||||
{
|
||||
shardspeedX += -Projectile.velocity.X;
|
||||
}
|
||||
if (shardspeedY > -3f)
|
||||
{
|
||||
shardspeedY += -Projectile.velocity.Y;
|
||||
}
|
||||
Vector2 shardspeed = new Vector2(Main.rand.Next(3, 8), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
|
||||
Vector2 speedAdd = -Projectile.velocity;
|
||||
speedAdd.Normalize();
|
||||
shardspeed += speedAdd * 9;
|
||||
//Spawn the projectile
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType<BrickFragment>(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position + shardspeed, shardspeed, ModContent.ProjectileType<BrickFragment>(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner);
|
||||
split += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -15,14 +17,17 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
Projectile.friendly = true;
|
||||
Projectile.width = 16;
|
||||
Projectile.scale = Main.rand.NextFloat(0.4f, 0.8f);
|
||||
Projectile.height = 16;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.ai[0]++;
|
||||
//Rotation and gravity
|
||||
Projectile.rotation += 0.6f * Projectile.direction;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.27f;
|
||||
Projectile.rotation += MathHelper.ToRadians(3f) * Projectile.direction;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.27f + MathHelper.Clamp(Projectile.ai[0] / 40, 0, 0.5f);
|
||||
Projectile.velocity.X *= 0.97f;
|
||||
if (Projectile.velocity.Y > 16f)
|
||||
{
|
||||
Projectile.velocity.Y = 16f;
|
||||
@@ -31,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
|
||||
SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(0.5f)).WithVolumeScale(0.6f), Projectile.position);
|
||||
//Dust effect
|
||||
int splash = 0;
|
||||
while (splash < 4)
|
||||
@@ -39,6 +44,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f);
|
||||
splash += 1;
|
||||
}
|
||||
int dust_splash = 0;
|
||||
while (dust_splash < 9)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(8), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, 0.4f, Color.SaddleBrown, false));
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, 0f, 0f, 0, default, 0.5f);
|
||||
dust_splash += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user