From 4c648b460a0fcbf00ea6ffd6a453139965f4b160 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 4 Aug 2023 12:53:52 -0400 Subject: [PATCH] v2.2.0: added a proper entrance room for the blacksmith quest area --- .../environment/custom_tiles/caves_quest.png | Bin 294 -> 717 bytes .../assets/messages/levels/levels.properties | 5 + .../levels/MiningLevel.java | 5 +- .../levels/rooms/quest/MineEntrance.java | 123 ++++++++++++++++++ .../levels/rooms/standard/BlacksmithRoom.java | 12 +- 5 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineEntrance.java diff --git a/core/src/main/assets/environment/custom_tiles/caves_quest.png b/core/src/main/assets/environment/custom_tiles/caves_quest.png index c173d2937a76981562f6d18958105320eb617aca..868987fba80b5aed89a5996cbb38f10706581630 100644 GIT binary patch delta 660 zcmV;F0&D%I0?h>_iBL{Q4GJ0x0000DNk~Le0001h0000$2m=5B0ObgeO#lD@w~-}A ze>N;DMmjouYFTzYTyehfe&`HyaW!nMnfJigVjW>z#-vNn8J1t(TfFym;*8!w}e^tCi zmk@yE2*3zH2#Xg29kz^xh-Fr7$xm z|9{uH*&JC6^`2Bu8<^lM$R0%rPy&>I|0CezFPO+*FM$04h+KjIV4BWX{I3H8kxR*d zuJaXcLFDgIf^Pr=k<(}3ol0Pse^>&`CMtnrU#_?N!?ir34ERA9#c`54Hc<~`W`6WQ zR>&+t$vAW@K~XW_+^=-XeJpEd)kJ>4H=`u!`y?}o{D4(&X6HCSP@LK8V|Cqb@Q5a(#!jO>3`1iinhSjUEP-SJ%94Q~00=!HoEaeT0|-D);|JjR uLr&ob5P+P-58#f-)fW;aKnYL+UWHGJL5(!xq-6mB00006$|DVZlLhw)#P@vD##WAFUaq3aUNv{$F*be-AHs7YBI_-VE1CJ2nNiVIm)ysU@ zC&(Nq60O(Hk=}P+L`A^x`ijrbl2=}i*%-Vv_qKgm^3>X$p`rP2x0MCguCp_VxD~Pd z}CE3iR&IZ h7R_*ObU5>oTl|*T4u+#D&w);3@O1TaS?83{1OP>sSw#Q< diff --git a/core/src/main/assets/messages/levels/levels.properties b/core/src/main/assets/messages/levels/levels.properties index da5910e6d..a82f6f1a3 100644 --- a/core/src/main/assets/messages/levels/levels.properties +++ b/core/src/main/assets/messages/levels/levels.properties @@ -23,9 +23,14 @@ levels.rooms.special.toxicgasroom$toxicvent.desc=A careless adventurer must have levels.rooms.special.weakfloorroom$hiddenwell.name=Distant well levels.rooms.special.weakfloorroom$hiddenwell.desc=You can just make out a well in the depths below, perhaps there is something down there? +levels.rooms.standard.blacksmithroom$questentrance.name=Mine entrance +levels.rooms.standard.blacksmithroom$questentrance.desc=This ladder leads to an old mine just below the blacksmith's workshop. + levels.rooms.standard.ritualsiteroom$ritualmarker.name=Ritual marker levels.rooms.standard.ritualsiteroom$ritualmarker.desc=A painted marker for some dark ritual. Candles are usually placed on the four corners. +levels.rooms.quest.mineentrance$questexit.name=Mine exit +levels.rooms.quest.mineentrance$questexit.desc=This ladder leads out of the mine, back into the blacksmith's workshop. ###traps levels.traps.alarmtrap.name=alarm trap diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java index 1e012570d..d267a71be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java @@ -32,9 +32,10 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.builders.Builder; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.MiningLevelPainter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.MineEntrance; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom; -import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap; import com.watabou.noosa.Group; import com.watabou.noosa.Image; @@ -49,7 +50,7 @@ public class MiningLevel extends CavesLevel { @Override protected ArrayList initRooms() { ArrayList initRooms = new ArrayList<>(); - initRooms.add ( roomEntrance = new EntranceRoom()); + initRooms.add ( roomEntrance = new MineEntrance()); //currently spawns 10-12 cave rooms, of any size int rooms = Random.NormalIntRange(10, 12); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineEntrance.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineEntrance.java new file mode 100644 index 000000000..3ab3c269b --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineEntrance.java @@ -0,0 +1,123 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2023 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition; +import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap; +import com.watabou.noosa.Image; +import com.watabou.noosa.Tilemap; +import com.watabou.utils.Point; + +public class MineEntrance extends EntranceRoom { + + @Override + public int minWidth() { + return Math.max(super.minWidth(), 7); + } + + @Override + public int minHeight() { + return Math.max(super.minHeight(), 7); + } + + @Override + public boolean canMerge(Level l, Point p, int mergeTerrain) { + //StandardRoom.canMerge + int cell = l.pointToCell(pointInside(p, 1)); + return (Terrain.flags[l.map[cell]] & Terrain.SOLID) == 0; + } + + @Override + public void paint(Level level) { + Painter.fill( level, this, Terrain.WALL ); + Painter.fill( level, this, 1, Terrain.EMPTY ); + + int entrance; + do { + entrance = level.pointToCell(random(2)); + } while (level.findMob(entrance) != null || level.map[entrance] == Terrain.WALL); + Painter.set( level, entrance, Terrain.ENTRANCE ); + + QuestExit vis = new QuestExit(); + Point p = level.cellToPoint(entrance); + vis.pos(p.x - 1, p.y - 1); + level.customTiles.add(vis); + + level.transitions.add(new LevelTransition(level, + entrance, + LevelTransition.Type.BRANCH_ENTRANCE, + Dungeon.depth, + 0, + LevelTransition.Type.BRANCH_EXIT)); + + //TODO add pre-quest decorations here + } + + public static class QuestExit extends CustomTilemap { + + { + texture = Assets.Environment.CAVES_QUEST; + + tileW = tileH = 3; + } + + final int TEX_WIDTH = 128; + + @Override + public Tilemap create() { + Tilemap v = super.create(); + v.map(mapSimpleImage(0, 1, TEX_WIDTH), 3); + return v; + } + + @Override + public String name(int tileX, int tileY) { + if (tileX == 1 && tileY == 1){ + return Messages.get(this, "name"); + } + return super.name(tileX, tileY); + } + + @Override + public String desc(int tileX, int tileY) { + if (tileX == 1 && tileY == 1){ + return Messages.get(this, "desc"); + } + return super.desc(tileX, tileY); + } + + @Override + public Image image(int tileX, int tileY) { + if (tileX == 1 && tileY == 1){ + return super.image(tileX, tileY); + } + return null; + } + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BlacksmithRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BlacksmithRoom.java index 4d509f9cc..701858ce5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BlacksmithRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BlacksmithRoom.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap; import com.watabou.noosa.Tilemap; import com.watabou.utils.Point; @@ -119,6 +120,15 @@ public class BlacksmithRoom extends StandardRoom { return v; } - //TODO add some text here in v2.2.0 + @Override + public String name(int tileX, int tileY) { + return Messages.get(this, "name"); + } + + @Override + public String desc(int tileX, int tileY) { + return Messages.get(this, "desc"); + } + } }