diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 1f953256d..bb6302a80 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -590,6 +590,21 @@ items.journal.guidebook.desc=An adventurer's guidebook, left here by someone who 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"_ +items.journal.regionlorepage$sewers.name=worn letter +items.journal.regionlorepage$sewers.desc=What looks to be a letter, written on a dirt-stained piece of paper. You'll need to pick it up to be able to make out what's written on it. + +items.journal.regionlorepage$prison.name=worn journal entry +items.journal.regionlorepage$prison.desc=A journal entry, or some other kind of record, written on an old piece of paper. It seems to have fared better than the letters you found in the prison, but you'll still need to pick it up to read it. + +items.journal.regionlorepage$caves.name=old log entry +items.journal.regionlorepage$caves.desc=What looks to be an entry in an explorer's logbook, preserved surprisingly well despite how old it must be. Pick it up to read it. + +items.journal.regionlorepage$city.name=rusted tablet +items.journal.regionlorepage$city.desc=A smalled rusted metal tablet with a message magically etched into it. The letters are still clear despite the tablet's age, but you'll have to pick it up to read it. + +items.journal.regionlorepage$halls.name=glowing tablet +items.journal.regionlorepage$halls.desc=A small black tablet with glowing green letters etched into it. The glowing letters blur together into a haze at a distance, you'll have to pick it up to read it. + ###keys items.keys.goldenkey.name=golden key diff --git a/core/src/main/assets/sprites/items.png b/core/src/main/assets/sprites/items.png index 129da29f0..7a0c05951 100644 Binary files a/core/src/main/assets/sprites/items.png and b/core/src/main/assets/sprites/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/RegionLorePage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/RegionLorePage.java new file mode 100644 index 000000000..b31493ac4 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/journal/RegionLorePage.java @@ -0,0 +1,94 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2022 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.items.journal; + +import com.shatteredpixel.shatteredpixeldungeon.journal.Document; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + +public class RegionLorePage { + + public static DocumentPage pageForDoc( Document doc ){ + switch (doc){ + case SEWERS_GUARD: default: return new RegionLorePage.Sewers(); + case PRISON_WARDEN: return new RegionLorePage.Prison(); + case CAVES_EXPLORER: return new RegionLorePage.Caves(); + case CITY_WARLOCK: return new RegionLorePage.City(); + case HALLS_KING: return new RegionLorePage.Halls(); + } + } + + public static class Sewers extends DocumentPage { + { + image = ItemSpriteSheet.SEWER_PAGE; + } + + @Override + public Document document() { + return Document.SEWERS_GUARD; + } + } + + public static class Prison extends DocumentPage { + { + image = ItemSpriteSheet.PRISON_PAGE; + } + + @Override + public Document document() { + return Document.PRISON_WARDEN; + } + } + + public static class Caves extends DocumentPage { + { + image = ItemSpriteSheet.CAVES_PAGE; + } + + @Override + public Document document() { + return Document.CAVES_EXPLORER; + } + } + + public static class City extends DocumentPage { + { + image = ItemSpriteSheet.CITY_PAGE; + } + + @Override + public Document document() { + return Document.CITY_WARLOCK; + } + } + + public static class Halls extends DocumentPage { + { + image = ItemSpriteSheet.HALLS_PAGE; + } + + @Override + public Document document() { + return Document.HALLS_KING; + } + } + +} 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 4b24444af..3d345607a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java @@ -39,12 +39,11 @@ public enum Document { ALCHEMY_GUIDE(ItemSpriteSheet.ALCH_PAGE, false), INTROS(Icons.STAIRS, true), - //TODO separate visuals for these? - SEWERS_GUARD(ItemSpriteSheet.GUIDE_PAGE, true), - PRISON_WARDEN(ItemSpriteSheet.GUIDE_PAGE, true), - CAVES_EXPLORER(ItemSpriteSheet.GUIDE_PAGE, true), - CITY_WARLOCK(ItemSpriteSheet.GUIDE_PAGE, true), - HALLS_KING(ItemSpriteSheet.GUIDE_PAGE, true); + SEWERS_GUARD(ItemSpriteSheet.SEWER_PAGE, true), + PRISON_WARDEN(ItemSpriteSheet.PRISON_PAGE, true), + CAVES_EXPLORER(ItemSpriteSheet.CAVES_PAGE, true), + CITY_WARLOCK(ItemSpriteSheet.CITY_PAGE, true), + HALLS_KING(ItemSpriteSheet.HALLS_PAGE, true); Document( int sprite, boolean lore ){ pageIcon = null; 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 961f92337..bdaa5b2af 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -40,7 +40,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation; +import com.shatteredpixel.shatteredpixeldungeon.items.journal.DocumentPage; import com.shatteredpixel.shatteredpixeldungeon.items.journal.GuidePage; +import com.shatteredpixel.shatteredpixeldungeon.items.journal.RegionLorePage; import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; @@ -526,8 +528,15 @@ public abstract class RegularLevel extends Level { //TODO maybe drop last page in boss floor with custom logic? if (Dungeon.depth >= targetFloor){ - //TODO actually drop the page, need to look into documentpage class a bit - //if (limit != null) limit.drop(); + DocumentPage page = RegionLorePage.pageForDoc(regionDoc); + page.page(pageToDrop); + int cell = randomDropCell(); + if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) { + map[cell] = Terrain.GRASS; + losBlocking[cell] = false; + } + drop(page, cell); + if (limit != null) limit.drop(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index 7ca27123c..7b47d4780 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -88,11 +88,8 @@ public class ItemSpriteSheet { public static final int SANDBAG = UNCOLLECTIBLE+5; public static final int SPIRIT_ARROW = UNCOLLECTIBLE+6; - public static final int GUIDE_PAGE = UNCOLLECTIBLE+8; - public static final int ALCH_PAGE = UNCOLLECTIBLE+9; - - public static final int TENGU_BOMB = UNCOLLECTIBLE+11; - public static final int TENGU_SHOCKER = UNCOLLECTIBLE+12; + public static final int TENGU_BOMB = UNCOLLECTIBLE+8; + public static final int TENGU_SHOCKER = UNCOLLECTIBLE+9; static{ assignItemRect(GOLD, 15, 13); assignItemRect(ENERGY, 16, 16); @@ -102,9 +99,6 @@ public class ItemSpriteSheet { assignItemRect(SANDBAG, 10, 10); assignItemRect(SPIRIT_ARROW,11, 11); - assignItemRect(GUIDE_PAGE, 10, 11); - assignItemRect(ALCH_PAGE, 10, 11); - assignItemRect(TENGU_BOMB, 10, 10); assignItemRect(TENGU_SHOCKER, 10, 10); } @@ -697,7 +691,23 @@ public class ItemSpriteSheet { assignItemRect(VIAL, 12, 12); } - //16 free slots + private static final int DOCUMENTS = xy(1, 32); //16 slots + public static final int GUIDE_PAGE = DOCUMENTS+0; + public static final int ALCH_PAGE = DOCUMENTS+1; + public static final int SEWER_PAGE = DOCUMENTS+2; + public static final int PRISON_PAGE = DOCUMENTS+3; + public static final int CAVES_PAGE = DOCUMENTS+4; + public static final int CITY_PAGE = DOCUMENTS+5; + public static final int HALLS_PAGE = DOCUMENTS+6; + static{ + assignItemRect(GUIDE_PAGE, 10, 11); + assignItemRect(ALCH_PAGE, 10, 11); + assignItemRect(SEWER_PAGE, 10, 11); + assignItemRect(PRISON_PAGE, 10, 11); + assignItemRect(CAVES_PAGE, 10, 11); + assignItemRect(CITY_PAGE, 10, 11); + assignItemRect(HALLS_PAGE, 10, 11); + } //for smaller 8x8 icons that often accompany an item sprite public static class Icons { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndDocument.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndDocument.java index 0b0e54057..34d8aa677 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndDocument.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndDocument.java @@ -36,7 +36,7 @@ public class WndDocument extends Window { list = new ScrollingListPane(); add( list ); - list.addTitle(doc.title()); + list.addTitle(Messages.titleCase(doc.title())); for (String page : doc.pageNames()){ boolean found = doc.isPageFound(page);