diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs new file mode 100644 index 0000000000..4f8fc7fc39 --- /dev/null +++ b/Buffs/Potions/TeslaBuff.cs @@ -0,0 +1,33 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class TeslaBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Tesla's Electricity"); + Description.SetDefault("Summons an aura of electricity"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().tesla < npc.buffTime[buffIndex]) + npc.Calamity().tesla = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().tesla = true; + } + } +} diff --git a/Buffs/Potions/TeslaBuff.png b/Buffs/Potions/TeslaBuff.png new file mode 100644 index 0000000000..59fd8fe7f3 Binary files /dev/null and b/Buffs/Potions/TeslaBuff.png differ diff --git a/Buffs/StatDebuffs/TimeSlow.cs b/Buffs/StatDebuffs/TimeSlow.cs index f4d9343c07..6eed8ac8a9 100644 --- a/Buffs/StatDebuffs/TimeSlow.cs +++ b/Buffs/StatDebuffs/TimeSlow.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Buffs.StatDebuffs /*public override void Update(Player player, ref int buffIndex) { - player.GetCalamityPlayer().timeSlow = true; + player.Calamity().timeSlow = true; }*/ } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 86cffd7cbe..8726963528 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -584,6 +584,7 @@ namespace CalamityMod.CalPlayer public bool profanedRage = false; public bool draconicSurge = false; public int draconicSurgeCooldown = 0; + public bool tesla = false; public bool vodka = false; public bool redWine = false; public bool grapeBeer = false; @@ -1299,6 +1300,7 @@ namespace CalamityMod.CalPlayer holyWrath = false; profanedRage = false; draconicSurge = false; + tesla = false; trippy = false; amidiasBlessing = false; yPower = false; @@ -1546,6 +1548,7 @@ namespace CalamityMod.CalPlayer gravityNormalizer = false; holyWrath = false; profanedRage = false; + tesla = false; draconicSurge = false; draconicSurgeCooldown = 0; yPower = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ef3aa4d115..a2818a5a08 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2693,6 +2693,29 @@ namespace CalamityMod.CalPlayer } } + if (modPlayer.tesla) + { + if (player.whoAmI == Main.myPlayer) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), 25, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + break; + } + } + } + } + if (Config.ProficiencyEnabled) modPlayer.GetStatBonuses(); } diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs new file mode 100644 index 0000000000..880fe3cdc2 --- /dev/null +++ b/Items/Potions/TeslaPotion.cs @@ -0,0 +1,53 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TeslaPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Potion"); + Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" + + "Slowdown does not work on bosses"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = ModContent.BuffType(); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddRecipeGroup("AnyGoldOre", 2); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Potions/TeslaPotion.png b/Items/Potions/TeslaPotion.png new file mode 100644 index 0000000000..f33ea5083d Binary files /dev/null and b/Items/Potions/TeslaPotion.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b475af11dc..7e5438e895 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; @@ -93,6 +94,7 @@ namespace CalamityMod.NPCs public int vaporfied = 0; public int timeSlow = 0; public int gState = 0; + public int tesla = 0; public int tSad = 0; public int eFreeze = 0; public int silvaStun = 0; @@ -546,9 +548,9 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); if (npc.velocity.X == 0) - ApplyDPSDebuff(electrified, 4, 2, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage); else - ApplyDPSDebuff(electrified, 16, 16, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(electrified, 40, 8, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -614,9 +616,9 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; - npc.buffImmune[BuffID.Electrified] = true; } if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) @@ -2115,6 +2117,8 @@ namespace CalamityMod.NPCs //Debuff decrements if (timeSlow > 0) timeSlow--; + if (tesla > 0) + tesla--; if (gState > 0) gState--; if (tSad > 0) @@ -2194,7 +2198,7 @@ namespace CalamityMod.NPCs npc.velocity = Vector2.Zero; else if (timeSlow > 0 || webbed > 0) npc.velocity *= 0.85f; - else if (slowed > 0) + else if (slowed > 0 || tesla > 0) npc.velocity *= 0.9f; } } @@ -3228,7 +3232,7 @@ namespace CalamityMod.NPCs drawColor = Color.White; } - if (timeSlow > 0) + if (timeSlow > 0 || tesla > 0) { drawColor = Color.Aquamarine; } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index d73c470299..ba35e4900e 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -37,6 +38,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index e94a587092..29a58a5e95 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -36,6 +37,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index b9e74330c0..51921c633c 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -36,6 +37,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 7234a258bf..ac4de30059 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.World; @@ -44,6 +45,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 5ae91b2cdb..401d0700e7 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -44,6 +45,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 8a334cb707..1a45d54551 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -42,6 +43,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index e55b97bfb1..f597060d08 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 6d5dc3f7f9..8aea588f04 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 95cbee6084..4f8c4cca08 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -35,6 +36,7 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 75a9b46002..f6902ec2ec 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod aiType = -1; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.knockBackResist = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 87434e9c87..9a0b639c0e 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod animationType = 50; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; npc.value = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 4e8d72dd12..3a5ff68b1f 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -33,6 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; animationType = 50; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 03bf8ab74a..06e4b04b41 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -35,6 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Slow] = true; npc.buffImmune[BuffID.Webbed] = true; animationType = 50; diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index a3796bdc72..513c09bf92 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -1,5 +1,4 @@ - -using CalamityMod.NPCs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs new file mode 100644 index 0000000000..5b00cc49ea --- /dev/null +++ b/Projectiles/Typeless/TeslaAura.cs @@ -0,0 +1,137 @@ +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using CalamityMod.Buffs.Potions; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TeslaAura : ModProjectile + { + private const float radius = 98f; + private const int framesX = 3; + private const int framesY = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla's Electricity"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 218; + projectile.height = 218; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.localAI[0]++; + projectile.frameCounter = 0; + } + if (projectile.localAI[0] >= framesY) + { + projectile.localAI[0] = 0; + projectile.localAI[1]++; + } + if (projectile.localAI[1] >= framesX) + { + projectile.localAI[1] = 0; + } + Player player = Main.player[projectile.owner]; + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + projectile.Center = player.Center; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - target.knockBackResist; + if (knockbackMultiplier < 0) + { + knockbackMultiplier = 0; + } + Vector2 trueKnockback = target.Center - projectile.Center; + trueKnockback.Normalize(); + target.velocity = trueKnockback * knockbackMultiplier; + } + + target.AddBuff(BuffID.Electrified, 300); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite = Main.projectileTexture[projectile.type]; + + Color drawColour = Color.White; + Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); + Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + + float opacity = 1f; + int sparkCount = 0; + int fadeTime = 20; + + if (projectile.timeLeft < fadeTime) + { + opacity = projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - projectile.timeLeft; + } + + for (int i = 0; i < sparkCount * 2; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + float rangeDiff = 2f; + + Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustPos.Normalize(); + dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); + + int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Typeless/TeslaAura.png b/Projectiles/Typeless/TeslaAura.png new file mode 100644 index 0000000000..d8e87ce805 Binary files /dev/null and b/Projectiles/Typeless/TeslaAura.png differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 41151a2eec..0bbf1f85c8 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -746,6 +746,13 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyCopperBar", group); + group = new RecipeGroup(() => "Any Gold Ore", new int[] + { + ItemID.GoldOre, + ItemID.PlatinumOre + }); + RecipeGroup.RegisterGroup("AnyGoldOre", group); + group = new RecipeGroup(() => "Any Gold Bar", new int[] { ItemID.GoldBar, @@ -781,7 +788,7 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("NForEE", group); - group = new RecipeGroup(() => "Fetid or Bloodletting Essence", new int[] + group = new RecipeGroup(() => "Any Evil Essence", new int[] { ModContent.ItemType(), ModContent.ItemType()