Mantis Claw rework
Additionally, changed GeneralParticleHandler's code to account for AffectedByLight in default drawing
This commit is contained in:
1 parent
201786e907
commit
25c87a8a64
12 files changed
+602
-38
No files matched your search
@@ -2,54 +2,43 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using CalamityMod.Balancing;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class MantisClaws : ModItem, ILocalizedModType
|
||||
public class MantisClaws : CustomUseProjItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
base.SetDefaults();
|
||||
Item.width = 26;
|
||||
Item.height = 20;
|
||||
Item.damage = 144;
|
||||
Item.damage = 125;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = 8;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTime = 8;
|
||||
Item.useTurn = true;
|
||||
Item.knockBack = 7f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useStyle = ItemUseStyleID.HiddenAnimation;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 25;
|
||||
Item.noMelee = true;
|
||||
Item.useTime = 25;
|
||||
Item.shoot = ModContent.ProjectileType<MantisClawHoldout>();
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
public override bool AltFunctionUse(Player player)
|
||||
{
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Water);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
|
||||
//does no damage. Explosion is visual
|
||||
Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<FuckYou>(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
|
||||
target.AddBuff(BuffID.OnFire3, 300);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
|
||||
//does no damage. Explosion is visual
|
||||
Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<FuckYou>(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
|
||||
target.AddBuff(BuffID.OnFire3, 300);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,3 +304,6 @@ WulfrumScrew.DisplayName: Wulfrum Screw
|
||||
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
|
||||
YinYoDark.DisplayName: Dark Shard
|
||||
YinYoLight.DisplayName: Light Shard
|
||||
MantisClawHoldout.DisplayName: Mantis Claw Holdout
|
||||
MantisClawSlash.DisplayName: Mantis Claw Slash
|
||||
MantisClawJet.DisplayName: Mantis Claw Jet
|
||||
@@ -165,8 +165,14 @@ namespace CalamityMod.Particles
|
||||
particle.CustomDraw(sb);
|
||||
else
|
||||
{
|
||||
Color lightColor = particle.Color;
|
||||
if (particle.AffectedByLight)
|
||||
{
|
||||
lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint()));
|
||||
}
|
||||
|
||||
Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant);
|
||||
sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f,
|
||||
sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f,
|
||||
particle.Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using ReLogic.Content;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class MantisPunch : Particle
|
||||
{
|
||||
int Frame = 0;
|
||||
int FrameTimer = 0;
|
||||
|
||||
public override string Texture => "CalamityMod/Particles/MantisPunch";
|
||||
public override bool UseCustomDraw => true;
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, tex.Frame(1, 6, 0, Frame), Lighting.GetColor((Position / 16).ToPoint()), Rotation, Origin, 1f, SpriteEffects.None);
|
||||
}
|
||||
public MantisPunch(Vector2 position, float rotation)
|
||||
{
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
|
||||
Origin = new Vector2(32, 56);
|
||||
|
||||
AffectedByLight = true;
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
FrameTimer++;
|
||||
if (FrameTimer % 3 == 0)
|
||||
{
|
||||
Frame++;
|
||||
}
|
||||
if (Frame >= 6)
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -2,6 +2,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Renderers;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
@@ -44,8 +45,14 @@ namespace CalamityMod.Particles
|
||||
Vector2 scale = new Vector2(0.65f, 1f) * Scale;
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f);
|
||||
Color lightColor = Color;
|
||||
if (AffectedByLight)
|
||||
{
|
||||
lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint()));
|
||||
}
|
||||
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, lightColor, Rotation, texture.Size() * 0.5f, scale, 0, 0f);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, lightColor, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool ItemAnimationActive = Owner.ItemAnimationActive;
|
||||
|
||||
if (Owner.HeldItem.type != AssignedItemID)
|
||||
{
|
||||
Projectile.Kill();
|
||||
@@ -174,7 +176,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
Owner.Calamity().rightClickListener = true;
|
||||
|
||||
if (Owner.ItemAnimationActive)
|
||||
if (ItemAnimationActive)
|
||||
{
|
||||
Animation++;
|
||||
|
||||
@@ -210,18 +212,19 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
Projectile.position = AbsolutePosition - (Projectile.Size / 2) + Offset;
|
||||
}
|
||||
|
||||
if (Owner.itemAnimation == 1)
|
||||
if (AnimationProgress == Owner.itemAnimationMax - 1)
|
||||
{
|
||||
OnEndUse();
|
||||
NumberOfAnimations++;
|
||||
}
|
||||
|
||||
if (Owner.ItemAnimationJustStarted)
|
||||
if (Owner.itemAnimation == Owner.itemAnimationMax - 1)
|
||||
{
|
||||
Projectile.timeLeft = Owner.HeldItem.useAnimation + 1;
|
||||
if (DrawUnconditionally) Projectile.timeLeft = 100;
|
||||
OnBeginUse();
|
||||
}
|
||||
|
||||
if (DrawUnconditionally) Projectile.timeLeft = Math.Max(Projectile.timeLeft, 2);
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using CalamityMod.Balancing;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.DataStructures;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class MantisClawHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
|
||||
{
|
||||
bool AnimationCooldown = false;
|
||||
|
||||
int JetDamage => 900;
|
||||
int SlashDamage => 125;
|
||||
int SlashSpeed => 6;
|
||||
|
||||
int BlastChargeUses => 3;
|
||||
float SlashTimer = 0;
|
||||
|
||||
public override Vector2 SpriteOrigin => new(0, 20);
|
||||
|
||||
public override int AssignedItemID => ModContent.ItemType<MantisClaws>();
|
||||
|
||||
public float ClawOpenness = MathHelper.ToRadians(80);
|
||||
public float BubbleSize = 0f;
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/MantisClaws";
|
||||
public override void ResetStyle()
|
||||
{
|
||||
if (AnimationCooldown)
|
||||
{
|
||||
if (NumberOfAnimations % 5 <= BlastChargeUses)
|
||||
{
|
||||
ClawOpenness = MathHelper.Lerp(ClawOpenness, MathHelper.ToRadians(80f), 0.15f);
|
||||
|
||||
BubbleSize *= 0.85f;
|
||||
|
||||
if (BubbleSize < 0.05f)
|
||||
{
|
||||
Projectile.scale -= 0.1f;
|
||||
|
||||
if (Projectile.scale < 0.1f)
|
||||
Projectile.active = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Clamp();
|
||||
}
|
||||
Offset = new Vector2(MathHelper.Lerp(0, 12, BubbleSize / 2), 0).RotatedBy(Projectile.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clamp()
|
||||
{
|
||||
if (BubbleSize != 0f)
|
||||
{
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation),
|
||||
Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType<MantisClawJet>(), JetDamage, 7, Owner.whoAmI);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
WaterFlavoredParticle waterFlavored = new WaterFlavoredParticle(Owner.Center, new Vector2(Main.rand.NextFloat(15, 25), 0).RotatedBy(Projectile.rotation + MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), true, 40, Main.rand.NextFloat(0.5f, 1.2f), MantisClawJet.WaterColor);
|
||||
waterFlavored.AffectedByLight = true;
|
||||
GeneralParticleHandler.SpawnParticle(waterFlavored);
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), Owner.Center);
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), Owner.Center);
|
||||
|
||||
Owner.Calamity().GeneralScreenShakePower = 2.5f;
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new MantisPunch(Owner.Center + new Vector2(26, 0).RotatedBy(Projectile.rotation), Projectile.rotation));
|
||||
}
|
||||
|
||||
ClawOpenness = MathHelper.ToRadians(80);
|
||||
BubbleSize = 0f;
|
||||
}
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
if (Owner.altFunctionUse != 2)
|
||||
{
|
||||
if (AnimationCooldown)
|
||||
{
|
||||
if (!Owner.Calamity().mouseRight)
|
||||
{
|
||||
if (Owner.itemAnimation > 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
DrawUnconditionally = true;
|
||||
AnimationCooldown = true;
|
||||
Owner.itemAnimation = 0;
|
||||
Owner.itemTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.scale = 1f;
|
||||
|
||||
DrawUnconditionally = false;
|
||||
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
|
||||
{
|
||||
if (SlashTimer % SlashSpeed == 0)
|
||||
{
|
||||
SoundStyle SlashStyle = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe" + (Main.rand.Next(2) + 1).ToString());
|
||||
SlashStyle.PitchVariance = 0.3f;
|
||||
SlashStyle.Volume = 0.7f;
|
||||
|
||||
SoundEngine.PlaySound(SlashStyle.WithPitchOffset(0.2f), Owner.Center);
|
||||
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType<MantisClawSlash>(), SlashDamage, 4f, Owner.whoAmI).rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25));
|
||||
}
|
||||
|
||||
SlashTimer++;
|
||||
}
|
||||
|
||||
Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X);
|
||||
Projectile.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld);
|
||||
|
||||
Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], MathHelper.ToRadians(135f * (SlashTimer % (SlashSpeed * 2) < SlashSpeed ? 1 : -1)), 0.2f);
|
||||
|
||||
ArmRotationOffset = MathHelper.ToRadians(-90f) - (Projectile.ai[2]) * Owner.direction;
|
||||
ArmRotationOffsetBack = MathHelper.ToRadians(-90f) + (Projectile.ai[2]) * Owner.direction;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.15f);
|
||||
Projectile.scale = MathHelper.Clamp(Projectile.scale, 0f, 1f);
|
||||
if (Owner.Calamity().mouseRight)
|
||||
{
|
||||
Owner.itemAnimation = 3;
|
||||
|
||||
float chargeFactor = (float)(NumberOfAnimations % 5f) / 3f;
|
||||
|
||||
DrawUnconditionally = true;
|
||||
|
||||
ArmRotationOffset = MathHelper.ToRadians(-90f) - (ClawOpenness / 5) * Owner.direction;
|
||||
ArmRotationOffsetBack = MathHelper.ToRadians(-90f) + (ClawOpenness / 5) * Owner.direction;
|
||||
if (NumberOfAnimations % 5 > BlastChargeUses)
|
||||
{
|
||||
Clamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
|
||||
Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X);
|
||||
Projectile.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld);
|
||||
|
||||
Projectile.ai[0]++;
|
||||
|
||||
if (AnimationProgress == 1)
|
||||
{
|
||||
if (NumberOfAnimations % 5 == 0)
|
||||
{
|
||||
ClawOpenness = MathHelper.ToRadians(80);
|
||||
BubbleSize = 0f;
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset((float)NumberOfAnimations % 5 / (float)BlastChargeUses), Owner.Center);
|
||||
|
||||
Projectile.ai[1] = MathHelper.Lerp(0.5f, 2f, chargeFactor);
|
||||
Projectile.ai[2] = MathHelper.Lerp(MathHelper.ToRadians(100f), MathHelper.ToRadians(180f), chargeFactor);
|
||||
}
|
||||
|
||||
BubbleSize = MathHelper.Lerp(BubbleSize, Projectile.ai[1], 0.2f);
|
||||
ClawOpenness = MathHelper.Lerp(ClawOpenness, Projectile.ai[2], 0.2f);
|
||||
}
|
||||
|
||||
Offset = new Vector2(MathHelper.Lerp(0, 12, BubbleSize / 2), 0).RotatedBy(Projectile.rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Owner.controlUseItem)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
DrawUnconditionally = true;
|
||||
AnimationCooldown = true;
|
||||
Owner.itemAnimation = 0;
|
||||
Owner.itemTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
{
|
||||
FlipAsSword = false;
|
||||
float rot = 0f;
|
||||
if (Owner.altFunctionUse != 2 && !AnimationCooldown)
|
||||
{
|
||||
rot = Projectile.ai[2];
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
FlipAsSword = true;
|
||||
|
||||
RotationOffset = MathHelper.ToRadians(-90f);
|
||||
|
||||
Owner.compositeFrontArm.rotation -= RotationOffset;
|
||||
Owner.compositeBackArm.rotation -= RotationOffset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RotationOffset = 0f;
|
||||
}
|
||||
|
||||
// Bubble texture drawing
|
||||
|
||||
Asset<Texture2D> Bubble = ModContent.Request<Texture2D>("CalamityMod/Particles/Bubble");
|
||||
|
||||
Main.EntitySpriteDraw(Bubble.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY) + new Vector2(20, 0).RotatedBy(Projectile.rotation + RotationOffset), Bubble.Frame(), lightColor, 0f, Bubble.Size() / 2, BubbleSize, SpriteEffects.None);
|
||||
|
||||
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
|
||||
if (Owner.itemAnimation > 0 || DrawUnconditionally)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
float r = FlipAsSword ? 0f : MathHelper.ToRadians(90);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation - ClawOpenness + rot + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
||||
}
|
||||
if (Owner.itemAnimation > 0 || DrawUnconditionally)
|
||||
{
|
||||
|
||||
if (Owner.altFunctionUse == 2 || AnimationCooldown)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
float r = FlipAsSword ? 0f : MathHelper.ToRadians(90);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + ClawOpenness + RotationOffset + r, !FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.None : SpriteEffects.FlipHorizontally));
|
||||
}
|
||||
else
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
float r = FlipAsSword ? 0f : MathHelper.ToRadians(90);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation - ClawOpenness - rot + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Projectile.scale = 0f;
|
||||
Projectile.damage = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using CalamityMod.Balancing;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.DataStructures;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class MantisClawJet : ModProjectile, ILocalizedModType
|
||||
{
|
||||
int TimerCap = 70;
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Particles/ThunderBolt";
|
||||
|
||||
public static Color WaterColor = new Color(114, 197, 255, 0);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 60;
|
||||
Projectile.timeLeft = TimerCap;
|
||||
Projectile.knockBack = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 4;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.ai[1] = 40;
|
||||
}
|
||||
|
||||
int dir = 1;
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Projectile.ai[1] = 40;
|
||||
}
|
||||
|
||||
public override void ModifyDamageHitbox(ref Rectangle hitbox)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.velocity *= 0.97f;
|
||||
|
||||
if (Projectile.ai[0] < 16) Projectile.ai[1] -= 2;
|
||||
|
||||
Projectile.ai[0]++;
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float ii = ((float)i) / 6f;
|
||||
Vector2 position = Vector2.Lerp(Projectile.position, Projectile.oldPos[5], ii);
|
||||
|
||||
float Prog = MathHelper.Lerp(3, 1, (float)Projectile.timeLeft / (float)TimerCap);
|
||||
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f) * Prog, 411);
|
||||
bubble.timeLeft = 8 + Main.rand.Next(6);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f) * (1 + Prog * 0.4f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
float ii = ((float)i) / 3f;
|
||||
Vector2 position = Vector2.Lerp(Projectile.position, Projectile.oldPos[5], ii);
|
||||
|
||||
float Prog = MathHelper.Lerp(3, 10, (float)Projectile.timeLeft / (float)TimerCap);
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new WaterFoamParticle(position, Projectile.velocity * 0.4f, 10 - (i * 2), Prog, WaterColor));
|
||||
}
|
||||
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
List<Vector2> positions = new();
|
||||
|
||||
for (int i = 0; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
positions.Add(Projectile.oldPos[i]);
|
||||
}
|
||||
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>(Texture));
|
||||
|
||||
PrimitiveRenderer.RenderTrail(positions, new PrimitiveSettings(AA => { return Projectile.ai[1]; }, CC => { return Lighting.GetColor(Vector2.Lerp(Projectile.oldPos[Projectile.oldPos.Length - 1], Projectile.position, CC).ToPoint()).MultiplyRGBA(WaterColor); }, shader: GameShaders.Misc["CalamityMod:TrailStreak"]));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.BaseItems;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using CalamityMod.Balancing;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.DataStructures;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Terraria.Graphics.Shaders;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class MantisClawSlash : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public int TimerCap => 20;
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Particles/SlashSmear";
|
||||
|
||||
Color startColor;
|
||||
Color endColor;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 60;
|
||||
Projectile.timeLeft = TimerCap;
|
||||
Projectile.knockBack = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.width = 256;
|
||||
Projectile.height = 256;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
}
|
||||
|
||||
int dir = 1;
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Projectile.scale = 0f;
|
||||
Projectile.ai[2] = Main.rand.NextFloat(0.5f, 1.25f);
|
||||
|
||||
if (Main.rand.NextBool(2)) dir = -1;
|
||||
|
||||
// i cherry picked five specific colors to make a similar but different palette to the claws themselves
|
||||
// of those five, the projectile lerps between two, randomly chosen when the projectile is spawned
|
||||
List<Color> ColorList =
|
||||
[
|
||||
new Color(248, 197, 58),
|
||||
new Color(143, 208, 50),
|
||||
new Color(69, 114, 227),
|
||||
new Color(212, 128, 187),
|
||||
new Color(255, 140, 82),
|
||||
];
|
||||
|
||||
startColor = ColorList[Main.rand.Next(ColorList.Count)];
|
||||
endColor = ColorList[Main.rand.Next(ColorList.Count)];
|
||||
}
|
||||
|
||||
public override void ModifyDamageHitbox(ref Rectangle hitbox)
|
||||
{
|
||||
hitbox = new Rectangle((int)Projectile.Center.X - 65, (int)Projectile.Center.Y - 65, 130, 130);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.velocity *= 0.9f;
|
||||
|
||||
if (Projectile.timeLeft > (TimerCap / 2))
|
||||
{
|
||||
Projectile.scale = MathHelper.Lerp(Projectile.scale, Projectile.ai[2], 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.scale = MathHelper.Lerp(Projectile.scale, Projectile.ai[2], -0.1f);
|
||||
}
|
||||
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f) * dir);
|
||||
|
||||
Projectile.ai[1]++;
|
||||
|
||||
Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], MathHelper.TwoPi * dir, 0.15f);
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
for (float i = 0; i < 1; i += 0.33f)
|
||||
{
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)),
|
||||
Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user