v1.4.0: added most of the logic for new lore pages + placeholder text

This commit is contained in:
Evan Debenham
2022-09-10 11:48:55 -04:00
parent c430a84038
commit 3dd20df438
4 changed files with 188 additions and 2 deletions

View File

@@ -62,6 +62,72 @@ journal.document.intros.city.body=The Dwarven Metropolis was once the greatest o
journal.document.intros.halls.title=Demon Halls
journal.document.intros.halls.body=These deep halls of the Dwarven Metropolis have been twisted by dark magic. In the past these regions played host to the Dwarf King's court of elite warlocks, but now they seem to have been taken over by something even more sinister...\n\nAll sorts of horrific demonic creatures inhabit these halls, being led by some terrible dark power. If the King of Dwarves wasn't the source of the spreading corruption, whatever is down here must be.\n\nTread carefully, very few adventurers have ever descended this far...
journal.document.sewers_guard.title=main title
journal.document.sewers_guard.p1.title=title
journal.document.sewers_guard.p1.body=body
journal.document.sewers_guard.p2.title=title
journal.document.sewers_guard.p2.body=body
journal.document.sewers_guard.p3.title=title
journal.document.sewers_guard.p3.body=body
journal.document.sewers_guard.p4.title=title
journal.document.sewers_guard.p4.body=body
journal.document.sewers_guard.p5.title=title
journal.document.sewers_guard.p5.body=body
journal.document.sewers_guard.p6.title=title
journal.document.sewers_guard.p6.body=body
journal.document.prison_warden.title=main title
journal.document.prison_warden.p1.title=title
journal.document.prison_warden.p1.body=body
journal.document.prison_warden.p2.title=title
journal.document.prison_warden.p2.body=body
journal.document.prison_warden.p3.title=title
journal.document.prison_warden.p3.body=body
journal.document.prison_warden.p4.title=title
journal.document.prison_warden.p4.body=body
journal.document.prison_warden.p5.title=title
journal.document.prison_warden.p5.body=body
journal.document.prison_warden.p6.title=title
journal.document.prison_warden.p6.body=body
journal.document.caves_explorer.title=main title
journal.document.caves_explorer.p1.title=title
journal.document.caves_explorer.p1.body=body
journal.document.caves_explorer.p2.title=title
journal.document.caves_explorer.p2.body=body
journal.document.caves_explorer.p3.title=title
journal.document.caves_explorer.p3.body=body
journal.document.caves_explorer.p4.title=title
journal.document.caves_explorer.p4.body=body
journal.document.caves_explorer.p5.title=title
journal.document.caves_explorer.p5.body=body
journal.document.caves_explorer.p6.title=title
journal.document.caves_explorer.p6.body=body
journal.document.city_warlock.title=main title
journal.document.city_warlock.p1.title=title
journal.document.city_warlock.p1.body=body
journal.document.city_warlock.p2.title=title
journal.document.city_warlock.p2.body=body
journal.document.city_warlock.p3.title=title
journal.document.city_warlock.p3.body=body
journal.document.city_warlock.p4.title=title
journal.document.city_warlock.p4.body=body
journal.document.city_warlock.p5.title=title
journal.document.city_warlock.p5.body=body
journal.document.city_warlock.p6.title=title
journal.document.city_warlock.p6.body=body
journal.document.halls_king.title=main title
journal.document.halls_king.p1.title=title
journal.document.halls_king.p1.body=body
journal.document.halls_king.p2.title=title
journal.document.halls_king.p2.body=body
journal.document.halls_king.p3.title=title
journal.document.halls_king.p3.body=body
journal.document.halls_king.p4.title=title
journal.document.halls_king.p4.body=body
journal.document.halls_king.p5.title=title
journal.document.halls_king.p5.body=body
journal.document.halls_king.p6.title=title
journal.document.halls_king.p6.body=body
journal.notes$landmark.well_of_health=well of health
journal.notes$landmark.well_of_awareness=well of awareness
journal.notes$landmark.alchemy=alchemy pot

View File

