From ef7ecad3215046cbdf4e87729cb5a56427497ac1 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 21 Jan 2020 17:07:33 -0500 Subject: [PATCH] added eutrophication debuff --- Buffs/StatDebuffs/Eutrophication.cs | 31 ++++++++++++++++++ CalPlayer/CalamityPlayer.cs | 5 ++- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- CalamityMod.cs | 5 ++- NPCs/CalamityGlobalNPC.cs | 8 +++-- NPCs/Perforator/PerforatorBodyLarge.cs | 1 + NPCs/Perforator/PerforatorBodyMedium.cs | 1 + NPCs/Perforator/PerforatorBodySmall.cs | 1 + NPCs/Perforator/PerforatorHeadLarge.cs | 1 + NPCs/Perforator/PerforatorHeadMedium.cs | 1 + NPCs/Perforator/PerforatorHeadSmall.cs | 1 + NPCs/Perforator/PerforatorTailLarge.cs | 1 + NPCs/Perforator/PerforatorTailMedium.cs | 1 + NPCs/Perforator/PerforatorTailSmall.cs | 1 + NPCs/SlimeGod/SlimeGod.cs | 1 + NPCs/SlimeGod/SlimeGodRun.cs | 1 + NPCs/SlimeGod/SlimeGodRunSplit.cs | 1 + NPCs/SlimeGod/SlimeGodSplit.cs | 1 + Projectiles/Melee/ClamCrusherFlail.cs | 38 +++++++++------------- Projectiles/Melee/EutrophicScimitarProj.cs | 5 +-- Projectiles/Ranged/BigCoral.cs | 5 +-- 21 files changed, 76 insertions(+), 36 deletions(-) create mode 100644 Buffs/StatDebuffs/Eutrophication.cs diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs new file mode 100644 index 0000000000..9b38185583 --- /dev/null +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class Eutrophication : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Eutrophication"); + Description.SetDefault("Excessive nutrients restrict your movement"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) + npc.Calamity().eutrophication = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eutrophication = true; + } + } +} diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 118cc6130e..2c30a99b9e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -541,6 +541,7 @@ namespace CalamityMod.CalPlayer public bool eFreeze = false; public bool silvaStun = false; public bool wCleave = false; + public bool eutrophication = false; // Buff public bool trinketOfChiBuff = false; @@ -1297,6 +1298,7 @@ namespace CalamityMod.CalPlayer eFreeze = false; silvaStun = false; wCleave = false; + eutrophication = false; revivify = false; trinketOfChiBuff = false; @@ -1532,6 +1534,7 @@ namespace CalamityMod.CalPlayer eFreeze = false; silvaStun = false; wCleave = false; + eutrophication = false; #endregion #region Rogue @@ -8262,7 +8265,7 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - if (eFreeze || silvaStun || gState || cDepth) + if (eFreeze || silvaStun || gState || cDepth || eutrophication) { if (noRogueStealth) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index fbedef4a39..f8011fc135 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2266,7 +2266,7 @@ namespace CalamityMod.CalPlayer player.velocity.X = 0f; } - if (modPlayer.eFreeze || modPlayer.silvaStun) + if (modPlayer.eFreeze || modPlayer.silvaStun || modPlayer.eutrophication) { player.velocity.Y = 0f; player.velocity.X = 0f; diff --git a/CalamityMod.cs b/CalamityMod.cs index f2f888d8bf..f49c106ff1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -799,7 +799,10 @@ namespace CalamityMod ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), - ModContent.BuffType() + ModContent.BuffType(), + ModContent.BuffType(), + ModContent.BuffType(), + ModContent.BuffType() }; fireWeaponList = new List() diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 79428d886d..9e8d7dca7b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -100,6 +100,7 @@ namespace CalamityMod.NPCs public int tSad = 0; public int eFreeze = 0; public int silvaStun = 0; + public int eutrophication = 0; public int webbed = 0; public int slowed = 0; public int electrified = 0; @@ -676,6 +677,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; } @@ -2123,6 +2125,8 @@ namespace CalamityMod.NPCs eFreeze--; if (silvaStun > 0) silvaStun--; + if (eutrophication > 0) + eutrophication--; if (webbed > 0) webbed--; if (slowed > 0) @@ -2190,7 +2194,7 @@ namespace CalamityMod.NPCs if (!CalamityWorld.bossRushActive) { - if (silvaStun > 0) + if (silvaStun > 0 || eutrophication > 0) npc.velocity = Vector2.Zero; else if (timeSlow > 0 || webbed > 0) npc.velocity *= 0.85f; @@ -3146,7 +3150,7 @@ namespace CalamityMod.NPCs } } - if (tSad > 0 || cDepth > 0) + if (tSad > 0 || cDepth > 0 || eutrophication > 0) { if (Main.rand.Next(6) < 3) { diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index cc1d30d60d..db6de7f303 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -37,6 +37,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 2e5d07bb37..78ba9d013a 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -36,6 +36,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 934afff3f5..5474a83174 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -36,6 +36,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index a7095a332e..a9c2fed07d 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -44,6 +44,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 2de89b7f52..698abcf2f5 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -44,6 +44,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index d2135b2cd9..3919728f3c 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -42,6 +42,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index d1d808dccf..5ba6d3c066 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index b2e842af76..8ea59a6afa 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 637e934c29..c1e70e23e9 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.Perforator npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 61149c2498..cdd7ee15b7 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -38,6 +38,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.knockBackResist = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 7cd5a560f3..ac7409ce81 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -38,6 +38,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.value = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 8f12874274..82c3acb0a9 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -37,6 +37,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; animationType = 50; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index b119473829..c7918434f2 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -39,6 +39,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; animationType = 50; diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 0299dd51b5..1821044352 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -44,13 +44,12 @@ namespace CalamityMod.Projectiles.Melee float num100 = projectile.velocity.Y / 3f * (float)num105; int num101 = 4; int waterDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.5f); - Main.dust[waterDust].noGravity = true; - Main.dust[waterDust].velocity *= 0.1f; - Main.dust[waterDust].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[waterDust]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[waterDust]; - expr_4815_cp_0.position.Y -= num100; + Dust waterdust = Main.dust[waterDust]; + waterdust.noGravity = true; + waterdust.velocity *= 0.1f; + waterdust.velocity += projectile.velocity * 0.1f; + waterdust.position.X -= num99; + waterdust.position.Y -= num100; } } if (projectile.ai[1] == 5f) @@ -66,7 +65,6 @@ namespace CalamityMod.Projectiles.Melee } Main.player[projectile.owner].itemAnimation = 10; Main.player[projectile.owner].itemTime = 10; - float arg_1DC8F_0 = vector62.X; if (vector62.X < 0f) { Main.player[projectile.owner].ChangeDir(1); @@ -114,10 +112,7 @@ namespace CalamityMod.Projectiles.Melee return; } } - float[] var_2_1DE21_cp_0 = projectile.ai; - int var_2_1DE21_cp_1 = 1; - float num73 = var_2_1DE21_cp_0[var_2_1DE21_cp_1]; - var_2_1DE21_cp_0[var_2_1DE21_cp_1] = num73 + 1f; + projectile.ai[1] += 1f; if (projectile.ai[1] > 5f) { projectile.alpha = 0; @@ -189,17 +184,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - if (target.rarity != 2) - { - target.AddBuff(ModContent.BuffType(), 60); - } - else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - target.AddBuff(ModContent.BuffType(), 30); - } - } + if (target.rarity < 2) + { + target.AddBuff(ModContent.BuffType(), 60); + } + else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + { + target.AddBuff(ModContent.BuffType(), 30); + } projectile.ai[0] = 1f; projectile.netUpdate = true; Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); diff --git a/Projectiles/Melee/EutrophicScimitarProj.cs b/Projectiles/Melee/EutrophicScimitarProj.cs index 00637a89a0..7435441605 100644 --- a/Projectiles/Melee/EutrophicScimitarProj.cs +++ b/Projectiles/Melee/EutrophicScimitarProj.cs @@ -31,10 +31,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) - { - target.AddBuff(ModContent.BuffType(), 15); - } + target.AddBuff(ModContent.BuffType(), 15); } public override void AI() diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index 10f9a046f9..ba41d38517 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -46,10 +46,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.rarity != 2 && !target.boss) - { - target.AddBuff(ModContent.BuffType(), 15); - } + target.AddBuff(ModContent.BuffType(), 15); } } }