Files
CalamityModPublic/Items/Accessories/ToxicHeart.cs
T
Andrew Marheine d5a2c4963b 1 - Expert boss items are now dropped on all modes and no longer have the expert rarity or tag.
2 - Counter Scarf is no longer dropped by EoC and is now sold by the Clothier for 10 gold.
2022-01-14 22:32:02 -06:00

71 lines
2.6 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Items.Accessories
{
public class ToxicHeart : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Toxic Heart");
Tooltip.SetDefault("Summons a plague aura around you that damages nearby enemies\n" +
"Makes you immune to the Plague debuff ");
}
public override void SetDefaults()
{
item.width = 28;
item.height = 32;
item.value = CalamityGlobalItem.Rarity8BuyPrice;
item.rare = ItemRarityID.Yellow;
item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
player.buffImmune[ModContent.BuffType<Plague>()] = true;
int plagueCounter = 0;
Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f);
int num = ModContent.BuffType<Plague>();
float num2 = 300f;
bool flag = plagueCounter % 60 == 0;
int num3 = (int)(50 * player.AverageDamage());
int random = Main.rand.Next(10);
if (player.whoAmI == Main.myPlayer)
{
if (random == 0)
{
for (int l = 0; l < Main.maxNPCs; l++)
{
NPC nPC = Main.npc[l];
if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2)
{
if (nPC.FindBuffIndex(num) == -1)
{
nPC.AddBuff(num, 120, false);
}
if (flag)
{
if (player.whoAmI == Main.myPlayer)
{
Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), num3, 0f, player.whoAmI, l);
}
}
}
}
}
}
plagueCounter++;
if (plagueCounter >= 180)
{
}
}
}
}