diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index ef37115769..b6f30ae94d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -833,5 +833,11 @@ HarvestStaff: { LiliesOfFinality: { DisplayName: Lilies of Finality - Tooltip: "" + Tooltip: + ''' + Grows a pumpkin patch that sprouts pumpkins nearby + Requires 2 minion slots to use + Can only be summoned once + 'Wake up' + ''' } diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 5d3ecf9f98..db1d971971 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -8,7 +8,9 @@ using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +20,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.World.CalamityWorld; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Systems { @@ -312,6 +315,75 @@ namespace CalamityMod.Systems } } } + + if (growthTile.LiquidAmount == 0) + { + bool isCragsTile = tileType == TileType() || + tileType == TileType() || + tileType == TileType() || + tileType == TileType() || + tileType == TileType(); + + int wallType = Main.tile[x, y2].WallType; + bool isCragHouseWall = wallType == WallType() || + wallType == WallType() || + wallType == WallType() || + wallType == WallType(); + + if (isCragsTile && isCragHouseWall && Main.tile[x, y2].LiquidAmount == 0) + { + // Lilies of Finality post-Yharon. + if (WorldGen.genRand.NextBool(20) && DownedBossSystem.downedYharon) + { + ushort tileTypeToPlace = (ushort)TileType(); + int tileTypeToPlaceThickness = 3; + bool placeLilies = true; + int minDistanceFromOtherBulbs = 100; + for (int k = x - minDistanceFromOtherBulbs; k < x + minDistanceFromOtherBulbs; k += 2) + { + for (int m = y - minDistanceFromOtherBulbs; m < y + minDistanceFromOtherBulbs; m += 2) + { + if (k > tileTypeToPlaceThickness && k < Main.maxTilesX - tileTypeToPlaceThickness && m > tileTypeToPlaceThickness && m < Main.maxTilesY - tileTypeToPlaceThickness && Main.tile[k, m].HasTile && Main.tile[k, m].TileType == tileTypeToPlace) + { + placeLilies = false; + break; + } + } + } + + if (placeLilies) + { + if (x < tileTypeToPlaceThickness || x > Main.maxTilesX - tileTypeToPlaceThickness || y2 < tileTypeToPlaceThickness || y2 > Main.maxTilesY - tileTypeToPlaceThickness) + return; + + bool placeTile = true; + for (int i2 = x - 1; i2 < x + 2; i2++) + { + for (int j3 = y2 - 2; j3 < y2 + 1; j3++) + { + if (Main.tile[i2, j3] == null) + return; + + if (Main.tile[i2, j3].HasTile) + placeTile = false; + } + + if (Main.tile[i2, y2 + 1] == null) + return; + + if (!WorldGen.SolidTile2(i2, y2 + 1)) + placeTile = false; + } + + if (placeTile) + { + WorldGen.PlaceObject(x, y2, tileTypeToPlace, true); + NetMessage.SendObjectPlacement(-1, x, y2, tileTypeToPlace, 0, 0, -1, -1); + } + } + } + } + } } } l++; diff --git a/Tiles/Crags/LiliesOfFinalityTile.cs b/Tiles/Crags/LiliesOfFinalityTile.cs new file mode 100644 index 0000000000..8d3a8be0c4 --- /dev/null +++ b/Tiles/Crags/LiliesOfFinalityTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class LiliesOfFinalityTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + + TileObjectData.addTile(Type); + + AddMapEntry(Color.White, CalamityUtils.GetItemName()); + TileID.Sets.DisableSmartCursor[Type] = true; + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) => r = g = b = 0.5f; + } +} diff --git a/Tiles/Crags/LiliesOfFinalityTile.png b/Tiles/Crags/LiliesOfFinalityTile.png new file mode 100644 index 0000000000..7c7c13f169 Binary files /dev/null and b/Tiles/Crags/LiliesOfFinalityTile.png differ