This commit is contained in:
DominicKarma42 committed 2019-11-15 23:16:29 -06:00
commit d8f7f8fa2d
25 files changed
+1034 -1437

No files matched your search

+21 -7
View File
@@ -1,6 +1,7 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using CalamityMod.Tiles.Furniture.CraftingStations;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -12,13 +13,7 @@ namespace CalamityMod.Items.Accessories
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Nanotech");
Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" +
"Stealth strikes summon lunar flares on enemy hits\n" +
"Rogue weapons have a chance to instantly kill normal enemies\n" +
"10% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" +
"Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" +
"This effect can stack up to 250 times\n" +
"Max rogue damage boost is 25%");
Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel");
}
public override void SetDefaults()
@@ -30,6 +25,25 @@ namespace CalamityMod.Items.Accessories
item.Calamity().postMoonLordRarity = 20;
}
public override void ModifyTooltips(List<TooltipLine> list)
{
int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack;
foreach (TooltipLine line2 in list)
{
if (line2.mod == "Terraria" && line2.Name == "Tooltip0")
{
line2.text = "Rogue projectiles create nanoblades as they travel\n" +
"Stealth strikes summon lunar flares on enemy hits\n" +
"Rogue weapons have a chance to instantly kill normal enemies\n" +
"10% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" +
"Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" +
"This effect can stack up to 250 times\n" +
"Max rogue damage boost is 25%\n" +
"Rogue Crit Level: " + critLevel;
}
}
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
+17 -3
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -10,9 +11,7 @@ namespace CalamityMod.Items.Accessories
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Raider's Talisman");
Tooltip.SetDefault("Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" +
"This effect can stack up to 250 times\n" +
"Max rogue damage boost is 25%");
Tooltip.SetDefault("Whenever you crit an enemy with a rogue weapon your rogue damage increases");
}
public override void SetDefaults()
@@ -24,6 +23,21 @@ namespace CalamityMod.Items.Accessories
item.accessory = true;
}
public override void ModifyTooltips(List<TooltipLine> list)
{
int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack;
foreach (TooltipLine line2 in list)
{
if (line2.mod == "Terraria" && line2.Name == "Tooltip0")
{
line2.text = "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" +
"This effect can stack up to 250 times\n" +
"Max rogue damage boost is 25%\n" +
"Rogue Crit Level: " + critLevel;
}
}
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
+2 -2
View File
@@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
public class SeasSearing : ModItem
{
public static int BaseDamage = 90;
public static int BaseDamage = 60;
public override void SetStaticDefaults()
{
@@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
if (player.altFunctionUse == 2)
{
item.damage = 130;
item.damage = 73;
item.useTime = 30;
item.useAnimation = 30;
item.reuseDelay = 0;
+4 -4
View File
@@ -7,7 +7,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
public class BouncingBetty : RogueWeapon
{
public const int BaseDamage = 34;
public const int BaseDamage = 52;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bouncing Betty");
@@ -21,8 +21,8 @@ namespace CalamityMod.Items.Weapons.Rogue
item.noMelee = true;
item.consumable = true;
item.noUseGraphic = true;
item.useAnimation = 12;
item.useTime = 12;
item.useAnimation = 24;
item.useTime = 24;
item.useStyle = ItemUseStyleID.SwingThrow;
item.knockBack = 3f;
item.UseSound = SoundID.Item1;
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue
item.value = Item.buyPrice(0, 0, 4, 0);
item.rare = 5;
item.shoot = ModContent.ProjectileType<BouncingBettyProjectile>();
item.shootSpeed = 15f;
item.shootSpeed = 16f;
item.Calamity().rogue = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue
}
public override void SafeSetDefaults()
{
item.damage = 20;
item.damage = 14;
item.shootSpeed = 12f;
item.shoot = ModContent.ProjectileType<Brick>();
item.width = 26;
+1 -7
View File
@@ -56,15 +56,9 @@ namespace CalamityMod.NPCs.AquaticScourge
public override void AI()
{
CalamityAI.AquaticScourgeAI(npc, mod);
CalamityAI.AquaticScourgeAI(npc, mod, false);
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
damage = (int)((double)damage * 0.5);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
if (projectile.minion)
+1 -7
View File
@@ -56,15 +56,9 @@ namespace CalamityMod.NPCs.AquaticScourge
public override void AI()
{
CalamityAI.AquaticScourgeAI(npc, mod);
CalamityAI.AquaticScourgeAI(npc, mod, false);
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
damage = (int)((double)damage * 0.5);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
if (projectile.minion)
+1 -7
View File
@@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.AquaticScourge
else
music = MusicID.Boss2;
}
CalamityAI.AquaticScourgeAI(npc, mod);
CalamityAI.AquaticScourgeAI(npc, mod, true);
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
@@ -103,12 +103,6 @@ namespace CalamityMod.NPCs.AquaticScourge
return minDist <= 50f;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
damage = (int)((double)damage * 0.5);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
if (projectile.minion)
+1 -7
View File
@@ -53,15 +53,9 @@ namespace CalamityMod.NPCs.AquaticScourge
public override void AI()
{
CalamityAI.AquaticScourgeAI(npc, mod);
CalamityAI.AquaticScourgeAI(npc, mod, false);
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
damage = (int)((double)damage * 0.5);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
if (projectile.minion)
+2 -107
View File
@@ -81,80 +81,8 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void AI()
{
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)
{
npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
}
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (!Main.npc[(int)npc.ai[1]].active)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.active = false;
}
if (Main.npc[(int)npc.ai[1]].alpha < 128)
{
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
}
/*if (Main.netMode != NetmodeID.MultiplayerClient)
{
int shootTime = 4;
if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive)
{
shootTime += 2;
}
npc.localAI[0] += (float)Main.rand.Next(shootTime);
if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000))
{
npc.localAI[0] = 0f;
npc.TargetClosest(true);
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float num941 = revenge ? 13f : 12f;
if (CalamityWorld.death)
{
num941 = 15f;
}
if (CalamityWorld.bossRushActive)
{
num941 = 20f;
}
Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2));
float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X;
float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y;
float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943));
num944 = num941 / num944;
num942 *= num944;
num943 *= num944;
int num945 = expertMode ? 38 : 45;
int num946 = ModContent.ProjectileType<AstralShot2>();
vector104.X += num942 * 5f;
vector104.Y += num943 * 5f;
int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f);
npc.netUpdate = true;
}
}
}*/
}
CalamityAI.AstrumDeusAI(npc, mod, false, false);
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
@@ -170,39 +98,6 @@ namespace CalamityMod.NPCs.AstrumDeus
return false;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override bool CheckActive()
{
return false;
+1 -179
View File
@@ -96,152 +96,7 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void AI()
{
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (npc.ai[3] > 0f)
{
npc.realLife = (int)npc.ai[3];
}
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead)
{
npc.TargetClosest(true);
}
npc.velocity.Length();
if (npc.velocity.X < 0f)
{
npc.spriteDirection = -1;
}
else if (npc.velocity.X > 0f)
{
npc.spriteDirection = 1;
}
bool flag = false;
if (npc.ai[1] <= 0f)
{
flag = true;
}
else if (Main.npc[(int)npc.ai[1]].life <= 0)
{
flag = true;
}
if (flag)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.checkDead();
}
if (Main.npc[(int)npc.ai[1]].alpha < 128)
{
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int shootTime = 4;
if ((double)npc.life <= (double)npc.lifeMax * 0.65 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f)
{
shootTime += CalamityWorld.death ? 4 : 2;
}
if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f)
{
shootTime += CalamityWorld.death ? 6 : 2;
}
npc.localAI[0] += (float)Main.rand.Next(shootTime);
if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000))
{
npc.localAI[0] = 0f;
npc.TargetClosest(true);
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float num941 = revenge ? 14f : 13f;
if (CalamityWorld.death)
{
num941 = 16f;
}
if (CalamityWorld.bossRushActive)
{
num941 = 24f;
}
if (Main.player[npc.target].gravDir == -1f)
{
num941 *= 2f;
}
Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2));
float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X;
float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y;
float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943));
num944 = num941 / num944;
num942 *= num944;
num943 *= num944;
int num945 = expertMode ? 38 : 45;
int num946 = ModContent.ProjectileType<AstralShot2>();
vector104.X += num942 * 5f;
vector104.Y += num943 * 5f;
int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f);
npc.netUpdate = true;
}
}
}
if (Main.player[npc.target].dead)
{
npc.TargetClosest(false);
}
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
} catch
{
}
npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = npc.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
npc.velocity = Vector2.Zero;
npc.position.X = npc.position.X + num191;
npc.position.Y = npc.position.Y + num192;
if (num191 < 0f)
{
npc.spriteDirection = -1;
}
else if (num191 > 0f)
{
npc.spriteDirection = 1;
}
}
CalamityAI.AstrumDeusAI(npc, mod, false, true);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
@@ -292,39 +147,6 @@ namespace CalamityMod.NPCs.AstrumDeus
return !npc.dontTakeDamage;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override bool CheckActive()
{
return false;
+2 -501
View File
@@ -18,17 +18,6 @@ namespace CalamityMod.NPCs.AstrumDeus
[AutoloadBossHead]
public class AstrumDeusHead : ModNPC
{
private bool flies = false;
private const int minLength = 4;
private const int maxLength = 5;
private int addOrbiter = 0;
private int addOrbiter2 = 0;
private float speed = 0.12f;
private float turnSpeed = 0.08f;
private bool tailSpawned = false;
private bool secondStage = false;
private bool thirdStage = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astrum Deus");
@@ -81,475 +70,20 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(addOrbiter);
writer.Write(addOrbiter2);
writer.Write(secondStage);
writer.Write(thirdStage);
writer.Write(npc.dontTakeDamage);
writer.Write(npc.chaseable);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
addOrbiter = reader.ReadInt32();
addOrbiter2 = reader.ReadInt32();
secondStage = reader.ReadBoolean();
thirdStage = reader.ReadBoolean();
npc.dontTakeDamage = reader.ReadBoolean();
npc.chaseable = reader.ReadBoolean();
}
public override void AI()
{
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)
{
npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
}
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (CalamityWorld.death || CalamityWorld.bossRushActive)
{
if (npc.life <= npc.lifeMax * 0.9f)
{
if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 3; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), ModContent.NPCType<AstrumDeusProbe>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 120;
Eye.ai[3] = I * 120;
}
secondStage = true;
}
}
if (npc.life <= npc.lifeMax * 0.8f)
{
if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 5; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), ModContent.NPCType<AstrumDeusProbe2>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 72;
Eye.ai[3] = I * 72;
}
thirdStage = true;
}
}
}
else
{
if (npc.life <= npc.lifeMax * 0.65f)
{
if (secondStage == false && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 3; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), ModContent.NPCType<AstrumDeusProbe>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 120;
Eye.ai[3] = I * 120;
}
secondStage = true;
}
}
if (npc.life <= npc.lifeMax * 0.3f)
{
if (thirdStage == false && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 5; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), ModContent.NPCType<AstrumDeusProbe2>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 72;
Eye.ai[3] = I * 72;
}
thirdStage = true;
}
}
}
if (npc.ai[3] > 0f)
{
npc.realLife = (int)npc.ai[3];
}
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead)
{
npc.TargetClosest(true);
}
npc.velocity.Length();
float speedAdd = expertMode ? 0.06f : 0.045f;
float turnSpeedAdd = expertMode ? 0.04f : 0.03f;
if (CalamityWorld.death || CalamityWorld.bossRushActive)
{
speedAdd *= 1.25f;
turnSpeedAdd *= 1.25f;
}
float life = (float)npc.life;
float totalLife = (float)npc.lifeMax;
float newSpeed = speed + speedAdd * (1f - (life / totalLife));
float newTurnSpeed = turnSpeed + turnSpeedAdd * (1f - (life / totalLife));
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (!tailSpawned && npc.ai[0] == 0f)
{
int Previous = npc.whoAmI;
for (int num36 = 0; num36 < maxLength; num36++)
{
int lol;
if (num36 >= 0 && num36 < minLength)
{
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AstrumDeusBody>(), npc.whoAmI);
}
else
{
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AstrumDeusTail>(), npc.whoAmI);
}
if (num36 % 2 == 0)
{
Main.npc[lol].localAI[3] = 1f;
}
Main.npc[lol].realLife = npc.whoAmI;
Main.npc[lol].ai[2] = (float)npc.whoAmI;
Main.npc[lol].ai[1] = (float)Previous;
Main.npc[Previous].ai[0] = (float)lol;
Previous = lol;
}
tailSpawned = true;
}
if (!npc.active && Main.netMode == NetmodeID.Server)
{
NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0);
}
}
int num180 = (int)(npc.position.X / 16f) - 1;
int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2;
int num182 = (int)(npc.position.Y / 16f) - 1;
int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2;
if (num180 < 0)
{
num180 = 0;
}
if (num181 > Main.maxTilesX)
{
num181 = Main.maxTilesX;
}
if (num182 < 0)
{
num182 = 0;
}
if (num183 > Main.maxTilesY)
{
num183 = Main.maxTilesY;
}
bool flag94 = flies;
if (!flag94)
{
for (int num952 = num180; num952 < num181; num952++)
{
for (int num953 = num182; num953 < num183; num953++)
{
if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64))
{
Vector2 vector105;
vector105.X = (float)(num952 * 16);
vector105.Y = (float)(num953 * 16);
if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f)
{
flag94 = true;
break;
}
}
}
}
}
if (!flag94)
{
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
npc.localAI[1] = 1f;
Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
int rectX = 300;
int rectY = (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200;
bool flag95 = true;
if (npc.position.Y > Main.player[npc.target].position.Y)
{
for (int num955 = 0; num955 < 255; num955++)
{
if (Main.player[num955].active)
{
Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2);
if (rectangle12.Intersects(rectangle13))
{
flag95 = false;
break;
}
}
}
if (flag95)
{
flag94 = true;
}
}
}
else
{
npc.localAI[1] = 0f;
}
float maxSpeed = 20f;
if (Main.dayTime || Main.player[npc.target].dead || CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)
{
flag94 = true;
npc.velocity.Y = npc.velocity.Y - 2f;
if ((double)npc.position.Y < Main.topWorld + 16f)
{
npc.velocity.Y = npc.velocity.Y - 2f;
maxSpeed = 40f;
}
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int num957 = 0; num957 < 200; num957++)
{
if (Main.npc[num957].aiStyle == npc.aiStyle)
{
Main.npc[num957].active = false;
}
}
}
}
float num188 = newSpeed;
float num189 = newTurnSpeed;
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
if (!flag94)
{
npc.TargetClosest(true);
npc.velocity.Y = npc.velocity.Y + 0.15f;
if (npc.velocity.Y > maxSpeed)
{
npc.velocity.Y = maxSpeed;
}
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4)
{
if (npc.velocity.X < 0f)
{
npc.velocity.X = npc.velocity.X - num188 * 1.1f;
}
else
{
npc.velocity.X = npc.velocity.X + num188 * 1.1f;
}
}
else if (npc.velocity.Y == maxSpeed)
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num188;
}
else if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num188;
}
}
else if (npc.velocity.Y > 4f)
{
if (npc.velocity.X < 0f)
{
npc.velocity.X = npc.velocity.X + num188 * 0.9f;
}
else
{
npc.velocity.X = npc.velocity.X - num188 * 0.9f;
}
}
}
else
{
if (!flies && npc.behindTiles && npc.soundDelay == 0)
{
float num195 = num193 / 40f;
if (num195 < 10f)
{
num195 = 10f;
}
if (num195 > 20f)
{
num195 = 20f;
}
npc.soundDelay = (int)num195;
Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1);
}
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
float num196 = System.Math.Abs(num191);
float num197 = System.Math.Abs(num192);
float num198 = maxSpeed / num193;
num191 *= num198;
num192 *= num198;
if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)))
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num189;
}
else if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num189;
}
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num189;
}
else if (npc.velocity.Y > num192)
{
npc.velocity.Y = npc.velocity.Y - num189;
}
}
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num188;
}
else
{
if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num188;
}
}
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num188;
}
else
{
if (npc.velocity.Y > num192)
{
npc.velocity.Y = npc.velocity.Y - num188;
}
}
if ((double)System.Math.Abs(num192) < (double)maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y + num188 * 2f;
}
else
{
npc.velocity.Y = npc.velocity.Y - num188 * 2f;
}
}
if ((double)System.Math.Abs(num191) < (double)maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
{
npc.velocity.X = npc.velocity.X + num188 * 2f;
}
else
{
npc.velocity.X = npc.velocity.X - num188 * 2f;
}
}
}
else
{
if (num196 > num197)
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num188 * 1.1f;
}
else if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num188 * 1.1f;
}
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5)
{
if (npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y + num188;
}
else
{
npc.velocity.Y = npc.velocity.Y - num188;
}
}
}
else
{
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num188 * 1.1f;
}
else if (npc.velocity.Y > num192)
{
npc.velocity.Y = npc.velocity.Y - num188 * 1.1f;
}
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5)
{
if (npc.velocity.X > 0f)
{
npc.velocity.X = npc.velocity.X + num188;
}
else
{
npc.velocity.X = npc.velocity.X - num188;
}
}
}
}
npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f;
if (flag94)
{
if (npc.localAI[0] != 1f)
{
npc.netUpdate = true;
}
npc.localAI[0] = 1f;
}
else
{
if (npc.localAI[0] != 0f)
{
npc.netUpdate = true;
}
npc.localAI[0] = 0f;
}
if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit)
{
npc.netUpdate = true;
}
}
}
CalamityAI.AstrumDeusAI(npc, mod, true, false);
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
@@ -568,39 +102,6 @@ namespace CalamityMod.NPCs.AstrumDeus
return false;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
+4 -348
View File
@@ -27,15 +27,6 @@ namespace CalamityMod.NPCs.AstrumDeus
[AutoloadBossHead]
public class AstrumDeusHeadSpectral : ModNPC
{
private bool colorChange = false;
private const int minLength = 12;
private const int maxLength = 13;
private float speed = 10f;
private float turnSpeed = 0.2f;
private bool tailSpawned = false;
private int deusHeadCount = 0;
private int astrumDeusTotalHPMax = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astrum Deus");
@@ -92,322 +83,20 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(deusHeadCount);
writer.Write(astrumDeusTotalHPMax);
writer.Write(colorChange);
writer.Write(npc.dontTakeDamage);
writer.Write(npc.chaseable);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
deusHeadCount = reader.ReadInt32();
astrumDeusTotalHPMax = reader.ReadInt32();
colorChange = reader.ReadBoolean();
npc.dontTakeDamage = reader.ReadBoolean();
npc.chaseable = reader.ReadBoolean();
}
public override void AI()
{
CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI;
colorChange = NPC.AnyNPCs(ModContent.NPCType<AstrumDeusHead>());
int astrumDeusTotalHP = 0;
double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax;
if (colorChange)
{
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].type == ModContent.NPCType<AstrumDeusHead>())
{
astrumDeusTotalHP += Main.npc[i].life;
if (deusHeadCount < 10)
{
deusHeadCount++;
astrumDeusTotalHPMax += Main.npc[i].lifeMax;
}
}
}
double astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax;
if (astrumDeusHPRatio < 0.33)
{
if (mainDeusHPRatio > 0.33)
colorChange = false;
}
else if (astrumDeusHPRatio < 0.66)
{
if (mainDeusHPRatio > 0.66)
colorChange = false;
}
}
npc.dontTakeDamage = colorChange;
npc.chaseable = !colorChange;
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
float speedLimit = CalamityWorld.revenge ? 7f : 6f;
float turnSpeedLimit = CalamityWorld.revenge ? 0.11f : 0.1f;
if (CalamityWorld.death)
{
speedLimit = 8f;
turnSpeedLimit = 0.12f;
}
if (CalamityWorld.bossRushActive)
{
speedLimit *= 1.5f;
turnSpeedLimit *= 1.5f;
}
float speedBoost = speedLimit * (1f - (float)mainDeusHPRatio);
float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio);
if (Main.player[npc.target].gravDir == -1f)
{
speedBoost = speedLimit;
turnSpeedBoost = turnSpeedLimit;
}
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (npc.ai[3] > 0f)
{
npc.realLife = (int)npc.ai[3];
}
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead)
{
npc.TargetClosest(true);
}
npc.velocity.Length();
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (!tailSpawned && npc.ai[0] == 0f)
{
int Previous = npc.whoAmI;
for (int num36 = 0; num36 < maxLength; num36++)
{
int lol;
if (num36 >= 0 && num36 < minLength)
{
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AstrumDeusBodySpectral>(), npc.whoAmI);
}
else
{
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<AstrumDeusTailSpectral>(), npc.whoAmI);
}
if (num36 % 2 == 0)
{
Main.npc[lol].localAI[3] = 1f;
}
Main.npc[lol].realLife = npc.whoAmI;
Main.npc[lol].ai[2] = (float)npc.whoAmI;
Main.npc[lol].ai[1] = (float)Previous;
Main.npc[Previous].ai[0] = (float)lol;
NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0);
Previous = lol;
}
tailSpawned = true;
}
}
if (Main.player[npc.target].dead || Main.dayTime)
{
npc.TargetClosest(false);
npc.velocity.Y = npc.velocity.Y - 3f;
if ((double)npc.position.Y < Main.topWorld + 16f)
{
npc.velocity.Y = npc.velocity.Y - 3f;
}
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int num957 = 0; num957 < 200; num957++)
{
if (Main.npc[num957].aiStyle == npc.aiStyle)
{
Main.npc[num957].active = false;
}
}
}
}
if (npc.velocity.X < 0f)
{
npc.spriteDirection = -1;
}
else if (npc.velocity.X > 0f)
{
npc.spriteDirection = 1;
}
if (Main.player[npc.target].dead)
{
npc.TargetClosest(false);
}
float num188 = speed + speedBoost;
float num189 = turnSpeed + turnSpeedBoost;
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
int num42 = -1;
int num43 = (int)(Main.player[npc.target].Center.X / 16f);
int num44 = (int)(Main.player[npc.target].Center.Y / 16f);
for (int num45 = num43 - 2; num45 <= num43 + 2; num45++)
{
for (int num46 = num44; num46 <= num44 + 15; num46++)
{
if (WorldGen.SolidTile2(num45, num46))
{
num42 = num46;
break;
}
}
if (num42 > 0)
{
break;
}
}
float num48 = num188 * 1.3f;
float num49 = num188 * 0.7f;
float num50 = npc.velocity.Length();
if (num50 > 0f)
{
if (num50 > num48)
{
npc.velocity.Normalize();
npc.velocity *= num48;
}
else if (num50 < num49)
{
npc.velocity.Normalize();
npc.velocity *= num49;
}
}
for (int num52 = 0; num52 < 200; num52++)
{
if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI)
{
Vector2 vector4 = Main.npc[num52].Center - npc.Center;
if (vector4.Length() < 60f)
{
vector4.Normalize();
vector4 *= 200f;
num191 -= vector4.X;
num192 -= vector4.Y;
}
}
}
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
float num196 = System.Math.Abs(num191);
float num197 = System.Math.Abs(num192);
float num198 = num188 / num193;
num191 *= num198;
num192 *= num198;
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num189;
}
else
{
if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num189;
}
}
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num189;
}
else
{
if (npc.velocity.Y > num192)
{
npc.velocity.Y = npc.velocity.Y - num189;
}
}
if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y + num189 * 2f;
}
else
{
npc.velocity.Y = npc.velocity.Y - num189 * 2f;
}
}
if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
{
npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2
}
else
{
npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2
}
}
}
else
{
if (num196 > num197)
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1
}
else if (npc.velocity.X > num191)
{
npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1
}
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
{
if (npc.velocity.Y > 0f)
{
npc.velocity.Y = npc.velocity.Y + num189;
}
else
{
npc.velocity.Y = npc.velocity.Y - num189;
}
}
}
else
{
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num189 * 1.1f;
}
else if (npc.velocity.Y > num192)
{
npc.velocity.Y = npc.velocity.Y - num189 * 1.1f;
}
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
{
if (npc.velocity.X > 0f)
{
npc.velocity.X = npc.velocity.X + num189;
}
else
{
npc.velocity.X = npc.velocity.X - num189;
}
}
}
}
npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f;
}
CalamityAI.AstrumDeusAI(npc, mod, true, true);
}
public override bool CheckActive()
{
@@ -417,7 +106,7 @@ namespace CalamityMod.NPCs.AstrumDeus
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
{
Color lightColor = new Color(250, 150, Main.DiscoB, npc.alpha);
Color newColor = colorChange ? lightColor : drawColor;
Color newColor = npc.Calamity().newAI[0] == 1f ? lightColor : drawColor;
SpriteEffects spriteEffects = SpriteEffects.None;
Color color24 = npc.GetAlpha(newColor);
Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));
@@ -459,46 +148,13 @@ namespace CalamityMod.NPCs.AstrumDeus
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
if (colorChange && Main.player[npc.target].gravDir != -1f)
if (npc.Calamity().newAI[0] == 1f && Main.player[npc.target].gravDir != -1f)
{
return false;
}
return true;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
+2 -66
View File
@@ -82,39 +82,8 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void AI()
{
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)
{
npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
}
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (!Main.npc[(int)npc.ai[1]].active)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.active = false;
}
if (Main.npc[(int)npc.ai[1]].alpha < 128)
{
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
}
}
CalamityAI.AstrumDeusAI(npc, mod, false, false);
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
@@ -128,39 +97,6 @@ namespace CalamityMod.NPCs.AstrumDeus
return null;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
+2 -131
View File
@@ -90,104 +90,8 @@ namespace CalamityMod.NPCs.AstrumDeus
public override void AI()
{
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
if (npc.ai[3] > 0f)
{
npc.realLife = (int)npc.ai[3];
}
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead)
{
npc.TargetClosest(true);
}
npc.velocity.Length();
if (npc.velocity.X < 0f)
{
npc.spriteDirection = -1;
}
else if (npc.velocity.X > 0f)
{
npc.spriteDirection = 1;
}
bool flag = false;
if (npc.ai[1] <= 0f)
{
flag = true;
}
else if (Main.npc[(int)npc.ai[1]].life <= 0)
{
flag = true;
}
if (flag)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.checkDead();
}
if (Main.npc[(int)npc.ai[1]].alpha < 128)
{
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
npc.alpha -= 42;
if (npc.alpha < 0)
{
npc.alpha = 0;
}
}
if (Main.player[npc.target].dead)
{
npc.TargetClosest(false);
}
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
} catch
{
}
npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = npc.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
npc.velocity = Vector2.Zero;
npc.position.X = npc.position.X + num191;
npc.position.Y = npc.position.Y + num192;
if (num191 < 0f)
{
npc.spriteDirection = -1;
}
else if (num191 > 0f)
{
npc.spriteDirection = 1;
}
}
}
CalamityAI.AstrumDeusAI(npc, mod, false, true);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
{
@@ -237,39 +141,6 @@ namespace CalamityMod.NPCs.AstrumDeus
return !npc.dontTakeDamage;
}
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)((double)damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)((double)damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)((double)damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)((double)damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)((double)damage * 0.3);
else
damage = (int)((double)damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0)
+754 -8
View File
@@ -1,6 +1,7 @@
using CalamityMod.Dusts;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.NPCs.Bumblebirb;
using CalamityMod.NPCs.Calamitas;
@@ -19,12 +20,10 @@ namespace CalamityMod.NPCs
public class CalamityAI
{
#region Aquatic Scourge
public static void AquaticScourgeAI(NPC npc, Mod mod)
public static void AquaticScourgeAI(NPC npc, Mod mod, bool head)
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
bool head = npc.type == ModContent.NPCType<AquaticScourgeHead>();
// Adjust hostility and stats
if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive ||
(double)Main.npc[(int)npc.ai[1]].life <= (double)Main.npc[(int)npc.ai[1]].lifeMax * 0.99)
@@ -54,7 +53,7 @@ namespace CalamityMod.NPCs
{
if (head)
{
// Spawn body and tail
// Spawn segments
if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f)
{
int maxLength = 31;
@@ -281,10 +280,6 @@ namespace CalamityMod.NPCs
else if (npc.velocity.X > 0f)
npc.spriteDirection = 1;
// Remove target
if (Main.player[npc.target].dead)
npc.TargetClosest(false);
// Alpha changes
if (head || Main.npc[(int)npc.ai[1]].alpha < 128)
{
@@ -1853,6 +1848,757 @@ namespace CalamityMod.NPCs
}
#endregion
#region Astrum Deus
public static void AstrumDeusAI(NPC npc, Mod mod, bool head, bool finalWorm)
{
// All parts of every worm use the following code
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
// Difficulty variables
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
// Emit light
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
// Dust and alpha effects
if (head || Main.npc[(int)npc.ai[1]].alpha < 128)
{
// Spawn dust
if (npc.alpha != 0)
{
for (int num934 = 0; num934 < 2; num934++)
{
int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f);
Main.dust[num935].noGravity = true;
Main.dust[num935].noLight = true;
}
}
// Alpha changes
npc.alpha -= 42;
if (npc.alpha < 0)
npc.alpha = 0;
}
// Set worm variable
if (npc.ai[3] > 0f)
npc.realLife = (int)npc.ai[3];
// Get a target
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead)
npc.TargetClosest(true);
// Velocity
npc.velocity.Length();
// Direction
if (npc.velocity.X < 0f)
npc.spriteDirection = -1;
else if (npc.velocity.X > 0f)
npc.spriteDirection = 1;
// Despawn
float maxSpeed = 20f;
bool flies = false;
if (Main.player[npc.target].dead || Main.dayTime || (!finalWorm && (CalamityGlobalNPC.astrumDeusHeadMain < 0 || !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)))
{
flies = true;
npc.TargetClosest(false);
npc.velocity.Y = npc.velocity.Y - 3f;
if ((double)npc.position.Y < Main.topWorld + 16f)
{
maxSpeed = 40f;
npc.velocity.Y = npc.velocity.Y - 3f;
}
if ((double)npc.position.Y < Main.topWorld + 16f)
{
for (int num957 = 0; num957 < 200; num957++)
{
if (Main.npc[num957].aiStyle == npc.aiStyle)
Main.npc[num957].active = false;
}
}
}
// All heads use this code
if (head)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (calamityGlobalNPC.newAI[1] == 0f && npc.ai[0] == 0f)
{
int maxLength = finalWorm ? 13 : 5;
int Previous = npc.whoAmI;
int bodyType = finalWorm ? ModContent.NPCType<AstrumDeusBodySpectral>() : ModContent.NPCType<AstrumDeusBody>();
int tailType = finalWorm ? ModContent.NPCType<AstrumDeusTailSpectral>() : ModContent.NPCType<AstrumDeusTail>();
for (int num36 = 0; num36 < maxLength; num36++)
{
int lol;
if (num36 >= 0 && num36 < maxLength - 1)
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), bodyType, npc.whoAmI);
else
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), tailType, npc.whoAmI);
if (num36 % 2 == 0)
Main.npc[lol].localAI[3] = 1f;
Main.npc[lol].realLife = npc.whoAmI;
Main.npc[lol].ai[2] = (float)npc.whoAmI;
Main.npc[lol].ai[1] = (float)Previous;
Main.npc[Previous].ai[0] = (float)lol;
NetMessage.SendData(23, -1, -1, null, lol, 0f, 0f, 0f, 0);
Previous = lol;
}
calamityGlobalNPC.newAI[1] = 1f;
}
}
}
// All body and tail segments use this code
else
{
// Kill segments
bool flag = false;
if (npc.ai[1] <= 0f)
flag = true;
else if (Main.npc[(int)npc.ai[1]].life <= 0)
flag = true;
if (flag)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.checkDead();
}
}
// Only the main worm uses this code
if (finalWorm)
{
// Only the main worm head uses this code
if (head)
{
// For other worms and probes
CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI;
// Change color depending on phase
if (NPC.AnyNPCs(ModContent.NPCType<AstrumDeusHead>()))
calamityGlobalNPC.newAI[0] = 1f;
else
calamityGlobalNPC.newAI[0] = 0f;
// Calculate phases based on worm HP
int astrumDeusTotalHP = 0;
double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax;
if (calamityGlobalNPC.newAI[0] == 1f)
{
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].type == ModContent.NPCType<AstrumDeusHead>())
{
astrumDeusTotalHP += Main.npc[i].life;
if (calamityGlobalNPC.newAI[2] < 10f)
{
calamityGlobalNPC.newAI[2] += 1f;
calamityGlobalNPC.newAI[3] += (float)Main.npc[i].lifeMax;
}
}
}
double astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)calamityGlobalNPC.newAI[3];
if (astrumDeusHPRatio < 0.33)
{
if (mainDeusHPRatio > 0.33)
calamityGlobalNPC.newAI[0] = 0f;
}
else if (astrumDeusHPRatio < 0.66)
{
if (mainDeusHPRatio > 0.66)
calamityGlobalNPC.newAI[0] = 0f;
}
}
// Change vulnerability based on phase (indicated by color)
npc.dontTakeDamage = calamityGlobalNPC.newAI[0] == 1f;
npc.chaseable = calamityGlobalNPC.newAI[0] != 1f;
// Speed and turn speed
float speedLimit = revenge ? 7f : 6f;
float turnSpeedLimit = revenge ? 0.11f : 0.1f;
if (CalamityWorld.death || CalamityWorld.bossRushActive)
{
speedLimit = 8f;
turnSpeedLimit = 0.12f;
}
if (CalamityWorld.bossRushActive)
{
speedLimit *= 1.5f;
turnSpeedLimit *= 1.5f;
}
// Speed and turn speed boosts based on remaining HP
float speedBoost = speedLimit * (1f - (float)mainDeusHPRatio);
float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio);
if (Main.player[npc.target].gravDir == -1f)
{
speedBoost = speedLimit;
turnSpeedBoost = turnSpeedLimit;
}
// Velocity
float num188 = 10f + speedBoost;
float num189 = 0.2f + turnSpeedBoost;
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
int num42 = -1;
int num43 = (int)(Main.player[npc.target].Center.X / 16f);
int num44 = (int)(Main.player[npc.target].Center.Y / 16f);
for (int num45 = num43 - 2; num45 <= num43 + 2; num45++)
{
for (int num46 = num44; num46 <= num44 + 15; num46++)
{
if (WorldGen.SolidTile2(num45, num46))
{
num42 = num46;
break;
}
}
if (num42 > 0)
break;
}
float num48 = num188 * 1.3f;
float num49 = num188 * 0.7f;
float num50 = npc.velocity.Length();
if (num50 > 0f)
{
if (num50 > num48)
{
npc.velocity.Normalize();
npc.velocity *= num48;
}
else if (num50 < num49)
{
npc.velocity.Normalize();
npc.velocity *= num49;
}
}
for (int num52 = 0; num52 < 200; num52++)
{
if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI)
{
Vector2 vector4 = Main.npc[num52].Center - npc.Center;
if (vector4.Length() < 60f)
{
vector4.Normalize();
vector4 *= 200f;
num191 -= vector4.X;
num192 -= vector4.Y;
}
}
}
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
float num196 = System.Math.Abs(num191);
float num197 = System.Math.Abs(num192);
float num198 = num188 / num193;
num191 *= num198;
num192 *= num198;
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num189;
}
else
{
if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num189;
}
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num189;
}
else
{
if (npc.velocity.Y > num192)
npc.velocity.Y = npc.velocity.Y - num189;
}
if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y = npc.velocity.Y + num189 * 2f;
else
npc.velocity.Y = npc.velocity.Y - num189 * 2f;
}
if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
npc.velocity.X = npc.velocity.X + num189 * 2f;
else
npc.velocity.X = npc.velocity.X - num189 * 2f;
}
}
else
{
if (num196 > num197)
{
if (npc.velocity.X < num191)
npc.velocity.X = npc.velocity.X + num189 * 1.1f;
else if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num189 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y = npc.velocity.Y + num189;
else
npc.velocity.Y = npc.velocity.Y - num189;
}
}
else
{
if (npc.velocity.Y < num192)
npc.velocity.Y = npc.velocity.Y + num189 * 1.1f;
else if (npc.velocity.Y > num192)
npc.velocity.Y = npc.velocity.Y - num189 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
{
if (npc.velocity.X > 0f)
npc.velocity.X = npc.velocity.X + num189;
else
npc.velocity.X = npc.velocity.X - num189;
}
}
}
npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f;
}
// Only the main worm body and tail use this code
else
{
// Change vulnerability based on phase (indicated by color)
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
// Shoot lasers
if (npc.type == ModContent.NPCType<AstrumDeusBodySpectral>() && Main.netMode != NetmodeID.MultiplayerClient)
{
int shootTime = 4;
if ((double)npc.life <= (double)npc.lifeMax * 0.65 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f)
{
shootTime += CalamityWorld.death ? 4 : 2;
}
if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f)
{
shootTime += CalamityWorld.death ? 6 : 2;
}
npc.localAI[0] += (float)Main.rand.Next(shootTime);
if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000))
{
npc.localAI[0] = 0f;
npc.TargetClosest(true);
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float num941 = revenge ? 14f : 13f;
if (CalamityWorld.death)
{
num941 = 16f;
}
if (CalamityWorld.bossRushActive)
{
num941 = 24f;
}
if (Main.player[npc.target].gravDir == -1f)
{
num941 *= 2f;
}
Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2));
float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X;
float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y;
float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943));
num944 = num941 / num944;
num942 *= num944;
num943 *= num944;
int num945 = expertMode ? 38 : 45;
int num946 = ModContent.ProjectileType<AstralShot2>();
vector104.X += num942 * 5f;
vector104.Y += num943 * 5f;
int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f);
npc.netUpdate = true;
}
}
}
// Follow the head
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
}
catch
{
}
npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = npc.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
npc.velocity = Vector2.Zero;
npc.position.X = npc.position.X + num191;
npc.position.Y = npc.position.Y + num192;
if (num191 < 0f)
npc.spriteDirection = -1;
else if (num191 > 0f)
npc.spriteDirection = 1;
}
}
}
// Only the smaller worms use this code
else
{
// Change vulnerability based on phase (indicated by final worm color)
if (CalamityGlobalNPC.astrumDeusHeadMain != -1)
{
if (Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].active)
{
npc.dontTakeDamage = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].dontTakeDamage;
npc.chaseable = !Main.npc[CalamityGlobalNPC.astrumDeusHeadMain].chaseable;
}
}
// Life remaining
float deusHPRatio = (float)npc.life / (float)npc.lifeMax;
// Only the smaller worm heads use this code
if (head)
{
// Spawn mine probes
float firstProbeSpawnThreshold = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.66f);
float secondProbeSpawnThreshold = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8f : 0.33f);
if (deusHPRatio <= firstProbeSpawnThreshold)
{
if (calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 3; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 75)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 75)), ModContent.NPCType<AstrumDeusProbe>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 120;
Eye.ai[3] = I * 120;
}
calamityGlobalNPC.newAI[0] = 1f;
}
}
if (deusHPRatio <= secondProbeSpawnThreshold)
{
if (calamityGlobalNPC.newAI[0] == 1f && Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74);
for (int I = 0; I < 5; I++)
{
int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), ModContent.NPCType<AstrumDeusProbe2>(), npc.whoAmI, 0, 0, 0, -1);
NPC Eye = Main.npc[FireEye];
Eye.ai[0] = I * 72;
Eye.ai[3] = I * 72;
}
calamityGlobalNPC.newAI[0] = 2f;
}
}
// Velocity variables
float speedAdd = expertMode ? 0.06f : 0.045f;
float turnSpeedAdd = expertMode ? 0.04f : 0.03f;
if (CalamityWorld.death || CalamityWorld.bossRushActive)
{
speedAdd *= 1.25f;
turnSpeedAdd *= 1.25f;
}
float newSpeed = 0.12f + speedAdd * (1f - deusHPRatio);
float newTurnSpeed = 0.08f + turnSpeedAdd * (1f - deusHPRatio);
// Movement variables
int num180 = (int)(npc.position.X / 16f) - 1;
int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2;
int num182 = (int)(npc.position.Y / 16f) - 1;
int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2;
if (num180 < 0)
num180 = 0;
if (num181 > Main.maxTilesX)
num181 = Main.maxTilesX;
if (num182 < 0)
num182 = 0;
if (num183 > Main.maxTilesY)
num183 = Main.maxTilesY;
// Fly or not
if (!flies)
{
for (int num952 = num180; num952 < num181; num952++)
{
for (int num953 = num182; num953 < num183; num953++)
{
if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64))
{
Vector2 vector105;
vector105.X = (float)(num952 * 16);
vector105.Y = (float)(num953 * 16);
if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f)
{
flies = true;
break;
}
}
}
}
}
if (!flies)
{
npc.localAI[1] = 1f;
Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
int rectX = 300;
int rectY = (npc.Calamity().enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200;
bool flag95 = true;
if (npc.position.Y > Main.player[npc.target].position.Y)
{
for (int num955 = 0; num955 < 255; num955++)
{
if (Main.player[num955].active)
{
Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - rectX, (int)Main.player[num955].position.Y - rectY, rectX * 2, rectY * 2);
if (rectangle12.Intersects(rectangle13))
{
flag95 = false;
break;
}
}
}
if (flag95)
flies = true;
}
}
else
npc.localAI[1] = 0f;
// Velocity
float num188 = newSpeed;
float num189 = newTurnSpeed;
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2);
float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
if (!flies)
{
npc.TargetClosest(true);
npc.velocity.Y = npc.velocity.Y + 0.15f;
if (npc.velocity.Y > maxSpeed)
npc.velocity.Y = maxSpeed;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.4)
{
if (npc.velocity.X < 0f)
npc.velocity.X = npc.velocity.X - num188 * 1.1f;
else
npc.velocity.X = npc.velocity.X + num188 * 1.1f;
}
else if (npc.velocity.Y == maxSpeed)
{
if (npc.velocity.X < num191)
npc.velocity.X = npc.velocity.X + num188;
else if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num188;
}
else if (npc.velocity.Y > 4f)
{
if (npc.velocity.X < 0f)
npc.velocity.X = npc.velocity.X + num188 * 0.9f;
else
npc.velocity.X = npc.velocity.X - num188 * 0.9f;
}
}
else
{
if (npc.behindTiles && npc.soundDelay == 0)
{
float num195 = num193 / 40f;
if (num195 < 10f)
num195 = 10f;
if (num195 > 20f)
num195 = 20f;
npc.soundDelay = (int)num195;
Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1);
}
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
float num196 = System.Math.Abs(num191);
float num197 = System.Math.Abs(num192);
float num198 = maxSpeed / num193;
num191 *= num198;
num192 *= num198;
if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)))
{
if (npc.velocity.X < num191)
npc.velocity.X = npc.velocity.X + num189;
else if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num189;
if (npc.velocity.Y < num192)
npc.velocity.Y = npc.velocity.Y + num189;
else if (npc.velocity.Y > num192)
npc.velocity.Y = npc.velocity.Y - num189;
}
if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))
{
if (npc.velocity.X < num191)
{
npc.velocity.X = npc.velocity.X + num188;
}
else
{
if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num188;
}
if (npc.velocity.Y < num192)
{
npc.velocity.Y = npc.velocity.Y + num188;
}
else
{
if (npc.velocity.Y > num192)
npc.velocity.Y = npc.velocity.Y - num188;
}
if ((double)System.Math.Abs(num192) < (double)maxSpeed * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y = npc.velocity.Y + num188 * 2f;
else
npc.velocity.Y = npc.velocity.Y - num188 * 2f;
}
if ((double)System.Math.Abs(num191) < (double)maxSpeed * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
npc.velocity.X = npc.velocity.X + num188 * 2f;
else
npc.velocity.X = npc.velocity.X - num188 * 2f;
}
}
else
{
if (num196 > num197)
{
if (npc.velocity.X < num191)
npc.velocity.X = npc.velocity.X + num188 * 1.1f;
else if (npc.velocity.X > num191)
npc.velocity.X = npc.velocity.X - num188 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y = npc.velocity.Y + num188;
else
npc.velocity.Y = npc.velocity.Y - num188;
}
}
else
{
if (npc.velocity.Y < num192)
npc.velocity.Y = npc.velocity.Y + num188 * 1.1f;
else if (npc.velocity.Y > num192)
npc.velocity.Y = npc.velocity.Y - num188 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)maxSpeed * 0.5)
{
if (npc.velocity.X > 0f)
npc.velocity.X = npc.velocity.X + num188;
else
npc.velocity.X = npc.velocity.X - num188;
}
}
}
npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f;
if (flies)
{
if (npc.localAI[0] != 1f)
npc.netUpdate = true;
npc.localAI[0] = 1f;
}
else
{
if (npc.localAI[0] != 0f)
npc.netUpdate = true;
npc.localAI[0] = 0f;
}
if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit)
{
npc.netUpdate = true;
}
}
}
}
}
#endregion
#region Bumblebirb
public static void BumblebirbAI(NPC npc, Mod mod)
{
+91 -23
View File
@@ -39,6 +39,8 @@ using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
@@ -238,10 +240,46 @@ namespace CalamityMod.NPCs
{ NPCID.CultistBoss, Item.buyPrice(0, 25) },
{ NPCID.MoonLordCore, Item.buyPrice(0, 30) }
};
#endregion
#region Instance Per Entity
public override bool InstancePerEntity => true;
/// <summary>
/// Lists of enemies that resist piercing to some extent (mostly worms).
/// Could prove useful for other things as well.
/// </summary>
public static List<int> AstrumDeusIDs = new List<int>
{
ModContent.NPCType<AstrumDeusHead>(),
ModContent.NPCType<AstrumDeusBody>(),
ModContent.NPCType<AstrumDeusTail>(),
ModContent.NPCType<AstrumDeusHeadSpectral>(),
ModContent.NPCType<AstrumDeusBodySpectral>(),
ModContent.NPCType<AstrumDeusTailSpectral>()
};
public static List<int> AquaticScourgeIDs = new List<int>
{
ModContent.NPCType<AquaticScourgeHead>(),
ModContent.NPCType<AquaticScourgeBody>(),
ModContent.NPCType<AquaticScourgeBodyAlt>(),
ModContent.NPCType<AquaticScourgeTail>()
};
public static List<int> EaterofWorldsIDs = new List<int>
{
NPCID.EaterofWorldsHead,
NPCID.EaterofWorldsBody,
NPCID.EaterofWorldsTail
};
public static List<int> DestroyerIDs = new List<int>
{
NPCID.TheDestroyer,
NPCID.TheDestroyerBody,
NPCID.TheDestroyerTail
};
#endregion
#region Instance Per Entity
public override bool InstancePerEntity => true;
#endregion
#region Reset Effects
@@ -582,9 +620,7 @@ namespace CalamityMod.NPCs
npc.buffImmune[ModContent.BuffType<TimeSlow>()] = true;
}
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail ||
npc.type == NPCID.DD2EterniaCrystal ||
npc.townNPC)
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC)
{
for (int k = 0; k < npc.buffImmune.Length; k++)
{
@@ -805,7 +841,7 @@ namespace CalamityMod.NPCs
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.2) : (int)(npc.lifeMax * 1.1);
}
else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)
else if (EaterofWorldsIDs.Contains(npc.type))
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.3);
@@ -833,7 +869,7 @@ namespace CalamityMod.NPCs
if (!DraedonMayhem)
{
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail)
if (DestroyerIDs.Contains(npc.type))
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.6) : (int)(npc.lifeMax * 1.25);
npc.scale = 1.5f;
@@ -1171,8 +1207,7 @@ namespace CalamityMod.NPCs
#region Strike NPC
public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
{
// TODO -- move this to Destroyer's Rev+ AI; either set his DR or modify npc.takenDamageMultiplier
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail)
if (DestroyerIDs.Contains(npc.type))
{
if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive))
{
@@ -1372,8 +1407,7 @@ namespace CalamityMod.NPCs
npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses;
}
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail ||
npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)
if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type))
{
npc.buffImmune[ModContent.BuffType<Enraged>()] = false;
}
@@ -1700,8 +1734,7 @@ namespace CalamityMod.NPCs
break;
case 7:
if (npc.type != NPCID.EaterofWorldsHead && npc.type != NPCID.EaterofWorldsBody && npc.type != NPCID.EaterofWorldsTail &&
npc.type != NPCID.VileSpit)
if (!EaterofWorldsIDs.Contains(npc.type) && npc.type != NPCID.VileSpit)
{
npc.active = false;
npc.netUpdate = true;
@@ -1719,8 +1752,7 @@ namespace CalamityMod.NPCs
break;
case 9:
if (npc.type != NPCID.TheDestroyer && npc.type != NPCID.TheDestroyerBody && npc.type != NPCID.TheDestroyerTail &&
npc.type != NPCID.Probe)
if (!DestroyerIDs.Contains(npc.type) && npc.type != NPCID.Probe)
{
npc.active = false;
npc.netUpdate = true;
@@ -1934,11 +1966,8 @@ namespace CalamityMod.NPCs
break;
case 29:
if (npc.type != ModContent.NPCType<AstrumDeusHead>() && npc.type != ModContent.NPCType<AstrumDeusBody>() &&
npc.type != ModContent.NPCType<AstrumDeusTail>() && npc.type != ModContent.NPCType<AstrumDeusHeadSpectral>() &&
npc.type != ModContent.NPCType<AstrumDeusBodySpectral>() && npc.type != ModContent.NPCType<AstrumDeusTailSpectral>() &&
npc.type != ModContent.NPCType<AstrumDeusProbe>() && npc.type != ModContent.NPCType<AstrumDeusProbe2>() &&
npc.type != ModContent.NPCType<AstrumDeusProbe3>())
if (!AstrumDeusIDs.Contains(npc.type) && npc.type != ModContent.NPCType<AstrumDeusProbe>() &&
npc.type != ModContent.NPCType<AstrumDeusProbe2>() && npc.type != ModContent.NPCType<AstrumDeusProbe3>())
{
npc.active = false;
npc.netUpdate = true;
@@ -2354,7 +2383,39 @@ namespace CalamityMod.NPCs
damage *= Main.expertMode ? 4 : 2;
}
if (npc.type == NPCID.TheDestroyerBody)
if (AstrumDeusIDs.Contains(npc.type))
{
if (projectile.type == ModContent.ProjectileType<RainbowBoom>() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)(damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType<BigNuke>() || projectile.type == ModContent.ProjectileType<RainBolt>() ||
projectile.type == ModContent.ProjectileType<AtlantisSpear2>() || projectile.type == ModContent.ProjectileType<MalachiteBolt>())
{
damage = (int)(damage * 0.2);
}
else if (projectile.type == ProjectileID.DD2BetsyArrow)
{
damage = (int)(damage * 0.3);
}
else if (projectile.type == ModContent.ProjectileType<SpikecragSpike>())
{
damage = (int)(damage * 0.5);
}
if (projectile.penetrate == -1 && !projectile.minion)
{
if (projectile.type == ModContent.ProjectileType<CosmicFire>())
damage = (int)(damage * 0.3);
else
damage = (int)(damage * 0.2);
}
else if (projectile.penetrate > 1 && projectile.type != ModContent.ProjectileType<BrinySpout>())
{
damage /= projectile.penetrate;
}
}
else if (DestroyerIDs.Contains(npc.type))
{
if (((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) || projectile.type == ModContent.ProjectileType<KelvinCatalystStar>())
{
@@ -2369,7 +2430,14 @@ namespace CalamityMod.NPCs
damage = (int)(damage * 0.25);
}
}
else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.Creeper)
else if (AquaticScourgeIDs.Contains(npc.type))
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
{
damage = (int)(damage * 0.5);
}
}
else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)
{
if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion)
{
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Ranged
projectile.ranged = true;
projectile.alpha = 255;
projectile.penetrate = -1;
projectile.localNPCHitCooldown = 5;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 7;
}
public override void AI()
+3 -3
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged
projectile.penetrate = -1;
projectile.timeLeft = 240; //1200
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 6;
projectile.localNPCHitCooldown = 8;
}
public override void AI()
@@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Ranged
Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f);
if (num237 > 0.5f)
{
color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f);
color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f );
}
color39.A = (byte)((float)color39.A * 0.5f);
color39 *= scale5;
@@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged
vector34.Y = 0f;
vector34.X = 0f;
vector34 += new Vector2(value33.X, num236) - Main.screenPosition;
Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None , 0f);
}
return false;
}
+1 -1
View File
@@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged
{
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ExoMark>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ExoMark>(), (int)(projectile.damage * 0.6f), projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
+95
View File
@@ -0,0 +1,95 @@
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace CalamityMod.Projectiles.Rogue
{
public class BettyExplosion : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Betty Explosion");
}
public override void SetDefaults()
{
projectile.width = 75;
projectile.height = 75;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 20;
projectile.Calamity().rogue = true;
}
public override void AI()
{
if (projectile.ai[0] == 0f)
SpawnExplosionDust();
if (projectile.ai[0] <= 1f)
projectile.ai[0]++;
}
void SpawnExplosionDust()
{
// Sparks and such
Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y);
for (int i = 0; i < 15; i++)
{
int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f);
Main.dust[idx].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[idx].scale = 0.5f;
Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < 25; i++)
{
int idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 5f;
idx = Dust.NewDust(corner, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f);
Main.dust[idx].velocity *= 2f;
}
// Smoke, which counts as a Gore
Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f);
for (int i = 0; i < 3; i++)
{
float smokeScale = 0.33f;
if (i == 1)
{
smokeScale = 0.66f;
}
if (i == 2)
{
smokeScale = 1f;
}
int idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f);
Main.gore[idx].velocity *= smokeScale;
Main.gore[idx].velocity.X += 1f;
Main.gore[idx].velocity.Y += 1f;
idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f);
Main.gore[idx].velocity *= smokeScale;
Main.gore[idx].velocity.X -= 1f;
Main.gore[idx].velocity.Y += 1f;
idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f);
Main.gore[idx].velocity *= smokeScale;
Main.gore[idx].velocity.X += 1f;
Main.gore[idx].velocity.Y -= 1f;
idx = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f);
Main.gore[idx].velocity *= smokeScale;
Main.gore[idx].velocity.X -= 1f;
Main.gore[idx].velocity.Y -= 1f;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

