dungeon spirit like AI's moved to CalamityAI
also Gatling Laser tooltip tweak
This commit is contained in:
1 parent
2d1ae12caa
commit
cc203e4864
9 files changed
+83
-126
No files matched your search
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
|
||||
{
|
||||
DisplayName.SetDefault("Gatling Laser");
|
||||
Tooltip.SetDefault("Large laser cannon used primarily by Yharim's fleet and base defense force\n" +
|
||||
"Incredibly accurate, but lacks the power to punch through defensive targets");
|
||||
"Somewhat inaccurate, but has the power to punch through defensive targets");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -5680,5 +5680,48 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dungeon Spirit AI
|
||||
public static void DungeonSpiritAI(NPC npc, Mod mod, float speed, float rotation, bool lantern = false)
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num1258 = Main.player[npc.target].Center.X - vector145.X;
|
||||
float num1259 = Main.player[npc.target].Center.Y - vector145.Y;
|
||||
float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259));
|
||||
float num1261 = speed;
|
||||
|
||||
if (lantern)
|
||||
{
|
||||
if (npc.localAI[0] < 85f)
|
||||
{
|
||||
num1261 = 0.1f;
|
||||
num1260 = num1261 / num1260;
|
||||
num1258 *= num1260;
|
||||
num1259 *= num1260;
|
||||
npc.velocity = (npc.velocity * 100f + new Vector2(num1258, num1259)) / 101f;
|
||||
npc.localAI[0] += 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
npc.dontTakeDamage = false;
|
||||
npc.chaseable = true;
|
||||
}
|
||||
|
||||
num1260 = num1261 / num1260;
|
||||
num1258 *= num1260;
|
||||
num1259 *= num1260;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f;
|
||||
|
||||
if (lantern)
|
||||
{
|
||||
npc.rotation = npc.velocity.X * 0.08f;
|
||||
npc.spriteDirection = (npc.direction > 0) ? 1 : -1;
|
||||
}
|
||||
else
|
||||
npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + rotation;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -40,22 +40,11 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool revenge = CalamityWorld.revenge;
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num1258 = Main.player[npc.target].Center.X - vector145.X;
|
||||
float num1259 = Main.player[npc.target].Center.Y - vector145.Y;
|
||||
float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259));
|
||||
float num1261 = revenge ? 16f : 13f;
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
float speed = revenge ? 16f : 13f;
|
||||
if (CalamityWorld.bossRushActive)
|
||||
num1261 = 24f;
|
||||
|
||||
num1260 = num1261 / num1260;
|
||||
num1258 *= num1260;
|
||||
num1259 *= num1260;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num1259, (double)num1258) + 3.14f;
|
||||
speed = 24f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, MathHelper.Pi);
|
||||
}
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
|
||||
@@ -39,23 +39,13 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num818 = Main.player[npc.target].Center.X - vector102.X;
|
||||
float num819 = Main.player[npc.target].Center.Y - vector102.Y;
|
||||
float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819));
|
||||
float num821 = CalamityWorld.death ? 22f : 17f;
|
||||
num820 = num821 / num820;
|
||||
num818 *= num820;
|
||||
num819 *= num820;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f;
|
||||
float speed = CalamityWorld.death ? 22f : 17f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
|
||||
int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f);
|
||||
Dust dust = Main.dust[num822];
|
||||
dust.velocity *= 0.1f;
|
||||
Main.dust[num822].scale = 1.3f;
|
||||
Main.dust[num822].noGravity = true;
|
||||
dust.scale = 1.3f;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
@@ -79,8 +69,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f);
|
||||
Dust dust = Main.dust[num289];
|
||||
dust.velocity *= 2f;
|
||||
Main.dust[num289].noGravity = true;
|
||||
Main.dust[num289].scale = 1.4f;
|
||||
dust.noGravity = true;
|
||||
dust.scale = 1.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,23 +48,13 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num818 = Main.player[npc.target].Center.X - vector102.X;
|
||||
float num819 = Main.player[npc.target].Center.Y - vector102.Y;
|
||||
float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819));
|
||||
float num821 = CalamityWorld.death ? 16f : 12f;
|
||||
num820 = num821 / num820;
|
||||
num818 *= num820;
|
||||
num819 *= num820;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f;
|
||||
float speed = CalamityWorld.death ? 16f : 12f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
|
||||
int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f);
|
||||
Dust dust = Main.dust[num822];
|
||||
dust.velocity *= 0.1f;
|
||||
Main.dust[num822].scale = 1.3f;
|
||||
Main.dust[num822].noGravity = true;
|
||||
dust.scale = 1.3f;
|
||||
dust.noGravity = true;
|
||||
Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
|
||||
float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X;
|
||||
float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y;
|
||||
@@ -126,8 +116,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f);
|
||||
Dust dust = Main.dust[num289];
|
||||
dust.velocity *= 2f;
|
||||
Main.dust[num289].noGravity = true;
|
||||
Main.dust[num289].scale = 1.4f;
|
||||
dust.noGravity = true;
|
||||
dust.scale = 1.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,23 +47,13 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num818 = Main.player[npc.target].Center.X - vector102.X;
|
||||
float num819 = Main.player[npc.target].Center.Y - vector102.Y;
|
||||
float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819));
|
||||
float num821 = CalamityWorld.death ? 18f : 13.5f;
|
||||
num820 = num821 / num820;
|
||||
num818 *= num820;
|
||||
num819 *= num820;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f;
|
||||
float speed = CalamityWorld.death ? 18f : 13.5f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
|
||||
int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f);
|
||||
Dust dust = Main.dust[num822];
|
||||
dust.velocity *= 0.1f;
|
||||
Main.dust[num822].scale = 1.3f;
|
||||
Main.dust[num822].noGravity = true;
|
||||
dust.scale = 1.3f;
|
||||
dust.noGravity = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,8 +78,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f);
|
||||
Dust dust = Main.dust[num289];
|
||||
dust.velocity *= 2f;
|
||||
Main.dust[num289].noGravity = true;
|
||||
Main.dust[num289].scale = 1.4f;
|
||||
dust.noGravity = true;
|
||||
dust.scale = 1.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,23 +46,13 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector102 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num818 = Main.player[npc.target].Center.X - vector102.X;
|
||||
float num819 = Main.player[npc.target].Center.Y - vector102.Y;
|
||||
float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819));
|
||||
float num821 = CalamityWorld.death ? 20f : 15f;
|
||||
num820 = num821 / num820;
|
||||
num818 *= num820;
|
||||
num819 *= num820;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num818) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num819) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num819, (double)num818) - 1.57f;
|
||||
float speed = CalamityWorld.death ? 20f : 15f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
|
||||
int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f);
|
||||
Dust dust = Main.dust[num822];
|
||||
dust.velocity *= 0.1f;
|
||||
Main.dust[num822].scale = 1.3f;
|
||||
Main.dust[num822].noGravity = true;
|
||||
dust.scale = 1.3f;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
@@ -86,8 +76,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f);
|
||||
Dust dust = Main.dust[num289];
|
||||
dust.velocity *= 2f;
|
||||
Main.dust[num289].noGravity = true;
|
||||
Main.dust[num289].scale = 1.4f;
|
||||
dust.noGravity = true;
|
||||
dust.scale = 1.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,38 +78,11 @@ namespace CalamityMod.NPCs.Signus
|
||||
Main.dust[num1262].noGravity = true;
|
||||
}
|
||||
|
||||
npc.rotation = npc.velocity.X * 0.08f;
|
||||
npc.spriteDirection = (npc.direction > 0) ? 1 : -1;
|
||||
npc.TargetClosest(true);
|
||||
|
||||
bool revenge = CalamityWorld.revenge;
|
||||
float playerDistNormMult = revenge ? 24f : 22f;
|
||||
if (CalamityWorld.bossRushActive)
|
||||
playerDistNormMult = 30f;
|
||||
|
||||
Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float playerDistX = Main.player[npc.target].Center.X - vector145.X;
|
||||
float playerDistY = Main.player[npc.target].Center.Y - vector145.Y;
|
||||
float playerDistMagnitude = (float)Math.Sqrt((double)(playerDistX * playerDistX + playerDistY * playerDistY));
|
||||
|
||||
if (npc.localAI[0] < 85f)
|
||||
{
|
||||
playerDistNormMult = 0.1f;
|
||||
playerDistMagnitude = playerDistNormMult / playerDistMagnitude;
|
||||
playerDistX *= playerDistMagnitude;
|
||||
playerDistY *= playerDistMagnitude;
|
||||
npc.velocity = (npc.velocity * 100f + new Vector2(playerDistX, playerDistY)) / 101f;
|
||||
npc.localAI[0] += 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
npc.dontTakeDamage = false;
|
||||
npc.chaseable = true;
|
||||
|
||||
playerDistMagnitude = playerDistNormMult / playerDistMagnitude;
|
||||
playerDistX *= playerDistMagnitude;
|
||||
playerDistY *= playerDistMagnitude;
|
||||
npc.velocity = (npc.velocity * 100f + new Vector2(playerDistX, playerDistY)) / 101f;
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, playerDistNormMult, 0f, true);
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
|
||||
@@ -37,45 +37,37 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
npc.alpha -= 3;
|
||||
npc.TargetClosest(true);
|
||||
Vector2 vector98 = new Vector2(npc.Center.X, npc.Center.Y);
|
||||
float num790 = Main.player[npc.target].Center.X - vector98.X;
|
||||
float num791 = Main.player[npc.target].Center.Y - vector98.Y;
|
||||
float num792 = (float)Math.Sqrt((double)(num790 * num790 + num791 * num791));
|
||||
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
||||
float randomSpeed = 10f;
|
||||
if (npc.localAI[3] == 0f)
|
||||
{
|
||||
switch (Main.rand.Next(6))
|
||||
{
|
||||
case 0:
|
||||
speed = 10f;
|
||||
randomSpeed = 10f;
|
||||
break;
|
||||
case 1:
|
||||
speed = 11.5f;
|
||||
randomSpeed = 11.5f;
|
||||
break;
|
||||
case 2:
|
||||
speed = 13f;
|
||||
randomSpeed = 13f;
|
||||
break;
|
||||
case 3:
|
||||
speed = 14.5f;
|
||||
randomSpeed = 14.5f;
|
||||
break;
|
||||
case 4:
|
||||
speed = 16f;
|
||||
randomSpeed = 16f;
|
||||
break;
|
||||
case 5:
|
||||
speed = 17.5f;
|
||||
randomSpeed = 17.5f;
|
||||
break;
|
||||
}
|
||||
npc.localAI[3] = 1f;
|
||||
}
|
||||
float num793 = speed + (revenge ? 1f : 0f);
|
||||
num792 = num793 / num792;
|
||||
num790 *= num792;
|
||||
num791 *= num792;
|
||||
npc.velocity.X = (npc.velocity.X * 100f + num790) / 101f;
|
||||
npc.velocity.Y = (npc.velocity.Y * 100f + num791) / 101f;
|
||||
npc.rotation = (float)Math.Atan2((double)num791, (double)num790) - 1.57f;
|
||||
float speed = randomSpeed + (revenge ? 1f : 0f);
|
||||
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color drawColor)
|
||||
|
||||
Reference in new issue
Block a user