using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Tiles { public class MonsterBanner : ModTile { public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.Height = 3; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; TileObjectData.newTile.StyleHorizontal = true; TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.SolidBottom | AnchorType.PlanterBox, TileObjectData.newTile.Width, 0); TileObjectData.newTile.DrawYOffset = -2; TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.Platform, TileObjectData.newTile.Width, 0); TileObjectData.newAlternate.DrawYOffset = -10; TileObjectData.addAlternate(0); TileObjectData.addTile(Type); DustType = -1; TileID.Sets.DisableSmartCursor[Type] = true; AddMapEntry(new Color(13, 88, 130), Language.GetText("MapObject.Banner")); } public override void NearbyEffects(int i, int j, bool closer) { if (!closer) return; Player player = Main.LocalPlayer; if (player is null || !player.active || player.dead) return; int style = Main.tile[i, j].TileFrameX / 18; int npc = GetBannerNPC(style); if (npc != -1) { Main.SceneMetrics.NPCBannerBuff[npc] = true; Main.SceneMetrics.hasBanner = true; } } public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); public static int GetBannerNPC(int style) { int npc = -1; switch (style) { case 0: npc = NPCType(); break; case 1: npc = NPCType(); break; case 2: npc = NPCType(); break; case 3: npc = NPCType(); break; case 4: npc = NPCType(); break; case 5: npc = NPCType(); break; case 6: npc = NPCType(); break; case 7: npc = NPCType(); break; case 8: npc = NPCType(); break; case 9: npc = NPCType(); break; case 10: npc = NPCType(); break; case 11: npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? break; case 12: npc = NPCType(); break; case 13: npc = NPCType(); break; case 14: npc = NPCType(); break; case 15: npc = NPCType(); break; case 16: npc = NPCType(); break; case 17: npc = NPCType(); break; case 18: npc = NPCType(); break; case 19: npc = NPCType(); break; case 20: npc = NPCType(); break; case 21: npc = NPCType(); break; case 22: npc = NPCType(); break; case 23: npc = NPCType(); break; case 24: npc = NPCType(); break; case 25: npc = NPCType(); break; case 26: npc = NPCType(); break; case 27: npc = NPCType(); break; case 28: npc = NPCType(); break; case 29: npc = NPCType(); break; case 30: npc = NPCType(); break; case 31: npc = NPCType(); break; case 32: npc = NPCType(); break; case 33: npc = NPCType(); break; case 34: npc = NPCType(); break; case 35: npc = NPCType(); break; case 36: npc = NPCType(); break; case 37: npc = NPCType(); break; case 38: npc = NPCType(); break; case 39: npc = NPCType(); break; case 40: npc = NPCType(); break; case 41: npc = NPCType(); break; case 42: npc = NPCType(); break; case 43: npc = NPCType(); break; case 44: npc = NPCType(); break; case 45: npc = NPCType(); break; case 46: npc = NPCType(); break; case 47: npc = NPCType(); break; case 48: npc = NPCType(); break; case 49: npc = NPCType(); break; case 50: npc = NPCType(); break; case 51: npc = NPCType(); break; case 52: npc = NPCType(); break; case 53: npc = NPCType(); break; case 54: npc = NPCType(); break; case 55: npc = NPCType(); break; case 56: npc = NPCType(); break; case 57: npc = NPCType(); break; case 58: npc = NPCType(); break; case 59: npc = NPCType(); break; case 60: npc = NPCType(); break; case 61: npc = NPCType(); break; case 62: npc = NPCType(); break; case 63: npc = NPCType(); break; /*case 64: npc = NPCType(); - Formerly Sand Tortoise break*/ /*case 65: npc = NPCType(); - Formerly Great Sand Shark break*/ case 66: npc = NPCType(); break; case 67: npc = NPCType(); break; case 68: npc = NPCType(); break; case 69: npc = NPCType(); break; case 70: npc = NPCType(); break; case 71: npc = NPCType(); break; case 72: npc = NPCType(); break; case 73: npc = NPCType(); break; /*case 74: npc = NPCType(); - Formerly Sun Bat break*/ /*case 75: npc = NPCType(); - Formerly Cosmic Elemental break*/ case 76: npc = NPCType(); break; case 77: npc = NPCType(); break; case 78: npc = NPCType(); break; case 79: npc = NPCType(); break; case 80: npc = NPCType(); break; case 81: npc = NPCType(); break; case 82: npc = NPCType(); break; case 83: npc = NPCType(); break; case 84: npc = NPCType(); break; case 85: npc = NPCType(); break; /*case 86: npc = NPCType(); - Formerly Phantom Debris break*/ case 87: npc = NPCType(); break; case 88: npc = NPCType(); break; case 89: npc = NPCType(); break; case 90: npc = NPCType(); break; case 91: npc = NPCType(); break; case 92: npc = NPCType(); break; case 93: npc = NPCType(); break; case 94: npc = NPCType(); break; case 95: npc = NPCType(); break; case 96: npc = NPCType(); break; case 97: npc = NPCType(); break; case 98: npc = NPCType(); break; case 99: npc = NPCType(); break; case 100: npc = NPCType(); break; case 101: npc = NPCType(); break; case 102: npc = NPCType(); break; case 103: npc = NPCType(); break; case 104: npc = NPCType(); break; case 105: npc = NPCType(); break; case 106: npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam break*/ case 108: npc = NPCType(); break; case 109: npc = NPCType(); break; case 110: npc = NPCType(); break; case 111: npc = NPCType(); break; case 112: npc = NPCType(); break; case 113: npc = NPCType(); break; /*case 114: npc = NPCType(); - Formerly Water Leech break*/ case 115: npc = NPCType(); break; case 116: npc = NPCType(); break; case 117: npc = NPCType(); break; case 118: npc = NPCType(); break; case 119: npc = NPCType(); break; case 120: npc = NPCType(); break; case 121: npc = NPCType(); break; case 122: npc = NPCType(); break; case 123: npc = NPCType(); break; case 124: npc = NPCType(); break; case 125: npc = NPCType(); break; case 126: npc = NPCType(); break; case 127: npc = NPCType(); break; case 128: npc = NPCType(); break; default: break; } return npc; } } }