newline at end of file

This commit is contained in:
2022-12-04 12:33:16 +01:00
parent 50c07dd04c
commit 9b613321b4
3 changed files with 14 additions and 8 deletions
+9 -3
View File
@@ -165,9 +165,11 @@ public class ToclafaneMinion : ModProjectile {
if (distanceFromTarget <= 120f) { if (distanceFromTarget <= 120f) {
attackMode = AttackMode.MELEE; attackMode = AttackMode.MELEE;
} }
if (distanceFromTarget > 120f && shootCooldown == 0) { if (distanceFromTarget > 120f && shootCooldown == 0) {
shootCooldown = 60; // 1 second between shots 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.friendly = true;
laser.penetrate = 5; laser.penetrate = 5;
attackMode = AttackMode.RANGED; attackMode = AttackMode.RANGED;
@@ -193,7 +195,8 @@ public class ToclafaneMinion : ModProjectile {
vectorToIdlePosition.Normalize(); vectorToIdlePosition.Normalize();
vectorToIdlePosition *= speed; vectorToIdlePosition *= speed;
Projectile.velocity = (Projectile.velocity * (inertia - 1) + vectorToIdlePosition) / inertia; 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" // If there is a case where it's not moving at all, give it a little "poke"
Projectile.velocity.X = -0.15f; Projectile.velocity.X = -0.15f;
Projectile.velocity.Y = -0.05f; Projectile.velocity.Y = -0.05f;
@@ -239,6 +242,7 @@ public class ToclafaneMinion : ModProjectile {
break; break;
} }
} }
if (attackMode == AttackMode.RANGED) { if (attackMode == AttackMode.RANGED) {
switch (Projectile.frame) { switch (Projectile.frame) {
case 0: case 0:
@@ -268,12 +272,14 @@ public class ToclafaneMinion : ModProjectile {
} }
} }
} }
Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.78f); Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.78f);
#endregion #endregion
} }
enum AttackMode { enum AttackMode {
MELEE, RANGED MELEE,
RANGED
} }
} }