diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 914f232d59..733b28540c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -407,6 +407,7 @@ namespace CalamityMod.CalPlayer public int plaguedFuelPackDash = 0; public int plaguedFuelPackDirection = 0; public bool veneratedLocket = false; + public bool camper = false; // Armor Set public bool victideSet = false; @@ -1246,6 +1247,7 @@ namespace CalamityMod.CalPlayer sandCloak = false; spectralVeil = false; plaguedFuelPack = false; + camper = false; alcoholPoisoning = false; shadowflame = false; @@ -2334,7 +2336,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 300); } } - if (sulfurSet && player.controlJump && player.justJumped && player.jumpAgainSandstorm) + if ((sulfurSet || camper) && player.controlJump && player.justJumped && player.jumpAgainSandstorm) { Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(Main.LocalPlayer.allDamage + (Main.LocalPlayer.Calamity().throwingDamage / 2f)), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); } @@ -5305,6 +5307,46 @@ namespace CalamityMod.CalPlayer } #endregion + #region Can Hit + + public override bool? CanHitNPC(Item item, NPC target) + { + bool notMoving = (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05; + if (camper && !notMoving) + { + target.chaseable = false; + target.dontTakeDamage = true; + player.MinionAttackTargetNPC = -1; + return false; + } + return null; + } + + public override bool? CanHitNPCWithProj(Projectile proj, NPC target) + { + bool notMoving = (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05; + if (camper && !notMoving) + { + target.chaseable = false; + target.dontTakeDamage = true; + player.MinionAttackTargetNPC = -1; + return false; + } + return null; + } + + public override bool CanHitPvp(Item item, Player target) + { + return !(camper && !((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05)); + } + + public override bool CanHitPvpWithProj(Projectile proj, Player target) + { + return !(camper && !((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05)); + } + + #endregion + #region Fishing public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 7fd16481c8..93503db606 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -578,6 +578,10 @@ namespace CalamityMod.CalPlayer player.lifeRegenTime += 8; player.lifeRegen += 16; } + if (modPlayer.camper) + { + player.lifeRegen += 2; + } if (modPlayer.bloodflareSummon) { @@ -758,13 +762,33 @@ namespace CalamityMod.CalPlayer } } } + else if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife) + { + player.lifeRegen = (int)((player.lifeRegen * 2) * 1.75f); + player.lifeRegenCount = player.lifeRegenCount > 30 ? player.lifeRegenCount : 30; + player.lifeRegenCount++; + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } } if (CalamityWorld.revenge) { if (player.statLife < modPlayer.actualMaxLife) { - bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis) && + bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0; if (!noLifeRegenCap) diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs new file mode 100644 index 0000000000..845ced1e99 --- /dev/null +++ b/Items/Accessories/TheCamper.cs @@ -0,0 +1,131 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + //Dedicated to Dzicozan + class TheCamper : ModItem + { + int auraCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Camper"); + Tooltip.SetDefault("You deal no damage unless stationary\n" + + "Standing still grants buff(s) dependant on what weapon you're holding\n" + + "Standing still provides a damaging aura around you\n" + + "While moving, you regenerate health as if standing still\n" + + "In rest may we find victory."); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 16, 0, 0); + item.rare = 9; + item.accessory = true; + item.defense = 10; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.camper = true; + player.AddBuff(BuffID.HeartLamp, 60, true); + player.AddBuff(BuffID.Campfire, 60, true); + player.AddBuff(BuffID.WellFed, 60, true); + player.lifeRegen += 2; + Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); + if (Main.myPlayer == player.whoAmI) + { + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05) + { + player.allDamage += 0.1f; + auraCounter++; + float range = 200f; + if (auraCounter == 9) + { + auraCounter = 0; + for (int i = 0; i < 200; i++) + { + NPC npc = Main.npc[i]; + if (npc.active && !npc.friendly && npc.damage > -1 && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range) + { + npc.StrikeNPC((int) (Main.rand.Next(30, 51) * player.allDamage), 0, 0, false, false); + if (!npc.buffImmune[BuffID.Burning]) + { + npc.AddBuff(BuffID.Burning, 120); + } + } + } + } + if (player.HeldItem != null && player.HeldItem.stack > 0) + { + bool summon = player.HeldItem.summon; + bool rogue = player.HeldItem.Calamity().rogue; + bool melee = player.HeldItem.melee; + bool ranged = player.HeldItem.ranged; + bool magic = player.HeldItem.magic; + if (summon) + { + player.minionDamage += 0.15f; + player.AddBuff(BuffID.Bewitched, 60, true); + } + else if (rogue) + { + modPlayer.throwingDamage += 0.15f; + modPlayer.throwingVelocity += 0.10f; + modPlayer.throwingCrit += 5; + } + else if (melee) + { + player.meleeDamage += 0.15f; + player.meleeCrit += 5; + player.meleeSpeed += 0.10f; + player.AddBuff(BuffID.Sharpened, 60, true); + } + else if (ranged) + { + player.rangedDamage += 0.15f; + player.rangedCrit += 5; + player.ammoBox = true; + } + else if (magic) + { + player.magicDamage += 0.15f; + player.magicCrit += 5; + player.AddBuff(BuffID.Clairvoyance, 60, true); + } + } + } + else + { + auraCounter = 0; + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Campfire, 10); + recipe.AddIngredient(ItemID.HeartLantern, 5); + recipe.AddRecipeGroup("AnyFood", 50); + recipe.AddIngredient(ItemID.ShinyStone); + recipe.AddIngredient(ItemID.SharpeningStation); + recipe.AddIngredient(ItemID.CrystalBall); + recipe.AddIngredient(ItemID.AmmoBox); + recipe.AddIngredient(ItemID.BewitchingTable); + + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + + } + } +} diff --git a/Items/Accessories/TheCamper.png b/Items/Accessories/TheCamper.png new file mode 100644 index 0000000000..01c6458dee Binary files /dev/null and b/Items/Accessories/TheCamper.png differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 698401fefb..bea41f38fd 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; using System.Collections.Generic; using System.Linq; @@ -769,7 +770,7 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyGoldBar", group); - group = new RecipeGroup(() => "AnyEvilOre", new int[] + group = new RecipeGroup(() => "Any Evil Ore", new int[] { ItemID.CrimtaneOre, ItemID.DemoniteOre @@ -872,6 +873,27 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("LunarHamaxe", group); + group = new RecipeGroup(() => "Any Food Item", new int[] + { + ItemID.CookedFish, + ItemID.CookedMarshmallow, + ItemID.PadThai, + ItemID.Pho, + ItemID.CookedShrimp, + ItemID.Sashimi, + ItemID.Bacon, + ItemID.BowlofSoup, + ItemID.GrubSoup, + ItemID.GingerbreadCookie, + ItemID.SugarCookie, + ItemID.ChristmasPudding, + ItemID.PumpkinPie, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + RecipeGroup.RegisterGroup("AnyFood", group); + group = new RecipeGroup(() => "Any Wings", new int[] { ItemID.DemonWings,