+24 -22
View File
@@ -29,31 +29,31 @@ namespace CalamityMod.Projectiles.Rogue
Main.PlaySound(2, projectile.Center, 14);
//This is definitely not a near copy of the Blast Barrel nosiree :>
bool stealthS = projectile.Calamity().stealthStrike;
int projectileCount = 2;
Projectile.NewProjectile(projectile.Center, new Vector2(0f, 0f), ModContent.ProjectileType<BettyExplosion>(), projectile.damage, 8f, projectile.owner);
if (stealthS)
{
projectileCount += 2;
}
for (int i = 0; i < projectileCount; i++)
{
if (Main.rand.NextBool(4))
int projectileCount = 12;
for (int i = 0; i < projectileCount; i++)
{
Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-7, 4f))).RotatedByRandom((double)MathHelper.ToRadians(30f));
Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity,
ModContent.ProjectileType<BouncingBettyShrapnel>(), BouncingBetty.BaseDamage, 3f, projectile.owner);
}
else
{
Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-7, 4f))).RotatedByRandom((double)MathHelper.ToRadians(40f));
int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity,
Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1),
BlastBarrel.BaseDamage, 1f, projectile.owner);
Main.projectile[fireIndex].thrown = false;
Main.projectile[fireIndex].Calamity().forceRogue = true;
Main.projectile[fireIndex].penetrate = -1;
Main.projectile[fireIndex].usesLocalNPCImmunity = true;
Main.projectile[fireIndex].localNPCHitCooldown = 9;
Main.projectile[fireIndex].timeLeft = 120;
if (Main.rand.NextBool(2))
{
Vector2 shrapnelVelocity = (Vector2.UnitY * (-6f + Main.rand.NextFloat(-6f, 2f))).RotatedByRandom((double)MathHelper.ToRadians(30f));
Projectile.NewProjectile(projectile.Center, projectile.velocity + shrapnelVelocity,
ModContent.ProjectileType<BouncingBettyShrapnel>(),(int)(projectile.damage * 0.5f), 3f, projectile.owner);
}
else
{
Vector2 fireVelocity = (Vector2.UnitY * (-6f + Main.rand.NextFloat(-6f, 2f))).RotatedByRandom((double)MathHelper.ToRadians(40f));
int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity,
Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1),
(int)(projectile.damage * 0.6f), 1f, projectile.owner);
Main.projectile[fireIndex].thrown = false;
Main.projectile[fireIndex].Calamity().forceRogue = true;
Main.projectile[fireIndex].penetrate = -1;
Main.projectile[fireIndex].usesLocalNPCImmunity = true;
Main.projectile[fireIndex].localNPCHitCooldown = 9;
Main.projectile[fireIndex].timeLeft = 240;
}
}
}
}
@@ -71,6 +71,8 @@ namespace CalamityMod.Projectiles.Rogue
else
{
projectile.velocity.Y += 0.4f;
if (projectile.velocity.Y > 16f)
projectile.velocity.Y = 16f;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
+1 -1
View File
@@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue
public override void Kill(int timeLeft)
{
if (Main.rand.Next(2) == 0)
if (Main.rand.Next(4) == 0)
{
Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType<IronFrancisca>());
}
+1 -1
View File
@@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue
public override void Kill(int timeLeft)
{
if (Main.rand.Next(2) == 0)
if (Main.rand.Next(4) == 0)
{
Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType<LeadTomahawk>());
}