diff --git a/Content/Buffs/Buffs/Commander.cs b/Content/Buffs/Buffs/Commander.cs index 7bede87..8874bd8 100644 --- a/Content/Buffs/Buffs/Commander.cs +++ b/Content/Buffs/Buffs/Commander.cs @@ -1,5 +1,5 @@ +using Decimation.Lib.Buffs; using Terraria; -using Terraria.ModLoader; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/DemonicallyBewitched.cs b/Content/Buffs/Buffs/DemonicallyBewitched.cs index c31e5dd..1eb1b7f 100644 --- a/Content/Buffs/Buffs/DemonicallyBewitched.cs +++ b/Content/Buffs/Buffs/DemonicallyBewitched.cs @@ -1,6 +1,5 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/FatesSmile.cs b/Content/Buffs/Buffs/FatesSmile.cs index f72f0ce..49722ac 100644 --- a/Content/Buffs/Buffs/FatesSmile.cs +++ b/Content/Buffs/Buffs/FatesSmile.cs @@ -1,6 +1,5 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.DataStructures; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/MysticFlame.cs b/Content/Buffs/Buffs/MysticFlame.cs index 600f45b..7e6843a 100644 --- a/Content/Buffs/Buffs/MysticFlame.cs +++ b/Content/Buffs/Buffs/MysticFlame.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/NaturesAura.cs b/Content/Buffs/Buffs/NaturesAura.cs index 44eb421..da9f89c 100644 --- a/Content/Buffs/Buffs/NaturesAura.cs +++ b/Content/Buffs/Buffs/NaturesAura.cs @@ -1,6 +1,5 @@ -using Terraria; -using Terraria.ModLoader; -using Terraria.DataStructures; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/ScarabEndurance.cs b/Content/Buffs/Buffs/ScarabEndurance.cs index f7e4e59..a3b5fb5 100644 --- a/Content/Buffs/Buffs/ScarabEndurance.cs +++ b/Content/Buffs/Buffs/ScarabEndurance.cs @@ -1,4 +1,5 @@ using Decimation.Content.Projectiles; +using Decimation.Lib.Buffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Content/Buffs/Buffs/SlimyFeet.cs b/Content/Buffs/Buffs/SlimyFeet.cs index fdaae70..dcfd491 100644 --- a/Content/Buffs/Buffs/SlimyFeet.cs +++ b/Content/Buffs/Buffs/SlimyFeet.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework.Input; +using Decimation.Lib.Buffs; +using Microsoft.Xna.Framework.Input; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Buffs/Ubered.cs b/Content/Buffs/Buffs/Ubered.cs index 779bdcd..2aefb0c 100644 --- a/Content/Buffs/Buffs/Ubered.cs +++ b/Content/Buffs/Buffs/Ubered.cs @@ -1,6 +1,5 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/Ubered.png b/Content/Buffs/Buffs/Ubered.png index 6274cbd..6561423 100644 Binary files a/Content/Buffs/Buffs/Ubered.png and b/Content/Buffs/Buffs/Ubered.png differ diff --git a/Content/Buffs/Buffs/Vampire.cs b/Content/Buffs/Buffs/Vampire.cs index e3b85ea..786b48a 100644 --- a/Content/Buffs/Buffs/Vampire.cs +++ b/Content/Buffs/Buffs/Vampire.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using Decimation.Lib.Buffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Buffs/Warlock.cs b/Content/Buffs/Buffs/Warlock.cs index dc2fdbd..fe7ca24 100644 --- a/Content/Buffs/Buffs/Warlock.cs +++ b/Content/Buffs/Buffs/Warlock.cs @@ -1,5 +1,5 @@ +using Decimation.Lib.Buffs; using Terraria; -using Terraria.ModLoader; namespace Decimation.Content.Buffs.Buffs { diff --git a/Content/Buffs/Buffs/Werepire.cs b/Content/Buffs/Buffs/Werepire.cs index e98be44..1347ec8 100644 --- a/Content/Buffs/Buffs/Werepire.cs +++ b/Content/Buffs/Buffs/Werepire.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Amnesia.cs b/Content/Buffs/Debuffs/Amnesia.cs index 05f9c78..4ce88bc 100644 --- a/Content/Buffs/Debuffs/Amnesia.cs +++ b/Content/Buffs/Debuffs/Amnesia.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; namespace Decimation.Content.Buffs.Debuffs diff --git a/Content/Buffs/Debuffs/AvianFlu.cs b/Content/Buffs/Debuffs/AvianFlu.cs index b176036..1753349 100644 --- a/Content/Buffs/Debuffs/AvianFlu.cs +++ b/Content/Buffs/Debuffs/AvianFlu.cs @@ -1,6 +1,5 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; +using Decimation.Lib.Buffs; +using Terraria; namespace Decimation.Content.Buffs.Debuffs { @@ -24,6 +23,7 @@ namespace Decimation.Content.Buffs.Debuffs { player.lifeRegen = 0; } + player.lifeRegenTime = 0; player.lifeRegen -= 3; @@ -36,6 +36,7 @@ namespace Decimation.Content.Buffs.Debuffs { npc.lifeRegen = 0; } + npc.lifeRegenExpectedLossPerSecond += 3; npc.lifeRegen -= 3; } diff --git a/Content/Buffs/Debuffs/AvianFlu.png b/Content/Buffs/Debuffs/AvianFlu.png index af9d614..0d66fa2 100644 Binary files a/Content/Buffs/Debuffs/AvianFlu.png and b/Content/Buffs/Debuffs/AvianFlu.png differ diff --git a/Content/Buffs/Debuffs/Corrosion.cs b/Content/Buffs/Debuffs/Corrosion.cs index e2901dd..37c3cd2 100644 --- a/Content/Buffs/Debuffs/Corrosion.cs +++ b/Content/Buffs/Debuffs/Corrosion.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Corrosion.png b/Content/Buffs/Debuffs/Corrosion.png index af9d614..0a4f5fa 100644 Binary files a/Content/Buffs/Debuffs/Corrosion.png and b/Content/Buffs/Debuffs/Corrosion.png differ diff --git a/Content/Buffs/Debuffs/Discombobulated.cs b/Content/Buffs/Debuffs/Discombobulated.cs index 6f12f5d..e631788 100644 --- a/Content/Buffs/Debuffs/Discombobulated.cs +++ b/Content/Buffs/Debuffs/Discombobulated.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Enveloped.cs b/Content/Buffs/Debuffs/Enveloped.cs index d512986..f607d09 100644 --- a/Content/Buffs/Debuffs/Enveloped.cs +++ b/Content/Buffs/Debuffs/Enveloped.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Enveloped.png b/Content/Buffs/Debuffs/Enveloped.png index dfed40b..81f8069 100644 Binary files a/Content/Buffs/Debuffs/Enveloped.png and b/Content/Buffs/Debuffs/Enveloped.png differ diff --git a/Content/Buffs/Debuffs/Hyperthermic.cs b/Content/Buffs/Debuffs/Hyperthermic.cs index cf6dea6..9bc07e8 100644 --- a/Content/Buffs/Debuffs/Hyperthermic.cs +++ b/Content/Buffs/Debuffs/Hyperthermic.cs @@ -1,4 +1,5 @@ using System; +using Decimation.Lib.Buffs; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Hyperthermic.png b/Content/Buffs/Debuffs/Hyperthermic.png index 35a0bb9..6b67569 100644 Binary files a/Content/Buffs/Debuffs/Hyperthermic.png and b/Content/Buffs/Debuffs/Hyperthermic.png differ diff --git a/Content/Buffs/Debuffs/InfernalGaze.cs b/Content/Buffs/Debuffs/InfernalGaze.cs index 39627dc..ab2daa3 100644 --- a/Content/Buffs/Debuffs/InfernalGaze.cs +++ b/Content/Buffs/Debuffs/InfernalGaze.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/PiercingGaze.cs b/Content/Buffs/Debuffs/PiercingGaze.cs index 07f7711..5d9486b 100644 --- a/Content/Buffs/Debuffs/PiercingGaze.cs +++ b/Content/Buffs/Debuffs/PiercingGaze.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Singed.cs b/Content/Buffs/Debuffs/Singed.cs index 116cd03..c95c688 100644 --- a/Content/Buffs/Debuffs/Singed.cs +++ b/Content/Buffs/Debuffs/Singed.cs @@ -1,4 +1,5 @@ -using Terraria; +using Decimation.Lib.Buffs; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Buffs/Debuffs/Slimed.cs b/Content/Buffs/Debuffs/Slimed.cs index a45fa9f..ac13dcd 100644 --- a/Content/Buffs/Debuffs/Slimed.cs +++ b/Content/Buffs/Debuffs/Slimed.cs @@ -1,3 +1,4 @@ +using Decimation.Lib.Buffs; using Terraria; using Terraria.ModLoader; using Terraria.DataStructures; diff --git a/Content/DecimationPlayerImpl.cs b/Content/DecimationPlayer.cs similarity index 98% rename from Content/DecimationPlayerImpl.cs rename to Content/DecimationPlayer.cs index f44aca8..b23a3b0 100644 --- a/Content/DecimationPlayerImpl.cs +++ b/Content/DecimationPlayer.cs @@ -16,7 +16,7 @@ using Terraria.ModLoader.IO; namespace Decimation.Content { - public class DecimationPlayer : DecimationModPlayer + public class DecimationPlayer : ModPlayer { // Amulet slot private Amulet _amuletSlotAmulet; @@ -69,8 +69,7 @@ namespace Decimation.Content public bool wasJumping = false; public ICollection EquippedAccessories { get; } = new List(); - public override bool HasShield { get; set; } - public override bool HasLavaCharm { get; set; } + public bool HasShield { get; set; } public Item AmuletSlotItem { @@ -101,7 +100,6 @@ namespace Decimation.Content tideTurnerEquipped = false; vampire = false; - HasLavaCharm = false; HasShield = false; hasCursedAccessory = false; @@ -270,6 +268,8 @@ namespace Decimation.Content if (AmuletSlotItem.type == ModContent.ItemType()) CrystalAmuletEffect(); + + _amuletSlotAmulet?.Synergy.OnHitPlayer(this, target, item, ref damage, ref crit); } public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) @@ -281,6 +281,8 @@ namespace Decimation.Content AmuletSlotItem.type != ModContent.ItemType()) if (Main.rand.Next(amuletsBuffChances, 100) < amuletsBuffChances) target.AddBuff(amuletsBuff, amuletsBuffTime); + + _amuletSlotAmulet?.Synergy.OnHitNPC(this, target, item, ref damage, ref crit); } public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) @@ -389,12 +391,12 @@ namespace Decimation.Content public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) { - _amuletSlotAmulet?.Synergy.OnHitPlayer(this, ref damage); + _amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage); } public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - _amuletSlotAmulet?.Synergy.OnHitPlayer(this, ref damage); + _amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage); } public void DashMovement() @@ -829,7 +831,6 @@ namespace Decimation.Content DecimationPlayer modPlayer = player.GetModPlayer(); if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield || item.type == ItemID.PaladinsShield || item.type == ItemID.ObsidianShield) modPlayer.HasShield = true; - if (item.type == ItemID.LavaCharm) modPlayer.HasLavaCharm = true; } } } \ No newline at end of file diff --git a/Content/Items/Ammo/TitanicStyngerBolt.cs b/Content/Items/Ammo/TitanicStyngerBolt.cs index dca1911..6fe6b67 100644 --- a/Content/Items/Ammo/TitanicStyngerBolt.cs +++ b/Content/Items/Ammo/TitanicStyngerBolt.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Buffs.Buffs; using Decimation.Content.Items.Ores; using Decimation.Content.Tiles; using Decimation.Lib.Items; diff --git a/Content/Items/Amulets/FireAmulet.cs b/Content/Items/Amulets/FireAmulet.cs index c070366..3403dd6 100644 --- a/Content/Items/Amulets/FireAmulet.cs +++ b/Content/Items/Amulets/FireAmulet.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using Decimation.Content.Buffs.Debuffs; -using Decimation.Lib.Amulets; -using Decimation.Lib.Amulets.Synergy; using Decimation.Content.Items.Accessories; using Decimation.Content.Synergies; +using Decimation.Lib.Amulets; +using Decimation.Lib.Amulets.Synergy; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,7 +54,9 @@ namespace Decimation.Content.Items.Amulets .AddEffect("+3% melee critical strike chances") .AddEffect("+7 seconds of immunity to lava") .AddEffect("+4% chances to inflict \"Slimed!\" debuff to ennemies on strikes") - .AddSynergy("The lava charm grant an additional 5 seconds of lava immunity"); + .AddSynergy("Grants an additional 5 seconds of effect to lava immunity accessories") + .AddSynergy("Fire melee weapons inflicts \"Slimed!\" to ennemies on strikes") + .AddSynergy("The Fiery Greatsword shoots fireballs"); } } } \ No newline at end of file diff --git a/Content/NPCs/Arachnus/Arachnus.cs b/Content/NPCs/Arachnus/Arachnus.cs index 4bb06cd..58f5ea1 100644 --- a/Content/NPCs/Arachnus/Arachnus.cs +++ b/Content/NPCs/Arachnus/Arachnus.cs @@ -1,9 +1,4 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.IO; using Decimation.Content.Buffs.Debuffs; using Decimation.Content.Items.Boss.Arachnus; @@ -11,15 +6,26 @@ using Decimation.Content.Items.Misc.Souls; using Decimation.Content.Items.Weapons.Arachnus; using Decimation.Content.Projectiles; using Decimation.Content.Tiles.ShrineoftheMoltenOne; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace Decimation.Content.NPCs.Arachnus { [AutoloadBossHead] - class Arachnus : ModNPC + internal class Arachnus : ModNPC { - private int counter = 0; - private int counterMax = 1320; - private float speed = 2; + public enum ArachnusMessageType + { + RoarSound, + FlamesSound + } + + private int _counter; + private int _counterMax = 1320; + private float _speed = 2; public override void SetStaticDefaults() { @@ -56,7 +62,7 @@ namespace Decimation.Content.NPCs.Arachnus { npc.lifeMax = (int) (npc.lifeMax * 0.625f * bossLifeScale); npc.damage = (int) (npc.damage * 0.6f); - npc.defense = (int) (npc.defense + numPlayers * 2); + npc.defense = npc.defense + numPlayers * 2; } private bool CheckDispawn() @@ -83,18 +89,12 @@ namespace Decimation.Content.NPCs.Arachnus // Move Vector2 move = moveTo; float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y); - if (magnitude > speed) - { - move *= speed / magnitude; - } + if (magnitude > _speed) move *= _speed / magnitude; float turnResistance = 50f; move = (npc.velocity * turnResistance + move) / (turnResistance + 1f); magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y); - if (magnitude > speed) - { - move *= speed / magnitude; - } + if (magnitude > _speed) move *= _speed / magnitude; npc.velocity = npc.ai[1] != 99 ? move : new Vector2(0, 0); } @@ -102,25 +102,19 @@ namespace Decimation.Content.NPCs.Arachnus private bool CheckForShrine() { bool tooFarFromShrine = true; - if (counter % 60 == 0) + if (_counter % 60 == 0) { int validBlockCount = 0; for (int i = (int) (-50 + npc.Center.X / 16f); i <= (int) (50 + npc.Center.X / 16f); i++) - { - for (int j = (int) (-50 + npc.Center.Y / 16f); j <= (int) (50 + npc.Center.Y / 16f); j++) - { - if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY) - { - if (Main.tile[i, j].type == ModContent.TileType() || - (Main.tile[i, j].type == ModContent.TileType() || - Main.tile[i, j].type == ModContent.TileType() || - Main.tile[i, j].type == ModContent.TileType()) || - Main.tile[i, j].type == ModContent.TileType() || - Main.tile[i, j].type == ModContent.TileType()) - validBlockCount++; - } - } - } + for (int j = (int) (-50 + npc.Center.Y / 16f); j <= (int) (50 + npc.Center.Y / 16f); j++) + if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY) + if (Main.tile[i, j].type == ModContent.TileType() || + Main.tile[i, j].type == ModContent.TileType() || + Main.tile[i, j].type == ModContent.TileType() || + Main.tile[i, j].type == ModContent.TileType() || + Main.tile[i, j].type == ModContent.TileType() || + Main.tile[i, j].type == ModContent.TileType()) + validBlockCount++; if (validBlockCount < 15) tooFarFromShrine = true; @@ -149,43 +143,46 @@ namespace Decimation.Content.NPCs.Arachnus { npc.velocity = new Vector2(0, 10f); npc.noTileCollide = true; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } + if (npc.timeLeft > 10) npc.timeLeft = 10; } - npc.TargetClosest(true); + npc.TargetClosest(); CheckEnraged(); // Normal ai if (npc.ai[0] == 0) { - float mouthX = (float) (((npc.height) / 2) * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X; - float mouthY = (float) (((npc.height) / 2) * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y; + float mouthX = (float) (npc.height / 2 * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X; + float mouthY = (float) (npc.height / 2 * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y; //Counter - if (npc.life <= npc.lifeMax / 2) counterMax = 1500; - if (counter >= counterMax && Main.netMode != 1) + if (npc.life <= npc.lifeMax / 2) _counterMax = 1500; + if (_counter >= _counterMax && Main.netMode != 1) { - counter = 0; + _counter = 0; npc.netUpdate = true; } // Fireballs - if (counter <= 600) npc.ai[1] = 0; - else if (counter > 600 && counter < 800) npc.ai[1] = 98; + if (_counter <= 600) + { + npc.ai[1] = 0; + } + else if (_counter > 600 && _counter < 800) + { + npc.ai[1] = 98; + } // Blast of Heat - else if (counter >= 800 && counter <= 1100) + else if (_counter >= 800 && _counter <= 1100) { npc.ai[1] = 1; } // Increase speed - else if (counter > 1320 && counter <= 1500 || - (Main.expertMode && counter > 600 && counter < 800 && npc.life <= npc.lifeMax / 4)) + else if (_counter > 1320 && _counter <= 1500 || + Main.expertMode && _counter > 600 && _counter < 800 && npc.life <= npc.lifeMax / 4) { - if (counter == 1321) + if (_counter == 1321) { if (Main.netMode == NetmodeID.SinglePlayer) Main.PlaySound(SoundID.Roar, (int) npc.position.X, (int) npc.position.Y, 0); @@ -194,16 +191,19 @@ namespace Decimation.Content.NPCs.Arachnus npc.ai[1] = 2; } - else npc.ai[1] = 99; + else + { + npc.ai[1] = 99; + } - if (counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1) + if (_counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1) { float speedX = (float) (6 * Math.Cos(npc.rotation - Math.PI * 0.5f)) * 2; float speedY = (float) (6 * Math.Sin(npc.rotation - Math.PI * 0.5f)) * 2; Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY), ModContent.ProjectileType(), 30, 0f); } - else if (counter % 5 == 0 && npc.ai[1] == 1) + else if (_counter % 5 == 0 && npc.ai[1] == 1) { if (Main.netMode != 1) { @@ -212,7 +212,7 @@ namespace Decimation.Content.NPCs.Arachnus Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY), npc.ai[2] == 1 ? ModContent.ProjectileType() - : ModContent.ProjectileType(), 30, 0f, 255); + : ModContent.ProjectileType(), 30, 0f); } Main.PlaySound(SoundID.Item34, npc.position); @@ -221,21 +221,20 @@ namespace Decimation.Content.NPCs.Arachnus } else if (npc.ai[1] == 2) { - speed = 20f; + _speed = 20f; if (Main.expertMode) { - speed = (npc.lifeMax - npc.life) / 500; + _speed = (npc.lifeMax - npc.life) / 500; if (npc.ai[2] == 1) - speed += 20; + _speed += 20; } else if (npc.ai[2] == 1) - speed = 40f; + { + _speed = 40f; + } } - if (npc.ai[1] != 2) - { - speed = 2f; - } + if (npc.ai[1] != 2) _speed = 2f; // Enraged if (npc.ai[2] == 1) @@ -245,12 +244,12 @@ namespace Decimation.Content.NPCs.Arachnus if (npc.ai[1] != 2) { - speed = 6f; + _speed = 6f; npc.defense = 300; } } - counter++; + _counter++; } Move(); @@ -258,16 +257,16 @@ namespace Decimation.Content.NPCs.Arachnus public override void SendExtraAI(BinaryWriter writer) { - writer.Write(counter); - writer.Write(counterMax); - writer.Write(speed); + writer.Write(_counter); + writer.Write(_counterMax); + writer.Write(_speed); } public override void ReceiveExtraAI(BinaryReader reader) { - counter = reader.ReadInt32(); - counterMax = reader.ReadInt32(); - speed = reader.ReadSingle(); + _counter = reader.ReadInt32(); + _counterMax = reader.ReadInt32(); + _speed = reader.ReadSingle(); } private ModPacket GetPacket(ArachnusMessageType type) @@ -295,10 +294,7 @@ namespace Decimation.Content.NPCs.Arachnus public override void OnHitPlayer(Player target, int damage, bool crit) { - if (npc.ai[1] == 2 && Main.expertMode) - { - target.AddBuff(ModContent.BuffType(), 900); - } + if (npc.ai[1] == 2 && Main.expertMode) target.AddBuff(ModContent.BuffType(), 900); base.OnHitPlayer(target, damage, crit); } @@ -308,7 +304,7 @@ namespace Decimation.Content.NPCs.Arachnus npc.frameCounter += 3f; if (npc.frameCounter >= 40) npc.frameCounter = 0; - npc.frame.Y = ((int) npc.frameCounter / 10) * frameHeight; + npc.frame.Y = (int) npc.frameCounter / 10 * frameHeight; } public override void NPCLoot() @@ -369,11 +365,5 @@ namespace Decimation.Content.NPCs.Arachnus ); return false; } - - public enum ArachnusMessageType - { - RoarSound, - FlamesSound - } } } \ No newline at end of file diff --git a/Content/NPCs/LivingMagma.cs b/Content/NPCs/LivingMagma.cs index 601d5fc..141da44 100644 --- a/Content/NPCs/LivingMagma.cs +++ b/Content/NPCs/LivingMagma.cs @@ -1,4 +1,5 @@ -using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Buffs.Buffs; +using Decimation.Content.Buffs.Debuffs; using Decimation.Content.Tiles.ShrineoftheMoltenOne; using Terraria; using Terraria.ID; diff --git a/Content/Projectiles/ArachnusFireball.cs b/Content/Projectiles/ArachnusFireball.cs index c7fd61b..159d544 100644 --- a/Content/Projectiles/ArachnusFireball.cs +++ b/Content/Projectiles/ArachnusFireball.cs @@ -1,4 +1,5 @@ -using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Buffs.Buffs; +using Decimation.Content.Buffs.Debuffs; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Content/Projectiles/BloodBeam.cs b/Content/Projectiles/BloodBeam.cs index c536e9e..3286915 100644 --- a/Content/Projectiles/BloodBeam.cs +++ b/Content/Projectiles/BloodBeam.cs @@ -1,10 +1,11 @@ -using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Buffs.Buffs; using Decimation.Content.Dusts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Decimation.Content.Buffs.Debuffs; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Content/Projectiles/Ember.cs b/Content/Projectiles/Ember.cs index d6b243f..5c95745 100644 --- a/Content/Projectiles/Ember.cs +++ b/Content/Projectiles/Ember.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Decimation.Content.Buffs.Buffs; using Decimation.Content.Buffs.Debuffs; using Microsoft.Xna.Framework; diff --git a/Content/Synergies/FireAmuletSynergy.cs b/Content/Synergies/FireAmuletSynergy.cs index 3071b97..61ece36 100644 --- a/Content/Synergies/FireAmuletSynergy.cs +++ b/Content/Synergies/FireAmuletSynergy.cs @@ -1,5 +1,12 @@ -using Decimation.Lib; +using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Items.Amulets; +using Decimation.Content.Projectiles; using Decimation.Lib.Amulets.Synergy; +using Decimation.Lib.Util; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace Decimation.Content.Synergies { @@ -7,9 +14,60 @@ namespace Decimation.Content.Synergies { private const int AddedLavaTime = 500; - public override void Update(DecimationModPlayer modPlayer) + public override void Update(DecimationPlayer modPlayer) { - if (modPlayer.HasLavaCharm) modPlayer.player.lavaMax += AddedLavaTime; + if (modPlayer.player.lavaMax > 0) modPlayer.player.lavaMax += AddedLavaTime; + } + + public override void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages, + ref bool crit) + { + if (weapon.type.IsFireWeapon()) target.AddBuff(ModContent.BuffType(), 500); + } + + public override void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages, + ref bool crit) + { + if (weapon.type.IsFireWeapon()) target.AddBuff(ModContent.BuffType(), 500); + } + + private class FireAmuletSynergyFieryGreatswordEffect : GlobalItem + { + public override bool UseItem(Item item, Player player) + { + if (item.type == ItemID.FieryGreatsword && + player.HasEquippedAmulet(ModContent.ItemType())) + { + int proj = Projectile.NewProjectile(player.Center + player.Directions * new Vector2(24, -16), + player.Directions * new Vector2(6, 0), ModContent.ProjectileType(), 30, + 5f, player.whoAmI); + Main.projectile[proj].hostile = false; + Main.projectile[proj].friendly = true; + } + + return true; + } + } + + private class FireAmuletSynergyFlamarangEffect : GlobalProjectile + { + public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) + { + if (projectile.type.IsFireMeleeProjectile() && + Main.LocalPlayer.HasEquippedAmulet(ModContent.ItemType())) + { + target.AddBuff(ModContent.BuffType(), 500); + } + } + + public override void OnHitPlayer(Projectile projectile, Player target, int damage, bool crit) + { + if (projectile.type.IsFireMeleeProjectile() && + Main.LocalPlayer.HasEquippedAmulet(ModContent.ItemType())) + { + target.AddBuff(ModContent.BuffType(), 500); + } + } } } } \ No newline at end of file diff --git a/Content/Synergies/GraniteAmuletSynergy.cs b/Content/Synergies/GraniteAmuletSynergy.cs index c9ff2d0..76c475c 100644 --- a/Content/Synergies/GraniteAmuletSynergy.cs +++ b/Content/Synergies/GraniteAmuletSynergy.cs @@ -1,5 +1,4 @@ -using Decimation.Lib; -using Decimation.Lib.Amulets.Synergy; +using Decimation.Lib.Amulets.Synergy; using Microsoft.Xna.Framework; using Terraria; @@ -7,7 +6,7 @@ namespace Decimation.Content.Synergies { internal class GraniteAmuletSynergy : AmuletSynergyAdapter { - public override void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages) + public override void OnPlayerHit(DecimationPlayer modPlayer, ref int damages) { if (modPlayer.HasShield && Main.rand.NextBool(10)) { diff --git a/Content/Synergies/MarbleAmuletSynergy.cs b/Content/Synergies/MarbleAmuletSynergy.cs index 6352301..205e3cf 100644 --- a/Content/Synergies/MarbleAmuletSynergy.cs +++ b/Content/Synergies/MarbleAmuletSynergy.cs @@ -1,5 +1,4 @@ using System; -using Decimation.Lib; using Decimation.Lib.Amulets.Synergy; using Microsoft.Xna.Framework; using Terraria; @@ -9,25 +8,26 @@ namespace Decimation.Content.Synergies { internal class MarbleAmuletSynergy : AmuletSynergyAdapter { - - public override void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, + public override void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, + ref float speedY, ref int projectileType, ref int damages, ref float knockBack) { int itemType = modPlayer.player.HeldItem.type; if (Main.rand.NextBool(4)) { - if (itemType == ItemID.Javelin || itemType == ItemID.Shuriken || itemType == ItemID.ThrowingKnife || itemType == ItemID.StarAnise || itemType == ItemID.BoneJavelin || itemType == ItemID.PoisonedKnife || itemType == ItemID.FrostDaggerfish) + if (itemType == ItemID.Javelin || itemType == ItemID.Shuriken || itemType == ItemID.ThrowingKnife || + itemType == ItemID.StarAnise || itemType == ItemID.BoneJavelin || + itemType == ItemID.PoisonedKnife || itemType == ItemID.FrostDaggerfish) { // Creation of the second projectile, with 10 degrees (0.174533 rad) rotation const double angle = 0.174533d; - float x2 = (float)(Math.Cos(angle) * speedX - Math.Sin(angle) * speedY); - float y2 = (float)(Math.Sin(angle) * speedX + Math.Cos(angle) * speedY); + float x2 = (float) (Math.Cos(angle) * speedX - Math.Sin(angle) * speedY); + float y2 = (float) (Math.Sin(angle) * speedX + Math.Cos(angle) * speedY); Projectile.NewProjectile(position, new Vector2(x2, y2), projectileType, damages, knockBack); } } } - } -} +} \ No newline at end of file diff --git a/Content/Tiles/ShrineoftheMoltenOne/RedHotSpike.cs b/Content/Tiles/ShrineoftheMoltenOne/RedHotSpike.cs index fccf9b9..fe43174 100644 --- a/Content/Tiles/ShrineoftheMoltenOne/RedHotSpike.cs +++ b/Content/Tiles/ShrineoftheMoltenOne/RedHotSpike.cs @@ -1,4 +1,5 @@ -using Decimation.Content.Buffs.Debuffs; +using Decimation.Content.Buffs.Buffs; +using Decimation.Content.Buffs.Debuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Lib/Amulets/AmuletTooltip.cs b/Lib/Amulets/AmuletTooltip.cs index 1ed4654..ff0ab5a 100644 --- a/Lib/Amulets/AmuletTooltip.cs +++ b/Lib/Amulets/AmuletTooltip.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria.ModLoader; using Terraria.UI.Chat; @@ -15,13 +14,12 @@ namespace Decimation.Lib.Amulets private readonly Color _synergyColor = Color.CadetBlue; private int _effectCount; - private bool _hasSynergy; public AmuletTooltip(Mod mod, Amulet amulet) { _mod = mod; _amulet = amulet; - this.Lines = new List(); + Lines = new List(); SetClassTooltip(); } @@ -30,7 +28,7 @@ namespace Decimation.Lib.Amulets private void SetClassTooltip() { - this.Lines.Add(new TooltipLine(_mod, "DecimationAmuletClass", _amulet.AmuletClass.ToString("F")) + Lines.Add(new TooltipLine(_mod, "DecimationAmuletClass", _amulet.AmuletClass.ToString("F")) { overrideColor = _classColor }); @@ -38,7 +36,7 @@ namespace Decimation.Lib.Amulets public AmuletTooltip AddEffect(string tooltip) { - this.Lines.Add(new TooltipLine(_mod, $"Effect{_effectCount}", tooltip) + Lines.Add(new TooltipLine(_mod, $"Effect{_effectCount}", tooltip) { overrideColor = _effectColor }); @@ -49,19 +47,10 @@ namespace Decimation.Lib.Amulets public AmuletTooltip AddSynergy(string tooltip) { - if (!_hasSynergy) + Lines.Add(new TooltipLine(_mod, "Synergy", tooltip) { - this.Lines.Add(new TooltipLine(_mod, "Synergy", tooltip) - { - overrideColor = _synergyColor - }); - - _hasSynergy = true; - } - else - { - throw new InvalidOperationException($"Can't add more than one synergy tooltip to {_amulet.Name}"); - } + overrideColor = _synergyColor + }); return this; } diff --git a/Lib/Amulets/Synergy/AmuletSynergyAdapter.cs b/Lib/Amulets/Synergy/AmuletSynergyAdapter.cs index 41c87b6..247856c 100644 --- a/Lib/Amulets/Synergy/AmuletSynergyAdapter.cs +++ b/Lib/Amulets/Synergy/AmuletSynergyAdapter.cs @@ -1,27 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Decimation.Content; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; namespace Decimation.Lib.Amulets.Synergy { public class AmuletSynergyAdapter : IAmuletsSynergy { - public virtual void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages) + public virtual void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages, ref bool crit) { } - public virtual void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, + public virtual void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages, + ref bool crit) + { + } + + public virtual void OnPlayerHit(DecimationPlayer modPlayer, ref int damages) + { + } + + public virtual void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, + ref float speedY, ref int projectileType, ref int damages, ref float knockBack) { } - public virtual void Update(DecimationModPlayer modPlayer) + public virtual void Update(DecimationPlayer modPlayer) { } } -} +} \ No newline at end of file diff --git a/Lib/Amulets/Synergy/IAmuletsSynergy.cs b/Lib/Amulets/Synergy/IAmuletsSynergy.cs index 27b5328..5448d3c 100644 --- a/Lib/Amulets/Synergy/IAmuletsSynergy.cs +++ b/Lib/Amulets/Synergy/IAmuletsSynergy.cs @@ -1,14 +1,15 @@ -using Microsoft.Xna.Framework; +using Decimation.Content; +using Microsoft.Xna.Framework; using Terraria; namespace Decimation.Lib.Amulets.Synergy { public interface IAmuletsSynergy { - void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages); - - void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int projectileType, ref int damages, ref float knockBack); - - void Update(DecimationModPlayer modPlayer); + void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages, ref bool crit); + void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages, ref bool crit); + void OnPlayerHit(DecimationPlayer modPlayer, ref int damages); + void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int projectileType, ref int damages, ref float knockBack); + void Update(DecimationPlayer modPlayer); } } diff --git a/Content/Buffs/DecimationBuff.cs b/Lib/Buffs/DecimationBuff.cs similarity index 95% rename from Content/Buffs/DecimationBuff.cs rename to Lib/Buffs/DecimationBuff.cs index 9fbb1e9..f50b7d4 100644 --- a/Content/Buffs/DecimationBuff.cs +++ b/Lib/Buffs/DecimationBuff.cs @@ -1,7 +1,7 @@ using Terraria.ModLoader; using Terraria; -namespace Decimation.Content.Buffs +namespace Decimation.Lib.Buffs { internal abstract class DecimationBuff : ModBuff { diff --git a/Lib/DecimationPlayer.cs b/Lib/DecimationPlayer.cs deleted file mode 100644 index a339fd0..0000000 --- a/Lib/DecimationPlayer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using Decimation.Lib.Items; -using Decimation.Lib.Util; -using Terraria.ModLoader; - -namespace Decimation.Lib -{ - public abstract class DecimationModPlayer : ModPlayer, IDecimationPlayer - { - public abstract bool HasLavaCharm { get; set; } - public abstract bool HasShield { get; set; } - - } -} \ No newline at end of file diff --git a/Lib/IDecimationPlayer.cs b/Lib/IDecimationPlayer.cs deleted file mode 100644 index ac5bcba..0000000 --- a/Lib/IDecimationPlayer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Terraria.ModLoader; - -namespace Decimation.Lib -{ - public interface IDecimationPlayer - { - - bool HasLavaCharm { get; } - bool HasShield { get; } - - } -} diff --git a/Lib/Util/PlayerUtils.cs b/Lib/Util/PlayerUtils.cs index b59b2fd..a05bc43 100644 --- a/Lib/Util/PlayerUtils.cs +++ b/Lib/Util/PlayerUtils.cs @@ -20,5 +20,10 @@ namespace Decimation.Lib.Util { return player.GetModPlayer().EquippedAccessories.Contains(accessoryType); } + + public static bool HasEquippedAmulet(this Player player, int amuletType) + { + return player.GetModPlayer().AmuletSlotItem.type == amuletType; + } } } \ No newline at end of file diff --git a/Lib/Util/WeaponUtils.cs b/Lib/Util/WeaponUtils.cs new file mode 100644 index 0000000..39050cb --- /dev/null +++ b/Lib/Util/WeaponUtils.cs @@ -0,0 +1,35 @@ +using System.Linq; +using Terraria.ID; + +namespace Decimation.Lib.Util +{ + public static class WeaponUtils + { + private static readonly int[] FireWeapons = + { + ItemID.FieryGreatsword, + ItemID.SolarFlarePickaxe, + ItemID.MoltenHamaxe, + ItemID.Sunfury, + ItemID.SolarEruption, + ItemID.SolarFlareHammer, + ItemID.HelFire, + ItemID.MoltenPickaxe + }; + + private static readonly int[] FireMeleeProjectiles = + { + ProjectileID.Flamarang + }; + + public static bool IsFireWeapon(this int itemType) + { + return FireWeapons.Contains(itemType); + } + + public static bool IsFireMeleeProjectile(this int projectileType) + { + return FireMeleeProjectiles.Contains(projectileType); + } + } +} \ No newline at end of file