85 lines
3.6 KiB
C#
85 lines
3.6 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Melee.Spears
|
|
{
|
|
public class StreamGougeProj : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Gouge");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 40;
|
|
projectile.aiStyle = 19;
|
|
projectile.melee = true;
|
|
projectile.timeLeft = 90;
|
|
projectile.height = 40;
|
|
projectile.friendly = true;
|
|
projectile.hostile = false;
|
|
projectile.tileCollide = false;
|
|
projectile.ignoreWater = true;
|
|
projectile.penetrate = -1;
|
|
projectile.ownerHitCheck = true;
|
|
projectile.hide = true;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 1;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Main.player[projectile.owner].direction = projectile.direction;
|
|
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
|
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
|
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
|
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
|
projectile.position += projectile.velocity * projectile.ai[0];
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.direction * 2, 0f, 150, default, 1f);
|
|
Main.dust[num].noGravity = true;
|
|
}
|
|
if (projectile.ai[0] == 0f)
|
|
{
|
|
projectile.ai[0] = 3f;
|
|
projectile.netUpdate = true;
|
|
}
|
|
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
|
{
|
|
projectile.ai[0] -= 2.4f;
|
|
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
|
{
|
|
projectile.localAI[0] = 1f;
|
|
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y,
|
|
ModContent.ProjectileType<EssenceBeam>(), projectile.damage * 4, projectile.knockBack, projectile.owner, 0f, 0f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
projectile.ai[0] += 0.95f;
|
|
}
|
|
if (Main.player[projectile.owner].itemAnimation == 0)
|
|
projectile.Kill();
|
|
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
|
if (projectile.spriteDirection == -1)
|
|
projectile.rotation -= 1.57f;
|
|
}
|
|
|
|
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
Vector2 origin = new Vector2(0f, 0f);
|
|
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/StreamGougeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f);
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
|
|
}
|
|
}
|
|
}
|