93 lines
3.5 KiB
C#
93 lines
3.5 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.CalPlayer;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Accessories
|
|
{
|
|
public class PlagueHive : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Plague Hive");
|
|
Tooltip.SetDefault("Summons a damaging plague aura around the player to destroy nearby enemies\n" +
|
|
"Releases bees when damaged\n" +
|
|
"Friendly bees inflict the plague\n" +
|
|
"All of your attacks inflict the plague\n" +
|
|
"Makes you immune to the plague\n" +
|
|
"Projectiles spawn plague seekers on enemy hits\n" +
|
|
"The power of your bees and wasps will rival the Moon Lord himself");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 30;
|
|
item.height = 38;
|
|
item.value = Item.buyPrice(0, 60, 0, 0);
|
|
item.expert = true;
|
|
item.rare = 9;
|
|
item.accessory = true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<ToxicHeart>());
|
|
recipe.AddIngredient(ModContent.ItemType<AlchemicalFlask>());
|
|
recipe.AddIngredient(ItemID.HiveBackpack);
|
|
recipe.AddIngredient(ItemID.HoneyComb);
|
|
recipe.AddTile(TileID.LunarCraftingStation);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
|
|
public override void UpdateAccessory(Player player, bool hideVisual)
|
|
{
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
player.buffImmune[ModContent.BuffType<Plague>()] = true;
|
|
player.bee = true;
|
|
modPlayer.uberBees = true;
|
|
player.strongBees = true;
|
|
modPlayer.alchFlask = true;
|
|
int plagueCounter = 0;
|
|
Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.1f, 2f, 0.2f);
|
|
int num = ModContent.BuffType<Plague>();
|
|
float num2 = 300f;
|
|
bool flag = plagueCounter % 60 == 0;
|
|
int num3 = 60;
|
|
int random = Main.rand.Next(10);
|
|
if (player.whoAmI == Main.myPlayer)
|
|
{
|
|
if (random == 0)
|
|
{
|
|
for (int l = 0; l < 200; 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)
|
|
{
|
|
nPC.StrikeNPC(num3, 0f, 0, false, false, false);
|
|
if (Main.netMode != NetmodeID.SinglePlayer)
|
|
{
|
|
NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
plagueCounter++;
|
|
if (plagueCounter >= 180)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|