diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs new file mode 100644 index 0000000000..0e89d7656b --- /dev/null +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class KamiBuff : ModBuff + { + public const float RunSpeedBoost = 0.2f; + public const float RunAccelerationBoost = 0.4f; + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Injection"); + Description.SetDefault("Increased defense, movement speed, and damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().kamiBoost = true; + } + } +} diff --git a/Buffs/StatBuffs/KamiBuff.png b/Buffs/StatBuffs/KamiBuff.png new file mode 100644 index 0000000000..4fdc0fff94 Binary files /dev/null and b/Buffs/StatBuffs/KamiBuff.png differ diff --git a/Buffs/StatDebuffs/KamiDebuff.cs b/Buffs/StatDebuffs/KamiDebuff.cs new file mode 100644 index 0000000000..d554fa2441 --- /dev/null +++ b/Buffs/StatDebuffs/KamiDebuff.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class KamiDebuff : ModBuff + { + public const float MultiplicativeDamageReduction = 0.8f; + public const float MaxNPCSpeed = 16f; // Hard-cap for npc speed when afflicted with this debuff. Does not affect certain NPCs and does not affect any bosses (Basically only works on boss minions). + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Flu"); + Description.SetDefault("Defenseless and dying"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) + npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().teslaFreeze = true; + } + } +} diff --git a/Buffs/StatDebuffs/KamiDebuff.png b/Buffs/StatDebuffs/KamiDebuff.png new file mode 100644 index 0000000000..df7af84f98 Binary files /dev/null and b/Buffs/StatDebuffs/KamiDebuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index bd373dc77c..a07cf598d3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -109,6 +109,9 @@ namespace CalamityMod.CalPlayer public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; public int waterLeechTarget = -1; + public float KameiTrailXScale = 0.1f; + public int KameiBladeUseDelay = 0; + public Vector2[] KameiOldPositions = new Vector2[4]; public double trueMeleeDamage = 0D; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; @@ -479,6 +482,7 @@ namespace CalamityMod.CalPlayer public bool depthCharm = false; public bool anechoicPlating = false; public bool jellyfishNecklace = false; + public bool abyssDivingGear = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; public bool reaperToothNecklace = false; @@ -813,6 +817,7 @@ namespace CalamityMod.CalPlayer public bool hallowedDefense = false; public bool hallowedPower = false; public bool hallowedRegen = false; + public bool kamiBoost = false; #endregion #region Minion @@ -1552,6 +1557,7 @@ namespace CalamityMod.CalPlayer hallowedDefense = false; hallowedRegen = false; hallowedPower = false; + kamiBoost = false; IBoots = false; elysianFire = false; sTracers = false; @@ -1594,6 +1600,7 @@ namespace CalamityMod.CalPlayer depthCharm = false; anechoicPlating = false; jellyfishNecklace = false; + abyssDivingGear = false; abyssalAmulet = false; lumenousAmulet = false; reaperToothNecklace = false; @@ -2072,6 +2079,7 @@ namespace CalamityMod.CalPlayer rRage = false; xRage = false; xWrath = false; + kamiBoost = false; graxDefense = false; encased = false; sMeleeBoost = false; @@ -2260,6 +2268,7 @@ namespace CalamityMod.CalPlayer elysianGuard = false; #endregion + KameiBladeUseDelay = 0; lastProjectileHit = null; brimlashBusterBoost = false; @@ -3275,6 +3284,10 @@ namespace CalamityMod.CalPlayer profanedCrystalHide = false; profanedCrystalForce = true; } + else if (item.type == ModContent.ItemType()) + { + abyssDivingGear = true; + } } } @@ -3591,6 +3604,7 @@ namespace CalamityMod.CalPlayer ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + @@ -3610,6 +3624,7 @@ namespace CalamityMod.CalPlayer (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (etherealExtorter && player.ZoneBeach ? 0.05f : 0f) + (stressPills ? 0.05f : 0f) + (laudanum && horror ? 0.1f : 0f) + @@ -3691,7 +3706,6 @@ namespace CalamityMod.CalPlayer } #endregion } - #endregion #region Rogue Mirrors @@ -3718,6 +3732,11 @@ namespace CalamityMod.CalPlayer Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); } + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } @@ -3738,6 +3757,11 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Item68, Main.player[Main.myPlayer].position); int eclipseBurst = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(7000 * player.RogueDamage()), 0, player.whoAmI); + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } #endregion @@ -6950,92 +6974,102 @@ namespace CalamityMod.CalPlayer } #endregion - #region Frame Effects - public override void FrameEffects() - { - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || - player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) - { - player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. - } - else if (snowRuffianSet) - { - player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); - bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; - if (player.controlJump && falling) - { - player.velocity.Y *= 0.9f; - player.wingFrame = 3; + #region Frame Effects + public override void FrameEffects() + { + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + } + else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) + { + player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); + player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); + player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); + player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); + player.face = -1; + + bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + + if (profanedCrystalWingCounter.Value == 0) + { + int key = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); + } + + player.wingFrame = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); + player.armorEffectDrawOutlines = true; + if (profanedCrystalBuffs) + { + player.armorEffectDrawShadow = true; + if (enrage) + { + player.armorEffectDrawOutlinesForbidden = true; + } + } + } + else if ((snowmanPower || snowmanForce) && !snowmanHide) + { + player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); + player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); + player.face = -1; + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + player.face = -1; + } + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) + { + player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); + player.face = -1; + } + else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) + { + player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); + player.face = -1; + } + else + { + if (profanedCrystalWingCounter.Key != 1) + profanedCrystalWingCounter = new KeyValuePair(1, 7); + if (profanedCrystalAnimCounter.Key != 0) + profanedCrystalAnimCounter = new KeyValuePair(0, 10); + } + if (snowRuffianSet) + { + player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); + bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; + if (player.controlJump && falling) + { + player.velocity.Y *= 0.9f; + player.wingFrame = 3; player.noFallDmg = true; player.fallStart = (int)(player.position.Y / 16f); - } - } - else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) - { - player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); - player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); - player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); - player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); + } + } + if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + { + player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); + player.face = -1; + } - bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + if (CalamityWorld.defiled) + Defiled(); - if (profanedCrystalWingCounter.Value == 0) - { - int key = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); - } - - player.wingFrame = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); - player.armorEffectDrawOutlines = true; - if (profanedCrystalBuffs) - { - player.armorEffectDrawShadow = true; - if (enrage) - { - player.armorEffectDrawOutlinesForbidden = true; - } - } - } - else if ((snowmanPower || snowmanForce) && !snowmanHide) - { - player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); - player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - } - else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) - { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - } - else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) - { - player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); - } - else - { - if (profanedCrystalWingCounter.Key != 1) - profanedCrystalWingCounter = new KeyValuePair(1, 7); - if (profanedCrystalAnimCounter.Key != 0) - profanedCrystalAnimCounter = new KeyValuePair(0, 10); - } - - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - } - #endregion + if (weakPetrification) + WeakPetrification(); + } + #endregion #region Limitations private void WeakPetrification() @@ -8311,11 +8345,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0) { - NPC nPC = Main.npc[i]; Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { OnDodge(); break; @@ -8324,9 +8358,9 @@ namespace CalamityMod.CalPlayer } for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + Projectile proj = Main.projectile[i]; + if (proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { - Projectile proj = Main.projectile[i]; Rectangle rect = proj.getRect(); if (rectangle.Intersects(rect)) { @@ -9319,10 +9353,40 @@ namespace CalamityMod.CalPlayer { if (drawInfo.shadow != 0f) return; - Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); + // Kamei trail/afterimage effect. + if (drawPlayer.Calamity().kamiBoost) + { + for (int i = drawPlayer.Calamity().KameiOldPositions.Length - 1; i > 0; i--) + { + if (drawPlayer.Calamity().KameiOldPositions[i - 1] == Vector2.Zero) + drawPlayer.Calamity().KameiOldPositions[i - 1] = drawPlayer.position; + drawPlayer.Calamity().KameiOldPositions[i] = drawPlayer.Calamity().KameiOldPositions[i - 1]; + } + drawPlayer.Calamity().KameiOldPositions[0] = drawPlayer.position; + + List existingDrawData = Main.playerDrawData; + for (int i = 0; i < drawPlayer.Calamity().KameiOldPositions.Length; i++) + { + float scale = MathHelper.Lerp(1f, 0.5f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + float opacity = MathHelper.Lerp(0.25f, 0.08f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + List afterimage = new List(); + for (int j = 0; j < existingDrawData.Count; j++) + { + var drawData = existingDrawData[j]; + drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; + drawData.color = Color.Cyan * opacity; + drawData.color.G = (byte)(drawData.color.G * 1.6); + drawData.color.B = (byte)(drawData.color.B * 1.2); + drawData.scale = new Vector2(scale); + afterimage.Add(drawData); + } + Main.playerDrawData.InsertRange(0, afterimage); + } + } + if (!drawPlayer.frozen && item.type > ItemID.None && !drawPlayer.dead && @@ -9482,6 +9546,7 @@ namespace CalamityMod.CalPlayer } } }); + public static readonly PlayerLayer DyeInvisibilityFix = new PlayerLayer("CalamityMod", "DyeInvisibilityFix", PlayerLayer.Arms, (PlayerDrawInfo drawInfo) => { Player drawPlayer = drawInfo.drawPlayer; @@ -9498,6 +9563,7 @@ namespace CalamityMod.CalPlayer Main.playerDrawData[i] = copy; } }); + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -9898,8 +9964,8 @@ namespace CalamityMod.CalPlayer public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { - // Dust modifications while high - if (trippy) + // Dust modifications while high + if (trippy) { if (Main.myPlayer == player.whoAmI) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e3ac3a4b21..f17d62bf3e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -340,8 +340,8 @@ namespace CalamityMod.CalPlayer { player.Calamity().andromedaState = AndromedaPlayerState.Inactive; } - - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + + if(player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { player.width = 80; player.height = 212; @@ -906,6 +906,8 @@ namespace CalamityMod.CalPlayer // Cooldowns and timers if (modPlayer.gainRageCooldown > 0) modPlayer.gainRageCooldown--; + if (modPlayer.KameiBladeUseDelay > 0) + modPlayer.KameiBladeUseDelay--; if (modPlayer.galileoCooldown > 0) modPlayer.galileoCooldown--; if (modPlayer.soundCooldown > 0) @@ -1142,8 +1144,14 @@ namespace CalamityMod.CalPlayer player.endurance += 0.07f; } - // Absorber bonus - if (modPlayer.absorber) + if (modPlayer.kamiBoost) + { + player.allDamage += 0.3f; + player.statDefense += 20; + } + + // Absorber bonus + if (modPlayer.absorber) { player.moveSpeed += 0.12f; player.jumpSpeedBoost += 1.2f; @@ -3858,7 +3866,7 @@ namespace CalamityMod.CalPlayer #region Rogue Mirrors private static void RogueMirrors(Player player, CalamityPlayer modPlayer) { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; diff --git a/CalamityMod.cs b/CalamityMod.cs index 0c8bf8ab7f..62893efb63 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -207,6 +207,7 @@ namespace CalamityMod public static List angryBonesList; public static List hornetList; public static List mossHornetList; + public static List bossMinionList; public static List legOverrideList; @@ -286,6 +287,8 @@ namespace CalamityMod AddEquipTexture(new SnowRuffianWings(), null, EquipType.Wings, "SnowRuffWings", "CalamityMod/Items/Armor/SnowRuffianWings"); + AddEquipTexture(new AbyssDivingGearHair(), null, EquipType.Head, "AbyssDivingGearHead", "CalamityMod/Items/Accessories/AbyssalDivingGear_Face"); + AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); @@ -434,6 +437,7 @@ namespace CalamityMod angryBonesList = null; hornetList = null; mossHornetList = null; + bossMinionList = null; legOverrideList = null; @@ -732,7 +736,10 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), // Because of potential dust lag. + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() @@ -2595,6 +2602,107 @@ namespace CalamityMod NPCID.GiantMossHornet }; + bossMinionList = new List() + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SlimeSpiked, + NPCID.ServantofCthulhu, + ModContent.NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SkeletronHand, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice, + ModContent.NPCType(), + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PlanterasTentacle, + ModContent.NPCType(), + NPCID.Spore, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordFreeEye, + NPCID.MoonLordHand, + NPCID.MoonLordHead, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; + Mod thorium = ModLoader.GetMod("ThoriumMod"); if (CalamityConfig.Instance.BuffThoriumBosses && thorium != null) { diff --git a/ExtraTextures/Lasers/UltimaRayEnd.png b/ExtraTextures/Lasers/UltimaRayEnd.png new file mode 100644 index 0000000000..26fefb2eb4 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayEnd.png differ diff --git a/ExtraTextures/Lasers/UltimaRayMid.png b/ExtraTextures/Lasers/UltimaRayMid.png new file mode 100644 index 0000000000..9a13aa9d6b Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayMid.png differ diff --git a/ExtraTextures/Lasers/UltimaRayStart.png b/ExtraTextures/Lasers/UltimaRayStart.png new file mode 100644 index 0000000000..6ebfb4d0e7 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayStart.png differ diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index a5ca41427f..202b02f1b9 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -6,54 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(EquipType.Face)] - public class AbyssalDivingGear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Diving Gear"); - Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + - "Removes the bleed effect caused by the abyss\n" + - "Grants the ability to swim and greatly extends underwater breathing\n" + - "Provides light underwater and extra mobility on ice\n" + - "Provides a moderate amount of light in the abyss\n" + - "Greatly reduces breath loss in the abyss"); - } + //[AutoloadEquip(EquipType.Face)] + public class AbyssalDivingGear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Diving Gear"); + Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + + "Removes the bleed effect caused by the abyss\n" + + "Grants the ability to swim and greatly extends underwater breathing\n" + + "Provides light underwater and extra mobility on ice\n" + + "Provides a moderate amount of light in the abyss\n" + + "Greatly reduces breath loss in the abyss"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.depthCharm = true; - modPlayer.jellyfishNecklace = true; - player.arcticDivingGear = true; - player.accFlipper = true; - player.accDivingHelm = true; - player.iceSkate = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + if (!hideVisual) + modPlayer.abyssDivingGear = true; //this bool is just used for drawing + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ArcticDivingGear); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void UpdateVanity(Player player, EquipType type) + { + player.Calamity().abyssDivingGear = true; //this bool is just used for drawing + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ArcticDivingGear); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + public class AbyssDivingGearHair : EquipTexture + { + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = false; + drawAltHair = false; + } + } } diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index 725d3ce13d..c00a8083ea 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + - "However, without the Well Fed buff your stats will decrease due to your insatiable hunger."); + "However, without the Well Fed buff your stats will decrease due to your insatiable hunger.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -31,11 +32,12 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aquaticScourgeLore = true; - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (item.favorited) + modPlayer.aquaticScourgeLore = true; + } public override void AddRecipes() { diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 5e7fd29484..73f24ba78b 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Aureus"); Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + "The destruction of this creature will not prevent the spread of the disease.\n" + - "Place in your inventory to gain 10% increased jump speed in space."); + "Place in your inventory to gain 10% increased jump speed in space.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumAureusLore = true; + if (item.favorited) + modPlayer.astrumAureusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index e892c5c7e8..a8b5376105 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Deus"); Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Place in your inventory to gain increased movement speed in space."); + "Place in your inventory to gain increased movement speed in space.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumDeusLore = true; + if (item.favorited) + modPlayer.astrumDeusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index 4e6a899dbb..e5f11cc641 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Most likely another abomination spawned from this inchoate mass of flesh.\n" + "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it.\n" + "Teleportation is disabled while Chaos State is active.\n" + - "However, you become confused for a few seconds after you use it due to your overwhelming brain power."); + "However, you become confused for a few seconds after you use it due to your overwhelming brain power.\n" + + "Teleportation only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override bool CanUseItem(Player player) { - return player.ZoneCrimson; + return player.ZoneCrimson && item.favorited; } public override bool UseItem(Player player) diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index 336c1e75a2..d9a666e5d1 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Brimstone Elemental"); Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Place in your inventory to improve the inferno potion effect."); + "Place in your inventory to improve the inferno potion effect.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneElementalLore = true; + if (item.favorited) + modPlayer.brimstoneElementalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index a4f20b294d..d2cddd9d9c 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + "Now that you have defeated her your destiny is clear.\n" + "Come now, face me.\n" + - "Place in your inventory to die instantly from every hit."); + "Place in your inventory to die instantly from every hit.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.SCalLore = true; + if (item.favorited) + modPlayer.SCalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 57bf38da6e..1b2116ca4e 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + "It's interesting how creatures can adapt given certain circumstances.\n" + "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome.\n" + - "However, your movement speed will be decreased while in these areas due to you being covered in fungi."); + "However, your movement speed will be decreased while in these areas due to you being covered in fungi.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.crabulonLore = true; + if (item.favorited) + modPlayer.crabulonLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 184c4b9776..16b985b6f8 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Cryogen"); Tooltip.SetDefault("The archmage's prison.\n" + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); + "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dashMod = 6; + if (item.favorited) + modPlayer.dashMod = 6; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index 082f206049..a631c734fa 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + "gluttonous husk, constantly on a voracious search for its next meal.\n" + "Place in your inventory for an increase to defense while in the desert or sunken sea.\n" + - "However, you will deal decreased damage while in these areas due to being a husk of your former self."); + "However, you will deal decreased damage while in these areas due to being a husk of your former self.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().desertScourgeLore = true; + if (item.favorited) + player.Calamity().desertScourgeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index 55303b8bff..5c3141b702 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + "Place in your inventory to gain a boost to your pick speed.\n" + - "However, your max acceleration is decreased slightly due to you feeling heavier."); + "However, your max acceleration is decreased slightly due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.destroyerLore = true; + if (item.favorited) + modPlayer.destroyerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index c7b2f2d492..3cf2fa69fd 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + "Place in your inventory to boost the power of your true melee strikes by 25%.\n" + - "However, due to your reckless nature you will take increased damage."); + "However, due to your reckless nature you will take increased damage.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.DoGLore = true; + if (item.favorited) + modPlayer.DoGLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index 516bd28ad7..fdc59c60bd 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + "Place in your inventory for an increase to all damage, crit and movement speed while submerged in liquid.\n" + - "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out."); + "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dukeFishronLore = true; + if (item.favorited) + modPlayer.dukeFishronLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 40a7adf76f..83269fc9a3 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + "Seems likely, given the origins of this place.\n" + "Deadly microbes spawn around you while this is placed in your inventory.\n" + - "However, you will have decreased life regen due to your skin rotting off."); + "However, you will have decreased life regen due to your skin rotting off.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eaterOfWorldsLore = true; + if (item.favorited) + modPlayer.eaterOfWorldsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 61a1a60a44..086355307c 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("That eye...how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger.\n" + "Place in your inventory for night vision at night.\n" + - "However, your vision is reduced during the day."); + "However, your vision is reduced during the day.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -31,10 +32,13 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (!Main.dayTime) - player.nightVision = true; - else - player.blind = true; + if (item.favorited) + { + if (!Main.dayTime) + player.nightVision = true; + else + player.blind = true; + } } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index 4fc871658b..d661b84483 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Golem"); Tooltip.SetDefault("A primitive construct.\n" + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Place in your inventory to gain increased defense while standing still."); + "Place in your inventory to gain increased defense while standing still.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.golemLore = true; + if (item.favorited) + modPlayer.golemLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 2d7b59c989..9ad9b6dbd9 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + "I do not believe killing it will lessen the corruption here.\n" + "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption.\n" + - "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor."); + "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCorrupt) + if (player.ZoneCorrupt && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.hiveMindLore = true; diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 24ee891577..ae7ca88231 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + "Unfortunately, our world has no shortage of those.\n" + "Place in your inventory to gain 5% increased movement speed and 2% increased jump speed.\n" + - "However, your defense is reduced by 3 due to your gelatinous body."); + "However, your defense is reduced by 3 due to your gelatinous body.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -46,7 +47,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().kingSlimeLore = true; + if (item.favorited) + player.Calamity().kingSlimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index b0207cd611..e95bef421f 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.LoreItems "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + "Allows the young siren pet to move normally while outside of liquids.\n" + - "However, if you're not submerged in liquid you will have decreased defense and damage reduction."); + "However, if you're not submerged in liquid you will have decreased defense and damage reduction.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.leviathanAndSirenLore = true; + if (item.favorited) + modPlayer.leviathanAndSirenLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 85eefb0946..4ddea4544f 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + "Your impending doom approaches...\n" + "Place in your inventory for an increase to all stats during the lunar event.\n" + - "However, your vision is decreased due to eldritch knowledge damaging your mind."); + "However, your vision is decreased due to eldritch knowledge damaging your mind.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (NPC.LunarApocalypseIsUp) + if (NPC.LunarApocalypseIsUp && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.lunaticCultistLore = true; diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index de993228b6..6d023e3fcb 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + - "However, while not upside down you have permanent featherfall."); + "However, while not upside down you have permanent featherfall.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.moonLordLore = true; + if (item.favorited) + modPlayer.moonLordLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 78a1498a80..6df689a8c1 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Old Duke"); Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + "Perhaps I was mistaken to classify the creature from its relation to pigrons alone.\n" + - "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects."); + "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.boomerDukeLore = true; + if (item.favorited) + modPlayer.boomerDukeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index aed58f7645..53dbe77a77 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Perforators and their Hive"); Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + "Place in your inventory for all of your projectiles to inflict ichor when in the crimson.\n" + - "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus."); + "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCrimson) + if (player.ZoneCrimson && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.perforatorLore = true; diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 54bc9ee369..4f88bf176c 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Plaguebringer Goliath"); Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen."); + "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.plaguebringerGoliathLore = true; + if (item.favorited) + modPlayer.plaguebringerGoliathLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index b5a07a9743..7c71900847 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + "I wish you luck in dealing with the fallout.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.planteraLore = true; + if (item.favorited) + modPlayer.planteraLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 80488cdddb..acce6e2081 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Polterghast"); Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.polterghastLore = true; + if (item.favorited) + modPlayer.polterghastLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 4c6d5cb9e0..16183e5179 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + - "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames."); + "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.providenceLore = true; + if (item.favorited) + modPlayer.providenceLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index f4ed7c5ed5..b91706e5ae 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Queen Bee"); Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Place in your inventory to make small bees and weak hornets friendly."); + "Place in your inventory to make small bees and weak hornets friendly.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -31,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.queenBeeLore = true; + if (item.favorited) + modPlayer.queenBeeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 8a2b2fc156..461310f14d 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Ravager"); Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time."); + "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ravagerLore = true; + if (item.favorited) + modPlayer.ravagerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 81a3cf3fdc..8f54da002b 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + "Place in your inventory to gain increased damage while in the dungeon.\n" + - "However, your max health is decreased due to Skeletron's curse."); + "However, your max health is decreased due to Skeletron's curse.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneDungeon) + if (player.ZoneDungeon && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.skeletronLore = true; diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index bbb95cff60..22239ad9f4 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + "Draedon obviously took several liberties with its design...I am not impressed.\n" + "Place in your inventory to gain a boost to your armor penetration.\n" + - "However, your max acceleration is decreased due to you feeling heavier."); + "However, your max acceleration is decreased due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronPrimeLore = true; + if (item.favorited) + modPlayer.skeletronPrimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index e980523588..c194ec932f 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + - "This effect makes dashing more difficult and does not work with mounts."); + "This effect makes dashing more difficult and does not work with mounts.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.mount.Active) + if (player.mount.Active || !item.favorited) return; if (player.dashDelay < 0) diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index 7314c7f2ba..1514675839 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "These creatures did not belong in this world, it's best to be rid of them.\n" + "Place in your inventory to gain invisibility and rogue bonuses at night.\n" + "However, your defense is reduced while above 50% life due to you feeling softer.\n" + - "Your max acceleration is reduced while below 50% life due to you feeling heavier."); + "Your max acceleration is reduced while below 50% life due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.twinsLore = true; + if (item.favorited) + modPlayer.twinsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 7f485be3dc..6c4b7a7015 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.wallOfFleshLore = true; + if (item.favorited) + modPlayer.wallOfFleshLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 535ff8a48d..bbf5a90a42 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Jungle Dragon, Yharon"); Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); + "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.yharonLore = true; + if (item.favorited) + modPlayer.yharonLore = true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs new file mode 100644 index 0000000000..f51f49efef --- /dev/null +++ b/Items/Weapons/Ranged/Ultima.cs @@ -0,0 +1,70 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Ultima : ModItem + { + public const float FullChargeTime = 420f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + Tooltip.SetDefault("Casts a continuous stream of plasma bolts\n" + + "Over time the bolts are replaced with powerful lasers\n" + + "Bolts power up into solid beams as you continue shooting\n" + + "90% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 210; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = item.useAnimation = 3; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 2f; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 18f; + item.useAmmo = AmmoID.Arrow; + item.channel = true; + item.useTurn = false; + item.autoReuse = true; + item.noUseGraphic = true; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY).SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); + return false; + } + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 90; + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PulseBow); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/Ultima.png b/Items/Weapons/Ranged/Ultima.png new file mode 100644 index 0000000000..bf77665303 Binary files /dev/null and b/Items/Weapons/Ranged/Ultima.png differ diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs new file mode 100644 index 0000000000..fabdacfe67 --- /dev/null +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -0,0 +1,67 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Typeless +{ + public class YanmeisKnife : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Tooltip.SetDefault("When hitting a boss or its minions, you gain various boosts and cripple the enemy hit\n" + + "A knife from an unknown world\n" + + "An owner who's heart is pure and free of taint\n" + + "A heart of iron and valor"); + } + + public override void SetDefaults() + { + item.height = 44; + item.width = 48; + item.damage = 8; + item.crit += 6; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = item.useTime = 32; + item.useStyle = ItemUseStyleID.HoldingOut; + item.knockBack = 4.5f; + item.autoReuse = false; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.UseSound = SoundID.Item71; + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 24f; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool CanUseItem(Player player) + { + if (player.Calamity().KameiBladeUseDelay > 0) + return false; + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.Calamity().KameiBladeUseDelay = 180; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PsychoKnife); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Typeless/YanmeisKnife.png b/Items/Weapons/Typeless/YanmeisKnife.png new file mode 100644 index 0000000000..36c6bc6c06 Binary files /dev/null and b/Items/Weapons/Typeless/YanmeisKnife.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 144add2bb2..46696928e0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -143,6 +143,7 @@ namespace CalamityMod.NPCs public int clamDebuff = 0; public int sulphurPoison = 0; public int ladHearts = 0; + public int kamiFlu = 0; public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; @@ -685,6 +686,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); if (npc.velocity.X == 0) ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage); @@ -1537,6 +1539,8 @@ namespace CalamityMod.NPCs calcDR *= 0.66f; if (wCleave > 0) calcDR *= 0.75f; + if (npc.Calamity().kamiFlu > 0) + calcDR *= KamiDebuff.MultiplicativeDamageReduction; if (npc.onFire2) calcDR *= 0.8f; @@ -3128,6 +3132,8 @@ namespace CalamityMod.NPCs clamDebuff--; if (sulphurPoison > 0) sulphurPoison--; + if (kamiFlu > 0) + kamiFlu--; if (relicOfResilienceCooldown > 0) relicOfResilienceCooldown--; if (relicOfResilienceWeakness > 0) @@ -3139,6 +3145,11 @@ namespace CalamityMod.NPCs if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) return; + if (kamiFlu > 0) + { + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiDebuff.MaxNPCSpeed), new Vector2(KamiDebuff.MaxNPCSpeed)); + } + if (!CalamityPlayer.areThereAnyDamnBosses) { if (pearlAura > 0) @@ -4519,6 +4530,11 @@ namespace CalamityMod.NPCs return new Color(200, 50, 50, npc.alpha); } + if (npc.Calamity().kamiFlu > 0) + { + return new Color(51, 197, 108, npc.alpha); + } + return null; } diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs new file mode 100644 index 0000000000..2bdecf4355 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -0,0 +1,169 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + public abstract class BaseLaserbeamProjectile : ModProjectile + { + public float RotationalSpeed + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float Time + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public float LaserLength + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public virtual void Behavior() + { + // Attach to some arbitrary thing/position optionally. (The ai[1] value is a reserved for this in vanilla's Phantasmal Deathray) + AttachToSomething(); + + // Ensure the the velocity is a unit vector and is not a <0,0> vector. + projectile.velocity = projectile.velocity.SafeNormalize(-Vector2.UnitY); + + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + DetermineScale(); + + UpdateLaserMotion(); + + float idealLaserLength = DetermineLaserLength(); + LaserLength = MathHelper.Lerp(LaserLength, idealLaserLength, 0.9f); // Very quickly approach the ideal laser length. + + DelegateMethods.v3_1 = LightCastColor.ToVector3(); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + public virtual void UpdateLaserMotion() + { + // This part is rather complicated at a glance. + // What it's doing is converting the velocity to an angle, doing something with that angle, and changing it back into the velocity. + // In this case, "doing something with that angle" means incrementing it by a constant. + // You could attempt to make it intelligent by having it move towards the target like the Last Prism, but that's not done here. + // This allows one to cause an arcing motion. + + float updatedVelocityDirection = projectile.velocity.ToRotation() + RotationalSpeed; + projectile.rotation = updatedVelocityDirection - MathHelper.PiOver2; // Pretty much all lasers have a vertical sheet. + projectile.velocity = updatedVelocityDirection.ToRotationVector2(); + } + public virtual void DetermineScale() + { + projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * 6f * MaxScale; + if (projectile.scale > MaxScale) + { + projectile.scale = MaxScale; + } + } + public virtual void AttachToSomething() { } // Does nothing by default. + public virtual float DetermineLaserLength() => MaxLaserLength; // Go with the default length and ignore any obstacles by default. + public virtual void ExtraBehavior() { } + public override void AI() + { + Behavior(); + ExtraBehavior(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // This should never happen, but just in case- + if (projectile.velocity == Vector2.Zero) + return false; + + // Start texture drawing. + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * projectile.scale; + Vector2 centerOnLaser = projectile.Center; + centerOnLaser += projectile.velocity * projectile.scale * LaserBeginTexture.Height / 2f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = LaserMiddleTexture.Height * projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + projectile.scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + null, + LaserOverlayColor, + projectile.rotation, + LaserEndTexture.Frame(1, 1, 0, 0).Top(), + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackMelee; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + float unused = 69420f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref unused)) + { + return true; + } + return false; + } + + #region Virtual Values + public virtual float Lifetime => 120f; + public virtual float MaxScale => 1f; + public virtual float MaxLaserLength => 2400f; // Be careful with this. Going too high will cause lag. + public virtual Color LightCastColor => Color.White; + public virtual Color LaserOverlayColor => Color.White * 0.9f; + public virtual Texture2D LaserBeginTexture { get; } + public virtual Texture2D LaserMiddleTexture { get; } + public virtual Texture2D LaserEndTexture { get; } + #endregion + } +} diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs new file mode 100644 index 0000000000..1201e4a9ae --- /dev/null +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBolt : ModProjectile + { + public float Bounces + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float DefaultHue => ((float)Math.Sin(Main.GlobalTime * 2.5f) + 1) * 0.5f; + public const int MaxBounces = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + DisplayName.SetDefault("Ultima Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 42; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public Color GetColorFromHue(float hue) => Main.hslToRgb(hue, 1f, 0.725f) * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => GetColorFromHue(DefaultHue); + + public void ProduceExplosionDust(int dustCount) + { + if (!Main.dedServ) + { + for (int i = 0; i < dustCount; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 267); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f); + dust.scale = Main.rand.NextFloat(1f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(7f, 7f); + dust.noGravity = true; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Bounces >= MaxBounces) + { + projectile.Kill(); + return false; + } + + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + Bounces++; + ProduceExplosionDust(24); + + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture(Texture); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + if (i > 0) + { + CalamityUtils.DistanceClamp(ref projectile.oldPos[i], ref projectile.oldPos[i - 1], 8f); // Ensure the max distance between the old positions isn't too great. It looks weird if it is. + } + float completionRatio = i / (float)projectile.oldPos.Length; + Color color = GetColorFromHue((DefaultHue + completionRatio * 0.5f) % 1f) * (float)Math.Pow(1f - completionRatio, 2); + spriteBatch.Draw(texture, + projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition, + null, + color, + projectile.rotation, + texture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 90, 90); + projectile.Damage(); + ProduceExplosionDust(32); + } + } +} diff --git a/Projectiles/Ranged/UltimaBolt.png b/Projectiles/Ranged/UltimaBolt.png new file mode 100644 index 0000000000..4e0b7c7f9b Binary files /dev/null and b/Projectiles/Ranged/UltimaBolt.png differ diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs new file mode 100644 index 0000000000..c5f44980fe --- /dev/null +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -0,0 +1,108 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBowProjectile : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float PositioningOffset = 35f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 144; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.direction = (Math.Cos(projectile.velocity.ToRotation()) > 0).ToDirectionInt(); + AttemptToFireProjectiles(player); + AttachToPlayer(player); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Time++; + } + + public void AttemptToFireProjectiles(Player player) + { + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + if (!canFire) + { + projectile.Kill(); + return; + } + if (Main.netMode != NetmodeID.MultiplayerClient && Time % player.ActiveItem().useTime == 0) + { + int type = ProjectileID.WoodenArrowFriendly; // This doesn't really matter. It's overwritten anyway. But it is passed into the PickAmmo method. + float shotSpeed = player.ActiveItem().shootSpeed; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().knockBack; + + player.PickAmmo(player.ActiveItem(), ref type, ref shotSpeed, ref canFire, ref damage, ref knockBack); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo). + + Main.PlaySound(player.ActiveItem().UseSound, projectile.Center); + + type = ModContent.ProjectileType(); + float shootLaserChance = Utils.InverseLerp(Ultima.FullChargeTime * 0.35f, Ultima.FullChargeTime, Time, true); + Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); + shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; + + projectile.velocity = projectile.DirectionTo(Main.MouseWorld); + + Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. + + // Fire a laser. + if (Main.rand.NextFloat() <= shootLaserChance) + { + type = ModContent.ProjectileType(); + shotVelocity = shotVelocity.RotatedByRandom(0.03f); + damage *= 2; + } + // Sometimes fire little sparks if the bow is fully charged. + if (Time >= Ultima.FullChargeTime * 0.7f && Main.rand.NextBool(6)) + { + // To ensure that the sparks don't spawn on top of the laser itself. + float offsetAngle = Main.rand.NextFloat(0.2f, 0.5f) * Main.rand.NextBool(2).ToDirectionInt(); + Vector2 sparkVelocity = projectile.DirectionTo(Main.MouseWorld).RotatedByRandom(0.5f) * 13f; + sparkVelocity = sparkVelocity.RotatedBy(offsetAngle); + Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, projectile.owner); + } + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); + + Projectile.NewProjectile(shotPosition, shotVelocity, type, damage, knockBack, projectile.owner); + projectile.netUpdate = true; + } + } + + public void AttachToPlayer(Player player) + { + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.ToRotation().ToRotationVector2() * PositioningOffset; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = player.itemAnimation = 2; + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/UltimaBowProjectile.png b/Projectiles/Ranged/UltimaBowProjectile.png new file mode 100644 index 0000000000..a5e99993fd Binary files /dev/null and b/Projectiles/Ranged/UltimaBowProjectile.png differ diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs new file mode 100644 index 0000000000..43742db73f --- /dev/null +++ b/Projectiles/Ranged/UltimaRay.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaRay : BaseLaserbeamProjectile + { + public float HueOffset + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override float MaxScale => 0.7f; + public override float MaxLaserLength => 1599.999999f; + public override float Lifetime => 50f; + public override Color LaserOverlayColor => Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 2.3f + HueOffset) * 0.5f + 0.5f, 1f, 0.775f) * Utils.InverseLerp(Lifetime, 0f, Time, true); + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Ray"); + } + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.localNPCHitCooldown = 8; + projectile.usesLocalNPCImmunity = true; + } + public override bool PreAI() + { + // Initialization. Using the AI hook would override the base laser's code, and we don't want that. + if (projectile.localAI[0] == 0f) + { + HueOffset = Main.rand.NextFloat(MathHelper.Pi / 5f); + projectile.localAI[0] = 1f; + } + return true; + } + public override bool ShouldUpdatePosition() => false; + } +} diff --git a/Projectiles/Ranged/UltimaRay.png b/Projectiles/Ranged/UltimaRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Ranged/UltimaRay.png differ diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs new file mode 100644 index 0000000000..277bb81070 --- /dev/null +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaSpark : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int DustType = 261; + public const float MaxHomingDistance = 1200f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Spark"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (!Main.dedServ && Time > 5f) + { + for (int i = 0; i < 3; i++) + { + Vector2 spawnPosition = Vector2.Lerp(projectile.oldPosition, projectile.position, i / 3f); + Dust dust = Dust.NewDustPerfect(spawnPosition, DustType); + dust.color = Main.hslToRgb((Main.rand.NextFloat(-0.04f, 0.04f) + Time / 80f) % 1f, 0.8f, 0.6f); + dust.scale = 2.3f; + dust.fadeIn = 1f; + dust.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + } + } + + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 8f + projectile.DirectionTo(potentialTarget.Center) * 18f) / 9f; + return; + } + + if (Time > 30f) + { + float updatedTime = Time - 30f; + // Make a complete 90 degree turn in 30 frames. + if (updatedTime % 120f > 90f) + { + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.PiOver2 / 20f); + } + // Arc around quickly for 60 frames. + else if (updatedTime % 120f > 30f) + { + projectile.velocity = projectile.velocity.RotatedBy((float)Math.Sin((updatedTime - 30f) % 60f / 60f * MathHelper.TwoPi) * MathHelper.ToRadians(15f)); + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60, 60); + projectile.Damage(); + if (!Main.dedServ) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, DustType); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.7f); + dust.scale = Main.rand.NextFloat(0.9f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(6f, 6f); + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Ranged/UltimaSpark.png b/Projectiles/Ranged/UltimaSpark.png new file mode 100644 index 0000000000..a799dbbc35 Binary files /dev/null and b/Projectiles/Ranged/UltimaSpark.png differ diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs new file mode 100644 index 0000000000..599ff27179 --- /dev/null +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -0,0 +1,113 @@ +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class YanmeisKnifeSlash : ModProjectile + { + // This is a rather weird thing, but it's what the patron asked for. + public static readonly Func CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityMod.bossMinionList.Contains(npc.type); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 180; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.Calamity().trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + // Frames and crap + projectile.frameCounter++; + if (projectile.frameCounter % 7 == 0) + { + projectile.frame++; + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.Kill(); + } + + // Create idle light and dust. + Vector2 origin = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(origin, 0f, 1.5f, 0.1f); + + Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); + + // Rotation and directioning. + float velocityAngle = projectile.velocity.ToRotation(); + projectile.rotation = velocityAngle + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); + + // Positioning close to the end of the player's arm. + projectile.position = playerRotatedPoint - projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; + + // Sprite and player directioning. + projectile.spriteDirection = projectile.direction; + player.ChangeDir(projectile.direction); + + // Prevents the projectile from dying + projectile.timeLeft = 2; + + // Player item-based field manipulation. + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + } + + public void HandleAttachmentMovement(Player player, Vector2 playerRotatedPoint) + { + float speed = 1f; + if (player.ActiveItem().shoot == projectile.type) + { + speed = player.ActiveItem().shootSpeed * projectile.scale; + } + Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; + + // Sync if a velocity component changes. + if (projectile.velocity.X != newVelocity.X || projectile.velocity.Y != newVelocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = newVelocity; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!CanRecieveCoolEffectsFrom(target)) + return; + target.AddBuff(ModContent.BuffType(), 600); + if (!Main.dedServ) + { + for (int i = 0; i < 60; i++) + { + Dust dust = Dust.NewDustDirect(Main.player[projectile.owner].position, Main.player[projectile.owner].width, Main.player[projectile.owner].height, 267); + dust.position.X += Main.rand.NextFloat(-16f, 16f); + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); + dust.velocity = Main.rand.NextVector2Circular(24f, 24f); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f); + dust.noGravity = true; + } + } + Main.PlaySound(SoundID.Zombie, Main.player[projectile.owner].Center, 104); + Main.player[projectile.owner].AddBuff(ModContent.BuffType(), 600); + } + public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); + } +} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.png b/Projectiles/Typeless/YanmeisKnifeSlash.png new file mode 100644 index 0000000000..e0b03d728c Binary files /dev/null and b/Projectiles/Typeless/YanmeisKnifeSlash.png differ diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 6613fc7ac6..c7c6cad210 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -3389,6 +3389,20 @@ namespace CalamityMod return (t - from) / (to - from); } + /// + /// Clamps the distance between vectors via normalization. + /// + /// The starting point. + /// The ending point. + /// The maximum possible distance between the two vectors before they get clamped. + public static void DistanceClamp(ref Vector2 start, ref Vector2 end, float maxDistance) + { + if (Vector2.Distance(end, start) > maxDistance) + { + end = start + Vector2.Normalize(end - start) * maxDistance; + } + } + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function public static Rectangle ClampToWorld(Rectangle tileRectangle) {