89 lines
3.1 KiB
C#
89 lines
3.1 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Summon
|
|
{
|
|
public class MagicAxe : ModProjectile
|
|
{
|
|
private int counter = 0;
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Axe");
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
|
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 52;
|
|
Projectile.height = 52;
|
|
Projectile.netImportant = true;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.minionSlots = 0;
|
|
Projectile.timeLeft = 180;
|
|
Projectile.penetrate = -1;
|
|
Projectile.minion = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.extraUpdates = 1;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 8;
|
|
Projectile.alpha = 255;
|
|
Projectile.DamageType = DamageClass.Summon;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.rotation += 0.075f;
|
|
Projectile.alpha -= 50;
|
|
counter++;
|
|
if (counter == 30)
|
|
{
|
|
Projectile.netUpdate = true;
|
|
}
|
|
else if (counter < 30)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Projectile.ChargingMinionAI(MagicHat.Range, 1200f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true, 3);
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(0, 255, 111, Projectile.alpha);
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 90);
|
|
target.AddBuff(BuffID.Frostburn, 90);
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 90);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 90);
|
|
target.AddBuff(BuffID.Frostburn, 90);
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 90);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f));
|
|
int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f);
|
|
Main.dust[dust].noGravity = true;
|
|
}
|
|
}
|
|
}
|
|
}
|