deathhail/eradicator

This commit is contained in:
Doze-Zoze committed 2025-06-19 14:25:44 -05:00
1 parent 8eea82d8e9
commit daa4b65956
5 files changed
+288 -91

No files matched your search

+4 -51
View File
@@ -22,11 +22,11 @@ namespace CalamityMod.Items.Weapons.Magic
{
Item.width = 80;
Item.height = 84;
Item.damage = 328;
Item.damage = 1500;
Item.DamageType = DamageClass.Magic;
Item.mana = 16;
Item.useTime = 11;
Item.useAnimation = 22;
Item.useTime = 30;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 4f;
@@ -45,54 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
int i = Main.myPlayer;
float beamSpeed = Item.shootSpeed;
float beamKnockback = knockback;
beamKnockback = player.GetWeaponKnockback(Item, beamKnockback);
player.itemTime = Item.useTime;
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (player.gravDir == -1f)
{
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
{
mouseXDist = (float)player.direction;
mouseYDist = 0f;
mouseDistance = beamSpeed;
}
else
{
mouseDistance = beamSpeed / mouseDistance;
}
int numLasers = 2;
for (int j = 0; j < numLasers; j++)
{
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(91) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
realPlayerPos.Y -= (float)(100 * j);
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (mouseYDist < 0f)
{
mouseYDist *= -1f;
}
if (mouseYDist < 20f)
{
mouseYDist = 20f;
}
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
mouseDistance = beamSpeed / mouseDistance;
mouseXDist *= mouseDistance;
mouseYDist *= mouseDistance;
float speedX4 = mouseXDist + (float)Main.rand.Next(-50, 51) * 0.02f;
float speedY5 = mouseYDist + (float)Main.rand.Next(-50, 51) * 0.02f;
Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, beamKnockback, i, 0f, 0f);
}
Projectile.NewProjectile(source, player.Calamity().mouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI,1);
return false;
}
}
@@ -169,3 +169,5 @@ WaterSpear.DisplayName: Water Spear
YharonBulletHellVortex.DisplayName: Bullet Hell Vortex
YharonFireball.DisplayName: Dragon Fireball
YharonFireball2.DisplayName: Dragon Fireball
DeathhailBeam.DisplayName: Deathhail Beam
FriendlyLaserWallBeam.DisplayName: Friendly Laser Wall Beam
+125 -32
View File
@@ -1,59 +1,152 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class DeathhailBeam : BaseLaserbeamProjectile, ILocalizedModType
public class DeathhailBeam : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private Color startingColor = new Color(119, 210, 255);
private Color secondColor = new Color(247, 119, 255);
public override float MaxScale => 0.7f;
public override float MaxLaserLength => 1599.999999f;
public override float Lifetime => 20f;
public override Color LaserOverlayColor => CalamityUtils.ColorSwap(startingColor, secondColor, 0.9f);
public override Color LightCastColor => LaserOverlayColor;
public override Texture2D LaserBeginTexture => ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Lasers/UltimaRayStart", AssetRequestMode.ImmediateLoad).Value;
public override Texture2D LaserMiddleTexture => ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Lasers/UltimaRayMid", AssetRequestMode.ImmediateLoad).Value;
public override Texture2D LaserEndTexture => ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd", AssetRequestMode.ImmediateLoad).Value;
public new string LocalizationCategory => "Projectiles.Boss";
public float time = 0;
public ref float attackSpeed => ref Projectile.ai[0];
public ref float laserType => ref Projectile.ai[2];
public bool canDamage => doneAttack && laserFX >= 1f;
public bool doneAttack = false;
public int attackTime = 30;
public float laserLength => 3000;
public float laserFX = 0;
public float storedTime = 0;
public Color drawColor = Color.Magenta;
public float sine = 0;
public float laserRot = 0;
Vector2 beamStart = Vector2.Zero;
Vector2 directionToTarget = Vector2.Zero;
public Vector2 targetPos => Projectile.Center;
public override void SetStaticDefaults()
{
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 22;
Projectile.width = 1;
Projectile.height = 1;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.alpha = 255;
Projectile.localNPCHitCooldown = -1;
Projectile.timeLeft = 6000;
Projectile.scale = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override bool PreAI()
public override void AI()
{
// Initialization. Using the AI hook would override the base laser's code, and we don't want that.
if (Projectile.localAI[0] == 0f)
if (laserFX > 0)
laserFX = MathHelper.Lerp(laserFX, 0, time > 15 ? 0.07f : 0.01f);
sine = (float)Math.Sin(time * 4f / MathHelper.Pi);
if (time == 0)
{
if (Main.rand.NextBool())
{
secondColor = new Color(119, 210, 255);
startingColor = new Color(247, 119, 255);
}
laserType = 1;
if (CalamityWorld.LegendaryMode)
Projectile.scale = 6;
laserRot = Main.rand.NextFloat(-0.4f, 0.4f);
beamStart = targetPos + ((laserType == 0 || laserType == 4 || laserType == 5) ? Vector2.UnitX : Vector2.UnitY).RotatedBy(laserRot) * laserLength;
directionToTarget = beamStart.DirectionTo(targetPos);
Projectile.Center += Main.rand.NextVector2CircularEdge(400, 400);
// Some default values for if the projectile spawns without them set
if (attackSpeed == 0)
attackSpeed = 0.5f;
Projectile.velocity = Vector2.Zero;
laserFX = 1f;
Projectile.ForceNetUpdate();
}
return true;
if (time >= attackTime && !doneAttack)
{
SoundStyle attack = new("CalamityMod/Sounds/Custom/DoGLaserWallBigAttack");
for (int i = 0; i < 2; i++)
SoundEngine.PlaySound(attack with { Volume = 0.3f, Pitch = 0, MaxInstances = -1 }, targetPos);
laserFX = 2.5f;
doneAttack = true;
storedTime = time;
Projectile.ForceNetUpdate();
}
float endTime = storedTime + 10;
if (time >= endTime && doneAttack)
{
Projectile.Kill();
return;
}
else if (doneAttack)
{
drawColor = Color.Lerp(Color.Magenta, Color.Cyan, (float)Math.Pow(Utils.GetLerpValue(endTime, storedTime, time, true), 2));
}
time += attackSpeed;
}
public override bool ShouldUpdatePosition() => false;
public override bool? CanHitNPC(NPC target)
{
if (canDamage)
return true;
return false;
}
public override bool CanHitPlayer(Player target)
{
if (canDamage)
return true;
return false;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
base.OnHitPlayer(target, info);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (!canDamage)
return false;
else
{
float _ = float.NaN;
Vector2 start = beamStart;
Vector2 end = beamStart + directionToTarget * laserLength * 2;
bool hitCheck = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 30 * Projectile.scale, ref _);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 180);
return hitCheck;
}
}
public override bool PreDraw(ref Color lightColor)
{
if (laserFX == 0)
return false;
Texture2D beam = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineThick").Value;
Texture2D bBeam = ModContent.Request<Texture2D>("CalamityMod/Particles/LineThick").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
float opacity = (doneAttack ? 0.65f : 0.35f) * (float)Math.Pow(Math.Min(laserFX, 1), 2);
Color beamColor = drawColor with { A = 0 };
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 180);
if (CalamityClientConfig.Instance.Photosensitivity)
opacity = 0.2f;
for (int t = 0; t < (!doneAttack ? 1 : 4 * Projectile.scale); t++)
{
bool black = (t > 0 + (Projectile.scale - 1));
if (black)
beam = bBeam;
float beamThickness = 0.09f * (black ? (0.8f - 0.15f * t / Projectile.scale) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f);
Main.EntitySpriteDraw(beam, beamStart - Main.screenPosition, null, (black ? Color.Black * opacity : beamColor * (1 - t * 0.3f) * opacity) * (black ? (0.2f + 0.15f * t / Projectile.scale) : 1), directionToTarget.ToRotation() + MathHelper.PiOver2, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness, laserLength / 975) * Projectile.scale, SpriteEffects.None);
}
//Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, Color.Red with { A = 0 }, 0, bloom.Size() / 2, 0.3f, SpriteEffects.None);
return false;
}
}
}
+3 -8
View File
@@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.NPCs;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -135,19 +136,13 @@ namespace CalamityMod.Projectiles.Rogue
if (randomLaserCharge >= 1f)
{
randomLaserCharge -= 1f;
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
Vector2 velocity = Vector2.UnitX.RotatedBy(Projectile.timeLeft / 120f * MathHelper.TwoPi);
int laserDamage = (int)(Projectile.damage * 0.12D);
Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<NebulaShot>(), laserDamage, 0f, Projectile.owner);
Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<FriendlyLaserWallBeam>(), laserDamage, 0f, Projectile.owner, 1.5f);
if (laser.whoAmI.WithinBounds(Main.maxProjectiles))
{
laser.DamageType = RogueDamageClass.Instance;
laser.aiStyle = Main.rand.NextBool() ? ProjAIStyleID.Arrow : -1;
laser.penetrate = -1;
laser.usesLocalNPCImmunity = true;
// This projectile has a hefty amount of extra updates, which will influence the hit cooldown.
laser.localNPCHitCooldown = 120;
}
}
@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.NPCs.Abyss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class FriendlyLaserWallBeam : ModProjectile, ILocalizedModType
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public new string LocalizationCategory => "Projectiles.Boss";
public float time = 0;
public ref float attackSpeed => ref Projectile.ai[0];
public ref float laserType => ref Projectile.ai[2];
public bool canDamage => doneAttack && laserFX >= 1f;
public bool doneAttack = false;
public int attackTime = 30;
public float laserLength => 3000;
public float laserFX = 0;
public float storedTime = 0;
public Color drawColor = Color.Magenta;
public float sine = 0;
public float laserRot = 0;
Vector2 beamStart = Vector2.Zero;
Vector2 directionToTarget = Vector2.Zero;
public Vector2 targetPos => Projectile.Center;
public override void SetStaticDefaults()
{
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000;
}
public override void SetDefaults()
{
Projectile.width = 1;
Projectile.height = 1;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 6000;
Projectile.scale = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (laserFX > 0)
laserFX = MathHelper.Lerp(laserFX, 0, time > 15 ? 0.07f : 0.01f);
sine = (float)Math.Sin(time * 4f / MathHelper.Pi);
if (time == 0)
{
laserType = 1;
if (CalamityWorld.LegendaryMode)
Projectile.scale = 6;
laserRot = Projectile.velocity.ToRotation();
beamStart = targetPos + Vector2.UnitX.RotatedBy(laserRot) * laserLength;
directionToTarget = beamStart.DirectionTo(targetPos);
//Projectile.Center += Main.rand.NextVector2CircularEdge(400, 400);
// Some default values for if the projectile spawns without them set
if (attackSpeed == 0)
attackSpeed = 3f;
Projectile.velocity = Vector2.Zero;
laserFX = 1f;
Projectile.ForceNetUpdate();
}
if (time >= attackTime && !doneAttack)
{
SoundStyle attack = new("CalamityMod/Sounds/Custom/DoGLaserWallLightAttack");
for (int i = 0; i < 2; i++)
SoundEngine.PlaySound(attack with { Volume = 0.3f, Pitch = 0, MaxInstances = -1}, targetPos);
laserFX = 2.5f;
doneAttack = true;
storedTime = time;
Projectile.ForceNetUpdate();
}
float endTime = storedTime + 10;
if (time >= endTime && doneAttack)
{
Projectile.Kill();
return;
}
else if (doneAttack)
{
drawColor = Color.Lerp(Color.Magenta, Color.Cyan, (float)Math.Pow(Utils.GetLerpValue(endTime, storedTime, time, true), 2));
}
time += attackSpeed;
}
public override bool? CanHitNPC(NPC target)
{
if (canDamage)
return true;
return false;
}
public override bool CanHitPlayer(Player target)
{
if (canDamage)
return true;
return false;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
base.OnHitPlayer(target, info);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (!canDamage)
return false;
else
{
float _ = float.NaN;
Vector2 start = beamStart;
Vector2 end = beamStart + directionToTarget * laserLength * 2;
bool hitCheck = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 30 * Projectile.scale, ref _);
return hitCheck;
}
}
public override bool PreDraw(ref Color lightColor)
{
if (laserFX == 0)
return false;
Texture2D beam = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineThick").Value;
Texture2D bBeam = ModContent.Request<Texture2D>("CalamityMod/Particles/LineThick").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
float opacity = (doneAttack ? 0.65f : 0.35f) * (float)Math.Pow(Math.Min(laserFX, 1), 2);
Color beamColor = drawColor with { A = 0 };
if (CalamityClientConfig.Instance.Photosensitivity)
opacity = 0.2f;
for (int t = 0; t < (!doneAttack ? 1 : 5); t++)
{
bool black = (t > 0);
Texture2D usedTex = (black ? bBeam : beam);
float beamThickness = 0.03f * (black ? (0.8f - 0.15f * t) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f);
float rot = beamStart.DirectionTo(targetPos).ToRotation() + (MathHelper.PiOver2);
Main.EntitySpriteDraw(usedTex, beamStart - Main.screenPosition, null, (black ? Color.Black * opacity : beamColor * opacity) * (black ? (0.2f + 0.15f * t) : 1), rot, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness, laserLength / 975) * Projectile.scale, SpriteEffects.None);
}
//Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, Color.Red with { A = 0 }, 0, bloom.Size() / 2, 0.3f, SpriteEffects.None);
return false;
}
}
}