public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!NpcMod.HasMetGuardian(GuardianID, GuardianModID) && !NpcMod.HasGuardianNPC(GuardianID, GuardianModID) && !NPC.AnyNPCs(npc.type) && (Main.dayTime && !Main.eclipse && Main.time < 9 * 3600 && CanSpawnGreen())) { bool HasTree = false; for (int y = 0; y >= -4; y--) { for (int x = -2; x < 3; x++) { int TileX = spawnInfo.spawnTileX + x, TileY = spawnInfo.spawnTileY + y; int TreeSize = 0; while (Main.tile[TileX, TileY].active() && Main.tile[TileX, TileY].type == Terraria.ID.TileID.Trees) { TreeSize++; TileY--; } if (TreeSize >= 9) { HasTree = true; } } } if (HasTree) { return(1f / 35); } } return(0); }
public static void TrySpawningMichelle() { if (NpcMod.HasMetGuardian(GuardianBase.Michelle) || WorldMod.IsGuardianNpcInWorld(GuardianBase.Michelle)) { return; } if (Main.fastForwardTime || Main.eclipse || !Main.dayTime || Main.time >= 27000 || Main.time % 60 > 0) { return; } if (Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0) { return; } if (Main.rand.Next(17) == 0) { bool HasPlayerWithDefense = false; for (int p = 0; p < 255; p++) { if (Main.player[p].active && Main.player[p].statDefense > 0) { HasPlayerWithDefense = true; break; } } if (HasPlayerWithDefense) { NpcMod.SpawnGuardianNPC(Main.spawnTileX * 16, Main.spawnTileY * 16, GuardianBase.Michelle); //NPC.NewNPC(Main.spawnTileX * 16, Main.spawnTileY * 16, ModContent.NPCType<MichelleGuardian>()); Main.NewText("Michelle has logged in.", 255, 255, 0); } } }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { bool MaySpawn = !spawnInfo.water && !NpcMod.HasMetGuardian(1) && !NpcMod.HasGuardianNPC(1) && !NPC.AnyNPCs(npc.type); //return 0; return(MaySpawn ? 1 : 0f); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && !NpcMod.HasGuardianNPC(GuardianID) && !NpcMod.HasMetGuardian(GuardianID) && spawnInfo.player.ZoneMeteor && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && !NPC.AnyNPCs(ModContent.NPCType <SmellyNPC>())) { return(1f / 6); } return(0); }
public static void TrySpawningMabel() { if (Cooldown > 0) { Cooldown--; return; } Cooldown = Main.rand.Next(180, 601) * 30; if (NpcMod.HasMetGuardian(8) || Main.eclipse || !Main.dayTime || !CanSpawnMabel) { return; } if (Main.rand.Next(5) == 0) { int TileX = (int)(Main.player[Main.myPlayer].Center.X / 16) + Main.rand.Next(-10, 11), TileY = (int)(Main.player[Main.myPlayer].Center.Y / 16); if (Main.tile[TileX, TileY].active() && Main.tileSolid[Main.tile[TileX, TileY].type]) { return; } while (!Main.tile[TileX, TileY + 1].active() || !Main.tileSolid[Main.tile[TileX, TileY + 1].type]) { TileY++; if (TileY >= Main.worldSurface + 20) { return; } } switch (Main.tile[TileX, TileY + 1].type) { default: return; case Terraria.ID.TileID.Dirt: case Terraria.ID.TileID.ClayBlock: case Terraria.ID.TileID.Sand: case Terraria.ID.TileID.Mud: case Terraria.ID.TileID.Grass: case Terraria.ID.TileID.CorruptGrass: case Terraria.ID.TileID.FleshGrass: case Terraria.ID.TileID.HallowedGrass: case Terraria.ID.TileID.JungleGrass: case Terraria.ID.TileID.MushroomGrass: break; } for (int y = 1; y < 65; y++) { int ty = TileY - y; if (Main.tile[TileX, ty].active() && Main.tileSolid[Main.tile[TileX, ty].type]) { return; } } NPC.NewNPC(TileX * 16, TileY * 16, ModContent.NPCType <MabelNPC>()); } }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && !NpcMod.HasBossSpawned && ((spawnInfo.player.position.Y < Main.worldSurface * 16 && !Main.dayTime && !Main.bloodMoon && !Main.pumpkinMoon && !Main.snowMoon && Main.invasionSize == 0) || (spawnInfo.player.position.Y >= Main.worldSurface * 16)) && !spawnInfo.playerSafe && !spawnInfo.playerInTown && CanGhostFoxSpawn(spawnInfo.player) && !NpcMod.HasMetGuardian(16) && !NpcMod.HasGuardianNPC(16) && !NPC.AnyNPCs(npc.type)) { for (int n = 0; n < 200; n++) { if (Main.npc[n].active && Terraria.ID.NPCID.Sets.TechnicallyABoss[n]) { return(0); } } return(GetSpawnRate); } return(0f); }
public static void UpdateTombstoneScript() { if (TombstoneTileX > 0 && !NpcMod.HasMetGuardian(5) && !NPC.AnyNPCs(ModContent.NPCType <Npcs.AlexNPC>())) { NPC.NewNPC(TombstoneTileX * 16, TombstoneTileY * 16, ModContent.NPCType <Npcs.AlexNPC>()); } if (TombstoneTileX == 0) { if (TombstonePlacementAttemptTime++ >= 200) { TombstonePlacementAttemptTime = 200; if (!NpcMod.HasMetGuardian(GuardianBase.Alex)) { TrySpawningTombstone(); } } } }
public static void InitializeRequestRewards() { RequestRewards.Clear(); AddRequestReward(ModContent.ItemType <Items.Consumable.EtherHeart>(), AcquisitionChance: 0.333f).CanGetReward = EtherItemRequirement; AddRequestReward(ItemID.LifeCrystal, AcquisitionChance: 0.2f); AddRequestReward(ModContent.ItemType <Items.Consumable.EtherHeart>(), AcquisitionChance : 0.333f).CanGetReward = delegate(Player player, GuardianData gd) { return(!MainMod.NoEtherItems && Main.hardMode && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && gd.Base.IsTerraGuardian); }; AddRequestReward(ItemID.LifeFruit, AcquisitionChance : 0.2f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); }; AddRequestReward(ModContent.ItemType <Items.Consumable.SkillResetPotion>(), AcquisitionChance: 0.667f); AddRequestReward(ModContent.ItemType <Items.Misc.Note>(), AcquisitionChance : 0.01f).CanGetReward = delegate(Player player, GuardianData gd){ return(!NpcMod.HasMetGuardian(GuardianBase.Daphne)); }; AddRequestReward(ItemID.WoodenCrate, AcquisitionChance: 0.625f); AddRequestReward(ItemID.IronCrate, AcquisitionChance: 0.390625f); AddRequestReward(ItemID.GoldenCrate, AcquisitionChance: 0.09765625f); AddRequestReward(ItemID.CorruptFishingCrate, AcquisitionChance: 0.05f); AddRequestReward(ItemID.HallowedFishingCrate, AcquisitionChance : 0.05f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode); }; AddRequestReward(ItemID.JungleFishingCrate, AcquisitionChance : 0.05f).CanGetReward = delegate(Player player, GuardianData gd) { return(NPC.downedQueenBee); }; AddRequestReward(ItemID.DungeonFishingCrate, AcquisitionChance : 0.05f).CanGetReward = delegate(Player player, GuardianData gd) { return(NPC.downedBoss3); }; AddRequestReward(ItemID.FloatingIslandFishingCrate, AcquisitionChance: 0.05f); AddRequestReward(ItemID.CookedFish, 3, AcquisitionChance: 0.125f); AddRequestReward(ItemID.BowlofSoup, 3, AcquisitionChance: 0.125f); AddRequestReward(364, Main.rand.Next(65, 86), 0.45f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 == 107); }; AddRequestReward(365, Main.rand.Next(50, 66), 0.35f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 == 108); }; AddRequestReward(366, Main.rand.Next(40, 56), 0.25f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 == 111); }; AddRequestReward(1104, Main.rand.Next(65, 86), 0.45f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 != 107); }; AddRequestReward(1105, Main.rand.Next(50, 66), 0.35f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 != 108); }; AddRequestReward(1106, Main.rand.Next(40, 56), 0.25f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && WorldGen.oreTier1 != 111); }; AddRequestReward(ItemID.ChlorophyteOre, Main.rand.Next(35, 86), 0.35f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); }; AddRequestReward(ItemID.LunarOre, Main.rand.Next(45, 96), 0.7f).CanGetReward = delegate(Player player, GuardianData gd) { return(Main.hardMode && NPC.downedMoonlord); }; AddRequestReward(ItemID.DemoniteOre, Main.rand.Next(20, 41), 0.6f).CanGetReward = delegate(Player player, GuardianData gd) { return(!Main.hardMode && !WorldGen.crimson && (NPC.downedBoss1 || NPC.downedBoss2)); }; AddRequestReward(ItemID.CrimtaneOre, Main.rand.Next(20, 41), 0.6f).CanGetReward = delegate(Player player, GuardianData gd) { return(!Main.hardMode && WorldGen.crimson && (NPC.downedBoss1 || NPC.downedBoss2)); }; AddRequestReward(ItemID.Hellstone, Main.rand.Next(30, 51), 0.55f).CanGetReward = delegate(Player player, GuardianData gd) { return(!Main.hardMode && NPC.downedBoss2); }; AddRequestReward(ItemID.Obsidian, Main.rand.Next(30, 51), 0.55f).CanGetReward = delegate(Player player, GuardianData gd) { return(!Main.hardMode && NPC.downedBoss2); }; AddRequestReward(ItemID.Bass, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; AddRequestReward(ItemID.ArmoredCavefish, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; AddRequestReward(ItemID.AtlanticCod, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; AddRequestReward(ItemID.CrimsonTigerfish, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; AddRequestReward(ItemID.Ebonkoi, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; AddRequestReward(ItemID.Tuna, 3, 0.66f).CanGetReward = CompanionHasFishingGearRequirement; //Boss spawners AddRequestReward(ItemID.SuspiciousLookingEye, 1, 0.1f); AddRequestReward(ItemID.WormFood, 1, 0.1f).CanGetReward = RequestContainer.CorruptWorldAndBossKilledRequirement; AddRequestReward(ItemID.BloodySpine, 1, 0.1f).CanGetReward = RequestContainer.CorruptWorldAndBossKilledRequirement; AddRequestReward(ItemID.SlimeCrown, 1, 0.1f).CanGetReward = RequestContainer.KingSlimeKillRequirement; AddRequestReward(ItemID.Abeemination, 1, 0.1f).CanGetReward = RequestContainer.QueenBeeKillRequirement; // AddRequestReward(ItemID.MechanicalSkull, 1, 0.1f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.MechanicalWorm, 1, 0.1f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.MechanicalEye, 1, 0.1f).CanGetReward = RequestContainer.HardmodeRequirement; // AddRequestReward(ItemID.LihzahrdPowerCell, 1, 0.1f).CanGetReward = RequestContainer.GolemKillRequirement; AddRequestReward(ItemID.CelestialSigil, 1, 0.1f).CanGetReward = RequestContainer.LunaticCultistKillRequirement; //Good Loot AddRequestReward(ItemID.SlimeStaff, 1, 0.01f); AddRequestReward(ItemID.Arkhalis, 1, 0.1f); AddRequestReward(ItemID.EnchantedSword, 1, 0.01f); AddRequestReward(ItemID.StylistKilLaKillScissorsIWish, 1, 0.01f).CanGetReward = FemaleQuestGiverRequirement; AddRequestReward(ItemID.CandyCaneSword, 1, 0.01f).CanGetReward = RequestContainer.XmasRequirement; AddRequestReward(ItemID.RedRyder, 1, 0.01f).CanGetReward = RequestContainer.XmasRequirement; AddRequestReward(ItemID.BladedGlove, 1, 0.01f).CanGetReward = RequestContainer.HalloweenRequirement; AddRequestReward(ItemID.Muramasa, 1, 0.01f).CanGetReward = RequestContainer.SkeletronKillRequirement; AddRequestReward(ItemID.FieryGreatsword, 1, 0.01f).CanGetReward = RequestContainer.EvilBossKillRequirement; AddRequestReward(ItemID.NightsEdge, 1, 0.01f).CanGetReward = RequestContainer.SkeletronKillRequirement; AddRequestReward(ItemID.BladeofGrass, 1, 0.01f).CanGetReward = RequestContainer.AnyFirstBossKillRequirement; AddRequestReward(ItemID.BeamSword, 1, 0.01f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.Bladetongue, 1, 0.01f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.Toxikarp, 1, 0.01f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.CrystalSerpent, 1, 0.01f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.Sunfury, 1, 0.01f).CanGetReward = RequestContainer.SkeletronKillRequirement; AddRequestReward(ItemID.Sunflower, 1, 0.01f).CanGetReward = RequestContainer.SkeletronKillRequirement; AddRequestReward(ItemID.HellwingBow, 1, 0.01f).CanGetReward = RequestContainer.SkeletronKillRequirement; AddRequestReward(ItemID.Boomstick, 1, 0.01f).CanGetReward = RequestContainer.AnyFirstBossKillRequirement; AddRequestReward(ItemID.AleThrowingGlove, 1, 0.01f); AddRequestReward(ItemID.PartyGirlGrenade, 1, 0.01f); AddRequestReward(ItemID.PainterPaintballGun, 1, 0.01f); //Potions AddRequestReward(ItemID.LesserHealingPotion, 5, 0.25f); AddRequestReward(ItemID.HealingPotion, 5, 0.5f); AddRequestReward(ItemID.GreaterHealingPotion, 5, 0.5f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.SuperHealingPotion, 5, 0.5f).CanGetReward = RequestContainer.LunaticCultistKillRequirement; AddRequestReward(ItemID.LesserManaPotion, 5, 0.25f); AddRequestReward(ItemID.ManaPotion, 5, 0.5f); AddRequestReward(ItemID.GreaterManaPotion, 5, 0.5f).CanGetReward = RequestContainer.HardmodeRequirement; AddRequestReward(ItemID.SuperManaPotion, 5, 0.5f).CanGetReward = RequestContainer.LunaticCultistKillRequirement; //Buff Potions AddRequestReward(ItemID.ArcheryPotion, 3, 0.1f); AddRequestReward(ItemID.BattlePotion, 3, 0.1f); AddRequestReward(ItemID.CalmingPotion, 3, 0.1f); AddRequestReward(ItemID.CratePotion, 3, 0.1f); AddRequestReward(ItemID.TrapsightPotion, 3, 0.1f); AddRequestReward(ItemID.EndurancePotion, 3, 0.1f); AddRequestReward(ItemID.GillsPotion, 3, 0.1f); AddRequestReward(ItemID.GravitationPotion, 3, 0.05f); AddRequestReward(ItemID.HunterPotion, 3, 0.1f); AddRequestReward(ItemID.InfernoPotion, 3, 0.05f); AddRequestReward(ItemID.IronskinPotion, 3, 0.1f); AddRequestReward(ItemID.LifeforcePotion, 3, 0.05f); AddRequestReward(ItemID.NightOwlPotion, 3, 0.1f); AddRequestReward(ItemID.ObsidianSkinPotion, 3, 0.1f); AddRequestReward(ItemID.RagePotion, 3, 0.1f); AddRequestReward(ItemID.RegenerationPotion, 3, 0.1f); AddRequestReward(ItemID.ShinePotion, 3, 0.1f); AddRequestReward(ItemID.SpelunkerPotion, 3, 0.1f); AddRequestReward(ItemID.SwiftnessPotion, 3, 0.1f); AddRequestReward(ItemID.TitanPotion, 3, 0.1f); AddRequestReward(ItemID.WaterWalkingPotion, 3, 0.1f); AddRequestReward(ItemID.WrathPotion, 3, 0.1f); }
public static void TrySpawningBrutus() { if (Main.netMode == 1 || NpcMod.HasMetGuardian(6, "") || WorldMod.IsGuardianNpcInWorld(GuardianBase.Brutus)) { return; } const int SpawnTime = 3 * 3600; if (Main.fastForwardTime || Main.eclipse || !Main.dayTime || (Main.time < SpawnTime || WorldMod.LastTime >= 7.5)) { return; } if (Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0) { return; } int NpcCount = (int)(NpcMod.GetCompanionNPCCount() * 0.5f); for (int n = 0; n < 200; n++) { if (Main.npc[n].active && Main.npc[n].townNPC) { NpcCount++; } } if (NpcCount < TownNpcsForBrutusToBeginAppearing) { return; } int SpawnChance = 20 - ChanceCounter() / 2; if (SpawnChance > 0 && Main.rand.Next(SpawnChance) > (NpcCount - TownNpcsForBrutusToBeginAppearing) * 0.5f) { return; } List <int> NpcsToSpawnOn = new List <int>(); for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <BrutusNPC>()) { return; } if (Main.npc[i].active && Main.npc[i].townNPC && !Main.npc[i].homeless && Main.npc[i].type != 37) { byte PickedPlayer = Player.FindClosest(Main.npc[i].position, Main.npc[i].width, Main.npc[i].height); if (Math.Abs(Main.player[PickedPlayer].Center.X - Main.npc[i].Center.X) >= NPC.sWidth * 0.5f || Math.Abs(Main.player[PickedPlayer].Center.Y - Main.npc[i].Center.Y) >= NPC.sHeight * 0.5f) { NpcsToSpawnOn.Add(i); } } } if (NpcsToSpawnOn.Count == 0) { return; } int PickedNPC = NpcsToSpawnOn[Main.rand.Next(NpcsToSpawnOn.Count)]; int SpawnPosX = (int)Main.npc[PickedNPC].Center.X, SpawnPosY = (int)(Main.npc[PickedNPC].position.Y + Main.npc[PickedNPC].height); int npcPos = NPC.NewNPC(SpawnPosX, SpawnPosY, ModContent.NPCType <BrutusNPC>()); string Text = "<Brutus> *If someone is interessed in having a body guard, come see me near " + Main.npc[PickedNPC].GivenOrTypeName + ".*"; if (Main.netMode == 0) { Main.NewText(Text, MainMod.MysteryCloseColor); } else { NetMessage.SendData(25, -1, -1, Terraria.Localization.NetworkText.FromLiteral(Text), MainMod.MysteryCloseColor.R, MainMod.MysteryCloseColor.G, MainMod.MysteryCloseColor.B, 255); } WarnedAboutBrutus = true; }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && !spawnInfo.playerInTown && !NpcMod.HasGuardianNPC(GuardianID) && !NpcMod.HasMetGuardian(GuardianID) && CanSpawnDomino(spawnInfo.player) && !NPC.AnyNPCs(ModContent.NPCType <DominoNPC>())) { return(0.00390625f); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (CanSpawnMe() && Main.dayTime && Main.invasionSize == 0 && !Main.eclipse && spawnInfo.player.ZoneOverworldHeight && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && !Main.slimeRain && !NPC.AnyNPCs(ModContent.NPCType <MiguelNPC>()) && !NpcMod.HasGuardianNPC(GuardianID) && !NpcMod.HasMetGuardian(GuardianID)) { return(1f / 200); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && Main.dayTime && !NpcMod.HasGuardianNPC(7) && !NpcMod.HasMetGuardian(7) && BreeMaySpawn && Main.time > 27000 && Main.time < 48600 && !NPC.AnyNPCs(ModContent.NPCType <BreeNPC>())) { return((float)(Main.time - 27000) / 432000 * 0.333f); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY].wall == 0 && PlayerMod.GetTerraGuardianCompanionsFound(spawnInfo.player) > 0 && Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY].wall == 0 && spawnInfo.playerInTown && Main.dayTime && !spawnInfo.water && !NpcMod.HasMetGuardian(GuardianBase.Luna) && !NpcMod.HasGuardianNPC(GuardianBase.Luna) && !PlayerMod.PlayerHasGuardianSummoned(spawnInfo.player, GuardianBase.Luna)) { return(1f); } return(0); }
public static void CilleSpawningScripts() { const byte CheckDelayTime = 150; const int CilleID = GuardianBase.Cille; CilleSpawnCheckDelay++; if (CilleSpawnCheckDelay < CheckDelayTime) { return; } CilleSpawnCheckDelay -= CheckDelayTime; if (Main.rand.Next(7) > 0) { return; } if (!NpcMod.HasMetGuardian(CilleID) || NPC.AnyNPCs(ModContent.NPCType <Npcs.CilleNPC>())) { return; } if (NpcMod.HasGuardianNPC(CilleID)) { TerraGuardian tg = NpcMod.GetGuardianNPCCharacter(CilleID); if (tg.FriendshipLevel >= tg.Base.MoveInLevel) { return; } for (int i = 0; i < 255; i++) { if (Main.player[i].active && Math.Abs(tg.Position.X - Main.player[i].Center.X) < 2000 && Math.Abs(tg.Position.Y - Main.player[i].Center.Y) < 1600) { return; } } } if (CilleShelterX == -1 && CilleShelterY == -1) { int Left = (int)(Main.leftWorld * (1f / 16) + 130), Right = (int)(Main.rightWorld * (1f / 16) - 130); int Top = (int)(Main.worldSurface * 0.35f), Bottom = (int)(Main.worldSurface); int PositionX = Main.rand.Next(Left, Right), PositionY = Main.rand.Next(Top, Bottom); Tile tile = Framing.GetTileSafely(PositionX, PositionY); if (tile == null || (tile.active() && Main.tileSolid[tile.type]) || tile.wall > 0) { return; } { byte Counter = 0; while (!tile.active() || !Main.tileSolid[tile.type]) { PositionY++; tile = Framing.GetTileSafely(PositionX, PositionY); if (Counter++ >= 250) { return; } } } tile = Framing.GetTileSafely(PositionX, PositionY); switch (tile.type) { case Terraria.ID.TileID.CorruptGrass: case Terraria.ID.TileID.Ebonstone: case Terraria.ID.TileID.Ebonsand: case Terraria.ID.TileID.FleshGrass: case Terraria.ID.TileID.Crimtane: case Terraria.ID.TileID.Crimsand: case Terraria.ID.TileID.LeafBlock: case Terraria.ID.TileID.LivingWood: case Terraria.ID.TileID.BlueDungeonBrick: case Terraria.ID.TileID.GreenDungeonBrick: case Terraria.ID.TileID.PinkDungeonBrick: return; } PositionY--; tile = Framing.GetTileSafely(PositionX, PositionY); if (tile.wall > 0) { return; } for (int i = 0; i < 255; i++) { if (Main.player[i].active) { if (Math.Abs(Main.player[i].Center.X - PositionX * 16) < 1000 && Math.Abs(Main.player[i].Center.Y - PositionY * 16) < 1000) { return; } } if (i < 200 && Main.npc[i].active) { if (Math.Abs(Main.npc[i].Center.X - PositionX * 16) < 1000 && Math.Abs(Main.npc[i].Center.Y - PositionY * 16) < 800) { return; } } } int HouseBottom; if (!TryPlacingCilleHouse(PositionX, PositionY, out HouseBottom)) { return; } CilleShelterX = PositionX; CilleShelterY = HouseBottom; /*if (!NpcMod.HasGuardianNPC(CilleID)) * { * NpcMod.SpawnGuardianNPC(PositionX * 16, PositionY * 16, CilleID); * } * else * { * TerraGuardian Cille = NpcMod.GetGuardianNPCCharacter(CilleID); * Cille.Position.X = PositionX * 16; * Cille.Position.Y = PositionY * 16; * Cille.SetFallStart(); * }*/ WorldMod.TrySpawningOrMovingGuardianNPC(CilleID, "", CilleShelterX, CilleShelterY, true, true); } else { if (!NpcMod.HasGuardianNPC(CilleID)) { if (!WorldMod.CanGuardianNPCSpawnInTheWorld(CilleID)) { if (Main.dayTime && Main.moonPhase != 4) { List <WorldMod.GuardianTownNpcState> TownNpcsAtThisHouse = WorldMod.GetGuardianLivingHere(CilleShelterX, CilleShelterY); foreach (WorldMod.GuardianTownNpcState tg in TownNpcsAtThisHouse) { if (!tg.CharID.IsSameID(CilleID)) { tg.Homeless = true; tg.HomeX = tg.HomeY = -1; } } if (WorldMod.TrySpawningOrMovingGuardianNPC(CilleID, "", CilleShelterX, CilleShelterY, true, true)) { //NpcMod.SpawnGuardianNPC(CilleShelterX * 16, CilleShelterY * 16, CilleID); } else { CilleShelterX = CilleShelterY = -1; } } } } else { /*if (!Main.dayTime && !WorldMod.CanGuardianNPCSpawnInTheWorld(CilleID)) * { * WorldMod.GuardianTownNpcState townnpc = CilleGuardian.GetTownNpcInfo; * if (townnpc != null) * { * townnpc.Homeless = true; * } * }*/ } } }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && !NpcMod.HasGuardianNPC(GuardianBase.Alexander) && !NpcMod.HasMetGuardian(GuardianBase.Alexander) && AlexanderConditionMet && spawnInfo.player.ZoneDungeon && !NPC.AnyNPCs(ModContent.NPCType <AlexanderNPC>())) { return(1f / 500); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.water && Main.dayTime && spawnInfo.player.townNPCs == 0 && GlennCanSpawn && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && !NpcMod.HasMetGuardian(GuardianBase.Glenn) && !NpcMod.HasGuardianNPC(GuardianBase.Glenn) && !PlayerMod.PlayerHasGuardianSummoned(spawnInfo.player, GuardianBase.Glenn) && !NPC.AnyNPCs(ModContent.NPCType <GlennNPC>())) { return(1f / 200); //250 } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.player.ZoneDungeon && !spawnInfo.water && !NpcMod.HasGuardianNPC(GuardianID, GuardianModID) && !NpcMod.HasMetGuardian(GuardianID, GuardianModID)) { return(1f / 200); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (!spawnInfo.playerInTown && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && Main.dayTime && !Main.eclipse && !NpcMod.HasMetGuardian(GuardianID, GuardianModID) && !NpcMod.HasGuardianNPC(GuardianID, GuardianModID) && !NPC.AnyNPCs(ModContent.NPCType <CilleNPC>()) && CanSpawn() && Main.moonPhase != 0 && Main.moonPhase != 4) { return(1f / 200); } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (Main.dayTime && Main.time < 3600 * 6.5f && !spawnInfo.playerInTown && !spawnInfo.water && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && (!NpcMod.HasMetGuardian(GuardianBase.Minerva) || PlayerMod.GetPlayerGuardianFriendshipLevel(spawnInfo.player, GuardianBase.Minerva) < 3) && !NpcMod.HasGuardianNPC(GuardianBase.Minerva) && !MainMod.IsGuardianInTheWorld(GuardianBase.Minerva)) { return(1f / 250); //250 } return(0); }
public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (CanSpawn && !spawnInfo.water && !Main.bloodMoon && !NPC.AnyNPCs(ModContent.NPCType <LiebreNPC>()) && !NpcMod.HasGuardianNPC(GuardianBase.Liebre) && !NpcMod.HasMetGuardian(GuardianBase.Liebre)) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; if (Lighting.Brightness(spawnInfo.spawnTileX, spawnInfo.spawnTileY) < 0.15f) { switch (EncounterTimes) { case 0: if (!spawnInfo.player.ZoneDungeon && !spawnInfo.player.ZoneCorrupt && !spawnInfo.player.ZoneCrimson) { return(1f / 200); } break; case 1: if (spawnInfo.player.ZoneCorrupt || spawnInfo.player.ZoneCrimson) { return(1f / 200); } break; case 2: if (spawnInfo.player.ZoneDungeon) { return(1f / 200); } break; case 3: if (spawnInfo.playerInTown) { return(1f / 200); } break; } //Can spawn :D } } return(base.SpawnChance(spawnInfo)); }
public static bool HasMetGuardian(int Id, string ModID = "") { return(NpcMod.HasMetGuardian(Id, ModID)); }