This commit is contained in:
Ozzatron committed 2020-04-03 22:33:20 -04:00
commit d5151c60d2
11 files changed
+74 -286

No files matched your search

+2
View File
@@ -465,6 +465,7 @@ namespace CalamityMod.CalPlayer
public bool starbusterCore = false;
public bool starTaintedGenerator = false;
public bool hallowedRune = false;
public int hallowedRuneCooldown = 0;
public bool silvaWings = false;
public int icicleCooldown = 0;
@@ -1686,6 +1687,7 @@ namespace CalamityMod.CalPlayer
sandCloakCooldown = false;
icicleCooldown = 0;
statisTimer = 0;
hallowedRuneCooldown = 0;
alcoholPoisoning = false;
shadowflame = false;
+7 -5
View File
@@ -423,12 +423,12 @@ namespace CalamityMod.CalPlayer
int acidRainDropRate = (int)(MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50) * 2.25);
Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801));
int acidDmg = CalamityWorld.downedPolterghast ? 35 : CalamityWorld.downedAquaticScourge ? 25 : 15;
if (player.miscCounter % acidRainDropRate == 0f && Main.rand.NextBool(2))
if (player.miscCounter % acidRainDropRate == 0f)
{
Projectile.NewProjectile(spawnPoint, Vector2.UnitY * Main.rand.NextFloat(7f, 11f),
ModContent.ProjectileType<AcidDrop>(), acidDmg, 0f);
if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12))
{
NPC.NewNPC((int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType<IrradiatedSlime>());
}
}
}
}
@@ -918,6 +918,8 @@ namespace CalamityMod.CalPlayer
modPlayer.icicleCooldown--;
if (modPlayer.statisTimer > 0 && player.dashDelay >= 0)
modPlayer.statisTimer = 0;
if (modPlayer.hallowedRuneCooldown > 0)
modPlayer.hallowedRuneCooldown--;
// Silva invincibility effects
if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet)
-1
View File
@@ -39,7 +39,6 @@ namespace CalamityMod.Events
( ModContent.NPCType<NuclearToad>(), 0, false ),
( ModContent.NPCType<AcidEel>(), 0, true ),
( ModContent.NPCType<Orthocera>(), 1, true ),
( ModContent.NPCType<IrradiatedSlime>(), 1, false ),
( ModContent.NPCType<WaterLeech>(), 1, true ),
( ModContent.NPCType<Skyfin>(), 1, true ),
( ModContent.NPCType<Trilobite>(), 1, true ),
+1
View File
@@ -561,6 +561,7 @@ namespace CalamityMod
{
InvasionDifficulty.TryGetValue("Acid Rain Aquatic Scourge", out float order);
List<int> enemies = AcidRainEvent.PossibleEnemiesAS.Select(enemy => enemy.Item1).ToList();
enemies.Add(ModContent.NPCType<IrradiatedSlime>());
enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Item1));
List<int> summons = new List<int>() { ItemType<CausticTear>(), ItemType<CausticTearNonConsumable>() };
List<int> loot = new List<int>() { ItemType<SulfuricScale>(), ItemType<CorrodedFossil>(), ItemType<LeadCore>(), ItemType<NuclearRod>(), ItemType<FlakToxicannon>(), ItemType<OrthoceraShell>(), ItemType<SkyfinBombers>(), ItemType<SlitheringEels>(), ItemType<SpentFuelContainer>(), ItemType<SulphurousGrabber>() };
+11 -7
View File
@@ -1,7 +1,7 @@
using CalamityMod.Dusts;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Projectiles.Environment;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -137,6 +137,13 @@ namespace CalamityMod.NPCs.AcidRain
}
}
}
else if (npc.ai[0] % 420f > 300f && npc.ai[0] % 7f == 6f && CalamityWorld.downedPolterghast)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.Center, -Vector2.UnitY.RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 15f), ModContent.ProjectileType<AcidDrop>(), 69, 4f, Main.myPlayer, 0f, npc.whoAmI);
}
}
if (!Phase2)
{
@@ -162,14 +169,11 @@ namespace CalamityMod.NPCs.AcidRain
if (CalamityWorld.downedPolterghast)
{
possibleEnemies.Add(ModContent.NPCType<GammaSlime>());
possibleEnemies.Add(ModContent.NPCType<FlakCrab>());
possibleEnemies.Add(ModContent.NPCType<NuclearToad>());
possibleEnemies.Add(ModContent.NPCType<Orthocera>());
}
else
{
possibleEnemies.Add(ModContent.NPCType<IrradiatedSlime>());
possibleEnemies.Add(ModContent.NPCType<FlakCrab>());
possibleEnemies.Add(ModContent.NPCType<WaterLeech>());
possibleEnemies.Add(ModContent.NPCType<Trilobite>());
}
@@ -178,17 +182,17 @@ namespace CalamityMod.NPCs.AcidRain
int attempts = 0;
while (!WorldGen.InWorld((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16))
{
spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -360f, 360f);
spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -460f, 460f);
attempts++;
if (attempts > 200)
return;
}
attempts = 0;
while (CalamityUtils.TileSelectionSolidSquare((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16, 4, 4) ||
while (CalamityUtils.TileSelectionSolidSquare((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16, 8, 8) ||
CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16).liquid != 255)
{
spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -420f, 420f);
spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -620f, 620f);
attempts++;
if (attempts > 300)
return;
+1 -1
View File
@@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.AcidRain
npc.chaseable = false;
if (Math.Abs(closest.Center.X - npc.Center.X) < 320f &&
closest.Center.Y - npc.Top.Y < -60f &&
npc.ai[1]++ >= Main.rand.Next(35, 95))
npc.ai[1]++ >= Main.rand.Next(90, 135))
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
+25 -247
View File
@@ -2,11 +2,9 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -14,6 +12,7 @@ namespace CalamityMod.NPCs.AcidRain
{
public class IrradiatedSlime : ModNPC
{
public bool Falling = true;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Irradiated Slime");
@@ -45,6 +44,14 @@ namespace CalamityMod.NPCs.AcidRain
banner = npc.type;
bannerItem = ModContent.ItemType<IrradiatedSlimeBanner>();
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(Falling);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
Falling = reader.ReadBoolean();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
@@ -53,252 +60,23 @@ namespace CalamityMod.NPCs.AcidRain
public override void AI()
{
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f);
if (!Main.player[npc.target].dead)
if (Falling)
{
npc.TargetClosest(false);
Player player = Main.player[npc.target];
npc.aiStyle = aiType = -1;
npc.noTileCollide = false;
npc.noGravity = false;
if (Main.player[npc.target].dead)
{
npc.TargetClosest(true);
if (Main.player[npc.target].dead)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
}
}
// Hop around
if (npc.ai[0] == 0f)
{
// Lunge towards player if too far away
if ((Main.player[npc.target].Center - npc.Center).Length() > 900f)
{
npc.ai[0] = 2f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
}
if (npc.velocity.Y == 0f)
{
npc.TargetClosest(true);
npc.velocity.X = npc.velocity.X * 0.85f;
npc.ai[1] += 1f;
float hopRate = 15f + 30f * ((float)npc.life / (float)npc.lifeMax);
float lungeForwardSpeed = 3f + 4f * (1f - (float)npc.life / (float)npc.lifeMax);
float jumpSpeed = 9f;
if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1))
{
jumpSpeed += 6f;
}
if (npc.ai[1] > hopRate)
{
npc.ai[3] += 1f;
if (npc.ai[3] >= 3f)
{
npc.ai[3] = 0f;
jumpSpeed *= 2f;
lungeForwardSpeed /= 2f;
}
npc.ai[1] = 0f;
npc.velocity.Y -= jumpSpeed;
npc.velocity.X = lungeForwardSpeed * npc.direction;
}
}
else
{
npc.knockBackResist = 0f;
npc.velocity.X = npc.velocity.X * 0.99f;
if (npc.direction < 0 && npc.velocity.X > -1f)
{
npc.velocity.X = -1f;
}
if (npc.direction > 0 && npc.velocity.X < 1f)
{
npc.velocity.X = 1f;
}
}
npc.ai[2]++;
if (npc.ai[2] > 210f && npc.velocity.Y == 0f && Main.netMode != 1)
{
if (Main.rand.NextBool(2))
{
npc.ai[0] = 2f;
npc.noTileCollide = true;
npc.velocity.Y = -8f;
}
else
{
npc.ai[0] = 3f;
}
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
return;
}
}
// Attempt to fly above the player
else if (npc.ai[0] == 1f)
{
npc.noTileCollide = true;
npc.noGravity = true;
npc.knockBackResist = 0f;
npc.direction = (npc.velocity.X > 0).ToDirectionInt();
npc.TargetClosest(true);
Vector2 idealPosition = Main.player[npc.target].Center;
idealPosition.Y -= 350f;
Vector2 idealDistanceVector = idealPosition - npc.Center;
if (npc.ai[2] == 1f)
{
npc.ai[1] += 1f;
npc.velocity = (npc.velocity * 4f + npc.DirectionTo(Main.player[npc.target].Center) * 10f) / 5f;
// And slam downward
if (npc.ai[1] > 6f)
{
npc.ai[1] = 0f;
npc.ai[0] = 1.1f;
npc.ai[2] = 0f;
npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * 10f;
return;
}
}
else
{
if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 40f && npc.Center.Y < Main.player[npc.target].Center.Y - 300f)
{
npc.ai[1] = 0f;
npc.ai[2] = 0f;
return;
}
npc.velocity = (npc.velocity * 5f + Vector2.Normalize(idealDistanceVector) * 10f) / 6f;
return;
}
}
// Slam onto the player
else if (npc.ai[0] == 1.1f)
{
npc.knockBackResist = 0f;
if (npc.ai[2] == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))
{
npc.ai[2] = 1f;
}
if (npc.Bottom.Y >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f)
{
npc.ai[1] += 1f;
if (npc.ai[1] > 10f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
if (Collision.SolidCollision(npc.position, npc.width, npc.height))
{
npc.ai[0] = 2f;
}
}
}
else
{
if (npc.ai[2] == 0f)
{
npc.noTileCollide = true;
npc.noGravity = true;
npc.knockBackResist = 0f;
}
}
float yAcceleration = 0.135f;
npc.velocity.Y += yAcceleration;
if (npc.velocity.Y > 18f)
{
npc.velocity.Y = 18f;
return;
}
}
// Lunge towards the player
else if (npc.ai[0] == 2f)
{
npc.direction = (npc.velocity.X > 0).ToDirectionInt();
npc.noTileCollide = true;
npc.noGravity = true;
npc.knockBackResist = 0f;
Vector2 idealDistanceVector = Main.player[npc.target].Center - npc.Center;
idealDistanceVector.Y -= 4f;
if (idealDistanceVector.Length() < 120f && !Collision.SolidCollision(npc.position, npc.width, npc.height))
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
if (Main.rand.NextBool(5))
{
Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * 8f, ModContent.ProjectileType<TrilobiteSpike>(),
41, 4f);
}
}
if (idealDistanceVector.Length() > 3f)
{
idealDistanceVector.Normalize();
idealDistanceVector *= 9f;
}
npc.velocity = (npc.velocity * 4f + idealDistanceVector) / 5f;
return;
}
// Significant, ground-based lunges
else if (npc.ai[0] == 3f)
{
npc.knockBackResist = 0f;
if (npc.velocity.Y == 0f)
{
npc.TargetClosest(true);
npc.velocity.X = npc.velocity.X * 0.8f;
npc.ai[1] += 1f;
if (npc.ai[1] > 5f)
{
npc.ai[1] = 0f;
npc.velocity.Y = npc.velocity.Y - 4f;
if (Main.player[npc.target].Bottom.Y < npc.Center.Y)
{
npc.velocity.Y -= 1.25f;
}
if (Main.player[npc.target].Bottom.Y < npc.Center.Y - 40f)
{
npc.velocity.Y -= 1.5f;
}
if (Main.player[npc.target].Bottom.Y < npc.Center.Y - 80f)
{
npc.velocity.Y -= 1.75f;
}
if (Main.player[npc.target].Bottom.Y < npc.Center.Y - 120f)
{
npc.velocity.Y -= 2f;
}
if (Main.player[npc.target].Bottom.Y < npc.Center.Y - 160f)
{
npc.velocity.Y -= 2.25f;
}
if (Main.player[npc.target].Bottom.Y < npc.Center.Y - 200f)
{
npc.velocity.Y -= 2.5f;
}
if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1))
{
npc.velocity.Y -= 2f;
}
npc.velocity.X = 10f * npc.direction;
npc.ai[2] += 1f;
}
}
if (npc.ai[2] >= 3f && npc.velocity.Y == 0f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
return;
}
}
npc.noTileCollide = npc.noGravity = true;
if (player.Top.Y < npc.Bottom.Y)
{
npc.noTileCollide = npc.noGravity = false;
Falling = false;
npc.netUpdate = true;
}
else
{
npc.velocity = Vector2.UnitY * 6f;
}
}
else
{
@@ -329,7 +107,7 @@ namespace CalamityMod.NPCs.AcidRain
}
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ModContent.ItemType<LeadCore>(), 100);
DropHelper.DropItemChance(npc, ModContent.ItemType<LeadCore>(), 30);
}
public override void OnHitPlayer(Player target, int damage, bool crit)
+1 -2
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.AcidRain
npc.aiStyle = aiType = -1;
npc.damage = 15;
npc.lifeMax = 120;
npc.lifeMax = 60;
npc.defense = 3;
if (CalamityWorld.downedPolterghast)
@@ -42,7 +42,6 @@ namespace CalamityMod.NPCs.AcidRain
npc.lifeMax = 420;
}
npc.knockBackResist = 0f;
npc.value = Item.buyPrice(0, 0, 5, 0);
for (int k = 0; k < npc.buffImmune.Length; k++)
+6 -13
View File
@@ -3640,17 +3640,6 @@ namespace CalamityMod.NPCs
}
}
if (modPlayer.hallowedPower)
{
if (isSummon && Main.rand.NextBool(4))
{
Vector2 spawnPosition = npc.Center - new Vector2(0f, 920f).RotatedByRandom(0.3f);
float speed = Main.rand.NextFloat(17f, 23f);
Projectile.NewProjectile(spawnPosition, Vector2.Normalize(npc.Center - spawnPosition) * speed,
ModContent.ProjectileType<HallowedStarSummon>(), projectile.damage, 3f, projectile.owner);
}
}
if (modPlayer.corrosiveSpine && projectile.Calamity().rogue)
{
for (int i = 0; i < 3; i++)
@@ -4009,6 +3998,7 @@ namespace CalamityMod.NPCs
{
PossibleEnemies = AcidRainEvent.PossibleEnemiesAS;
PossibleMinibosses = AcidRainEvent.PossibleMinibossesAS;
PossibleEnemies.Add((ModContent.NPCType<IrradiatedSlime>(), 1, false));
}
if (CalamityWorld.downedPolterghast)
{
@@ -4019,7 +4009,10 @@ namespace CalamityMod.NPCs
{
if (spawnInfo.water || !PossibleEnemies.First(potential => potential.Item1 == enemy).Item3)
{
pool.Add(enemy, 1f);
if (!pool.ContainsKey(enemy))
{
pool.Add(enemy, 1f);
}
}
}
if (PossibleMinibosses.Count > 0)
@@ -4028,7 +4021,7 @@ namespace CalamityMod.NPCs
{
if (spawnInfo.water || !PossibleMinibosses.First(potential => potential.Item1 == enemy).Item3)
{
pool.Add(enemy, 0.05f);
pool.Add(enemy, enemy == ModContent.NPCType<CragmawMire>() ? 0.085f : 0.05f);
}
}
}
+8 -10
View File
@@ -1598,25 +1598,23 @@ namespace CalamityMod.NPCs
#region Acid Rain
private void AcidRainProgression(NPC npc)
{
List<(int, int, bool)> PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM;
List<(int, int, bool)> PossibleMinibosses = new List<(int, int, bool)>();
List<(int, int, bool)> possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM;
if (CalamityWorld.downedAquaticScourge)
PossibleEnemies = AcidRainEvent.PossibleEnemiesAS;
possibleEnemies = AcidRainEvent.PossibleEnemiesAS;
if (CalamityWorld.downedPolterghast)
PossibleEnemies = AcidRainEvent.PossibleEnemiesPolter;
if (PossibleEnemies.Select(enemy => enemy.Item1).Contains(npc.type) && CalamityWorld.rainingAcid)
possibleEnemies = AcidRainEvent.PossibleEnemiesPolter;
if (possibleEnemies.Select(enemy => enemy.Item1).Contains(npc.type) && CalamityWorld.rainingAcid)
{
CalamityWorld.acidRainPoints -= PossibleEnemies.Find(enemy => enemy.Item1 == npc.type).Item2;
CalamityWorld.acidRainPoints -= possibleEnemies.Find(enemy => enemy.Item1 == npc.type).Item2;
if (CalamityWorld.downedPolterghast)
{
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
}
}
PossibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : PossibleMinibosses;
if (AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Item1).Contains(npc.type) ||
AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Item1).Contains(npc.type))
List<(int, int, bool)> possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS;
if (possibleMinibosses.Select(miniboss => miniboss.Item1).Contains(npc.type))
{
CalamityWorld.acidRainPoints -= PossibleMinibosses.Find(enemy => enemy.Item1 == npc.type).Item2;
CalamityWorld.acidRainPoints -= possibleMinibosses.Find(enemy => enemy.Item1 == npc.type).Item2;
if (CalamityWorld.downedPolterghast)
{
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
+12
View File
@@ -1580,6 +1580,18 @@ namespace CalamityMod.Projectiles
modPlayer.jellyDmg += (float)num;
}
}
if (modPlayer.hallowedPower)
{
if (Main.rand.NextBool(3) && modPlayer.hallowedRuneCooldown <= 0)
{
modPlayer.hallowedRuneCooldown = 60;
Vector2 spawnPosition = npc.Center - new Vector2(0f, 920f).RotatedByRandom(0.3f);
float speed = Main.rand.NextFloat(17f, 23f);
Projectile.NewProjectile(spawnPosition, Vector2.Normalize(npc.Center - spawnPosition) * speed,
ModContent.ProjectileType<HallowedStarSummon>(), projectile.damage / 3, 3f, projectile.owner);
}
}
}
}