From 9b613321b4c461a9871f552fbef08e1b8e6d7c66 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sun, 4 Dec 2022 12:33:16 +0100 Subject: [PATCH] newline at end of file --- Buffs/ToclafaneMinionBuff.cs | 2 +- Items/ToclafaneStaff.cs | 2 +- Projectiles/Weapons/ToclafaneMinion.cs | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Buffs/ToclafaneMinionBuff.cs b/Buffs/ToclafaneMinionBuff.cs index 2433d33..08703ee 100644 --- a/Buffs/ToclafaneMinionBuff.cs +++ b/Buffs/ToclafaneMinionBuff.cs @@ -21,4 +21,4 @@ public class ToclafaneMinionBuff : ModBuff { buffIndex--; } } -} \ No newline at end of file +} diff --git a/Items/ToclafaneStaff.cs b/Items/ToclafaneStaff.cs index 82a8427..bae006e 100644 --- a/Items/ToclafaneStaff.cs +++ b/Items/ToclafaneStaff.cs @@ -79,4 +79,4 @@ public class ToclafaneStaff : ModItem { .AddTile(TileID.MythrilAnvil) .Register(); } -} \ No newline at end of file +} diff --git a/Projectiles/Weapons/ToclafaneMinion.cs b/Projectiles/Weapons/ToclafaneMinion.cs index f3532f4..fece0a3 100644 --- a/Projectiles/Weapons/ToclafaneMinion.cs +++ b/Projectiles/Weapons/ToclafaneMinion.cs @@ -11,7 +11,7 @@ public class ToclafaneMinion : ModProjectile { private int shootCooldown = 0; private AttackMode attackMode = AttackMode.RANGED; - + public override void SetStaticDefaults() { DisplayName.SetDefault("Toclafane Minion"); // Sets the amount of frames this minion has on its spritesheet @@ -165,9 +165,11 @@ public class ToclafaneMinion : ModProjectile { if (distanceFromTarget <= 120f) { attackMode = AttackMode.MELEE; } + if (distanceFromTarget > 120f && shootCooldown == 0) { shootCooldown = 60; // 1 second between shots - Projectile laser = Projectile.NewProjectileDirect(player.GetSource_FromThis(), Projectile.Center, direction, ProjectileID.DeathLaser, 30, Projectile.knockBack, Projectile.owner); + Projectile laser = Projectile.NewProjectileDirect(player.GetSource_FromThis(), Projectile.Center, + direction, ProjectileID.DeathLaser, 30, Projectile.knockBack, Projectile.owner); laser.friendly = true; laser.penetrate = 5; attackMode = AttackMode.RANGED; @@ -193,7 +195,8 @@ public class ToclafaneMinion : ModProjectile { vectorToIdlePosition.Normalize(); vectorToIdlePosition *= speed; Projectile.velocity = (Projectile.velocity * (inertia - 1) + vectorToIdlePosition) / inertia; - } else if (Projectile.velocity == Vector2.Zero) { + } + else if (Projectile.velocity == Vector2.Zero) { // If there is a case where it's not moving at all, give it a little "poke" Projectile.velocity.X = -0.15f; Projectile.velocity.Y = -0.05f; @@ -206,7 +209,7 @@ public class ToclafaneMinion : ModProjectile { // So it will lean slightly towards the direction it's moving Projectile.rotation = Projectile.velocity.X * 0.05f; - + int frameSpeed = 8; Projectile.frameCounter++; if (Projectile.frameCounter >= frameSpeed) { @@ -239,6 +242,7 @@ public class ToclafaneMinion : ModProjectile { break; } } + if (attackMode == AttackMode.RANGED) { switch (Projectile.frame) { case 0: @@ -268,12 +272,14 @@ public class ToclafaneMinion : ModProjectile { } } } + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.78f); #endregion } enum AttackMode { - MELEE, RANGED + MELEE, + RANGED } -} \ No newline at end of file +}