public override void OnHitPlayer(Player target, int damage, bool crit) { for (int k = 0; k < Player.maxBuffs; k++) { if (target.buffType[k] > 0 && target.buffTime[k] > 0 && BuffLoader.CanBeCleared(target.buffType[k]) && Main.rand.NextBool()) { target.DelBuff(k); k--; } } }
public override void OnPlay(TLoZPlayer tlozPlayer, SongVariant variant) { for (int i = 0; i < Main.player.Length; i++) { Player player = Main.player[i]; if (!player.active || player.dead) { return; } for (int j = 0; j < player.CountBuffs(); j++) { int buffType = player.buffType[j]; if (Main.debuff[buffType] && BuffLoader.CanBeCleared(buffType)) { player.ClearBuff(buffType); } } } }
public static void Heal() { int num27 = CalculatePriceForHeal(); int health = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife; if (health == 0) { return; } if (Main.player[Main.myPlayer].BuyItem(num27, -1)) { AchievementsHelper.HandleNurseService(num27); Main.PlaySound(SoundID.Item4, -1, -1); Main.player[Main.myPlayer].HealEffect(health, true); Main.player[Main.myPlayer].statLife += health; if (true) { for (int i = 0; i < Player.MaxBuffs; i++) { int num9 = Main.player[Main.myPlayer].buffType[i]; if (Main.debuff[num9] && Main.player[Main.myPlayer].buffTime[i] > 0 && BuffLoader.CanBeCleared(num9)) { Main.player[Main.myPlayer].DelBuff(i); i = -1; } } } PlayerHooks.PostNurseHeal(Main.player[Main.myPlayer], Main.npc[Main.player[Main.myPlayer].talkNPC], health, true, num27); } }
public static int CalculatePriceForHeal() { int health = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife; int num27 = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife; for (int k = 0; k < Player.MaxBuffs; k++) { int num6 = Main.player[Main.myPlayer].buffType[k]; if (Main.debuff[num6] && Main.player[Main.myPlayer].buffTime[k] > 5 && BuffLoader.CanBeCleared(num6)) { num27 += 1000; } } int num23 = num27; PlayerHooks.ModifyNursePrice(Main.player[Main.myPlayer], Main.npc[Main.player[Main.myPlayer].talkNPC], health, true, ref num23); if (num23 > 0) { num23 = (int)((double)num23 * 0.75); if (num23 < 1) { num23 = 1; } } return(num23); }
public override bool NewRightClick(int i, int j) { int x = i; int y = j; while (Main.tile[x, y].frameY % 70 != 0) { y--; } while (Main.tile[x, y].frameX % 54 != 0) { x--; } int vmID = VendingMachineWorld.GetVendingMachineFromCoordinates(x, y); if (vmID < 0) { Main.NewText("No vending Machine Found..."); return(false); } VendingMachineData vm = VendingMachineWorld.vm[vmID]; if (vm.isItem) { Main.player[Main.myPlayer].chest = -1; Main.npcChatText = ""; int type = SoulOfNPC.getTypeFromItemTag(vm.id); Item itm = new Item(); itm.SetDefaults(type); VendingMachineItem vendor = itm.modItem as VendingMachineItem; if (vendor != null) { if (vendor.replaceRightClick) { vendor.machineRightClick(vm, i, j); } else { Main.npcShop = Main.MaxShopIDs - 1; chooseTalkingNPC(vm); Main.recBigList = false; Main.playerInventory = true; Main.InGuideCraftMenu = false; Main.InReforgeMenu = false; for (int k = 0; k < InvisibleAllShopNPC.shopChest.item.Length; k++) { InvisibleAllShopNPC.shopChest.item[k] = new Item(); } vendor.SetupShop(InvisibleAllShopNPC.shopChest); Main.instance.shop[Main.npcShop].SetupShop(ModContent.NPCType <InvisibleAllShopNPC>()); } } } else { int type = SoulOfNPC.getTypeFromNPCTag(vm.id); Main.npcShop = NPCToShop(type); if (type == NPCID.TravellingMerchant) { Main.player[Main.myPlayer].chest = -1; Main.npcChatText = ""; for (int k = 0; k < 40; k++) { if (Main.instance.shop[Main.npcShop].item[k] == null) { Main.instance.shop[Main.npcShop].item[k] = new Item(); } Main.instance.shop[Main.npcShop].item[k].SetDefaults(Main.travelShop[k]); } Main.InGuideCraftMenu = false; Main.InReforgeMenu = false; Main.recBigList = false; Main.playerInventory = true; chooseTalkingNPC(vm); } /*Nurse code overrides the normal vending machine shop for the behaviour of the nurse heal option.*/ else if (type == NPCID.Nurse) { int num5 = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife; for (int k = 0; k < 22; k++) { int num6 = Main.player[Main.myPlayer].buffType[k]; if (Main.debuff[num6] && Main.player[Main.myPlayer].buffTime[k] > 5 && BuffLoader.CanBeCleared(num6)) { num5 += 1000; } } if (Main.player[Main.myPlayer].BuyItem(num5)) { AchievementsHelper.HandleNurseService(num5); Main.PlaySound(SoundID.Item4, -1, -1); Main.player[Main.myPlayer].HealEffect(Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife, true); Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax2; for (int k = 0; k < 22; k++) { int num23 = Main.player[Main.myPlayer].buffType[k]; if (Main.debuff[num23] && Main.player[Main.myPlayer].buffTime[k] > 0 && BuffLoader.CanBeCleared(num23)) { Main.player[Main.myPlayer].DelBuff(k); k = -1; } } return(true); } } else { Main.player[Main.myPlayer].chest = -1; Main.npcChatText = ""; chooseTalkingNPC(vm); Main.recBigList = false; Main.playerInventory = true; Main.InGuideCraftMenu = false; Main.InReforgeMenu = false; Main.instance.shop[Main.npcShop].SetupShop(Main.npcShop < Main.MaxShopIDs - 1 ? Main.npcShop : type); } } return(true); }