95 lines
3.2 KiB
C#
95 lines
3.2 KiB
C#
using CalamityMod.CalPlayer;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Summon
|
|
{
|
|
public class CloudElementalMinion : ModProjectile
|
|
{
|
|
public int dust = 3;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Cloudy Waifu");
|
|
Main.projFrames[Projectile.type] = 8;
|
|
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
|
|
ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 58;
|
|
Projectile.height = 116;
|
|
Projectile.netImportant = true;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.minionSlots = 0f;
|
|
Projectile.timeLeft = 18000;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.timeLeft *= 5;
|
|
Projectile.minion = true;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 20;
|
|
Projectile.DamageType = DamageClass.Summon;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Player player = Main.player[Projectile.owner];
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
if (!modPlayer.cloudWaifu && !modPlayer.allWaifus)
|
|
{
|
|
Projectile.active = false;
|
|
return;
|
|
}
|
|
bool correctMinion = Projectile.type == ModContent.ProjectileType<CloudElementalMinion>();
|
|
if (correctMinion)
|
|
{
|
|
if (player.dead)
|
|
{
|
|
modPlayer.cWaifu = false;
|
|
}
|
|
if (modPlayer.cWaifu)
|
|
{
|
|
Projectile.timeLeft = 2;
|
|
}
|
|
}
|
|
dust--;
|
|
if (dust >= 0)
|
|
{
|
|
int dustAmt = 50;
|
|
for (int d = 0; d < dustAmt; d++)
|
|
{
|
|
int index = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 16, 0f, 0f, 0, default, 1f);
|
|
Main.dust[index].velocity *= 2f;
|
|
Main.dust[index].scale *= 1.15f;
|
|
}
|
|
}
|
|
if (Math.Abs(Projectile.velocity.X) > 0.2f)
|
|
{
|
|
Projectile.spriteDirection = -Projectile.direction;
|
|
}
|
|
float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f;
|
|
lightScalar *= Main.essScale;
|
|
Lighting.AddLight(Projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar);
|
|
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 6)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame > 7)
|
|
{
|
|
Projectile.frame = 0;
|
|
}
|
|
|
|
Projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, 4f, new Vector2(500f, -60f), 40f, 8f, false, true, 1);
|
|
}
|
|
}
|
|
}
|