public override void OnCraft(Item item, Recipe recipe) { Player player = Main.player[item.owner]; AwakenedPlayer modPlayer = player.GetModPlayer <AwakenedPlayer>(mod); if (MyWorld.awakenedMode) { if (item.damage > 0 && modPlayer.craftWeaponCooldown <= 0) { modPlayer.sanity += 15; modPlayer.craftWeaponCooldown = 3600; } } }
public override void Update(Item item, ref float gravity, ref float maxFallSpeed) { Player player = Main.player[item.owner]; AwakenedPlayer modPlayer = player.GetModPlayer <AwakenedPlayer>(mod); if (MyWorld.awakenedMode) { // lavawet isnt set yet so check it manually reduceSanityCD--; // takes 3 frames for vanilla to destroy the voodoo doll (idk why) so add a cooldown so it doesnt reduce it too much if (item.type == ItemID.GuideVoodooDoll && Collision.LavaCollision(item.position, item.width, item.height) && Main.netMode != 1 && NPC.AnyNPCs(NPCID.Guide) && reduceSanityCD <= 0) { reduceSanityCD = 5; modPlayer.sanity -= 20; ElementsAwoken.DebugModeText("voodoll drain"); } } }
public override void NPCLoot(NPC npc) { Player player = Main.player[Main.myPlayer]; AwakenedPlayer modPlayer = player.GetModPlayer <AwakenedPlayer>(mod); PlayerUtils playerUtils = player.GetModPlayer <PlayerUtils>(mod); if (MyWorld.awakenedMode) { if (npc.boss) { if (playerUtils.bossesKilledLastFiveMin < 3) { modPlayer.sanity += modPlayer.sanityMax / 5; } else { modPlayer.sanity -= 8; } } } }
// check using potions public override bool UseItem(Item item, Player player) { AwakenedPlayer modPlayer = player.GetModPlayer <AwakenedPlayer>(mod); PlayerUtils playerUtils = player.GetModPlayer <PlayerUtils>(mod); if (MyWorld.awakenedMode) { if (item.buffType != 0 && item.useStyle == 2 && item.consumable && item.type != mod.ItemType("SanityRegenerationPotion")) { if (playerUtils.potionsConsumedLastMin > 5) { modPlayer.sanity -= 3; } } } /*if (item.Name.Contains("Potion") && item.buffType != 0) * { * * }*/ return(base.UseItem(item, player)); }