public bool InjectItem(int x, int y, Item item) { if (item.type != ItemID.DD2ElderCrystal) { return(false); } if (DD2Event.Ongoing || NPC.AnyNPCs(NPCID.DD2EterniaCrystal) || Main.pumpkinMoon || Main.snowMoon) { return(false); } Tile tile = Main.tile[x, y]; if (tile == null || !tile.active()) { return(false); } if (DD2Event.WouldFailSpawningHere(x, y)) { DD2Event.FailureMessage(-1); return(false); } else { DD2Event.SummonCrystal(x, y); item.stack--; return(true); } }
internal static bool ClearEvents(ref bool eventOccurring) { bool canClearEvent = FargoWorld.AbomClearCD <= 0; if (Main.invasionType != 0) { eventOccurring = true; if (canClearEvent) { Main.invasionType = 0; } } if (Main.pumpkinMoon) { eventOccurring = true; if (canClearEvent) { Main.pumpkinMoon = false; } } if (Main.snowMoon) { eventOccurring = true; if (canClearEvent) { Main.snowMoon = false; } } if (Main.eclipse) { eventOccurring = true; if (canClearEvent) { Main.eclipse = false; } } if (Main.bloodMoon) { eventOccurring = true; if (canClearEvent) { Main.bloodMoon = false; } } if (Main.raining) { eventOccurring = true; if (canClearEvent) { Main.raining = false; } } if (Main.slimeRain) { eventOccurring = true; if (canClearEvent) { Main.StopSlimeRain(); Main.slimeWarningDelay = 1; Main.slimeWarningTime = 1; } } if (BirthdayParty.PartyIsUp) { eventOccurring = true; if (canClearEvent) { BirthdayParty.WorldClear(); } } if (DD2Event.Ongoing) { eventOccurring = true; if (canClearEvent) { DD2Event.StopInvasion(); } } if (Sandstorm.Happening) { eventOccurring = true; if (canClearEvent) { Sandstorm.Happening = false; Sandstorm.TimeLeft = 0; } } if (NPC.LunarApocalypseIsUp || NPC.ShieldStrengthTowerNebula > 0 || NPC.ShieldStrengthTowerSolar > 0 || NPC.ShieldStrengthTowerStardust > 0 || NPC.ShieldStrengthTowerVortex > 0) { eventOccurring = true; if (canClearEvent) { NPC.LunarApocalypseIsUp = false; NPC.ShieldStrengthTowerNebula = 0; NPC.ShieldStrengthTowerSolar = 0; NPC.ShieldStrengthTowerStardust = 0; NPC.ShieldStrengthTowerVortex = 0; // Purge all towers for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && (Main.npc[i].type == NPCID.LunarTowerNebula || Main.npc[i].type == NPCID.LunarTowerSolar || Main.npc[i].type == NPCID.LunarTowerStardust || Main.npc[i].type == NPCID.LunarTowerVortex)) { Main.npc[i].dontTakeDamage = false; Main.npc[i].GetGlobalNPC <FargoGlobalNPC>().NoLoot = true; Main.npc[i].StrikeNPCNoInteraction(int.MaxValue, 0f, 0); } } } } foreach (MutantSummonInfo summon in summonTracker.EventSummons) { if ((bool)ModLoader.GetMod(summon.modSource).Call("AbominationnClearEvents", canClearEvent)) { eventOccurring = true; } } if (eventOccurring && canClearEvent) { FargoWorld.AbomClearCD = 7200; } return(eventOccurring && canClearEvent); }
public override void NPCLoot(NPC npc) { Player player = Main.player[Main.myPlayer]; //lumber jaxe if (npc.FindBuffIndex(mod.BuffType("WoodDrop")) != -1) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Wood, Main.rand.Next(10, 30)); } if (npc.type == NPCID.GreekSkeleton && Main.rand.Next(15) == 0) { int i = Main.rand.Next(3); switch (i) { case 0: Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GladiatorHelmet); break; case 1: Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GladiatorBreastplate); break; default: Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GladiatorLeggings); break; } } else if (npc.type == NPCID.Clown) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bananarang); } else if (npc.type == NPCID.Merchant) { if (Main.rand.Next(8) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MiningShirt); Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MiningPants); } } else if (npc.type == NPCID.Nurse) { if (Main.rand.Next(5) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LifeCrystal); } } else if (npc.type == NPCID.Demolitionist) { if (Main.rand.Next(2) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Dynamite, 5); } } else if (npc.type == NPCID.Dryad) { if (Main.rand.Next(3) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HerbBag); } } else if (npc.type == NPCID.DD2Bartender) { if (Main.rand.Next(2) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ale, 4); } } else if (npc.type == NPCID.ArmsDealer) { if (Main.rand.Next(4) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrystalBullet, 30); } } else if (npc.type == NPCID.Painter) { if (NPC.AnyNPCs(NPCID.MoonLordCore)) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EchPainting")); } } else if (npc.type == NPCID.Angler) { if (Main.rand.Next(4) == 0) { int[] drops = { ItemID.FishermansGuide, ItemID.Sextant, ItemID.WeatherRadio }; Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, drops[Main.rand.Next(drops.Length)]); } } else if (npc.type == NPCID.Clothier) { if (Main.rand.Next(20) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Skull); } } else if (npc.type == NPCID.Mechanic) { if (Main.rand.Next(5) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Wire, 40); } } else if (npc.type == NPCID.Wizard) { if (Main.rand.Next(5) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FallenStar, 5); } } else if (npc.type == NPCID.TaxCollector) { if (Main.rand.Next(8) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldCoin, 10); } } else if (npc.type == NPCID.Truffle) { if (Main.rand.Next(8) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MushroomStatue); } } else if (npc.type == NPCID.GoblinTinkerer) { if (Main.rand.Next(10) == 0) { Item.NewItem(npc.position, npc.Size, mod.ItemType("GoblinHead"), 1, false, 0, false, false); } } else if (npc.type == NPCID.DD2OgreT3 && !DD2Event.Ongoing) { if (Main.rand.Next(14) == 0) { Item.NewItem(npc.position, npc.Size, 3865, 1, false, 0, false, false); } if (Main.rand.Next(6) == 0) { Item.NewItem(npc.position, npc.Size, (int)Utils.SelectRandom <short>(Main.rand, new short[] { 3809, 3811, 3810, 3812 }), 1, false, 0, false, false); } if (Main.rand.Next(6) == 0) { Item.NewItem(npc.position, npc.Size, (int)Utils.SelectRandom <short>(Main.rand, new short[] { 3852, 3854, 3823, 3835, 3836 }), 1, false, 0, false, false); } if (Main.rand.Next(10) == 0) { Item.NewItem(npc.position, npc.Size, 3856, 1, false, 0, false, false); } } else if (npc.type == NPCID.DD2DarkMageT3 && !DD2Event.Ongoing) { if (Main.rand.Next(14) == 0) { Item.NewItem(npc.position, npc.Size, 3864, 1, false, 0, false, false); } if (Main.rand.Next(10) == 0) { if (Main.rand.Next(2) == 0) { Item.NewItem(npc.position, npc.Size, 3815, 4, false, 0, false, false); } else { Item.NewItem(npc.position, npc.Size, 3814, 1, false, 0, false, false); } } if (Main.rand.Next(6) == 0) { Item.NewItem(npc.position, npc.Size, (int)Utils.SelectRandom <short>(Main.rand, new short[] { 3857, 3855 }), 1, false, 0, false, false); } if (DD2Event.ShouldDropCrystals()) { Item.NewItem(npc.position, npc.Size, 3822, 1, false, 0, false, false); } } else if (npc.type == NPCID.Raven && !Main.halloween) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoodieBag); } else if (npc.type == NPCID.SlimeRibbonRed && !Main.xMas) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Present); } else if (npc.type == NPCID.BloodZombie && Main.rand.Next(200) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Main.rand.Next(2) == 0 ? ItemID.BladedGlove : ItemID.BloodyMachete); } }
public override void NPCLoot(NPC npc) { // Lumber Jaxe if (npc.FindBuffIndex(mod.BuffType("WoodDrop")) != -1) { Item.NewItem(npc.Hitbox, ItemID.Wood, Main.rand.Next(10, 30)); } switch (npc.type) { // Avoid lunar event with cultist summon case NPCID.CultistBoss: if (!PillarSpawn) { for (int i = 0; i < Main.maxNPCs; i++) { NPC npc2 = Main.npc[i]; NPC.LunarApocalypseIsUp = false; if (npc2.type == NPCID.LunarTowerNebula || npc2.type == NPCID.LunarTowerSolar || npc2.type == NPCID.LunarTowerStardust || npc2.type == NPCID.LunarTowerVortex) { NPC.TowerActiveSolar = true; npc2.active = false; } NPC.TowerActiveSolar = false; } } break; case NPCID.GreekSkeleton: if (Main.rand.NextBool(15)) { int i = Main.rand.Next(3); switch (i) { case 0: Item.NewItem(npc.Hitbox, ItemID.GladiatorHelmet); break; case 1: Item.NewItem(npc.Hitbox, ItemID.GladiatorBreastplate); break; default: Item.NewItem(npc.Hitbox, ItemID.GladiatorLeggings); break; } } break; case NPCID.Merchant: if (Main.rand.NextBool(8)) { Item.NewItem(npc.Hitbox, ItemID.MiningShirt); Item.NewItem(npc.Hitbox, ItemID.MiningPants); } break; case NPCID.Nurse: if (Main.rand.NextBool(5)) { Item.NewItem(npc.Hitbox, ItemID.LifeCrystal); } break; case NPCID.Demolitionist: if (Main.rand.NextBool(2)) { Item.NewItem(npc.Hitbox, ItemID.Dynamite, 5); } break; case NPCID.Dryad: if (Main.rand.NextBool(3)) { Item.NewItem(npc.Hitbox, ItemID.HerbBag); } break; case NPCID.DD2Bartender: if (Main.rand.NextBool(2)) { Item.NewItem(npc.Hitbox, ItemID.Ale, 4); } break; case NPCID.ArmsDealer: if (Main.rand.NextBool(4)) { Item.NewItem(npc.Hitbox, ItemID.NanoBullet, 30); } break; case NPCID.Painter: if (NPC.AnyNPCs(NPCID.MoonLordCore)) { Item.NewItem(npc.Hitbox, mod.ItemType("EchPainting")); } break; case NPCID.Angler: if (Main.rand.NextBool(4)) { int[] drops = { ItemID.FishermansGuide, ItemID.Sextant, ItemID.WeatherRadio }; Item.NewItem(npc.Hitbox, Main.rand.Next(drops)); } break; case NPCID.Clothier: if (Main.rand.NextBool(20)) { Item.NewItem(npc.Hitbox, ItemID.Skull); } break; case NPCID.Mechanic: if (Main.rand.NextBool(5)) { Item.NewItem(npc.Hitbox, ItemID.Wire, 40); } break; case NPCID.Wizard: if (Main.rand.NextBool(5)) { Item.NewItem(npc.Hitbox, ItemID.FallenStar, 5); } break; case NPCID.TaxCollector: if (Main.rand.NextBool(8)) { Item.NewItem(npc.Hitbox, ItemID.GoldCoin, 10); } break; case NPCID.Truffle: if (Main.rand.NextBool(8)) { Item.NewItem(npc.Hitbox, ItemID.MushroomStatue); } break; case NPCID.GoblinTinkerer: if (Main.rand.NextBool(10)) { Item.NewItem(npc.Hitbox, mod.ItemType("GoblinHead")); } break; case NPCID.DD2OgreT3: FargoWorld.DownedBools["ogre"] = true; if (!DD2Event.Ongoing) { if (Main.rand.NextBool(14)) { Item.NewItem(npc.Hitbox, ItemID.BossMaskOgre); } if (Main.rand.NextBool(6)) { Item.NewItem(npc.Hitbox, Main.rand.Next(new short[] { ItemID.ApprenticeScarf, ItemID.SquireShield, ItemID.HuntressBuckler, ItemID.MonkBelt })); } if (Main.rand.NextBool(6)) { Item.NewItem(npc.Hitbox, Main.rand.Next(new short[] { ItemID.DD2SquireDemonSword, ItemID.MonkStaffT1, ItemID.MonkStaffT2, ItemID.BookStaff, ItemID.DD2PhoenixBow })); } if (Main.rand.NextBool(10)) { Item.NewItem(npc.Hitbox, ItemID.DD2PetGhost); } } break; case NPCID.DD2DarkMageT3: FargoWorld.DownedBools["darkMage3"] = true; if (!DD2Event.Ongoing) { if (Main.rand.NextBool(14)) { Item.NewItem(npc.Hitbox, ItemID.BossMaskDarkMage); } if (Main.rand.NextBool(10)) { if (Main.rand.NextBool(2)) { Item.NewItem(npc.Hitbox, ItemID.WarTableBanner); } else { Item.NewItem(npc.Hitbox, ItemID.WarTable); } } if (Main.rand.NextBool(6)) { Item.NewItem(npc.Hitbox, Main.rand.Next(new short[] { ItemID.DD2PetGato, ItemID.DD2PetDragon })); } if (DD2Event.ShouldDropCrystals()) { Item.NewItem(npc.Hitbox, ItemID.DD2EnergyCrystal); } } break; case NPCID.Raven: if (!Main.halloween) { Item.NewItem(npc.Hitbox, ItemID.GoodieBag); } break; case NPCID.SlimeRibbonRed: if (!Main.xMas) { Item.NewItem(npc.Hitbox, ItemID.Present); } break; case NPCID.BloodZombie: if (Main.rand.NextBool(200)) { Item.NewItem(npc.Hitbox, Main.rand.NextBool(2) ? ItemID.BladedGlove : ItemID.BloodyMachete); } break; case NPCID.Clown: Item.NewItem(npc.Hitbox, ItemID.Bananarang); FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["clown"] = true; break; case NPCID.BlueSlime: if (npc.netID == NPCID.Pinky) { FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["pinky"] = true; } break; case NPCID.UndeadMiner: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["undeadMiner"] = true; break; case NPCID.Tim: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["tim"] = true; break; case NPCID.DoctorBones: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["doctorBones"] = true; break; case NPCID.Mimic: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mimic"] = true; break; case NPCID.WyvernHead: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["wyvern"] = true; break; case NPCID.RuneWizard: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["runeWizard"] = true; break; case NPCID.Nymph: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["nymph"] = true; break; case NPCID.Moth: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["moth"] = true; break; case NPCID.RainbowSlime: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["rainbowSlime"] = true; break; case NPCID.Paladin: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["paladin"] = true; break; case NPCID.Medusa: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["medusa"] = true; break; case NPCID.IceGolem: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["iceGolem"] = true; break; case NPCID.SandElemental: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["sandElemental"] = true; break; case NPCID.Mothron: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mothron"] = true; break; case NPCID.BigMimicCorruption: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mimicCorrupt"] = true; break; case NPCID.BigMimicHallow: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mimicHallow"] = true; break; case NPCID.BigMimicCrimson: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mimicCrimson"] = true; break; case NPCID.BigMimicJungle: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["mimicJungle"] = true; break; case NPCID.GoblinSummoner: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["goblinSummoner"] = true; break; case NPCID.PirateShip: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["flyingDutchman"] = true; break; case NPCID.DungeonSlime: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["dungeonSlime"] = true; break; case NPCID.PirateCaptain: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["pirateCaptain"] = true; break; case NPCID.SkeletonSniper: case NPCID.TacticalSkeleton: case NPCID.SkeletonCommando: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["skeletonGun"] = true; break; case NPCID.Necromancer: case NPCID.NecromancerArmored: case NPCID.DiabolistRed: case NPCID.DiabolistWhite: case NPCID.RaggedCaster: case NPCID.RaggedCasterOpenCoat: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["skeletonMage"] = true; break; case NPCID.BoneLee: FargoWorld.DownedBools["rareEnemy"] = true; FargoWorld.DownedBools["boneLee"] = true; break; case NPCID.HeadlessHorseman: FargoWorld.DownedBools["headlessHorseman"] = true; break; default: break; } }