diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index af7994e43b..5e9f8a690f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -79,6 +79,7 @@ using Terraria.ModLoader.IO; using Terraria.Net; using static Terraria.Main; using static Terraria.ModLoader.ModContent; +using CalamityMod.NPCs.Ravager; namespace CalamityMod.CalPlayer { @@ -4404,6 +4405,158 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.ExoChairSlowdownHotkey.Current) Player.velocity *= 0.5f; } + + foreach (var npc in Main.ActiveNPCs) + { + //This is the ravager rock pillar collision logic. It should only apply to rock pillars that are mostly opaque to ensure players don't get stopped by invisible pillars right when they spawn. + //This could also potentially be limited to only run with the pillar is stationary if desired. + if (npc.type == ModContent.NPCType() && npc.Opacity > 0.9f && npc.damage < 1) + { + bool LandedOnPlayer = false; + float origX = Player.velocity.X; + float origY = Player.velocity.Y; + npc.position += npc.velocity; + bool intersectPreVel = false; + Player.position += Player.velocity; + + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectPreVel = true; + Player.position -= Player.velocity; + if (intersectPreVel) + { + Player.position += npc.velocity; + if (Collision.SolidCollision(Player.position, Player.Hitbox.Width, Player.Hitbox.Height) || Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.Opacity > 0.9f && x.whoAmI != npc.whoAmI && x.Hitbox.Intersects(Player.Hitbox))) + { + npc.damage = npc.defDamage; + npc.ai[0] = 1; + LandedOnPlayer = true; + Player.position -= npc.velocity; + } + } + npc.position -= npc.velocity; + + if (!LandedOnPlayer) + { + //Yes, testing intercepts on th X, Y, and X+Y individually has a purpose. It makes it far more stable and consistent. + bool intersectX = false; + Player.position.X += Player.velocity.X; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectX = true; + Player.position.X -= Player.velocity.X; + bool intersectY = false; + Player.position.Y += Player.velocity.Y; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectY = true; + Player.position.Y -= Player.velocity.Y; + bool intersect = false; + //We only bother checking the X+Y together if individually they return false. + //This accounts for moving diagonal onto a corner. + if (!intersectX && !intersectY) + { + Player.position += Player.velocity; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersect = true; + Player.position -= Player.velocity; + } + if (intersectX || intersect) + { + //This checks if the player is to the left of the pillar + if (Player.Center.X < npc.Center.X) + { + float playerEdge = Player.Hitbox.X + Player.Hitbox.Width; + float pillarEdge = npc.Hitbox.X; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge > pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } + } + //This is for if the player is to the right of the pillar + else + { + float playerEdge = Player.Hitbox.X; + float pillarEdge = npc.Hitbox.X + npc.Hitbox.Width; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge < pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } + } + } + //For the vertical axis, we don't distinguish between top and bottom, and always move players to the top + //This is so being placed inside a pillar teleports a player to the top, which applies primarily to teleporting or pillar spawning + //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. + if ((intersectY || intersect)) + { + if (Player.Center.Y < npc.Center.Y) + { + float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; + float pillarEdge = npc.Hitbox.Y; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge > pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } + } + else + { + float playerEdge = Player.Hitbox.Y; + float pillarEdge = npc.Hitbox.Y + npc.Hitbox.Height; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge < pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } + } + } + //This is to guarantee we can stand on top of rock pillars instead of looking like we're "floating" on top of them. + if (intersectY && Player.velocity.Y < 0.25f && Player.velocity.Y > -0.25f) + { + Player.velocity.Y = 0; + } + } + } + } } #endregion diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 69962e5cf5..8a7abc4e6c 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); + NPCID.Sets.ImmuneToAllBuffs[Type] = true; Main.npcFrameCount[Type] = 4; if (!Main.dedServ) { @@ -35,10 +36,8 @@ namespace CalamityMod.NPCs.Ravager NPC.damage = 75; // 150 NPC.width = 40; NPC.height = 150; - NPC.defense = 35; - NPC.DR_NERD(0.2f); NPC.chaseable = false; - NPC.lifeMax = DownedBossSystem.downedProvidence ? 14000 : 3500; + NPC.lifeMax = 1250; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -59,6 +58,10 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { + if (NPC.lifeMax > 1250) + NPC.lifeMax = 1250; + if (NPC.life > NPC.lifeMax) + NPC.life = NPC.lifeMax; // Avoid cheap bullshit NPC.damage = 0; @@ -121,6 +124,7 @@ namespace CalamityMod.NPCs.Ravager } Vector2 velocity = new Vector2(speedX, speedY); int type = ModContent.ProjectileType(); + NPC.SimpleStrikeNPC(NPC.lifeMax/4,0,false,noPlayerInteraction:true); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, FlameDamage + (provy ? PostProviFlameBuff : 0), 0f, Main.myPlayer, 0f, 0f); } @@ -213,5 +217,40 @@ namespace CalamityMod.NPCs.Ravager } } } + + public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) + { + if (item.pick > 0) + { + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); + } + base.ModifyHitByItem(player, item, ref modifiers); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + var item = Main.player[projectile.owner].HeldItem; + if (item.pick > 0 && projectile.CountsAsClass()) + { + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += item.pick-1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); + } + base.ModifyHitByProjectile(projectile, ref modifiers); + } } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index db28bb704f..980dfb4ece 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -507,7 +508,7 @@ namespace CalamityMod.NPCs.Ravager player = Main.player[NPC.target]; bool shouldFall = player.position.Y >= NPC.Bottom.Y; - float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXBoost = !anyHeadActive ? 6f : 4f * (1f - lifeRatio); float velocityX = 4f + velocityXBoost; if (velocityY != 16) @@ -540,13 +541,13 @@ namespace CalamityMod.NPCs.Ravager { velocityX *= 2f; if (!shouldFall) - velocityY *= 0.5f; + velocityY *= 0.75f; } else if (calamityGlobalNPC.newAI[0] % 2f == 0f) { velocityX *= 1.5f; if (!shouldFall) - velocityY *= 0.75f; + velocityY *= 1f; } } @@ -584,7 +585,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - bool anyRockPillars = NPC.AnyNPCs(ModContent.NPCType()); + bool anyRockPillars = Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.ai[1] < 2); bool anyFlamePillars = NPC.AnyNPCs(ModContent.NPCType()); if (expertMode) @@ -593,24 +594,35 @@ namespace CalamityMod.NPCs.Ravager { if (n.type == ModContent.NPCType() && n.ai[0] == 0f) { - n.ai[1] = -1f; + n.ai[1]++; n.direction = NPC.direction; n.netUpdate = true; } } int spawnDistance = 360; + SoundEngine.PlaySound(PillarSound, NPC.Center); + if (death && phase2) + { + spawnDistance = 300; + var index = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X), (int)player.Center.Y - spawnDistance - 100, ModContent.NPCType()); + if (Main.npc.IndexInRange(index)) + { + var npc = Main.npc[index]; + (int, int) H_W = (npc.height, npc.width); + npc.position = npc.Center; + npc.height = H_W.Item2; + npc.width = H_W.Item1; + npc.rotation = -MathHelper.PiOver2; + npc.Center = npc.position; + npc.ModNPC.DrawOffsetY = npc.width / 2 - npc.height / 2; - if (!anyRockPillars || !anyFlamePillars) - { - SoundEngine.PlaySound(PillarSound, NPC.Center); + } } - if (!anyRockPillars || Main.getGoodWorld) - { - NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); - } - else if (!anyFlamePillars || Main.getGoodWorld) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); + + if (!anyFlamePillars && !phase2) { float distanceMultiplier = finalPhase ? 2.5f : 2f; NPC.NewNPC(NPC.GetSource_FromAI(), (int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); @@ -681,7 +693,7 @@ namespace CalamityMod.NPCs.Ravager else calamityGlobalNPC.newAI[2] = player.direction; - float maxOffsetScale = death ? 320f : 240f; + float maxOffsetScale = 240f; float maxOffset = maxOffsetScale * (1f - lifeRatio); float offset = phase2 ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; int quarterWidth = (int)(NPC.width * 0.25f); @@ -723,7 +735,7 @@ namespace CalamityMod.NPCs.Ravager if (NPC.Bottom.Y < player.position.Y) { - float fallSpeedBoost = !anyHeadActive ? 0.9f : death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); + float fallSpeedBoost = !anyHeadActive ? 0.9f : 0.6f * (1f - lifeRatio); float fallSpeed = 0.6f + fallSpeedBoost; if (calamityGlobalNPC.newAI[1] > 1f) @@ -738,7 +750,7 @@ namespace CalamityMod.NPCs.Ravager float velocityMult = 1.8f; float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; - float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXBoost = !anyHeadActive ? 6f : 4f * (1f - lifeRatio); float velocityXCap = 8f + velocityXBoost + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; if (!rightClawActive) diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 6c330c0b16..dc4ac07a20 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -62,7 +62,6 @@ namespace CalamityMod.NPCs.Ravager return; } - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) { NPC.timeLeft = 1800; @@ -93,17 +92,17 @@ namespace CalamityMod.NPCs.Ravager NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-120f, 50f); NPC.ai[1] += 1f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - NPC.ai[1] += 5f; + NPC.ai[1] += 2f; } if (NPC.ai[1] >= 60f) { @@ -143,17 +142,17 @@ namespace CalamityMod.NPCs.Ravager NPC.collideX = false; NPC.collideY = false; float clawSpeed = 12f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - clawSpeed += 5f; + clawSpeed += 4f; } Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; @@ -200,7 +199,7 @@ namespace CalamityMod.NPCs.Ravager bodyReturnYDist += 40f; bodyReturnXDist -= 110f; float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); - if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + if ((bodyReturnDistance > 700f || NPC.collideX || NPC.collideY) | NPC.justHit) { // Avoid cheap bullshit NPC.damage = 0; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 0e9178538e..8a0426db9e 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -62,7 +62,6 @@ namespace CalamityMod.NPCs.Ravager return; } - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) { NPC.timeLeft = 1800; @@ -93,17 +92,17 @@ namespace CalamityMod.NPCs.Ravager NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(120f, 50f); NPC.ai[1] += 1f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - NPC.ai[1] += 5f; + NPC.ai[1] += 2f; } if (NPC.ai[1] >= 60f) { @@ -143,17 +142,17 @@ namespace CalamityMod.NPCs.Ravager NPC.collideX = false; NPC.collideY = false; float clawSpeed = 12f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - clawSpeed += 5f; + clawSpeed += 4f; } Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; @@ -200,7 +199,7 @@ namespace CalamityMod.NPCs.Ravager bodyReturnYDist += 40f; bodyReturnXDist += 110f; float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); - if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + if ((bodyReturnDistance > 700f || NPC.collideX || NPC.collideY) | NPC.justHit) { // Avoid cheap bullshit NPC.damage = 0; diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index b7c57c63bf..b1754dfac9 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -50,6 +50,7 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + NPC.dontTakeDamage = true; } public override void AI() @@ -123,17 +124,6 @@ namespace CalamityMod.NPCs.Ravager Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, RavagerHead.NukeDamage + (provy ? RavagerHead.PostProviNukeBuff : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); } } - else - { - if (NPC.ai[1] % 40f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, HomingDartDamage + (provy ? PostProviDartBuff : 0), 0f, Main.myPlayer, 0f, -1f); - } - } - } } float attackMovementVel = 22f; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 5ad924bdf8..ad80d16cc6 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -14,6 +14,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); + NPCID.Sets.ImmuneToAllBuffs[Type] = true; } public override void SetDefaults() @@ -25,7 +26,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 50; NPC.DR_NERD(0.3f); NPC.chaseable = false; - NPC.lifeMax = DownedBossSystem.downedProvidence ? 20000 : 5000; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -34,10 +34,23 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + NPCID.Sets.ImmuneToAllBuffs[Type] = true; + NPC.lifeMax = 1800; } + //Disable dmg when stationary vertically or before jumping + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (NPC.velocity.Y == 0 || NPC.ai[0] == 0f) + return false; + return base.CanHitPlayer(target, ref cooldownSlot); + } public override void AI() { + if (NPC.lifeMax > 1800) + NPC.lifeMax = 1800; + if (NPC.life > NPC.lifeMax) + NPC.life = NPC.lifeMax; if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -60,17 +73,13 @@ namespace CalamityMod.NPCs.Ravager } else { - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; } - if (NPC.ai[0] == 0f) + if (NPC.ai[0] == 0) { if (NPC.velocity.Y == 0f) { - if (NPC.ai[1] == -1f) + if (NPC.ai[1] >= 2) { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); @@ -94,10 +103,14 @@ namespace CalamityMod.NPCs.Ravager } NPC.noTileCollide = true; - NPC.velocity.X = 12 * NPC.direction; + if (NPC.rotation == 0) + NPC.velocity.X = 12 * NPC.direction; NPC.velocity.Y = -28.5f; NPC.ai[0] = 1f; - NPC.ai[1] = 0f; + NPC.ai[1] = 0; + NPC.damage = NPC.defDamage; + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)(NPC.defDamage * 1.5); } } } @@ -122,7 +135,7 @@ namespace CalamityMod.NPCs.Ravager } } } - public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; + public override bool? CanFallThroughPlatforms() => NPC.ai[0] != 0 || ((NPC.alpha > 10) || (NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height)); public override bool CheckActive() => false; public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) @@ -205,5 +218,40 @@ namespace CalamityMod.NPCs.Ravager } } } + + public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) + { + if (item.pick > 0) + { + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); + } + base.ModifyHitByItem(player, item, ref modifiers); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + var item = Main.player[projectile.owner].HeldItem; + if (item.pick > 0 && projectile.CountsAsClass()) + { + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); + } + base.ModifyHitByProjectile(projectile, ref modifiers); + } } } diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index e229838a03..53bc023b24 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,4 +1,8 @@ -using Terraria; +using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -27,9 +31,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Particle beam3 = new CustomSpark(Projectile.Center, new Vector2(1).RotatedByRandom(6.3f), "CalamityMod/Particles/BloomCircle", false, 10, 0.25f, Color.SkyBlue, new Vector2(1), true, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); for (int i = 0; i < 2; i++) { - int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 3f); + int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 1.5f); Main.dust[icyFlame].noGravity = true; Main.dust[icyFlame].velocity *= 0f; }