@@ -123,7 +123,14 @@ public class Dungeon {
VELVET_POUCH,
SCROLL_HOLDER,
POTION_BANDOLIER,
MAGICAL_HOLSTER;
MAGICAL_HOLSTER,
//lore documents
LORE_SEWERS,
LORE_PRISON,
LORE_CAVES,
LORE_CITY,
LORE_HALLS;
public int count = 0;

View File

@@ -38,7 +38,13 @@ public enum Document {
ADVENTURERS_GUIDE(ItemSpriteSheet.GUIDE_PAGE, false),
ALCHEMY_GUIDE(ItemSpriteSheet.ALCH_PAGE, false),
INTROS(Icons.STAIRS, true);
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);
Document( int sprite, boolean lore ){
pageIcon = null;
@@ -87,6 +93,15 @@ public enum Document {
return false;
}
public boolean allPagesFound(){
for( Integer val : pagesStates.values()){
if (val == NOT_FOUND){
return false;
}
}
return true;
}
public boolean readPage( String page ) {
if (pagesStates.containsKey(page)){
pagesStates.put(page, READ);
@@ -241,6 +256,41 @@ public enum Document {
INTROS.pagesStates.put("City", debug ? READ : NOT_FOUND);
INTROS.pagesStates.put("Halls", debug ? READ : NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p1", NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p2", NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p3", NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p4", NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p5", NOT_FOUND);
SEWERS_GUARD.pagesStates.put("p6", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p1", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p2", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p3", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p4", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p5", NOT_FOUND);
PRISON_WARDEN.pagesStates.put("p6", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p1", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p2", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p3", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p4", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p5", NOT_FOUND);
CAVES_EXPLORER.pagesStates.put("p6", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p1", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p2", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p3", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p4", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p5", NOT_FOUND);
CITY_WARLOCK.pagesStates.put("p6", NOT_FOUND);
HALLS_KING.pagesStates.put("p1", NOT_FOUND);
HALLS_KING.pagesStates.put("p2", NOT_FOUND);
HALLS_KING.pagesStates.put("p3", NOT_FOUND);
HALLS_KING.pagesStates.put("p4", NOT_FOUND);
HALLS_KING.pagesStates.put("p5", NOT_FOUND);
HALLS_KING.pagesStates.put("p6", NOT_FOUND);
}
private static final String DOCUMENTS = "documents";

View File

@@ -73,6 +73,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
public abstract class RegularLevel extends Level {
@@ -482,9 +483,71 @@ public abstract class RegularLevel extends Level {
drop( p, cell );
}
//lore pages
//TODO a fair bit going on here, I might want to refactor/externalize this in the future
if (Document.ADVENTURERS_GUIDE.allPagesFound()){
int region = 1+(Dungeon.depth-1)/5;
Document regionDoc;
switch( region ){
default: regionDoc = null; break;
case 1: regionDoc = Document.SEWERS_GUARD; break;
case 2: regionDoc = Document.PRISON_WARDEN; break;
case 3: regionDoc = Document.CAVES_EXPLORER; break;
case 4: regionDoc = Document.CITY_WARLOCK; break;
case 5: regionDoc = Document.HALLS_KING; break;
}
if (regionDoc != null && !regionDoc.allPagesFound()) {
Dungeon.LimitedDrops limit = limitedDocs.get(regionDoc);
if (limit == null || !limit.dropped()) {
float totalPages = 0;
float pagesFound = 0;
String pageToDrop = null;
for (String page : regionDoc.pageNames()) {
totalPages++;
if (!regionDoc.isPageFound(page)) {
if (pageToDrop == null) {
pageToDrop = page;
}
} else {
pagesFound++;
}
}
float percentComplete = pagesFound / totalPages;
// initial value is the first floor in a region
int targetFloor = 5*(region-1) + 1;
targetFloor += Math.round(3*percentComplete);
//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();
}
}
}
}
Random.popGenerator();
}
private static HashMap<Document, Dungeon.LimitedDrops> limitedDocs = new HashMap<>();
static {
limitedDocs.put(Document.SEWERS_GUARD, Dungeon.LimitedDrops.LORE_SEWERS);
limitedDocs.put(Document.PRISON_WARDEN, Dungeon.LimitedDrops.LORE_PRISON);
limitedDocs.put(Document.CAVES_EXPLORER, Dungeon.LimitedDrops.LORE_CAVES);
limitedDocs.put(Document.CITY_WARLOCK, Dungeon.LimitedDrops.LORE_CITY);
limitedDocs.put(Document.HALLS_KING, Dungeon.LimitedDrops.LORE_HALLS);
}
public ArrayList<Room> rooms() {
return new ArrayList<>(rooms);