Files
CalamityModPublic/Projectiles/Summon/ElementalAxeMinion.cs
T

74 lines
2.6 KiB
C#

using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class ElementalAxeMinion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public override void SetStaticDefaults()
{
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 52;
Projectile.height = 52;
Projectile.netImportant = true;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.minionSlots = 1;
Projectile.timeLeft = 18000;
Projectile.penetrate = -1;
Projectile.timeLeft *= 5;
Projectile.minion = true;
Projectile.tileCollide = false;
Projectile.extraUpdates = 1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 30;
Projectile.DamageType = DamageClass.Summon;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
bool flag64 = Projectile.type == ModContent.ProjectileType<ElementalAxeMinion>();
player.AddBuff(ModContent.BuffType<ElementalAxeBuff>(), 3600);
if (flag64)
{
if (player.dead)
{
modPlayer.eAxe = false;
}
if (modPlayer.eAxe)
{
Projectile.timeLeft = 2;
}
}
Projectile.rotation += 0.075f;
Projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha);
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
}
}