v0.9.4: improved Document method names
This commit is contained in:
parent
d26e6b41dd
commit
65a45d19dc
|
@ -97,7 +97,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
|||
|
||||
GLog.w( Messages.get(this, "onhungry") );
|
||||
|
||||
if (!Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_FOOD)){
|
||||
if (!Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_FOOD)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_FOOD);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Foresight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Fury;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HoldFast;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
|
@ -60,10 +59,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior.En
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Monk;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Snake;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
|
||||
|
@ -1256,7 +1252,7 @@ public class Hero extends Char {
|
|||
target = m;
|
||||
}
|
||||
if (m instanceof Snake
|
||||
&& !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_EXAMINING)){
|
||||
&& !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_EXAMINING)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_EXAMINING);
|
||||
//we set to read here to prevent this message popping up a bunch
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook;
|
||||
|
@ -62,7 +61,7 @@ public class Snake extends Mob {
|
|||
@Override
|
||||
public String defenseVerb() {
|
||||
dodges++;
|
||||
if (dodges >= 2 && !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_SURPRISE_ATKS)){
|
||||
if (dodges >= 2 && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_SURPRISE_ATKS)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_SURPRISE_ATKS);
|
||||
dodges = 0;
|
||||
|
|
|
@ -36,8 +36,6 @@ import com.watabou.noosa.audio.Sample;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.print.Doc;
|
||||
|
||||
public abstract class EquipableItem extends Item {
|
||||
|
||||
public static final String AC_EQUIP = "EQUIP";
|
||||
|
@ -57,7 +55,7 @@ public abstract class EquipableItem extends Item {
|
|||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
if (super.doPickUp(hero)){
|
||||
if (!isIdentified() && !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_IDING)){
|
||||
if (!isIdentified() && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_IDING)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_IDING);
|
||||
}
|
||||
|
|
|
@ -417,10 +417,10 @@ public class Heap implements Bundlable {
|
|||
for (Item item : items.toArray(new Item[0])){
|
||||
if (item instanceof DocumentPage
|
||||
&& ( !((DocumentPage) item).document().pageNames().contains(((DocumentPage) item).page())
|
||||
|| ((DocumentPage) item).document().pageFound(((DocumentPage) item).page()))){
|
||||
|| ((DocumentPage) item).document().isPageFound(((DocumentPage) item).page()))){
|
||||
items.remove(item);
|
||||
}
|
||||
if (item instanceof Guidebook && Document.ADVENTURERS_GUIDE.pageRead(0)){
|
||||
if (item instanceof Guidebook && Document.ADVENTURERS_GUIDE.isPageRead(0)){
|
||||
items.remove(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,12 +56,12 @@ public enum Document {
|
|||
return findPage( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
}
|
||||
|
||||
public boolean pageFound( String page ){
|
||||
public boolean isPageFound( String page ){
|
||||
return pagesStates.containsKey(page) && pagesStates.get(page) > NOT_FOUND;
|
||||
}
|
||||
|
||||
public boolean pageFound( int pageIdx ){
|
||||
return pageFound( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
public boolean isPageFound( int pageIdx ){
|
||||
return isPageFound( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
}
|
||||
|
||||
public boolean readPage( String page ) {
|
||||
|
@ -77,12 +77,12 @@ public enum Document {
|
|||
return readPage( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
}
|
||||
|
||||
public boolean pageRead( String page ){
|
||||
public boolean isPageRead( String page ){
|
||||
return pagesStates.containsKey(page) && pagesStates.get(page) == READ;
|
||||
}
|
||||
|
||||
public boolean pageRead( int pageIdx ){
|
||||
return pageRead( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
public boolean isPageRead( int pageIdx ){
|
||||
return isPageRead( pagesStates.keySet().toArray(new String[0])[pageIdx] );
|
||||
}
|
||||
|
||||
public Collection<String> pageNames(){
|
||||
|
|
|
@ -439,7 +439,7 @@ public abstract class RegularLevel extends Level {
|
|||
Collection<String> allPages = Document.ADVENTURERS_GUIDE.pageNames();
|
||||
ArrayList<String> missingPages = new ArrayList<>();
|
||||
for ( String page : allPages){
|
||||
if (!Document.ADVENTURERS_GUIDE.pageFound(page)){
|
||||
if (!Document.ADVENTURERS_GUIDE.isPageFound(page)){
|
||||
missingPages.add(page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ public abstract class RegularPainter extends Painter {
|
|||
|
||||
//entrance doors on floor 2 are hidden if the player hasn't picked up 2nd guidebook page
|
||||
if (Dungeon.depth == 2
|
||||
&& !Document.ADVENTURERS_GUIDE.pageFound(Document.GUIDE_SEARCHING)
|
||||
&& !Document.ADVENTURERS_GUIDE.isPageFound(Document.GUIDE_SEARCHING)
|
||||
&& r instanceof EntranceRoom){
|
||||
d.type = Room.Door.Type.HIDDEN;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class LaboratoryRoom extends SpecialRoom {
|
|||
Collection<String> allPages = Document.ALCHEMY_GUIDE.pageNames();
|
||||
ArrayList<String> missingPages = new ArrayList<>();
|
||||
for ( String page : allPages){
|
||||
if (!Document.ALCHEMY_GUIDE.pageFound(page)){
|
||||
if (!Document.ALCHEMY_GUIDE.isPageFound(page)){
|
||||
missingPages.add(page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class EntranceRoom extends StandardRoom {
|
|||
Random.pushGenerator();
|
||||
|
||||
//places the first guidebook page on floor 1
|
||||
if (Dungeon.depth == 1 && !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_INTRO)){
|
||||
if (Dungeon.depth == 1 && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_INTRO)){
|
||||
int pos;
|
||||
do {
|
||||
//can't be on bottom row of tiles
|
||||
|
@ -78,7 +78,7 @@ public class EntranceRoom extends StandardRoom {
|
|||
}
|
||||
|
||||
//places the third guidebook page on floor 2
|
||||
if (Dungeon.depth == 2 && !Document.ADVENTURERS_GUIDE.pageFound(Document.GUIDE_SEARCHING)){
|
||||
if (Dungeon.depth == 2 && !Document.ADVENTURERS_GUIDE.isPageFound(Document.GUIDE_SEARCHING)){
|
||||
int pos;
|
||||
do {
|
||||
//can't be on bottom row of tiles
|
||||
|
|
|
@ -538,7 +538,7 @@ public class GameScene extends PixelScene {
|
|||
|
||||
}
|
||||
|
||||
if (Rankings.INSTANCE.totalNumber > 0 && !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_DIEING)){
|
||||
if (Rankings.INSTANCE.totalNumber > 0 && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_DIEING)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_DIEING);
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ public class GameScene extends PixelScene {
|
|||
GameScene.show( new WndHero() );
|
||||
} else if ( o instanceof Mob ){
|
||||
GameScene.show(new WndInfoMob((Mob) o));
|
||||
if (o instanceof Snake && !Document.ADVENTURERS_GUIDE.pageRead(Document.GUIDE_SURPRISE_ATKS)){
|
||||
if (o instanceof Snake && !Document.ADVENTURERS_GUIDE.isPageRead(Document.GUIDE_SURPRISE_ATKS)){
|
||||
GLog.p(Messages.get(Guidebook.class, "hint"));
|
||||
GameScene.flashForDocument(Document.GUIDE_SURPRISE_ATKS);
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ public class WndJournal extends WndTabbed {
|
|||
super( iconForPage(page), Messages.titleCase(Document.ADVENTURERS_GUIDE.pageTitle(page)));
|
||||
|
||||
this.page = page;
|
||||
found = Document.ADVENTURERS_GUIDE.pageFound(page);
|
||||
found = Document.ADVENTURERS_GUIDE.isPageFound(page);
|
||||
|
||||
if (!found) {
|
||||
icon.hardlight( 0.5f, 0.5f, 0.5f);
|
||||
|
@ -295,7 +295,7 @@ public class WndJournal extends WndTabbed {
|
|||
|
||||
//TODO might just want this to be part of the Document class
|
||||
public static Image iconForPage( String page ){
|
||||
if (!Document.ADVENTURERS_GUIDE.pageFound(page)){
|
||||
if (!Document.ADVENTURERS_GUIDE.isPageFound(page)){
|
||||
return new ItemSprite( ItemSpriteSheet.GUIDE_PAGE );
|
||||
}
|
||||
switch (page){
|
||||
|
@ -357,7 +357,7 @@ public class WndJournal extends WndTabbed {
|
|||
updateList();
|
||||
}
|
||||
};
|
||||
if (Document.ALCHEMY_GUIDE.pageFound(i)) {
|
||||
if (Document.ALCHEMY_GUIDE.isPageFound(i)) {
|
||||
pageButtons[i].icon(new ItemSprite(ItemSpriteSheet.SOMETHING + spriteIndexes[i], null));
|
||||
} else {
|
||||
pageButtons[i].icon(new ItemSprite(ItemSpriteSheet.SOMETHING, null));
|
||||
|
|
Loading…
Reference in New Issue
Block a user