Files
ForgottenWawiTech/Content/Items/Materials/RGBass.cs
T

51 lines
1.5 KiB
C#

using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Microsoft.Xna.Framework;
namespace ForgottenWawiTech.Content.Items.Materials
{
public class RGBass : ModItem
{
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.maxStack = 9999;
Item.rare = ItemRarityID.Expert; // temp rarity until custom rarity is added
Item.value = Item.buyPrice(gold: 10);
}
public override void OnStack(Item source, int numTransfered)
{
// Mark that RGBass has been obtained in this world
ForgottenWawiTechSystem.hasObtainedRGBass = true;
}
public override bool OnPickup(Player player)
{
// Mark that RGBass has been obtained in this world
ForgottenWawiTechSystem.hasObtainedRGBass = true;
return true;
}
}
public class RGBassFishingPlayer : ModPlayer
{
public override void CatchFish(FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition)
{
// Only if Moon Lord has been defeated
if (!NPC.downedMoonlord)
return;
bool inWater = !attempt.inLava && !attempt.inHoney;
if (inWater && Main.rand.NextBool(20)) // 5% chance (1 in 20)
{
itemDrop = ModContent.ItemType<RGBass>();
}
}
}
}