Files
CalamityModPublic/Items/SummonItems/RuneofCos.cs
T
2019-10-19 20:46:47 -05:00

74 lines
2.7 KiB
C#

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using CalamityMod.NPCs;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Typeless;
namespace CalamityMod.Items.SummonItems
{
public class RuneofCos : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rune of Kos");
Tooltip.SetDefault("A relic of the profaned flame\n" +
"Contains the power hunted relentlessly by the sentinels of the cosmic devourer\n" +
"When used in certain areas of the world it will unleash them\n" +
"Not consumable");
}
public override void SetDefaults()
{
item.width = 20;
item.height = 20;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = 4;
item.rare = 9;
item.UseSound = SoundID.Item44;
item.consumable = false;
item.Calamity().postMoonLordRarity = 13;
}
public override bool CanUseItem(Player player)
{
return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) &&
!NPC.AnyNPCs(ModContent.NPCType<StormWeaverHead>()) && !NPC.AnyNPCs(ModContent.NPCType<StormWeaverHeadNaked>()) && !NPC.AnyNPCs(ModContent.NPCType<CeaselessVoid>()) && !NPC.AnyNPCs(ModContent.NPCType<CosmicWraith>());
}
public override bool UseItem(Player player)
{
if (player.ZoneDungeon)
{
for (int num662 = 0; num662 < 2; num662++)
{
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<DarkEnergySpawn>(), 0, 0f, Main.myPlayer, 0f, 0f);
}
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<CeaselessVoid>());
}
else if (player.ZoneUnderworldHeight)
{
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<CosmicWraith>());
}
else if (player.ZoneSkyHeight)
{
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<StormWeaverHead>());
}
Main.PlaySound(SoundID.Roar, player.position, 0);
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<UnholyEssence>(), 40);
recipe.AddIngredient(ItemID.LunarBar, 10);
recipe.AddIngredient(ItemID.FragmentSolar, 5);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}