diff --git a/core/src/main/assets/items.png b/core/src/main/assets/items.png index ab6ebdb11..7886c46b3 100644 Binary files a/core/src/main/assets/items.png and b/core/src/main/assets/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/GuidePage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/GuidePage.java index 03934cafa..ea43d9646 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/GuidePage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/GuidePage.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.journal; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class GuidePage extends DocumentPage { @@ -34,5 +35,9 @@ public class GuidePage extends DocumentPage { public Document document() { return Document.ADVENTURERS_GUIDE; } - + + @Override + public String desc() { + return Messages.get(this, "desc", document().pageTitle(page())); + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java index 173f24e09..0ee07e1be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java @@ -43,6 +43,7 @@ public enum Document { public boolean addPage( String page ) { if (pages.containsKey(page) && !pages.get(page)){ pages.put(page, true); + Journal.saveNeeded = true; return true; } return false; @@ -63,19 +64,19 @@ public enum Document { public String pageBody( String page ){ return Messages.get( this, name() + "." + page + ".body"); } + + public static final String GUIDE_INTRO_PAGE = "Intro"; + public static final String GUIDE_SEARCH_PAGE = "Examining_and_Searching"; static { - ADVENTURERS_GUIDE.pages.put("0", false); - ADVENTURERS_GUIDE.pages.put("1", false); - ADVENTURERS_GUIDE.pages.put("2", false); - ADVENTURERS_GUIDE.pages.put("3", false); - ADVENTURERS_GUIDE.pages.put("4", false); - ADVENTURERS_GUIDE.pages.put("5", false); - ADVENTURERS_GUIDE.pages.put("6", false); - ADVENTURERS_GUIDE.pages.put("7", false); - ADVENTURERS_GUIDE.pages.put("8", false); - ADVENTURERS_GUIDE.pages.put("9", false); - + ADVENTURERS_GUIDE.pages.put(GUIDE_INTRO_PAGE, false); + ADVENTURERS_GUIDE.pages.put("Identifying", false); + ADVENTURERS_GUIDE.pages.put(GUIDE_SEARCH_PAGE, false); + ADVENTURERS_GUIDE.pages.put("Upgrades", false); + ADVENTURERS_GUIDE.pages.put("Food", false); + ADVENTURERS_GUIDE.pages.put("Levelling", false); + ADVENTURERS_GUIDE.pages.put("Surprise_Attacks", false); + ADVENTURERS_GUIDE.pages.put("Dieing", false); } private static final String DOCUMENTS = "documents"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 207ae52fe..e63025b7a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -31,8 +31,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.journal.GuidePage; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; +import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.levels.builders.Builder; import com.shatteredpixel.shatteredpixeldungeon.levels.builders.LoopBuilder; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; @@ -51,8 +53,10 @@ import com.watabou.utils.Bundle; import com.watabou.utils.Random; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Iterator; +import java.util.List; public abstract class RegularLevel extends Level { @@ -81,12 +85,7 @@ public abstract class RegularLevel extends Level { rooms = builder.build((ArrayList)initRooms.clone()); } while (rooms == null); - if (painter().paint(this, rooms)){ - placeSign(); - return true; - } else { - return false; - } + return painter().paint(this, rooms); } @@ -132,25 +131,6 @@ public abstract class RegularLevel extends Level { } protected abstract Painter painter(); - - protected void placeSign(){ - while (true) { - int pos = pointToCell(roomEntrance.random()); - if (pos != entrance && traps.get(pos) == null && findMob(pos) == null) { - map[pos] = Terrain.SIGN; - break; - } - } - - //teaches new players about secret doors - if (Dungeon.depth == 2 && !Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1)) { - for (Room r : roomEntrance.connected.keySet()) { - Room.Door d = roomEntrance.connected.get(r); - if (d.type == Room.Door.Type.REGULAR) - map[d.x + d.y * width()] = Terrain.SECRET_DOOR; - } - } - } protected float waterFill(){ return 0; @@ -375,6 +355,33 @@ public abstract class RegularLevel extends Level { } drop( item, cell ).type = Heap.Type.REMAINS; } + + //guide pages + Collection allPages = Document.ADVENTURERS_GUIDE.pages(); + ArrayList missingPages = new ArrayList<>(); + for ( String page : allPages){ + if (!Document.ADVENTURERS_GUIDE.hasPage(page)){ + missingPages.add(page); + } + } + + //these are dropped specially + missingPages.remove(Document.GUIDE_INTRO_PAGE); + missingPages.remove(Document.GUIDE_SEARCH_PAGE); + + //chance to find a page scales with pages missing and depth + if (missingPages.size() > 0 && + Random.Int(allPages.size()) < missingPages.size() + Dungeon.depth/2){ + GuidePage p = new GuidePage(); + p.page(missingPages.get(0)); + int cell = randomDropCell(); + if (map[cell] == Terrain.HIGH_GRASS) { + map[cell] = Terrain.GRASS; + losBlocking[cell] = false; + } + drop( p, cell ).type = Heap.Type.REMAINS; + } + } protected Room randomRoom( Class type ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java index 04c717aee..5e55170f8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java @@ -74,19 +74,6 @@ public class SewerBossLevel extends SewerLevel { .setTunnelLength(new float[]{0, 3, 1}, new float[]{1}); } - @Override - protected void placeSign() { - while (true) { - int pos = pointToCell(roomEntrance.random(2)); - if (map[pos] != Terrain.LOCKED_EXIT - && map[pos] != Terrain.WALL_DECO - && map[pos] != Terrain.ENTRANCE) { - map[pos] = Terrain.SIGN; - break; - } - } - } - @Override protected float waterFill(){ return 0.50f; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/EntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/EntranceRoom.java index 3065b7d07..b3a2a03e1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/EntranceRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/EntranceRoom.java @@ -21,10 +21,16 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard; +import com.shatteredpixel.shatteredpixeldungeon.Badges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.items.journal.GuidePage; +import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; +import com.watabou.utils.Point; +import com.watabou.utils.Random; public class EntranceRoom extends StandardRoom { @@ -51,6 +57,40 @@ public class EntranceRoom extends StandardRoom { level.entrance = level.pointToCell(random(2)); } while (level.findMob(level.entrance) != null); Painter.set( level, level.entrance, Terrain.ENTRANCE ); + + if (Dungeon.depth == 1 && !Document.ADVENTURERS_GUIDE.hasPage(Document.GUIDE_INTRO_PAGE)){ + int pos; + do { + //can't be on bottom row of tiles + pos = level.pointToCell(new Point( Random.IntRange( left + 1, right - 1 ), + Random.IntRange( top + 1, bottom - 2 ))); + } while (pos == level.entrance || level.findMob(level.entrance) != null); + GuidePage p = new GuidePage(); + p.page(Document.GUIDE_INTRO_PAGE); + level.drop( p, pos ); + } + + if (Dungeon.depth == 2){ + if (!Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_4)){ + for (Room.Door door : connected.values()) { + door.set( Door.Type.HIDDEN ); + } + } + + if (!Document.ADVENTURERS_GUIDE.hasPage(Document.GUIDE_SEARCH_PAGE)){ + int pos; + do { + //can't be on bottom row of tiles + pos = level.pointToCell(new Point( Random.IntRange( left + 1, right - 1 ), + Random.IntRange( top + 1, bottom - 2 ))); + } while (pos == level.entrance || level.findMob(level.entrance) != null); + GuidePage p = new GuidePage(); + p.page(Document.GUIDE_SEARCH_PAGE); + level.drop( p, pos ); + } + + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java index 7f25fe53a..fec80504d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java @@ -251,14 +251,15 @@ public class WndJournal extends WndTabbed { private String page; public GuideItem( String page ){ - super( Icons.get(Icons.MASTERY), Messages.titleCase(Document.ADVENTURERS_GUIDE.pageTitle(page)), -1); + super( new ItemSprite( ItemSpriteSheet.GUIDE_PAGE, null), + Messages.titleCase(Document.ADVENTURERS_GUIDE.pageTitle(page)), -1); this.page = page; found = Document.ADVENTURERS_GUIDE.hasPage(page); if (!found) { icon.hardlight( 0.5f, 0.5f, 0.5f); - label.text("???"); + label.text( Messages.titleCase(Messages.get( this, "missing" ))); label.hardlight( 0x999999 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java index c39cc712b..68b7b6ab8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java @@ -35,9 +35,9 @@ import com.watabou.utils.SparseArray; public class WndStory extends Window { - private static final int WIDTH_P = 120; - private static final int WIDTH_L = 144; - private static final int MARGIN = 6; + private static final int WIDTH_P = 125; + private static final int WIDTH_L = 160; + private static final int MARGIN = 2; private static final float bgR = 0.77f; private static final float bgG = 0.73f; diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index e55011c00..36fd99c5f 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -394,6 +394,8 @@ items.food.pasty.cane_desc=A huge sugary sweet candy cane! It's big enough to fi items.journal.documentpage.name=torn page items.journal.documentpage.desc=A lone page, probably torn from a book of some sort. You'll need to pick it up to read it. +items.journal.guidepage.name=torn guidebook page +items.journal.guidepage.desc=A torn page from an adventuring guidebook.\n\nMost of the text is too small to read at a distance, but you can make out the title of the page:\n\n_"%s"_ ###keys diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties index 853944035..b26fc80ac 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties @@ -1,6 +1,20 @@ journal.document.adventurers_guide.title=Adventurer's Guide -journal.document.adventurers_guide.0.title=Coming soon... -journal.document.adventurers_guide.0.body=Welcome to the Adventurer's Guide to Dungeoneering!\n\nThe most important thing to remember: DON'T PANIC! +journal.document.adventurers_guide.intro.title=Introduction +journal.document.adventurers_guide.intro.body=Greetings Adventurer!\n\nYou have just purchased (or looted) the amazing Adventurer's Guide to Dungeoneering! This guidebook is full of tips, tricks, and advice to help budding adventurers survive and excel!\n\nWhile you can read this guide all at once, it is best used as a reference. Make sure to check it whenever you're struggling.\n\nKeep your wits about you, and remember:\nDON'T PANIC! +journal.document.adventurers_guide.identifying.title=Identifying Items +journal.document.adventurers_guide.identifying.body=Identifying items can be just as important as finding them!\n\nThe colors on potions and glyphs on scrolls are different in each dungeon, so you won't know what effect you'll get if they're unidentified.\n\nUnidentified equipment can be upgraded if you're lucky, or it might be cursed! Accidentally equipping a cursed item is bad, but usually isn't instant doom.\n\nScrolls of identify, upgrade, or remove curse are very useful if you want to reduce the risk of unidentified items.\n\n(You can find a list of all the items you've identified in the items tab of your journal) +journal.document.adventurers_guide.examining_and_searching.title=Examining and Searching +journal.document.adventurers_guide.examining_and_searching.body=Charging forward recklessly is a great way to get killed.\n\nThere's always time to slow down and examine things around you, which can help you figure out the best way to approach a situation. Rushing into enemies is almost never the best way to deal with them.\n\nDungeons are full of secret passages and traps which appear invisible at first glance. It's good to be willing to thoroughly search an area if you suspect something is hidden.\n\n(The magnifying glass button is used for examining and searching. Tap it once and then tap on something to examine, tap it twice to search the area around you.) +journal.document.adventurers_guide.upgrades.title=Upgrades and Strength +journal.document.adventurers_guide.upgrades.body=TODO +journal.document.adventurers_guide.food.title=Effective Rationing +journal.document.adventurers_guide.food.body=TODO +journal.document.adventurers_guide.levelling.title=Gaining Experience +journal.document.adventurers_guide.levelling.body=TODO +journal.document.adventurers_guide.surprise_attacks.title=Surprise Attacks +journal.document.adventurers_guide.surprise_attacks.body=TODO +journal.document.adventurers_guide.dieing.title=Handling Defeat +journal.document.adventurers_guide.dieing.body=TODO journal.notes$landmark.well_of_health=well of health journal.notes$landmark.well_of_awareness=well of awareness diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/ui/ui.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/ui/ui.properties index 2d9778d99..c863c0538 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/ui/ui.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/ui/ui.properties @@ -1,3 +1,3 @@ ui.quickslotbutton.select_item=Quickslot an item -ui.toolbar.examine_prompt=Press again to search\nPress a tile for info +ui.toolbar.examine_prompt=Press again to search\nPress a tile to examine diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/windows/windows.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/windows/windows.properties index ed175051c..337ef313e 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/windows/windows.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/windows/windows.properties @@ -36,6 +36,7 @@ windows.wndinfotrap.inactive=This trap is inactive, and can no longer be trigger windows.wndjournal.guide=Guide windows.wndjournal.notes=Notes windows.wndjournal.items=Items +windows.wndjournal$guidetab$guideitem.missing=page missing windows.wndjournal$notestab.keys=Keys windows.wndjournal$notestab.landmarks=Landmarks