public override void NPCLoot(NPC npc) { // npc.type == NPCID. if (npc.lastInteraction != 255 && !npc.boss && !npc.friendly && !npc.SpawnedFromStatue && npc.lifeMax > 5 && npc.type != NPCID.TargetDummy && npc.type != NPCID.Creeper && npc.type != NPCID.EaterofWorldsHead && npc.type != NPCID.EaterofWorldsBody && npc.type != NPCID.EaterofWorldsTail) { if (Main.hardMode) { if (NPC.downedMoonlord && KeyUtils.RandPercent(.05f)) { Item.NewItem(npc.getRect(), ItemType <Items.Synthesis.Other.Zenithite>()); } else if (NPC.downedPlantBoss && KeyUtils.RandPercent(.01f)) { Item.NewItem(npc.getRect(), ItemType <Items.Synthesis.Other.Zenithite>()); } else if (KeyUtils.RandPercent(.00125f)) { Item.NewItem(npc.getRect(), ItemType <Items.Synthesis.Other.Zenithite>()); } }/* #region Blazing * if (npc.type == NPCID.Hellbat || npc.type == NPCID.LavaSlime) * { * if (Main.hardMode && Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingShard>()); * } * else if (npc.type == NPCID.FireImp) * { * if (Main.hardMode && Main.rand.NextBool(7)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingGem>()); * else if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingShard>()); * } * else if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.Lavabat) * { * if (Main.hardMode && Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingGem>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingStone>()); * } * else if (npc.type == NPCID.HellArmoredBones || npc.type == NPCID.HellArmoredBonesMace || npc.type == NPCID.HellArmoredBonesSpikeShield || npc.type == NPCID.HellArmoredBonesSword || npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite || npc.type == NPCID.RedDevil || npc.type == NPCID.Pumpking) * { * if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingCrystal>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Blazing.BlazingGem>()); * } #endregion #region Frost * if (npc.type == NPCID.ZombieEskimo || npc.type == NPCID.ArmedZombieEskimo || npc.type == NPCID.IceSlime) * { * if (Main.hardMode && Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostShard>()); * } * else if (npc.type == NPCID.DarkCaster || npc.type == NPCID.SnowFlinx || npc.type == NPCID.IceBat || npc.type == NPCID.SpikedIceSlime || npc.type == NPCID.UndeadViking) * { * if (Main.hardMode && Main.rand.NextBool(7)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostGem>()); * else if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostShard>()); * } * else if (npc.type == NPCID.ArmoredViking || npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman || npc.type == NPCID.Wolf || npc.type == NPCID.IceTortoise) * { * if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostGem>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostStone>()); * } * else if (npc.type == NPCID.IceGolem || npc.type == NPCID.IceQueen) * { * if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostCrystal>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Frost.FrostGem>()); * } #endregion #region Lightning * if (npc.type == NPCID.PinkJellyfish) * { * if (Main.hardMode && Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningShard>()); * } * else if (npc.type == NPCID.GraniteFlyer || npc.type == NPCID.GraniteGolem) * { * if (Main.hardMode && Main.rand.NextBool(7)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningGem>()); * else if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningStone>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningShard>()); * } * else if (npc.type == NPCID.AnglerFish || npc.type == NPCID.Gastropod || npc.type == NPCID.AngryNimbus) * { * if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningGem>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningStone>()); * } * else if (npc.type == NPCID.GigaZapper || npc.type == NPCID.MartianWalker) * { * if (Main.rand.NextBool(5)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningCrystal>()); * else if (Main.rand.NextBool(3)) * Item.NewItem(npc.getRect(), ItemType<Items.Synthesis.Lightning.LightningGem>()); * } #endregion #region Stormy * #endregion #region Brave * #endregion #region Lucid * #endregion #region Pulsing * #endregion #region Writhing * #endregion #region Sinister * #endregion #region Hungry * #endregion #region Soothing * #endregion #region Wellspring * #endregion */ } }
public override void AI() { //npc.active = false; SafeToUnlock = true; for (int k = 0; k < 200; k++) { if (Main.npc[k].active && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5) { if (Main.npc[k].Distance(npc.Center) < 300f) { SafeToUnlock = false; } } } for (int k = 0; k < 200; k++) { Player player = Main.player[k]; if (player.active && !player.dead) { Rectangle itemRect = player.GetModPlayer <KeyPlayer>().itemRectangle; itemRect.Inflate(itemRect.Width / 2, 0); if (!Unlocked && SafeToUnlock && player.altFunctionUse != 2 && player.itemAnimation > 0 && player.HeldItem.GetGlobalItem <KeyItem>().IsKeybrand&& itemRect.Intersects(npc.getRect()) && Collision.CanHit(player.GetModPlayer <KeyPlayer>().itemRectangle.Center.ToVector2(), 0, 0, npc.Center, 0, 0)) { Unlocked = true; npc.netUpdate = true; } } } if (Unlocked) { npc.localAI[0]++; } if (npc.localAI[0] == 1) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/ChestOpen").WithVolume(0.5f), npc.Center); } else if (npc.localAI[0] == 10) { npc.rarity = 0; #region Munny if (NPC.downedMoonlord) { MaxMunny = 500; } else if (NPC.downedPlantBoss) { MaxMunny = 300; } else if (Main.hardMode) { MaxMunny = 150; } else { MaxMunny = 75; } int DropAmount = 1; if (KeyUtils.RandPercent(.05f)) { DropAmount = Main.rand.Next(MaxMunny / 2, MaxMunny + 1); } else if (KeyUtils.RandPercent(.25f)) { DropAmount = Main.rand.Next(MaxMunny / 4, MaxMunny / 2 + 1); } else if (KeyUtils.RandPercent(.5f)) { DropAmount = Main.rand.Next(MaxMunny / 10, MaxMunny / 4 + 1); } else { DropAmount = Main.rand.Next(1, MaxMunny / 10 + 1); } if (KeyUtils.RandPercent(.1f)) { if (KeyUtils.RandPercent(.05f)) { DropAmount += Main.rand.Next(MaxMunny / 2, MaxMunny + 1); } else if (KeyUtils.RandPercent(.25f)) { DropAmount += Main.rand.Next(MaxMunny / 4, MaxMunny / 2 + 1); } else if (KeyUtils.RandPercent(.5f)) { DropAmount += Main.rand.Next(MaxMunny / 10, MaxMunny / 4 + 1); } else { DropAmount += Main.rand.Next(1, MaxMunny / 10 + 1); } } if (DropAmount > (int)((float)MaxMunny * 1.5f)) { DropAmount = (int)((float)MaxMunny * 1.5f); } KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Currency.Munny>(), DropAmount); #endregion #region Synthesis Materials if (KeyUtils.RandPercent(NPC.downedMoonlord ? .1f : .01f)) { if (KeyUtils.RandPercent(.01f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Synthesis.Other.Zanithite>()); } else { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Synthesis.Other.Zenithite>()); } } #endregion #region Other Materials if (NPC.downedPlantBoss || (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)) { if (KeyUtils.RandPercent(.15f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Materials.BrokenHeroKeybrand>()); } if (KeyUtils.RandPercent(.3f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Materials.WarriorFragment>(), Main.rand.Next(3, 8)); } if (KeyUtils.RandPercent(.3f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Materials.GuardianFragment>(), Main.rand.Next(3, 8)); } if (KeyUtils.RandPercent(.3f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Materials.MysticFragment>(), Main.rand.Next(3, 8)); } } else if (KeyUtils.RandPercent(.15f)) { KeyUtils.NewSyncedItem(npc.getRect(), ItemType <Items.Materials.KeybrandMold>()); } #endregion npc.netUpdate = true; } else if (npc.localAI[0] > 30) { npc.alpha += 5; } }