*Buffed Apotheosis' damage from 77 to 230. (goodbye funny meme number : ( ) *Buffed Azathoth's damage from 50 to 80. *Buffed Draconic Destruction's damage from 80 to 250. *Buffed Galaxy Smasher's damage from 264 to 300. *Increased Illustrious Knives' use time from 12 to 10, and its knives now have an extra update. *Nerfed Anti-materiel Rifle's damage from 3240 to 1800 *Buffed Soma Prime's damage from 252 to 370. *Buffed The Maelstrom's damage from 397 to 530. *Decreased The Reaper's localNPCHitCooldown from 32 to 26. *Buffed Ark of the Cosmos' damage from 1300 to 1670 *Buffed Tesla Cannon's damage from 1050 to 1360
115 lines
4.4 KiB
C#
115 lines
4.4 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Projectiles.Healing;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class IllustriousKnife : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Illustrious Knife");
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 14;
|
|
Projectile.height = 14;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
|
Projectile.penetrate = 1;
|
|
Projectile.timeLeft = 300;
|
|
Projectile.extraUpdates = 1;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.ai[0] += 1f;
|
|
if (Projectile.ai[0] >= 240f)
|
|
{
|
|
Projectile.alpha += 4;
|
|
Projectile.damage = (int)(Projectile.damage * 0.95);
|
|
Projectile.knockBack = (int)(Projectile.knockBack * 0.95);
|
|
}
|
|
if (Projectile.ai[0] < 240f)
|
|
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2;
|
|
else
|
|
{
|
|
Projectile.rotation += 0.5f;
|
|
}
|
|
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f);
|
|
if (Main.rand.NextBool(6))
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 20, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
|
|
}
|
|
|
|
//Give it a custom hitbox shape so it may remain rectangular and elongated
|
|
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
|
{
|
|
float collisionPoint = 0f;
|
|
float bladeHalfLenght = 25f * Projectile.scale / 2f;
|
|
float bladeWidth = 14f * Projectile.scale;
|
|
|
|
Vector2 direction = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2();
|
|
|
|
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeHalfLenght, Projectile.Center + direction * bladeHalfLenght, bladeWidth, ref collisionPoint);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int num303 = 0; num303 < 3; num303++)
|
|
{
|
|
int num304 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 20, 0f, 0f, 100, default, 0.8f);
|
|
Main.dust[num304].noGravity = true;
|
|
Main.dust[num304].velocity *= 1.2f;
|
|
Main.dust[num304].velocity -= Projectile.oldVelocity * 0.3f;
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
|
|
|
|
float healAmt = damage * 0.015f;
|
|
if ((int)healAmt == 0)
|
|
return;
|
|
|
|
if (Main.player[Main.myPlayer].lifeSteal <= 0f)
|
|
return;
|
|
|
|
if (healAmt > CalamityMod.lifeStealCap)
|
|
healAmt = CalamityMod.lifeStealCap;
|
|
|
|
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType<RoyalHeal>(), 1200f, 3f);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
|
|
|
|
float healAmt = damage * 0.015f;
|
|
if ((int)healAmt == 0)
|
|
return;
|
|
|
|
if (Main.player[Main.myPlayer].lifeSteal <= 0f)
|
|
return;
|
|
|
|
if (healAmt > CalamityMod.lifeStealCap)
|
|
healAmt = CalamityMod.lifeStealCap;
|
|
|
|
CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], healAmt, ModContent.ProjectileType<RoyalHeal>(), 1200f, 3f);
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
}
|
|
}
|