using CalamityMod.CalPlayer; using CalamityMod.World; 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; } 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(); if (correctMinion) { if (player.dead) { modPlayer.cWaifu = false; } if (modPlayer.cWaifu) { projectile.timeLeft = 2; } } dust--; if (dust >= 0) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; 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 (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } 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 > 16) { 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); } } }