diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6ef5486dd..d4acaff8f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -5,20 +5,20 @@ android:versionName="0.3.0d" android:installLocation="auto"> - + + android:minSdkVersion="8" + android:targetSdkVersion="21"/> + android:glEsVersion="0x00020000"/> - + android:smallScreens="false" + android:normalScreens="true" + android:largeScreens="true"/> + = depth || Dungeon.challenges > 0) { - depth = -1; - return; - } + //heroes which have won the game, who die far above their farthest depth, or who are challenged drop no bones. + if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth || Dungeon.challenges > 0) { + depth = -1; + return; + } item = pickItem(Dungeon.hero); @@ -69,59 +69,59 @@ public class Bones { } } - private static Item pickItem(Hero hero){ - Item item = null; - if (Random.Int(2) == 0) { - switch (Random.Int(5)) { - case 0: - item = hero.belongings.weapon; - break; - case 1: - item = hero.belongings.armor; - break; - case 2: - item = hero.belongings.misc1; - break; - case 3: - item = hero.belongings.misc2; - break; - case 4: - item = Dungeon.quickslot.randomNonePlaceholder(); - break; - } - if (item != null && !item.bones) - return pickItem(hero); - } else { + private static Item pickItem(Hero hero){ + Item item = null; + if (Random.Int(2) == 0) { + switch (Random.Int(5)) { + case 0: + item = hero.belongings.weapon; + break; + case 1: + item = hero.belongings.armor; + break; + case 2: + item = hero.belongings.misc1; + break; + case 3: + item = hero.belongings.misc2; + break; + case 4: + item = Dungeon.quickslot.randomNonePlaceholder(); + break; + } + if (item != null && !item.bones) + return pickItem(hero); + } else { - Iterator iterator = hero.belongings.backpack.iterator(); - Item curItem; - ArrayList items = new ArrayList(); - while (iterator.hasNext()){ - curItem = iterator.next(); - if (curItem.bones) - items.add(curItem); - } + Iterator iterator = hero.belongings.backpack.iterator(); + Item curItem; + ArrayList items = new ArrayList(); + while (iterator.hasNext()){ + curItem = iterator.next(); + if (curItem.bones) + items.add(curItem); + } - if (Random.Int(3) < items.size()) { - item = Random.element(items); - if (item.stackable){ - if (item instanceof MissileWeapon){ - item.quantity(Random.NormalIntRange(1, item.quantity())); - } else { - item.quantity(Random.NormalIntRange(1, (item.quantity() + 1) / 2)); - } - } - } - } - if (item == null) { - if (Dungeon.gold > 50) { - item = new Gold( Random.NormalIntRange( 50, Dungeon.gold ) ); - } else { - item = new Gold( 50 ); - } - } - return item; - } + if (Random.Int(3) < items.size()) { + item = Random.element(items); + if (item.stackable){ + if (item instanceof MissileWeapon){ + item.quantity(Random.NormalIntRange(1, item.quantity())); + } else { + item.quantity(Random.NormalIntRange(1, (item.quantity() + 1) / 2)); + } + } + } + } + if (item == null) { + if (Dungeon.gold > 50) { + item = new Gold( Random.NormalIntRange( 50, Dungeon.gold ) ); + } else { + item = new Gold( 50 ); + } + } + return item; + } public static Item get() { if (depth == -1) { @@ -141,36 +141,36 @@ public class Bones { } } else { - //heroes who are challenged cannot find bones + //heroes who are challenged cannot find bones if (depth == Dungeon.depth && Dungeon.challenges == 0) { Game.instance.deleteFile( BONES_FILE ); depth = 0; - if (item instanceof Artifact){ - if (Generator.removeArtifact((Artifact)item)) { - try { - Artifact artifact = (Artifact)item.getClass().newInstance(); - artifact.cursed = true; - artifact.cursedKnown = true; - //caps displayed artifact level - artifact.transferUpgrade(Math.min( - item.visiblyUpgraded(), - 1 + ((Dungeon.depth * 3) / 10))); + if (item instanceof Artifact){ + if (Generator.removeArtifact((Artifact)item)) { + try { + Artifact artifact = (Artifact)item.getClass().newInstance(); + artifact.cursed = true; + artifact.cursedKnown = true; + //caps displayed artifact level + artifact.transferUpgrade(Math.min( + item.visiblyUpgraded(), + 1 + ((Dungeon.depth * 3) / 10))); - return item; - } catch (Exception e) { - return new Gold(item.price()); - } - } else { - return new Gold(item.price()); - } - } + return item; + } catch (Exception e) { + return new Gold(item.price()); + } + } else { + return new Gold(item.price()); + } + } if (item.isUpgradable()) { item.cursed = true; item.cursedKnown = true; if (item.isUpgradable()) { - //gain 1 level every 3.333 floors down plus one additional level. + //gain 1 level every 3.333 floors down plus one additional level. int lvl = 1 + ((Dungeon.depth * 3) / 10); if (lvl < item.level) { item.degrade( item.level - lvl ); @@ -186,5 +186,5 @@ public class Bones { return null; } } - } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java b/src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java index 55f15f132..431967fcb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java @@ -19,26 +19,26 @@ package com.shatteredpixel.shatteredpixeldungeon; public class Challenges { - public static final int NO_FOOD = 1; - public static final int NO_ARMOR = 2; - public static final int NO_HEALING = 4; - public static final int NO_HERBALISM = 8; - public static final int SWARM_INTELLIGENCE = 16; - public static final int DARKNESS = 32; + public static final int NO_FOOD = 1; + public static final int NO_ARMOR = 2; + public static final int NO_HEALING = 4; + public static final int NO_HERBALISM = 8; + public static final int SWARM_INTELLIGENCE = 16; + public static final int DARKNESS = 32; public static final int NO_SCROLLS = 64; - public static final String[] NAMES = { - "On diet", - "Faith is my armor", - "Pharmacophobia", - "Barren land", - "Swarm intelligence", - "Into darkness", - "Forbidden runes" - }; + public static final String[] NAMES = { + "On diet", + "Faith is my armor", + "Pharmacophobia", + "Barren land", + "Swarm intelligence", + "Into darkness", + "Forbidden runes" + }; - public static final int[] MASKS = { - NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS - }; + public static final int[] MASKS = { + NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS + }; } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 6d160602c..4136c0349 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -73,45 +73,45 @@ public class Dungeon { public static int transmutation; // depth number for a well of transmutation - //enum of items which have limited spawns, records how many have spawned - //could all be their own separate numbers, but this allows iterating, much nicer for bundling/initializing. + //enum of items which have limited spawns, records how many have spawned + //could all be their own separate numbers, but this allows iterating, much nicer for bundling/initializing. public static enum limitedDrops{ - //limited world drops - strengthPotions, - upgradeScrolls, - arcaneStyli, + //limited world drops + strengthPotions, + upgradeScrolls, + arcaneStyli, - //all unlimited health potion sources + //all unlimited health potion sources swarmHP, batHP, warlockHP, scorpioHP, cookingHP, - //blandfruit, which can technically be an unlimited health potion source + //blandfruit, which can technically be an unlimited health potion source blandfruitSeed, - //doesn't use Generator, so we have to enforce one armband drop here + //doesn't use Generator, so we have to enforce one armband drop here armband, - //containers - dewVial, - seedBag, - scrollBag, - potionBag, - wandBag; + //containers + dewVial, + seedBag, + scrollBag, + potionBag, + wandBag; public int count = 0; - //for items which can only be dropped once, should directly access count otherwise. - public boolean dropped(){ - return count != 0; - } - public void drop(){ - count = 1; - } + //for items which can only be dropped once, should directly access count otherwise. + public boolean dropped(){ + return count != 0; + } + public void drop(){ + count = 1; + } } - public static int challenges; + public static int challenges; public static Hero hero; public static Level level; @@ -130,17 +130,17 @@ public class Dungeon { public static SparseArray> droppedItems; - public static int version; + public static int version; public static void init() { version = Game.versionCode; - challenges = ShatteredPixelDungeon.challenges(); + challenges = ShatteredPixelDungeon.challenges(); - Generator.initArtifacts(); + Generator.initArtifacts(); Actor.clear(); - Actor.resetNextID(); + Actor.resetNextID(); PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT ); @@ -152,7 +152,7 @@ public class Dungeon { Journal.reset(); quickslot.reset(); - QuickSlotButton.reset(); + QuickSlotButton.reset(); depth = 0; gold = 0; @@ -160,7 +160,7 @@ public class Dungeon { droppedItems = new SparseArray>(); for (limitedDrops a : limitedDrops.values()) - a.count = 0; + a.count = 0; transmutation = Random.IntRange( 6, 14 ); @@ -181,9 +181,9 @@ public class Dungeon { StartScene.curClass.initHero( hero ); } - public static boolean isChallenged( int mask ) { - return (challenges & mask) != 0; - } + public static boolean isChallenged( int mask ) { + return (challenges & mask) != 0; + } public static Level newLevel() { @@ -315,12 +315,12 @@ public class Dungeon { } observe(); - try { - saveAll(); - } catch (IOException e) { + try { + saveAll(); + } catch (IOException e) { /*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically. But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/ - } + } } public static void dropToChasm( Item item ) { @@ -372,23 +372,23 @@ public class Dungeon { private static final String RN_DEPTH_FILE = "ranger%d.dat"; private static final String VERSION = "version"; - private static final String CHALLENGES = "challenges"; + private static final String CHALLENGES = "challenges"; private static final String HERO = "hero"; private static final String GOLD = "gold"; private static final String DEPTH = "depth"; private static final String DROPPED = "dropped%d"; private static final String LEVEL = "level"; - private static final String LIMDROPS = "limiteddrops"; + private static final String LIMDROPS = "limiteddrops"; private static final String DV = "dewVial"; private static final String WT = "transmutation"; private static final String CHAPTERS = "chapters"; private static final String QUESTS = "quests"; private static final String BADGES = "badges"; - //TODO: to support pre-0.2.3 saves, remove when needed - private static final String POS = "potionsOfStrength"; - private static final String SOU = "scrollsOfEnhancement"; - private static final String AS = "arcaneStyli"; + //TODO: to support pre-0.2.3 saves, remove when needed + private static final String POS = "potionsOfStrength"; + private static final String SOU = "scrollsOfEnhancement"; + private static final String AS = "arcaneStyli"; public static String gameFile( HeroClass cl ) { switch (cl) { @@ -422,7 +422,7 @@ public class Dungeon { version = Game.versionCode; bundle.put( VERSION, version ); - bundle.put( CHALLENGES, challenges ); + bundle.put( CHALLENGES, challenges ); bundle.put( HERO, hero ); bundle.put( GOLD, gold ); bundle.put( DEPTH, depth ); @@ -435,10 +435,10 @@ public class Dungeon { bundle.put( WT, transmutation ); - int[] dropValues = new int[limitedDrops.values().length]; - for (limitedDrops value : limitedDrops.values()) - dropValues[value.ordinal()] = value.count; - bundle.put ( LIMDROPS, dropValues ); + int[] dropValues = new int[limitedDrops.values().length]; + for (limitedDrops value : limitedDrops.values()) + dropValues[value.ordinal()] = value.count; + bundle.put ( LIMDROPS, dropValues ); int count = 0; int ids[] = new int[chapters.size()]; @@ -458,13 +458,13 @@ public class Dungeon { Statistics.storeInBundle( bundle ); Journal.storeInBundle( bundle ); - Generator.storeInBundle( bundle ); + Generator.storeInBundle( bundle ); Scroll.save( bundle ); Potion.save( bundle ); Ring.save( bundle ); - Actor.storeNextID( bundle ); + Actor.storeNextID( bundle ); Bundle badges = new Bundle(); Badges.saveLocal( badges ); @@ -484,7 +484,7 @@ public class Dungeon { Bundle bundle = new Bundle(); bundle.put( LEVEL, level ); - OutputStream output = Game.instance.openFileOutput( + OutputStream output = Game.instance.openFileOutput( Utils.format( depthFile( hero.heroClass ), depth ), Game.MODE_PRIVATE ); Bundle.write( bundle, output ); output.close(); @@ -519,16 +519,16 @@ public class Dungeon { Bundle bundle = gameBundle( fileName ); - version = bundle.getInt( VERSION ); + version = bundle.getInt( VERSION ); Generator.reset(); - Actor.restoreNextID( bundle ); + Actor.restoreNextID( bundle ); quickslot.reset(); - QuickSlotButton.reset(); + QuickSlotButton.reset(); - Dungeon.challenges = bundle.getInt( CHALLENGES ); + Dungeon.challenges = bundle.getInt( CHALLENGES ); Dungeon.level = null; Dungeon.depth = -1; @@ -544,23 +544,23 @@ public class Dungeon { quickslot.restorePlaceholders( bundle ); if (fullLoad) { - transmutation = bundle.getInt( WT ); + transmutation = bundle.getInt( WT ); - //TODO: adjust this when dropping support for pre-0.2.3 saves - if (bundle.contains( LIMDROPS )) { - int[] dropValues = bundle.getIntArray(LIMDROPS); - for (limitedDrops value : limitedDrops.values()) - value.count = value.ordinal() < dropValues.length ? - dropValues[value.ordinal()] : 0; - } else { - for (limitedDrops value : limitedDrops.values()) - value.count = 0; - limitedDrops.strengthPotions.count = bundle.getInt(POS); - limitedDrops.upgradeScrolls.count = bundle.getInt(SOU); - limitedDrops.arcaneStyli.count = bundle.getInt(AS); - } - //for pre-0.2.4 saves - if (bundle.getBoolean(DV)) limitedDrops.dewVial.drop(); + //TODO: adjust this when dropping support for pre-0.2.3 saves + if (bundle.contains( LIMDROPS )) { + int[] dropValues = bundle.getIntArray(LIMDROPS); + for (limitedDrops value : limitedDrops.values()) + value.count = value.ordinal() < dropValues.length ? + dropValues[value.ordinal()] : 0; + } else { + for (limitedDrops value : limitedDrops.values()) + value.count = 0; + limitedDrops.strengthPotions.count = bundle.getInt(POS); + limitedDrops.upgradeScrolls.count = bundle.getInt(SOU); + limitedDrops.arcaneStyli.count = bundle.getInt(AS); + } + //for pre-0.2.4 saves + if (bundle.getBoolean(DV)) limitedDrops.dewVial.drop(); chapters = new HashSet(); int ids[] = bundle.getIntArray( CHAPTERS ); @@ -601,7 +601,7 @@ public class Dungeon { Statistics.restoreFromBundle( bundle ); Journal.restoreFromBundle( bundle ); - Generator.restoreFromBundle( bundle ); + Generator.restoreFromBundle( bundle ); droppedItems = new SparseArray>(); for (int i=2; i <= Statistics.deepestFloor + 1; i++) { @@ -669,7 +669,7 @@ public class Dungeon { public static void fail( String desc ) { resultDescription = desc; - if (hero.belongings.getItem( Ankh.class ) == null) { + if (hero.belongings.getItem( Ankh.class ) == null) { Rankings.INSTANCE.submit( false ); } } @@ -678,9 +678,9 @@ public class Dungeon { hero.belongings.identify(); - if (challenges != 0) { - Badges.validateChampion(); - } + if (challenges != 0) { + Badges.validateChampion(); + } resultDescription = desc; Rankings.INSTANCE.submit( true ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java b/src/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java index 1a9508cfe..5c945f93b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java @@ -32,8 +32,8 @@ public class DungeonTilemap extends Tilemap { private static DungeonTilemap instance; public DungeonTilemap() { - super( - Dungeon.level.tilesTex(), + super( + Dungeon.level.tilesTex(), new TextureFilm( Dungeon.level.tilesTex(), SIZE, SIZE ) ); map( Dungeon.level.map, Level.WIDTH ); @@ -76,8 +76,8 @@ public class DungeonTilemap extends Tilemap { } public static PointF tileCenterToWorld( int pos ) { - return new PointF( - (pos % Level.WIDTH + 0.5f) * SIZE, + return new PointF( + (pos % Level.WIDTH + 0.5f) * SIZE, (pos / Level.WIDTH + 0.5f) * SIZE ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/FogOfWar.java b/src/com/shatteredpixel/shatteredpixeldungeon/FogOfWar.java index 3b3c6b8b1..cb5cda28c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/FogOfWar.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/FogOfWar.java @@ -65,8 +65,8 @@ public class FogOfWar extends Image { texture( new FogTexture() ); - scale.set( - DungeonTilemap.SIZE, + scale.set( + DungeonTilemap.SIZE, DungeonTilemap.SIZE ); x = y = -size / 2; @@ -84,16 +84,16 @@ public class FogOfWar extends Image { for (int j=1; j < pWidth - 1; j++) { pos++; int c = INVISIBLE; - if (visible[pos] && visible[pos - (pWidth - 1)] && + if (visible[pos] && visible[pos - (pWidth - 1)] && visible[pos - 1] && visible[pos - (pWidth - 1) - 1]) { c = VISIBLE; - } else - if (visited[pos] && visited[pos - (pWidth - 1)] && + } else + if (visited[pos] && visited[pos - (pWidth - 1)] && visited[pos - 1] && visited[pos - (pWidth - 1) - 1]) { c = VISITED; } - else - if (mapped[pos] && mapped[pos - (pWidth - 1)] && + else + if (mapped[pos] && mapped[pos - (pWidth - 1)] && mapped[pos - 1] && mapped[pos - (pWidth - 1) - 1]) { c = MAPPED; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java index 8b1b799bd..574d2acd4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java @@ -26,17 +26,17 @@ enum Preferences { INSTANCE; public static final String KEY_LANDSCAPE = "landscape"; - public static final String KEY_IMMERSIVE = "immersive"; + public static final String KEY_IMMERSIVE = "immersive"; public static final String KEY_SCALE_UP = "scaleup"; public static final String KEY_MUSIC = "music"; public static final String KEY_SOUND_FX = "soundfx"; public static final String KEY_ZOOM = "zoom"; public static final String KEY_LAST_CLASS = "last_class"; - public static final String KEY_CHALLENGES = "challenges"; + public static final String KEY_CHALLENGES = "challenges"; public static final String KEY_QUICKSLOTS = "quickslots"; public static final String KEY_INTRO = "intro"; public static final String KEY_BRIGHTNESS = "brightness"; - public static final String KEY_VERSION = "version"; + public static final String KEY_VERSION = "version"; private SharedPreferences prefs; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/QuickSlot.java b/src/com/shatteredpixel/shatteredpixeldungeon/QuickSlot.java index 76112205c..7969954da 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/QuickSlot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/QuickSlot.java @@ -8,123 +8,120 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Collection; -/** - * Created by debenhame on 16/01/2015. - */ public class QuickSlot { - /** - * Slots contain objects which are also in a player's inventory. The one exception to this is when quantity is 0, - * which can happen for a stackable item that has been 'used up', these are refered to a placeholders. - */ + /** + * Slots contain objects which are also in a player's inventory. The one exception to this is when quantity is 0, + * which can happen for a stackable item that has been 'used up', these are refered to a placeholders. + */ - //note that the current max size is coded at 4, due to UI constraints, but it could be much much bigger with no issue. - public static int SIZE = 4; - private Item[] slots = new Item[SIZE]; + //note that the current max size is coded at 4, due to UI constraints, but it could be much much bigger with no issue. + public static int SIZE = 4; + private Item[] slots = new Item[SIZE]; - //direct array interaction methods, everything should build from these methods. - public void setSlot(int slot, Item item){ - clearItem(item); //we don't want to allow the same item in multiple slots. - slots[slot] = item; - } + //direct array interaction methods, everything should build from these methods. + public void setSlot(int slot, Item item){ + clearItem(item); //we don't want to allow the same item in multiple slots. + slots[slot] = item; + } - public void clearSlot(int slot){ - slots[slot] = null; - } + public void clearSlot(int slot){ + slots[slot] = null; + } - public void reset(){ - slots = new Item[SIZE]; - } + public void reset(){ + slots = new Item[SIZE]; + } - public Item getItem(int slot){ - return slots[slot]; - } + public Item getItem(int slot){ + return slots[slot]; + } - //utility methods, for easier use of the internal array. - public int getSlot(Item item) { - for (int i = 0; i < SIZE; i++) - if (getItem(i) == item) - return i; - return -1; - } + //utility methods, for easier use of the internal array. + public int getSlot(Item item) { + for (int i = 0; i < SIZE; i++) + if (getItem(i) == item) + return i; + return -1; + } - public Boolean isPlaceholder(int slot){ - return getItem(slot) != null && getItem(slot).quantity() == 0; - } + public Boolean isPlaceholder(int slot){ + return getItem(slot) != null && getItem(slot).quantity() == 0; + } public Boolean isNonePlaceholder(int slot){ return getItem(slot) != null && getItem(slot).quantity() > 0; } - public void clearItem(Item item){ - if (contains(item)) - clearSlot(getSlot(item)); - } + public void clearItem(Item item){ + if (contains(item)) + clearSlot(getSlot(item)); + } - public boolean contains(Item item){ - return getSlot(item) != -1; - } + public boolean contains(Item item){ + return getSlot(item) != -1; + } - public void replaceSimilar(Item item){ - for (int i = 0; i < SIZE; i++) - if (getItem(i) != null && item.isSimilar(getItem(i))) - setSlot( i , item ); - } + public void replaceSimilar(Item item){ + for (int i = 0; i < SIZE; i++) + if (getItem(i) != null && item.isSimilar(getItem(i))) + setSlot( i , item ); + } - public void convertToPlaceholder(Item item){ - Item placeholder = Item.virtual(item.getClass()); + public void convertToPlaceholder(Item item){ + Item placeholder = Item.virtual(item.getClass()); - if (placeholder != null && contains(item)) - for (int i = 0; i < SIZE; i++) - if (getItem(i) == item) - setSlot( i , placeholder ); - } + if (placeholder != null && contains(item)) + for (int i = 0; i < SIZE; i++) + if (getItem(i) == item) + setSlot( i , placeholder ); + } - public Item randomNonePlaceholder(){ + public Item randomNonePlaceholder(){ - ArrayList result = new ArrayList(); - for (int i = 0; i < SIZE; i ++) - if (getItem(i) != null && !isPlaceholder(i)) - result.add(getItem(i)); + ArrayList result = new ArrayList(); + for (int i = 0; i < SIZE; i ++) + if (getItem(i) != null && !isPlaceholder(i)) + result.add(getItem(i)); - return Random.element(result); - } + return Random.element(result); + } - private final String PLACEHOLDERS = "placeholders"; - private final String PLACEMENTS = "placements"; + private final String PLACEHOLDERS = "placeholders"; + private final String PLACEMENTS = "placements"; - /** - * Placements array is used as order is preserved while bundling, but exact index is not, so if we - * bundle both the placeholders (which preserves their order) and an array telling us where the placeholders are, - * we can reconstruct them perfectly. - */ + /** + * Placements array is used as order is preserved while bundling, but exact index is not, so if we + * bundle both the placeholders (which preserves their order) and an array telling us where the placeholders are, + * we can reconstruct them perfectly. + */ - public void storePlaceholders(Bundle bundle){ - ArrayList placeholders = new ArrayList(SIZE); - boolean[] placements = new boolean[SIZE]; + public void storePlaceholders(Bundle bundle){ + ArrayList placeholders = new ArrayList(SIZE); + boolean[] placements = new boolean[SIZE]; - for (int i = 0; i < SIZE; i++) - if (isPlaceholder(i)) { - placeholders.add(getItem(i)); - placements[i] = true; - } - bundle.put( PLACEHOLDERS, placeholders ); - bundle.put( PLACEMENTS, placements ); - } + for (int i = 0; i < SIZE; i++) + if (isPlaceholder(i)) { + placeholders.add(getItem(i)); + placements[i] = true; + } + bundle.put( PLACEHOLDERS, placeholders ); + bundle.put( PLACEMENTS, placements ); + } - public void restorePlaceholders(Bundle bundle){ - Collection placeholders = bundle.getCollection(PLACEHOLDERS); - boolean[] placements = bundle.getBooleanArray( PLACEMENTS ); + public void restorePlaceholders(Bundle bundle){ + Collection placeholders = bundle.getCollection(PLACEHOLDERS); + boolean[] placements = bundle.getBooleanArray( PLACEMENTS ); - int i = 0; - for (Bundlable item : placeholders){ - while (!placements[i]) i++; - setSlot( i, (Item)item ); - i++; - } + int i = 0; + for (Bundlable item : placeholders){ + while (!placements[i]) i++; + setSlot( i, (Item)item ); + i++; + } - } + } -} +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index 594dc9208..78b2e4984 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -140,7 +140,7 @@ public enum Rankings { for (Bundlable record : bundle.getCollection( RECORDS )) { records.add( (Record)record ); - } + } lastRecord = bundle.getInt( LATEST ); totalNumber = bundle.getInt( TOTAL ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index bc2d4a539..14b80a562 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -94,20 +94,20 @@ public class ShatteredPixelDungeon extends Game { super.onCreate(savedInstanceState); /* if (android.os.Build.VERSION.SDK_INT >= 19) { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE | - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_FULLSCREEN | + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY ); }*/ - updateImmersiveMode(); + updateImmersiveMode(); - DisplayMetrics metrics = new DisplayMetrics(); - instance.getWindowManager().getDefaultDisplay().getMetrics( metrics ); - boolean landscape = metrics.widthPixels > metrics.heightPixels; + DisplayMetrics metrics = new DisplayMetrics(); + instance.getWindowManager().getDefaultDisplay().getMetrics( metrics ); + boolean landscape = metrics.widthPixels > metrics.heightPixels; if (Preferences.INSTANCE.getBoolean( Preferences.KEY_LANDSCAPE, false ) != landscape) { landscape( !landscape ); @@ -121,16 +121,16 @@ public class ShatteredPixelDungeon extends Game { Assets.SND_BADGE, Assets.SND_GOLD, - Assets.SND_STEP, - Assets.SND_WATER, - Assets.SND_OPEN, - Assets.SND_UNLOCK, - Assets.SND_ITEM, - Assets.SND_DEWDROP, - Assets.SND_HIT, - Assets.SND_MISS, + Assets.SND_STEP, + Assets.SND_WATER, + Assets.SND_OPEN, + Assets.SND_UNLOCK, + Assets.SND_ITEM, + Assets.SND_DEWDROP, + Assets.SND_HIT, + Assets.SND_MISS, - Assets.SND_DESCEND, + Assets.SND_DESCEND, Assets.SND_EAT, Assets.SND_READ, Assets.SND_LULLABY, @@ -167,20 +167,20 @@ public class ShatteredPixelDungeon extends Game { Assets.SND_MIMIC ); } - @Override - public void onWindowFocusChanged( boolean hasFocus ) { + @Override + public void onWindowFocusChanged( boolean hasFocus ) { - super.onWindowFocusChanged( hasFocus ); + super.onWindowFocusChanged( hasFocus ); - if (hasFocus) { - updateImmersiveMode(); - } - } + if (hasFocus) { + updateImmersiveMode(); + } + } - public static void switchNoFade( Class c ) { - PixelScene.noFade = true; - switchScene( c ); - } + public static void switchNoFade( Class c ) { + PixelScene.noFade = true; + switchScene( c ); + } /* * ---> Prefernces @@ -202,59 +202,59 @@ public class ShatteredPixelDungeon extends Game { switchScene( TitleScene.class ); } - // *** IMMERSIVE MODE **** + // *** IMMERSIVE MODE **** - private static boolean immersiveModeChanged = false; + private static boolean immersiveModeChanged = false; - @SuppressLint("NewApi") - public static void immerse( boolean value ) { - Preferences.INSTANCE.put( Preferences.KEY_IMMERSIVE, value ); + @SuppressLint("NewApi") + public static void immerse( boolean value ) { + Preferences.INSTANCE.put( Preferences.KEY_IMMERSIVE, value ); - instance.runOnUiThread( new Runnable() { - @Override - public void run() { - updateImmersiveMode(); - immersiveModeChanged = true; - } - } ); - } + instance.runOnUiThread( new Runnable() { + @Override + public void run() { + updateImmersiveMode(); + immersiveModeChanged = true; + } + } ); + } - @Override - public void onSurfaceChanged( GL10 gl, int width, int height ) { - super.onSurfaceChanged( gl, width, height ); + @Override + public void onSurfaceChanged( GL10 gl, int width, int height ) { + super.onSurfaceChanged( gl, width, height ); - if (immersiveModeChanged) { - requestedReset = true; - immersiveModeChanged = false; - } - } + if (immersiveModeChanged) { + requestedReset = true; + immersiveModeChanged = false; + } + } - @SuppressLint("NewApi") - public static void updateImmersiveMode() { - if (android.os.Build.VERSION.SDK_INT >= 19) { - try { - // Sometime NullPointerException happens here - instance.getWindow().getDecorView().setSystemUiVisibility( - immersed() ? - View.SYSTEM_UI_FLAG_LAYOUT_STABLE | - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY - : - 0 ); - } catch (Exception e) { - reportException( e ); - } - } - } + @SuppressLint("NewApi") + public static void updateImmersiveMode() { + if (android.os.Build.VERSION.SDK_INT >= 19) { + try { + // Sometime NullPointerException happens here + instance.getWindow().getDecorView().setSystemUiVisibility( + immersed() ? + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + : + 0 ); + } catch (Exception e) { + reportException( e ); + } + } + } - public static boolean immersed() { - return Preferences.INSTANCE.getBoolean( Preferences.KEY_IMMERSIVE, false ); - } + public static boolean immersed() { + return Preferences.INSTANCE.getBoolean( Preferences.KEY_IMMERSIVE, false ); + } - // ***************************** + // ***************************** public static boolean scaleUp() { return Preferences.INSTANCE.getBoolean( Preferences.KEY_SCALE_UP, true ); @@ -305,13 +305,13 @@ public class ShatteredPixelDungeon extends Game { return Preferences.INSTANCE.getInt( Preferences.KEY_LAST_CLASS, 0 ); } - public static void challenges( int value ) { - Preferences.INSTANCE.put( Preferences.KEY_CHALLENGES, value ); - } + public static void challenges( int value ) { + Preferences.INSTANCE.put( Preferences.KEY_CHALLENGES, value ); + } - public static int challenges() { - return Preferences.INSTANCE.getInt( Preferences.KEY_CHALLENGES, 0 ); - } + public static int challenges() { + return Preferences.INSTANCE.getInt( Preferences.KEY_CHALLENGES, 0 ); + } public static void quickSlots( int value ){ Preferences.INSTANCE.put( Preferences.KEY_QUICKSLOTS, value ); } @@ -325,13 +325,13 @@ public class ShatteredPixelDungeon extends Game { return Preferences.INSTANCE.getBoolean( Preferences.KEY_INTRO, true ); } - public static void version( int value) { - Preferences.INSTANCE.put( Preferences.KEY_VERSION, value ); - } + public static void version( int value) { + Preferences.INSTANCE.put( Preferences.KEY_VERSION, value ); + } - public static int version() { - return Preferences.INSTANCE.getInt( Preferences.KEY_VERSION, 0 ); - } + public static int version() { + return Preferences.INSTANCE.getInt( Preferences.KEY_VERSION, 0 ); + } /* * <--- Preferences diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Statistics.java b/src/com/shatteredpixel/shatteredpixeldungeon/Statistics.java index ba4dc604f..8df847f28 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Statistics.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Statistics.java @@ -45,7 +45,7 @@ public class Statistics { foodEaten = 0; potionsCooked = 0; piranhasKilled = 0; - nightHunt = 0; + nightHunt = 0; ankhsUsed = 0; duration = 0; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java index 8f9fb99fd..a8a1a6591 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java @@ -83,7 +83,7 @@ public abstract class Actor implements Bundlable { id = bundle.getInt( ID ); } - private static int nextID = 1; + private static int nextID = 1; public int id() { if (id > 0) { return id; @@ -144,25 +144,25 @@ public abstract class Actor implements Bundlable { current = null; } - private static final String NEXTID = "nextid"; + private static final String NEXTID = "nextid"; - public static void storeNextID( Bundle bundle){ - bundle.put( NEXTID, nextID ); - } + public static void storeNextID( Bundle bundle){ + bundle.put( NEXTID, nextID ); + } - public static void restoreNextID( Bundle bundle){ - nextID = bundle.getInt( NEXTID ); - } + public static void restoreNextID( Bundle bundle){ + nextID = bundle.getInt( NEXTID ); + } - public static void resetNextID(){ - nextID = 1; - } + public static void resetNextID(){ + nextID = 1; + } - /*protected*/public void next() { - if (current == this) { - current = null; - } - } + /*protected*/public void next() { + if (current == this) { + current = null; + } + } public static void process() { @@ -190,12 +190,12 @@ public abstract class Actor implements Bundlable { if (current != null) { - if (current instanceof Char && ((Char)current).sprite.isMoving) { - // If it's character's turn to act, but its sprite - // is moving, wait till the movement is over - current = null; - break; - } + if (current instanceof Char && ((Char)current).sprite.isMoving) { + // If it's character's turn to act, but its sprite + // is moving, wait till the movement is over + current = null; + break; + } doNext = current.act(); if (doNext && !Dungeon.hero.isAlive()) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 1be64e112..c1fced893 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -121,7 +121,7 @@ public abstract class Char extends Actor { // FIXME int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass == - HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() ); + HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() ); int dmg = damageRoll(); int effectiveDamage = Math.max( dmg - dr, 0 ); @@ -242,11 +242,11 @@ public abstract class Char extends Actor { return; } if (this.buff(Frost.class) != null){ - Buff.detach( this, Frost.class ); - } - if (this.buff(MagicalSleep.class) != null){ - Buff.detach(this, MagicalSleep.class); - } + Buff.detach( this, Frost.class ); + } + if (this.buff(MagicalSleep.class) != null){ + Buff.detach(this, MagicalSleep.class); + } Class srcClass = src.getClass(); if (immunities().contains( srcClass )) { @@ -266,8 +266,8 @@ public abstract class Char extends Actor { HP -= dmg; if (dmg > 0 || src instanceof Char) { - sprite.showStatus( HP > HT / 2 ? - CharSprite.WARNING : + sprite.showStatus( HP > HT / 2 ? + CharSprite.WARNING : CharSprite.NEGATIVE, Integer.toString( dmg ) ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java index d0a633c59..3b659693b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java @@ -70,7 +70,7 @@ public class Alchemy extends Blob { @Override public void use( BlobEmitter emitter ) { - super.use( emitter ); + super.use( emitter ); emitter.start( Speck.factory( Speck.BUBBLE ), 0.4f, 0 ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java index 2a2d7a15c..7c911136f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java @@ -94,7 +94,7 @@ public class Blob extends Actor { int[] data = bundle.getIntArray( CUR ); if (data != null) { - int start = bundle.getInt( START ); + int start = bundle.getInt( START ); for (int i=0; i < data.length; i++) { cur[i + start] = data[i]; volume += data[i]; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ConfusionGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ConfusionGas.java index 4e6f8861c..ad08746b2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ConfusionGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ConfusionGas.java @@ -26,28 +26,28 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; public class ConfusionGas extends Blob { - @Override - protected void evolve() { - super.evolve(); + @Override + protected void evolve() { + super.evolve(); - Char ch; - for (int i=0; i < LENGTH; i++) { - if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) { - if (!ch.immunities().contains(this.getClass())) - Buff.prolong( ch, Vertigo.class, 2 ); - } - } - } + Char ch; + for (int i=0; i < LENGTH; i++) { + if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) { + if (!ch.immunities().contains(this.getClass())) + Buff.prolong( ch, Vertigo.class, 2 ); + } + } + } - @Override - public void use( BlobEmitter emitter ) { - super.use( emitter ); + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); - emitter.pour( Speck.factory( Speck.CONFUSION, true ), 0.6f ); - } + emitter.pour( Speck.factory( Speck.CONFUSION, true ), 0.6f ); + } - @Override - public String tileDesc() { - return "A cloud of confusion gas is swirling here."; - } + @Override + public String tileDesc() { + return "A cloud of confusion gas is swirling here."; + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java index caa5a830e..9221cef35 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java @@ -75,7 +75,7 @@ public class Foliage extends Blob { @Override public void use( BlobEmitter emitter ) { - super.use( emitter ); + super.use( emitter ); emitter.start( ShaftParticle.FACTORY, 0.9f, 0 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java index 2aaa417f5..7c548ff0d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java @@ -33,13 +33,13 @@ public class Freezing { // Returns true, if this cell is visible public static boolean affect( int cell, Fire fire ) { - Char ch = Actor.findChar( cell ); + Char ch = Actor.findChar( cell ); if (ch != null) { - if (Level.water[ch.pos]){ - Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f)); - } else { - Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f)); - } + if (Level.water[ch.pos]){ + Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f)); + } else { + Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f)); + } } if (fire != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/GooWarn.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/GooWarn.java index be3512282..f7d716302 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/GooWarn.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/GooWarn.java @@ -5,52 +5,49 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.sprites.GooSprite; -/** - * Created by Evan on 29/09/2014. - */ public class GooWarn extends Blob { - //cosmetic blob, used to warn noobs that goo's pump up should, infact, be avoided. + //cosmetic blob, used to warn noobs that goo's pump up should, infact, be avoided. - { - //this one needs to act after the Goo - actPriority = 3; - } + { + //this one needs to act after the Goo + actPriority = 3; + } - protected int pos; + protected int pos; - @Override - protected void evolve() { - for (int i=0; i < LENGTH; i++) { + @Override + protected void evolve() { + for (int i=0; i < LENGTH; i++) { - int offv = cur[i] > 0 ? cur[i] - 1 : 0; - off[i] = offv; + int offv = cur[i] > 0 ? cur[i] - 1 : 0; + off[i] = offv; - if (offv > 0) { - volume += offv; - } - } + if (offv > 0) { + volume += offv; + } + } - } + } - public void seed( int cell, int amount ) { - int diff = amount - cur[cell]; - if (diff > 0) { - cur[cell] = amount; - volume += diff; - } - } + public void seed( int cell, int amount ) { + int diff = amount - cur[cell]; + if (diff > 0) { + cur[cell] = amount; + volume += diff; + } + } - @Override - public void use( BlobEmitter emitter ) { - super.use( emitter ); - emitter.pour(GooSprite.GooParticle.FACTORY, 0.03f ); - } + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); + emitter.pour(GooSprite.GooParticle.FACTORY, 0.03f ); + } - @Override - public String tileDesc() { - return "Specs of dark energy are swarming here!"; - } + @Override + public String tileDesc() { + return "Specs of dark energy are swarming here!"; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java index fa57c2214..ce88b497c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ParalyticGas.java @@ -33,8 +33,8 @@ public class ParalyticGas extends Blob { Char ch; for (int i=0; i < LENGTH; i++) { if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) { - if (!ch.immunities().contains(this.getClass())) - Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch ) ); + if (!ch.immunities().contains(this.getClass())) + Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch ) ); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StenchGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StenchGas.java index 6de30ef5e..2a76b92e3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StenchGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StenchGas.java @@ -7,33 +7,30 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -/** - * Created by debenhame on 08/10/2014. - */ public class StenchGas extends Blob { - @Override - protected void evolve() { - super.evolve(); + @Override + protected void evolve() { + super.evolve(); - Char ch; - for (int i=0; i < LENGTH; i++) { - if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { - if (!ch.immunities().contains(this.getClass())) - Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch )/5 ); - } - } - } + Char ch; + for (int i=0; i < LENGTH; i++) { + if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { + if (!ch.immunities().contains(this.getClass())) + Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch )/5 ); + } + } + } - @Override - public void use( BlobEmitter emitter ) { - super.use( emitter ); + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); - emitter.pour( Speck.factory(Speck.STENCH), 0.6f ); - } + emitter.pour( Speck.factory(Speck.STENCH), 0.6f ); + } - @Override - public String tileDesc() { - return "A cloud of fetid stench is swirling here."; - } + @Override + public String tileDesc() { + return "A cloud of fetid stench is swirling here."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java index ccf8fdabe..5568ab1ad 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ToxicGas.java @@ -31,20 +31,20 @@ import com.watabou.utils.Random; public class ToxicGas extends Blob implements Hero.Doom { - @Override - protected void evolve() { - super.evolve(); + @Override + protected void evolve() { + super.evolve(); - int levelDamage = 5 + Dungeon.depth * 5; + int levelDamage = 5 + Dungeon.depth * 5; - Char ch; - for (int i=0; i < LENGTH; i++) { - if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) { + Char ch; + for (int i=0; i < LENGTH; i++) { + if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) { - int damage = (ch.HT + levelDamage) / 40; - if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) { - damage++; - } + int damage = (ch.HT + levelDamage) / 40; + if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) { + damage++; + } ch.damage( damage, this ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java index 76f55237c..fe0c22daf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java @@ -8,58 +8,55 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.watabou.utils.Bundle; -/** - * Created by Evan on 12/04/2015. - */ public class VenomGas extends Blob { - private int strength = 0; + private int strength = 0; - @Override - protected void evolve() { - super.evolve(); + @Override + protected void evolve() { + super.evolve(); - if (volume == 0){ - strength = 0; - } else { - Char ch; - for (int i = 0; i < LENGTH; i++) { - if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { - if (!ch.immunities().contains(this.getClass())) - Buff.affect(ch, Venom.class).set(2f, strength); - } - } - } - } + if (volume == 0){ + strength = 0; + } else { + Char ch; + for (int i = 0; i < LENGTH; i++) { + if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { + if (!ch.immunities().contains(this.getClass())) + Buff.affect(ch, Venom.class).set(2f, strength); + } + } + } + } - public void setStrength(int str){ - if (str > strength) - strength = str; - } + public void setStrength(int str){ + if (str > strength) + strength = str; + } - private static final String STRENGTH = "strength"; + private static final String STRENGTH = "strength"; - @Override - public void restoreFromBundle(Bundle bundle) { - super.restoreFromBundle(bundle); - strength = bundle.getInt( STRENGTH ); - } + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + strength = bundle.getInt( STRENGTH ); + } - @Override - public void storeInBundle(Bundle bundle) { - super.storeInBundle(bundle); - bundle.put( STRENGTH, strength ); - } + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put( STRENGTH, strength ); + } - @Override - public void use( BlobEmitter emitter ) { - super.use( emitter ); + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); - emitter.pour( Speck.factory(Speck.VENOM), 0.6f ); - } + emitter.pour( Speck.factory(Speck.VENOM), 0.6f ); + } - @Override - public String tileDesc() { - return "A could of foul acidic venom is swirling here."; - } + @Override + public String tileDesc() { + return "A could of foul acidic venom is swirling here."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java index b53012414..18a2b0686 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java @@ -94,13 +94,13 @@ public class WaterOfAwareness extends WellWater { @Override public void use( BlobEmitter emitter ) { - super.use( emitter ); + super.use( emitter ); emitter.pour( Speck.factory( Speck.QUESTION ), 0.3f ); } @Override public String tileDesc() { - return + return "Power of knowledge radiates from the water of this well. " + "Take a sip from it to reveal all secrets of equipped items."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java index 53956a90a..11da20dc0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java @@ -70,13 +70,13 @@ public class WaterOfHealth extends WellWater { @Override public void use( BlobEmitter emitter ) { - super.use( emitter ); + super.use( emitter ); emitter.start( Speck.factory( Speck.HEALING ), 0.5f, 0 ); } @Override public String tileDesc() { - return + return "Power of health radiates from the water of this well. " + "Take a sip from it to heal your wounds and satisfy hunger."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java index a11290bff..012a9b1c1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java @@ -55,7 +55,7 @@ public class WaterOfTransmutation extends WellWater { item = changeSeed( (Plant.Seed)item ); } else if (item instanceof Artifact) { item = changeArtifact( (Artifact)item ); - } else { + } else { item = null; } @@ -69,7 +69,7 @@ public class WaterOfTransmutation extends WellWater { @Override public void use( BlobEmitter emitter ) { - super.use( emitter ); + super.use( emitter ); emitter.start( Speck.factory( Speck.CHANGE ), 0.2f, 0 ); } @@ -149,18 +149,18 @@ public class WaterOfTransmutation extends WellWater { return n; } - private Artifact changeArtifact( Artifact a ) { - Artifact n = Generator.randomArtifact(); + private Artifact changeArtifact( Artifact a ) { + Artifact n = Generator.randomArtifact(); - if (n != null){ - n.cursedKnown = a.cursedKnown; - n.cursed = a.cursed; - n.levelKnown = a.levelKnown; + if (n != null){ + n.cursedKnown = a.cursedKnown; + n.cursed = a.cursed; + n.levelKnown = a.levelKnown; n.transferUpgrade(a.visiblyUpgraded()); - } + } - return n; - } + return n; + } private Wand changeWand( Wand w ) { @@ -231,7 +231,7 @@ public class WaterOfTransmutation extends WellWater { @Override public String tileDesc() { - return + return "Power of change radiates from the water of this well. " + "Throw an item into the well to turn it into something else."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java index 0c44a3df7..1c70f5d35 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java @@ -132,9 +132,9 @@ public class WellWater extends Blob { for (ClasswaterClass : waters) { WellWater water = (WellWater)Dungeon.level.blobs.get( waterClass ); - if (water != null && - water.volume > 0 && - water.pos == cell && + if (water != null && + water.volume > 0 && + water.pos == cell && water.affect()) { Level.set( cell, Terrain.EMPTY_WELL ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java index 28d745e51..91b34b3f7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java @@ -31,14 +31,14 @@ public class Amok extends FlavourBuff { return BuffIndicator.AMOK; } - @Override - public void detach() { - super.detach(); - if (target instanceof Mob) - ((Mob)target).aggro( null ); - } + @Override + public void detach() { + super.detach(); + if (target instanceof Mob) + ((Mob)target).aggro( null ); + } - @Override + @Override public String toString() { return "Amok"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java index a3e28403d..a47745455 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java @@ -72,7 +72,7 @@ public class Bleeding extends Buff { target.damage( level, this ); if (target.sprite.visible) { - Splash.at( target.sprite.center(), -PointF.PI / 2, PointF.PI / 6, + Splash.at( target.sprite.center(), -PointF.PI / 2, PointF.PI / 6, target.sprite.blood(), Math.min( 10 * level / target.HT, 10 ) ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java index a99c314c2..353193541 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java @@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -/** - * Created by debenhame on 27/04/2015. - */ public class Bless extends FlavourBuff { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java index 71dc20085..e8c7e6007 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java @@ -37,9 +37,9 @@ public class Buff extends Actor { public enum buffType {POSITIVE, NEGATIVE, NEUTRAL, SILENT}; public buffType type = buffType.SILENT; - public HashSet> resistances = new HashSet>(); + public HashSet> resistances = new HashSet>(); - public HashSet> immunities = new HashSet>(); + public HashSet> immunities = new HashSet>(); public boolean attachTo( Char target ) { @@ -50,11 +50,11 @@ public class Buff extends Actor { this.target = target; target.add( this ); - if (target.buffs().contains(this)){ + if (target.buffs().contains(this)){ if (target.sprite != null) fx( true ); return true; } else - return false; + return false; } public void detach() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index 2b0faadcf..07a7d9afc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -89,7 +89,7 @@ public class Burning extends Buff implements Hero.Doom { } else if (item instanceof MysteryMeat) { item = item.detach( hero.belongings.backpack ); - ChargrilledMeat steak = new ChargrilledMeat(); + ChargrilledMeat steak = new ChargrilledMeat(); if (!steak.collect( hero.belongings.backpack )) { Dungeon.level.drop( steak, hero.pos ).sprite.drop(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java index 8b40873a5..d01b07bda 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java @@ -15,9 +15,6 @@ import com.watabou.utils.Random; import java.text.DecimalFormat; -/** - * Created by debenhame on 23/04/2015. - */ public class Chill extends FlavourBuff { private static final String TXT_FREEZES = "%s freezes!"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Corruption.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Corruption.java index ccb0697a3..8dcfad61a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Corruption.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Corruption.java @@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -/** - * Created by Evan on 14/05/2015. - */ public class Corruption extends Buff { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java index 69a5eca3f..cf177f84b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java @@ -23,43 +23,43 @@ import com.watabou.utils.Random; public class Drowsy extends Buff { - { - type = buffType.NEUTRAL; - } + { + type = buffType.NEUTRAL; + } - @Override - public int icon() { - return BuffIndicator.DROWSY; - } + @Override + public int icon() { + return BuffIndicator.DROWSY; + } - public boolean attachTo( Char target ) { - if (!target.immunities().contains(Sleep.class) && super.attachTo(target)) { - if (cooldown() == 0) - spend(Random.Int(3, 6)); - return true; - } - return false; - } + public boolean attachTo( Char target ) { + if (!target.immunities().contains(Sleep.class) && super.attachTo(target)) { + if (cooldown() == 0) + spend(Random.Int(3, 6)); + return true; + } + return false; + } - @Override - public boolean act(){ - Buff.affect(target, MagicalSleep.class); + @Override + public boolean act(){ + Buff.affect(target, MagicalSleep.class); - detach(); - return true; - } + detach(); + return true; + } - @Override - public String toString() { - return "Drowsy"; - } + @Override + public String toString() { + return "Drowsy"; + } - @Override - public String desc() { - return "A magical force is making it difficult to stay awake.\n" + - "\n" + - "The hero can resist drowsiness by taking damage or by being at full health.\n" + - "\n" + - "After " + dispTurns(cooldown()+1) + ", the target will fall into a deep magical sleep."; - } + @Override + public String desc() { + return "A magical force is making it difficult to stay awake.\n" + + "\n" + + "The hero can resist drowsiness by taking damage or by being at full health.\n" + + "\n" + + "After " + dispTurns(cooldown()+1) + ", the target will fall into a deep magical sleep."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java index 40ef18a92..7e95812e1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java @@ -8,40 +8,37 @@ import com.watabou.utils.Bundle; import java.util.HashSet; -/** - * Created by debenhame on 19/11/2014. - */ public class EarthImbue extends FlavourBuff { - public static final float DURATION = 30f; + public static final float DURATION = 30f; - public void proc(Char enemy){ - Buff.affect(enemy, Roots.class, 2); - CellEmitter.bottom(enemy.pos).start(EarthParticle.FACTORY, 0.05f, 8); - } + public void proc(Char enemy){ + Buff.affect(enemy, Roots.class, 2); + CellEmitter.bottom(enemy.pos).start(EarthParticle.FACTORY, 0.05f, 8); + } - @Override - public int icon() { - return BuffIndicator.ROOTS; - } + @Override + public int icon() { + return BuffIndicator.ROOTS; + } - @Override - public String toString() { - return "Imbued with Earth"; - } + @Override + public String toString() { + return "Imbued with Earth"; + } - @Override - public String desc() { - return "You are inbued with the power of earth!\n" + - "\n" + - "All physical attacks will command roots to lock the enemy in place while the effect lasts.\n" + - "\n" + - "You are imbued for " + dispTurns() + "."; - } + @Override + public String desc() { + return "You are inbued with the power of earth!\n" + + "\n" + + "All physical attacks will command roots to lock the enemy in place while the effect lasts.\n" + + "\n" + + "You are imbued for " + dispTurns() + "."; + } - { - immunities.add( Paralysis.class ); - immunities.add( Roots.class ); - immunities.add( Slow.class ); - } + { + immunities.add( Paralysis.class ); + immunities.add( Roots.class ); + immunities.add( Slow.class ); + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java index c2488dbf3..a2d99f8d9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java @@ -11,77 +11,74 @@ import com.watabou.utils.Random; import java.util.HashSet; -/** - * Created by debenhame on 19/11/2014. - */ public class FireImbue extends Buff { - public static final float DURATION = 30f; + public static final float DURATION = 30f; - protected float left; + protected float left; - private static final String LEFT = "left"; + private static final String LEFT = "left"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( LEFT, left ); + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( LEFT, left ); - } + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - left = bundle.getFloat( LEFT ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + left = bundle.getFloat( LEFT ); + } - public void set( float duration ) { - this.left = duration; - }; + public void set( float duration ) { + this.left = duration; + }; - @Override - public boolean act() { - if (Dungeon.level.map[target.pos] == Terrain.GRASS) { - Dungeon.level.set(target.pos, Terrain.EMBERS); - GameScene.updateMap(target.pos); - } + @Override + public boolean act() { + if (Dungeon.level.map[target.pos] == Terrain.GRASS) { + Dungeon.level.set(target.pos, Terrain.EMBERS); + GameScene.updateMap(target.pos); + } - spend(TICK); - left -= TICK; - if (left <= 0) - detach(); + spend(TICK); + left -= TICK; + if (left <= 0) + detach(); - return true; - } + return true; + } - public void proc(Char enemy){ - if (Random.Int(2) == 0) - Buff.affect( enemy, Burning.class ).reignite( enemy ); + public void proc(Char enemy){ + if (Random.Int(2) == 0) + Buff.affect( enemy, Burning.class ).reignite( enemy ); - enemy.sprite.emitter().burst( FlameParticle.FACTORY, 2 ); - } + enemy.sprite.emitter().burst( FlameParticle.FACTORY, 2 ); + } - @Override - public int icon() { - return BuffIndicator.FIRE; - } + @Override + public int icon() { + return BuffIndicator.FIRE; + } - @Override - public String toString() { - return "Imbued with Fire"; - } + @Override + public String toString() { + return "Imbued with Fire"; + } - @Override - public String desc() { - return "You are imbued with the power of fire!\n" + - "\n" + - "All physical attacks will have a chance to light enemies ablaze. " + - "Additionally, you are completely immune to the effects of fire.\n" + - "\n" + - "You are imbued for " + dispTurns(left) + "."; - } + @Override + public String desc() { + return "You are imbued with the power of fire!\n" + + "\n" + + "All physical attacks will have a chance to light enemies ablaze. " + + "Additionally, you are completely immune to the effects of fire.\n" + + "\n" + + "You are imbued for " + dispTurns(left) + "."; + } - { - immunities.add( Burning.class ); - } + { + immunities.add( Burning.class ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java index 2aadc7389..11a4ea231 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java @@ -62,7 +62,7 @@ public class Frost extends FlavourBuff { } else if (item instanceof MysteryMeat) { item = item.detach( hero.belongings.backpack ); - FrozenCarpaccio carpaccio = new FrozenCarpaccio(); + FrozenCarpaccio carpaccio = new FrozenCarpaccio(); if (!carpaccio.collect( hero.belongings.backpack )) { Dungeon.level.drop( carpaccio, target.pos ).sprite.drop(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java index b1dca3873..0856a84f6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java @@ -39,10 +39,10 @@ public class GasesImmunity extends FlavourBuff { } { - immunities.add( ParalyticGas.class ); - immunities.add( ToxicGas.class ); - immunities.add( ConfusionGas.class ); - immunities.add( StenchGas.class ); + immunities.add( ParalyticGas.class ); + immunities.add( ToxicGas.class ); + immunities.add( ConfusionGas.class ); + immunities.add( StenchGas.class ); immunities.add( VenomGas.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java index c90916148..3b63f0646 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java @@ -44,8 +44,8 @@ public class Invisibility extends FlavourBuff { @Override public void detach() { - if (target.invisible > 0) - target.invisible--; + if (target.invisible > 0) + target.invisible--; super.detach(); } @@ -80,15 +80,15 @@ public class Invisibility extends FlavourBuff { if (buff != null) { buff.detach(); } - CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class ); - if (cloakBuff != null) { - cloakBuff.act(); - cloakBuff.detach(); - } - //this isn't a form of invisibilty, but it is meant to dispel at the same time as it. - TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff( TimekeepersHourglass.timeFreeze.class ); - if (timeFreeze != null) { - timeFreeze.detach(); - } + CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class ); + if (cloakBuff != null) { + cloakBuff.act(); + cloakBuff.detach(); + } + //this isn't a form of invisibilty, but it is meant to dispel at the same time as it. + TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff( TimekeepersHourglass.timeFreeze.class ); + if (timeFreeze != null) { + timeFreeze.detach(); + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/LockedFloor.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/LockedFloor.java index c674315ac..9f2fe1228 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/LockedFloor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/LockedFloor.java @@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -/** - * Created by Evan on 04/04/2015. - */ public class LockedFloor extends Buff { //this buff is purely meant as a visual indicator that the gameplay implications of a level seal are in effect. diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java index 77d257692..8c897ade7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java @@ -25,70 +25,70 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; public class MagicalSleep extends Buff { - private static final float STEP = 1f; - public static final float SWS = 1.5f; + private static final float STEP = 1f; + public static final float SWS = 1.5f; - @Override - public boolean attachTo( Char target ) { - if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) { + @Override + public boolean attachTo( Char target ) { + if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) { - if (target instanceof Hero) - if (target.HP == target.HT) { - GLog.i("You are too healthy, and resist the urge to sleep."); - detach(); - return true; - } else { - GLog.i("You fall into a deep magical sleep."); - } - else if (target instanceof Mob) - ((Mob)target).state = ((Mob)target).SLEEPING; + if (target instanceof Hero) + if (target.HP == target.HT) { + GLog.i("You are too healthy, and resist the urge to sleep."); + detach(); + return true; + } else { + GLog.i("You fall into a deep magical sleep."); + } + else if (target instanceof Mob) + ((Mob)target).state = ((Mob)target).SLEEPING; - target.paralysed = true; + target.paralysed = true; - return true; - } else { - return false; - } - } + return true; + } else { + return false; + } + } - @Override - public boolean act(){ - if (target instanceof Hero) { - target.HP = Math.min(target.HP+1, target.HT); - ((Hero) target).restoreHealth = true; - if (target.HP == target.HT) { - GLog.p("You wake up feeling refreshed and healthy."); - detach(); - } - } - spend( STEP ); - return true; - } + @Override + public boolean act(){ + if (target instanceof Hero) { + target.HP = Math.min(target.HP+1, target.HT); + ((Hero) target).restoreHealth = true; + if (target.HP == target.HT) { + GLog.p("You wake up feeling refreshed and healthy."); + detach(); + } + } + spend( STEP ); + return true; + } - @Override - public void detach() { - target.paralysed = false; - if (target instanceof Hero) - ((Hero) target).restoreHealth = false; - super.detach(); - } + @Override + public void detach() { + target.paralysed = false; + if (target instanceof Hero) + ((Hero) target).restoreHealth = false; + super.detach(); + } - @Override - public int icon() { - return BuffIndicator.MAGIC_SLEEP; - } + @Override + public int icon() { + return BuffIndicator.MAGIC_SLEEP; + } - @Override - public String toString() { - return "Magical Sleep"; - } + @Override + public String toString() { + return "Magical Sleep"; + } - @Override - public String desc() { - return "This character has fallen into a deep magical sleep which they will not wake from naturally.\n" + - "\n" + - "Magical sleep is similar to regular sleep, except that only damage will cause the target to wake up. \n" + - "\n" + - "For the hero, magical sleep has some restorative properties, allowing them to rapidly heal while resting."; - } + @Override + public String desc() { + return "This character has fallen into a deep magical sleep which they will not wake from naturally.\n" + + "\n" + + "Magical sleep is similar to regular sleep, except that only damage will cause the target to wake up. \n" + + "\n" + + "For the hero, magical sleep has some restorative properties, allowing them to rapidly heal while resting."; + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java index 2c7ef8661..6e2e771f0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java @@ -55,10 +55,10 @@ public class Ooze extends Buff { @Override public boolean act() { if (target.isAlive()) { - if (Dungeon.depth > 4) - target.damage( Dungeon.depth/5, this ); - else if (Random.Int(2) == 0) - target.damage( 1, this ); + if (Dungeon.depth > 4) + target.damage( Dungeon.depth/5, this ); + else if (Random.Int(2) == 0) + target.damage( 1, this ); if (!target.isAlive() && target == Dungeon.hero) { Dungeon.fail( ResultDescriptions.OOZE ); GLog.n( TXT_HERO_KILLED, toString() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java index a000282d5..137b70e40 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java @@ -9,9 +9,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; -/** - * Created by debenhame on 06/02/2015. - */ public class PinCushion extends Buff { private ArrayList items = new ArrayList(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java index 899b7e02b..8052613c4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java @@ -31,7 +31,7 @@ public class Regeneration extends Buff { - if (target.HP < target.HT && !((Hero)target).isStarving()) { + if (target.HP < target.HT && !((Hero)target).isStarving()) { target.HP += 1; } @@ -42,8 +42,8 @@ public class Regeneration extends Buff { spend( REGENERATION_DELAY * 1.5f ); else spend( REGENERATION_DELAY - regenBuff.level()*0.9f ); - else - spend( REGENERATION_DELAY ); + else + spend( REGENERATION_DELAY ); } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java index 3e348fb37..57d492f91 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java @@ -8,69 +8,66 @@ import com.watabou.utils.Bundle; import java.util.HashSet; -/** - * Created by debenhame on 19/11/2014. - */ public class ToxicImbue extends Buff { - public static final float DURATION = 30f; + public static final float DURATION = 30f; - protected float left; + protected float left; - private static final String LEFT = "left"; + private static final String LEFT = "left"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( LEFT, left ); + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( LEFT, left ); - } + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - left = bundle.getFloat( LEFT ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + left = bundle.getFloat( LEFT ); + } - public void set( float duration ) { - this.left = duration; - }; + public void set( float duration ) { + this.left = duration; + }; - @Override - public boolean act() { - GameScene.add(Blob.seed(target.pos, 50, ToxicGas.class)); + @Override + public boolean act() { + GameScene.add(Blob.seed(target.pos, 50, ToxicGas.class)); - spend(TICK); - left -= TICK; - if (left <= 0) - detach(); + spend(TICK); + left -= TICK; + if (left <= 0) + detach(); - return true; - } + return true; + } - @Override - public int icon() { - return BuffIndicator.IMMUNITY; - } + @Override + public int icon() { + return BuffIndicator.IMMUNITY; + } - @Override - public String toString() { - return "Imbued with Toxicity"; - } + @Override + public String toString() { + return "Imbued with Toxicity"; + } - @Override - public String desc() { - return "You are imbued with poisonous energy!\n" + - "\n" + - "As you move around toxic gas will constantly billow forth from you, damaging your enemies. " + - "You are immune to toxic gas and poison for the duration of the effect.\n" + - "\n" + - "You are imbued for " + dispTurns(left) + "."; - } + @Override + public String desc() { + return "You are imbued with poisonous energy!\n" + + "\n" + + "As you move around toxic gas will constantly billow forth from you, damaging your enemies. " + + "You are immune to toxic gas and poison for the duration of the effect.\n" + + "\n" + + "You are imbued for " + dispTurns(left) + "."; + } - { - immunities.add( ToxicGas.class ); - immunities.add( Poison.class ); - } + { + immunities.add( ToxicGas.class ); + immunities.add( Poison.class ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java index 14c59eb1b..7d62d6cf5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java @@ -5,73 +5,70 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.utils.Bundle; -/** - * Created by Evan on 12/04/2015. - */ public class Venom extends Poison implements Hero.Doom { - private int damage = 1; + private int damage = 1; - private static final String DAMAGE = "damage"; + private static final String DAMAGE = "damage"; - { - type = buffType.NEGATIVE; - } + { + type = buffType.NEGATIVE; + } - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( DAMAGE, damage ); + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( DAMAGE, damage ); - } + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - damage = bundle.getInt( DAMAGE ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + damage = bundle.getInt( DAMAGE ); + } - public void set(float duration, int damage) { - set(duration); - this.damage = damage; - } + public void set(float duration, int damage) { + set(duration); + this.damage = damage; + } - @Override - public int icon() { - return BuffIndicator.POISON; - } + @Override + public int icon() { + return BuffIndicator.POISON; + } - @Override - public String toString() { - return "Venomed"; - } + @Override + public String toString() { + return "Venomed"; + } - @Override - public String desc() { - return "Venom is a extremely caustic and dangerous poison.\n" + - "\n" + - "Unlike poison, whose damage lowers over time, venom does increasing damage the longer it stays on a target.\n" + - "\n" + - "This venom will last for " + dispTurns(left) + ", and is currently dealing " + damage + " damage."; - } + @Override + public String desc() { + return "Venom is a extremely caustic and dangerous poison.\n" + + "\n" + + "Unlike poison, whose damage lowers over time, venom does increasing damage the longer it stays on a target.\n" + + "\n" + + "This venom will last for " + dispTurns(left) + ", and is currently dealing " + damage + " damage."; + } - @Override - public boolean act() { - if (target.isAlive()) { - target.damage(damage, this); - if (damage < ((Dungeon.depth+1)/2)+1) - damage++; + @Override + public boolean act() { + if (target.isAlive()) { + target.damage(damage, this); + if (damage < ((Dungeon.depth+1)/2)+1) + damage++; - //want it to act after the cloud of venom it came from. - spend( TICK+0.1f ); - if ((left -= TICK) <= 0) { - detach(); - } - } else { - detach(); - } + //want it to act after the cloud of venom it came from. + spend( TICK+0.1f ); + if ((left -= TICK) <= 0) { + detach(); + } + } else { + detach(); + } - return true; - } + return true; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java index e0eb3db66..6ffaac264 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java @@ -22,34 +22,34 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Vertigo extends FlavourBuff { - public static final float DURATION = 10f; + public static final float DURATION = 10f; - { - type = buffType.NEGATIVE; - } + { + type = buffType.NEGATIVE; + } - @Override - public int icon() { - return BuffIndicator.VERTIGO; - } + @Override + public int icon() { + return BuffIndicator.VERTIGO; + } - @Override - public String toString() { - return "Vertigo"; - } + @Override + public String toString() { + return "Vertigo"; + } - @Override - public String desc() { - return "Walking in a straight line can be difficult when the whole world is spinning.\n" + - "\n" + - "While under the effects of vertigo, characters who attempt to move will go in a random direction, " + - "instead of the one they intended to go in. \n" + - "\n" + - "This Vertigo effect with last for " + dispTurns() + "."; - } + @Override + public String desc() { + return "Walking in a straight line can be difficult when the whole world is spinning.\n" + + "\n" + + "While under the effects of vertigo, characters who attempt to move will go in a random direction, " + + "instead of the one they intended to go in. \n" + + "\n" + + "This Vertigo effect with last for " + dispTurns() + "."; + } - public static float duration( Char ch ) { - Resistance r = ch.buff( Resistance.class ); - return r != null ? r.durationFactor() * DURATION : DURATION; - } + public static float duration( Char ch ) { + Resistance r = ch.buff( Resistance.class ); + return r != null ? r.durationFactor() * DURATION : DURATION; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java index a48da7014..d28143666 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java @@ -128,16 +128,16 @@ public class Belongings implements Iterable { return null; } - public void countIronKeys() { + public void countIronKeys() { - IronKey.curDepthQuantity = 0; + IronKey.curDepthQuantity = 0; - for (Item item : backpack) { - if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) { - IronKey.curDepthQuantity += item.quantity(); - } - } - } + for (Item item : backpack) { + if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) { + IronKey.curDepthQuantity += item.quantity(); + } + } + } public void identify() { for (Item item : this) { @@ -248,7 +248,7 @@ public class Belongings implements Iterable { @Override public Iterator iterator() { - return new ItemIterator(); + return new ItemIterator(); } private class ItemIterator implements Iterator { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 9fc3686af..6bf218360 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -124,7 +124,7 @@ public class Hero extends Char { public static final int MAX_LEVEL = 30; private static final String TXT_LEVEL_UP = "level up!"; - private static final String TXT_NEW_LEVEL = + private static final String TXT_NEW_LEVEL = "Welcome to level %d! Now you are healthier and more focused. " + "It's easier for you to hit enemies and dodge their attacks."; private static final String TXT_LEVEL_CAP = @@ -152,8 +152,8 @@ public class Hero extends Char { private int defenseSkill = 5; public boolean ready = false; - private boolean damageInterrupt = true; - public HeroAction curAction = null; + private boolean damageInterrupt = true; + public HeroAction curAction = null; public HeroAction lastAction = null; private Char enemy; @@ -162,7 +162,7 @@ public class Hero extends Char { public boolean restoreHealth = false; - public MissileWeapon rangedWeapon = null; + public MissileWeapon rangedWeapon = null; public Belongings belongings; public int STR; @@ -173,7 +173,7 @@ public class Hero extends Char { public int lvl = 1; public int exp = 0; - private ArrayList visibleEnemies; + private ArrayList visibleEnemies; public Hero() { super(); @@ -189,11 +189,11 @@ public class Hero extends Char { } public int STR() { - int STR = this.STR; + int STR = this.STR; - for (Buff buff : buffs(RingOfMight.Might.class)) { - STR += ((RingOfMight.Might)buff).level; - } + for (Buff buff : buffs(RingOfMight.Might.class)) { + STR += ((RingOfMight.Might)buff).level; + } return weakened ? STR - 2 : STR; } @@ -255,7 +255,7 @@ public class Hero extends Char { } public void live() { - Buff.affect( this, Regeneration.class ); + Buff.affect( this, Regeneration.class ); Buff.affect( this, Hunger.class ); } @@ -263,29 +263,29 @@ public class Hero extends Char { return belongings.armor == null ? 0 : belongings.armor.tier; } - public boolean shoot( Char enemy, MissileWeapon wep ) { + public boolean shoot( Char enemy, MissileWeapon wep ) { - rangedWeapon = wep; - boolean result = attack( enemy ); - Invisibility.dispel(); - rangedWeapon = null; + rangedWeapon = wep; + boolean result = attack( enemy ); + Invisibility.dispel(); + rangedWeapon = null; - return result; - } + return result; + } @Override public int attackSkill( Char target ) { - float accuracy = 1; - if (rangedWeapon != null && Level.distance( pos, target.pos ) == 1) { - accuracy *= 0.5f; - } + float accuracy = 1; + if (rangedWeapon != null && Level.distance( pos, target.pos ) == 1) { + accuracy *= 0.5f; + } - KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; - if (wep != null) { - return (int)(attackSkill * accuracy * wep.acuracyFactor( this )); - } else { - return (int)(attackSkill * accuracy); - } + KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; + if (wep != null) { + return (int)(attackSkill * accuracy * wep.acuracyFactor( this )); + } else { + return (int)(attackSkill * accuracy); + } } @Override @@ -327,12 +327,12 @@ public class Hero extends Char { @Override public int damageRoll() { - KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; + KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; int dmg; - int bonus = 0; - for (Buff buff : buffs( RingOfForce.Force.class )) { - bonus += ((RingOfForce.Force)buff).level; - } + int bonus = 0; + for (Buff buff : buffs( RingOfForce.Force.class )) { + bonus += ((RingOfForce.Force)buff).level; + } if (wep != null) { dmg = wep.damageRoll( this ) + bonus; @@ -351,15 +351,15 @@ public class Hero extends Char { @Override public float speed() { - float speed = super.speed(); + float speed = super.speed(); - int hasteLevel = 0; - for (Buff buff : buffs( RingOfHaste.Haste.class )) { - hasteLevel += ((RingOfHaste.Haste)buff).level; - } + int hasteLevel = 0; + for (Buff buff : buffs( RingOfHaste.Haste.class )) { + hasteLevel += ((RingOfHaste.Haste)buff).level; + } - if (hasteLevel != 0) - speed *= Math.pow(1.2, hasteLevel); + if (hasteLevel != 0) + speed *= Math.pow(1.2, hasteLevel); int aEnc = belongings.armor != null ? belongings.armor.STR - STR() : 0; if (aEnc > 0) { @@ -378,29 +378,29 @@ public class Hero extends Char { } public float attackDelay() { - KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; + KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; if (wep != null) { return wep.speedFactor( this ); } else { - //Normally putting furor speed on unarmed attacks would be unnecessary - //But there's going to be that one guy who gets a furor+force ring combo - //This is for that one guy, you shall get your fists of fury! - int bonus = 0; - for (Buff buff : buffs(RingOfFuror.Furor.class)) { - bonus += ((RingOfFuror.Furor)buff).level; - } + //Normally putting furor speed on unarmed attacks would be unnecessary + //But there's going to be that one guy who gets a furor+force ring combo + //This is for that one guy, you shall get your fists of fury! + int bonus = 0; + for (Buff buff : buffs(RingOfFuror.Furor.class)) { + bonus += ((RingOfFuror.Furor)buff).level; + } return (float)(0.25 + (1 - 0.25)*Math.pow(0.8, bonus)); } } - @Override - public void spend( float time ) { - TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class); - if (!(buff != null && buff.processTime(time))) - super.spend( time ); - } + @Override + public void spend( float time ) { + TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class); + if (!(buff != null && buff.processTime(time))) + super.spend( time ); + } public void spendAndNext( float time ) { busy(); @@ -436,7 +436,7 @@ public class Hero extends Char { } ready(); - return false; + return false; } else { @@ -448,50 +448,50 @@ public class Hero extends Char { return actMove( (HeroAction.Move)curAction ); - } else + } else if (curAction instanceof HeroAction.Interact) { - return actInteract( (HeroAction.Interact)curAction ); + return actInteract( (HeroAction.Interact)curAction ); - } else + } else if (curAction instanceof HeroAction.Buy) { - return actBuy( (HeroAction.Buy)curAction ); + return actBuy( (HeroAction.Buy)curAction ); - }else + }else if (curAction instanceof HeroAction.PickUp) { - return actPickUp( (HeroAction.PickUp)curAction ); + return actPickUp( (HeroAction.PickUp)curAction ); - } else + } else if (curAction instanceof HeroAction.OpenChest) { - return actOpenChest( (HeroAction.OpenChest)curAction ); + return actOpenChest( (HeroAction.OpenChest)curAction ); - } else + } else if (curAction instanceof HeroAction.Unlock) { - return actUnlock((HeroAction.Unlock) curAction); + return actUnlock((HeroAction.Unlock) curAction); - } else + } else if (curAction instanceof HeroAction.Descend) { - return actDescend( (HeroAction.Descend)curAction ); + return actDescend( (HeroAction.Descend)curAction ); } else if (curAction instanceof HeroAction.Ascend) { - return actAscend( (HeroAction.Ascend)curAction ); + return actAscend( (HeroAction.Ascend)curAction ); } else if (curAction instanceof HeroAction.Attack) { - return actAttack( (HeroAction.Attack)curAction ); + return actAttack( (HeroAction.Attack)curAction ); } else if (curAction instanceof HeroAction.Cook) { - return actCook( (HeroAction.Cook)curAction ); + return actCook( (HeroAction.Cook)curAction ); } } @@ -506,10 +506,10 @@ public class Hero extends Char { private void ready() { sprite.idle(); curAction = null; - damageInterrupt = true; + damageInterrupt = true; ready = true; - AttackIndicator.updateState(); + AttackIndicator.updateState(); GameScene.ready(); } @@ -524,7 +524,7 @@ public class Hero extends Char { public void resume() { curAction = lastAction; lastAction = null; - damageInterrupt = false; + damageInterrupt = false; act(); } @@ -532,7 +532,7 @@ public class Hero extends Char { if (getCloser( action.dst )) { - return true; + return true; } else { if (Dungeon.level.map[pos] == Terrain.SIGN) { @@ -540,7 +540,7 @@ public class Hero extends Char { } ready(); - return false; + return false; } } @@ -553,17 +553,17 @@ public class Hero extends Char { ready(); sprite.turnTo( pos, npc.pos ); npc.interact(); - return false; + return false; } else { if (Level.fieldOfView[npc.pos] && getCloser( npc.pos )) { - return true; + return true; } else { ready(); - return false; + return false; } } @@ -580,15 +580,15 @@ public class Hero extends Char { GameScene.show( new WndTradeItem( heap, true ) ); } - return false; + return false; } else if (getCloser( dst )) { - return true; + return true; } else { ready(); - return false; + return false; } } @@ -598,15 +598,15 @@ public class Hero extends Char { ready(); AlchemyPot.operate( this, dst ); - return false; + return false; } else if (getCloser( dst )) { - return true; + return true; } else { ready(); - return false; + return false; } } @@ -615,13 +615,13 @@ public class Hero extends Char { if (pos == dst) { Heap heap = Dungeon.level.heaps.get( pos ); - if (heap != null) { + if (heap != null) { Item item = heap.pickUp(); if (item.doPickUp( this )) { if (item instanceof Dewdrop - || item instanceof TimekeepersHourglass.sandBag - || item instanceof DriedRose.Petal) { + || item instanceof TimekeepersHourglass.sandBag + || item instanceof DriedRose.Petal) { //Do Nothing } else { @@ -645,17 +645,17 @@ public class Hero extends Char { } } else { ready(); - } + } - return false; + return false; - } else if (getCloser( dst )) { + } else if (getCloser( dst )) { - return true; + return true; - } else { - ready(); - return false; + } else { + ready(); + return false; } } @@ -685,7 +685,7 @@ public class Hero extends Char { Camera.main.shake( 1, 0.5f ); break; case SKELETON: - case REMAINS: + case REMAINS: break; default: Sample.INSTANCE.play( Assets.SND_UNLOCK ); @@ -696,18 +696,18 @@ public class Hero extends Char { } else { ready(); - } + } - return false; + return false; - } else if (getCloser( dst )) { + } else if (getCloser( dst )) { - return true; + return true; - } else { - ready(); - return false; - } + } else { + ready(); + return false; + } } private boolean actUnlock( HeroAction.Unlock action ) { @@ -737,18 +737,18 @@ public class Hero extends Char { } else { GLog.w( TXT_LOCKED_DOOR ); ready(); - } + } - return false; + return false; - } else if (getCloser( doorCell )) { + } else if (getCloser( doorCell )) { - return true; + return true; - } else { - ready(); - return false; - } + } else { + ready(); + return false; + } } private boolean actDescend( HeroAction.Descend action ) { @@ -760,22 +760,22 @@ public class Hero extends Char { Buff buff = buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); - for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) - if (mob instanceof DriedRose.GhostHero) mob.destroy(); + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.DESCEND; - Game.switchScene( InterlevelScene.class ); + Game.switchScene( InterlevelScene.class ); - return false; + return false; - } else if (getCloser( stairs )) { + } else if (getCloser( stairs )) { - return true; + return true; - } else { - ready(); - return false; - } + } else { + ready(); + return false; + } } private boolean actAscend( HeroAction.Ascend action ) { @@ -788,7 +788,7 @@ public class Hero extends Char { GameScene.show( new WndMessage( TXT_LEAVE ) ); ready(); } else { - Dungeon.win( ResultDescriptions.WIN ); + Dungeon.win( ResultDescriptions.WIN ); Dungeon.deleteGame( Dungeon.hero.heroClass, true ); Game.switchScene( SurfaceScene.class ); } @@ -805,23 +805,23 @@ public class Hero extends Char { Buff buff = buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); - for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) - if (mob instanceof DriedRose.GhostHero) mob.destroy(); + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.ASCEND; Game.switchScene( InterlevelScene.class ); - } + } - return false; + return false; - } else if (getCloser( stairs )) { + } else if (getCloser( stairs )) { - return true; + return true; - } else { - ready(); - return false; - } + } else { + ready(); + return false; + } } private boolean actAttack( HeroAction.Attack action ) { @@ -831,22 +831,22 @@ public class Hero extends Char { if (Level.adjacent( pos, enemy.pos ) && enemy.isAlive() && !isCharmedBy( enemy )) { spend( attackDelay() ); - sprite.attack( enemy.pos ); + sprite.attack( enemy.pos ); - return false; + return false; - } else { + } else { - if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) { + if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) { - return true; + return true; - } else { - ready(); - return false; - } + } else { + ready(); + return false; + } - } + } } public void rest( boolean tillHealthy ) { @@ -859,7 +859,7 @@ public class Hero extends Char { @Override public int attackProc( Char enemy, int damage ) { - KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; + KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; if (wep != null) wep.proc( this, enemy, damage ); @@ -889,10 +889,10 @@ public class Hero extends Char { damage = armor.absorb( damage ); } - Sungrass.Health health = buff( Sungrass.Health.class ); - if (health != null) { - health.absorb( damage ); - } + Sungrass.Health health = buff( Sungrass.Health.class ); + if (health != null) { + health.absorb( damage ); + } if (belongings.armor != null) { damage = belongings.armor.proc( enemy, this, damage ); @@ -909,24 +909,24 @@ public class Hero extends Char { restoreHealth = false; if (!(src instanceof Hunger || src instanceof Viscosity.DeferedDamage) && damageInterrupt) - interrupt(); + interrupt(); - if (this.buff(Drowsy.class) != null){ - Buff.detach(this, Drowsy.class); - GLog.w("The pain helps you resist the urge to sleep."); - } + if (this.buff(Drowsy.class) != null){ + Buff.detach(this, Drowsy.class); + GLog.w("The pain helps you resist the urge to sleep."); + } CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class ); if (thorns != null) { dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this); } - int tenacity = 0; - for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) { - tenacity += ((RingOfTenacity.Tenacity)buff).level; - } - if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health. - dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT))); + int tenacity = 0; + for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) { + tenacity += ((RingOfTenacity.Tenacity)buff).level; + } + if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health. + dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT))); super.damage( dmg, src ); @@ -979,9 +979,9 @@ public class Hero extends Char { if (Actor.findChar( target ) == null) { if (Level.pit[target] && !flying && !Chasm.jumpConfirmed) { if (!Level.solid[target]) { - Chasm.heroJump(this); - interrupt(); - } + Chasm.heroJump(this); + interrupt(); + } return false; } if (Level.passable[target] || Level.avoid[target]) { @@ -1005,9 +1005,9 @@ public class Hero extends Char { if (step != -1) { - int oldPos = pos; - move(step); - sprite.move(oldPos, pos); + int oldPos = pos; + move(step); + sprite.move(oldPos, pos); spend( 1 / speed() ); return true; @@ -1048,8 +1048,8 @@ public class Hero extends Char { curAction = new HeroAction.PickUp( cell ); break; case FOR_SALE: - curAction = heap.size() == 1 && heap.peek().price() > 0 ? - new HeroAction.Buy( cell ) : + curAction = heap.size() == 1 && heap.peek().price() > 0 ? + new HeroAction.Buy( cell ) : new HeroAction.PickUp( cell ); break; default: @@ -1137,9 +1137,9 @@ public class Hero extends Char { } void updateAwareness() { - awareness = (float)(1 - Math.pow( - (heroClass == HeroClass.ROGUE ? 0.85 : 0.90), - (1 + Math.min( lvl, 9 )) * 0.5 + awareness = (float)(1 - Math.pow( + (heroClass == HeroClass.ROGUE ? 0.85 : 0.90), + (1 + Math.min( lvl, 9 )) * 0.5 )); } @@ -1182,13 +1182,13 @@ public class Hero extends Char { } else if (buff instanceof Bleeding) { GLog.w( "You are bleeding!" ); } else if (buff instanceof RingOfMight.Might){ - if (((RingOfMight.Might)buff).level > 0) { - HT += ((RingOfMight.Might) buff).level * 5; - } - } else if (buff instanceof Vertigo) { - GLog.w("Everything is spinning around you!"); - interrupt(); - } + if (((RingOfMight.Might)buff).level > 0) { + HT += ((RingOfMight.Might) buff).level * 5; + } + } else if (buff instanceof Vertigo) { + GLog.w("Everything is spinning around you!"); + interrupt(); + } } @@ -1200,11 +1200,11 @@ public class Hero extends Char { super.remove( buff ); if (buff instanceof RingOfMight.Might){ - if (((RingOfMight.Might)buff).level > 0){ - HT -= ((RingOfMight.Might) buff).level * 5; - HP = Math.min(HT, HP); - } - } + if (((RingOfMight.Might)buff).level > 0){ + HT -= ((RingOfMight.Might) buff).level * 5; + HP = Math.min(HT, HP); + } + } BuffIndicator.refreshHero(); } @@ -1223,35 +1223,35 @@ public class Hero extends Char { curAction = null; - Ankh ankh = null; + Ankh ankh = null; - //look for ankhs in player inventory, prioritize ones which are blessed. - for (Item item : belongings){ - if (item instanceof Ankh) { - if (ankh == null || ((Ankh) item).isBlessed()) { - ankh = (Ankh) item; - } - } - } + //look for ankhs in player inventory, prioritize ones which are blessed. + for (Item item : belongings){ + if (item instanceof Ankh) { + if (ankh == null || ((Ankh) item).isBlessed()) { + ankh = (Ankh) item; + } + } + } - if (ankh != null && ankh.isBlessed()) { - this.HP = HT/4; + if (ankh != null && ankh.isBlessed()) { + this.HP = HT/4; - //ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again. - Buff.detach(this, Paralysis.class); - spend(-cooldown()); + //ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again. + Buff.detach(this, Paralysis.class); + spend(-cooldown()); - new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f); - CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); + new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f); + CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); - ankh.detach(belongings.backpack); + ankh.detach(belongings.backpack); - Sample.INSTANCE.play( Assets.SND_TELEPORT ); - GLog.w( ankh.TXT_REVIVE ); - Statistics.ankhsUsed++; + Sample.INSTANCE.play( Assets.SND_TELEPORT ); + GLog.w( ankh.TXT_REVIVE ); + Statistics.ankhsUsed++; - return; - } + return; + } Actor.fixTime(); super.die( cause ); @@ -1384,7 +1384,7 @@ public class Hero extends Char { theKey = null; } - Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst ); + Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst ); if (heap.type == Type.SKELETON || heap.type == Type.REMAINS) { Sample.INSTANCE.play( Assets.SND_BONES ); } @@ -1429,7 +1429,7 @@ public class Hero extends Char { by = Level.HEIGHT - 1; } - TalismanOfForesight.Foresight foresight = buff( TalismanOfForesight.Foresight.class ); + TalismanOfForesight.Foresight foresight = buff( TalismanOfForesight.Foresight.class ); //cursed talisman of foresight makes unintentionally finding things impossible. if (foresight != null && foresight.isCursed()){ @@ -1457,8 +1457,8 @@ public class Hero extends Char { smthFound = true; - if (foresight != null && !foresight.isCursed()) - foresight.charge(); + if (foresight != null && !foresight.isCursed()) + foresight.charge(); } } } @@ -1505,11 +1505,11 @@ public class Hero extends Char { @Override public HashSet> immunities() { - HashSet> immunities = new HashSet>(); + HashSet> immunities = new HashSet>(); for (Buff buff : buffs()){ - for (Class immunity : buff.immunities) - immunities.add(immunity); - } + for (Class immunity : buff.immunities) + immunities.add(immunity); + } return immunities; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java index 48c3c1dc4..782788761 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java @@ -83,110 +83,110 @@ public enum HeroClass { "Potions of Mind Vision are identified from the beginning." }; - public void initHero( Hero hero ) { + public void initHero( Hero hero ) { - hero.heroClass = this; + hero.heroClass = this; - initCommon( hero ); + initCommon( hero ); - switch (this) { - case WARRIOR: - initWarrior( hero ); - break; + switch (this) { + case WARRIOR: + initWarrior( hero ); + break; - case MAGE: - initMage( hero ); - break; + case MAGE: + initMage( hero ); + break; - case ROGUE: - initRogue( hero ); - break; + case ROGUE: + initRogue( hero ); + break; - case HUNTRESS: - initHuntress( hero ); - break; - } + case HUNTRESS: + initHuntress( hero ); + break; + } - if (Badges.isUnlocked( masteryBadge() )) { - new TomeOfMastery().collect(); - } + if (Badges.isUnlocked( masteryBadge() )) { + new TomeOfMastery().collect(); + } - hero.updateAwareness(); - } + hero.updateAwareness(); + } - private static void initCommon( Hero hero ) { - if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) - (hero.belongings.armor = new ClothArmor()).identify(); + private static void initCommon( Hero hero ) { + if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) + (hero.belongings.armor = new ClothArmor()).identify(); - if (!Dungeon.isChallenged(Challenges.NO_FOOD)) - new Food().identify().collect(); - } + if (!Dungeon.isChallenged(Challenges.NO_FOOD)) + new Food().identify().collect(); + } - public Badges.Badge masteryBadge() { - switch (this) { - case WARRIOR: - return Badges.Badge.MASTERY_WARRIOR; - case MAGE: - return Badges.Badge.MASTERY_MAGE; - case ROGUE: - return Badges.Badge.MASTERY_ROGUE; - case HUNTRESS: - return Badges.Badge.MASTERY_HUNTRESS; - } - return null; - } + public Badges.Badge masteryBadge() { + switch (this) { + case WARRIOR: + return Badges.Badge.MASTERY_WARRIOR; + case MAGE: + return Badges.Badge.MASTERY_MAGE; + case ROGUE: + return Badges.Badge.MASTERY_ROGUE; + case HUNTRESS: + return Badges.Badge.MASTERY_HUNTRESS; + } + return null; + } - private static void initWarrior( Hero hero ) { - hero.STR = hero.STR + 1; + private static void initWarrior( Hero hero ) { + hero.STR = hero.STR + 1; - (hero.belongings.weapon = new ShortSword()).identify(); - Dart darts = new Dart( 8 ); - darts.identify().collect(); + (hero.belongings.weapon = new ShortSword()).identify(); + Dart darts = new Dart( 8 ); + darts.identify().collect(); - Dungeon.quickslot.setSlot(0, darts); + Dungeon.quickslot.setSlot(0, darts); - new PotionOfStrength().setKnown(); - } + new PotionOfStrength().setKnown(); + } - private static void initMage( Hero hero ) { - MagesStaff staff = new MagesStaff(new WandOfMagicMissile()); - (hero.belongings.weapon = staff).identify(); - hero.belongings.weapon.activate(hero); + private static void initMage( Hero hero ) { + MagesStaff staff = new MagesStaff(new WandOfMagicMissile()); + (hero.belongings.weapon = staff).identify(); + hero.belongings.weapon.activate(hero); - Dungeon.quickslot.setSlot(0, staff); + Dungeon.quickslot.setSlot(0, staff); - new ScrollOfUpgrade().setKnown(); - } + new ScrollOfUpgrade().setKnown(); + } - private static void initRogue( Hero hero ) { - (hero.belongings.weapon = new Dagger()).identify(); + private static void initRogue( Hero hero ) { + (hero.belongings.weapon = new Dagger()).identify(); - CloakOfShadows cloak = new CloakOfShadows(); - (hero.belongings.misc1 = cloak).identify(); - hero.belongings.misc1.activate( hero ); + CloakOfShadows cloak = new CloakOfShadows(); + (hero.belongings.misc1 = cloak).identify(); + hero.belongings.misc1.activate( hero ); - Dart darts = new Dart( 8 ); - darts.identify().collect(); + Dart darts = new Dart( 8 ); + darts.identify().collect(); - Dungeon.quickslot.setSlot(0, cloak); - if (ShatteredPixelDungeon.quickSlots() > 1) - Dungeon.quickslot.setSlot(1, darts); + Dungeon.quickslot.setSlot(0, cloak); + if (ShatteredPixelDungeon.quickSlots() > 1) + Dungeon.quickslot.setSlot(1, darts); - new ScrollOfMagicMapping().setKnown(); - } + new ScrollOfMagicMapping().setKnown(); + } - private static void initHuntress( Hero hero ) { + private static void initHuntress( Hero hero ) { - hero.HP = (hero.HT -= 5); + hero.HP = (hero.HT -= 5); - (hero.belongings.weapon = new Dagger()).identify(); - Boomerang boomerang = new Boomerang(); - boomerang.identify().collect(); + (hero.belongings.weapon = new Dagger()).identify(); + Boomerang boomerang = new Boomerang(); + boomerang.identify().collect(); - Dungeon.quickslot.setSlot(0, boomerang); + Dungeon.quickslot.setSlot(0, boomerang); - new PotionOfMindVision().setKnown(); - } + new PotionOfMindVision().setKnown(); + } public String title() { return title; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java index 1c8c979cf..797818467 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java @@ -23,30 +23,30 @@ public enum HeroSubClass { NONE( null, null ), - GLADIATOR( "gladiator", + GLADIATOR( "gladiator", "A successful attack with a melee weapon allows the _Gladiator_ to start a combo, " + "in which every next successful hit inflicts more damage." ), - BERSERKER( "berserker", + BERSERKER( "berserker", "When severely wounded, the _Berserker_ enters a state of wild fury " + "significantly increasing his damage output." ), - WARLOCK( "warlock", + WARLOCK( "warlock", "Normal food grants the _Warlock_ additional wand recharge, but does not satisfy his hunger. " + "Instead, after killing an enemy, he consumes its soul to heal his wounds and satisfy hunger." ), - BATTLEMAGE( "battlemage", + BATTLEMAGE( "battlemage", "When fighting with his staff, the _Battlemage_ conjures bonus effects depending on the wand " + "his staff is imbued with. His staff will also gain charge through combat." ), - ASSASSIN( "assassin", + ASSASSIN( "assassin", "When performing a surprise attack, the _Assassin_ inflicts additional damage to his target." ), - FREERUNNER( "freerunner", + FREERUNNER( "freerunner", "The _Freerunner_ moves faster when he unencumbered and not starving, " + "if he is invisible, this speed boost is much stronger." ), - SNIPER( "sniper", + SNIPER( "sniper", "_Snipers_ are able to detect weak points in an enemy's armor, " + "effectively ignoring it when using a missile weapon." ), - WARDEN( "warden", + WARDEN( "warden", "Having a strong connection with forces of nature gives _Wardens_ an ability to gather dewdrops and " + "seeds from plants. Also trampling a high grass grants them a temporary armor buff." ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Albino.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Albino.java index bebdcb13f..4251bc876 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Albino.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Albino.java @@ -48,9 +48,9 @@ public class Albino extends Rat { return damage; } - @Override - public String description() { - return - "This is a rare breed of marsupial rat, with pure white fur and jagged teeth."; - } + @Override + public String description() { + return + "This is a rare breed of marsupial rat, with pure white fur and jagged teeth."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bandit.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bandit.java index c8d3d825f..b73e56c3b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bandit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bandit.java @@ -37,8 +37,8 @@ public class Bandit extends Thief { name = "crazy bandit"; spriteClass = BanditSprite.class; - //1 in 30 chance to be a crazy bandit, equates to overall 1/90 chance. - lootChance = 0.333f; + //1 in 30 chance to be a crazy bandit, equates to overall 1/90 chance. + lootChance = 0.333f; } @Override @@ -46,8 +46,8 @@ public class Bandit extends Thief { if (super.steal( hero )) { Buff.prolong( hero, Blindness.class, Random.Int( 5, 12 ) ); - Buff.affect( hero, Poison.class ).set(Random.Int(5, 7) * Poison.durationFactor(enemy)); - Buff.prolong( hero, Cripple.class, Cripple.DURATION ); + Buff.affect( hero, Poison.class ).set(Random.Int(5, 7) * Poison.durationFactor(enemy)); + Buff.prolong( hero, Cripple.class, Cripple.DURATION ); Dungeon.observe(); return true; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java index 5bb717515..837420d63 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java @@ -80,18 +80,18 @@ public class Bat extends Mob { return damage; } - @Override - public void die( Object cause ){ - //sets drop chance - lootChance = 1f/((6 + Dungeon.limitedDrops.batHP.count )); - super.die( cause ); - } + @Override + public void die( Object cause ){ + //sets drop chance + lootChance = 1f/((6 + Dungeon.limitedDrops.batHP.count )); + super.die( cause ); + } - @Override - protected Item createLoot(){ - Dungeon.limitedDrops.batHP.count++; - return super.createLoot(); - } + @Override + protected Item createLoot(){ + Dungeon.limitedDrops.batHP.count++; + return super.createLoot(); + } @Override public String description() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index 89232fbda..a7ade810e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -49,23 +49,23 @@ public class Bee extends Mob { private int potHolder; private static final String LEVEL = "level"; - private static final String POTPOS = "potpos"; - private static final String POTHOLDER = "potholder"; + private static final String POTPOS = "potpos"; + private static final String POTHOLDER = "potholder"; @Override public void storeInBundle( Bundle bundle ) { super.storeInBundle( bundle ); bundle.put( LEVEL, level ); - bundle.put( POTPOS, potPos ); - bundle.put( POTHOLDER, potHolder ); + bundle.put( POTPOS, potPos ); + bundle.put( POTHOLDER, potHolder ); } @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); spawn( bundle.getInt( LEVEL ) ); - potPos = bundle.getInt( POTPOS ); - potHolder = bundle.getInt( POTHOLDER ); + potPos = bundle.getInt( POTPOS ); + potHolder = bundle.getInt( POTHOLDER ); } public void spawn( int level ) { @@ -103,37 +103,37 @@ public class Bee extends Mob { @Override protected Char chooseEnemy() { - //if the pot is no longer present, target the hero + //if the pot is no longer present, target the hero if (potHolder == -1 && potPos == -1) return Dungeon.hero; - //if something is holding the pot, target that + //if something is holding the pot, target that else if (Actor.findById(potHolder) != null) return (Char)Actor.findById(potHolder); - //if the pot is on the ground + //if the pot is on the ground else { - //if already targeting something, and that thing is still alive and near the pot, keeping targeting it. - if (enemy != null && enemy.isAlive() && Level.distance(enemy.pos, potPos) <= 3) return enemy; + //if already targeting something, and that thing is still alive and near the pot, keeping targeting it. + if (enemy != null && enemy.isAlive() && Level.distance(enemy.pos, potPos) <= 3) return enemy; - //find all mobs near the pot - HashSet enemies = new HashSet(); - for (Mob mob : Dungeon.level.mobs) - if (!(mob instanceof Bee) && Level.distance(mob.pos, potPos) <= 3 && (mob.hostile || mob.ally)) - enemies.add(mob); + //find all mobs near the pot + HashSet enemies = new HashSet(); + for (Mob mob : Dungeon.level.mobs) + if (!(mob instanceof Bee) && Level.distance(mob.pos, potPos) <= 3 && (mob.hostile || mob.ally)) + enemies.add(mob); - //pick one, if there are none, check if the hero is near the pot, go for them, otherwise go for nothing. - if (enemies.size() > 0) return Random.element(enemies); - else return (Level.distance(Dungeon.hero.pos, potPos) <= 3) ? Dungeon.hero : null ; - } + //pick one, if there are none, check if the hero is near the pot, go for them, otherwise go for nothing. + if (enemies.size() > 0) return Random.element(enemies); + else return (Level.distance(Dungeon.hero.pos, potPos) <= 3) ? Dungeon.hero : null ; + } } @Override protected boolean getCloser(int target) { - if (enemy != null && Actor.findById(potHolder) == enemy) { - target = enemy.pos; - } else if (potPos != -1 && (state == WANDERING || Level.distance(target, potPos) > 3)) + if (enemy != null && Actor.findById(potHolder) == enemy) { + target = enemy.pos; + } else if (potPos != -1 && (state == WANDERING || Level.distance(target, potPos) > 3)) this.target = target = potPos; return super.getCloser( target ); } @@ -148,7 +148,7 @@ public class Bee extends Mob { private static final HashSet> IMMUNITIES = new HashSet>(); static { IMMUNITIES.add( Poison.class ); - IMMUNITIES.add( Amok.class ); + IMMUNITIES.add( Amok.class ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java index df961bdf2..e3b201a7e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java @@ -58,7 +58,7 @@ public class Brute extends Mob { @Override public int damageRoll() { return enraged ? - Random.NormalIntRange( 10, 40 ) : + Random.NormalIntRange( 10, 40 ) : Random.NormalIntRange( 8, 18 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java index d705e23e4..7dfd3ede5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java @@ -98,10 +98,10 @@ public class DM300 extends Mob { } int[] cells = { - step-1, step+1, step-Level.WIDTH, step+Level.WIDTH, - step-1-Level.WIDTH, - step-1+Level.WIDTH, - step+1-Level.WIDTH, + step-1, step+1, step-Level.WIDTH, step+Level.WIDTH, + step-1-Level.WIDTH, + step-1+Level.WIDTH, + step+1-Level.WIDTH, step+1+Level.WIDTH }; int cell = cells[Random.Int( cells.length )]; @@ -172,7 +172,7 @@ public class DM300 extends Mob { private static final HashSet> IMMUNITIES = new HashSet>(); static { IMMUNITIES.add( ToxicGas.class ); - IMMUNITIES.add( Terror.class ); + IMMUNITIES.add( Terror.class ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java index ea38cba89..4ad9cf706 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java @@ -82,13 +82,13 @@ public class Elemental extends Mob { sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); } } else if (buff instanceof Frost || buff instanceof Chill) { - if (Level.water[this.pos]) - damage( Random.NormalIntRange( HT / 2, HT ), buff ); - else - damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff ); + if (Level.water[this.pos]) + damage( Random.NormalIntRange( HT / 2, HT ), buff ); + else + damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff ); } else { - super.add( buff ); - } + super.add( buff ); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java index 66bc13452..082c97e14 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java @@ -63,13 +63,13 @@ public class Goo extends Mob { @Override public int damageRoll() { if (pumpedUp > 0) { - pumpedUp = 0; - for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) { - int j = pos + Level.NEIGHBOURS9DIST2[i]; - if (Level.insideMap(j) && Level.passable[j]) - CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10); - } - Sample.INSTANCE.play( Assets.SND_BURNING ); + pumpedUp = 0; + for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) { + int j = pos + Level.NEIGHBOURS9DIST2[i]; + if (Level.insideMap(j) && Level.passable[j]) + CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10); + } + Sample.INSTANCE.play( Assets.SND_BURNING ); return Random.NormalIntRange( 5, 30 ); } else { return Random.NormalIntRange( 2, 12 ); @@ -118,35 +118,35 @@ public class Goo extends Mob { @Override protected boolean doAttack( Char enemy ) { - if (pumpedUp == 1) { - ((GooSprite)sprite).pumpUp(); - for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) { - int j = pos + Level.NEIGHBOURS9DIST2[i]; - if (Level.insideMap(j) && Level.passable[j]) - GameScene.add(Blob.seed(j, 2, GooWarn.class)); - } - pumpedUp++; + if (pumpedUp == 1) { + ((GooSprite)sprite).pumpUp(); + for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) { + int j = pos + Level.NEIGHBOURS9DIST2[i]; + if (Level.insideMap(j) && Level.passable[j]) + GameScene.add(Blob.seed(j, 2, GooWarn.class)); + } + pumpedUp++; - spend( attackDelay() ); + spend( attackDelay() ); - return true; - } else if (pumpedUp >= 2 || Random.Int( 3 ) > 0) { + return true; + } else if (pumpedUp >= 2 || Random.Int( 3 ) > 0) { - boolean visible = Dungeon.visible[pos]; + boolean visible = Dungeon.visible[pos]; - if (visible) { - if (pumpedUp >= 2) { - ((GooSprite) sprite).pumpAttack(); - } - else - sprite.attack( enemy.pos ); - } else { - attack( enemy ); - } + if (visible) { + if (pumpedUp >= 2) { + ((GooSprite) sprite).pumpAttack(); + } + else + sprite.attack( enemy.pos ); + } else { + attack( enemy ); + } - spend( attackDelay() ); + spend( attackDelay() ); - return !visible; + return !visible; } else { @@ -154,18 +154,18 @@ public class Goo extends Mob { ((GooSprite)sprite).pumpUp(); - for (int i=0; i < Level.NEIGHBOURS9.length; i++) { - int j = pos + Level.NEIGHBOURS9[i]; - GameScene.add( Blob.seed( j , 2, GooWarn.class )); + for (int i=0; i < Level.NEIGHBOURS9.length; i++) { + int j = pos + Level.NEIGHBOURS9[i]; + GameScene.add( Blob.seed( j , 2, GooWarn.class )); - } + } if (Dungeon.visible[pos]) { sprite.showStatus( CharSprite.NEGATIVE, "!!!" ); GLog.n( "Goo is pumping itself up!" ); } - spend( attackDelay() ); + spend( attackDelay() ); return true; } @@ -216,28 +216,28 @@ public class Goo extends Mob { return "Little is known about The Goo. It's quite possible that it is not even a creature, but rather a " + "conglomerate of vile substances from the sewers that somehow gained basic intelligence. " + - "Regardless, dark magic is certainly what has allowed Goo to exist.\n\n" + - "Its gelatinous nature has let it absorb lots of dark energy, you feel a chill just from being near. " + - "If goo is able to attack with this energy you won't live for long."; + "Regardless, dark magic is certainly what has allowed Goo to exist.\n\n" + + "Its gelatinous nature has let it absorb lots of dark energy, you feel a chill just from being near. " + + "If goo is able to attack with this energy you won't live for long."; } - private final String PUMPEDUP = "pumpedup"; + private final String PUMPEDUP = "pumpedup"; - @Override - public void storeInBundle( Bundle bundle ) { + @Override + public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); + super.storeInBundle( bundle ); - bundle.put( PUMPEDUP , pumpedUp ); - } + bundle.put( PUMPEDUP , pumpedUp ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { + @Override + public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); + super.restoreFromBundle( bundle ); - pumpedUp = bundle.getInt( PUMPEDUP ); - } + pumpedUp = bundle.getInt( PUMPEDUP ); + } private static final HashSet> RESISTANCES = new HashSet>(); static { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java index c6b83bed2..2177cc4e2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java @@ -101,15 +101,15 @@ public class King extends Mob { @Override protected boolean getCloser( int target ) { - return canTryToSummon() ? - super.getCloser( CityBossLevel.pedestal( nextPedestal ) ) : + return canTryToSummon() ? + super.getCloser( CityBossLevel.pedestal( nextPedestal ) ) : super.getCloser( target ); } @Override protected boolean canAttack( Char enemy ) { - return canTryToSummon() ? - pos == CityBossLevel.pedestal( nextPedestal ) : + return canTryToSummon() ? + pos == CityBossLevel.pedestal( nextPedestal ) : Level.adjacent( pos, enemy.pos ); } @@ -163,7 +163,7 @@ public class King extends Mob { nextPedestal = !nextPedestal; - sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.4f, 2 ); + sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.4f, 2 ); Sample.INSTANCE.play( Assets.SND_CHALLENGE ); boolean[] passable = Level.passable.clone(); @@ -293,7 +293,7 @@ public class King extends Mob { @Override public void damage( int dmg, Object src ) { super.damage( dmg, src ); - if (src instanceof ToxicGas) { + if (src instanceof ToxicGas) { ((ToxicGas)src).clear( pos ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index cb7aec6f3..8d0105232 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -115,7 +115,7 @@ public class Mimic extends Mob { } public static Mimic spawnAt( int pos, List items ) { - Char ch = Actor.findChar( pos ); + Char ch = Actor.findChar( pos ); if (ch != null) { ArrayList candidates = new ArrayList(); for (int n : Level.NEIGHBOURS8) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 47f88bbd7..7945d3bd6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -59,12 +59,12 @@ public abstract class Mob extends Char { protected static final String TXT_RAGE = "#$%^"; protected static final String TXT_EXP = "%+dEXP"; - public AiState SLEEPING = new Sleeping(); - public AiState HUNTING = new Hunting(); - public AiState WANDERING = new Wandering(); - public AiState FLEEING = new Fleeing(); - public AiState PASSIVE = new Passive(); - public AiState state = SLEEPING; + public AiState SLEEPING = new Sleeping(); + public AiState HUNTING = new Hunting(); + public AiState WANDERING = new Wandering(); + public AiState FLEEING = new Fleeing(); + public AiState PASSIVE = new Passive(); + public AiState state = SLEEPING; public Class spriteClass; @@ -85,7 +85,7 @@ public abstract class Mob extends Char { public boolean ally = false; private static final String STATE = "state"; - private static final String SEEN = "seen"; + private static final String SEEN = "seen"; private static final String TARGET = "target"; @Override @@ -93,19 +93,19 @@ public abstract class Mob extends Char { super.storeInBundle( bundle ); - if (state == SLEEPING) { - bundle.put( STATE, Sleeping.TAG ); - } else if (state == WANDERING) { - bundle.put( STATE, Wandering.TAG ); - } else if (state == HUNTING) { - bundle.put( STATE, Hunting.TAG ); - } else if (state == FLEEING) { - bundle.put( STATE, Fleeing.TAG ); - } else if (state == PASSIVE) { - bundle.put( STATE, Passive.TAG ); - } + if (state == SLEEPING) { + bundle.put( STATE, Sleeping.TAG ); + } else if (state == WANDERING) { + bundle.put( STATE, Wandering.TAG ); + } else if (state == HUNTING) { + bundle.put( STATE, Hunting.TAG ); + } else if (state == FLEEING) { + bundle.put( STATE, Fleeing.TAG ); + } else if (state == PASSIVE) { + bundle.put( STATE, Passive.TAG ); + } bundle.put( SEEN, enemySeen ); - bundle.put( TARGET, target ); + bundle.put( TARGET, target ); } @Override @@ -113,23 +113,23 @@ public abstract class Mob extends Char { super.restoreFromBundle( bundle ); - String state = bundle.getString( STATE ); - if (state.equals( Sleeping.TAG )) { - this.state = SLEEPING; - } else if (state.equals( Wandering.TAG )) { - this.state = WANDERING; - } else if (state.equals( Hunting.TAG )) { - this.state = HUNTING; - } else if (state.equals( Fleeing.TAG )) { - this.state = FLEEING; - } else if (state.equals( Passive.TAG )) { - this.state = PASSIVE; - } + String state = bundle.getString( STATE ); + if (state.equals( Sleeping.TAG )) { + this.state = SLEEPING; + } else if (state.equals( Wandering.TAG )) { + this.state = WANDERING; + } else if (state.equals( Hunting.TAG )) { + this.state = HUNTING; + } else if (state.equals( Fleeing.TAG )) { + this.state = FLEEING; + } else if (state.equals( Passive.TAG )) { + this.state = PASSIVE; + } enemySeen = bundle.getBoolean( SEEN ); - target = bundle.getInt( TARGET ); - } + target = bundle.getInt( TARGET ); + } public CharSprite sprite() { CharSprite sprite = null; @@ -160,7 +160,7 @@ public abstract class Mob extends Char { boolean enemyInFOV = enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0; - return state.act( enemyInFOV, justAlerted ); + return state.act( enemyInFOV, justAlerted ); } protected Char chooseEnemy() { @@ -247,7 +247,7 @@ public abstract class Mob extends Char { state = FLEEING; } else if (buff instanceof Sleep) { state = SLEEPING; - this.sprite().showSleep(); + this.sprite().showSleep(); postpone( Sleep.SWS ); } } @@ -271,8 +271,8 @@ public abstract class Mob extends Char { return false; } - int step = Dungeon.findPath( this, pos, target, - Level.passable, + int step = Dungeon.findPath( this, pos, target, + Level.passable, Level.fieldOfView ); if (step != -1) { move( step ); @@ -283,8 +283,8 @@ public abstract class Mob extends Char { } protected boolean getFurther( int target ) { - int step = Dungeon.flee( this, pos, target, - Level.passable, + int step = Dungeon.flee( this, pos, target, + Level.passable, Level.fieldOfView ); if (step != -1) { move( step ); @@ -294,14 +294,14 @@ public abstract class Mob extends Char { } } - @Override - public void updateSpriteState() { - super.updateSpriteState(); - if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null) - sprite.add( CharSprite.State.PARALYSED ); - } + @Override + public void updateSpriteState() { + super.updateSpriteState(); + if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null) + sprite.add( CharSprite.State.PARALYSED ); + } - @Override + @Override public void move( int step ) { super.move( step ); @@ -337,18 +337,18 @@ public abstract class Mob extends Char { @Override public int defenseSkill( Char enemy ) { - if (enemySeen && !paralysed) { - int defenseSkill = this.defenseSkill; - int penalty = 0; - for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) { - penalty += ((RingOfAccuracy.Accuracy) buff).level; - } - if (penalty != 0 && enemy == Dungeon.hero) - defenseSkill *= Math.pow(0.75, penalty); - return defenseSkill; - } else { - return 0; - } + if (enemySeen && !paralysed) { + int defenseSkill = this.defenseSkill; + int penalty = 0; + for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) { + penalty += ((RingOfAccuracy.Accuracy) buff).level; + } + if (penalty != 0 && enemy == Dungeon.hero) + defenseSkill *= Math.pow(0.75, penalty); + return defenseSkill; + } else { + return 0; + } } @Override @@ -382,9 +382,9 @@ public abstract class Mob extends Char { Terror.recover( this ); - if (state == SLEEPING) { - state = WANDERING; - } + if (state == SLEEPING) { + state = WANDERING; + } alerted = true; super.damage( dmg, src ); @@ -425,21 +425,21 @@ public abstract class Mob extends Char { super.die( cause ); - float lootChance = this.lootChance; - int bonus = 0; - for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { - bonus += ((RingOfWealth.Wealth) buff).level; - } + float lootChance = this.lootChance; + int bonus = 0; + for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { + bonus += ((RingOfWealth.Wealth) buff).level; + } - lootChance *= Math.pow(1.1, bonus); + lootChance *= Math.pow(1.1, bonus); if (Random.Float() < lootChance && Dungeon.hero.lvl <= maxLvl + 2) { - Item loot = createLoot(); - if (loot != null) - Dungeon.level.drop( loot , pos ).sprite.drop(); + Item loot = createLoot(); + if (loot != null) + Dungeon.level.drop( loot , pos ).sprite.drop(); } - if (Dungeon.hero.isAlive() && !Dungeon.visible[pos]) { + if (Dungeon.hero.isAlive() && !Dungeon.visible[pos]) { GLog.i( TXT_DIED ); } } @@ -449,21 +449,21 @@ public abstract class Mob extends Char { @SuppressWarnings("unchecked") protected Item createLoot() { - Item item; - if (loot instanceof Generator.Category) { + Item item; + if (loot instanceof Generator.Category) { - item = Generator.random( (Generator.Category)loot ); + item = Generator.random( (Generator.Category)loot ); - } else if (loot instanceof Class) { + } else if (loot instanceof Class) { - item = Generator.random( (Class)loot ); + item = Generator.random( (Class)loot ); - } else { + } else { - item = (Item)loot; + item = (Item)loot; - } - return item; + } + return item; } public boolean reset() { @@ -497,177 +497,177 @@ public abstract class Mob extends Char { return enemySeen && (target == Dungeon.hero.pos); } - public interface AiState { - public boolean act( boolean enemyInFOV, boolean justAlerted ); - public String status(); - } + public interface AiState { + public boolean act( boolean enemyInFOV, boolean justAlerted ); + public String status(); + } - private class Sleeping implements AiState { + private class Sleeping implements AiState { - public static final String TAG = "SLEEPING"; + public static final String TAG = "SLEEPING"; - @Override - public boolean act( boolean enemyInFOV, boolean justAlerted ) { - if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) { + @Override + public boolean act( boolean enemyInFOV, boolean justAlerted ) { + if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) { - enemySeen = true; + enemySeen = true; - notice(); - state = HUNTING; - target = enemy.pos; + notice(); + state = HUNTING; + target = enemy.pos; - if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) { - for (Mob mob : Dungeon.level.mobs) { - if (mob != Mob.this) { - mob.beckon( target ); - } - } - } + if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) { + for (Mob mob : Dungeon.level.mobs) { + if (mob != Mob.this) { + mob.beckon( target ); + } + } + } - spend( TIME_TO_WAKE_UP ); + spend( TIME_TO_WAKE_UP ); - } else { + } else { - enemySeen = false; + enemySeen = false; - spend( TICK ); + spend( TICK ); - } - return true; - } + } + return true; + } - @Override - public String status() { - return Utils.format( "This %s is sleeping", name ); - } - } + @Override + public String status() { + return Utils.format( "This %s is sleeping", name ); + } + } - private class Wandering implements AiState { + private class Wandering implements AiState { - public static final String TAG = "WANDERING"; + public static final String TAG = "WANDERING"; - @Override - public boolean act( boolean enemyInFOV, boolean justAlerted ) { - if (enemyInFOV && (justAlerted || Random.Int( distance( enemy ) / 2 + enemy.stealth() ) == 0)) { + @Override + public boolean act( boolean enemyInFOV, boolean justAlerted ) { + if (enemyInFOV && (justAlerted || Random.Int( distance( enemy ) / 2 + enemy.stealth() ) == 0)) { - enemySeen = true; + enemySeen = true; - notice(); - state = HUNTING; - target = enemy.pos; + notice(); + state = HUNTING; + target = enemy.pos; - } else { + } else { - enemySeen = false; + enemySeen = false; - int oldPos = pos; - if (target != -1 && getCloser( target )) { - spend( 1 / speed() ); - return moveSprite( oldPos, pos ); - } else { - target = Dungeon.level.randomDestination(); - spend( TICK ); - } + int oldPos = pos; + if (target != -1 && getCloser( target )) { + spend( 1 / speed() ); + return moveSprite( oldPos, pos ); + } else { + target = Dungeon.level.randomDestination(); + spend( TICK ); + } - } - return true; - } + } + return true; + } - @Override - public String status() { - return Utils.format( "This %s is wandering", name ); - } - } + @Override + public String status() { + return Utils.format( "This %s is wandering", name ); + } + } - private class Hunting implements AiState { + private class Hunting implements AiState { - public static final String TAG = "HUNTING"; + public static final String TAG = "HUNTING"; - @Override - public boolean act( boolean enemyInFOV, boolean justAlerted ) { - enemySeen = enemyInFOV; - if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) { + @Override + public boolean act( boolean enemyInFOV, boolean justAlerted ) { + enemySeen = enemyInFOV; + if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) { - return doAttack( enemy ); + return doAttack( enemy ); - } else { + } else { - if (enemyInFOV) { - target = enemy.pos; - } + if (enemyInFOV) { + target = enemy.pos; + } - int oldPos = pos; - if (target != -1 && getCloser( target )) { + int oldPos = pos; + if (target != -1 && getCloser( target )) { - spend( 1 / speed() ); - return moveSprite( oldPos, pos ); + spend( 1 / speed() ); + return moveSprite( oldPos, pos ); - } else { + } else { - spend( TICK ); - state = WANDERING; - target = Dungeon.level.randomDestination(); - return true; - } - } - } + spend( TICK ); + state = WANDERING; + target = Dungeon.level.randomDestination(); + return true; + } + } + } - @Override - public String status() { - return Utils.format( "This %s is hunting", name ); - } - } + @Override + public String status() { + return Utils.format( "This %s is hunting", name ); + } + } - protected class Fleeing implements AiState { + protected class Fleeing implements AiState { - public static final String TAG = "FLEEING"; + public static final String TAG = "FLEEING"; - @Override - public boolean act( boolean enemyInFOV, boolean justAlerted ) { - enemySeen = enemyInFOV; - if (enemyInFOV) { - target = enemy.pos; - } + @Override + public boolean act( boolean enemyInFOV, boolean justAlerted ) { + enemySeen = enemyInFOV; + if (enemyInFOV) { + target = enemy.pos; + } - int oldPos = pos; - if (target != -1 && getFurther( target )) { + int oldPos = pos; + if (target != -1 && getFurther( target )) { - spend( 1 / speed() ); - return moveSprite( oldPos, pos ); + spend( 1 / speed() ); + return moveSprite( oldPos, pos ); - } else { + } else { - spend( TICK ); - nowhereToRun(); + spend( TICK ); + nowhereToRun(); - return true; - } - } + return true; + } + } - protected void nowhereToRun() { - } + protected void nowhereToRun() { + } - @Override - public String status() { - return Utils.format( "This %s is fleeing", name ); - } - } + @Override + public String status() { + return Utils.format( "This %s is fleeing", name ); + } + } - private class Passive implements AiState { + private class Passive implements AiState { - public static final String TAG = "PASSIVE"; + public static final String TAG = "PASSIVE"; - @Override - public boolean act( boolean enemyInFOV, boolean justAlerted ) { - enemySeen = false; - spend( TICK ); - return true; - } + @Override + public boolean act( boolean enemyInFOV, boolean justAlerted ) { + enemySeen = false; + spend( TICK ); + return true; + } - @Override - public String status() { - return Utils.format( "This %s is passive", name ); - } - } + @Override + public String status() { + return Utils.format( "This %s is passive", name ); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index ea67d810c..4921151b5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -114,8 +114,8 @@ public class Piranha extends Mob { return false; } - int step = Dungeon.findPath( this, pos, target, - Level.water, + int step = Dungeon.findPath( this, pos, target, + Level.water, Level.fieldOfView ); if (step != -1) { move( step ); @@ -127,8 +127,8 @@ public class Piranha extends Mob { @Override protected boolean getFurther( int target ) { - int step = Dungeon.flee( this, pos, target, - Level.water, + int step = Dungeon.flee( this, pos, target, + Level.water, Level.fieldOfView ); if (step != -1) { move( step ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java index e8fdca6d5..02f0ee759 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java @@ -92,10 +92,10 @@ public class Scorpio extends Mob { @Override protected Item createLoot() { - //5/count+5 total chance of getting healing, failing the 2nd roll drops mystery meat instead. + //5/count+5 total chance of getting healing, failing the 2nd roll drops mystery meat instead. if (Random.Int( 5 + Dungeon.limitedDrops.scorpioHP.count ) <= 4) { - Dungeon.limitedDrops.scorpioHP.count++; - return (Item)loot; + Dungeon.limitedDrops.scorpioHP.count++; + return (Item)loot; } else { return new MysteryMeat(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java index 38948136d..eff2bfd2b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java @@ -84,7 +84,7 @@ public class Shaman extends Mob implements Callback { } else { - boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; + boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; if (visible) { ((ShamanSprite)sprite).zap( enemy.pos ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java index c4c669531..d83e58477 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java @@ -47,8 +47,8 @@ public class Skeleton extends Mob { EXP = 5; maxLvl = 10; - loot = Generator.Category.WEAPON; - lootChance = 0.2f; + loot = Generator.Category.WEAPON; + lootChance = 0.2f; } @Override @@ -85,15 +85,15 @@ public class Skeleton extends Mob { @Override protected Item createLoot() { - Item loot = Generator.random( Generator.Category.WEAPON ); - for (int i=0; i < 2; i++) { - Item l = Generator.random( Generator.Category.WEAPON ); - if (l.level < loot.level) { - loot = l; - } - } - return loot; - } + Item loot = Generator.random( Generator.Category.WEAPON ); + for (int i=0; i < 2; i++) { + Item l = Generator.random( Generator.Category.WEAPON ); + if (l.level < loot.level) { + loot = l; + } + } + return loot; + } @Override public int attackSkill( Char target ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java index ad1ae9788..01ac5986b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java @@ -33,103 +33,103 @@ import com.watabou.utils.Random; public class Spinner extends Mob { - { - name = "cave spinner"; - spriteClass = SpinnerSprite.class; + { + name = "cave spinner"; + spriteClass = SpinnerSprite.class; - HP = HT = 50; - defenseSkill = 14; + HP = HT = 50; + defenseSkill = 14; - EXP = 9; - maxLvl = 16; + EXP = 9; + maxLvl = 16; - loot = new MysteryMeat(); - lootChance = 0.125f; + loot = new MysteryMeat(); + lootChance = 0.125f; - FLEEING = new Fleeing(); - } + FLEEING = new Fleeing(); + } - @Override - public int damageRoll() { - return Random.NormalIntRange(12, 16); - } + @Override + public int damageRoll() { + return Random.NormalIntRange(12, 16); + } - @Override - public int attackSkill(Char target) { - return 20; - } + @Override + public int attackSkill(Char target) { + return 20; + } - @Override - public int dr() { - return 6; - } + @Override + public int dr() { + return 6; + } - @Override - protected boolean act() { - boolean result = super.act(); + @Override + protected boolean act() { + boolean result = super.act(); - if (state == FLEEING && buff( Terror.class ) == null && - enemy != null && enemySeen && enemy.buff( Poison.class ) == null) { - state = HUNTING; - } - return result; - } + if (state == FLEEING && buff( Terror.class ) == null && + enemy != null && enemySeen && enemy.buff( Poison.class ) == null) { + state = HUNTING; + } + return result; + } - @Override - public int attackProc(Char enemy, int damage) { - if (Random.Int(2) == 0) { - Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy)); - state = FLEEING; - } + @Override + public int attackProc(Char enemy, int damage) { + if (Random.Int(2) == 0) { + Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy)); + state = FLEEING; + } - return damage; - } + return damage; + } - @Override - public void move(int step) { - if (state == FLEEING) { - GameScene.add(Blob.seed(pos, Random.Int(5, 7), Web.class)); - } - super.move(step); - } + @Override + public void move(int step) { + if (state == FLEEING) { + GameScene.add(Blob.seed(pos, Random.Int(5, 7), Web.class)); + } + super.move(step); + } - @Override - public String description() { - return - "These greenish furry cave spiders try to avoid direct combat, preferring to wait in the distance " + - "while their victim, entangled in the spinner's excreted cobweb, slowly dies from their poisonous bite."; - } + @Override + public String description() { + return + "These greenish furry cave spiders try to avoid direct combat, preferring to wait in the distance " + + "while their victim, entangled in the spinner's excreted cobweb, slowly dies from their poisonous bite."; + } - private static final HashSet> RESISTANCES = new HashSet>(); + private static final HashSet> RESISTANCES = new HashSet>(); - static { - RESISTANCES.add(Poison.class); - } + static { + RESISTANCES.add(Poison.class); + } - @Override - public HashSet> resistances() { - return RESISTANCES; - } + @Override + public HashSet> resistances() { + return RESISTANCES; + } - private static final HashSet> IMMUNITIES = new HashSet>(); + private static final HashSet> IMMUNITIES = new HashSet>(); - static { - IMMUNITIES.add(Roots.class); - } + static { + IMMUNITIES.add(Roots.class); + } - @Override - public HashSet> immunities() { - return IMMUNITIES; - } + @Override + public HashSet> immunities() { + return IMMUNITIES; + } - private class Fleeing extends Mob.Fleeing { - @Override - protected void nowhereToRun() { - if (buff(Terror.class) == null) { - state = HUNTING; - } else { - super.nowhereToRun(); - } - } - } + private class Fleeing extends Mob.Fleeing { + @Override + protected void nowhereToRun() { + if (buff(Terror.class) == null) { + state = HUNTING; + } else { + super.nowhereToRun(); + } + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java index 0d410cad1..4ab979128 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java @@ -50,8 +50,8 @@ public class Swarm extends Mob { flying = true; - loot = new PotionOfHealing(); - lootChance = 0.2f; //by default, see die() + loot = new PotionOfHealing(); + lootChance = 0.2f; //by default, see die() } private static final float SPLIT_DELAY = 1f; @@ -139,16 +139,16 @@ public class Swarm extends Mob { @Override public void die( Object cause ){ - //sets drop chance - lootChance = 1f/((5 + Dungeon.limitedDrops.swarmHP.count ) * (generation+1) ); - super.die( cause ); - } + //sets drop chance + lootChance = 1f/((5 + Dungeon.limitedDrops.swarmHP.count ) * (generation+1) ); + super.die( cause ); + } - @Override - protected Item createLoot(){ - Dungeon.limitedDrops.swarmHP.count++; - return super.createLoot(); - } + @Override + protected Item createLoot(){ + Dungeon.limitedDrops.swarmHP.count++; + return super.createLoot(); + } @Override public String description() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index b8d4c9f28..b1ea4591f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -158,8 +158,8 @@ public class Tengu extends Mob { do { newPos = Random.Int( Level.LENGTH ); } while ( - !Level.fieldOfView[newPos] || - !Level.passable[newPos] || + !Level.fieldOfView[newPos] || + !Level.passable[newPos] || Level.adjacent( newPos, enemy.pos ) || Actor.findChar( newPos ) != null); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index 4f807e656..65e832eef 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -50,132 +50,132 @@ public class Thief extends Mob { maxLvl = 10; loot = new MasterThievesArmband().identify(); - lootChance = 0.01f; + lootChance = 0.01f; - FLEEING = new Fleeing(); - } + FLEEING = new Fleeing(); + } - private static final String ITEM = "item"; + private static final String ITEM = "item"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( ITEM, item ); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( ITEM, item ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - item = (Item)bundle.get( ITEM ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + item = (Item)bundle.get( ITEM ); + } - @Override - public int damageRoll() { - return Random.NormalIntRange( 1, 7 ); - } + @Override + public int damageRoll() { + return Random.NormalIntRange( 1, 7 ); + } - @Override - protected float attackDelay() { - return 0.5f; - } + @Override + protected float attackDelay() { + return 0.5f; + } - @Override - public void die( Object cause ) { + @Override + public void die( Object cause ) { - super.die( cause ); + super.die( cause ); - if (item != null) { - Dungeon.level.drop( item, pos ).sprite.drop(); - //updates position - if (item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder( this ); - } - } + if (item != null) { + Dungeon.level.drop( item, pos ).sprite.drop(); + //updates position + if (item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder( this ); + } + } - @Override - protected Item createLoot(){ - if (!Dungeon.limitedDrops.armband.dropped()) { - Dungeon.limitedDrops.armband.drop(); - return super.createLoot(); - } else - return new Gold(Random.NormalIntRange(100, 250)); - } + @Override + protected Item createLoot(){ + if (!Dungeon.limitedDrops.armband.dropped()) { + Dungeon.limitedDrops.armband.drop(); + return super.createLoot(); + } else + return new Gold(Random.NormalIntRange(100, 250)); + } - @Override - public int attackSkill( Char target ) { - return 12; - } + @Override + public int attackSkill( Char target ) { + return 12; + } - @Override - public int dr() { - return 3; - } + @Override + public int dr() { + return 3; + } - @Override - public int attackProc( Char enemy, int damage ) { - if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) { - state = FLEEING; - } + @Override + public int attackProc( Char enemy, int damage ) { + if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) { + state = FLEEING; + } - return damage; - } + return damage; + } - @Override - public int defenseProc(Char enemy, int damage) { - if (state == FLEEING) { - Dungeon.level.drop( new Gold(), pos ).sprite.drop(); - } + @Override + public int defenseProc(Char enemy, int damage) { + if (state == FLEEING) { + Dungeon.level.drop( new Gold(), pos ).sprite.drop(); + } - return super.defenseProc(enemy, damage); - } + return super.defenseProc(enemy, damage); + } - protected boolean steal( Hero hero ) { + protected boolean steal( Hero hero ) { - Item item = hero.belongings.randomUnequipped(); - if (item != null) { + Item item = hero.belongings.randomUnequipped(); + if (item != null) { - GLog.w( TXT_STOLE, this.name, item.name() ); + GLog.w( TXT_STOLE, this.name, item.name() ); - if (item instanceof Honeypot){ - this.item = ((Honeypot)item).shatter(this, this.pos); - item.detach( hero.belongings.backpack ); - } else { - this.item = item; - if ( item instanceof Honeypot.ShatteredPot) - ((Honeypot.ShatteredPot)item).setHolder(this); - item.detachAll( hero.belongings.backpack ); - } + if (item instanceof Honeypot){ + this.item = ((Honeypot)item).shatter(this, this.pos); + item.detach( hero.belongings.backpack ); + } else { + this.item = item; + if ( item instanceof Honeypot.ShatteredPot) + ((Honeypot.ShatteredPot)item).setHolder(this); + item.detachAll( hero.belongings.backpack ); + } - return true; - } else { - return false; - } - } + return true; + } else { + return false; + } + } - @Override - public String description() { - String desc = - "Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " + - "Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " + - "these crazy thieves and bandits have forgotten who they are and why they steal."; + @Override + public String description() { + String desc = + "Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " + + "Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " + + "these crazy thieves and bandits have forgotten who they are and why they steal."; - if (item != null) { - desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() ); - } + if (item != null) { + desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() ); + } - return desc; - } + return desc; + } - private class Fleeing extends Mob.Fleeing { - @Override - protected void nowhereToRun() { - if (buff( Terror.class ) == null) { - sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE ); - state = HUNTING; - } else { - super.nowhereToRun(); - } - } - } + private class Fleeing extends Mob.Fleeing { + @Override + protected void nowhereToRun() { + if (buff( Terror.class ) == null) { + sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE ); + state = HUNTING; + } else { + super.nowhereToRun(); + } + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java index 41a1b1c54..62d8fe43b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java @@ -85,7 +85,7 @@ public class Warlock extends Mob implements Callback { } else { - boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; + boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; if (visible) { ((WarlockSprite)sprite).zap( enemy.pos ); } else { @@ -126,22 +126,22 @@ public class Warlock extends Mob implements Callback { next(); } - @Override - public Item createLoot(){ - Item loot = super.createLoot(); + @Override + public Item createLoot(){ + Item loot = super.createLoot(); - if (loot instanceof PotionOfHealing){ + if (loot instanceof PotionOfHealing){ - //count/10 chance of not dropping potion - if (Random.Int(10)-Dungeon.limitedDrops.warlockHP.count < 0){ - return null; - } else - Dungeon.limitedDrops.warlockHP.count++; + //count/10 chance of not dropping potion + if (Random.Int(10)-Dungeon.limitedDrops.warlockHP.count < 0){ + return null; + } else + Dungeon.limitedDrops.warlockHP.count++; - } + } - return loot; - } + return loot; + } @Override public String description() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index cf9e96349..9e221831d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -133,11 +133,11 @@ public class Yog extends Mob { Actor.addDelayed( new Pushing( larva, pos, larva.pos ), -1 ); } - for (Mob mob : Dungeon.level.mobs) { - if (mob instanceof BurningFist || mob instanceof RottingFist || mob instanceof Larva) { - mob.aggro( enemy ); - } - } + for (Mob mob : Dungeon.level.mobs) { + if (mob instanceof BurningFist || mob instanceof RottingFist || mob instanceof Larva) { + mob.aggro( enemy ); + } + } return super.defenseProc(enemy, damage); } @@ -377,7 +377,7 @@ public class Yog extends Mob { IMMUNITIES.add( Sleep.class ); IMMUNITIES.add( Terror.class ); IMMUNITIES.add( Burning.class ); - IMMUNITIES.add( ScrollOfPsionicBlast.class ); + IMMUNITIES.add( ScrollOfPsionicBlast.class ); IMMUNITIES.add( Vertigo.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index fa517875f..086db1b7a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -75,7 +75,7 @@ public class Blacksmith extends NPC { @Override protected boolean act() { - throwItem(); + throwItem(); return super.act(); } @@ -86,7 +86,7 @@ public class Blacksmith extends NPC { if (!Quest.given) { - GameScene.show( new WndQuest( this, + GameScene.show( new WndQuest( this, Quest.alternative ? TXT_BLOOD_1 : TXT_GOLD_1 ) { @Override @@ -168,7 +168,7 @@ public class Blacksmith extends NPC { return "Select 2 different items, not the same item twice!"; } - if (item1.getClass() != item2.getClass()) { + if (item1.getClass() != item2.getClass()) { return "Select 2 items of the same type!"; } @@ -244,7 +244,7 @@ public class Blacksmith extends NPC { @Override public String description() { - return + return "This troll blacksmith looks like all trolls look: he is tall and lean, and his skin resembles stone " + "in both color and texture. The troll blacksmith is tinkering with unproportionally small tools."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index c48005132..ae7a10888 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -77,37 +77,37 @@ public class Ghost extends NPC { } private static final String TXT_RAT1 = - "Hello %s... Once I was like you - strong and confident... " + - "But I was slain by a foul beast... I can't leave this place... Not until I have my revenge... " + - "Slay the _fetid rat_, that has taken my life...\n\n" + - "It stalks this floor... Spreading filth everywhere... " + - "_Beware its cloud of stink and corrosive bite, the acid dissolves in water..._ "; + "Hello %s... Once I was like you - strong and confident... " + + "But I was slain by a foul beast... I can't leave this place... Not until I have my revenge... " + + "Slay the _fetid rat_, that has taken my life...\n\n" + + "It stalks this floor... Spreading filth everywhere... " + + "_Beware its cloud of stink and corrosive bite, the acid dissolves in water..._ "; - private static final String TXT_RAT2 = - "Please... Help me... Slay the abomination...\n\n" + - "_Fight it near water... Avoid the stench..._"; + private static final String TXT_RAT2 = + "Please... Help me... Slay the abomination...\n\n" + + "_Fight it near water... Avoid the stench..._"; - private static final String TXT_GNOLL1 = - "Hello %s... Once I was like you - strong and confident... " + - "But I was slain by a devious foe... I can't leave this place... Not until I have my revenge... " + - "Slay the _gnoll trickster_, that has taken my life...\n\n" + - "It is not like the other gnolls... It hides and uses thrown weapons... " + - "_Beware its poisonous and incendiary darts, don't attack from a distance..._"; + private static final String TXT_GNOLL1 = + "Hello %s... Once I was like you - strong and confident... " + + "But I was slain by a devious foe... I can't leave this place... Not until I have my revenge... " + + "Slay the _gnoll trickster_, that has taken my life...\n\n" + + "It is not like the other gnolls... It hides and uses thrown weapons... " + + "_Beware its poisonous and incendiary darts, don't attack from a distance..._"; - private static final String TXT_GNOLL2 = - "Please... Help me... Slay the trickster...\n\n" + - "_Don't let it hit you... Get near to it..._"; + private static final String TXT_GNOLL2 = + "Please... Help me... Slay the trickster...\n\n" + + "_Don't let it hit you... Get near to it..._"; - private static final String TXT_CRAB1 = - "Hello %s... Once I was like you - strong and confident... " + - "But I was slain by an ancient creature... I can't leave this place... Not until I have my revenge... " + - "Slay the _great crab_, that has taken my life...\n\n" + - "It is unnaturally old... With a massive single claw and a thick shell... " + - "_Beware its claw, you must surprise the crab or it will block with it..._"; + private static final String TXT_CRAB1 = + "Hello %s... Once I was like you - strong and confident... " + + "But I was slain by an ancient creature... I can't leave this place... Not until I have my revenge... " + + "Slay the _great crab_, that has taken my life...\n\n" + + "It is unnaturally old... With a massive single claw and a thick shell... " + + "_Beware its claw, you must surprise the crab or it will block with it..._"; - private static final String TXT_CRAB2 = - "Please... Help me... Slay the Crustacean...\n\n" + - "_It will always block... When it sees you coming..._"; + private static final String TXT_CRAB2 = + "Please... Help me... Slay the Crustacean...\n\n" + + "_It will always block... When it sees you coming..._"; public Ghost() { super(); @@ -156,69 +156,69 @@ public class Ghost extends NPC { if (Quest.given) { if (Quest.weapon != null) { - if (Quest.processed) { - GameScene.show(new WndSadGhost(this, Quest.type)); - } else { - switch (Quest.type) { - case 1: - default: - GameScene.show(new WndQuest(this, TXT_RAT2)); - break; - case 2: - GameScene.show(new WndQuest(this, TXT_GNOLL2)); - break; - case 3: - GameScene.show(new WndQuest(this, TXT_CRAB2)); - break; - } + if (Quest.processed) { + GameScene.show(new WndSadGhost(this, Quest.type)); + } else { + switch (Quest.type) { + case 1: + default: + GameScene.show(new WndQuest(this, TXT_RAT2)); + break; + case 2: + GameScene.show(new WndQuest(this, TXT_GNOLL2)); + break; + case 3: + GameScene.show(new WndQuest(this, TXT_CRAB2)); + break; + } - int newPos = -1; - for (int i = 0; i < 10; i++) { - newPos = Dungeon.level.randomRespawnCell(); - if (newPos != -1) { - break; - } - } - if (newPos != -1) { + int newPos = -1; + for (int i = 0; i < 10; i++) { + newPos = Dungeon.level.randomRespawnCell(); + if (newPos != -1) { + break; + } + } + if (newPos != -1) { - CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); - pos = newPos; - sprite.place(pos); - sprite.visible = Dungeon.visible[pos]; - } - } - } + CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); + pos = newPos; + sprite.place(pos); + sprite.visible = Dungeon.visible[pos]; + } + } + } } else { - Mob questBoss; - String txt_quest; + Mob questBoss; + String txt_quest; - switch (Quest.type){ - case 1: default: - questBoss = new FetidRat(); - txt_quest = Utils.format(TXT_RAT1, Dungeon.hero.givenName()); break; - case 2: - questBoss = new GnollTrickster(); - txt_quest = Utils.format(TXT_GNOLL1, Dungeon.hero.givenName()); break; - case 3: - questBoss = new GreatCrab(); - txt_quest = Utils.format(TXT_CRAB1, Dungeon.hero.givenName()); break; - } + switch (Quest.type){ + case 1: default: + questBoss = new FetidRat(); + txt_quest = Utils.format(TXT_RAT1, Dungeon.hero.givenName()); break; + case 2: + questBoss = new GnollTrickster(); + txt_quest = Utils.format(TXT_GNOLL1, Dungeon.hero.givenName()); break; + case 3: + questBoss = new GreatCrab(); + txt_quest = Utils.format(TXT_CRAB1, Dungeon.hero.givenName()); break; + } - questBoss.pos = Dungeon.level.randomRespawnCell(); + questBoss.pos = Dungeon.level.randomRespawnCell(); - if (questBoss.pos != -1) { - GameScene.add(questBoss); - GameScene.show( new WndQuest( this, txt_quest ) ); - Quest.given = true; - Journal.add( Journal.Feature.GHOST ); - } + if (questBoss.pos != -1) { + GameScene.add(questBoss); + GameScene.show( new WndQuest( this, txt_quest ) ); + Quest.given = true; + Journal.add( Journal.Feature.GHOST ); + } } } @Override public String description() { - return + return "The ghost is barely visible. It looks like a shapeless " + "spot of faint light with a sorrowful face."; } @@ -240,7 +240,7 @@ public class Ghost extends NPC { private static boolean spawned; - private static int type; + private static int type; private static boolean given; private static boolean processed; @@ -251,7 +251,7 @@ public class Ghost extends NPC { public static Armor armor; public static void reset() { - spawned = false; + spawned = false; weapon = null; armor = null; @@ -260,7 +260,7 @@ public class Ghost extends NPC { private static final String NODE = "sadGhost"; private static final String SPAWNED = "spawned"; - private static final String TYPE = "type"; + private static final String TYPE = "type"; private static final String GIVEN = "given"; private static final String PROCESSED = "processed"; private static final String DEPTH = "depth"; @@ -294,9 +294,9 @@ public class Ghost extends NPC { if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { - type = node.getInt(TYPE); - given = node.getBoolean( GIVEN ); - processed = node.getBoolean( PROCESSED ); + type = node.getInt(TYPE); + given = node.getBoolean( GIVEN ); + processed = node.getBoolean( PROCESSED ); depth = node.getInt( DEPTH ); @@ -317,32 +317,32 @@ public class Ghost extends NPC { level.mobs.add( ghost ); spawned = true; - //dungeon depth determines type of quest. - //depth2=fetid rat, 3=gnoll trickster, 4=great crab + //dungeon depth determines type of quest. + //depth2=fetid rat, 3=gnoll trickster, 4=great crab type = Dungeon.depth-1; given = false; processed = false; depth = Dungeon.depth; - do { - weapon = Generator.randomWeapon(10); - } while (weapon instanceof MissileWeapon); - armor = Generator.randomArmor(10); + do { + weapon = Generator.randomWeapon(10); + } while (weapon instanceof MissileWeapon); + armor = Generator.randomArmor(10); - for (int i = 1; i <= 3; i++) { - Item another; - do { - another = Generator.randomWeapon(10+i); - } while (another instanceof MissileWeapon); - if (another.level >= weapon.level) { - weapon = (Weapon) another; - } - another = Generator.randomArmor(10+i); - if (another.level >= armor.level) { - armor = (Armor) another; - } - } + for (int i = 1; i <= 3; i++) { + Item another; + do { + another = Generator.randomWeapon(10+i); + } while (another instanceof MissileWeapon); + if (another.level >= weapon.level) { + weapon = (Weapon) another; + } + another = Generator.randomArmor(10+i); + if (another.level >= armor.level) { + armor = (Armor) another; + } + } weapon.identify(); armor.identify(); @@ -352,9 +352,9 @@ public class Ghost extends NPC { public static void process() { if (spawned && given && !processed && (depth == Dungeon.depth)) { GLog.n("sad ghost: Thank you... come find me..."); - Sample.INSTANCE.play( Assets.SND_GHOST ); - processed = true; - Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable. + Sample.INSTANCE.play( Assets.SND_GHOST ); + processed = true; + Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable. } } @@ -379,7 +379,7 @@ public class Ghost extends NPC { EXP = 4; - state = WANDERING; + state = WANDERING; } @Override @@ -392,14 +392,14 @@ public class Ghost extends NPC { return 2; } - @Override - public int attackProc( Char enemy, int damage ) { - if (Random.Int( 3 ) == 0) { - Buff.affect(enemy, Ooze.class); - } + @Override + public int attackProc( Char enemy, int damage ) { + if (Random.Int( 3 ) == 0) { + Buff.affect(enemy, Ooze.class); + } - return damage; - } + return damage; + } @Override public int defenseProc( Char enemy, int damage ) { @@ -420,184 +420,184 @@ public class Ghost extends NPC { public String description() { return "Something is clearly wrong with this rat. Its greasy black fur and rotting skin are very " + - "different from the healthy rats you've seen previously. It's pale green eyes " + - "make it seem especially menacing.\n\n" + - "The rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\n" + - "Dark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water."; + "different from the healthy rats you've seen previously. It's pale green eyes " + + "make it seem especially menacing.\n\n" + + "The rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\n" + + "Dark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water."; } - private static final HashSet> IMMUNITIES = new HashSet>(); - static { - IMMUNITIES.add( StenchGas.class ); - } + private static final HashSet> IMMUNITIES = new HashSet>(); + static { + IMMUNITIES.add( StenchGas.class ); + } - @Override - public HashSet> immunities() { - return IMMUNITIES; - } + @Override + public HashSet> immunities() { + return IMMUNITIES; + } } - public static class GnollTrickster extends Gnoll { - { - name = "gnoll trickster"; - spriteClass = GnollTricksterSprite.class; + public static class GnollTrickster extends Gnoll { + { + name = "gnoll trickster"; + spriteClass = GnollTricksterSprite.class; - HP = HT = 20; - defenseSkill = 5; + HP = HT = 20; + defenseSkill = 5; - EXP = 5; + EXP = 5; - state = WANDERING; + state = WANDERING; - loot = Generator.random(CurareDart.class); - lootChance = 1f; - } + loot = Generator.random(CurareDart.class); + lootChance = 1f; + } - private int combo = 0; + private int combo = 0; - @Override - public int attackSkill( Char target ) { - return 16; - } + @Override + public int attackSkill( Char target ) { + return 16; + } - @Override - protected boolean canAttack( Char enemy ) { - Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE ); - if (!Level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos){ - combo++; - return true; - } else { - return false; - } - } + @Override + protected boolean canAttack( Char enemy ) { + Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE ); + if (!Level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos){ + combo++; + return true; + } else { + return false; + } + } - @Override - public int attackProc( Char enemy, int damage ) { - //The gnoll's attacks get more severe the more the player lets it hit them - int effect = Random.Int(4)+combo; + @Override + public int attackProc( Char enemy, int damage ) { + //The gnoll's attacks get more severe the more the player lets it hit them + int effect = Random.Int(4)+combo; - if (effect > 2) { + if (effect > 2) { - if (effect >=6 && enemy.buff(Burning.class) == null){ + if (effect >=6 && enemy.buff(Burning.class) == null){ - if (Level.flamable[enemy.pos]) - GameScene.add( Blob.seed( enemy.pos, 4, Fire.class ) ); - Buff.affect( enemy, Burning.class ).reignite( enemy ); + if (Level.flamable[enemy.pos]) + GameScene.add( Blob.seed( enemy.pos, 4, Fire.class ) ); + Buff.affect( enemy, Burning.class ).reignite( enemy ); - } else - Buff.affect( enemy, Poison.class).set((effect-2) * Poison.durationFactor(enemy)); + } else + Buff.affect( enemy, Poison.class).set((effect-2) * Poison.durationFactor(enemy)); - } - return damage; - } + } + return damage; + } - @Override - protected boolean getCloser( int target ) { - combo = 0; //if he's moving, he isn't attacking, reset combo. - if (enemy != null && Level.adjacent(pos, enemy.pos)) { - return getFurther( target ); - } else { - return super.getCloser( target ); - } - } + @Override + protected boolean getCloser( int target ) { + combo = 0; //if he's moving, he isn't attacking, reset combo. + if (enemy != null && Level.adjacent(pos, enemy.pos)) { + return getFurther( target ); + } else { + return super.getCloser( target ); + } + } - @Override - public void die( Object cause ) { - super.die( cause ); + @Override + public void die( Object cause ) { + super.die( cause ); - Quest.process(); - } + Quest.process(); + } - @Override - public String description() { - return - "A strange looking creature, even by gnoll standards. It hunches forward with a wicked grin, " + - "almost cradling the satchel hanging over its shoulder. Its eyes are wide with a strange mix of " + - "fear and excitement.\n\n" + - "There is a large collection of poorly made darts in its satchel, they all seem to be " + - "tipped with various harmful substances."; - } + @Override + public String description() { + return + "A strange looking creature, even by gnoll standards. It hunches forward with a wicked grin, " + + "almost cradling the satchel hanging over its shoulder. Its eyes are wide with a strange mix of " + + "fear and excitement.\n\n" + + "There is a large collection of poorly made darts in its satchel, they all seem to be " + + "tipped with various harmful substances."; + } - private static final String COMBO = "combo"; + private static final String COMBO = "combo"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put(COMBO, combo); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put(COMBO, combo); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - combo = bundle.getInt( COMBO ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + combo = bundle.getInt( COMBO ); + } - } + } - public static class GreatCrab extends Crab { - { - name = "great crab"; - spriteClass = GreatCrabSprite.class; + public static class GreatCrab extends Crab { + { + name = "great crab"; + spriteClass = GreatCrabSprite.class; - HP = HT = 30; - defenseSkill = 0; //see damage() - baseSpeed = 1f; + HP = HT = 30; + defenseSkill = 0; //see damage() + baseSpeed = 1f; - EXP = 6; + EXP = 6; - state = WANDERING; - } + state = WANDERING; + } - private int moving = 0; + private int moving = 0; - @Override - protected boolean getCloser( int target ) { - //this is used so that the crab remains slower, but still detects the player at the expected rate. - moving++; - if (moving < 3) { - return super.getCloser( target ); - } else { - moving = 0; - return true; - } + @Override + protected boolean getCloser( int target ) { + //this is used so that the crab remains slower, but still detects the player at the expected rate. + moving++; + if (moving < 3) { + return super.getCloser( target ); + } else { + moving = 0; + return true; + } - } + } - @Override - public void damage( int dmg, Object src ){ - //crab blocks all attacks originating from the hero or enemy characters or traps if it is alerted. - //All direct damage from these sources is negated, no exceptions. blob/debuff effects go through as normal. - if (enemySeen && (src instanceof Wand || src instanceof LightningTrap.Electricity || src instanceof Char)){ - GLog.n("The crab notices the attack and blocks with its massive claw."); - sprite.showStatus( CharSprite.NEUTRAL, "blocked" ); - } else { - super.damage( dmg, src ); - } - } + @Override + public void damage( int dmg, Object src ){ + //crab blocks all attacks originating from the hero or enemy characters or traps if it is alerted. + //All direct damage from these sources is negated, no exceptions. blob/debuff effects go through as normal. + if (enemySeen && (src instanceof Wand || src instanceof LightningTrap.Electricity || src instanceof Char)){ + GLog.n("The crab notices the attack and blocks with its massive claw."); + sprite.showStatus( CharSprite.NEUTRAL, "blocked" ); + } else { + super.damage( dmg, src ); + } + } - @Override - public void die( Object cause ) { - super.die( cause ); + @Override + public void die( Object cause ) { + super.die( cause ); - Quest.process(); + Quest.process(); - Dungeon.level.drop( new MysteryMeat(), pos ); - Dungeon.level.drop( new MysteryMeat(), pos ).sprite.drop(); - } + Dungeon.level.drop( new MysteryMeat(), pos ); + Dungeon.level.drop( new MysteryMeat(), pos ).sprite.drop(); + } - @Override - public String description() { - return - "This crab is gigantic, even compared to other sewer crabs. " + - "Its blue shell is covered in cracks and barnacles, showing great age. " + - "It lumbers around slowly, barely keeping balance with its massive claw.\n\n" + - "While the crab only has one claw, its size easily compensates. " + - "The crab holds the claw infront of itself whenever it sees a threat, shielding " + - "itself behind an impenetrable wall of carapace."; - } - } + @Override + public String description() { + return + "This crab is gigantic, even compared to other sewer crabs. " + + "Its blue shell is covered in cracks and barnacles, showing great age. " + + "It lumbers around slowly, barely keeping balance with its massive claw.\n\n" + + "While the crab only has one claw, its size easily compensates. " + + "The crab holds the claw infront of itself whenever it sees a threat, shielding " + + "itself behind an impenetrable wall of carapace."; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 9465891b2..e3dfcbd20 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -62,11 +62,11 @@ public class Imp extends NPC { "So please, kill... let's say _8 of them_ and a reward is yours."; private static final String TXT_GOLEMS2 = - "How is your golem safari going?"; + "How is your golem safari going?"; private static final String TXT_MONKS2 = "Oh, you are still alive! I knew that your kung-fu is stronger ;) " + - "Just don't forget to grab these monks' tokens."; + "Just don't forget to grab these monks' tokens."; private static final String TXT_CYA = "See you, %s!"; private static final String TXT_HEY = "Psst, %s!"; @@ -136,7 +136,7 @@ public class Imp extends NPC { } private void tell( String format, Object...args ) { - GameScene.show( + GameScene.show( new WndQuest( this, Utils.format( format, args ) ) ); } @@ -150,7 +150,7 @@ public class Imp extends NPC { @Override public String description() { - return + return "Imps are lesser demons. They are notable for neither their strength nor their magic talent, " + "but they are quite smart and sociable. Many imps prefer to live among non-demons."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java index 54d9800b7..6bee2e415 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java @@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; public class ImpShopkeeper extends Shopkeeper { private static final String TXT_GREETINGS = "Hello, %s!"; - public static final String TXT_THIEF = "I thought I could trust you!"; + public static final String TXT_THIEF = "I thought I could trust you!"; { @@ -50,7 +50,7 @@ public class ImpShopkeeper extends Shopkeeper { } @Override - public void flee() { + public void flee() { for (Heap heap: Dungeon.level.heaps.values()) { if (heap.type == Heap.Type.FOR_SALE) { CellEmitter.get( heap.pos ).burst( ElmoParticle.FACTORY, 4 ); @@ -66,7 +66,7 @@ public class ImpShopkeeper extends Shopkeeper { @Override public String description() { - return + return "Imps are lesser demons. They are notable for neither their strength nor their magic talent. " + "But they are quite smart and sociable, and many of imps prefer to live and do business among non-demons."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java index 7cffd7d33..3ddd84263 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java @@ -135,16 +135,16 @@ public class MirrorImage extends NPC { Dungeon.hero.spend( 1 / Dungeon.hero.speed() ); Dungeon.hero.busy(); - } + } - private static final HashSet> IMMUNITIES = new HashSet>(); - static { - IMMUNITIES.add( ToxicGas.class ); - IMMUNITIES.add( Burning.class ); - } + private static final HashSet> IMMUNITIES = new HashSet>(); + static { + IMMUNITIES.add( ToxicGas.class ); + IMMUNITIES.add( Burning.class ); + } - @Override - public HashSet> immunities() { - return IMMUNITIES; + @Override + public HashSet> immunities() { + return IMMUNITIES; } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java index f4b3ac47a..a99352cd8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java @@ -25,28 +25,28 @@ import com.watabou.utils.Random; public abstract class NPC extends Mob { - { - HP = HT = 1; - EXP = 0; + { + HP = HT = 1; + EXP = 0; - hostile = false; - state = PASSIVE; - } + hostile = false; + state = PASSIVE; + } - protected void throwItem() { - Heap heap = Dungeon.level.heaps.get( pos ); - if (heap != null) { - int n; - do { - n = pos + Level.NEIGHBOURS8[Random.Int( 8 )]; - } while (!Level.passable[n] && !Level.avoid[n]); - Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos ); - } - } + protected void throwItem() { + Heap heap = Dungeon.level.heaps.get( pos ); + if (heap != null) { + int n; + do { + n = pos + Level.NEIGHBOURS8[Random.Int( 8 )]; + } while (!Level.passable[n] && !Level.avoid[n]); + Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos ); + } + } - @Override - public void beckon( int cell ) { - } + @Override + public void beckon( int cell ) { + } - abstract public void interact(); + abstract public void interact(); } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java index 9a04aa9d8..97af77a91 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java @@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem; public class Shopkeeper extends NPC { - public static final String TXT_THIEF = "Thief, Thief!"; + public static final String TXT_THIEF = "Thief, Thief!"; { name = "shopkeeper"; @@ -79,7 +79,7 @@ public class Shopkeeper extends NPC { @Override public String description() { - return + return "This stout guy looks more appropriate for a trade district in some large city " + "than for a dungeon. His prices explain why he prefers to do business here."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 74eb86905..5e21b509c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -55,7 +55,7 @@ import com.watabou.utils.Random; public class Wandmaker extends NPC { - { + { name = "old wandmaker"; spriteClass = WandmakerSprite.class; } @@ -126,8 +126,8 @@ public class Wandmaker extends NPC { Quest.placeItem(); - if (Quest.given) - tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1); + if (Quest.given) + tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1); Journal.add( Journal.Feature.WANDMAKER ); } @@ -139,7 +139,7 @@ public class Wandmaker extends NPC { @Override public String description() { - return + return "This old but hale gentleman wears a slightly confused " + "expression. He is protected by a magic shield."; } @@ -241,19 +241,19 @@ public class Wandmaker extends NPC { if (candidates.size() > 0) { Random.element( candidates ).drop( new CorpseDust() ); - given = true; + given = true; } else { int pos = Dungeon.level.randomRespawnCell(); while (Dungeon.level.heaps.get( pos ) != null) { pos = Dungeon.level.randomRespawnCell(); } - if (pos != -1) { - Heap heap = Dungeon.level.drop(new CorpseDust(), pos); - heap.type = Heap.Type.SKELETON; - heap.sprite.link(); - given = true; - } + if (pos != -1) { + Heap heap = Dungeon.level.drop(new CorpseDust(), pos); + heap.type = Heap.Type.SKELETON; + heap.sprite.link(); + given = true; + } } } else { @@ -263,10 +263,10 @@ public class Wandmaker extends NPC { shrubPos = Dungeon.level.randomRespawnCell(); } - if (shrubPos != -1) { - Dungeon.level.plant(new Rotberry.Seed(), shrubPos); - given = true; - } + if (shrubPos != -1) { + Dungeon.level.plant(new Rotberry.Seed(), shrubPos); + given = true; + } } } @@ -281,7 +281,7 @@ public class Wandmaker extends NPC { public static class Rotberry extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "Berries of this shrub taste like sweet, sweet death."; { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BadgeBanner.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BadgeBanner.java index f791cf72d..7c1345fc2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BadgeBanner.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BadgeBanner.java @@ -208,9 +208,9 @@ public class BadgeBanner extends Image { break; case 38: p.offset( 5, 5 ); - break; - case 39: - p.offset( 5, 4 ); + break; + case 39: + p.offset( 5, 4 ); break; case 40: case 41: @@ -256,10 +256,10 @@ public class BadgeBanner extends Image { break; } - p.x *= image.scale.x; + p.x *= image.scale.x; p.y *= image.scale.y; - p.offset( - -image.origin.x * (image.scale.x - 1), + p.offset( + -image.origin.x * (image.scale.x - 1), -image.origin.y * (image.scale.y - 1) ); p.offset( image.point() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java index 149b326bf..695ee1a1b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java @@ -22,33 +22,33 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; public class BannerSprites { - public enum Type { - PIXEL_DUNGEON, - BOSS_SLAIN, - GAME_OVER, - SELECT_YOUR_HERO, - PIXEL_DUNGEON_SIGNS - }; + public enum Type { + PIXEL_DUNGEON, + BOSS_SLAIN, + GAME_OVER, + SELECT_YOUR_HERO, + PIXEL_DUNGEON_SIGNS + }; - public static Image get( Type type ) { - Image icon = new Image( Assets.BANNERS ); - switch (type) { - case PIXEL_DUNGEON: - icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) ); - break; - case BOSS_SLAIN: - icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) ); - break; - case GAME_OVER: - icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) ); - break; - case SELECT_YOUR_HERO: - icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) ); - break; - case PIXEL_DUNGEON_SIGNS: - icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) ); - break; - } - return icon; - } + public static Image get( Type type ) { + Image icon = new Image( Assets.BANNERS ); + switch (type) { + case PIXEL_DUNGEON: + icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) ); + break; + case BOSS_SLAIN: + icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) ); + break; + case GAME_OVER: + icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) ); + break; + case SELECT_YOUR_HERO: + icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) ); + break; + case PIXEL_DUNGEON_SIGNS: + icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) ); + break; + } + return icon; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Chains.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Chains.java index aad4cb673..a65293622 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Chains.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Chains.java @@ -7,9 +7,6 @@ import com.watabou.noosa.Image; import com.watabou.utils.Callback; import com.watabou.utils.PointF; -/** - * Created by Evan on 23/05/2015. - */ public class Chains extends Group { private static final double A = 180 / Math.PI; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/CheckedCell.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/CheckedCell.java index 2d82d5457..e47ce37cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/CheckedCell.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/CheckedCell.java @@ -31,8 +31,8 @@ public class CheckedCell extends Image { origin.set( 0.5f ); - point( DungeonTilemap.tileToWorld( pos ).offset( - DungeonTilemap.SIZE / 2, + point( DungeonTilemap.tileToWorld( pos ).offset( + DungeonTilemap.SIZE / 2, DungeonTilemap.SIZE / 2 ) ); alpha = 0.8f; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/DarkBlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/DarkBlock.java index 646661da4..e8473feeb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/DarkBlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/DarkBlock.java @@ -6,9 +6,6 @@ import com.watabou.noosa.Game; import com.watabou.noosa.Gizmo; import com.watabou.noosa.audio.Sample; -/** - * Created by Evan on 14/05/2015. - */ public class DarkBlock extends Gizmo{ private CharSprite target; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Fireball.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Fireball.java index 7a7e1e384..667a18f54 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Fireball.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Fireball.java @@ -86,10 +86,10 @@ public class Fireball extends Component { bLight.x = x - bLight.width / 2; bLight.y = y - bLight.height / 2; - emitter.pos( - x - bLight.width / 4, - y - bLight.height / 4, - bLight.width / 2, + emitter.pos( + x - bLight.width / 4, + y - bLight.height / 4, + bLight.width / 2, bLight.height / 2 ); fLight.x = x - fLight.width / 2; @@ -104,8 +104,8 @@ public class Fireball extends Component { if (Random.Float() < Game.elapsed) { PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class ); spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) ); - spark.speed.set( - Random.Float( -40, +40 ), + spark.speed.set( + Random.Float( -40, +40 ), Random.Float( -60, +20 ) ); spark.acc.set( 0, +80 ); sparks.add( spark ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java index a53454173..3b09db898 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java @@ -157,8 +157,8 @@ public class Flare extends Visual { texture.bind(); script.uModel.valueM4( matrix ); - script.lighting( - rm, gm, bm, am, + script.lighting( + rm, gm, bm, am, ra, ga, ba, aa ); script.camera( camera ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/IceBlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/IceBlock.java index 99fb2cc76..96516cdd3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/IceBlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/IceBlock.java @@ -25,7 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; public class IceBlock extends Gizmo { - private float phase; + private float phase; private CharSprite target; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java index 977718f3e..161dfa521 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java @@ -175,7 +175,7 @@ public class MagicMissile extends Emitter { public static class MagicParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((MagicParticle)emitter.recycle( MagicParticle.class )).reset( x, y ); @@ -214,7 +214,7 @@ public class MagicMissile extends Emitter { public static class EarthParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((EarthParticle)emitter.recycle( EarthParticle.class )).reset( x, y ); @@ -246,7 +246,7 @@ public class MagicMissile extends Emitter { public static class WhiteParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((WhiteParticle)emitter.recycle( WhiteParticle.class )).reset( x, y ); @@ -286,7 +286,7 @@ public class MagicMissile extends Emitter { private Emitter emitter; - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((SlowParticle)emitter.recycle( SlowParticle.class )).reset( x, y, emitter ); @@ -330,7 +330,7 @@ public class MagicMissile extends Emitter { public static class ForceParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ForceParticle)emitter.recycle( ForceParticle.class )).reset( x, y ); @@ -368,7 +368,7 @@ public class MagicMissile extends Emitter { public static class ColdParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ColdParticle)emitter.recycle( ColdParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java index 525ed7598..b31df7c56 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java @@ -58,9 +58,9 @@ public class Speck extends Image { public static final int VENOM = 108; public static final int PARALYSIS = 109; public static final int DUST = 110; - public static final int STENCH = 111; + public static final int STENCH = 111; public static final int FORGE = 112; - public static final int CONFUSION = 113; + public static final int CONFUSION = 113; private static final int SIZE = 7; @@ -104,8 +104,8 @@ public class Speck extends Image { case TOXIC: case VENOM: case PARALYSIS: - case STENCH: - case CONFUSION: + case STENCH: + case CONFUSION: case DUST: frame( film.get( STEAM ) ); break; @@ -218,7 +218,7 @@ public class Speck extends Image { angularSpeed = Random.Float( -360, +360 ); break; - case ROCK: + case ROCK: angle = Random.Float( 360 ); angularSpeed = Random.Float( -360, +360 ); scale.set( Random.Float( 1, 2 ) ); @@ -287,28 +287,28 @@ public class Speck extends Image { lifespan = Random.Float( 1f, 3f ); break; - case STENCH: - hardlight( 0x003300 ); - angularSpeed = -30; - angle = Random.Float( 360 ); - lifespan = Random.Float( 1f, 3f ); - break; + case STENCH: + hardlight( 0x003300 ); + angularSpeed = -30; + angle = Random.Float( 360 ); + lifespan = Random.Float( 1f, 3f ); + break; - case CONFUSION: - hardlight( Random.Int( 0x1000000 ) | 0x000080 ); - angularSpeed = Random.Float( -20, +20 ); - angle = Random.Float( 360 ); - lifespan = Random.Float( 1f, 3f ); - break; + case CONFUSION: + hardlight( Random.Int( 0x1000000 ) | 0x000080 ); + angularSpeed = Random.Float( -20, +20 ); + angle = Random.Float( 360 ); + lifespan = Random.Float( 1f, 3f ); + break; - case DUST: - hardlight( 0xFFFF66 ); - angle = Random.Float( 360 ); - speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) ); - lifespan = 0.5f; - break; + case DUST: + hardlight( 0xFFFF66 ); + angle = Random.Float( 360 ); + speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) ); + lifespan = 0.5f; + break; - case COIN: + case COIN: speed.polar( -PointF.PI * Random.Float( 0.3f, 0.7f ), Random.Float( 48, 96 ) ); acc.y = 256; lifespan = -speed.y / acc.y * 2; @@ -340,12 +340,12 @@ public class Speck extends Image { am = p < 0.2f ? p * 5f : (1 - p) * 1.25f; break; - case KIT: + case KIT: case MASTERY: am = 1 - p * p; break; - case EVOKE: + case EVOKE: case HEALING: am = p < 0.5f ? 1 : 2 - p * 2; @@ -408,7 +408,7 @@ public class Speck extends Image { case STEAM: case TOXIC: case PARALYSIS: - case CONFUSION: + case CONFUSION: case DUST: am = p < 0.5f ? p : 1 - p; scale.set( 1 + p * 2 ); @@ -416,10 +416,10 @@ public class Speck extends Image { case VENOM: hardlight( ColorMath.interpolate( 0x8844FF, 0x00FF00 , p )); - case STENCH: - am = (p < 0.5f ? p : 1 - p) * 2; - scale.set( 1 + p * 2 ); - break; + case STENCH: + am = (p < 0.5f ? p : 1 - p) * 2; + scale.set( 1 + p * 2 ); + break; case JET: am = (p < 0.5f ? p : 1 - p) * 2; @@ -435,29 +435,29 @@ public class Speck extends Image { } } - public static Emitter.Factory factory( final int type ) { - return factory( type, false ); - } + public static Emitter.Factory factory( final int type ) { + return factory( type, false ); + } - public static Emitter.Factory factory( final int type, final boolean lightMode ) { + public static Emitter.Factory factory( final int type, final boolean lightMode ) { - Emitter.Factory factory = factories.get( type ); + Emitter.Factory factory = factories.get( type ); - if (factory == null) { - factory = new Emitter.Factory() { - @Override - public void emit ( Emitter emitter, int index, float x, float y ) { - Speck p = (Speck)emitter.recycle( Speck.class ); - p.reset( index, x, y, type ); - } - @Override - public boolean lightMode() { - return lightMode; - } - }; - factories.put( type, factory ); - } + if (factory == null) { + factory = new Emitter.Factory() { + @Override + public void emit ( Emitter emitter, int index, float x, float y ) { + Speck p = (Speck)emitter.recycle( Speck.class ); + p.reset( index, x, y, type ); + } + @Override + public boolean lightMode() { + return lightMode; + } + }; + factories.put( type, factory ); + } - return factory; - } + return factory; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Splash.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Splash.java index 3c5623f78..7d5cbcdf7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Splash.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Splash.java @@ -60,7 +60,7 @@ public class Splash { emitter.burst( FACTORY, n ); } - private static final SplashFactory FACTORY = new SplashFactory(); + private static final SplashFactory FACTORY = new SplashFactory(); private static class SplashFactory extends Emitter.Factory { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Surprise.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Surprise.java index dc1753a01..e7484545d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Surprise.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Surprise.java @@ -8,64 +8,61 @@ import com.watabou.noosa.Game; import com.watabou.noosa.Group; import com.watabou.noosa.Image; -/** - * Created by Evan on 20/04/2015. - */ public class Surprise extends Image { - private static final float TIME_TO_FADE = 0.8f; + private static final float TIME_TO_FADE = 0.8f; - private float time; + private float time; - public Surprise() { - super(Effects.get(Effects.Type.EXCLAMATION)); - origin.set(width / 2, height / 2); - } + public Surprise() { + super(Effects.get(Effects.Type.EXCLAMATION)); + origin.set(width / 2, height / 2); + } - public void reset(int p) { - revive(); + public void reset(int p) { + revive(); - x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2; - y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2; + x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2; + y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2; - time = TIME_TO_FADE; - } + time = TIME_TO_FADE; + } - @Override - public void update() { - super.update(); + @Override + public void update() { + super.update(); - if ((time -= Game.elapsed) <= 0) { - kill(); - } else { - float p = time / TIME_TO_FADE; - alpha(p); - scale.y = 1 + p/2; - } - } + if ((time -= Game.elapsed) <= 0) { + kill(); + } else { + float p = time / TIME_TO_FADE; + alpha(p); + scale.y = 1 + p/2; + } + } - public static void hit(Char ch) { - hit(ch, 0); - } + public static void hit(Char ch) { + hit(ch, 0); + } - public static void hit(Char ch, float angle) { - if (ch.sprite.parent != null) { - Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class); - ch.sprite.parent.bringToFront(s); - s.reset(ch.pos); - s.angle = angle; - } - } + public static void hit(Char ch, float angle) { + if (ch.sprite.parent != null) { + Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class); + ch.sprite.parent.bringToFront(s); + s.reset(ch.pos); + s.angle = angle; + } + } - public static void hit(int pos) { - hit(pos, 0); - } + public static void hit(int pos) { + hit(pos, 0); + } - public static void hit(int pos, float angle) { - Group parent = Dungeon.hero.sprite.parent; - Wound w = (Wound) parent.recycle(Wound.class); - parent.bringToFront(w); - w.reset(pos); - w.angle = angle; - } + public static void hit(int pos, float angle) { + Group parent = Dungeon.hero.sprite.parent; + Wound w = (Wound) parent.recycle(Wound.class); + parent.bringToFront(w); + w.reset(pos); + w.angle = angle; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Wound.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Wound.java index 6f1f98397..2f3602857 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Wound.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Wound.java @@ -63,12 +63,12 @@ public class Wound extends Image { } public static void hit( Char ch, float angle ) { - if (ch.sprite.parent != null) { - Wound w = (Wound) ch.sprite.parent.recycle(Wound.class); - ch.sprite.parent.bringToFront(w); - w.reset(ch.pos); - w.angle = angle; - } + if (ch.sprite.parent != null) { + Wound w = (Wound) ch.sprite.parent.recycle(Wound.class); + ch.sprite.parent.bringToFront(w); + w.reset(ch.pos); + w.angle = angle; + } } public static void hit( int pos ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java index 965ea5b13..5354e7f5e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java @@ -38,7 +38,7 @@ public class BlastParticle extends PixelParticle.Shrinking { public BlastParticle() { super(); - color( 0xEE7722 ); + color( 0xEE7722 ); acc.set( 0, +50 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BloodParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BloodParticle.java index 16eed351e..b6bf52c3d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BloodParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BloodParticle.java @@ -25,7 +25,7 @@ import com.watabou.utils.Random; public class BloodParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((BloodParticle)emitter.recycle( BloodParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EarthParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EarthParticle.java index 5aa1f8a17..d8c5473a1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EarthParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EarthParticle.java @@ -23,9 +23,9 @@ import com.watabou.noosa.particles.Emitter.Factory; import com.watabou.utils.ColorMath; import com.watabou.utils.Random; -public class EarthParticle extends PixelParticle { +public class EarthParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((EarthParticle)emitter.recycle( EarthParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ElmoParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ElmoParticle.java index f82db3f90..df6f87add 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ElmoParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ElmoParticle.java @@ -23,7 +23,7 @@ import com.watabou.noosa.particles.Emitter.Factory; public class ElmoParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ElmoParticle)emitter.recycle( ElmoParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java index 6eae30326..a4479c836 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java @@ -25,7 +25,7 @@ import com.watabou.utils.Random; public class EnergyParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((EnergyParticle)emitter.recycle( EnergyParticle.class )).reset( x, y ); @@ -59,7 +59,7 @@ public class EnergyParticle extends PixelParticle { super.update(); float p = left / lifespan; - am = p < 0.5f ? p * p * 4 : (1 - p) * 2; + am = p < 0.5f ? p * p * 4 : (1 - p) * 2; size( Random.Float( 5 * left / lifespan ) ); } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlameParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlameParticle.java index d8481b232..ebf2aaf1d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlameParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlameParticle.java @@ -23,7 +23,7 @@ import com.watabou.noosa.particles.Emitter.Factory; public class FlameParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((FlameParticle)emitter.recycle( FlameParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java index 858446cab..6fd113430 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java @@ -29,7 +29,7 @@ import com.watabou.utils.Random; public class FlowParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((FlowParticle)emitter.recycle( FlowParticle.class )).reset( x, y ); @@ -100,7 +100,7 @@ public class FlowParticle extends PixelParticle { delay = Random.Float( DELAY ); - ((FlowParticle)recycle( FlowParticle.class )).reset( + ((FlowParticle)recycle( FlowParticle.class )).reset( x + Random.Float( DungeonTilemap.SIZE ), y ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/LeafParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/LeafParticle.java index 771a9e2d6..3f2549d8e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/LeafParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/LeafParticle.java @@ -30,7 +30,7 @@ public class LeafParticle extends PixelParticle.Shrinking { public static int color2; - public static final Emitter.Factory GENERAL = new Factory() { + public static final Emitter.Factory GENERAL = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class )); @@ -39,7 +39,7 @@ public class LeafParticle extends PixelParticle.Shrinking { } }; - public static final Emitter.Factory LEVEL_SPECIFIC = new Factory() { + public static final Emitter.Factory LEVEL_SPECIFIC = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class )); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java index b870efbf7..3c757f0d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java @@ -25,7 +25,7 @@ import com.watabou.utils.Random; public class PoisonParticle extends PixelParticle { - public static final Emitter.Factory MISSILE = new Factory() { + public static final Emitter.Factory MISSILE = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((PoisonParticle)emitter.recycle( PoisonParticle.class )).resetMissile( x, y ); @@ -36,7 +36,7 @@ public class PoisonParticle extends PixelParticle { }; }; - public static final Emitter.Factory SPLASH = new Factory() { + public static final Emitter.Factory SPLASH = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((PoisonParticle)emitter.recycle( PoisonParticle.class )).resetSplash( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java index 6c04a0261..7e34bba4f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java @@ -26,14 +26,14 @@ import com.watabou.utils.Random; public class PurpleParticle extends PixelParticle { - public static final Emitter.Factory MISSILE = new Factory() { + public static final Emitter.Factory MISSILE = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((PurpleParticle)emitter.recycle( PurpleParticle.class )).reset( x, y ); } }; - public static final Emitter.Factory BURST = new Factory() { + public static final Emitter.Factory BURST = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((PurpleParticle)emitter.recycle( PurpleParticle.class )).resetBurst( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/RainbowParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/RainbowParticle.java index a2b6c6f24..c712d318f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/RainbowParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/RainbowParticle.java @@ -5,56 +5,53 @@ import com.watabou.noosa.particles.PixelParticle; import com.watabou.utils.PointF; import com.watabou.utils.Random; -/** - * Created by Evan on 11/04/2015. - */ public class RainbowParticle extends PixelParticle { - public static final Emitter.Factory BURST = new Emitter.Factory() { - @Override - public void emit( Emitter emitter, int index, float x, float y ) { - ((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y ); - } - @Override - public boolean lightMode() { - return true; - } - }; + public static final Emitter.Factory BURST = new Emitter.Factory() { + @Override + public void emit( Emitter emitter, int index, float x, float y ) { + ((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y ); + } + @Override + public boolean lightMode() { + return true; + } + }; - public RainbowParticle() { - super(); - color( Random.Int( 0x1000000 ) ); - lifespan = 0.5f; - } + public RainbowParticle() { + super(); + color( Random.Int( 0x1000000 ) ); + lifespan = 0.5f; + } - public void reset( float x, float y ) { - revive(); + public void reset( float x, float y ) { + revive(); - this.x = x; - this.y = y; + this.x = x; + this.y = y; - speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) ); + speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) ); - left = lifespan; - } + left = lifespan; + } - public void resetBurst( float x, float y ) { - revive(); + public void resetBurst( float x, float y ) { + revive(); - this.x = x; - this.y = y; + this.x = x; + this.y = y; - speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) ); + speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) ); - left = lifespan; - } + left = lifespan; + } - @Override - public void update() { - super.update(); - // alpha: 1 -> 0; size: 1 -> 5 - size( 5 - (am = left / lifespan) * 4 ); - } + @Override + public void update() { + super.update(); + // alpha: 1 -> 0; size: 1 -> 5 + size( 5 - (am = left / lifespan) * 4 ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java index 68718331c..dfbaeafe8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java @@ -26,21 +26,21 @@ import com.watabou.utils.Random; public class ShadowParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory MISSILE = new Factory() { + public static final Emitter.Factory MISSILE = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ShadowParticle)emitter.recycle( ShadowParticle.class )).reset( x, y ); } }; - public static final Emitter.Factory CURSE = new Factory() { + public static final Emitter.Factory CURSE = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ShadowParticle)emitter.recycle( ShadowParticle.class )).resetCurse( x, y ); } }; - public static final Emitter.Factory UP = new Factory() { + public static final Emitter.Factory UP = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ShadowParticle)emitter.recycle( ShadowParticle.class )).resetUp( x, y ); @@ -88,6 +88,6 @@ public class ShadowParticle extends PixelParticle.Shrinking { float p = left / lifespan; // alpha: 0 -> 1 -> 0; size: 6 -> 0; color: 0x660044 -> 0x000000 color( ColorMath.interpolate( 0x000000, 0x440044, p ) ); - am = p < 0.5f ? p * p * 4 : (1 - p) * 2; + am = p < 0.5f ? p * p * 4 : (1 - p) * 2; } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShaftParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShaftParticle.java index bf22aca02..158036257 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShaftParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShaftParticle.java @@ -24,7 +24,7 @@ import com.watabou.utils.Random; public class ShaftParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((ShaftParticle)emitter.recycle( ShaftParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SnowParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SnowParticle.java index 2d13de9e0..cb54f2dc6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SnowParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SnowParticle.java @@ -24,7 +24,7 @@ import com.watabou.utils.Random; public class SnowParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((SnowParticle)emitter.recycle( SnowParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java index 1a55e37c6..aab0418fb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java @@ -24,7 +24,7 @@ import com.watabou.utils.Random; public class SparkParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((SparkParticle)emitter.recycle( SparkParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WebParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WebParticle.java index 66d0d86cc..e31d3a5b8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WebParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WebParticle.java @@ -24,7 +24,7 @@ import com.watabou.utils.Random; public class WebParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { for (int i=0; i < 3; i++) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java index ca87fe2d3..3b92927f6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java @@ -29,7 +29,7 @@ import com.watabou.utils.Random; public class WindParticle extends PixelParticle { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((WindParticle)emitter.recycle( WindParticle.class )).reset( x, y ); @@ -103,8 +103,8 @@ public class WindParticle extends PixelParticle { delay = Random.Float( 5 ); - ((WindParticle)recycle( WindParticle.class )).reset( - x + Random.Float( DungeonTilemap.SIZE ), + ((WindParticle)recycle( WindParticle.class )).reset( + x + Random.Float( DungeonTilemap.SIZE ), y + Random.Float( DungeonTilemap.SIZE ) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WoolParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WoolParticle.java index 087199276..9aea92a7c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WoolParticle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WoolParticle.java @@ -25,7 +25,7 @@ import com.watabou.utils.Random; public class WoolParticle extends PixelParticle.Shrinking { - public static final Emitter.Factory FACTORY = new Factory() { + public static final Emitter.Factory FACTORY = new Factory() { @Override public void emit( Emitter emitter, int index, float x, float y ) { ((WoolParticle)emitter.recycle( WoolParticle.class )).reset( x, y ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java index 9900133b6..a3f8cfd0f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java @@ -97,7 +97,7 @@ public class Amulet extends Item { @Override public String info() { - return + return "The Amulet of Yendor is the most powerful known artifact of unknown origin. It is said that the amulet " + "is able to fulfil any wish if its owner's will-power is strong enough to \"persuade\" it to do it."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java index 067eeac56..cfece6d38 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java @@ -31,28 +31,28 @@ import java.util.ArrayList; public class Ankh extends Item { - public static final String AC_BLESS = "BLESS"; + public static final String AC_BLESS = "BLESS"; - public static final String TXT_DESC_NOBLESS = "Upon resurrection all non-equipped items are lost. " + - "Using a full dew vial, the ankh can be blessed with extra strength."; - public static final String TXT_DESC_BLESSED = "The ankh has been blessed and is now much stronger. " + - "The Ankh will sacrifice itself to save you in a moment of deadly peril."; + public static final String TXT_DESC_NOBLESS = "Upon resurrection all non-equipped items are lost. " + + "Using a full dew vial, the ankh can be blessed with extra strength."; + public static final String TXT_DESC_BLESSED = "The ankh has been blessed and is now much stronger. " + + "The Ankh will sacrifice itself to save you in a moment of deadly peril."; - public static final String TXT_BLESS = "You bless the ankh with clean water."; - public static final String TXT_REVIVE = "The ankh explodes with life-giving energy!"; + public static final String TXT_BLESS = "You bless the ankh with clean water."; + public static final String TXT_REVIVE = "The ankh explodes with life-giving energy!"; - { + { name = "Ankh"; image = ItemSpriteSheet.ANKH; - //You tell the ankh no, don't revive me, and then it comes back to revive you again in another run. - //I'm not sure if that's enthusiasm or passive-aggression. - bones = true; - } + //You tell the ankh no, don't revive me, and then it comes back to revive you again in another run. + //I'm not sure if that's enthusiasm or passive-aggression. + bones = true; + } - private Boolean blessed = false; + private Boolean blessed = false; @Override public boolean isUpgradable() { @@ -64,76 +64,76 @@ public class Ankh extends Item { return true; } - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions(hero); - DewVial vial = hero.belongings.getItem(DewVial.class); - if (vial != null && vial.isFull() && !blessed) - actions.add( AC_BLESS ); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions(hero); + DewVial vial = hero.belongings.getItem(DewVial.class); + if (vial != null && vial.isFull() && !blessed) + actions.add( AC_BLESS ); + return actions; + } - @Override - public void execute( final Hero hero, String action ) { - if (action.equals( AC_BLESS )) { + @Override + public void execute( final Hero hero, String action ) { + if (action.equals( AC_BLESS )) { - DewVial vial = hero.belongings.getItem(DewVial.class); - if (vial != null){ - blessed = true; - vial.empty(); - GLog.p( TXT_BLESS ); - hero.spend( 1f ); - hero.busy(); + DewVial vial = hero.belongings.getItem(DewVial.class); + if (vial != null){ + blessed = true; + vial.empty(); + GLog.p( TXT_BLESS ); + hero.spend( 1f ); + hero.busy(); - Sample.INSTANCE.play( Assets.SND_DRINK ); - CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); - hero.sprite.operate( hero.pos ); - } - } else { + Sample.INSTANCE.play( Assets.SND_DRINK ); + CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); + hero.sprite.operate( hero.pos ); + } + } else { - super.execute( hero, action ); + super.execute( hero, action ); - } + } - } + } @Override public String info() { if (blessed) - return - "This ancient symbol of immortality grants the ability to return to life after death. " + - TXT_DESC_BLESSED; - else - return + return "This ancient symbol of immortality grants the ability to return to life after death. " + - TXT_DESC_NOBLESS; + TXT_DESC_BLESSED; + else + return + "This ancient symbol of immortality grants the ability to return to life after death. " + + TXT_DESC_NOBLESS; } - public Boolean isBlessed(){ - return blessed; - } + public Boolean isBlessed(){ + return blessed; + } - private static final Glowing WHITE = new Glowing( 0xFFFFCC ); + private static final Glowing WHITE = new Glowing( 0xFFFFCC ); - @Override - public Glowing glowing() { - return isBlessed() ? WHITE : null; - } + @Override + public Glowing glowing() { + return isBlessed() ? WHITE : null; + } - private static final String BLESSED = "blessed"; + private static final String BLESSED = "blessed"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( BLESSED, blessed ); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( BLESSED, blessed ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - blessed = bundle.getBoolean( BLESSED ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + blessed = bundle.getBoolean( BLESSED ); + } @Override public int price() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index bf00dfb75..f550acda2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -53,48 +53,48 @@ public class Bomb extends Item { public Fuse fuse; - //FIXME using a static variable for this is kinda gross, should be a better way - private static boolean lightingFuse = false; + //FIXME using a static variable for this is kinda gross, should be a better way + private static boolean lightingFuse = false; private static final String AC_LIGHTTHROW = "Light & Throw"; - @Override - public boolean isSimilar(Item item) { - return item instanceof Bomb && this.fuse == ((Bomb) item).fuse; - } + @Override + public boolean isSimilar(Item item) { + return item instanceof Bomb && this.fuse == ((Bomb) item).fuse; + } - @Override - public ArrayList actions(Hero hero) { - ArrayList actions = super.actions( hero ); - actions.add ( AC_LIGHTTHROW ); - return actions; - } + @Override + public ArrayList actions(Hero hero) { + ArrayList actions = super.actions( hero ); + actions.add ( AC_LIGHTTHROW ); + return actions; + } - @Override - public void execute(Hero hero, String action) { - if (action.equals( AC_LIGHTTHROW )){ - lightingFuse = true; - action = AC_THROW; - } else - lightingFuse = false; + @Override + public void execute(Hero hero, String action) { + if (action.equals( AC_LIGHTTHROW )){ + lightingFuse = true; + action = AC_THROW; + } else + lightingFuse = false; - super.execute(hero, action); - } + super.execute(hero, action); + } - @Override + @Override protected void onThrow( int cell ) { - if (!Level.pit[ cell ] && lightingFuse) { - Actor.addDelayed(fuse = new Fuse().ignite(this), 2); - } - if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){ - ArrayList candidates = new ArrayList<>(); - for (int i : Level.NEIGHBOURS8) - if (Level.passable[cell + i]) - candidates.add(cell + i); - int newCell = candidates.isEmpty() ? cell : Random.element(candidates); - Dungeon.level.drop( this, newCell ).sprite.drop( cell ); - } else - super.onThrow( cell ); + if (!Level.pit[ cell ] && lightingFuse) { + Actor.addDelayed(fuse = new Fuse().ignite(this), 2); + } + if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){ + ArrayList candidates = new ArrayList<>(); + for (int i : Level.NEIGHBOURS8) + if (Level.passable[cell + i]) + candidates.add(cell + i); + int newCell = candidates.isEmpty() ? cell : Random.element(candidates); + Dungeon.level.drop( this, newCell ).sprite.drop( cell ); + } else + super.onThrow( cell ); } @Override @@ -138,8 +138,8 @@ public class Bomb extends Item { Char ch = Actor.findChar( c ); if (ch != null) { //those not at the center of the blast take damage less consistently. - int minDamage = c == cell ? Dungeon.depth+5 : 1; - int maxDamage = 10 + Dungeon.depth * 2; + int minDamage = c == cell ? Dungeon.depth+5 : 1; + int maxDamage = 10 + Dungeon.depth * 2; int dmg = Random.NormalIntRange( minDamage, maxDamage ) - Random.Int( ch.dr() ); if (dmg > 0) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java index 5939fbe5e..28242b006 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java @@ -87,12 +87,12 @@ public class DewVial extends Item { if (volume > 0) { - int value = 1 + (Dungeon.depth - 1) / 5; - if (hero.heroClass == HeroClass.HUNTRESS) { - value++; - } - value *= volume; - value = (int)Math.max(volume*volume*.01*hero.HT, value); + int value = 1 + (Dungeon.depth - 1) / 5; + if (hero.heroClass == HeroClass.HUNTRESS) { + value++; + } + value *= volume; + value = (int)Math.max(volume*volume*.01*hero.HT, value); int effect = Math.min( hero.HT - hero.HP, value ); if (effect > 0) { hero.HP += effect; @@ -100,7 +100,7 @@ public class DewVial extends Item { hero.sprite.showStatus( CharSprite.POSITIVE, TXT_VALUE, effect ); } - volume = 0; + volume = 0; hero.spend( TIME_TO_DRINK ); hero.busy(); @@ -122,7 +122,7 @@ public class DewVial extends Item { } } - public void empty() {volume = 0; updateQuickslot();} + public void empty() {volume = 0; updateQuickslot();} @Override public boolean isUpgradable() { @@ -156,7 +156,7 @@ public class DewVial extends Item { } //removed as people need a bigger distinction to realize the dew vial doesn't revive. - /* + /* private static final Glowing WHITE = new Glowing( 0xFFFFCC ); @Override @@ -174,10 +174,10 @@ public class DewVial extends Item { return "You can store excess dew in this tiny vessel for drinking it later. " + "The more full the vial is, the more each dew drop will heal you. " + - "A full vial is as strong as a potion of healing." + - "\n\nVials like this one used to be imbued with revival magic, " + - "but that power has faded. There still seems to be some residual power " + - "left, perhaps a full vial can bless another revival item."; + "A full vial is as strong as a potion of healing." + + "\n\nVials like this one used to be imbued with revival magic, " + + "but that power has faded. There still seems to be some residual power " + + "left, perhaps a full vial can bless another revival item."; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java index ce7523b41..866bfff2f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java @@ -26,84 +26,84 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle public abstract class EquipableItem extends Item { - private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!"; + private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!"; - public static final String AC_EQUIP = "EQUIP"; - public static final String AC_UNEQUIP = "UNEQUIP"; + public static final String AC_EQUIP = "EQUIP"; + public static final String AC_UNEQUIP = "UNEQUIP"; - { - bones = true; - } + { + bones = true; + } - @Override - public void execute( Hero hero, String action ) { - if (action.equals( AC_EQUIP )) { - //In addition to equipping itself, item reassigns itself to the quickslot - //This is a special case as the item is being removed from inventory, but is staying with the hero. - int slot = Dungeon.quickslot.getSlot( this ); - doEquip(hero); - if (slot != -1) { - Dungeon.quickslot.setSlot( slot, this ); - updateQuickslot(); - } - } else if (action.equals( AC_UNEQUIP )) { - doUnequip( hero, true ); - } else { - super.execute( hero, action ); - } - } + @Override + public void execute( Hero hero, String action ) { + if (action.equals( AC_EQUIP )) { + //In addition to equipping itself, item reassigns itself to the quickslot + //This is a special case as the item is being removed from inventory, but is staying with the hero. + int slot = Dungeon.quickslot.getSlot( this ); + doEquip(hero); + if (slot != -1) { + Dungeon.quickslot.setSlot( slot, this ); + updateQuickslot(); + } + } else if (action.equals( AC_UNEQUIP )) { + doUnequip( hero, true ); + } else { + super.execute( hero, action ); + } + } - @Override - public void doDrop( Hero hero ) { - if (!isEquipped( hero ) || doUnequip( hero, false, false )) { - super.doDrop( hero ); - } - } + @Override + public void doDrop( Hero hero ) { + if (!isEquipped( hero ) || doUnequip( hero, false, false )) { + super.doDrop( hero ); + } + } - @Override - public void cast( final Hero user, int dst ) { + @Override + public void cast( final Hero user, int dst ) { - if (isEquipped( user )) { - if (quantity == 1 && !this.doUnequip( user, false, false )) { - return; - } - } + if (isEquipped( user )) { + if (quantity == 1 && !this.doUnequip( user, false, false )) { + return; + } + } - super.cast( user, dst ); - } + super.cast( user, dst ); + } - public static void equipCursed( Hero hero ) { - hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 ); - Sample.INSTANCE.play( Assets.SND_CURSED ); - } + public static void equipCursed( Hero hero ) { + hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 ); + Sample.INSTANCE.play( Assets.SND_CURSED ); + } - protected float time2equip( Hero hero ) { - return 1; - } + protected float time2equip( Hero hero ) { + return 1; + } - public abstract boolean doEquip( Hero hero ); + public abstract boolean doEquip( Hero hero ); - public boolean doUnequip( Hero hero, boolean collect, boolean single ) { + public boolean doUnequip( Hero hero, boolean collect, boolean single ) { - if (cursed) { - GLog.w(TXT_UNEQUIP_CURSED, name()); - return false; - } + if (cursed) { + GLog.w(TXT_UNEQUIP_CURSED, name()); + return false; + } - if (single) { - hero.spendAndNext( time2equip( hero ) ); - } else { - hero.spend( time2equip( hero ) ); - } + if (single) { + hero.spendAndNext( time2equip( hero ) ); + } else { + hero.spend( time2equip( hero ) ); + } - if (collect && !collect( hero.belongings.backpack )) { - Dungeon.level.drop( this, hero.pos ); - } + if (collect && !collect( hero.belongings.backpack )) { + Dungeon.level.drop( this, hero.pos ); + } - return true; - } + return true; + } - final public boolean doUnequip( Hero hero, boolean collect ) { - return doUnequip( hero, collect, true ); - } + final public boolean doUnequip( Hero hero, boolean collect ) { + return doUnequip( hero, collect, true ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index ec4e9edd8..81e4fff9d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -50,7 +50,7 @@ public class Generator { SCROLL ( 400, Scroll.class ), WAND ( 40, Wand.class ), RING ( 15, Ring.class ), - ARTIFACT( 15, Artifact.class), + ARTIFACT( 15, Artifact.class), SEED ( 50, Plant.Seed.class ), FOOD ( 0, Food.class ), GOLD ( 500, Gold.class ); @@ -81,14 +81,14 @@ public class Generator { static { - Category.GOLD.classes = new Class[]{ + Category.GOLD.classes = new Class[]{ Gold.class }; Category.GOLD.probs = new float[]{ 1 }; - Category.SCROLL.classes = new Class[]{ - ScrollOfIdentify.class, - ScrollOfTeleportation.class, - ScrollOfRemoveCurse.class, + Category.SCROLL.classes = new Class[]{ + ScrollOfIdentify.class, + ScrollOfTeleportation.class, + ScrollOfRemoveCurse.class, ScrollOfUpgrade.class, ScrollOfRecharging.class, ScrollOfMagicMapping.class, @@ -100,10 +100,10 @@ public class Generator { ScrollOfMirrorImage.class }; Category.SCROLL.probs = new float[]{ 30, 10, 15, 0, 15, 15, 12, 8, 8, 0, 4, 10 }; - Category.POTION.classes = new Class[]{ - PotionOfHealing.class, + Category.POTION.classes = new Class[]{ + PotionOfHealing.class, PotionOfExperience.class, - PotionOfToxicGas.class, + PotionOfToxicGas.class, PotionOfParalyticGas.class, PotionOfLiquidFlame.class, PotionOfLevitation.class, @@ -132,16 +132,16 @@ public class Generator { WandOfRegrowth.class }; Category.WAND.probs = new float[]{ 4, 4, 4, 4, 4, 3, /*3,*/ 3, 3, /*3,*/ 3, 3, 3 }; - Category.WEAPON.classes = new Class[]{ - Dagger.class, + Category.WEAPON.classes = new Class[]{ + Dagger.class, Knuckles.class, - Quarterstaff.class, - Spear.class, - Mace.class, - Sword.class, + Quarterstaff.class, + Spear.class, + Mace.class, + Sword.class, Longsword.class, BattleAxe.class, - WarHammer.class, + WarHammer.class, Glaive.class, ShortSword.class, Dart.class, @@ -153,52 +153,52 @@ public class Generator { Tamahawk.class }; Category.WEAPON.probs = new float[]{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1 }; - Category.ARMOR.classes = new Class[]{ - ClothArmor.class, - LeatherArmor.class, - MailArmor.class, - ScaleArmor.class, + Category.ARMOR.classes = new Class[]{ + ClothArmor.class, + LeatherArmor.class, + MailArmor.class, + ScaleArmor.class, PlateArmor.class }; Category.ARMOR.probs = new float[]{ 1, 1, 1, 1, 1 }; - Category.FOOD.classes = new Class[]{ - Food.class, + Category.FOOD.classes = new Class[]{ + Food.class, Pasty.class, MysteryMeat.class }; Category.FOOD.probs = new float[]{ 4, 1, 0 }; Category.RING.classes = new Class[]{ - RingOfAccuracy.class, - RingOfEvasion.class, - RingOfElements.class, - RingOfForce.class, - RingOfFuror.class, - RingOfHaste.class, - RingOfMagic.class, //currently removed from drop tables, pending rework - RingOfMight.class, - RingOfSharpshooting.class, - RingOfTenacity.class, - RingOfWealth.class}; + RingOfAccuracy.class, + RingOfEvasion.class, + RingOfElements.class, + RingOfForce.class, + RingOfFuror.class, + RingOfHaste.class, + RingOfMagic.class, //currently removed from drop tables, pending rework + RingOfMight.class, + RingOfSharpshooting.class, + RingOfTenacity.class, + RingOfWealth.class}; Category.RING.probs = new float[]{ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 }; - Category.ARTIFACT.classes = new Class[]{ - CapeOfThorns.class, - ChaliceOfBlood.class, - CloakOfShadows.class, - HornOfPlenty.class, - MasterThievesArmband.class, - SandalsOfNature.class, - TalismanOfForesight.class, - TimekeepersHourglass.class, - UnstableSpellbook.class, - AlchemistsToolkit.class, //currently removed from drop tables, pending rework. - DriedRose.class, //starts with no chance of spawning, chance is set directly after beating ghost quest. - LloydsBeacon.class, - EtherealChains.class - }; - Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; + Category.ARTIFACT.classes = new Class[]{ + CapeOfThorns.class, + ChaliceOfBlood.class, + CloakOfShadows.class, + HornOfPlenty.class, + MasterThievesArmband.class, + SandalsOfNature.class, + TalismanOfForesight.class, + TimekeepersHourglass.class, + UnstableSpellbook.class, + AlchemistsToolkit.class, //currently removed from drop tables, pending rework. + DriedRose.class, //starts with no chance of spawning, chance is set directly after beating ghost quest. + LloydsBeacon.class, + EtherealChains.class + }; + Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; - Category.SEED.classes = new Class[]{ + Category.SEED.classes = new Class[]{ Firebloom.Seed.class, Icecap.Seed.class, Sorrowmoss.Seed.class, @@ -206,10 +206,10 @@ public class Generator { Sungrass.Seed.class, Earthroot.Seed.class, Fadeleaf.Seed.class, - Rotberry.Seed.class, + Rotberry.Seed.class, BlandfruitBush.Seed.class, - Dreamfoil.Seed.class, - Stormvine.Seed.class, + Dreamfoil.Seed.class, + Stormvine.Seed.class, Starflower.Seed.class}; Category.SEED.probs = new float[]{ 12, 12, 12, 12, 12, 12, 12, 0, 4, 12, 12, 1 }; } @@ -234,10 +234,10 @@ public class Generator { return randomArmor(); case WEAPON: return randomWeapon(); - case ARTIFACT: - Item item = randomArtifact(); - //if we're out of artifacts, return a ring instead. - return item != null ? item : random(Category.RING); + case ARTIFACT: + Item item = randomArtifact(); + //if we're out of artifacts, return a ring instead. + return item != null ? item : random(Category.RING); default: return ((Item)cat.classes[Random.chances( cat.probs )].newInstance()).random(); } @@ -261,124 +261,124 @@ public class Generator { } } - public static Armor randomArmor(){ - int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count; + public static Armor randomArmor(){ + int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count; - return randomArmor(curStr); - } + return randomArmor(curStr); + } public static Armor randomArmor(int targetStr) { Category cat = Category.ARMOR; - try { - Armor a1 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance(); - Armor a2 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance(); + try { + Armor a1 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance(); + Armor a2 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance(); - a1.random(); - a2.random(); + a1.random(); + a2.random(); - return Math.abs(targetStr - a1.STR) < Math.abs(targetStr - a2.STR) ? a1 : a2; - } catch (Exception e) { - return null; - } + return Math.abs(targetStr - a1.STR) < Math.abs(targetStr - a2.STR) ? a1 : a2; + } catch (Exception e) { + return null; + } } - public static Weapon randomWeapon(){ - int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count; + public static Weapon randomWeapon(){ + int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count; - return randomWeapon(curStr); - } + return randomWeapon(curStr); + } public static Weapon randomWeapon(int targetStr) { - try { - Category cat = Category.WEAPON; + try { + Category cat = Category.WEAPON; - Weapon w1 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance(); - Weapon w2 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance(); + Weapon w1 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance(); + Weapon w2 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance(); - w1.random(); - w2.random(); + w1.random(); + w2.random(); - return Math.abs( targetStr - w1.STR ) < Math.abs( targetStr - w2.STR ) ? w1 : w2; - } catch (Exception e) { - return null; - } + return Math.abs( targetStr - w1.STR ) < Math.abs( targetStr - w2.STR ) ? w1 : w2; + } catch (Exception e) { + return null; + } } - //enforces uniqueness of artifacts throughout a run. - public static Artifact randomArtifact() { + //enforces uniqueness of artifacts throughout a run. + public static Artifact randomArtifact() { - try { - Category cat = Category.ARTIFACT; - int i = Random.chances( cat.probs ); + try { + Category cat = Category.ARTIFACT; + int i = Random.chances( cat.probs ); - //if no artifacts are left, return null - if (i == -1){ - return null; - } + //if no artifacts are left, return null + if (i == -1){ + return null; + } - Artifact artifact = (Artifact)cat.classes[i].newInstance(); + Artifact artifact = (Artifact)cat.classes[i].newInstance(); - //remove the chance of spawning this artifact. - cat.probs[i] = 0; - spawnedArtifacts.add(cat.classes[i].getSimpleName()); + //remove the chance of spawning this artifact. + cat.probs[i] = 0; + spawnedArtifacts.add(cat.classes[i].getSimpleName()); - artifact.random(); + artifact.random(); - return artifact; + return artifact; - } catch (Exception e) { - return null; - } - } + } catch (Exception e) { + return null; + } + } - public static boolean removeArtifact(Artifact artifact) { - if (spawnedArtifacts.contains(artifact.getClass().getSimpleName())) - return false; + public static boolean removeArtifact(Artifact artifact) { + if (spawnedArtifacts.contains(artifact.getClass().getSimpleName())) + return false; - Category cat = Category.ARTIFACT; - for (int i = 0; i < cat.classes.length; i++) - if (cat.classes[i].equals(artifact.getClass())) { - if (cat.probs[i] == 1){ + Category cat = Category.ARTIFACT; + for (int i = 0; i < cat.classes.length; i++) + if (cat.classes[i].equals(artifact.getClass())) { + if (cat.probs[i] == 1){ cat.probs[i] = 0; spawnedArtifacts.add(artifact.getClass().getSimpleName()); return true; } else return false; - } + } - return false; - } + return false; + } - //resets artifact probabilities, for new dungeons - public static void initArtifacts() { - //FIXME: the duplicated logic here has caused 1 bug so far, should refactor. - Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; - spawnedArtifacts = new ArrayList(); - } + //resets artifact probabilities, for new dungeons + public static void initArtifacts() { + //FIXME: the duplicated logic here has caused 1 bug so far, should refactor. + Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; + spawnedArtifacts = new ArrayList(); + } - private static ArrayList spawnedArtifacts = new ArrayList(); + private static ArrayList spawnedArtifacts = new ArrayList(); - private static final String ARTIFACTS = "artifacts"; + private static final String ARTIFACTS = "artifacts"; - //used to store information on which artifacts have been spawned. - public static void storeInBundle(Bundle bundle) { - bundle.put( ARTIFACTS, spawnedArtifacts.toArray(new String[spawnedArtifacts.size()])); - } + //used to store information on which artifacts have been spawned. + public static void storeInBundle(Bundle bundle) { + bundle.put( ARTIFACTS, spawnedArtifacts.toArray(new String[spawnedArtifacts.size()])); + } - public static void restoreFromBundle(Bundle bundle) { - initArtifacts(); + public static void restoreFromBundle(Bundle bundle) { + initArtifacts(); - if (bundle.contains(ARTIFACTS)) { - Collections.addAll(spawnedArtifacts, bundle.getStringArray(ARTIFACTS)); - Category cat = Category.ARTIFACT; + if (bundle.contains(ARTIFACTS)) { + Collections.addAll(spawnedArtifacts, bundle.getStringArray(ARTIFACTS)); + Category cat = Category.ARTIFACT; - for (String artifact : spawnedArtifacts) - for (int i = 0; i < cat.classes.length; i++) - if (cat.classes[i].getSimpleName().equals(artifact)) - cat.probs[i] = 0; - } - } + for (String artifact : spawnedArtifacts) + for (int i = 0; i < cat.classes.length; i++) + if (cat.classes[i].getSimpleName().equals(artifact)) + cat.probs[i] = 0; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Gold.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Gold.java index a67012872..dc11ff24d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Gold.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Gold.java @@ -66,9 +66,9 @@ public class Gold extends Item { Statistics.goldCollected += quantity; Badges.validateGoldCollected(); - MasterThievesArmband.Thievery thievery = hero.buff(MasterThievesArmband.Thievery.class); + MasterThievesArmband.Thievery thievery = hero.buff(MasterThievesArmband.Thievery.class); if (thievery != null) - thievery.collect(quantity); + thievery.collect(quantity); GameScene.pickUp( this ); hero.sprite.showStatus( CharSprite.NEUTRAL, TXT_VALUE, quantity ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index e40679c72..bbf0151a7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -64,14 +64,14 @@ public class Heap implements Bundlable { private static final int SEEDS_TO_POTION = 3; public enum Type { - HEAP, - FOR_SALE, - CHEST, - LOCKED_CHEST, + HEAP, + FOR_SALE, + CHEST, + LOCKED_CHEST, CRYSTAL_CHEST, - TOMB, + TOMB, SKELETON, - REMAINS, + REMAINS, MIMIC } public Type type = Type.HEAP; @@ -98,8 +98,8 @@ public class Heap implements Bundlable { return ItemSpriteSheet.TOMB; case SKELETON: return ItemSpriteSheet.BONES; - case REMAINS: - return ItemSpriteSheet.REMAINS; + case REMAINS: + return ItemSpriteSheet.REMAINS; default: return 0; } @@ -123,7 +123,7 @@ public class Heap implements Bundlable { Wraith.spawnAround( hero.pos ); break; case SKELETON: - case REMAINS: + case REMAINS: CellEmitter.center( pos ).start( Speck.factory( Speck.RATTLE ), 0.1f, 3 ); for (Item item : items) { if (item.cursed) { @@ -261,12 +261,12 @@ public class Heap implements Bundlable { //Note: should not be called to initiate an explosion, but rather by an explosion that is happening. public void explode() { - //breaks open most standard containers, mimics die. + //breaks open most standard containers, mimics die. if (type == Type.MIMIC || type == Type.CHEST || type == Type.SKELETON) { - type = Type.HEAP; - sprite.link(); - sprite.drop(); - return; + type = Type.HEAP; + sprite.link(); + sprite.drop(); + return; } if (type != Type.HEAP) { @@ -294,7 +294,7 @@ public class Heap implements Bundlable { } if (items.isEmpty()) - destroy(); + destroy(); } } @@ -318,7 +318,7 @@ public class Heap implements Bundlable { replace( item, FrozenCarpaccio.cook( (MysteryMeat)item ) ); frozen = true; } else if (item instanceof Potion) { - items.remove(item); + items.remove(item); ((Potion) item).shatter(pos); frozen = true; } else if (item instanceof Bomb){ @@ -332,7 +332,7 @@ public class Heap implements Bundlable { destroy(); } else if (sprite != null) { sprite.view( image(), glowing() ); - } + } } } @@ -345,19 +345,19 @@ public class Heap implements Bundlable { int count = 0; - if (items.size() == 2 && items.get(0) instanceof Seed && items.get(1) instanceof Blandfruit ) { + if (items.size() == 2 && items.get(0) instanceof Seed && items.get(1) instanceof Blandfruit ) { - Sample.INSTANCE.play( Assets.SND_PUFF ); - CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 ); + Sample.INSTANCE.play( Assets.SND_PUFF ); + CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 ); - Blandfruit result = new Blandfruit(); - result.cook((Seed)items.get(0)); + Blandfruit result = new Blandfruit(); + result.cook((Seed)items.get(0)); - destroy(); + destroy(); - return result; + return result; - } + } int index = 0; for (Item item : items) { @@ -379,7 +379,7 @@ public class Heap implements Bundlable { CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 ); Sample.INSTANCE.play( Assets.SND_PUFF ); - Item potion; + Item potion; if (Random.Int( count + bonus ) == 0) { @@ -390,7 +390,7 @@ public class Heap implements Bundlable { Statistics.potionsCooked++; Badges.validatePotionsCooked(); - potion = Generator.random( Generator.Category.POTION ); + potion = Generator.random( Generator.Category.POTION ); } else { @@ -403,10 +403,10 @@ public class Heap implements Bundlable { Badges.validatePotionsCooked(); if (itemClass == null) { - potion = Generator.random( Generator.Category.POTION ); + potion = Generator.random( Generator.Category.POTION ); } else { try { - potion = itemClass.newInstance(); + potion = itemClass.newInstance(); } catch (Exception e) { return null; } @@ -418,13 +418,13 @@ public class Heap implements Bundlable { if (Random.Int(1000/bonus) == 0) return new PotionOfExperience(); - while (potion instanceof PotionOfHealing && Random.Int(15) - Dungeon.limitedDrops.cookingHP.count >= 0) - potion = Generator.random( Generator.Category.POTION ); + while (potion instanceof PotionOfHealing && Random.Int(15) - Dungeon.limitedDrops.cookingHP.count >= 0) + potion = Generator.random( Generator.Category.POTION ); - if (potion instanceof PotionOfHealing) - Dungeon.limitedDrops.cookingHP.count++; + if (potion instanceof PotionOfHealing) + Dungeon.limitedDrops.cookingHP.count++; - return potion; + return potion; } else { return null; @@ -462,8 +462,8 @@ public class Heap implements Bundlable { public void restoreFromBundle( Bundle bundle ) { pos = bundle.getInt( POS ); type = Type.valueOf( bundle.getString( TYPE ) ); - items = new LinkedList( (Collection) ((Collection) bundle.getCollection( ITEMS )) ); - items.removeAll(Collections.singleton(null)); + items = new LinkedList( (Collection) ((Collection) bundle.getCollection( ITEMS )) ); + items.removeAll(Collections.singleton(null)); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java index 0aabc89a1..d7c583601 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java @@ -61,9 +61,9 @@ public class Honeypot extends Item { detach( hero.belongings.backpack ); - shatter( hero, hero.pos ).collect(); + shatter( hero, hero.pos ).collect(); - hero.next(); + hero.next(); } else { super.execute( hero, action ); @@ -82,7 +82,7 @@ public class Honeypot extends Item { public Item shatter( Char owner, int pos ) { if (Dungeon.visible[pos]) { - Sample.INSTANCE.play( Assets.SND_SHATTER ); + Sample.INSTANCE.play( Assets.SND_SHATTER ); Splash.at( pos, 0xffd500, 5 ); } @@ -129,7 +129,7 @@ public class Honeypot extends Item { @Override public boolean isIdentified() { return true; - } + } @Override public int price() { @@ -161,7 +161,7 @@ public class Honeypot extends Item { public Item setBee(Char bee){ myBee = bee.id(); beeDepth = Dungeon.depth; - return this; + return this; } @Override @@ -227,20 +227,20 @@ public class Honeypot extends Item { } private static final String MYBEE = "mybee"; - private static final String BEEDEPTH = "beedepth"; + private static final String BEEDEPTH = "beedepth"; @Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put( MYBEE, myBee ); - bundle.put( BEEDEPTH, beeDepth ); + bundle.put( BEEDEPTH, beeDepth ); } @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); myBee = bundle.getInt( MYBEE ); - beeDepth = bundle.getInt( BEEDEPTH ); + beeDepth = bundle.getInt( BEEDEPTH ); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 1c53b5417..409b85fa3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -79,10 +79,10 @@ public class Item implements Bundlable { // Unique items persist through revival public boolean unique = false; - // whether an item can be included in heroes remains - public boolean bones = false; + // whether an item can be included in heroes remains + public boolean bones = false; - private static Comparator itemComparator = new Comparator() { + private static Comparator itemComparator = new Comparator() { @Override public int compare( Item lhs, Item rhs ) { return Generator.Category.order( lhs ) - Generator.Category.order( rhs ); @@ -109,16 +109,16 @@ public class Item implements Bundlable { } } - public void doDrop( Hero hero ) { - hero.spendAndNext( TIME_TO_DROP ); - Dungeon.level.drop( detachAll( hero.belongings.backpack ), hero.pos ).sprite.drop( hero.pos ); + public void doDrop( Hero hero ) { + hero.spendAndNext( TIME_TO_DROP ); + Dungeon.level.drop( detachAll( hero.belongings.backpack ), hero.pos ).sprite.drop( hero.pos ); } - public void syncVisuals(){ - //do nothing by default, as most items need no visual syncing. - } + public void syncVisuals(){ + //do nothing by default, as most items need no visual syncing. + } - public void doThrow( Hero hero ) { + public void doThrow( Hero hero ) { GameScene.selectCell( thrower ); } @@ -170,7 +170,7 @@ public class Item implements Bundlable { item.updateQuickslot(); return true; } - } + } } if (items.size() < container.size) { @@ -219,15 +219,15 @@ public class Item implements Bundlable { try { - //pssh, who needs copy constructors? - Item detached = getClass().newInstance(); - Bundle copy = new Bundle(); - this.storeInBundle(copy); - detached.restoreFromBundle(copy); - detached.quantity(1); + //pssh, who needs copy constructors? + Item detached = getClass().newInstance(); + Bundle copy = new Bundle(); + this.storeInBundle(copy); + detached.restoreFromBundle(copy); + detached.quantity(1); - detached.onDetach( ); - return detached; + detached.onDetach( ); + return detached; } catch (Exception e) { return null; } @@ -239,17 +239,17 @@ public class Item implements Bundlable { updateQuickslot(); for (Item item : container.items) { - if (item == this) { - container.items.remove(this); - item.onDetach(); - return this; - } else if (item instanceof Bag) { - Bag bag = (Bag)item; - if (bag.contains( this )) { - return detachAll( bag ); - } - } - } + if (item == this) { + container.items.remove(this); + item.onDetach(); + return this; + } else if (item instanceof Bag) { + Bag bag = (Bag)item; + if (bag.contains( this )) { + return detachAll( bag ); + } + } + } return this; } @@ -258,7 +258,7 @@ public class Item implements Bundlable { return getClass() == item.getClass(); } - protected void onDetach(){} + protected void onDetach(){} public Item upgrade() { @@ -481,7 +481,7 @@ public class Item implements Bundlable { final float finalDelay = delay; ((MissileSprite)user.sprite.parent.recycle( MissileSprite.class )). - reset( user.pos, cell, this, new Callback() { + reset( user.pos, cell, this, new Callback() { @Override public void call() { Item.this.detach( user.belongings.backpack ).onThrow( cell ); @@ -492,7 +492,7 @@ public class Item implements Bundlable { protected static Hero curUser = null; protected static Item curItem = null; - protected static CellSelector.Listener thrower = new CellSelector.Listener() { + protected static CellSelector.Listener thrower = new CellSelector.Listener() { @Override public void onSelect( Integer target ) { if (target != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java index cd9062893..3d767f3da 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java @@ -107,8 +107,8 @@ public class ItemStatusHandler { known.add( item ); } - //if there's a new item, give it a random image - //or.. if we're loading from an untrusted version, randomize the image to be safe. + //if there's a new item, give it a random image + //or.. if we're loading from an untrusted version, randomize the image to be safe. } else { int index = Random.Int( labelsLeft.size() ); @@ -119,9 +119,9 @@ public class ItemStatusHandler { images.put( item, imagesLeft.get( index ) ); imagesLeft.remove( index ); - if (bundle.contains( itemName + PFX_KNOWN ) && bundle.getBoolean( itemName + PFX_KNOWN )) { - known.add( item ); - } + if (bundle.contains( itemName + PFX_KNOWN ) && bundle.getBoolean( itemName + PFX_KNOWN )) { + known.add( item ); + } } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java index aac9265bb..522871fc6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java @@ -74,19 +74,19 @@ public class KindOfWeapon extends EquipableItem { } } - @Override - public boolean doUnequip( Hero hero, boolean collect, boolean single ) { - if (super.doUnequip( hero, collect, single )) { + @Override + public boolean doUnequip( Hero hero, boolean collect, boolean single ) { + if (super.doUnequip( hero, collect, single )) { - hero.belongings.weapon = null; - return true; + hero.belongings.weapon = null; + return true; - } else { + } else { - return false; + return false; - } - } + } + } public void activate( Hero hero ) { } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java index 48eb556c3..00516150b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java @@ -3,10 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; -/** - * Created by Evan on 24/08/2014. - */ public abstract class KindofMisc extends EquipableItem { - public abstract void activate(Char ch); + public abstract void activate(Char ch); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java index 694741846..98873b887 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java @@ -8,9 +8,6 @@ import com.watabou.noosa.audio.Sample; import java.util.ArrayList; -/** - * Created by debenhame on 16/03/2015. - */ public class MerchantsBeacon extends Item { private static final String AC_USE = "USE"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java index b4a30ef35..329479368 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java @@ -44,7 +44,7 @@ public class Stylus extends Item { stackable = true; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java index 73d94fdd4..8ed3cd408 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java @@ -116,7 +116,7 @@ public class TomeOfMastery extends Item { @Override public String info() { - return + return "This worn leather book is not that thick, but you feel somehow, " + "that you can gather a lot from it. Remember though that reading " + "this tome may require some time."; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java index 30450e26b..29480a449 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java @@ -36,163 +36,163 @@ import java.util.ArrayList; public class Weightstone extends Item { - private static final String TXT_SELECT_WEAPON = "Select a weapon to balance"; - private static final String TXT_LIGHT = "you balanced your %s to make it lighter"; - private static final String TXT_HEAVY = "you balanced your %s to make it heavier"; + private static final String TXT_SELECT_WEAPON = "Select a weapon to balance"; + private static final String TXT_LIGHT = "you balanced your %s to make it lighter"; + private static final String TXT_HEAVY = "you balanced your %s to make it heavier"; - private static final float TIME_TO_APPLY = 2; + private static final float TIME_TO_APPLY = 2; - private static final String AC_APPLY = "APPLY"; + private static final String AC_APPLY = "APPLY"; - { - name = "weightstone"; - image = ItemSpriteSheet.WEIGHT; + { + name = "weightstone"; + image = ItemSpriteSheet.WEIGHT; - stackable = true; + stackable = true; - bones = true; - } + bones = true; + } - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - actions.add( AC_APPLY ); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + actions.add( AC_APPLY ); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - if (action == AC_APPLY) { + @Override + public void execute( Hero hero, String action ) { + if (action == AC_APPLY) { - curUser = hero; - GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON ); + curUser = hero; + GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON ); - } else { + } else { - super.execute( hero, action ); + super.execute( hero, action ); - } - } + } + } - @Override - public boolean isUpgradable() { - return false; - } + @Override + public boolean isUpgradable() { + return false; + } - @Override - public boolean isIdentified() { - return true; - } + @Override + public boolean isIdentified() { + return true; + } - private void apply( Weapon weapon, boolean forSpeed ) { + private void apply( Weapon weapon, boolean forSpeed ) { - detach( curUser.belongings.backpack ); + detach( curUser.belongings.backpack ); - if (forSpeed) { - weapon.imbue = Weapon.Imbue.LIGHT; - GLog.p( TXT_LIGHT, weapon.name() ); - } else { - weapon.imbue = Weapon.Imbue.HEAVY; - GLog.p( TXT_HEAVY, weapon.name() ); - } + if (forSpeed) { + weapon.imbue = Weapon.Imbue.LIGHT; + GLog.p( TXT_LIGHT, weapon.name() ); + } else { + weapon.imbue = Weapon.Imbue.HEAVY; + GLog.p( TXT_HEAVY, weapon.name() ); + } - curUser.sprite.operate( curUser.pos ); - Sample.INSTANCE.play( Assets.SND_MISS ); + curUser.sprite.operate( curUser.pos ); + Sample.INSTANCE.play( Assets.SND_MISS ); - curUser.spend( TIME_TO_APPLY ); - curUser.busy(); - } + curUser.spend( TIME_TO_APPLY ); + curUser.busy(); + } - @Override - public int price() { - return 40 * quantity; - } + @Override + public int price() { + return 40 * quantity; + } - @Override - public String info() { - return - "Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " + - "increasing either speed or damage at the expense of the other."; - } + @Override + public String info() { + return + "Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " + + "increasing either speed or damage at the expense of the other."; + } - private final WndBag.Listener itemSelector = new WndBag.Listener() { - @Override - public void onSelect( Item item ) { - if (item != null) { - GameScene.show( new WndBalance( (Weapon)item ) ); - } - } - }; + private final WndBag.Listener itemSelector = new WndBag.Listener() { + @Override + public void onSelect( Item item ) { + if (item != null) { + GameScene.show( new WndBalance( (Weapon)item ) ); + } + } + }; - public class WndBalance extends Window { + public class WndBalance extends Window { - private static final String TXT_CHOICE = "How would you like to balance your %s?"; + private static final String TXT_CHOICE = "How would you like to balance your %s?"; - private static final String TXT_LIGHT = "Lighter"; - private static final String TXT_HEAVY = "Heavier"; - private static final String TXT_CANCEL = "Never mind"; + private static final String TXT_LIGHT = "Lighter"; + private static final String TXT_HEAVY = "Heavier"; + private static final String TXT_CANCEL = "Never mind"; - private static final int WIDTH = 120; - private static final int MARGIN = 2; - private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2; - private static final int BUTTON_HEIGHT = 20; + private static final int WIDTH = 120; + private static final int MARGIN = 2; + private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2; + private static final int BUTTON_HEIGHT = 20; - public WndBalance( final Weapon weapon ) { - super(); + public WndBalance( final Weapon weapon ) { + super(); - IconTitle titlebar = new IconTitle( weapon ); - titlebar.setRect( 0, 0, WIDTH, 0 ); - add( titlebar ); + IconTitle titlebar = new IconTitle( weapon ); + titlebar.setRect( 0, 0, WIDTH, 0 ); + add( titlebar ); - BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 ); - tfMesage.maxWidth = WIDTH - MARGIN * 2; - tfMesage.measure(); - tfMesage.x = MARGIN; - tfMesage.y = titlebar.bottom() + MARGIN; - add( tfMesage ); + BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 ); + tfMesage.maxWidth = WIDTH - MARGIN * 2; + tfMesage.measure(); + tfMesage.x = MARGIN; + tfMesage.y = titlebar.bottom() + MARGIN; + add( tfMesage ); - float pos = tfMesage.y + tfMesage.height(); + float pos = tfMesage.y + tfMesage.height(); - if (weapon.imbue != Weapon.Imbue.LIGHT) { - RedButton btnSpeed = new RedButton( TXT_LIGHT ) { - @Override - protected void onClick() { - hide(); - Weightstone.this.apply( weapon, true ); - } - }; - btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); - add( btnSpeed ); + if (weapon.imbue != Weapon.Imbue.LIGHT) { + RedButton btnSpeed = new RedButton( TXT_LIGHT ) { + @Override + protected void onClick() { + hide(); + Weightstone.this.apply( weapon, true ); + } + }; + btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); + add( btnSpeed ); - pos = btnSpeed.bottom(); - } + pos = btnSpeed.bottom(); + } - if (weapon.imbue != Weapon.Imbue.HEAVY) { - RedButton btnAccuracy = new RedButton( TXT_HEAVY ) { - @Override - protected void onClick() { - hide(); - Weightstone.this.apply( weapon, false ); - } - }; - btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); - add( btnAccuracy ); + if (weapon.imbue != Weapon.Imbue.HEAVY) { + RedButton btnAccuracy = new RedButton( TXT_HEAVY ) { + @Override + protected void onClick() { + hide(); + Weightstone.this.apply( weapon, false ); + } + }; + btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); + add( btnAccuracy ); - pos = btnAccuracy.bottom(); - } + pos = btnAccuracy.bottom(); + } - RedButton btnCancel = new RedButton( TXT_CANCEL ) { - @Override - protected void onClick() { - hide(); - } - }; - btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); - add( btnCancel ); + RedButton btnCancel = new RedButton( TXT_CANCEL ) { + @Override + protected void onClick() { + hide(); + } + }; + btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT ); + add( btnCancel ); - resize( WIDTH, (int)btnCancel.bottom() + MARGIN ); - } + resize( WIDTH, (int)btnCancel.bottom() + MARGIN ); + } - protected void onSelect( int index ) {}; - } + protected void onSelect( int index ) {}; + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 845c331be..4854ef650 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -45,7 +45,7 @@ public class Armor extends EquipableItem { private static final String TXT_TO_STRING = "%s :%d"; - private static final String TXT_INCOMPATIBLE = + private static final String TXT_INCOMPATIBLE = "Interaction of different types of magic has erased the glyph on this armor!"; public int tier; @@ -107,7 +107,7 @@ public class Armor extends EquipableItem { ((HeroSprite)hero.sprite).updateArmor(); - hero.spendAndNext( 2 * time2equip( hero ) ); + hero.spendAndNext( 2 * time2equip( hero ) ); return true; } else { @@ -118,26 +118,26 @@ public class Armor extends EquipableItem { } } - @Override - protected float time2equip( Hero hero ) { - return hero.speed(); - } + @Override + protected float time2equip( Hero hero ) { + return hero.speed(); + } - @Override - public boolean doUnequip( Hero hero, boolean collect, boolean single ) { - if (super.doUnequip( hero, collect, single )) { + @Override + public boolean doUnequip( Hero hero, boolean collect, boolean single ) { + if (super.doUnequip( hero, collect, single )) { - hero.belongings.armor = null; - ((HeroSprite)hero.sprite).updateArmor(); + hero.belongings.armor = null; + ((HeroSprite)hero.sprite).updateArmor(); - return true; + return true; - } else { + } else { - return false; + return false; - } - } + } + } @Override public boolean isEquipped( Hero hero ) { @@ -209,25 +209,25 @@ public class Armor extends EquipableItem { StringBuilder info = new StringBuilder( desc() ); if (levelKnown) { - info.append( + info.append( "\n\nThis " + name + " provides damage absorption up to " + "" + Math.max( DR, 0 ) + " points per attack. " ); if (STR > Dungeon.hero.STR()) { if (isEquipped( Dungeon.hero )) { - info.append( + info.append( "\n\nBecause of your inadequate strength your " + "movement speed and defense skill is decreased. " ); } else { - info.append( + info.append( "\n\nBecause of your inadequate strength wearing this armor " + "will decrease your movement speed and defense skill. " ); } } } else { - info.append( + info.append( "\n\nTypical " + name + " provides damage absorption up to " + typicalDR() + " points per attack " + " and requires " + typicalSTR() + " points of strength. " ); if (typicalSTR() > Dungeon.hero.STR()) { @@ -240,8 +240,8 @@ public class Armor extends EquipableItem { } if (isEquipped( Dungeon.hero )) { - info.append( "\n\nYou are wearing the " + name + - (cursed ? ", and because it is cursed, you are powerless to remove it." : ".") ); + info.append( "\n\nYou are wearing the " + name + + (cursed ? ", and because it is cursed, you are powerless to remove it." : ".") ); } else { if (cursedKnown && cursed) { info.append( "\n\nYou can feel a malevolent magic lurking within the " + name + "." ); @@ -306,18 +306,18 @@ public class Armor extends EquipableItem { return price; } - public Armor inscribe( Glyph glyph ) { + public Armor inscribe( Glyph glyph ) { - if (glyph != null && this.glyph == null) { - DR += tier; - } else if (glyph == null && this.glyph != null) { - DR -= tier; - } + if (glyph != null && this.glyph == null) { + DR += tier; + } else if (glyph == null && this.glyph != null) { + DR -= tier; + } - this.glyph = glyph; + this.glyph = glyph; - return this; - } + return this; + } public Armor inscribe() { @@ -341,8 +341,8 @@ public class Armor extends EquipableItem { public static abstract class Glyph implements Bundlable { - private static final Class[] glyphs = new Class[]{ - Bounce.class, Affection.class, AntiEntropy.class, Multiplicity.class, + private static final Class[] glyphs = new Class[]{ + Bounce.class, Affection.class, AntiEntropy.class, Multiplicity.class, Potential.class, Metabolism.class, Stench.class, Viscosity.class, Displacement.class, Entanglement.class }; @@ -359,11 +359,11 @@ public class Armor extends EquipableItem { } @Override - public void restoreFromBundle( Bundle bundle ) { + public void restoreFromBundle( Bundle bundle ) { } @Override - public void storeInBundle( Bundle bundle ) { + public void storeInBundle( Bundle bundle ) { } public ItemSprite.Glowing glowing() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index b1d881416..8ad892d54 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -34,7 +34,7 @@ abstract public class ClassArmor extends Armor { cursedKnown = true; defaultAction = special(); - bones = false; + bones = false; } public ClassArmor() { @@ -108,8 +108,8 @@ abstract public class ClassArmor extends Armor { doSpecial(); } - } else { - super.execute( hero, action ); + } else { + super.execute( hero, action ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClothArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClothArmor.java index ebdbb8556..4f07e8e70 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClothArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClothArmor.java @@ -22,11 +22,11 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class ClothArmor extends Armor { - { + { name = "cloth armor"; image = ItemSpriteSheet.ARMOR_CLOTH; - bones = false; //Finding them in bones would be semi-frequent and disappointing. + bones = false; //Finding them in bones would be semi-frequent and disappointing. } public ClothArmor() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java index ef2c78f10..2241f3af0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java @@ -36,7 +36,7 @@ public class HuntressArmor extends ClassArmor { private static final String TXT_NO_ENEMIES = "No enemies in sight"; private static final String TXT_NOT_HUNTRESS = "Only huntresses can use this armor!"; - private static final String AC_SPECIAL = "SPECTRAL BLADES"; + private static final String AC_SPECIAL = "SPECTRAL BLADES"; { name = "huntress cloak"; @@ -58,7 +58,7 @@ public class HuntressArmor extends ClassArmor { for (Mob mob : Dungeon.level.mobs) { if (Level.fieldOfView[mob.pos]) { - Callback callback = new Callback() { + Callback callback = new Callback() { @Override public void call() { curUser.attack( targets.get( this ) ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/LeatherArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/LeatherArmor.java index 655f429bf..91a06201c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/LeatherArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/LeatherArmor.java @@ -22,7 +22,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class LeatherArmor extends Armor { - { + { name = "leather armor"; image = ItemSpriteSheet.ARMOR_LEATHER; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java index ee70412dd..2faa6a659 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java @@ -32,9 +32,9 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -public class MageArmor extends ClassArmor { +public class MageArmor extends ClassArmor { - private static final String AC_SPECIAL = "MOLTEN EARTH"; + private static final String AC_SPECIAL = "MOLTEN EARTH"; private static final String TXT_NOT_MAGE = "Only mages can use this armor!"; @@ -56,7 +56,7 @@ public class MageArmor extends ClassArmor { } @Override - public void doSpecial() { + public void doSpecial() { for (Mob mob : Dungeon.level.mobs) { if (Level.fieldOfView[mob.pos]) { @@ -65,7 +65,7 @@ public class MageArmor extends ClassArmor { } } - curUser.HP -= (curUser.HP / 3); + curUser.HP -= (curUser.HP / 3); curUser.spend( Actor.TICK ); curUser.sprite.operate( curUser.pos ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MailArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MailArmor.java index 3c6cf31e9..58e25ba85 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MailArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MailArmor.java @@ -33,7 +33,7 @@ public class MailArmor extends Armor { @Override public String desc() { - return + return "Interlocking metal links make for a tough but flexible suit of armor."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/PlateArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/PlateArmor.java index a080bd3af..7904cabd7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/PlateArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/PlateArmor.java @@ -33,7 +33,7 @@ public class PlateArmor extends Armor { @Override public String desc() { - return + return "Enormous plates of metal are joined together into a suit that provides " + "unmatched protection to any adventurer strong enough to bear its staggering weight."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java index ac94f581d..45689c641 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java @@ -40,7 +40,7 @@ public class RogueArmor extends ClassArmor { private static final String TXT_FOV = "You can only jump to an empty location in your field of view"; private static final String TXT_NOT_ROGUE = "Only rogues can use this armor!"; - private static final String AC_SPECIAL = "SMOKE BOMB"; + private static final String AC_SPECIAL = "SMOKE BOMB"; { name = "rogue garb"; @@ -53,7 +53,7 @@ public class RogueArmor extends ClassArmor { } @Override - public void doSpecial() { + public void doSpecial() { GameScene.selectCell( teleporter ); } @@ -69,7 +69,7 @@ public class RogueArmor extends ClassArmor { @Override public String desc() { - return + return "Wearing this dark garb, a rogue can perform a trick, that is called \"smoke bomb\" " + "(though no real explosives are used): he blinds enemies who could see him and jumps aside."; } @@ -80,15 +80,15 @@ public class RogueArmor extends ClassArmor { public void onSelect( Integer target ) { if (target != null) { - if (!Level.fieldOfView[target] || - !(Level.passable[target] || Level.avoid[target]) || + if (!Level.fieldOfView[target] || + !(Level.passable[target] || Level.avoid[target]) || Actor.findChar( target ) != null) { GLog.w( TXT_FOV ); return; } - curUser.HP -= (curUser.HP / 3); + curUser.HP -= (curUser.HP / 3); for (Mob mob : Dungeon.level.mobs) { if (Level.fieldOfView[mob.pos]) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ScaleArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ScaleArmor.java index 2b0528631..b6d4a8501 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ScaleArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ScaleArmor.java @@ -33,7 +33,7 @@ public class ScaleArmor extends Armor { @Override public String desc() { - return + return "The metal scales sewn onto a leather vest create a flexible, yet protective armor."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java index 8fc8b9915..ccf8675b7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java @@ -41,7 +41,7 @@ public class WarriorArmor extends ClassArmor { private static int LEAP_TIME = 1; private static int SHOCK_TIME = 3; - private static final String AC_SPECIAL = "HEROIC LEAP"; + private static final String AC_SPECIAL = "HEROIC LEAP"; private static final String TXT_NOT_WARRIOR = "Only warriors can use this armor!"; @@ -91,35 +91,35 @@ public class WarriorArmor extends ClassArmor { cell = route.path.get(route.dist-1); - curUser.HP -= (curUser.HP / 3); + curUser.HP -= (curUser.HP / 3); if (curUser.subClass == HeroSubClass.BERSERKER && curUser.HP <= curUser.HT * Fury.LEVEL) { Buff.affect( curUser, Fury.class ); } - final int dest = cell; - curUser.busy(); - curUser.sprite.jump(curUser.pos, cell, new Callback() { - @Override - public void call() { - curUser.move(dest); - Dungeon.level.press(dest, curUser); - Dungeon.observe(); + final int dest = cell; + curUser.busy(); + curUser.sprite.jump(curUser.pos, cell, new Callback() { + @Override + public void call() { + curUser.move(dest); + Dungeon.level.press(dest, curUser); + Dungeon.observe(); - for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { - Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]); - if (mob != null && mob != curUser) { - Buff.prolong(mob, Paralysis.class, SHOCK_TIME); - } - } + for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { + Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]); + if (mob != null && mob != curUser) { + Buff.prolong(mob, Paralysis.class, SHOCK_TIME); + } + } - CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10); - Camera.main.shake(2, 0.5f); + CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10); + Camera.main.shake(2, 0.5f); - curUser.spendAndNext(LEAP_TIME); - } - }); + curUser.spendAndNext(LEAP_TIME); + } + }); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java index 6dc0a15af..6c85b14ee 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java @@ -17,254 +17,251 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Collections; -/** - * Created by debenhame on 24/11/2014. - */ public class AlchemistsToolkit extends Artifact { - { - name = "Alchemists Toolkit"; - image = ItemSpriteSheet.ARTIFACT_TOOLKIT; + { + name = "Alchemists Toolkit"; + image = ItemSpriteSheet.ARTIFACT_TOOLKIT; - level = 0; - levelCap = 10; - } + level = 0; + levelCap = 10; + } - public static final String AC_BREW = "BREW"; + public static final String AC_BREW = "BREW"; - //arrays used in containing potion collections for mix logic. - public final ArrayList combination = new ArrayList(); - public ArrayList curGuess = new ArrayList(); - public ArrayList bstGuess = new ArrayList(); + //arrays used in containing potion collections for mix logic. + public final ArrayList combination = new ArrayList(); + public ArrayList curGuess = new ArrayList(); + public ArrayList bstGuess = new ArrayList(); - public int numWrongPlace = 0; - public int numRight = 0; + public int numWrongPlace = 0; + public int numRight = 0; - private int seedsToPotion = 0; + private int seedsToPotion = 0; - protected String inventoryTitle = "Select a potion"; - protected WndBag.Mode mode = WndBag.Mode.POTION; + protected String inventoryTitle = "Select a potion"; + protected WndBag.Mode mode = WndBag.Mode.POTION; - public AlchemistsToolkit() { - super(); + public AlchemistsToolkit() { + super(); - Generator.Category cat = Generator.Category.POTION; - for (int i = 1; i <= 3; i++){ - String potion; - do{ - potion = convertName(cat.classes[Random.chances(cat.probs)].getSimpleName()); - //forcing the player to use experience potions would be completely unfair. - } while (combination.contains(potion) || potion.equals("Experience")); - combination.add(potion); - } - } + Generator.Category cat = Generator.Category.POTION; + for (int i = 1; i <= 3; i++){ + String potion; + do{ + potion = convertName(cat.classes[Random.chances(cat.probs)].getSimpleName()); + //forcing the player to use experience potions would be completely unfair. + } while (combination.contains(potion) || potion.equals("Experience")); + combination.add(potion); + } + } - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < levelCap && !cursed) - actions.add(AC_BREW); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && level < levelCap && !cursed) + actions.add(AC_BREW); + return actions; + } - @Override - public void execute(Hero hero, String action ) { - if (action.equals(AC_BREW)){ - GameScene.selectItem(itemSelector, mode, inventoryTitle); - } else { - super.execute(hero, action); - } - } + @Override + public void execute(Hero hero, String action ) { + if (action.equals(AC_BREW)){ + GameScene.selectItem(itemSelector, mode, inventoryTitle); + } else { + super.execute(hero, action); + } + } - public void guessBrew() { - if (curGuess.size() != 3) - return; + public void guessBrew() { + if (curGuess.size() != 3) + return; - int numWrongPlace = 0; - int numRight = 0; + int numWrongPlace = 0; + int numRight = 0; - for (String potion : curGuess) { - if (combination.contains(potion)) { - if (curGuess.indexOf(potion) == combination.indexOf(potion)) { - numRight++; - } else { - numWrongPlace++; - } - } - } + for (String potion : curGuess) { + if (combination.contains(potion)) { + if (curGuess.indexOf(potion) == combination.indexOf(potion)) { + numRight++; + } else { + numWrongPlace++; + } + } + } - int score = (numRight *3) + numWrongPlace; + int score = (numRight *3) + numWrongPlace; - if (score == 9) - score ++; + if (score == 9) + score ++; - if (score == 0){ + if (score == 0){ - GLog.i("Your mixture is complete, but none of the potions you used seem to react well. " + - "The brew is useless, you throw it away."); + GLog.i("Your mixture is complete, but none of the potions you used seem to react well. " + + "The brew is useless, you throw it away."); - } else if (score > level) { + } else if (score > level) { - level = score; - seedsToPotion = 0; - bstGuess = curGuess; - this.numRight = numRight; - this.numWrongPlace = numWrongPlace; + level = score; + seedsToPotion = 0; + bstGuess = curGuess; + this.numRight = numRight; + this.numWrongPlace = numWrongPlace; - if (level == 10){ - bstGuess = new ArrayList(); - GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!"); - } else { - GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) + - ". This is your best brew yet!"); - } + if (level == 10){ + bstGuess = new ArrayList(); + GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!"); + } else { + GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) + + ". This is your best brew yet!"); + } - } else { + } else { - GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) + - ". This brew isn't as good as the current one, you throw it away."); - } - curGuess = new ArrayList(); + GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) + + ". This brew isn't as good as the current one, you throw it away."); + } + curGuess = new ArrayList(); - } + } - private String brewDesc(int numWrongPlace, int numRight){ - String result = ""; - if (numWrongPlace > 0){ - result += numWrongPlace + " reacted well, but in the wrong order"; - if (numRight > 0) - result += " and "; - } - if (numRight > 0){ - result += numRight + " reacted perfectly"; - } - return result; - } + private String brewDesc(int numWrongPlace, int numRight){ + String result = ""; + if (numWrongPlace > 0){ + result += numWrongPlace + " reacted well, but in the wrong order"; + if (numRight > 0) + result += " and "; + } + if (numRight > 0){ + result += numRight + " reacted perfectly"; + } + return result; + } - @Override - protected ArtifactBuff passiveBuff() { - return new alchemy(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new alchemy(); + } - @Override - public String desc() { - String result = "This toolkit contains a number of regents and herbs used to improve the process of " + - "cooking potions.\n\n"; + @Override + public String desc() { + String result = "This toolkit contains a number of regents and herbs used to improve the process of " + + "cooking potions.\n\n"; - if (isEquipped(Dungeon.hero)) - if (cursed) - result += "The cursed toolkit has bound itself to your side, and refuses to let you use alchemy.\n\n"; - else - result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n"; + if (isEquipped(Dungeon.hero)) + if (cursed) + result += "The cursed toolkit has bound itself to your side, and refuses to let you use alchemy.\n\n"; + else + result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n"; - if (level == 0){ - result += "The toolkit seems to be missing a key tool, a catalyst mixture. You'll have to make your own " + - "out of three common potions to get the most out of the toolkit."; - } else if (level == 10) { - result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency."; - } else if (!bstGuess.isEmpty()) { - result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", " - + bstGuess.get(2) + ", in that order.\n\n"; - result += "Of the potions in that mix, " + brewDesc(numWrongPlace, numRight) + "."; + if (level == 0){ + result += "The toolkit seems to be missing a key tool, a catalyst mixture. You'll have to make your own " + + "out of three common potions to get the most out of the toolkit."; + } else if (level == 10) { + result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency."; + } else if (!bstGuess.isEmpty()) { + result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", " + + bstGuess.get(2) + ", in that order.\n\n"; + result += "Of the potions in that mix, " + brewDesc(numWrongPlace, numRight) + "."; - //would only trigger if an upgraded toolkit was gained through transmutation or bones. - } else { - result += "The toolkit seems to have a catalyst mixture already in it, but it isn't ideal. Unfortunately " + - "you have no idea what's in the mixture."; - } - return result; - } + //would only trigger if an upgraded toolkit was gained through transmutation or bones. + } else { + result += "The toolkit seems to have a catalyst mixture already in it, but it isn't ideal. Unfortunately " + + "you have no idea what's in the mixture."; + } + return result; + } - private static final String COMBINATION = "combination"; - private static final String CURGUESS = "curguess"; - private static final String BSTGUESS = "bstguess"; + private static final String COMBINATION = "combination"; + private static final String CURGUESS = "curguess"; + private static final String BSTGUESS = "bstguess"; - private static final String NUMWRONGPLACE = "numwrongplace"; - private static final String NUMRIGHT = "numright"; + private static final String NUMWRONGPLACE = "numwrongplace"; + private static final String NUMRIGHT = "numright"; - private static final String SEEDSTOPOTION = "seedstopotion"; + private static final String SEEDSTOPOTION = "seedstopotion"; - @Override - public void storeInBundle(Bundle bundle){ - super.storeInBundle(bundle); - bundle.put(NUMWRONGPLACE, numWrongPlace); - bundle.put(NUMRIGHT, numRight); + @Override + public void storeInBundle(Bundle bundle){ + super.storeInBundle(bundle); + bundle.put(NUMWRONGPLACE, numWrongPlace); + bundle.put(NUMRIGHT, numRight); - bundle.put(SEEDSTOPOTION, seedsToPotion); + bundle.put(SEEDSTOPOTION, seedsToPotion); - bundle.put(COMBINATION, combination.toArray(new String[combination.size()])); - bundle.put(CURGUESS, curGuess.toArray(new String[curGuess.size()])); - bundle.put(BSTGUESS, bstGuess.toArray(new String[bstGuess.size()])); - } + bundle.put(COMBINATION, combination.toArray(new String[combination.size()])); + bundle.put(CURGUESS, curGuess.toArray(new String[curGuess.size()])); + bundle.put(BSTGUESS, bstGuess.toArray(new String[bstGuess.size()])); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - numWrongPlace = bundle.getInt( NUMWRONGPLACE ); - numRight = bundle.getInt( NUMRIGHT ); + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + numWrongPlace = bundle.getInt( NUMWRONGPLACE ); + numRight = bundle.getInt( NUMRIGHT ); - seedsToPotion = bundle.getInt( SEEDSTOPOTION ); + seedsToPotion = bundle.getInt( SEEDSTOPOTION ); - combination.clear(); - Collections.addAll( combination, bundle.getStringArray( COMBINATION )); - Collections.addAll( curGuess, bundle.getStringArray( CURGUESS )); - Collections.addAll( bstGuess, bundle.getStringArray( BSTGUESS )); - } + combination.clear(); + Collections.addAll( combination, bundle.getStringArray( COMBINATION )); + Collections.addAll( curGuess, bundle.getStringArray( CURGUESS )); + Collections.addAll( bstGuess, bundle.getStringArray( BSTGUESS )); + } - public class alchemy extends ArtifactBuff { + public class alchemy extends ArtifactBuff { - public boolean tryCook(int count){ + public boolean tryCook(int count){ - //this logic is handled inside the class with a variable so that it may be stored. - //to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky. - if (seedsToPotion == 0){ - if (Random.Int(20) < 10+level){ - if (Random.Int(20) < level){ - seedsToPotion = 1; - } else - seedsToPotion = 2; - } else - seedsToPotion = 3; - } + //this logic is handled inside the class with a variable so that it may be stored. + //to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky. + if (seedsToPotion == 0){ + if (Random.Int(20) < 10+level){ + if (Random.Int(20) < level){ + seedsToPotion = 1; + } else + seedsToPotion = 2; + } else + seedsToPotion = 3; + } - if (count >= seedsToPotion){ - seedsToPotion = 0; - return true; - } else - return false; + if (count >= seedsToPotion){ + seedsToPotion = 0; + return true; + } else + return false; - } + } - } + } - protected WndBag.Listener itemSelector = new WndBag.Listener() { - @Override - public void onSelect(Item item) { - if (item != null && item instanceof Potion && item.isIdentified()){ - if (!curGuess.contains(convertName(item.getClass().getSimpleName()))) { + protected WndBag.Listener itemSelector = new WndBag.Listener() { + @Override + public void onSelect(Item item) { + if (item != null && item instanceof Potion && item.isIdentified()){ + if (!curGuess.contains(convertName(item.getClass().getSimpleName()))) { - Hero hero = Dungeon.hero; - hero.sprite.operate( hero.pos ); - hero.busy(); - hero.spend( 2f ); - Sample.INSTANCE.play(Assets.SND_DRINK); + Hero hero = Dungeon.hero; + hero.sprite.operate( hero.pos ); + hero.busy(); + hero.spend( 2f ); + Sample.INSTANCE.play(Assets.SND_DRINK); - item.detach(hero.belongings.backpack); + item.detach(hero.belongings.backpack); - curGuess.add(convertName(item.getClass().getSimpleName())); - if (curGuess.size() == 3){ - guessBrew(); - } else { - GLog.i("You mix the " + item.name() + " into your current brew."); - } - } else { - GLog.w("Your current brew already contains that potion."); - } - } else if (item != null) { - GLog.w("You need to select an identified potion."); - } - } - }; + curGuess.add(convertName(item.getClass().getSimpleName())); + if (curGuess.size() == 3){ + guessBrew(); + } else { + GLog.i("You mix the " + item.name() + " into your current brew."); + } + } else { + GLog.w("Your current brew already contains that potion."); + } + } else if (item != null) { + GLog.w("You need to select an identified potion."); + } + } + }; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java index 4fe57c35d..73ed1a976 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java @@ -13,270 +13,267 @@ import com.watabou.utils.Random; import java.util.ArrayList; -/** - * Created by Evan on 24/08/2014. - */ public class Artifact extends KindofMisc { - private static final float TIME_TO_EQUIP = 1f; + private static final float TIME_TO_EQUIP = 1f; - private static final String TXT_TO_STRING = "%s"; - private static final String TXT_TO_STRING_CHARGE = "%s (%d/%d)"; - private static final String TXT_TO_STRING_LVL = "%s%+d"; - private static final String TXT_TO_STRING_LVL_CHARGE = "%s%+d (%d/%d)"; + private static final String TXT_TO_STRING = "%s"; + private static final String TXT_TO_STRING_CHARGE = "%s (%d/%d)"; + private static final String TXT_TO_STRING_LVL = "%s%+d"; + private static final String TXT_TO_STRING_LVL_CHARGE = "%s%+d (%d/%d)"; - protected Buff passiveBuff; - protected Buff activeBuff; + protected Buff passiveBuff; + protected Buff activeBuff; - //level is used internally to track upgrades to artifacts, size/logic varies per artifact. - //already inherited from item superclass - //exp is used to count progress towards levels for some artifacts - protected int exp = 0; - //levelCap is the artifact's maximum level - protected int levelCap = 0; + //level is used internally to track upgrades to artifacts, size/logic varies per artifact. + //already inherited from item superclass + //exp is used to count progress towards levels for some artifacts + protected int exp = 0; + //levelCap is the artifact's maximum level + protected int levelCap = 0; - //the current artifact charge - protected int charge = 0; - //the build towards next charge, usually rolls over at 1. - //better to keep charge as an int and use a separate float than casting. - protected float partialCharge = 0; - //the maximum charge, varies per artifact, not all artifacts use this. - protected int chargeCap = 0; + //the current artifact charge + protected int charge = 0; + //the build towards next charge, usually rolls over at 1. + //better to keep charge as an int and use a separate float than casting. + protected float partialCharge = 0; + //the maximum charge, varies per artifact, not all artifacts use this. + protected int chargeCap = 0; - //used by some artifacts to keep track of duration of effects or cooldowns to use. - protected int cooldown = 0; + //used by some artifacts to keep track of duration of effects or cooldowns to use. + protected int cooldown = 0; - public Artifact(){ - super(); - } + public Artifact(){ + super(); + } - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); + return actions; + } - @Override - public boolean doEquip( Hero hero ) { + @Override + public boolean doEquip( Hero hero ) { - if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) { + if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) { - GLog.w("you can only wear 2 misc items at a time"); - return false; + GLog.w("you can only wear 2 misc items at a time"); + return false; - } else if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass()) - || (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){ + } else if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass()) + || (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){ - GLog.w("you cannot wear two of the same artifact"); - return false; + GLog.w("you cannot wear two of the same artifact"); + return false; - } else { + } else { - if (hero.belongings.misc1 == null) { - hero.belongings.misc1 = this; - } else { - hero.belongings.misc2 = this; - } + if (hero.belongings.misc1 == null) { + hero.belongings.misc1 = this; + } else { + hero.belongings.misc2 = this; + } - detach( hero.belongings.backpack ); + detach( hero.belongings.backpack ); - activate( hero ); + activate( hero ); - cursedKnown = true; - identify(); - if (cursed) { - equipCursed( hero ); - GLog.n( "the " + this.name + " painfully binds itself to you" ); - } + cursedKnown = true; + identify(); + if (cursed) { + equipCursed( hero ); + GLog.n( "the " + this.name + " painfully binds itself to you" ); + } - hero.spendAndNext( TIME_TO_EQUIP ); - return true; + hero.spendAndNext( TIME_TO_EQUIP ); + return true; - } + } - } + } - public void activate( Char ch ) { - passiveBuff = passiveBuff(); - passiveBuff.attachTo(ch); - } + public void activate( Char ch ) { + passiveBuff = passiveBuff(); + passiveBuff.attachTo(ch); + } - @Override - public boolean doUnequip( Hero hero, boolean collect, boolean single ) { - if (super.doUnequip( hero, collect, single )) { + @Override + public boolean doUnequip( Hero hero, boolean collect, boolean single ) { + if (super.doUnequip( hero, collect, single )) { - if (hero.belongings.misc1 == this) { - hero.belongings.misc1 = null; - } else { - hero.belongings.misc2 = null; - } + if (hero.belongings.misc1 == this) { + hero.belongings.misc1 = null; + } else { + hero.belongings.misc2 = null; + } - passiveBuff.detach(); - passiveBuff = null; + passiveBuff.detach(); + passiveBuff = null; - if (activeBuff != null){ - activeBuff.detach(); - activeBuff = null; - } + if (activeBuff != null){ + activeBuff.detach(); + activeBuff = null; + } - return true; + return true; - } else { + } else { - return false; + return false; - } - } + } + } - @Override - public boolean isEquipped( Hero hero ) { - return hero.belongings.misc1 == this || hero.belongings.misc2 == this; - } + @Override + public boolean isEquipped( Hero hero ) { + return hero.belongings.misc1 == this || hero.belongings.misc2 == this; + } - @Override - public boolean isUpgradable() { - return false; - } + @Override + public boolean isUpgradable() { + return false; + } - @Override - public int visiblyUpgraded() { - return ((level*10)/levelCap); - } + @Override + public int visiblyUpgraded() { + return ((level*10)/levelCap); + } - //transfers upgrades from another artifact, transfer level will equal the displayed level - public void transferUpgrade(int transferLvl) { - upgrade(Math.round((float)(transferLvl*levelCap)/10)); - } + //transfers upgrades from another artifact, transfer level will equal the displayed level + public void transferUpgrade(int transferLvl) { + upgrade(Math.round((float)(transferLvl*levelCap)/10)); + } - @Override - public String info() { - if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) { + @Override + public String info() { + if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) { - return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + "."; + return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + "."; - } else { + } else { - return desc(); + return desc(); - } - } + } + } - @Override - public String toString() { + @Override + public String toString() { - if (levelKnown && level/levelCap != 0) { - if (chargeCap > 0) { - return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap ); - } else { - return Utils.format( TXT_TO_STRING_LVL, name(), visiblyUpgraded() ); - } - } else { - if (chargeCap > 0) { - return Utils.format( TXT_TO_STRING_CHARGE, name(), charge, chargeCap ); - } else { - return Utils.format( TXT_TO_STRING, name() ); - } - } - } + if (levelKnown && level/levelCap != 0) { + if (chargeCap > 0) { + return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap ); + } else { + return Utils.format( TXT_TO_STRING_LVL, name(), visiblyUpgraded() ); + } + } else { + if (chargeCap > 0) { + return Utils.format( TXT_TO_STRING_CHARGE, name(), charge, chargeCap ); + } else { + return Utils.format( TXT_TO_STRING, name() ); + } + } + } - @Override - public String status() { + @Override + public String status() { - //display the current cooldown - if (cooldown != 0) - return Utils.format( "%d", cooldown ); + //display the current cooldown + if (cooldown != 0) + return Utils.format( "%d", cooldown ); - //display as percent - if (chargeCap == 100) - return Utils.format( "%d%%", charge ); + //display as percent + if (chargeCap == 100) + return Utils.format( "%d%%", charge ); - //display as #/# - if (chargeCap > 0) - return Utils.format( "%d/%d", charge, chargeCap ); + //display as #/# + if (chargeCap > 0) + return Utils.format( "%d/%d", charge, chargeCap ); - //if there's no cap - - //- but there is charge anyway, display that charge - if (charge != 0) - return Utils.format( "%d", charge ); + //if there's no cap - + //- but there is charge anyway, display that charge + if (charge != 0) + return Utils.format( "%d", charge ); - //otherwise, if there's no charge, return null. - return null; - } + //otherwise, if there's no charge, return null. + return null; + } - //converts class names to be more concise and readable. - protected String convertName(String className){ - //removes known redundant parts of names. - className = className.replaceFirst("ScrollOf|PotionOf", ""); + //converts class names to be more concise and readable. + protected String convertName(String className){ + //removes known redundant parts of names. + className = className.replaceFirst("ScrollOf|PotionOf", ""); - //inserts a space infront of every uppercase character - className = className.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"); + //inserts a space infront of every uppercase character + className = className.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"); - return className; - }; + return className; + }; - @Override - public Item random() { - if (Random.Float() < 0.3f) { - cursed = true; - } - return this; - } + @Override + public Item random() { + if (Random.Float() < 0.3f) { + cursed = true; + } + return this; + } - @Override - public int price() { - int price = 100; - if (level > 0) - price += 50*((level*10)/levelCap); - if (cursed && cursedKnown) { - price /= 2; - } - if (price < 1) { - price = 1; - } - return price; - } + @Override + public int price() { + int price = 100; + if (level > 0) + price += 50*((level*10)/levelCap); + if (cursed && cursedKnown) { + price /= 2; + } + if (price < 1) { + price = 1; + } + return price; + } - protected ArtifactBuff passiveBuff() { - return null; - } + protected ArtifactBuff passiveBuff() { + return null; + } - protected ArtifactBuff activeBuff() {return null; } + protected ArtifactBuff activeBuff() {return null; } - public class ArtifactBuff extends Buff { + public class ArtifactBuff extends Buff { - public int level() { - return level; - } + public int level() { + return level; + } - public boolean isCursed() { - return cursed; - } + public boolean isCursed() { + return cursed; + } - } + } - private static final String IMAGE = "image"; - private static final String EXP = "exp"; - private static final String CHARGE = "charge"; - private static final String PARTIALCHARGE = "partialcharge"; + private static final String IMAGE = "image"; + private static final String EXP = "exp"; + private static final String CHARGE = "charge"; + private static final String PARTIALCHARGE = "partialcharge"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put( IMAGE, image ); - bundle.put( EXP , exp ); - bundle.put( CHARGE , charge ); - bundle.put( PARTIALCHARGE , partialCharge ); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put( IMAGE, image ); + bundle.put( EXP , exp ); + bundle.put( CHARGE , charge ); + bundle.put( PARTIALCHARGE , partialCharge ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - if (bundle.contains( IMAGE )) image = bundle.getInt( IMAGE ); - exp = bundle.getInt( EXP ); - charge = bundle.getInt( CHARGE ); - partialCharge = bundle.getFloat( PARTIALCHARGE ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + if (bundle.contains( IMAGE )) image = bundle.getInt( IMAGE ); + exp = bundle.getInt( EXP ); + charge = bundle.getInt( CHARGE ); + partialCharge = bundle.getFloat( PARTIALCHARGE ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java index 583004efd..ec5a3b7b4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -8,127 +8,124 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Random; -/** - * Created by debenhame on 03/09/2014. - */ public class CapeOfThorns extends Artifact { - { - name = "Cape of Thorns"; - image = ItemSpriteSheet.ARTIFACT_CAPE; + { + name = "Cape of Thorns"; + image = ItemSpriteSheet.ARTIFACT_CAPE; - level = 0; - levelCap = 10; + level = 0; + levelCap = 10; - charge = 0; - chargeCap = 100; - cooldown = 0; + charge = 0; + chargeCap = 100; + cooldown = 0; - defaultAction = "NONE"; - } + defaultAction = "NONE"; + } - @Override - protected ArtifactBuff passiveBuff() { - return new Thorns(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new Thorns(); + } - @Override - public String desc() { - String desc = "These collapsed sheets of metal from the DM-300 have formed together into a rigid wearable " + - "cape. The metal is old and coated in thick flakes of rust. It seems to store a deep energy, " + - "perhaps it has some of the DM-300's power?"; - if (isEquipped( Dungeon.hero )) { - desc += "\n\n"; - if (cooldown == 0) - desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " + - "help you in a fight, but it seems to be gaining energy from the damage you take."; - else - desc += "The cape seems to be releasing some stored energy, " + - "it is radiating a protective power at all angles. "; - } + @Override + public String desc() { + String desc = "These collapsed sheets of metal from the DM-300 have formed together into a rigid wearable " + + "cape. The metal is old and coated in thick flakes of rust. It seems to store a deep energy, " + + "perhaps it has some of the DM-300's power?"; + if (isEquipped( Dungeon.hero )) { + desc += "\n\n"; + if (cooldown == 0) + desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " + + "help you in a fight, but it seems to be gaining energy from the damage you take."; + else + desc += "The cape seems to be releasing some stored energy, " + + "it is radiating a protective power at all angles. "; + } - return desc; - } + return desc; + } - public class Thorns extends ArtifactBuff{ + public class Thorns extends ArtifactBuff{ - @Override - public boolean act(){ - if (cooldown > 0) { - cooldown--; - if (cooldown == 0) { - BuffIndicator.refreshHero(); - GLog.w("Your Cape becomes inert again."); - } - updateQuickslot(); - } - spend(TICK); - return true; - } + @Override + public boolean act(){ + if (cooldown > 0) { + cooldown--; + if (cooldown == 0) { + BuffIndicator.refreshHero(); + GLog.w("Your Cape becomes inert again."); + } + updateQuickslot(); + } + spend(TICK); + return true; + } - public int proc(int damage, Char attacker, Char defender){ - if (cooldown == 0){ - charge += damage*(0.5+level*0.05); - if (charge >= chargeCap){ - charge = 0; - cooldown = 10+level; - GLog.p("Your Cape begins radiating energy, you feel protected!"); - BuffIndicator.refreshHero(); - } - } + public int proc(int damage, Char attacker, Char defender){ + if (cooldown == 0){ + charge += damage*(0.5+level*0.05); + if (charge >= chargeCap){ + charge = 0; + cooldown = 10+level; + GLog.p("Your Cape begins radiating energy, you feel protected!"); + BuffIndicator.refreshHero(); + } + } - if (cooldown != 0){ - int deflected = Random.NormalIntRange(0, damage); - damage -= deflected; + if (cooldown != 0){ + int deflected = Random.NormalIntRange(0, damage); + damage -= deflected; - if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) { - attacker.damage(deflected, this); - } + if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) { + attacker.damage(deflected, this); + } - exp+= deflected; + exp+= deflected; - if (exp >= (level+1)*5 && level < levelCap){ - exp -= (level+1)*5; - upgrade(); - GLog.p("Your Cape grows stronger!"); - } + if (exp >= (level+1)*5 && level < levelCap){ + exp -= (level+1)*5; + upgrade(); + GLog.p("Your Cape grows stronger!"); + } - } - updateQuickslot(); - return damage; - } + } + updateQuickslot(); + return damage; + } - @Override - public String toString() { - return "Thorns"; - } + @Override + public String toString() { + return "Thorns"; + } - @Override - public String desc() { - return "Your cape is radiating energy, surrounding you in a field of deflective force!\n" + - "\n" + - "All damage you receive is reduced while the thorns effect is active. Additionally, " + - "if the attacker is next to you, the reduced amount is deflected back at the attacker.\n" + - "\n" + - "Your cape will continue radiating energy for " + dispTurns(cooldown) + "."; - } + @Override + public String desc() { + return "Your cape is radiating energy, surrounding you in a field of deflective force!\n" + + "\n" + + "All damage you receive is reduced while the thorns effect is active. Additionally, " + + "if the attacker is next to you, the reduced amount is deflected back at the attacker.\n" + + "\n" + + "Your cape will continue radiating energy for " + dispTurns(cooldown) + "."; + } - @Override - public int icon() { - if (cooldown == 0) - return BuffIndicator.NONE; - else - return BuffIndicator.THORNS; - } + @Override + public int icon() { + if (cooldown == 0) + return BuffIndicator.NONE; + else + return BuffIndicator.THORNS; + } - @Override - public void detach(){ - cooldown = 0; - charge = 0; - super.detach(); - } + @Override + public void detach(){ + cooldown = 0; + charge = 0; + super.detach(); + } - } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index 3825ce1b0..b92e24c5b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -17,152 +17,149 @@ import com.watabou.utils.Random; import java.util.ArrayList; -/** - * Created by debenhame on 27/08/2014. - */ public class ChaliceOfBlood extends Artifact { - private static final String TXT_CHALICE = "Chalice of Blood"; - private static final String TXT_YES = "Yes, I know what I'm doing"; - private static final String TXT_NO = "No, I changed my mind"; - private static final String TXT_PRICK = - "Each time you use the chalice it will drain more life energy, "+ - "if you are not careful this draining effect can easily kill you.\n\n"+ - "Are you sure you want to offer it more life energy?"; + private static final String TXT_CHALICE = "Chalice of Blood"; + private static final String TXT_YES = "Yes, I know what I'm doing"; + private static final String TXT_NO = "No, I changed my mind"; + private static final String TXT_PRICK = + "Each time you use the chalice it will drain more life energy, "+ + "if you are not careful this draining effect can easily kill you.\n\n"+ + "Are you sure you want to offer it more life energy?"; - { - name = "Chalice of Blood"; - image = ItemSpriteSheet.ARTIFACT_CHALICE1; + { + name = "Chalice of Blood"; + image = ItemSpriteSheet.ARTIFACT_CHALICE1; - level = 0; - levelCap = 10; - } + level = 0; + levelCap = 10; + } - public static final String AC_PRICK = "PRICK"; + public static final String AC_PRICK = "PRICK"; - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < levelCap && !cursed) - actions.add(AC_PRICK); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && level < levelCap && !cursed) + actions.add(AC_PRICK); + return actions; + } - @Override - public void execute(Hero hero, String action ) { - super.execute(hero, action); - if (action.equals(AC_PRICK)){ + @Override + public void execute(Hero hero, String action ) { + super.execute(hero, action); + if (action.equals(AC_PRICK)){ - int damage = 3*(level*level); + int damage = 3*(level*level); - if (damage > hero.HP*0.75) { + if (damage > hero.HP*0.75) { - GameScene.show( - new WndOptions(TXT_CHALICE, TXT_PRICK, TXT_YES, TXT_NO) { - @Override - protected void onSelect(int index) { - if (index == 0) - prick(Dungeon.hero); - }; - } - ); + GameScene.show( + new WndOptions(TXT_CHALICE, TXT_PRICK, TXT_YES, TXT_NO) { + @Override + protected void onSelect(int index) { + if (index == 0) + prick(Dungeon.hero); + }; + } + ); - } else { - prick(hero); - } - } - } + } else { + prick(hero); + } + } + } - private void prick(Hero hero){ - int damage = 3*(level*level); + private void prick(Hero hero){ + int damage = 3*(level*level); - Earthroot.Armor armor = hero.buff(Earthroot.Armor.class); - if (armor != null) { - damage = armor.absorb(damage); - } + Earthroot.Armor armor = hero.buff(Earthroot.Armor.class); + if (armor != null) { + damage = armor.absorb(damage); + } - damage -= Random.IntRange(0, hero.dr()); + damage -= Random.IntRange(0, hero.dr()); - hero.sprite.operate( hero.pos ); - hero.busy(); - hero.spend(3f); - if (damage <= 0){ - GLog.i("You prick yourself, and your blood drips into the chalice."); - } else if (damage < 25){ - GLog.w("You prick yourself and the chalice feeds on you."); - Sample.INSTANCE.play(Assets.SND_CURSED); - hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 ); - } else if (damage < 100){ - GLog.w("Your life essence drains into the chalice."); - Sample.INSTANCE.play(Assets.SND_CURSED); - hero.sprite.emitter().burst( ShadowParticle.CURSE, 12 ); - } else { - GLog.w("The chalice devours your life energy."); - Sample.INSTANCE.play(Assets.SND_CURSED); - hero.sprite.emitter().burst( ShadowParticle.CURSE, 18 ); - } + hero.sprite.operate( hero.pos ); + hero.busy(); + hero.spend(3f); + if (damage <= 0){ + GLog.i("You prick yourself, and your blood drips into the chalice."); + } else if (damage < 25){ + GLog.w("You prick yourself and the chalice feeds on you."); + Sample.INSTANCE.play(Assets.SND_CURSED); + hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 ); + } else if (damage < 100){ + GLog.w("Your life essence drains into the chalice."); + Sample.INSTANCE.play(Assets.SND_CURSED); + hero.sprite.emitter().burst( ShadowParticle.CURSE, 12 ); + } else { + GLog.w("The chalice devours your life energy."); + Sample.INSTANCE.play(Assets.SND_CURSED); + hero.sprite.emitter().burst( ShadowParticle.CURSE, 18 ); + } - if (damage > 0) - hero.damage(damage, this); + if (damage > 0) + hero.damage(damage, this); - if (!hero.isAlive()) { - Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name )); - GLog.n("The Chalice sucks your life essence dry..."); - } else { - upgrade(); - } - } + if (!hero.isAlive()) { + Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name )); + GLog.n("The Chalice sucks your life essence dry..."); + } else { + upgrade(); + } + } - @Override - public Item upgrade() { - if (level >= 6) - image = ItemSpriteSheet.ARTIFACT_CHALICE3; - else if (level >= 2) - image = ItemSpriteSheet.ARTIFACT_CHALICE2; - return super.upgrade(); - } + @Override + public Item upgrade() { + if (level >= 6) + image = ItemSpriteSheet.ARTIFACT_CHALICE3; + else if (level >= 2) + image = ItemSpriteSheet.ARTIFACT_CHALICE2; + return super.upgrade(); + } - @Override - protected ArtifactBuff passiveBuff() { - return new chaliceRegen(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new chaliceRegen(); + } - @Override - public String desc() { - String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. "; - if (level < levelCap) - desc += "The chalice is pulling your attention strangely, you feel like it wants something from you."; - else - desc += "The chalice is full and radiating energy."; + @Override + public String desc() { + String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. "; + if (level < levelCap) + desc += "The chalice is pulling your attention strangely, you feel like it wants something from you."; + else + desc += "The chalice is full and radiating energy."; - if (isEquipped (Dungeon.hero)){ - desc += "\n\n"; - if (cursed) - desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy."; - else if (level == 0) - desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems."; - else if (level < 3) - desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " + - "energy into you. You still want to cut yourself on the chalice, even though you know it will hurt."; - else if (level < 7) - desc += "The chalice is about half full of your blood and you can feel it feeding life energy " + - "into you. you still want to hurt yourself, the chalice needs your energy, it's your friend."; - else if (level < levelCap) - desc += "The chalice is getting pretty full, and the life force it's feeding you is stronger than " + - "ever. You should give it more energy, you need too, your friend needs your energy, it needs " + - "your help. Your friend knows you have limits though, it doesn't want you to die, just bleed."; - else - desc += "The chalice is filled to the brim with your life essence. You can feel the chalice pouring " + - "life energy back into you. It's your best friend. It's happy with you. So happy. " + - "You've done well. So well. You're being rewarded. You don't need to touch the sharp gems anymore."; - } + if (isEquipped (Dungeon.hero)){ + desc += "\n\n"; + if (cursed) + desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy."; + else if (level == 0) + desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems."; + else if (level < 3) + desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " + + "energy into you. You still want to cut yourself on the chalice, even though you know it will hurt."; + else if (level < 7) + desc += "The chalice is about half full of your blood and you can feel it feeding life energy " + + "into you. you still want to hurt yourself, the chalice needs your energy, it's your friend."; + else if (level < levelCap) + desc += "The chalice is getting pretty full, and the life force it's feeding you is stronger than " + + "ever. You should give it more energy, you need too, your friend needs your energy, it needs " + + "your help. Your friend knows you have limits though, it doesn't want you to die, just bleed."; + else + desc += "The chalice is filled to the brim with your life essence. You can feel the chalice pouring " + + "life energy back into you. It's your best friend. It's happy with you. So happy. " + + "You've done well. So well. You're being rewarded. You don't need to touch the sharp gems anymore."; + } - return desc; - } + return desc; + } - public class chaliceRegen extends ArtifactBuff { + public class chaliceRegen extends ArtifactBuff { - } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index c07d12da2..ec26316e9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -16,251 +16,248 @@ import com.watabou.utils.Bundle; import java.util.ArrayList; -/** - * Created by debenhame on 25/08/2014. - */ public class CloakOfShadows extends Artifact { - { - name = "Cloak of Shadows"; - image = ItemSpriteSheet.ARTIFACT_CLOAK; + { + name = "Cloak of Shadows"; + image = ItemSpriteSheet.ARTIFACT_CLOAK; - level = 0; - exp = 0; - levelCap = 15; + level = 0; + exp = 0; + levelCap = 15; - charge = level+5; - partialCharge = 0; - chargeCap = level+5; + charge = level+5; + partialCharge = 0; + chargeCap = level+5; - cooldown = 0; + cooldown = 0; - defaultAction = AC_STEALTH; + defaultAction = AC_STEALTH; - unique = true; - bones = false; - } + unique = true; + bones = false; + } - private boolean stealthed = false; + private boolean stealthed = false; - public static final String AC_STEALTH = "STEALTH"; + public static final String AC_STEALTH = "STEALTH"; - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge > 1) - actions.add(AC_STEALTH); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge > 1) + actions.add(AC_STEALTH); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - if (action.equals( AC_STEALTH )) { + @Override + public void execute( Hero hero, String action ) { + if (action.equals( AC_STEALTH )) { - if (!stealthed){ - if (!isEquipped(hero)) GLog.i("You need to equip your cloak to do that."); - else if (cooldown > 0) GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize."); - else if (charge <= 1) GLog.i("Your cloak hasn't recharged enough to be usable yet."); - else { - stealthed = true; - hero.spend( 1f ); - hero.busy(); - Sample.INSTANCE.play(Assets.SND_MELD); - activeBuff = activeBuff(); - activeBuff.attachTo(hero); - if (hero.sprite.parent != null) { - hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f)); - } else { - hero.sprite.alpha(0.4f); - } - hero.sprite.operate(hero.pos); - GLog.i("Your cloak blends you into the shadows."); - } - } else { - stealthed = false; - activeBuff.detach(); - activeBuff = null; - hero.sprite.operate( hero.pos ); - GLog.i("You return from underneath your cloak."); - } + if (!stealthed){ + if (!isEquipped(hero)) GLog.i("You need to equip your cloak to do that."); + else if (cooldown > 0) GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize."); + else if (charge <= 1) GLog.i("Your cloak hasn't recharged enough to be usable yet."); + else { + stealthed = true; + hero.spend( 1f ); + hero.busy(); + Sample.INSTANCE.play(Assets.SND_MELD); + activeBuff = activeBuff(); + activeBuff.attachTo(hero); + if (hero.sprite.parent != null) { + hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f)); + } else { + hero.sprite.alpha(0.4f); + } + hero.sprite.operate(hero.pos); + GLog.i("Your cloak blends you into the shadows."); + } + } else { + stealthed = false; + activeBuff.detach(); + activeBuff = null; + hero.sprite.operate( hero.pos ); + GLog.i("You return from underneath your cloak."); + } - } else - super.execute(hero, action); - } + } else + super.execute(hero, action); + } - @Override - public void activate(Char ch){ - super.activate(ch); - if (stealthed){ - activeBuff = activeBuff(); - activeBuff.attachTo(ch); - } - } + @Override + public void activate(Char ch){ + super.activate(ch); + if (stealthed){ + activeBuff = activeBuff(); + activeBuff.attachTo(ch); + } + } - @Override - public boolean doUnequip(Hero hero, boolean collect, boolean single) { - if (super.doUnequip(hero, collect, single)){ - stealthed = false; - return true; - } else - return false; - } + @Override + public boolean doUnequip(Hero hero, boolean collect, boolean single) { + if (super.doUnequip(hero, collect, single)){ + stealthed = false; + return true; + } else + return false; + } - @Override - protected ArtifactBuff passiveBuff() { - return new cloakRecharge(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new cloakRecharge(); + } - @Override - protected ArtifactBuff activeBuff( ) { - return new cloakStealth(); - } + @Override + protected ArtifactBuff activeBuff( ) { + return new cloakStealth(); + } - @Override - public Item upgrade() { - chargeCap++; - return super.upgrade(); - } + @Override + public Item upgrade() { + chargeCap++; + return super.upgrade(); + } - @Override - public String desc() { - String desc = "This light silken cloak shimmers in and out of your vision as it sways in the air. When worn, " + - "it can be used to hide your presence for a short time.\n\n"; + @Override + public String desc() { + String desc = "This light silken cloak shimmers in and out of your vision as it sways in the air. When worn, " + + "it can be used to hide your presence for a short time.\n\n"; - if (level < 5) - desc += "The cloak's magic has faded and it is not very powerful, perhaps it will regain strength through use."; - else if (level < 10) - desc += "The cloak's power has begun to return."; - else if (level < 15) - desc += "The cloak has almost returned to full strength."; - else - desc += "The cloak is at full potential and will work for extended durations."; + if (level < 5) + desc += "The cloak's magic has faded and it is not very powerful, perhaps it will regain strength through use."; + else if (level < 10) + desc += "The cloak's power has begun to return."; + else if (level < 15) + desc += "The cloak has almost returned to full strength."; + else + desc += "The cloak is at full potential and will work for extended durations."; - if ( isEquipped (Dungeon.hero) ) - desc += "\n\nThe cloak rests around your shoulders."; + if ( isEquipped (Dungeon.hero) ) + desc += "\n\nThe cloak rests around your shoulders."; - return desc; - } + return desc; + } - private static final String STEALTHED = "stealthed"; - private static final String COOLDOWN = "cooldown"; + private static final String STEALTHED = "stealthed"; + private static final String COOLDOWN = "cooldown"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put( STEALTHED, stealthed ); - bundle.put( COOLDOWN, cooldown ); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put( STEALTHED, stealthed ); + bundle.put( COOLDOWN, cooldown ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - stealthed = bundle.getBoolean( STEALTHED ); - cooldown = bundle.getInt( COOLDOWN ); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + stealthed = bundle.getBoolean( STEALTHED ); + cooldown = bundle.getInt( COOLDOWN ); + } - public class cloakRecharge extends ArtifactBuff{ - @Override - public boolean act() { - if (charge < chargeCap) { - if (!stealthed) - partialCharge += (1f / (60 - (chargeCap-charge)*2)); + public class cloakRecharge extends ArtifactBuff{ + @Override + public boolean act() { + if (charge < chargeCap) { + if (!stealthed) + partialCharge += (1f / (60 - (chargeCap-charge)*2)); - if (partialCharge >= 1) { - charge++; - partialCharge -= 1; - if (charge == chargeCap){ - partialCharge = 0; - } + if (partialCharge >= 1) { + charge++; + partialCharge -= 1; + if (charge == chargeCap){ + partialCharge = 0; + } - } - } else - partialCharge = 0; + } + } else + partialCharge = 0; - if (cooldown > 0) - cooldown --; + if (cooldown > 0) + cooldown --; - updateQuickslot(); + updateQuickslot(); - spend( TICK ); + spend( TICK ); - return true; - } + return true; + } - } + } - public class cloakStealth extends ArtifactBuff{ - @Override - public int icon() { - return BuffIndicator.INVISIBLE; - } + public class cloakStealth extends ArtifactBuff{ + @Override + public int icon() { + return BuffIndicator.INVISIBLE; + } - @Override - public boolean attachTo( Char target ) { - if (super.attachTo( target )) { - target.invisible++; - return true; - } else { - return false; - } - } + @Override + public boolean attachTo( Char target ) { + if (super.attachTo( target )) { + target.invisible++; + return true; + } else { + return false; + } + } - @Override - public boolean act(){ - charge--; - if (charge <= 0) { - detach(); - GLog.w("Your cloak has run out of energy."); - ((Hero)target).interrupt(); - } + @Override + public boolean act(){ + charge--; + if (charge <= 0) { + detach(); + GLog.w("Your cloak has run out of energy."); + ((Hero)target).interrupt(); + } - exp += 10 + ((Hero)target).lvl; + exp += 10 + ((Hero)target).lvl; - if (exp >= (level+1)*50 && level < levelCap) { - upgrade(); - exp -= level*50; - GLog.p("Your cloak grows stronger!"); - } + if (exp >= (level+1)*50 && level < levelCap) { + upgrade(); + exp -= level*50; + GLog.p("Your cloak grows stronger!"); + } - updateQuickslot(); + updateQuickslot(); - spend( TICK ); + spend( TICK ); - return true; - } + return true; + } - @Override - public void fx(boolean on) { - if (on) target.sprite.add( CharSprite.State.INVISIBLE ); - else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE ); - } + @Override + public void fx(boolean on) { + if (on) target.sprite.add( CharSprite.State.INVISIBLE ); + else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE ); + } - @Override - public String toString() { - return "Cloaked"; - } + @Override + public String toString() { + return "Cloaked"; + } - @Override - public String desc() { - return "Your cloak of shadows is granting you invisibility while you are shrouded by it.\n" + - "\n" + - "While you are invisible enemies are unable to attack or follow you. " + - "Most physical attacks and magical effects (such as scrolls and wands) will immediately cancel invisibility.\n" + - "\n" + - "You will remain cloaked until it is cancelled or your cloak runs out of charge."; - } + @Override + public String desc() { + return "Your cloak of shadows is granting you invisibility while you are shrouded by it.\n" + + "\n" + + "While you are invisible enemies are unable to attack or follow you. " + + "Most physical attacks and magical effects (such as scrolls and wands) will immediately cancel invisibility.\n" + + "\n" + + "You will remain cloaked until it is cancelled or your cloak runs out of charge."; + } - @Override - public void detach() { - if (target.invisible > 0) - target.invisible--; - stealthed = false; - cooldown = 10 - (level / 3); + @Override + public void detach() { + if (target.invisible > 0) + target.invisible--; + stealthed = false; + cooldown = 10 - (level / 3); - updateQuickslot(); - super.detach(); - } - } + updateQuickslot(); + super.detach(); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index e08729248..081dcbdf0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -28,549 +28,546 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.HashSet; -/** - * Created by debenhame on 21/11/2014. - */ public class DriedRose extends Artifact { - { - name = "Dried Rose"; - image = ItemSpriteSheet.ARTIFACT_ROSE1; - - level = 0; - levelCap = 10; - - charge = 100; - chargeCap = 100; - - defaultAction = AC_SUMMON; - } - - protected static boolean talkedTo = false; - protected static boolean firstSummon = false; - protected static boolean spawned = false; - - public int droppedPetals = 0; - - public static final String AC_SUMMON = "SUMMON"; - - public DriedRose(){ - super(); - talkedTo = firstSummon = spawned = false; - } - - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge == chargeCap && !cursed) - actions.add(AC_SUMMON); - return actions; - } - - @Override - public void execute( Hero hero, String action ) { - if (action.equals(AC_SUMMON)) { - - if (spawned) GLog.n("sad ghost: \"I'm already here\""); - else if (!isEquipped( hero )) GLog.i("You need to equip your rose to do that."); - else if (charge != chargeCap) GLog.i("Your rose isn't fully charged yet."); - else if (cursed) GLog.i("You cannot use a cursed rose."); - else { - ArrayList spawnPoints = new ArrayList(); - for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { - int p = hero.pos + Level.NEIGHBOURS8[i]; - if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) { - spawnPoints.add(p); - } - } - - if (spawnPoints.size() > 0) { - GhostHero ghost = new GhostHero( level ); - ghost.pos = Random.element(spawnPoints); - - GameScene.add(ghost, 1f); - CellEmitter.get(ghost.pos).start( ShaftParticle.FACTORY, 0.3f, 4 ); - CellEmitter.get(ghost.pos).start( Speck.factory(Speck.LIGHT), 0.2f, 3 ); - - hero.spend(1f); - hero.busy(); - hero.sprite.operate(hero.pos); - - if (!firstSummon) { - ghost.yell(ghost.VOICE_HELLO + Dungeon.hero.givenName()); - Sample.INSTANCE.play( Assets.SND_GHOST ); - firstSummon = true; - } else - ghost.saySpawned(); - - spawned = true; - charge = 0; - updateQuickslot(); - - } else - GLog.i("There is no free space near you."); - } - - } else{ - super.execute(hero, action); - } - } - - @Override - public String desc() { - String desc = - "Is this the rose that the ghost mentioned before disappearing? It seems to hold some spiritual power,"+ - " perhaps it can be used to channel the energy of that lost warrior."; - - if (isEquipped( Dungeon.hero )){ - if (!cursed){ - desc += "\n\nThe rose rests in your hand, it feels strangely warm."; - - if (level < 5) - desc+= "\n\nThe rose has lost most of its petals. It feels extremely frail, like it " + - "could snap any moment."; - else if (level < 10) - desc+= "\n\nYou have reattached many petals and the rose has started to somehow come back to life."+ - " It almost looks like it's ready to bloom."; - else - desc+= "\n\nThe rose has blossomed again through some kind of magic, its connection to your spirit"+ - " friend is stronger than ever."; - } else - desc += "\n\nThe cursed rose is bound to you hand, it feels eerily cold."; - } - - return desc; - } - - @Override - protected ArtifactBuff passiveBuff() { - return new roseRecharge(); - } - - @Override - public Item upgrade() { - if (level >= 9) - image = ItemSpriteSheet.ARTIFACT_ROSE3; - else if (level >= 4) - image = ItemSpriteSheet.ARTIFACT_ROSE2; - - //For upgrade transferring via well of transmutation - droppedPetals = Math.max( level, droppedPetals ); - - return super.upgrade(); - } - - private static final String TALKEDTO = "talkedto"; - private static final String FIRSTSUMMON = "firstsummon"; - private static final String SPAWNED = "spawned"; - private static final String PETALS = "petals"; - - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - - bundle.put( TALKEDTO, talkedTo ); - bundle.put( FIRSTSUMMON, firstSummon ); - bundle.put( SPAWNED, spawned ); - bundle.put( PETALS, droppedPetals ); - } - - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - - talkedTo = bundle.getBoolean( TALKEDTO ); - firstSummon = bundle.getBoolean( FIRSTSUMMON ); - spawned = bundle.getBoolean( SPAWNED ); - droppedPetals = bundle.getInt( PETALS ); - } - - public class roseRecharge extends ArtifactBuff { - - @Override - public boolean act() { - - if (charge < chargeCap && !cursed) { - //TODO: investigate balancing on this. - partialCharge += 10/75f; - if (partialCharge > 1){ - charge++; - partialCharge--; - if (charge == chargeCap){ - partialCharge = 0f; - GLog.p("Your rose is fully charged!"); - } - } - } else if (cursed && Random.Int(100) == 0) { - - ArrayList spawnPoints = new ArrayList(); - - for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { - int p = target.pos + Level.NEIGHBOURS8[i]; - if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) { - spawnPoints.add(p); - } - } - - if (spawnPoints.size() > 0) { - Wraith.spawnAt(Random.element(spawnPoints)); - Sample.INSTANCE.play(Assets.SND_CURSED); - } - - } - - updateQuickslot(); - - spend( TICK ); - - return true; - } - } - - public static class Petal extends Item { - - { - name = "dried petal"; - stackable = true; - image = ItemSpriteSheet.PETAL; - } - - @Override - public boolean doPickUp( Hero hero ) { - DriedRose rose = hero.belongings.getItem( DriedRose.class ); - - if (rose == null){ - GLog.w("You have no rose to add this petal to."); - return false; - } if ( rose.level >= rose.levelCap ){ - GLog.i("There is no room left for this petal, so you discard it."); - return true; - } else { - - rose.upgrade(); - if (rose.level == rose.levelCap) { - GLog.p("The rose is completed!"); - Sample.INSTANCE.play( Assets.SND_GHOST ); - GLog.n("sad ghost: \"Thank you...\""); - } else - GLog.i("You add the petal to the rose."); - - Sample.INSTANCE.play( Assets.SND_DEWDROP ); - hero.spendAndNext(TIME_TO_PICK_UP); - return true; - - } - } - - @Override - public String info() { - return "A frail dried up petal, which has somehow survived this far into the dungeon."; - } - - } - - public static class GhostHero extends NPC { - - { - name = "sad ghost"; - spriteClass = GhostSprite.class; - - flying = true; - - state = WANDERING; - enemy = null; - - ally = true; - } - - public GhostHero() { - super(); - - //double heroes defence skill - defenseSkill = (Dungeon.hero.lvl+4)*2; - } - - public GhostHero(int roseLevel){ - this(); - HP = HT = 10+roseLevel*3; - } - - public void saySpawned(){ - int i = (Dungeon.depth - 1) / 5; - if (chooseEnemy() == null) - yell( Random.element( VOICE_AMBIENT[i] ) ); - else - yell( Random.element( VOICE_ENEMIES[i][ Dungeon.bossLevel() ? 1 : 0 ] ) ); - Sample.INSTANCE.play( Assets.SND_GHOST ); - } - - public void sayAnhk(){ - yell( Random.element( VOICE_BLESSEDANKH ) ); - Sample.INSTANCE.play( Assets.SND_GHOST ); - } - - public void sayDefeated(){ - yell( Random.element( VOICE_DEFEATED[ Dungeon.bossLevel() ? 1 : 0 ] ) ); - Sample.INSTANCE.play( Assets.SND_GHOST ); - } - - public void sayHeroKilled(){ - yell(Random.element(VOICE_HEROKILLED)); - Sample.INSTANCE.play( Assets.SND_GHOST ); - } - - public void sayBossBeaten(){ - yell( Random.element( VOICE_BOSSBEATEN[ Dungeon.depth==25 ? 1 : 0 ] ) ); - Sample.INSTANCE.play( Assets.SND_GHOST ); - } - - @Override - public String defenseVerb() { - return "evaded"; - } - - @Override - protected boolean act() { - if (Random.Int(10) == 0) damage(1 , this); - if (!isAlive()) - return true; - if (!Dungeon.hero.isAlive()){ - sayHeroKilled(); - sprite.die(); - destroy(); - return true; - } - return super.act(); - } - - @Override - protected boolean getCloser( int target ) { - if (state == WANDERING || Level.distance(target, Dungeon.hero.pos) > 6) - this.target = target = Dungeon.hero.pos; - return super.getCloser( target ); - } - - @Override - protected Char chooseEnemy() { - if (enemy == null || !enemy.isAlive() || state == WANDERING) { - - HashSet enemies = new HashSet(); - for (Mob mob : Dungeon.level.mobs) { - if (mob.hostile && Level.fieldOfView[mob.pos] && mob.state != mob.PASSIVE) { - enemies.add(mob); - } - } - enemy = enemies.size() > 0 ? Random.element( enemies ) : null; - } - return enemy; - } - - @Override - public int attackSkill(Char target) { - //same accuracy as the hero. - return (defenseSkill/2)+5; - } - - @Override - public int damageRoll() { - //equivalent to N/2 to 5+N, where N is rose level. - int lvl = (HT-10)/3; - return Random.NormalIntRange( lvl/2, 5+lvl); - } - - @Override - public int dr() { - //defence is equal to the level of rose. - return (HT-10)/3; - } - - @Override - public void add( Buff buff ) { - //in other words, can't be directly affected by buffs/debuffs. - } - - @Override - public void interact() { - if (!DriedRose.talkedTo){ - DriedRose.talkedTo = true; - GameScene.show(new WndQuest(this, VOICE_INTRODUCE )); - } else { - int curPos = pos; - - moveSprite( pos, Dungeon.hero.pos ); - move( Dungeon.hero.pos ); - - Dungeon.hero.sprite.move( Dungeon.hero.pos, curPos ); - Dungeon.hero.move( curPos ); - - Dungeon.hero.spend( 1 / Dungeon.hero.speed() ); - Dungeon.hero.busy(); - } - } - - @Override - public void die(Object cause) { - sayDefeated(); - super.die(cause); - } - - @Override - public void destroy() { - DriedRose.spawned = false; - super.destroy(); - } - - @Override - public String description() { - return - "A frail looking ethereal figure with a humanoid shape. Its power seems tied to the rose I have." + - "\n\nThis ghost may not be much, but it seems to be my only true friend down here."; - } - - private static final HashSet> IMMUNITIES = new HashSet>(); - static { - IMMUNITIES.add( ToxicGas.class ); - IMMUNITIES.add( ScrollOfPsionicBlast.class ); - } - - @Override - public HashSet> immunities() { - return IMMUNITIES; - } - - //************************************************************************************ - //This is a bunch strings & string arrays, used in all of the sad ghost's voice lines. - //************************************************************************************ - - public static final String VOICE_HELLO = "Hello again "; - - private static final String VOICE_INTRODUCE = "My spirit is bound to this rose, it was very precious to me, a "+ - "gift from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a " + - "second chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" + - "hopefully you may succeed where I failed..."; - - //1st index - depth type, 2nd index - specific line. - public static final String[][] VOICE_AMBIENT = { - { - "These sewers were once safe, some even lived here in the winter...", - "I wonder what happened to the guard patrols, did they give up?...", - "I had family on the surface, I hope they are safe..." - },{ - "I've heard stories about this place, nothing good...", - "This place was always more of a dungeon than a prison...", - "I can't imagine what went on when this place was abandoned..." - },{ - "No human or dwarf has been here for a very long time...", - "Something must have gone very wrong, for the dwarves to abandon a gold mine...", - "I feel great evil lurking below..." - },{ - "The dwarves were industrious, but greedy...", - "I hope the surface never ends up like this place...", - "So the dwarvern metropolis really has fallen..." - },{ - "What is this place?...", - "So the stories are true, we have to fight a demon god...", - "I feel a great evil in this place..." - },{ - "... I don't like this place... We should leave as soon as possible..." - } - }; - - //1st index - depth type, 2nd index - boss or not, 3rd index - specific line. - public static final String[][][] VOICE_ENEMIES = { - { - { - "Let's make the sewers safe again...", - "If the guards couldn't defeat them, perhaps we can...", - "These crabs are extremely annoying..." - },{ - "Beware Goo!...", - "Many of my friends died to this thing, time for vengeance...", - "Such an abomination cannot be allowed to live..." - } - },{ - { - "What dark magic happened here?...", - "To think the captives of this place are now its guardians...", - "They were criminals before, now they are monsters..." - },{ - "If only he would see reason, he doesn't seem insane...", - "He assumes we are hostile, if only he would stop to talk...", - "The one prisoner left sane is a deadly assassin. Of course..." - } - },{ - { - "The creatures here are twisted, just like the sewers... ", - "more gnolls, I hate gnolls...", - "Even the bats are bloodthirsty here..." - },{ - "Only dwarves would build a mining machine that kills looters...", - "That thing is huge...", - "How has it survived here for so long?..." - } - },{ - { - "Dwarves aren't supposed to look that pale...", - "I don't know what's worse, the dwarves, or their creations...", - "They all obey their master without question, even now..." - },{ - "When people say power corrupts, this is what they mean...", - "He's more a Lich than a King now...", - "Looks like he's more demon than dwarf now..." - } - },{ - { - "What the heck is that thing?...", - "This place is terrifying...", - "What were the dwarves thinking, toying with power like this?..." - },{ - "Oh.... this doesn't look good...", - "So that's what a god looks like?...", - "This is going to hurt..." - } - },{ - { - "I don't like this place... we should leave as soon as we can..." - },{ - "Hello source viewer, I'm writing this here as this line should never trigger. Have a nice day!" - } - } - }; - - //1st index - Yog or not, 2nd index - specific line. - public static final String[][] VOICE_BOSSBEATEN = { - { - "Yes!", - "Victory!" - },{ - "It's over... we won...", - "I can't believe it... We just killed a god..." - } - }; - - //1st index - boss or not, 2nd index - specific line. - public static final String[][] VOICE_DEFEATED = { - { - "Good luck...", - "I will return...", - "Tired... for now..." - },{ - "No... I can't....", - "I'm sorry.. good luck..", - "Finish it off... without me..." - } - }; - - public static final String[] VOICE_HEROKILLED = { - "nooo...", - "no...", - "I couldn't help them..." - }; - - public static final String[] VOICE_BLESSEDANKH = { - "Incredible!...", - "Wish I had one of those...", - "How did you survive that?..." - }; - } + { + name = "Dried Rose"; + image = ItemSpriteSheet.ARTIFACT_ROSE1; + + level = 0; + levelCap = 10; + + charge = 100; + chargeCap = 100; + + defaultAction = AC_SUMMON; + } + + protected static boolean talkedTo = false; + protected static boolean firstSummon = false; + protected static boolean spawned = false; + + public int droppedPetals = 0; + + public static final String AC_SUMMON = "SUMMON"; + + public DriedRose(){ + super(); + talkedTo = firstSummon = spawned = false; + } + + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge == chargeCap && !cursed) + actions.add(AC_SUMMON); + return actions; + } + + @Override + public void execute( Hero hero, String action ) { + if (action.equals(AC_SUMMON)) { + + if (spawned) GLog.n("sad ghost: \"I'm already here\""); + else if (!isEquipped( hero )) GLog.i("You need to equip your rose to do that."); + else if (charge != chargeCap) GLog.i("Your rose isn't fully charged yet."); + else if (cursed) GLog.i("You cannot use a cursed rose."); + else { + ArrayList spawnPoints = new ArrayList(); + for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { + int p = hero.pos + Level.NEIGHBOURS8[i]; + if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) { + spawnPoints.add(p); + } + } + + if (spawnPoints.size() > 0) { + GhostHero ghost = new GhostHero( level ); + ghost.pos = Random.element(spawnPoints); + + GameScene.add(ghost, 1f); + CellEmitter.get(ghost.pos).start( ShaftParticle.FACTORY, 0.3f, 4 ); + CellEmitter.get(ghost.pos).start( Speck.factory(Speck.LIGHT), 0.2f, 3 ); + + hero.spend(1f); + hero.busy(); + hero.sprite.operate(hero.pos); + + if (!firstSummon) { + ghost.yell(ghost.VOICE_HELLO + Dungeon.hero.givenName()); + Sample.INSTANCE.play( Assets.SND_GHOST ); + firstSummon = true; + } else + ghost.saySpawned(); + + spawned = true; + charge = 0; + updateQuickslot(); + + } else + GLog.i("There is no free space near you."); + } + + } else{ + super.execute(hero, action); + } + } + + @Override + public String desc() { + String desc = + "Is this the rose that the ghost mentioned before disappearing? It seems to hold some spiritual power,"+ + " perhaps it can be used to channel the energy of that lost warrior."; + + if (isEquipped( Dungeon.hero )){ + if (!cursed){ + desc += "\n\nThe rose rests in your hand, it feels strangely warm."; + + if (level < 5) + desc+= "\n\nThe rose has lost most of its petals. It feels extremely frail, like it " + + "could snap any moment."; + else if (level < 10) + desc+= "\n\nYou have reattached many petals and the rose has started to somehow come back to life."+ + " It almost looks like it's ready to bloom."; + else + desc+= "\n\nThe rose has blossomed again through some kind of magic, its connection to your spirit"+ + " friend is stronger than ever."; + } else + desc += "\n\nThe cursed rose is bound to you hand, it feels eerily cold."; + } + + return desc; + } + + @Override + protected ArtifactBuff passiveBuff() { + return new roseRecharge(); + } + + @Override + public Item upgrade() { + if (level >= 9) + image = ItemSpriteSheet.ARTIFACT_ROSE3; + else if (level >= 4) + image = ItemSpriteSheet.ARTIFACT_ROSE2; + + //For upgrade transferring via well of transmutation + droppedPetals = Math.max( level, droppedPetals ); + + return super.upgrade(); + } + + private static final String TALKEDTO = "talkedto"; + private static final String FIRSTSUMMON = "firstsummon"; + private static final String SPAWNED = "spawned"; + private static final String PETALS = "petals"; + + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + + bundle.put( TALKEDTO, talkedTo ); + bundle.put( FIRSTSUMMON, firstSummon ); + bundle.put( SPAWNED, spawned ); + bundle.put( PETALS, droppedPetals ); + } + + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + + talkedTo = bundle.getBoolean( TALKEDTO ); + firstSummon = bundle.getBoolean( FIRSTSUMMON ); + spawned = bundle.getBoolean( SPAWNED ); + droppedPetals = bundle.getInt( PETALS ); + } + + public class roseRecharge extends ArtifactBuff { + + @Override + public boolean act() { + + if (charge < chargeCap && !cursed) { + //TODO: investigate balancing on this. + partialCharge += 10/75f; + if (partialCharge > 1){ + charge++; + partialCharge--; + if (charge == chargeCap){ + partialCharge = 0f; + GLog.p("Your rose is fully charged!"); + } + } + } else if (cursed && Random.Int(100) == 0) { + + ArrayList spawnPoints = new ArrayList(); + + for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { + int p = target.pos + Level.NEIGHBOURS8[i]; + if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) { + spawnPoints.add(p); + } + } + + if (spawnPoints.size() > 0) { + Wraith.spawnAt(Random.element(spawnPoints)); + Sample.INSTANCE.play(Assets.SND_CURSED); + } + + } + + updateQuickslot(); + + spend( TICK ); + + return true; + } + } + + public static class Petal extends Item { + + { + name = "dried petal"; + stackable = true; + image = ItemSpriteSheet.PETAL; + } + + @Override + public boolean doPickUp( Hero hero ) { + DriedRose rose = hero.belongings.getItem( DriedRose.class ); + + if (rose == null){ + GLog.w("You have no rose to add this petal to."); + return false; + } if ( rose.level >= rose.levelCap ){ + GLog.i("There is no room left for this petal, so you discard it."); + return true; + } else { + + rose.upgrade(); + if (rose.level == rose.levelCap) { + GLog.p("The rose is completed!"); + Sample.INSTANCE.play( Assets.SND_GHOST ); + GLog.n("sad ghost: \"Thank you...\""); + } else + GLog.i("You add the petal to the rose."); + + Sample.INSTANCE.play( Assets.SND_DEWDROP ); + hero.spendAndNext(TIME_TO_PICK_UP); + return true; + + } + } + + @Override + public String info() { + return "A frail dried up petal, which has somehow survived this far into the dungeon."; + } + + } + + public static class GhostHero extends NPC { + + { + name = "sad ghost"; + spriteClass = GhostSprite.class; + + flying = true; + + state = WANDERING; + enemy = null; + + ally = true; + } + + public GhostHero() { + super(); + + //double heroes defence skill + defenseSkill = (Dungeon.hero.lvl+4)*2; + } + + public GhostHero(int roseLevel){ + this(); + HP = HT = 10+roseLevel*3; + } + + public void saySpawned(){ + int i = (Dungeon.depth - 1) / 5; + if (chooseEnemy() == null) + yell( Random.element( VOICE_AMBIENT[i] ) ); + else + yell( Random.element( VOICE_ENEMIES[i][ Dungeon.bossLevel() ? 1 : 0 ] ) ); + Sample.INSTANCE.play( Assets.SND_GHOST ); + } + + public void sayAnhk(){ + yell( Random.element( VOICE_BLESSEDANKH ) ); + Sample.INSTANCE.play( Assets.SND_GHOST ); + } + + public void sayDefeated(){ + yell( Random.element( VOICE_DEFEATED[ Dungeon.bossLevel() ? 1 : 0 ] ) ); + Sample.INSTANCE.play( Assets.SND_GHOST ); + } + + public void sayHeroKilled(){ + yell(Random.element(VOICE_HEROKILLED)); + Sample.INSTANCE.play( Assets.SND_GHOST ); + } + + public void sayBossBeaten(){ + yell( Random.element( VOICE_BOSSBEATEN[ Dungeon.depth==25 ? 1 : 0 ] ) ); + Sample.INSTANCE.play( Assets.SND_GHOST ); + } + + @Override + public String defenseVerb() { + return "evaded"; + } + + @Override + protected boolean act() { + if (Random.Int(10) == 0) damage(1 , this); + if (!isAlive()) + return true; + if (!Dungeon.hero.isAlive()){ + sayHeroKilled(); + sprite.die(); + destroy(); + return true; + } + return super.act(); + } + + @Override + protected boolean getCloser( int target ) { + if (state == WANDERING || Level.distance(target, Dungeon.hero.pos) > 6) + this.target = target = Dungeon.hero.pos; + return super.getCloser( target ); + } + + @Override + protected Char chooseEnemy() { + if (enemy == null || !enemy.isAlive() || state == WANDERING) { + + HashSet enemies = new HashSet(); + for (Mob mob : Dungeon.level.mobs) { + if (mob.hostile && Level.fieldOfView[mob.pos] && mob.state != mob.PASSIVE) { + enemies.add(mob); + } + } + enemy = enemies.size() > 0 ? Random.element( enemies ) : null; + } + return enemy; + } + + @Override + public int attackSkill(Char target) { + //same accuracy as the hero. + return (defenseSkill/2)+5; + } + + @Override + public int damageRoll() { + //equivalent to N/2 to 5+N, where N is rose level. + int lvl = (HT-10)/3; + return Random.NormalIntRange( lvl/2, 5+lvl); + } + + @Override + public int dr() { + //defence is equal to the level of rose. + return (HT-10)/3; + } + + @Override + public void add( Buff buff ) { + //in other words, can't be directly affected by buffs/debuffs. + } + + @Override + public void interact() { + if (!DriedRose.talkedTo){ + DriedRose.talkedTo = true; + GameScene.show(new WndQuest(this, VOICE_INTRODUCE )); + } else { + int curPos = pos; + + moveSprite( pos, Dungeon.hero.pos ); + move( Dungeon.hero.pos ); + + Dungeon.hero.sprite.move( Dungeon.hero.pos, curPos ); + Dungeon.hero.move( curPos ); + + Dungeon.hero.spend( 1 / Dungeon.hero.speed() ); + Dungeon.hero.busy(); + } + } + + @Override + public void die(Object cause) { + sayDefeated(); + super.die(cause); + } + + @Override + public void destroy() { + DriedRose.spawned = false; + super.destroy(); + } + + @Override + public String description() { + return + "A frail looking ethereal figure with a humanoid shape. Its power seems tied to the rose I have." + + "\n\nThis ghost may not be much, but it seems to be my only true friend down here."; + } + + private static final HashSet> IMMUNITIES = new HashSet>(); + static { + IMMUNITIES.add( ToxicGas.class ); + IMMUNITIES.add( ScrollOfPsionicBlast.class ); + } + + @Override + public HashSet> immunities() { + return IMMUNITIES; + } + + //************************************************************************************ + //This is a bunch strings & string arrays, used in all of the sad ghost's voice lines. + //************************************************************************************ + + public static final String VOICE_HELLO = "Hello again "; + + private static final String VOICE_INTRODUCE = "My spirit is bound to this rose, it was very precious to me, a "+ + "gift from my love whom I left on the surface.\n\nI cannot return to him, but thanks to you I have a " + + "second chance to complete my journey. When I am able I will respond to your call and fight with you.\n\n" + + "hopefully you may succeed where I failed..."; + + //1st index - depth type, 2nd index - specific line. + public static final String[][] VOICE_AMBIENT = { + { + "These sewers were once safe, some even lived here in the winter...", + "I wonder what happened to the guard patrols, did they give up?...", + "I had family on the surface, I hope they are safe..." + },{ + "I've heard stories about this place, nothing good...", + "This place was always more of a dungeon than a prison...", + "I can't imagine what went on when this place was abandoned..." + },{ + "No human or dwarf has been here for a very long time...", + "Something must have gone very wrong, for the dwarves to abandon a gold mine...", + "I feel great evil lurking below..." + },{ + "The dwarves were industrious, but greedy...", + "I hope the surface never ends up like this place...", + "So the dwarvern metropolis really has fallen..." + },{ + "What is this place?...", + "So the stories are true, we have to fight a demon god...", + "I feel a great evil in this place..." + },{ + "... I don't like this place... We should leave as soon as possible..." + } + }; + + //1st index - depth type, 2nd index - boss or not, 3rd index - specific line. + public static final String[][][] VOICE_ENEMIES = { + { + { + "Let's make the sewers safe again...", + "If the guards couldn't defeat them, perhaps we can...", + "These crabs are extremely annoying..." + },{ + "Beware Goo!...", + "Many of my friends died to this thing, time for vengeance...", + "Such an abomination cannot be allowed to live..." + } + },{ + { + "What dark magic happened here?...", + "To think the captives of this place are now its guardians...", + "They were criminals before, now they are monsters..." + },{ + "If only he would see reason, he doesn't seem insane...", + "He assumes we are hostile, if only he would stop to talk...", + "The one prisoner left sane is a deadly assassin. Of course..." + } + },{ + { + "The creatures here are twisted, just like the sewers... ", + "more gnolls, I hate gnolls...", + "Even the bats are bloodthirsty here..." + },{ + "Only dwarves would build a mining machine that kills looters...", + "That thing is huge...", + "How has it survived here for so long?..." + } + },{ + { + "Dwarves aren't supposed to look that pale...", + "I don't know what's worse, the dwarves, or their creations...", + "They all obey their master without question, even now..." + },{ + "When people say power corrupts, this is what they mean...", + "He's more a Lich than a King now...", + "Looks like he's more demon than dwarf now..." + } + },{ + { + "What the heck is that thing?...", + "This place is terrifying...", + "What were the dwarves thinking, toying with power like this?..." + },{ + "Oh.... this doesn't look good...", + "So that's what a god looks like?...", + "This is going to hurt..." + } + },{ + { + "I don't like this place... we should leave as soon as we can..." + },{ + "Hello source viewer, I'm writing this here as this line should never trigger. Have a nice day!" + } + } + }; + + //1st index - Yog or not, 2nd index - specific line. + public static final String[][] VOICE_BOSSBEATEN = { + { + "Yes!", + "Victory!" + },{ + "It's over... we won...", + "I can't believe it... We just killed a god..." + } + }; + + //1st index - boss or not, 2nd index - specific line. + public static final String[][] VOICE_DEFEATED = { + { + "Good luck...", + "I will return...", + "Tired... for now..." + },{ + "No... I can't....", + "I'm sorry.. good luck..", + "Finish it off... without me..." + } + }; + + public static final String[] VOICE_HEROKILLED = { + "nooo...", + "no...", + "I couldn't help them..." + }; + + public static final String[] VOICE_BLESSEDANKH = { + "Incredible!...", + "Wish I had one of those...", + "How did you survive that?..." + }; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index ed44f0287..df9818180 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -20,9 +20,6 @@ import com.watabou.utils.Random; import java.util.ArrayList; -/** - * Created by Evan on 23/05/2015. - */ public class EtherealChains extends Artifact { public static final String AC_CAST = "CAST"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index 6bf35527a..d21b328d2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -21,200 +21,197 @@ import com.watabou.noosa.audio.Sample; import java.util.ArrayList; -/** - * Created by debenhame on 26/08/2014. - */ public class HornOfPlenty extends Artifact { - { - name = "Horn of Plenty"; - image = ItemSpriteSheet.ARTIFACT_HORN1; + { + name = "Horn of Plenty"; + image = ItemSpriteSheet.ARTIFACT_HORN1; - level = 0; - levelCap = 30; + level = 0; + levelCap = 30; - charge = 0; - partialCharge = 0; - chargeCap = 10; + charge = 0; + partialCharge = 0; + chargeCap = 10; - defaultAction = AC_EAT; - } + defaultAction = AC_EAT; + } - private static final float TIME_TO_EAT = 3f; + private static final float TIME_TO_EAT = 3f; - private float energy = 36f; + private float energy = 36f; - public static final String AC_EAT = "EAT"; - public static final String AC_STORE = "STORE"; + public static final String AC_EAT = "EAT"; + public static final String AC_STORE = "STORE"; - protected String inventoryTitle = "Select a piece of food"; - protected WndBag.Mode mode = WndBag.Mode.FOOD; + protected String inventoryTitle = "Select a piece of food"; + protected WndBag.Mode mode = WndBag.Mode.FOOD; - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge > 0) - actions.add(AC_EAT); - if (isEquipped( hero ) && level < 30 && !cursed) - actions.add(AC_STORE); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge > 0) + actions.add(AC_EAT); + if (isEquipped( hero ) && level < 30 && !cursed) + actions.add(AC_STORE); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - super.execute(hero, action); + @Override + public void execute( Hero hero, String action ) { + super.execute(hero, action); - if (action.equals(AC_EAT)){ + if (action.equals(AC_EAT)){ - if (!isEquipped(hero)) GLog.i("You need to equip your horn to do that."); - else if (charge == 0) GLog.i("Your horn has no food in it to eat!"); - else { - ((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge); + if (!isEquipped(hero)) GLog.i("You need to equip your horn to do that."); + else if (charge == 0) GLog.i("Your horn has no food in it to eat!"); + else { + ((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge); - //if you get at least 100 food energy from the horn - if (charge >= 3) { - switch (hero.heroClass) { - case WARRIOR: - if (hero.HP < hero.HT) { - hero.HP = Math.min(hero.HP + 5, hero.HT); - hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); - } - break; - case MAGE: - //1 charge - Buff.affect( hero, ScrollOfRecharging.Recharging.class, 4f ); - ScrollOfRecharging.charge(hero); - break; - case ROGUE: - case HUNTRESS: - break; - } + //if you get at least 100 food energy from the horn + if (charge >= 3) { + switch (hero.heroClass) { + case WARRIOR: + if (hero.HP < hero.HT) { + hero.HP = Math.min(hero.HP + 5, hero.HT); + hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); + } + break; + case MAGE: + //1 charge + Buff.affect( hero, ScrollOfRecharging.Recharging.class, 4f ); + ScrollOfRecharging.charge(hero); + break; + case ROGUE: + case HUNTRESS: + break; + } - Statistics.foodEaten++; - } - charge = 0; + Statistics.foodEaten++; + } + charge = 0; - hero.sprite.operate(hero.pos); - hero.busy(); - SpellSprite.show(hero, SpellSprite.FOOD); - Sample.INSTANCE.play(Assets.SND_EAT); - GLog.i("You eat from the horn."); + hero.sprite.operate(hero.pos); + hero.busy(); + SpellSprite.show(hero, SpellSprite.FOOD); + Sample.INSTANCE.play(Assets.SND_EAT); + GLog.i("You eat from the horn."); - hero.spend(TIME_TO_EAT); + hero.spend(TIME_TO_EAT); - Badges.validateFoodEaten(); + Badges.validateFoodEaten(); - image = ItemSpriteSheet.ARTIFACT_HORN1; + image = ItemSpriteSheet.ARTIFACT_HORN1; - updateQuickslot(); - } + updateQuickslot(); + } - } else if (action.equals(AC_STORE)){ + } else if (action.equals(AC_STORE)){ - GameScene.selectItem(itemSelector, mode, inventoryTitle); - } - } + GameScene.selectItem(itemSelector, mode, inventoryTitle); + } + } - @Override - protected ArtifactBuff passiveBuff() { - return new hornRecharge(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new hornRecharge(); + } - @Override - public String desc() { - String desc = "This horn can't be blown into, but instead seems to fill up with food over time.\n\n"; + @Override + public String desc() { + String desc = "This horn can't be blown into, but instead seems to fill up with food over time.\n\n"; - if (charge == 0) - desc += "The horn is completely empty."; - else if (charge < 3) - desc += "The horn is almost empty, a few small fruits and berries sit in the back."; - else if (charge < 7) - desc += "The horn is partially filled, you can see several fruits & vegetables inside."; - else if (charge < 10) - desc += "The horn is getting quite full, several pieces of fresh produce are poking up towards the front."; - else - desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim."; + if (charge == 0) + desc += "The horn is completely empty."; + else if (charge < 3) + desc += "The horn is almost empty, a few small fruits and berries sit in the back."; + else if (charge < 7) + desc += "The horn is partially filled, you can see several fruits & vegetables inside."; + else if (charge < 10) + desc += "The horn is getting quite full, several pieces of fresh produce are poking up towards the front."; + else + desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim."; - if ( isEquipped( Dungeon.hero ) ){ - if (!cursed) { - desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it."; + if ( isEquipped( Dungeon.hero ) ){ + if (!cursed) { + desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it."; - if (level < 15) - desc += " Perhaps there is a way to increase the horn's power by giving it food energy."; - } else { - desc += "\n\nThe cursed horn has bound itself to your side, " + - "it seems to be eager to take food rather than produce it."; - } - } + if (level < 15) + desc += " Perhaps there is a way to increase the horn's power by giving it food energy."; + } else { + desc += "\n\nThe cursed horn has bound itself to your side, " + + "it seems to be eager to take food rather than produce it."; + } + } - return desc; - } + return desc; + } - public class hornRecharge extends ArtifactBuff{ + public class hornRecharge extends ArtifactBuff{ - @Override - public boolean act() { - if (charge < chargeCap && !cursed) { + @Override + public boolean act() { + if (charge < chargeCap && !cursed) { - //generates 0.25 food value every round, +0.015 value per level - //to a max of 0.70 food value per round (0.25+0.5, at level 30) - partialCharge += 0.25f + (0.015f*level); + //generates 0.25 food value every round, +0.015 value per level + //to a max of 0.70 food value per round (0.25+0.5, at level 30) + partialCharge += 0.25f + (0.015f*level); - //charge is in increments of 36 food value. - if (partialCharge >= 36) { - charge++; - partialCharge -= 36; + //charge is in increments of 36 food value. + if (partialCharge >= 36) { + charge++; + partialCharge -= 36; - if (charge == chargeCap) - image = ItemSpriteSheet.ARTIFACT_HORN4; - else if (charge >= 7) - image = ItemSpriteSheet.ARTIFACT_HORN3; - else if (charge >= 3) - image = ItemSpriteSheet.ARTIFACT_HORN2; - else - image = ItemSpriteSheet.ARTIFACT_HORN1; + if (charge == chargeCap) + image = ItemSpriteSheet.ARTIFACT_HORN4; + else if (charge >= 7) + image = ItemSpriteSheet.ARTIFACT_HORN3; + else if (charge >= 3) + image = ItemSpriteSheet.ARTIFACT_HORN2; + else + image = ItemSpriteSheet.ARTIFACT_HORN1; - if (charge == chargeCap){ - GLog.p("Your horn is full of food!"); - partialCharge = 0; - } + if (charge == chargeCap){ + GLog.p("Your horn is full of food!"); + partialCharge = 0; + } - updateQuickslot(); - } - } else - partialCharge = 0; + updateQuickslot(); + } + } else + partialCharge = 0; - spend( TICK ); + spend( TICK ); - return true; - } + return true; + } - } + } - protected static WndBag.Listener itemSelector = new WndBag.Listener() { - @Override - public void onSelect( Item item ) { - if (item != null && item instanceof Food) { - if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){ - GLog.w("your horn rejects the unprepared blandfruit."); - } else { - Hero hero = Dungeon.hero; - hero.sprite.operate( hero.pos ); - hero.busy(); - hero.spend( TIME_TO_EAT ); + protected static WndBag.Listener itemSelector = new WndBag.Listener() { + @Override + public void onSelect( Item item ) { + if (item != null && item instanceof Food) { + if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){ + GLog.w("your horn rejects the unprepared blandfruit."); + } else { + Hero hero = Dungeon.hero; + hero.sprite.operate( hero.pos ); + hero.busy(); + hero.spend( TIME_TO_EAT ); - curItem.upgrade(((Food)item).hornValue); - if (curItem.level >= 30){ - curItem.level = 30; - GLog.p("your horn has consumed all the food it can!"); - } else - GLog.p("the horn consumes your food offering and grows in strength!"); - item.detach(hero.belongings.backpack); - } + curItem.upgrade(((Food)item).hornValue); + if (curItem.level >= 30){ + curItem.level = 30; + GLog.p("your horn has consumed all the food it can!"); + } else + GLog.p("the horn consumes your food offering and grows in strength!"); + item.detach(hero.belongings.backpack); + } - } - } - }; + } + } + }; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index eb9fd0c95..45bab5c3a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -47,13 +47,13 @@ import java.util.ArrayList; public class LloydsBeacon extends Artifact { - private static final String TXT_PREVENTING = + private static final String TXT_PREVENTING = "Strong magic aura of this place prevents you from using the lloyd's beacon!"; - private static final String TXT_CREATURES = + private static final String TXT_CREATURES = "Psychic aura of neighbouring creatures doesn't allow you to use the lloyd's beacon at this moment."; - private static final String TXT_RETURN = + private static final String TXT_RETURN = "The lloyd's beacon is successfully set at your current location, now you can return here anytime."; private static final String TXT_INFO = @@ -62,7 +62,7 @@ public class LloydsBeacon extends Artifact { "The beacon can be used to return to a set location, but can also expel bursts of random teleportation " + "magic once it has charged from being equipped. This magic can be directed at a target or at the user themselves."; - private static final String TXT_SET = + private static final String TXT_SET = "\n\nThis beacon was set somewhere on the level %d of Pixel Dungeon."; public static final float TIME_TO_USE = 1; @@ -171,8 +171,8 @@ public class LloydsBeacon extends Artifact { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); - for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) - if (mob instanceof DriedRose.GhostHero) mob.destroy(); + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = returnDepth; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java index 823c3505f..f6820903b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java @@ -4,81 +4,78 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; -/** - * Created by debenhame on 03/09/2014. - */ public class MasterThievesArmband extends Artifact { - { - name = "Master Thieves' Armband"; - image = ItemSpriteSheet.ARTIFACT_ARMBAND; + { + name = "Master Thieves' Armband"; + image = ItemSpriteSheet.ARTIFACT_ARMBAND; - level = 0; - levelCap = 10; + level = 0; + levelCap = 10; - charge = 0; - } + charge = 0; + } - private int exp = 0; + private int exp = 0; - @Override - protected ArtifactBuff passiveBuff() { - return new Thievery(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new Thievery(); + } - @Override - public String desc() { - String desc = "This purple velvet armband bears the mark of a master thief. This doesn't belong to you, but " + - "you doubt it belonged to the person you took it from either."; + @Override + public String desc() { + String desc = "This purple velvet armband bears the mark of a master thief. This doesn't belong to you, but " + + "you doubt it belonged to the person you took it from either."; - if ( isEquipped (Dungeon.hero) ) - desc += "\n\nWith the armband around your wrist you feel more dexterous and cunning. Every piece of gold " + - "you find makes you desire others property more. " + - "You wonder if Pixel Mart accepts the five finger discount..."; + if ( isEquipped (Dungeon.hero) ) + desc += "\n\nWith the armband around your wrist you feel more dexterous and cunning. Every piece of gold " + + "you find makes you desire others property more. " + + "You wonder if Pixel Mart accepts the five finger discount..."; - return desc; - } + return desc; + } - public class Thievery extends ArtifactBuff{ - public void collect(int gold){ - charge += gold/2; - } + public class Thievery extends ArtifactBuff{ + public void collect(int gold){ + charge += gold/2; + } - @Override - public void detach() { - charge *= 0.95; - super.detach(); - } + @Override + public void detach() { + charge *= 0.95; + super.detach(); + } - public boolean steal(int value){ - if (value <= charge){ - charge -= value; - exp += value; - } else { - float chance = stealChance(value); - if (Random.Float() > chance) - return false; - else { - if (chance <= 1) - charge = 0; - else - //removes the charge it took you to reach 100% - charge -= charge/chance; - exp += value; - } - } - while(exp >= 600 && level < levelCap) { - exp -= 600; - upgrade(); - } - return true; - } + public boolean steal(int value){ + if (value <= charge){ + charge -= value; + exp += value; + } else { + float chance = stealChance(value); + if (Random.Float() > chance) + return false; + else { + if (chance <= 1) + charge = 0; + else + //removes the charge it took you to reach 100% + charge -= charge/chance; + exp += value; + } + } + while(exp >= 600 && level < levelCap) { + exp -= 600; + upgrade(); + } + return true; + } - public float stealChance(int value){ - //get lvl*100 gold or lvl*5% item value of free charge, whichever is less. - int chargeBonus = Math.min(level*100, (value*level)/20); + public float stealChance(int value){ + //get lvl*100 gold or lvl*5% item value of free charge, whichever is less. + int chargeBonus = Math.min(level*100, (value*level)/20); - return (((float)charge + chargeBonus)/value); - } - } + return (((float)charge + chargeBonus)/value); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java index 7ecdbd079..ad2bd0991 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java @@ -21,196 +21,193 @@ import com.watabou.utils.Bundle; import java.util.ArrayList; import java.util.Collections; -/** - * Created by debenhame on 08/09/2014. - */ public class SandalsOfNature extends Artifact { - { - name = "Sandals of Nature"; - image = ItemSpriteSheet.ARTIFACT_SANDALS; + { + name = "Sandals of Nature"; + image = ItemSpriteSheet.ARTIFACT_SANDALS; - level = 0; - levelCap = 3; + level = 0; + levelCap = 3; - charge = 0; + charge = 0; - defaultAction = AC_ROOT; - } + defaultAction = AC_ROOT; + } - public static final String[] NAMES = {"Sandals of Nature", "Shoes of Nature", - "Boots of Nature", "Greaves of Nature"}; + public static final String[] NAMES = {"Sandals of Nature", "Shoes of Nature", + "Boots of Nature", "Greaves of Nature"}; - public static final String AC_FEED = "FEED"; - public static final String AC_ROOT = "ROOT"; + public static final String AC_FEED = "FEED"; + public static final String AC_ROOT = "ROOT"; - protected String inventoryTitle = "Select a seed"; - protected WndBag.Mode mode = WndBag.Mode.SEED; + protected String inventoryTitle = "Select a seed"; + protected WndBag.Mode mode = WndBag.Mode.SEED; - public ArrayList seeds = new ArrayList(); + public ArrayList seeds = new ArrayList(); - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < 3 && !cursed) - actions.add(AC_FEED); - if (isEquipped( hero ) && charge > 0) - actions.add(AC_ROOT); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && level < 3 && !cursed) + actions.add(AC_FEED); + if (isEquipped( hero ) && charge > 0) + actions.add(AC_ROOT); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - super.execute(hero, action); - if (action.equals(AC_FEED)){ - GameScene.selectItem(itemSelector, mode, inventoryTitle); - } else if (action.equals(AC_ROOT) && level > 0){ + @Override + public void execute( Hero hero, String action ) { + super.execute(hero, action); + if (action.equals(AC_FEED)){ + GameScene.selectItem(itemSelector, mode, inventoryTitle); + } else if (action.equals(AC_ROOT) && level > 0){ - if (!isEquipped( hero )) GLog.i("You need to equip them to do that."); - else if (charge == 0) GLog.i("They have no energy right now."); - else { - Buff.prolong(hero, Roots.class, 5); - Buff.affect(hero, Earthroot.Armor.class).level(charge); - CellEmitter.bottom(hero.pos).start(EarthParticle.FACTORY, 0.05f, 8); - Camera.main.shake(1, 0.4f); - charge = 0; - updateQuickslot(); - } - } - } + if (!isEquipped( hero )) GLog.i("You need to equip them to do that."); + else if (charge == 0) GLog.i("They have no energy right now."); + else { + Buff.prolong(hero, Roots.class, 5); + Buff.affect(hero, Earthroot.Armor.class).level(charge); + CellEmitter.bottom(hero.pos).start(EarthParticle.FACTORY, 0.05f, 8); + Camera.main.shake(1, 0.4f); + charge = 0; + updateQuickslot(); + } + } + } - @Override - protected ArtifactBuff passiveBuff() { - return new Naturalism(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new Naturalism(); + } - @Override - public String desc() { - String desc = ""; - if (level == 0) - desc += "What initially seem like sandals made of twine are actually two plants! The footwear moves ever " + - "so slightly when being held. They seem very weak and pale, perhaps they need to be given nutrients?"; - else if (level == 1) - desc += "The footwear has grown and now more closely resemble two tailored shoes. They seem to match the " + - "contours of your feet exactly. Some colour has returned to them, perhaps they can still grow further?"; - else if (level == 2) - desc += "The plants have grown again and now resembles a pair of solid tall boots. They appear to be made" + - " of solid bark more than vine now, yet are still very flexible. The plants seem to have " + - "regained their strength, but perhaps they can still grow further"; - else - desc += "Now almost tall enough to make full pants, the bark-mesh artifact seems to have reached its " + - "maximum size. Perhaps the two plants don't want to merge together? The greaves are a deep brown " + - "and resemble a very sturdy tree."; + @Override + public String desc() { + String desc = ""; + if (level == 0) + desc += "What initially seem like sandals made of twine are actually two plants! The footwear moves ever " + + "so slightly when being held. They seem very weak and pale, perhaps they need to be given nutrients?"; + else if (level == 1) + desc += "The footwear has grown and now more closely resemble two tailored shoes. They seem to match the " + + "contours of your feet exactly. Some colour has returned to them, perhaps they can still grow further?"; + else if (level == 2) + desc += "The plants have grown again and now resembles a pair of solid tall boots. They appear to be made" + + " of solid bark more than vine now, yet are still very flexible. The plants seem to have " + + "regained their strength, but perhaps they can still grow further"; + else + desc += "Now almost tall enough to make full pants, the bark-mesh artifact seems to have reached its " + + "maximum size. Perhaps the two plants don't want to merge together? The greaves are a deep brown " + + "and resemble a very sturdy tree."; - if ( isEquipped ( Dungeon.hero ) ){ - desc += "\n\n"; - if (level == 0) { - if (!cursed) - desc += "The sandals wrap snugly around your feet, they seem happy to be worn."; - else - desc += "The cursed sandals wrap tightly around your feet."; - } - else if (level == 1) - desc += "The shoes fit on loosely but quickly tighten to make a perfect fit."; - else if (level == 2) - desc += "The boots fit snugly and add a nice heft to your step."; - else - desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you."; + if ( isEquipped ( Dungeon.hero ) ){ + desc += "\n\n"; + if (level == 0) { + if (!cursed) + desc += "The sandals wrap snugly around your feet, they seem happy to be worn."; + else + desc += "The cursed sandals wrap tightly around your feet."; + } + else if (level == 1) + desc += "The shoes fit on loosely but quickly tighten to make a perfect fit."; + else if (level == 2) + desc += "The boots fit snugly and add a nice heft to your step."; + else + desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you."; - if (!cursed) - desc += " You feel more attuned with nature while wearing them."; - else - desc += " They are blocking any attunement with nature."; + if (!cursed) + desc += " You feel more attuned with nature while wearing them."; + else + desc += " They are blocking any attunement with nature."; - if (level > 0) - desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " + - "but will need to charge up for it."; - } + if (level > 0) + desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " + + "but will need to charge up for it."; + } - if (!seeds.isEmpty()){ - desc += "\n\nRecently Fed Seeds:"; - String[] seedsArray = seeds.toArray(new String[seeds.size()]); + if (!seeds.isEmpty()){ + desc += "\n\nRecently Fed Seeds:"; + String[] seedsArray = seeds.toArray(new String[seeds.size()]); - for (int i = 0; i < seedsArray.length-1; i++) - desc += " " + seedsArray[i].substring(8) + ","; + for (int i = 0; i < seedsArray.length-1; i++) + desc += " " + seedsArray[i].substring(8) + ","; - desc += " " + seedsArray[seedsArray.length-1].substring(8) + "."; - } + desc += " " + seedsArray[seedsArray.length-1].substring(8) + "."; + } - return desc; - } + return desc; + } - @Override - public Item upgrade() { - if (level < 0) - image = ItemSpriteSheet.ARTIFACT_SANDALS; - else if (level == 0) - image = ItemSpriteSheet.ARTIFACT_SHOES; - else if (level == 1) - image = ItemSpriteSheet.ARTIFACT_BOOTS; - else if (level >= 2) - image = ItemSpriteSheet.ARTIFACT_GREAVES; - name = NAMES[level+1]; - return super.upgrade(); - } + @Override + public Item upgrade() { + if (level < 0) + image = ItemSpriteSheet.ARTIFACT_SANDALS; + else if (level == 0) + image = ItemSpriteSheet.ARTIFACT_SHOES; + else if (level == 1) + image = ItemSpriteSheet.ARTIFACT_BOOTS; + else if (level >= 2) + image = ItemSpriteSheet.ARTIFACT_GREAVES; + name = NAMES[level+1]; + return super.upgrade(); + } - private static final String SEEDS = "seeds"; - private static final String NAME = "name"; + private static final String SEEDS = "seeds"; + private static final String NAME = "name"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put(NAME, name); - bundle.put(SEEDS, seeds.toArray(new String[seeds.size()])); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put(NAME, name); + bundle.put(SEEDS, seeds.toArray(new String[seeds.size()])); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - name = bundle.getString( NAME ); - if (bundle.contains(SEEDS)) - Collections.addAll(seeds , bundle.getStringArray(SEEDS)); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + name = bundle.getString( NAME ); + if (bundle.contains(SEEDS)) + Collections.addAll(seeds , bundle.getStringArray(SEEDS)); + } - public class Naturalism extends ArtifactBuff{ - public void charge() { - if (charge < target.HT){ - //gain 1+(1*level)% of the difference between current charge and max HP. - charge+= (Math.round( (target.HT-charge) * (.01+ level*0.01) )); - updateQuickslot(); - } - } - } + public class Naturalism extends ArtifactBuff{ + public void charge() { + if (charge < target.HT){ + //gain 1+(1*level)% of the difference between current charge and max HP. + charge+= (Math.round( (target.HT-charge) * (.01+ level*0.01) )); + updateQuickslot(); + } + } + } - protected WndBag.Listener itemSelector = new WndBag.Listener() { - @Override - public void onSelect( Item item ) { - if (item != null && item instanceof Plant.Seed) { - if (seeds.contains(item.name())){ - GLog.w("Your " + name + " have already gained nutrients from that seed recently."); - } else { - seeds.add(item.name()); + protected WndBag.Listener itemSelector = new WndBag.Listener() { + @Override + public void onSelect( Item item ) { + if (item != null && item instanceof Plant.Seed) { + if (seeds.contains(item.name())){ + GLog.w("Your " + name + " have already gained nutrients from that seed recently."); + } else { + seeds.add(item.name()); - Hero hero = Dungeon.hero; - hero.sprite.operate( hero.pos ); - Sample.INSTANCE.play( Assets.SND_PLANT ); - hero.busy(); - hero.spend( 2f ); - if (seeds.size() >= 5+(level*2)){ - seeds.clear(); - upgrade(); - if (level >= 1 && level <= 3) { - GLog.p("Your " + NAMES[level-1] + " surge in size, they are now " + NAMES[level] + "!"); - } + Hero hero = Dungeon.hero; + hero.sprite.operate( hero.pos ); + Sample.INSTANCE.play( Assets.SND_PLANT ); + hero.busy(); + hero.spend( 2f ); + if (seeds.size() >= 5+(level*2)){ + seeds.clear(); + upgrade(); + if (level >= 1 && level <= 3) { + GLog.p("Your " + NAMES[level-1] + " surge in size, they are now " + NAMES[level] + "!"); + } - } else { - GLog.i("Your " + name + " absorb the seed, they seem healthier."); - } - item.detach(hero.belongings.backpack); - } - } - } - }; + } else { + GLog.i("Your " + name + " absorb the seed, they seem healthier."); + } + item.detach(hero.belongings.backpack); + } + } + } + }; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index 6b78e3b4c..3bb180d9c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -15,187 +15,184 @@ import com.watabou.noosa.audio.Sample; import java.util.ArrayList; -/** - * Created by debenhame on 08/09/2014. - */ public class TalismanOfForesight extends Artifact { - { - name = "Talisman of Foresight"; - image = ItemSpriteSheet.ARTIFACT_TALISMAN; + { + name = "Talisman of Foresight"; + image = ItemSpriteSheet.ARTIFACT_TALISMAN; - level = 0; - exp = 0; - levelCap = 10; + level = 0; + exp = 0; + levelCap = 10; - charge = 0; - partialCharge = 0; - chargeCap = 100; + charge = 0; + partialCharge = 0; + chargeCap = 100; - defaultAction = AC_SCRY; - } + defaultAction = AC_SCRY; + } - public static final String AC_SCRY = "SCRY"; + public static final String AC_SCRY = "SCRY"; - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge == 100 && !cursed) - actions.add(AC_SCRY); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge == 100 && !cursed) + actions.add(AC_SCRY); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - super.execute(hero, action); - if (action.equals(AC_SCRY)){ + @Override + public void execute( Hero hero, String action ) { + super.execute(hero, action); + if (action.equals(AC_SCRY)){ - if (!isEquipped(hero)) GLog.i("You need to equip your talisman to do that."); - else if (charge != chargeCap) GLog.i("Your talisman isn't full charged yet."); - else { - hero.sprite.operate(hero.pos); - hero.busy(); - Sample.INSTANCE.play(Assets.SND_BEACON); - charge = 0; - for (int i = 0; i < Level.LENGTH; i++) { + if (!isEquipped(hero)) GLog.i("You need to equip your talisman to do that."); + else if (charge != chargeCap) GLog.i("Your talisman isn't full charged yet."); + else { + hero.sprite.operate(hero.pos); + hero.busy(); + Sample.INSTANCE.play(Assets.SND_BEACON); + charge = 0; + for (int i = 0; i < Level.LENGTH; i++) { - int terr = Dungeon.level.map[i]; - if ((Terrain.flags[terr] & Terrain.SECRET) != 0) { + int terr = Dungeon.level.map[i]; + if ((Terrain.flags[terr] & Terrain.SECRET) != 0) { - GameScene.updateMap(i); + GameScene.updateMap(i); - if (Dungeon.visible[i]) { - GameScene.discoverTile(i, terr); - } - } - } + if (Dungeon.visible[i]) { + GameScene.discoverTile(i, terr); + } + } + } - GLog.p("The Talisman floods your mind with knowledge about the current floor."); + GLog.p("The Talisman floods your mind with knowledge about the current floor."); - Buff.affect(hero, Awareness.class, Awareness.DURATION); - Dungeon.observe(); - } - } - } + Buff.affect(hero, Awareness.class, Awareness.DURATION); + Dungeon.observe(); + } + } + } - @Override - protected ArtifactBuff passiveBuff() { - return new Foresight(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new Foresight(); + } - @Override - public String desc() { - String desc = "A smooth stone, almost too big for your pocket or hand, with strange engravings on it. " + - "You feel like it's watching you, assessing your every move."; - if ( isEquipped( Dungeon.hero ) ){ - if (!cursed) { - desc += "\n\nWhen you hold the talisman you feel like your senses are heightened."; - if (charge == 100) - desc += "\n\nThe talisman is radiating energy, prodding at your mind. You wonder what would " + - "happen if you let it in."; - } else { - desc += "\n\nThe cursed talisman is intently staring into you, making it impossible to concentrate."; - } - } + @Override + public String desc() { + String desc = "A smooth stone, almost too big for your pocket or hand, with strange engravings on it. " + + "You feel like it's watching you, assessing your every move."; + if ( isEquipped( Dungeon.hero ) ){ + if (!cursed) { + desc += "\n\nWhen you hold the talisman you feel like your senses are heightened."; + if (charge == 100) + desc += "\n\nThe talisman is radiating energy, prodding at your mind. You wonder what would " + + "happen if you let it in."; + } else { + desc += "\n\nThe cursed talisman is intently staring into you, making it impossible to concentrate."; + } + } - return desc; - } + return desc; + } - public class Foresight extends ArtifactBuff{ - private int warn = 0; + public class Foresight extends ArtifactBuff{ + private int warn = 0; - @Override - public boolean act() { - spend( TICK ); + @Override + public boolean act() { + spend( TICK ); - boolean smthFound = false; + boolean smthFound = false; - int distance = 3; + int distance = 3; - int cx = target.pos % Level.WIDTH; - int cy = target.pos / Level.WIDTH; - int ax = cx - distance; - if (ax < 0) { - ax = 0; - } - int bx = cx + distance; - if (bx >= Level.WIDTH) { - bx = Level.WIDTH - 1; - } - int ay = cy - distance; - if (ay < 0) { - ay = 0; - } - int by = cy + distance; - if (by >= Level.HEIGHT) { - by = Level.HEIGHT - 1; - } + int cx = target.pos % Level.WIDTH; + int cy = target.pos / Level.WIDTH; + int ax = cx - distance; + if (ax < 0) { + ax = 0; + } + int bx = cx + distance; + if (bx >= Level.WIDTH) { + bx = Level.WIDTH - 1; + } + int ay = cy - distance; + if (ay < 0) { + ay = 0; + } + int by = cy + distance; + if (by >= Level.HEIGHT) { + by = Level.HEIGHT - 1; + } - for (int y = ay; y <= by; y++) { - for (int x = ax, p = ax + y * Level.WIDTH; x <= bx; x++, p++) { + for (int y = ay; y <= by; y++) { + for (int x = ax, p = ax + y * Level.WIDTH; x <= bx; x++, p++) { - if (Dungeon.visible[p] && Level.secret[p] && Dungeon.level.map[p] != Terrain.SECRET_DOOR) - smthFound = true; - } - } + if (Dungeon.visible[p] && Level.secret[p] && Dungeon.level.map[p] != Terrain.SECRET_DOOR) + smthFound = true; + } + } - if (smthFound == true && !cursed){ - if (warn == 0){ - GLog.w("You feel uneasy."); - if (target instanceof Hero){ - ((Hero)target).interrupt(); - } - } - warn = 3; - } else { - if (warn > 0){ - warn --; - } - } - BuffIndicator.refreshHero(); + if (smthFound == true && !cursed){ + if (warn == 0){ + GLog.w("You feel uneasy."); + if (target instanceof Hero){ + ((Hero)target).interrupt(); + } + } + warn = 3; + } else { + if (warn > 0){ + warn --; + } + } + BuffIndicator.refreshHero(); - //fully charges in 2500 turns at lvl=0, scaling to 1000 turns at lvl = 10. - if (charge < 100 && !cursed) { - partialCharge += 0.04+(level*0.006); + //fully charges in 2500 turns at lvl=0, scaling to 1000 turns at lvl = 10. + if (charge < 100 && !cursed) { + partialCharge += 0.04+(level*0.006); - if (partialCharge > 1 && charge < 100) { - partialCharge--; - charge++; - } else if (charge >= 100) { - partialCharge = 0; - GLog.p("Your Talisman is fully charged!"); - } - } + if (partialCharge > 1 && charge < 100) { + partialCharge--; + charge++; + } else if (charge >= 100) { + partialCharge = 0; + GLog.p("Your Talisman is fully charged!"); + } + } - return true; - } + return true; + } - public void charge(){ - charge = Math.min(charge+(2+(level/3)), chargeCap); - exp++; - if (exp >= 4 && level < levelCap) { - upgrade(); - GLog.p("Your Talisman grows stronger!"); - exp -= 4; - } - } + public void charge(){ + charge = Math.min(charge+(2+(level/3)), chargeCap); + exp++; + if (exp >= 4 && level < levelCap) { + upgrade(); + GLog.p("Your Talisman grows stronger!"); + exp -= 4; + } + } - @Override - public String toString() { - return "Foresight"; - } + @Override + public String toString() { + return "Foresight"; + } - @Override - public String desc() { - return "You feel very nervous, as if there is nearby unseen danger."; - } + @Override + public String desc() { + return "You feel very nervous, as if there is nearby unseen danger."; + } - @Override - public int icon() { - if (warn == 0) - return BuffIndicator.NONE; - else - return BuffIndicator.FORESIGHT; - } - } + @Override + public int icon() { + if (warn == 0) + return BuffIndicator.NONE; + else + return BuffIndicator.FORESIGHT; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index 2ac9ba7da..746acd796 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -18,354 +18,351 @@ import com.watabou.utils.Random; import java.util.ArrayList; -/** - * Created by debenhame on 01/12/2014. - */ public class TimekeepersHourglass extends Artifact { - private static final String TXT_HGLASS = "Timekeeper's Hourglass"; - private static final String TXT_STASIS = "Put myself in stasis"; - private static final String TXT_FREEZE = "Freeze time around me"; - private static final String TXT_DESC = - "How would you like to use the hourglass's magic?\n\n" + - "While in stasis, time will move normally while you are frozen and completely invulnerable.\n\n" + - "When time is frozen, you can move as if your actions take no time. Note that attacking will break this."; - - { - name = "Timekeeper's Hourglass"; - image = ItemSpriteSheet.ARTIFACT_HOURGLASS; - - level = 0; - levelCap = 5; - - charge = 10+level*2; - partialCharge = 0; - chargeCap = 10+level*2; - - defaultAction = AC_ACTIVATE; - } - - public static final String AC_ACTIVATE = "ACTIVATE"; - - //keeps track of generated sandbags. - public int sandBags = 0; - - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge > 0 && !cursed) - actions.add(AC_ACTIVATE); - return actions; - } - - @Override - public void execute( Hero hero, String action ) { - if (action.equals(AC_ACTIVATE)){ - - if (!isEquipped( hero )) GLog.i("You need to equip your hourglass to do that."); - else if (activeBuff != null) GLog.i("Your hourglass is already in use."); - else if (charge <= 1) GLog.i("Your hourglass hasn't recharged enough to be usable yet."); - else if (cursed) GLog.i("You cannot use a cursed hourglass."); - else GameScene.show( - new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) { - @Override - protected void onSelect(int index) { - if (index == 0) { - GLog.i("The world seems to shift around you in an instant."); - GameScene.flash(0xFFFFFF); - Sample.INSTANCE.play(Assets.SND_TELEPORT); - - activeBuff = new timeStasis(); - activeBuff.attachTo(Dungeon.hero); - } else if (index == 1) { - GLog.i("everything around you suddenly freezes."); - GameScene.flash(0xFFFFFF); - Sample.INSTANCE.play(Assets.SND_TELEPORT); - - activeBuff = new timeFreeze(); - activeBuff.attachTo(Dungeon.hero); - } - }; - } - ); - } else - super.execute(hero, action); - } - - @Override - public void activate(Char ch) { - super.activate(ch); - if (activeBuff != null) - activeBuff.attachTo(ch); - } - - @Override - public boolean doUnequip(Hero hero, boolean collect, boolean single) { - if (super.doUnequip(hero, collect, single)){ - if (activeBuff != null){ - activeBuff.detach(); - activeBuff = null; - } - return true; - } else - return false; - } - - @Override - protected ArtifactBuff passiveBuff() { - return new hourglassRecharge(); - } - - @Override - public Item upgrade() { - chargeCap+= 2; - - //for artifact transmutation. - while (level+1 > sandBags) - sandBags ++; - - return super.upgrade(); - } - - @Override - public String desc() { - String desc = - "This large ornate hourglass looks fairly unassuming, but you feel a great power in its finely carved" + - " frame. As you rotate the hourglass and watch the sand pour you can feel its magic tugging at you, " + - "surely invoking this magic would give you some power over time."; - - if (isEquipped( Dungeon.hero )){ - if (!cursed) { - desc += "\n\nThe hourglass rests at your side, the whisper of steadily pouring sand is reassuring."; - - if (level < levelCap ) - desc += - "\n\nThe hourglass seems to have lost some sand with age. While there are no cracks, " + - "there is a port on the top of the hourglass to pour sand in, if only you could find some..."; - }else - desc += "\n\nThe cursed hourglass is locked to your side, " + - "you can feel it trying to manipulate your flow of time."; - } - return desc; - } - - - private static final String SANDBAGS = "sandbags"; - private static final String BUFF = "buff"; - - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put( SANDBAGS, sandBags ); - - if (activeBuff != null) - bundle.put( BUFF , activeBuff ); - } - - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - sandBags = bundle.getInt( SANDBAGS ); - - //these buffs belong to hourglass, need to handle unbundling within the hourglass class. - if (bundle.contains( BUFF )){ - Bundle buffBundle = bundle.getBundle( BUFF ); - - if (buffBundle.contains( timeFreeze.PARTIALTIME )) - activeBuff = new timeFreeze(); - else - activeBuff = new timeStasis(); - - activeBuff.restoreFromBundle(buffBundle); - } - } - - public class hourglassRecharge extends ArtifactBuff { - @Override - public boolean act() { - if (charge < chargeCap && !cursed) { - partialCharge += 1 / (60f - (chargeCap - charge)*2f); - - if (partialCharge >= 1) { - partialCharge --; - charge ++; - - if (charge == chargeCap){ - partialCharge = 0; - } - } - } else if (cursed && Random.Int(10) == 0) - ((Hero) target).spend( TICK ); - - updateQuickslot(); - - spend( TICK ); - - return true; - } - } - - public class timeStasis extends ArtifactBuff { - - @Override - public boolean attachTo(Char target) { - //buffs always act last, so the stasis buff should end a turn early. - spend(charge-1); - ((Hero)target).spendAndNext(charge); - - //shouldn't punish the player for going into stasis frequently - Hunger hunger = target.buff(Hunger.class); - if (hunger != null && !hunger.isStarving()) - hunger.satisfy(charge); - - charge = 0; - - target.invisible++; - - updateQuickslot(); - - Dungeon.observe(); - - return super.attachTo(target); - } - - @Override - public boolean act() { - detach(); - return true; - } - - @Override - public void detach() { - if (target.invisible > 0) - target.invisible --; - super.detach(); - activeBuff = null; - Dungeon.observe(); - } - } - - public class timeFreeze extends ArtifactBuff { - - float partialTime = 0f; - - ArrayList presses = new ArrayList(); - - public boolean processTime(float time){ - partialTime += time; - - while (partialTime >= 1f){ - partialTime --; - charge --; - } - - updateQuickslot(); - - if (charge <= 0){ - detach(); - return false; - } else - return true; - - } - - public void setDelayedPress(int cell){ - if (!presses.contains(cell)) - presses.add(cell); - } - - public void triggerPresses(){ - for (int cell : presses) - Dungeon.level.press(cell, null); - - presses = new ArrayList(); - } - - @Override - public boolean attachTo(Char target) { - if (Dungeon.level != null) - for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) - mob.sprite.add(CharSprite.State.PARALYSED); - GameScene.freezeEmitters = true; - return super.attachTo(target); - } - - @Override - public void detach(){ - triggerPresses(); - for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) - mob.sprite.remove(CharSprite.State.PARALYSED); - GameScene.freezeEmitters = false; - - charge = 0; - updateQuickslot(); - super.detach(); - activeBuff = null; - } - - private static final String PRESSES = "presses"; - private static final String PARTIALTIME = "partialtime"; - - @Override - public void storeInBundle(Bundle bundle) { - super.storeInBundle(bundle); - - int[] values = new int[presses.size()]; - for (int i = 0; i < values.length; i ++) - values[i] = presses.get(i); - bundle.put( PRESSES , values ); - - bundle.put( PARTIALTIME , partialTime ); - } - - @Override - public void restoreFromBundle(Bundle bundle) { - super.restoreFromBundle(bundle); - - int[] values = bundle.getIntArray( PRESSES ); - for (int value : values) - presses.add(value); - - partialTime = bundle.getFloat( PARTIALTIME ); - } - } - - public static class sandBag extends Item { - - { - name = "bag of magic sand"; - image = ItemSpriteSheet.SANDBAG; - } - - @Override - public boolean doPickUp( Hero hero ) { - TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class ); - if (hourglass != null && !hourglass.cursed) { - hourglass.upgrade(); - Sample.INSTANCE.play( Assets.SND_DEWDROP ); - if (hourglass.level == hourglass.levelCap) - GLog.p("Your hourglass is filled with magical sand!"); - else - GLog.i("you add the sand to your hourglass."); - hero.spendAndNext(TIME_TO_PICK_UP); - return true; - } else { - GLog.w("You have no hourglass to place this sand into."); - return false; - } - } - - @Override - public String desc(){ - return "This small bag of finely ground sand should work perfectly with your hourglass.\n\n" + - "It seems odd that the shopkeeper would have this specific item right when you need it."; - } - - @Override - public int price() { - return 20; - } - } + private static final String TXT_HGLASS = "Timekeeper's Hourglass"; + private static final String TXT_STASIS = "Put myself in stasis"; + private static final String TXT_FREEZE = "Freeze time around me"; + private static final String TXT_DESC = + "How would you like to use the hourglass's magic?\n\n" + + "While in stasis, time will move normally while you are frozen and completely invulnerable.\n\n" + + "When time is frozen, you can move as if your actions take no time. Note that attacking will break this."; + + { + name = "Timekeeper's Hourglass"; + image = ItemSpriteSheet.ARTIFACT_HOURGLASS; + + level = 0; + levelCap = 5; + + charge = 10+level*2; + partialCharge = 0; + chargeCap = 10+level*2; + + defaultAction = AC_ACTIVATE; + } + + public static final String AC_ACTIVATE = "ACTIVATE"; + + //keeps track of generated sandbags. + public int sandBags = 0; + + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge > 0 && !cursed) + actions.add(AC_ACTIVATE); + return actions; + } + + @Override + public void execute( Hero hero, String action ) { + if (action.equals(AC_ACTIVATE)){ + + if (!isEquipped( hero )) GLog.i("You need to equip your hourglass to do that."); + else if (activeBuff != null) GLog.i("Your hourglass is already in use."); + else if (charge <= 1) GLog.i("Your hourglass hasn't recharged enough to be usable yet."); + else if (cursed) GLog.i("You cannot use a cursed hourglass."); + else GameScene.show( + new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) { + @Override + protected void onSelect(int index) { + if (index == 0) { + GLog.i("The world seems to shift around you in an instant."); + GameScene.flash(0xFFFFFF); + Sample.INSTANCE.play(Assets.SND_TELEPORT); + + activeBuff = new timeStasis(); + activeBuff.attachTo(Dungeon.hero); + } else if (index == 1) { + GLog.i("everything around you suddenly freezes."); + GameScene.flash(0xFFFFFF); + Sample.INSTANCE.play(Assets.SND_TELEPORT); + + activeBuff = new timeFreeze(); + activeBuff.attachTo(Dungeon.hero); + } + }; + } + ); + } else + super.execute(hero, action); + } + + @Override + public void activate(Char ch) { + super.activate(ch); + if (activeBuff != null) + activeBuff.attachTo(ch); + } + + @Override + public boolean doUnequip(Hero hero, boolean collect, boolean single) { + if (super.doUnequip(hero, collect, single)){ + if (activeBuff != null){ + activeBuff.detach(); + activeBuff = null; + } + return true; + } else + return false; + } + + @Override + protected ArtifactBuff passiveBuff() { + return new hourglassRecharge(); + } + + @Override + public Item upgrade() { + chargeCap+= 2; + + //for artifact transmutation. + while (level+1 > sandBags) + sandBags ++; + + return super.upgrade(); + } + + @Override + public String desc() { + String desc = + "This large ornate hourglass looks fairly unassuming, but you feel a great power in its finely carved" + + " frame. As you rotate the hourglass and watch the sand pour you can feel its magic tugging at you, " + + "surely invoking this magic would give you some power over time."; + + if (isEquipped( Dungeon.hero )){ + if (!cursed) { + desc += "\n\nThe hourglass rests at your side, the whisper of steadily pouring sand is reassuring."; + + if (level < levelCap ) + desc += + "\n\nThe hourglass seems to have lost some sand with age. While there are no cracks, " + + "there is a port on the top of the hourglass to pour sand in, if only you could find some..."; + }else + desc += "\n\nThe cursed hourglass is locked to your side, " + + "you can feel it trying to manipulate your flow of time."; + } + return desc; + } + + + private static final String SANDBAGS = "sandbags"; + private static final String BUFF = "buff"; + + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put( SANDBAGS, sandBags ); + + if (activeBuff != null) + bundle.put( BUFF , activeBuff ); + } + + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + sandBags = bundle.getInt( SANDBAGS ); + + //these buffs belong to hourglass, need to handle unbundling within the hourglass class. + if (bundle.contains( BUFF )){ + Bundle buffBundle = bundle.getBundle( BUFF ); + + if (buffBundle.contains( timeFreeze.PARTIALTIME )) + activeBuff = new timeFreeze(); + else + activeBuff = new timeStasis(); + + activeBuff.restoreFromBundle(buffBundle); + } + } + + public class hourglassRecharge extends ArtifactBuff { + @Override + public boolean act() { + if (charge < chargeCap && !cursed) { + partialCharge += 1 / (60f - (chargeCap - charge)*2f); + + if (partialCharge >= 1) { + partialCharge --; + charge ++; + + if (charge == chargeCap){ + partialCharge = 0; + } + } + } else if (cursed && Random.Int(10) == 0) + ((Hero) target).spend( TICK ); + + updateQuickslot(); + + spend( TICK ); + + return true; + } + } + + public class timeStasis extends ArtifactBuff { + + @Override + public boolean attachTo(Char target) { + //buffs always act last, so the stasis buff should end a turn early. + spend(charge-1); + ((Hero)target).spendAndNext(charge); + + //shouldn't punish the player for going into stasis frequently + Hunger hunger = target.buff(Hunger.class); + if (hunger != null && !hunger.isStarving()) + hunger.satisfy(charge); + + charge = 0; + + target.invisible++; + + updateQuickslot(); + + Dungeon.observe(); + + return super.attachTo(target); + } + + @Override + public boolean act() { + detach(); + return true; + } + + @Override + public void detach() { + if (target.invisible > 0) + target.invisible --; + super.detach(); + activeBuff = null; + Dungeon.observe(); + } + } + + public class timeFreeze extends ArtifactBuff { + + float partialTime = 0f; + + ArrayList presses = new ArrayList(); + + public boolean processTime(float time){ + partialTime += time; + + while (partialTime >= 1f){ + partialTime --; + charge --; + } + + updateQuickslot(); + + if (charge <= 0){ + detach(); + return false; + } else + return true; + + } + + public void setDelayedPress(int cell){ + if (!presses.contains(cell)) + presses.add(cell); + } + + public void triggerPresses(){ + for (int cell : presses) + Dungeon.level.press(cell, null); + + presses = new ArrayList(); + } + + @Override + public boolean attachTo(Char target) { + if (Dungeon.level != null) + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) + mob.sprite.add(CharSprite.State.PARALYSED); + GameScene.freezeEmitters = true; + return super.attachTo(target); + } + + @Override + public void detach(){ + triggerPresses(); + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) + mob.sprite.remove(CharSprite.State.PARALYSED); + GameScene.freezeEmitters = false; + + charge = 0; + updateQuickslot(); + super.detach(); + activeBuff = null; + } + + private static final String PRESSES = "presses"; + private static final String PARTIALTIME = "partialtime"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + + int[] values = new int[presses.size()]; + for (int i = 0; i < values.length; i ++) + values[i] = presses.get(i); + bundle.put( PRESSES , values ); + + bundle.put( PARTIALTIME , partialTime ); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + + int[] values = bundle.getIntArray( PRESSES ); + for (int value : values) + presses.add(value); + + partialTime = bundle.getFloat( PARTIALTIME ); + } + } + + public static class sandBag extends Item { + + { + name = "bag of magic sand"; + image = ItemSpriteSheet.SANDBAG; + } + + @Override + public boolean doPickUp( Hero hero ) { + TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class ); + if (hourglass != null && !hourglass.cursed) { + hourglass.upgrade(); + Sample.INSTANCE.play( Assets.SND_DEWDROP ); + if (hourglass.level == hourglass.levelCap) + GLog.p("Your hourglass is filled with magical sand!"); + else + GLog.i("you add the sand to your hourglass."); + hero.spendAndNext(TIME_TO_PICK_UP); + return true; + } else { + GLog.w("You have no hourglass to place this sand into."); + return false; + } + } + + @Override + public String desc(){ + return "This small bag of finely ground sand should work perfectly with your hourglass.\n\n" + + "It seems odd that the shopkeeper would have this specific item right when you need it."; + } + + @Override + public int price() { + return 20; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 0dd9c0567..9ef83cf14 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -22,210 +22,207 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Collections; -/** - * Created by debenhame on 26/11/2014. - */ public class UnstableSpellbook extends Artifact { - { - name = "Unstable Spellbook"; - image = ItemSpriteSheet.ARTIFACT_SPELLBOOK; + { + name = "Unstable Spellbook"; + image = ItemSpriteSheet.ARTIFACT_SPELLBOOK; - level = 0; - levelCap = 10; + level = 0; + levelCap = 10; - charge = ((level/2)+3); - partialCharge = 0; - chargeCap = ((level/2)+3); + charge = ((level/2)+3); + partialCharge = 0; + chargeCap = ((level/2)+3); - defaultAction = AC_READ; - } + defaultAction = AC_READ; + } - public static final String AC_READ = "READ"; - public static final String AC_ADD = "ADD"; + public static final String AC_READ = "READ"; + public static final String AC_ADD = "ADD"; - private final ArrayList scrolls = new ArrayList(); + private final ArrayList scrolls = new ArrayList(); - protected String inventoryTitle = "Select a scroll"; - protected WndBag.Mode mode = WndBag.Mode.SCROLL; + protected String inventoryTitle = "Select a scroll"; + protected WndBag.Mode mode = WndBag.Mode.SCROLL; - public UnstableSpellbook() { - super(); + public UnstableSpellbook() { + super(); - Class[] scrollClasses = Generator.Category.SCROLL.classes; - float[] probs = Generator.Category.SCROLL.probs.clone(); //array of primitives, clone gives deep copy. - int i = Random.chances(probs); + Class[] scrollClasses = Generator.Category.SCROLL.classes; + float[] probs = Generator.Category.SCROLL.probs.clone(); //array of primitives, clone gives deep copy. + int i = Random.chances(probs); - while (i != -1){ - scrolls.add(convertName(scrollClasses[i].getSimpleName())); - probs[i] = 0; + while (i != -1){ + scrolls.add(convertName(scrollClasses[i].getSimpleName())); + probs[i] = 0; - i = Random.chances(probs); - }; - } + i = Random.chances(probs); + }; + } - @Override - public ArrayList actions( Hero hero ) { - ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && charge > 0 && !cursed) - actions.add(AC_READ); - if (isEquipped( hero ) && level < levelCap && !cursed) - actions.add(AC_ADD); - return actions; - } + @Override + public ArrayList actions( Hero hero ) { + ArrayList actions = super.actions( hero ); + if (isEquipped( hero ) && charge > 0 && !cursed) + actions.add(AC_READ); + if (isEquipped( hero ) && level < levelCap && !cursed) + actions.add(AC_ADD); + return actions; + } - @Override - public void execute( Hero hero, String action ) { - if (action.equals( AC_READ )) { + @Override + public void execute( Hero hero, String action ) { + if (action.equals( AC_READ )) { - if (hero.buff( Blindness.class ) != null) GLog.w("You cannot read from the book while blinded."); - else if (!isEquipped( hero )) GLog.i("You need to equip your spellbook to do that."); - else if (charge == 0) GLog.i("Your spellbook is out of energy for now."); - else if (cursed) GLog.i("Your cannot read from a cursed spellbook."); - else { - charge--; + if (hero.buff( Blindness.class ) != null) GLog.w("You cannot read from the book while blinded."); + else if (!isEquipped( hero )) GLog.i("You need to equip your spellbook to do that."); + else if (charge == 0) GLog.i("Your spellbook is out of energy for now."); + else if (cursed) GLog.i("Your cannot read from a cursed spellbook."); + else { + charge--; - Scroll scroll; - do { - scroll = (Scroll) Generator.random(Generator.Category.SCROLL); - } while (scroll == null || - //gotta reduce the rate on these scrolls or that'll be all the item does. - ((scroll instanceof ScrollOfIdentify || - scroll instanceof ScrollOfRemoveCurse || - scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)); + Scroll scroll; + do { + scroll = (Scroll) Generator.random(Generator.Category.SCROLL); + } while (scroll == null || + //gotta reduce the rate on these scrolls or that'll be all the item does. + ((scroll instanceof ScrollOfIdentify || + scroll instanceof ScrollOfRemoveCurse || + scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)); - scroll.ownedByBook = true; - scroll.execute(hero, AC_READ); - } + scroll.ownedByBook = true; + scroll.execute(hero, AC_READ); + } - } else if (action.equals( AC_ADD )) { - GameScene.selectItem(itemSelector, mode, inventoryTitle); - } else - super.execute( hero, action ); - } + } else if (action.equals( AC_ADD )) { + GameScene.selectItem(itemSelector, mode, inventoryTitle); + } else + super.execute( hero, action ); + } - @Override - protected ArtifactBuff passiveBuff() { - return new bookRecharge(); - } + @Override + protected ArtifactBuff passiveBuff() { + return new bookRecharge(); + } - @Override - public Item upgrade() { - chargeCap = (((level+1)/2)+3); + @Override + public Item upgrade() { + chargeCap = (((level+1)/2)+3); - //for artifact transmutation. - while (scrolls.size() > (levelCap-1-level)) - scrolls.remove(0); + //for artifact transmutation. + while (scrolls.size() > (levelCap-1-level)) + scrolls.remove(0); - return super.upgrade(); - } + return super.upgrade(); + } - @Override - public String desc() { - String desc = "This Tome is in surprising good condition given its age. "; + @Override + public String desc() { + String desc = "This Tome is in surprising good condition given its age. "; - if (level < 3) - desc += "It emanates a strange chaotic energy. "; - else if (level < 7) - desc += "It glows with a strange chaotic energy. "; - else - desc += "It fizzes and crackles as you move the pages, surging with unstable energy. "; + if (level < 3) + desc += "It emanates a strange chaotic energy. "; + else if (level < 7) + desc += "It glows with a strange chaotic energy. "; + else + desc += "It fizzes and crackles as you move the pages, surging with unstable energy. "; - desc += "It seems to contains a list of spells, but the order and position of them in the index is " + - "constantly shifting. If you read from this book, there's no telling what spell you might cast."; + desc += "It seems to contains a list of spells, but the order and position of them in the index is " + + "constantly shifting. If you read from this book, there's no telling what spell you might cast."; - desc += "\n\n"; + desc += "\n\n"; - if (isEquipped (Dungeon.hero)) { + if (isEquipped (Dungeon.hero)) { - if (!cursed) - desc += "The book fits firmly at your side, sending you the occasional zip of static energy."; - else - desc += "The cursed book has bound itself to you, it is inhibiting your ability to use most scrolls."; + if (!cursed) + desc += "The book fits firmly at your side, sending you the occasional zip of static energy."; + else + desc += "The cursed book has bound itself to you, it is inhibiting your ability to use most scrolls."; - desc += "\n\n"; + desc += "\n\n"; - } + } - if (level < levelCap) - if (scrolls.size() > 1) - desc += "The book's index points to some pages which are blank. " + - "Those pages are listed as: " + scrolls.get(0) + " and " - + scrolls.get(1) + ". Perhaps adding to the book will increase its power"; - else - desc += "The book's index has one remaining blank page. " + - "That page is listed as " + scrolls.get(0) + "."; - else - desc += "The book's index is full, it doesn't look like you can add anything more to it."; + if (level < levelCap) + if (scrolls.size() > 1) + desc += "The book's index points to some pages which are blank. " + + "Those pages are listed as: " + scrolls.get(0) + " and " + + scrolls.get(1) + ". Perhaps adding to the book will increase its power"; + else + desc += "The book's index has one remaining blank page. " + + "That page is listed as " + scrolls.get(0) + "."; + else + desc += "The book's index is full, it doesn't look like you can add anything more to it."; - return desc; - } + return desc; + } - private static final String SCROLLS = "scrolls"; + private static final String SCROLLS = "scrolls"; - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle(bundle); - bundle.put( SCROLLS, scrolls.toArray(new String[scrolls.size()]) ); - } + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle(bundle); + bundle.put( SCROLLS, scrolls.toArray(new String[scrolls.size()]) ); + } - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle(bundle); - scrolls.clear(); - Collections.addAll(scrolls, bundle.getStringArray(SCROLLS)); - } + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle(bundle); + scrolls.clear(); + Collections.addAll(scrolls, bundle.getStringArray(SCROLLS)); + } - public class bookRecharge extends ArtifactBuff{ - @Override - public boolean act() { - if (charge < chargeCap && !cursed) { - partialCharge += 1 / (150f - (chargeCap - charge)*15f); + public class bookRecharge extends ArtifactBuff{ + @Override + public boolean act() { + if (charge < chargeCap && !cursed) { + partialCharge += 1 / (150f - (chargeCap - charge)*15f); - if (partialCharge >= 1) { - partialCharge --; - charge ++; + if (partialCharge >= 1) { + partialCharge --; + charge ++; - if (charge == chargeCap){ - partialCharge = 0; - } - } - } + if (charge == chargeCap){ + partialCharge = 0; + } + } + } - updateQuickslot(); + updateQuickslot(); - spend( TICK ); + spend( TICK ); - return true; - } - } + return true; + } + } - protected WndBag.Listener itemSelector = new WndBag.Listener() { - @Override - public void onSelect(Item item) { - if (item != null && item instanceof Scroll && item.isIdentified()){ - String scroll = convertName(item.getClass().getSimpleName()); - Hero hero = Dungeon.hero; - for (int i = 0; ( i <= 1 && i < scrolls.size() ); i++){ - if (scrolls.get(i).equals(scroll)){ - hero.sprite.operate( hero.pos ); - hero.busy(); - hero.spend( 2f ); - Sample.INSTANCE.play(Assets.SND_BURNING); - hero.sprite.emitter().burst( ElmoParticle.FACTORY, 12 ); + protected WndBag.Listener itemSelector = new WndBag.Listener() { + @Override + public void onSelect(Item item) { + if (item != null && item instanceof Scroll && item.isIdentified()){ + String scroll = convertName(item.getClass().getSimpleName()); + Hero hero = Dungeon.hero; + for (int i = 0; ( i <= 1 && i < scrolls.size() ); i++){ + if (scrolls.get(i).equals(scroll)){ + hero.sprite.operate( hero.pos ); + hero.busy(); + hero.spend( 2f ); + Sample.INSTANCE.play(Assets.SND_BURNING); + hero.sprite.emitter().burst( ElmoParticle.FACTORY, 12 ); - scrolls.remove(i); - item.detach(hero.belongings.backpack); + scrolls.remove(i); + item.detach(hero.belongings.backpack); - upgrade(); - GLog.i("You infuse the scroll's energy into the book."); - return; - } - } - if (item != null) - GLog.w("You are unable to add this scroll to the book."); - } else if (item instanceof Scroll && !item.isIdentified()) - GLog.w("You're not sure what type of scroll this is yet."); - } - }; + upgrade(); + GLog.i("You infuse the scroll's energy into the book."); + return; + } + } + if (item != null) + GLog.w("You are unable to add this scroll to the book."); + } else if (item instanceof Scroll && !item.isIdentified()) + GLog.w("You're not sure what type of scroll this is yet."); + } + }; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java index 0b54d1c34..683aa6efd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java @@ -42,7 +42,7 @@ public class Bag extends Item implements Iterable { public Char owner; - public ArrayList items = new ArrayList(); + public ArrayList items = new ArrayList(); public int size = 1; @@ -61,7 +61,7 @@ public class Bag extends Item implements Iterable { @Override public boolean collect( Bag container ) { - if (super.collect( container )) { + if (super.collect( container )) { owner = container.owner; @@ -82,9 +82,9 @@ public class Bag extends Item implements Iterable { @Override public void onDetach( ) { - this.owner = null; - for (Item item : items) - Dungeon.quickslot.clearItem(item); + this.owner = null; + for (Item item : items) + Dungeon.quickslot.clearItem(item); updateQuickslot(); } @@ -178,6 +178,6 @@ public class Bag extends Item implements Iterable { } else { items.remove( index ); } - } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/PotionBandolier.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/PotionBandolier.java index 9c65194b5..7f08f2496 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/PotionBandolier.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/PotionBandolier.java @@ -4,9 +4,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -/** - * Created by debenhame on 05/02/2015. - */ public class PotionBandolier extends Bag { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/WandHolster.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/WandHolster.java index 7cfcc07ab..63b956338 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/WandHolster.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/WandHolster.java @@ -51,12 +51,12 @@ public class WandHolster extends Bag { } @Override - public void onDetach( ) { + public void onDetach( ) { super.onDetach(); - for (Item item : items) { - ((Wand)item).stopCharging(); - } - } + for (Item item : items) { + ((Wand)item).stopCharging(); + } + } @Override public int price() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index 295baeb08..064acf6e0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -38,298 +38,295 @@ import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.Random; -/** - * Created by debenhame on 12/08/2014. - */ public class Blandfruit extends Food { - public String message = "You eat the Blandfruit, bleugh!"; - public String info = "So dry and insubstantial, perhaps stewing it with another ingredient would improve it."; + public String message = "You eat the Blandfruit, bleugh!"; + public String info = "So dry and insubstantial, perhaps stewing it with another ingredient would improve it."; - public Potion potionAttrib = null; - public ItemSprite.Glowing potionGlow = null; + public Potion potionAttrib = null; + public ItemSprite.Glowing potionGlow = null; - { - name = "Blandfruit"; - stackable = true; - image = ItemSpriteSheet.BLANDFRUIT; - energy = (Hunger.STARVING - Hunger.HUNGRY)/2; - hornValue = 6; //only applies when blandfruit is cooked + { + name = "Blandfruit"; + stackable = true; + image = ItemSpriteSheet.BLANDFRUIT; + energy = (Hunger.STARVING - Hunger.HUNGRY)/2; + hornValue = 6; //only applies when blandfruit is cooked - bones = true; - } + bones = true; + } - @Override - public boolean isSimilar( Item item ) { - if (item instanceof Blandfruit){ - if (potionAttrib == null){ - if (((Blandfruit)item).potionAttrib == null) - return true; - } else if (((Blandfruit)item).potionAttrib != null){ - if (((Blandfruit)item).potionAttrib.getClass() == potionAttrib.getClass()) - return true; - } - } - return false; - } + @Override + public boolean isSimilar( Item item ) { + if (item instanceof Blandfruit){ + if (potionAttrib == null){ + if (((Blandfruit)item).potionAttrib == null) + return true; + } else if (((Blandfruit)item).potionAttrib != null){ + if (((Blandfruit)item).potionAttrib.getClass() == potionAttrib.getClass()) + return true; + } + } + return false; + } - @Override - public void execute( Hero hero, String action ) { - if (action.equals( AC_EAT )){ + @Override + public void execute( Hero hero, String action ) { + if (action.equals( AC_EAT )){ - if (potionAttrib == null) { + if (potionAttrib == null) { - detach(hero.belongings.backpack); + detach(hero.belongings.backpack); - ((Hunger) hero.buff(Hunger.class)).satisfy(energy); - GLog.i(message); + ((Hunger) hero.buff(Hunger.class)).satisfy(energy); + GLog.i(message); - hero.sprite.operate(hero.pos); - hero.busy(); - SpellSprite.show(hero, SpellSprite.FOOD); - Sample.INSTANCE.play(Assets.SND_EAT); + hero.sprite.operate(hero.pos); + hero.busy(); + SpellSprite.show(hero, SpellSprite.FOOD); + Sample.INSTANCE.play(Assets.SND_EAT); - hero.spend(1f); + hero.spend(1f); - Statistics.foodEaten++; - Badges.validateFoodEaten(); - } else { + Statistics.foodEaten++; + Badges.validateFoodEaten(); + } else { - ((Hunger) hero.buff(Hunger.class)).satisfy(Hunger.HUNGRY); + ((Hunger) hero.buff(Hunger.class)).satisfy(Hunger.HUNGRY); - detach(hero.belongings.backpack); + detach(hero.belongings.backpack); - hero.spend(1f); - hero.busy(); + hero.spend(1f); + hero.busy(); - if (potionAttrib instanceof PotionOfFrost) { - GLog.i("the Icefruit tastes a bit like Frozen Carpaccio."); - switch (Random.Int(5)) { - case 0: - GLog.i("You see your hands turn invisible!"); - Buff.affect(hero, Invisibility.class, Invisibility.DURATION); - break; - case 1: - GLog.i("You feel your skin harden!"); - Buff.affect(hero, Barkskin.class).level(hero.HT / 4); - break; - case 2: - GLog.i("Refreshing!"); - Buff.detach(hero, Poison.class); - Buff.detach(hero, Cripple.class); - Buff.detach(hero, Weakness.class); - Buff.detach(hero, Bleeding.class); - break; - case 3: - GLog.i("You feel better!"); - if (hero.HP < hero.HT) { - hero.HP = Math.min(hero.HP + hero.HT / 4, hero.HT); - hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); - } - break; - } - } else if (potionAttrib instanceof PotionOfLiquidFlame){ - GLog.i("You feel a great fire burning within you!"); - Buff.affect(hero, FireImbue.class).set(FireImbue.DURATION); - } else if (potionAttrib instanceof PotionOfToxicGas) { - GLog.i("You are imbued with vile toxic power!"); - Buff.affect(hero, ToxicImbue.class).set(ToxicImbue.DURATION); - } else if (potionAttrib instanceof PotionOfParalyticGas) { - GLog.i("You feel the power of the earth coursing through you!"); - Buff.affect(hero, EarthImbue.class, EarthImbue.DURATION); - } else - potionAttrib.apply(hero); + if (potionAttrib instanceof PotionOfFrost) { + GLog.i("the Icefruit tastes a bit like Frozen Carpaccio."); + switch (Random.Int(5)) { + case 0: + GLog.i("You see your hands turn invisible!"); + Buff.affect(hero, Invisibility.class, Invisibility.DURATION); + break; + case 1: + GLog.i("You feel your skin harden!"); + Buff.affect(hero, Barkskin.class).level(hero.HT / 4); + break; + case 2: + GLog.i("Refreshing!"); + Buff.detach(hero, Poison.class); + Buff.detach(hero, Cripple.class); + Buff.detach(hero, Weakness.class); + Buff.detach(hero, Bleeding.class); + break; + case 3: + GLog.i("You feel better!"); + if (hero.HP < hero.HT) { + hero.HP = Math.min(hero.HP + hero.HT / 4, hero.HT); + hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); + } + break; + } + } else if (potionAttrib instanceof PotionOfLiquidFlame){ + GLog.i("You feel a great fire burning within you!"); + Buff.affect(hero, FireImbue.class).set(FireImbue.DURATION); + } else if (potionAttrib instanceof PotionOfToxicGas) { + GLog.i("You are imbued with vile toxic power!"); + Buff.affect(hero, ToxicImbue.class).set(ToxicImbue.DURATION); + } else if (potionAttrib instanceof PotionOfParalyticGas) { + GLog.i("You feel the power of the earth coursing through you!"); + Buff.affect(hero, EarthImbue.class, EarthImbue.DURATION); + } else + potionAttrib.apply(hero); - Sample.INSTANCE.play( Assets.SND_EAT ); - SpellSprite.show(hero, SpellSprite.FOOD); - hero.sprite.operate(hero.pos); + Sample.INSTANCE.play( Assets.SND_EAT ); + SpellSprite.show(hero, SpellSprite.FOOD); + hero.sprite.operate(hero.pos); - switch (hero.heroClass) { - case WARRIOR: - if (hero.HP < hero.HT) { - hero.HP = Math.min( hero.HP + 5, hero.HT ); - hero.sprite.emitter().burst( Speck.factory(Speck.HEALING), 1 ); - } - break; - case MAGE: - //1 charge - Buff.affect(hero, ScrollOfRecharging.Recharging.class, 4f); - ScrollOfRecharging.charge(hero); - break; - case ROGUE: - case HUNTRESS: - break; - } - } - } else { - super.execute(hero, action); - } - } + switch (hero.heroClass) { + case WARRIOR: + if (hero.HP < hero.HT) { + hero.HP = Math.min( hero.HP + 5, hero.HT ); + hero.sprite.emitter().burst( Speck.factory(Speck.HEALING), 1 ); + } + break; + case MAGE: + //1 charge + Buff.affect(hero, ScrollOfRecharging.Recharging.class, 4f); + ScrollOfRecharging.charge(hero); + break; + case ROGUE: + case HUNTRESS: + break; + } + } + } else { + super.execute(hero, action); + } + } - @Override - public String info() { - return info; - } + @Override + public String info() { + return info; + } - @Override - public int price() { - return 20 * quantity; - } + @Override + public int price() { + return 20 * quantity; + } - public Item cook(Seed seed){ + public Item cook(Seed seed){ - try { - return imbuePotion((Potion)seed.alchemyClass.newInstance()); - } catch (Exception e) { - return null; - } + try { + return imbuePotion((Potion)seed.alchemyClass.newInstance()); + } catch (Exception e) { + return null; + } - } + } - public Item imbuePotion(Potion potion){ + public Item imbuePotion(Potion potion){ - potionAttrib = potion; - potionAttrib.ownedByFruit = true; + potionAttrib = potion; + potionAttrib.ownedByFruit = true; - potionAttrib.image = ItemSpriteSheet.BLANDFRUIT; + potionAttrib.image = ItemSpriteSheet.BLANDFRUIT; - info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+ - "of the seed it was cooked with.\n\n"; + info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+ + "of the seed it was cooked with.\n\n"; - if (potionAttrib instanceof PotionOfHealing){ + if (potionAttrib instanceof PotionOfHealing){ - name = "Sunfruit"; - potionGlow = new ItemSprite.Glowing( 0x2EE62E ); - info += "It looks delicious and hearty, ready to be eaten!"; + name = "Sunfruit"; + potionGlow = new ItemSprite.Glowing( 0x2EE62E ); + info += "It looks delicious and hearty, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfStrength){ + } else if (potionAttrib instanceof PotionOfStrength){ - name = "Rotfruit"; - potionGlow = new ItemSprite.Glowing( 0xCC0022 ); - info += "It looks delicious and powerful, ready to be eaten!"; + name = "Rotfruit"; + potionGlow = new ItemSprite.Glowing( 0xCC0022 ); + info += "It looks delicious and powerful, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfParalyticGas){ + } else if (potionAttrib instanceof PotionOfParalyticGas){ - name = "Earthfruit"; - potionGlow = new ItemSprite.Glowing( 0x67583D ); - info += "It looks delicious and firm, ready to be eaten!"; + name = "Earthfruit"; + potionGlow = new ItemSprite.Glowing( 0x67583D ); + info += "It looks delicious and firm, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfInvisibility){ + } else if (potionAttrib instanceof PotionOfInvisibility){ - name = "Blindfruit"; - potionGlow = new ItemSprite.Glowing( 0xE5D273 ); - info += "It looks delicious and shiny, ready to be eaten!"; + name = "Blindfruit"; + potionGlow = new ItemSprite.Glowing( 0xE5D273 ); + info += "It looks delicious and shiny, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfLiquidFlame){ + } else if (potionAttrib instanceof PotionOfLiquidFlame){ - name = "Firefruit"; - potionGlow = new ItemSprite.Glowing( 0xFF7F00 ); - info += "It looks delicious and spicy, ready to be eaten!"; + name = "Firefruit"; + potionGlow = new ItemSprite.Glowing( 0xFF7F00 ); + info += "It looks delicious and spicy, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfFrost){ + } else if (potionAttrib instanceof PotionOfFrost){ - name = "Icefruit"; - potionGlow = new ItemSprite.Glowing( 0x66B3FF ); - info += "It looks delicious and refreshing, ready to be eaten!"; + name = "Icefruit"; + potionGlow = new ItemSprite.Glowing( 0x66B3FF ); + info += "It looks delicious and refreshing, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfMindVision){ + } else if (potionAttrib instanceof PotionOfMindVision){ - name = "Fadefruit"; - potionGlow = new ItemSprite.Glowing( 0xB8E6CF ); - info += "It looks delicious and shadowy, ready to be eaten!"; + name = "Fadefruit"; + potionGlow = new ItemSprite.Glowing( 0xB8E6CF ); + info += "It looks delicious and shadowy, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfToxicGas){ + } else if (potionAttrib instanceof PotionOfToxicGas){ - name = "Sorrowfruit"; - potionGlow = new ItemSprite.Glowing( 0xA15CE5 ); - info += "It looks delicious and crisp, ready to be eaten!"; + name = "Sorrowfruit"; + potionGlow = new ItemSprite.Glowing( 0xA15CE5 ); + info += "It looks delicious and crisp, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfLevitation) { + } else if (potionAttrib instanceof PotionOfLevitation) { - name = "Stormfruit"; - potionGlow = new ItemSprite.Glowing( 0x1C3A57 ); - info += "It looks delicious and lightweight, ready to be eaten!"; + name = "Stormfruit"; + potionGlow = new ItemSprite.Glowing( 0x1C3A57 ); + info += "It looks delicious and lightweight, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfPurity) { + } else if (potionAttrib instanceof PotionOfPurity) { - name = "Dreamfruit"; - potionGlow = new ItemSprite.Glowing( 0x8E2975 ); - info += "It looks delicious and clean, ready to be eaten!"; + name = "Dreamfruit"; + potionGlow = new ItemSprite.Glowing( 0x8E2975 ); + info += "It looks delicious and clean, ready to be eaten!"; - } else if (potionAttrib instanceof PotionOfExperience) { + } else if (potionAttrib instanceof PotionOfExperience) { - name = "Starfruit"; - potionGlow = new ItemSprite.Glowing( 0xA79400 ); - info += "It looks delicious and glorious, ready to be eaten!"; + name = "Starfruit"; + potionGlow = new ItemSprite.Glowing( 0xA79400 ); + info += "It looks delicious and glorious, ready to be eaten!"; - } + } - return this; - } + return this; + } - public static final String POTIONATTRIB = "potionattrib"; + public static final String POTIONATTRIB = "potionattrib"; - @Override - public void cast( final Hero user, int dst ) { - if (potionAttrib instanceof PotionOfLiquidFlame || - potionAttrib instanceof PotionOfToxicGas || - potionAttrib instanceof PotionOfParalyticGas || - potionAttrib instanceof PotionOfFrost || - potionAttrib instanceof PotionOfLevitation || - potionAttrib instanceof PotionOfPurity) { - potionAttrib.cast(user, dst); - detach( user.belongings.backpack ); - } else { - super.cast(user, dst); - } + @Override + public void cast( final Hero user, int dst ) { + if (potionAttrib instanceof PotionOfLiquidFlame || + potionAttrib instanceof PotionOfToxicGas || + potionAttrib instanceof PotionOfParalyticGas || + potionAttrib instanceof PotionOfFrost || + potionAttrib instanceof PotionOfLevitation || + potionAttrib instanceof PotionOfPurity) { + potionAttrib.cast(user, dst); + detach( user.belongings.backpack ); + } else { + super.cast(user, dst); + } - } + } - @Override - public void storeInBundle(Bundle bundle){ - super.storeInBundle(bundle); - bundle.put( POTIONATTRIB , potionAttrib); - } + @Override + public void storeInBundle(Bundle bundle){ + super.storeInBundle(bundle); + bundle.put( POTIONATTRIB , potionAttrib); + } - @Override - public void restoreFromBundle(Bundle bundle){ - super.restoreFromBundle(bundle); - if (bundle.contains( POTIONATTRIB )) { - imbuePotion( (Potion)bundle.get( POTIONATTRIB ) ); + @Override + public void restoreFromBundle(Bundle bundle){ + super.restoreFromBundle(bundle); + if (bundle.contains( POTIONATTRIB )) { + imbuePotion( (Potion)bundle.get( POTIONATTRIB ) ); - //TODO: legacy code for pre-v0.2.3, remove when saves from that version are no longer supported. - } else if (bundle.contains("name")) { - name = bundle.getString("name"); + //TODO: legacy code for pre-v0.2.3, remove when saves from that version are no longer supported. + } else if (bundle.contains("name")) { + name = bundle.getString("name"); - if (name.equals("Healthfruit")) - cook(new Sungrass.Seed()); - else if (name.equals("Powerfruit")) - cook(new Wandmaker.Rotberry.Seed()); - else if (name.equals("Paralyzefruit")) - cook(new Earthroot.Seed()); - else if (name.equals("Invisifruit")) - cook(new Blindweed.Seed()); - else if (name.equals("Flamefruit")) - cook(new Firebloom.Seed()); - else if (name.equals("Frostfruit")) - cook(new Icecap.Seed()); - else if (name.equals("Visionfruit")) - cook(new Fadeleaf.Seed()); - else if (name.equals("Toxicfruit")) - cook(new Sorrowmoss.Seed()); - else if (name.equals("Floatfruit")) - cook(new Stormvine.Seed()); - else if (name.equals("Purefruit")) - cook(new Dreamfoil.Seed()); - } + if (name.equals("Healthfruit")) + cook(new Sungrass.Seed()); + else if (name.equals("Powerfruit")) + cook(new Wandmaker.Rotberry.Seed()); + else if (name.equals("Paralyzefruit")) + cook(new Earthroot.Seed()); + else if (name.equals("Invisifruit")) + cook(new Blindweed.Seed()); + else if (name.equals("Flamefruit")) + cook(new Firebloom.Seed()); + else if (name.equals("Frostfruit")) + cook(new Icecap.Seed()); + else if (name.equals("Visionfruit")) + cook(new Fadeleaf.Seed()); + else if (name.equals("Toxicfruit")) + cook(new Sorrowmoss.Seed()); + else if (name.equals("Floatfruit")) + cook(new Stormvine.Seed()); + else if (name.equals("Purefruit")) + cook(new Dreamfoil.Seed()); + } - } + } - @Override - public ItemSprite.Glowing glowing() { - return potionGlow; - } + @Override + public ItemSprite.Glowing glowing() { + return potionGlow; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/ChargrilledMeat.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/ChargrilledMeat.java index dbe66c5cf..a7e6c0393 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/ChargrilledMeat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/ChargrilledMeat.java @@ -26,7 +26,7 @@ public class ChargrilledMeat extends Food { name = "chargrilled meat"; image = ItemSpriteSheet.STEAK; energy = Hunger.STARVING - Hunger.HUNGRY; - hornValue = 1; + hornValue = 1; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java index 1838f886b..3f622c730 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java @@ -42,14 +42,14 @@ public class Food extends Item { public float energy = Hunger.HUNGRY; public String message = "That food tasted delicious!"; - public int hornValue = 3; + public int hornValue = 3; { stackable = true; name = "ration of food"; image = ItemSpriteSheet.RATION; - bones = true; + bones = true; } @Override @@ -102,9 +102,9 @@ public class Food extends Item { } } - @Override + @Override public String info() { - return + return "Nothing fancy here: dried meat, " + "some biscuits - things like that."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java index ccb4614f1..1a5a55d51 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java @@ -40,7 +40,7 @@ public class FrozenCarpaccio extends Food { name = "frozen carpaccio"; image = ItemSpriteSheet.CARPACCIO; energy = Hunger.STARVING - Hunger.HUNGRY; - hornValue = 1; + hornValue = 1; } @Override @@ -61,13 +61,13 @@ public class FrozenCarpaccio extends Food { break; case 2: GLog.i( "Refreshing!" ); - Buff.detach( hero, Poison.class ); - Buff.detach( hero, Cripple.class ); - Buff.detach( hero, Weakness.class ); - Buff.detach( hero, Bleeding.class ); - Buff.detach( hero, Drowsy.class ); - Buff.detach( hero, Slow.class ); - Buff.detach( hero, Vertigo.class); + Buff.detach( hero, Poison.class ); + Buff.detach( hero, Cripple.class ); + Buff.detach( hero, Weakness.class ); + Buff.detach( hero, Bleeding.class ); + Buff.detach( hero, Drowsy.class ); + Buff.detach( hero, Slow.class ); + Buff.detach( hero, Vertigo.class); break; case 3: GLog.i( "You feel better!" ); @@ -82,7 +82,7 @@ public class FrozenCarpaccio extends Food { @Override public String info() { - return + return "It's a piece of frozen raw meat. The only way to eat it is " + "by cutting thin slices of it. And this way it's suprisingly good."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/MysteryMeat.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/MysteryMeat.java index 5197179a5..f93f03a61 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/MysteryMeat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/MysteryMeat.java @@ -36,7 +36,7 @@ public class MysteryMeat extends Food { image = ItemSpriteSheet.MEAT; energy = Hunger.STARVING - Hunger.HUNGRY; message = "That food tasted... strange."; - hornValue = 1; + hornValue = 1; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/OverpricedRation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/OverpricedRation.java index 11bb367c0..71de346b7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/OverpricedRation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/OverpricedRation.java @@ -27,7 +27,7 @@ public class OverpricedRation extends Food { image = ItemSpriteSheet.OVERPRICED; energy = Hunger.STARVING - Hunger.HUNGRY; message = "That food tasted ok."; - hornValue = 1; + hornValue = 1; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java index 2750483d3..311b72900 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java @@ -26,9 +26,9 @@ public class Pasty extends Food { name = "pasty"; image = ItemSpriteSheet.PASTY; energy = Hunger.STARVING; - hornValue = 5; + hornValue = 5; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/GoldenKey.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/GoldenKey.java index 75a063bd6..64ee777c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/GoldenKey.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/GoldenKey.java @@ -37,7 +37,7 @@ public class GoldenKey extends Key { @Override public String info() { - return + return "The notches on this golden key are tiny and intricate. " + "Maybe it can open some chest lock?"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/IronKey.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/IronKey.java index c8e96ef97..fb9e5d3c3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/IronKey.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/IronKey.java @@ -52,12 +52,12 @@ public class IronKey extends Key { return result; } - @Override - public void onDetach( ) { - if (depth == Dungeon.depth) { - Dungeon.hero.belongings.countIronKeys(); - } - } + @Override + public void onDetach( ) { + if (depth == Dungeon.depth) { + Dungeon.hero.belongings.countIronKeys(); + } + } @Override public String toString() { @@ -66,7 +66,7 @@ public class IronKey extends Key { @Override public String info() { - return + return "The notches on this ancient iron key are well worn; its leather lanyard " + "is battered by age. What door might it open?"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/SkeletonKey.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/SkeletonKey.java index 8e1a64953..28f4d78f3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/SkeletonKey.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/SkeletonKey.java @@ -44,7 +44,7 @@ public class SkeletonKey extends Key { @Override public String info() { - return + return "This key looks serious: its head is shaped like a skull. Probably it can open some serious door."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 73a64b077..8e1a2e792 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -50,9 +50,9 @@ public class Potion extends Item { private static final String TXT_BENEFICIAL = "Beneficial potion"; private static final String TXT_YES = "Yes, I know what I'm doing"; private static final String TXT_NO = "No, I changed my mind"; - private static final String TXT_R_U_SURE_DRINK = + private static final String TXT_R_U_SURE_DRINK = "Are you sure you want to drink it? In most cases you should throw such potions at your enemies."; - private static final String TXT_R_U_SURE_THROW = + private static final String TXT_R_U_SURE_THROW = "Are you sure you want to throw it? In most cases it makes sense to drink it."; private static final float TIME_TO_DRINK = 1f; @@ -60,44 +60,44 @@ public class Potion extends Item { protected String initials; private static final Class[] potions = { - PotionOfHealing.class, - PotionOfExperience.class, - PotionOfToxicGas.class, + PotionOfHealing.class, + PotionOfExperience.class, + PotionOfToxicGas.class, PotionOfLiquidFlame.class, PotionOfStrength.class, PotionOfParalyticGas.class, PotionOfLevitation.class, - PotionOfMindVision.class, + PotionOfMindVision.class, PotionOfPurity.class, PotionOfInvisibility.class, PotionOfMight.class, PotionOfFrost.class }; private static final String[] colors = { - "turquoise", "crimson", "azure", "jade", "golden", "magenta", + "turquoise", "crimson", "azure", "jade", "golden", "magenta", "charcoal", "ivory", "amber", "bistre", "indigo", "silver"}; private static final Integer[] images = { - ItemSpriteSheet.POTION_TURQUOISE, - ItemSpriteSheet.POTION_CRIMSON, - ItemSpriteSheet.POTION_AZURE, - ItemSpriteSheet.POTION_JADE, - ItemSpriteSheet.POTION_GOLDEN, - ItemSpriteSheet.POTION_MAGENTA, - ItemSpriteSheet.POTION_CHARCOAL, - ItemSpriteSheet.POTION_IVORY, - ItemSpriteSheet.POTION_AMBER, - ItemSpriteSheet.POTION_BISTRE, - ItemSpriteSheet.POTION_INDIGO, + ItemSpriteSheet.POTION_TURQUOISE, + ItemSpriteSheet.POTION_CRIMSON, + ItemSpriteSheet.POTION_AZURE, + ItemSpriteSheet.POTION_JADE, + ItemSpriteSheet.POTION_GOLDEN, + ItemSpriteSheet.POTION_MAGENTA, + ItemSpriteSheet.POTION_CHARCOAL, + ItemSpriteSheet.POTION_IVORY, + ItemSpriteSheet.POTION_AMBER, + ItemSpriteSheet.POTION_BISTRE, + ItemSpriteSheet.POTION_INDIGO, ItemSpriteSheet.POTION_SILVER}; private static ItemStatusHandler handler; private String color; - public boolean ownedByFruit = false; + public boolean ownedByFruit = false; - { - stackable = true; + { + stackable = true; defaultAction = AC_DRINK; } @@ -120,11 +120,11 @@ public class Potion extends Item { syncVisuals(); } - @Override - public void syncVisuals(){ - image = handler.image( this ); - color = handler.label( this ); - }; + @Override + public void syncVisuals(){ + image = handler.image( this ); + color = handler.label( this ); + }; @Override public ArrayList actions( Hero hero ) { @@ -138,11 +138,11 @@ public class Potion extends Item { if (action.equals( AC_DRINK )) { if (isKnown() && ( - this instanceof PotionOfLiquidFlame || - this instanceof PotionOfToxicGas || + this instanceof PotionOfLiquidFlame || + this instanceof PotionOfToxicGas || this instanceof PotionOfParalyticGas)) { - GameScene.show( + GameScene.show( new WndOptions( TXT_HARMFUL, TXT_R_U_SURE_DRINK, TXT_YES, TXT_NO ) { @Override protected void onSelect(int index) { @@ -168,14 +168,14 @@ public class Potion extends Item { public void doThrow( final Hero hero ) { if (isKnown() && ( - this instanceof PotionOfExperience || + this instanceof PotionOfExperience || this instanceof PotionOfHealing || this instanceof PotionOfMindVision || this instanceof PotionOfStrength || - this instanceof PotionOfInvisibility || + this instanceof PotionOfInvisibility || this instanceof PotionOfMight)) { - GameScene.show( + GameScene.show( new WndOptions( TXT_BENEFICIAL, TXT_R_U_SURE_THROW, TXT_YES, TXT_NO ) { @Override protected void onSelect(int index) { @@ -229,23 +229,23 @@ public class Potion extends Item { } } - @Override - public void cast( final Hero user, int dst ) { - super.cast(user, dst); - } + @Override + public void cast( final Hero user, int dst ) { + super.cast(user, dst); + } public boolean isKnown() { return handler.isKnown( this ); } public void setKnown() { - if (!ownedByFruit) { - if (!isKnown()) { - handler.know(this); - } + if (!ownedByFruit) { + if (!isKnown()) { + handler.know(this); + } - Badges.validateAllPotionsIdentified(); - } + Badges.validateAllPotionsIdentified(); + } } @Override @@ -302,14 +302,14 @@ public class Potion extends Item { final int color = ItemSprite.pick( image, 8, 10 ); Splash.at( cell, color, 5 ); - Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); - if (fire != null) - fire.clear( cell ); + Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); + if (fire != null) + fire.clear( cell ); - Char ch = Actor.findChar(cell); - if (ch != null) - Buff.detach( ch, Burning.class ); - } + Char ch = Actor.findChar(cell); + if (ch != null) + Buff.detach( ch, Burning.class ); + } @Override public int price() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfExperience.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfExperience.java index 8a0d02b01..4b448e090 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfExperience.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfExperience.java @@ -25,7 +25,7 @@ public class PotionOfExperience extends Potion { name = "Potion of Experience"; initials = "Ex"; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java index 63292ff0d..4ba6f5750 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java @@ -59,10 +59,10 @@ public class PotionOfFrost extends Potion { @Override public String desc() { - return + return "Upon exposure to open air this chemical will evaporate into a freezing cloud, causing " + "any creature that contacts it to be frozen in place unable to act and move. " + - "The freezing effect is much stronger if the environment is wet."; + "The freezing effect is much stronger if the environment is wet."; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java index 6643d8d32..f0a42835c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java @@ -33,7 +33,7 @@ public class PotionOfHealing extends Potion { name = "Potion of Healing"; initials = "He"; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java index b36ff2133..20172113f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java @@ -35,18 +35,18 @@ public class PotionOfLevitation extends Potion { initials = "Le"; } - @Override - public void shatter( int cell ) { + @Override + public void shatter( int cell ) { - if (Dungeon.visible[cell]) { - setKnown(); + if (Dungeon.visible[cell]) { + setKnown(); - splash( cell ); - Sample.INSTANCE.play( Assets.SND_SHATTER ); - } + splash( cell ); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } - GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) ); - } + GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) ); + } @Override public void apply( Hero hero ) { @@ -60,7 +60,7 @@ public class PotionOfLevitation extends Potion { return "Drinking this curious liquid will cause you to hover in the air, " + "able to drift effortlessly over traps and pits. Throwing this potion " + - "will create a cloud of unrefined gas, disorienting anything caught in it."; + "will create a cloud of unrefined gas, disorienting anything caught in it."; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java index 246a8c1b7..64a737f82 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -45,19 +45,19 @@ public class PotionOfLiquidFlame extends Potion { Sample.INSTANCE.play( Assets.SND_SHATTER ); } - for (int offset : Level.NEIGHBOURS9){ - if (Level.flamable[cell+offset] - || Actor.findChar(cell+offset) != null - || Dungeon.level.heaps.get(cell+offset) != null) { + for (int offset : Level.NEIGHBOURS9){ + if (Level.flamable[cell+offset] + || Actor.findChar(cell+offset) != null + || Dungeon.level.heaps.get(cell+offset) != null) { - GameScene.add(Blob.seed(cell + offset, 2, Fire.class)); + GameScene.add(Blob.seed(cell + offset, 2, Fire.class)); - } else { + } else { - CellEmitter.get(cell+offset).burst(FlameParticle.FACTORY, 2); + CellEmitter.get(cell+offset).burst(FlameParticle.FACTORY, 2); - } - } + } + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfMight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfMight.java index 8b25a3079..ec7aab75f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfMight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfMight.java @@ -28,7 +28,7 @@ public class PotionOfMight extends PotionOfStrength { name = "Potion of Might"; initials = "Mi"; - bones = true; + bones = true; } @Override @@ -41,7 +41,7 @@ public class PotionOfMight extends PotionOfStrength { hero.sprite.showStatus( CharSprite.POSITIVE, "+1 str, +5 ht" ); GLog.p( "Newfound strength surges through your body." ); - Badges.validateStrengthAttained(); + Badges.validateStrengthAttained(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index ea722499f..45ad72848 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -56,10 +56,10 @@ public class PotionOfPurity extends Potion { boolean procd = false; Blob[] blobs = { - Dungeon.level.blobs.get( ToxicGas.class ), + Dungeon.level.blobs.get( ToxicGas.class ), Dungeon.level.blobs.get( ParalyticGas.class ), - Dungeon.level.blobs.get( ConfusionGas.class ), - Dungeon.level.blobs.get( StenchGas.class ), + Dungeon.level.blobs.get( ConfusionGas.class ), + Dungeon.level.blobs.get( StenchGas.class ), Dungeon.level.blobs.get( VenomGas.class ) }; @@ -73,7 +73,7 @@ public class PotionOfPurity extends Potion { for (int i=0; i < Level.LENGTH; i++) { if (PathFinder.distance[i] < Integer.MAX_VALUE) { - int value = blob.cur[i]; + int value = blob.cur[i]; if (value > 0) { blob.cur[i] = 0; @@ -125,7 +125,7 @@ public class PotionOfPurity extends Potion { @Override public String desc() { - return + return "This reagent will quickly neutralize all harmful gases in the area of effect. " + "Drinking it will give you a temporary immunity to such gases."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java index 75f96d01a..6341fd022 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java @@ -28,7 +28,7 @@ public class PotionOfStrength extends Potion { name = "Potion of Strength"; initials = "St"; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index be4b3b2fd..5cf9d37e5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -39,38 +39,38 @@ public class Ring extends KindofMisc { private static final float TIME_TO_EQUIP = 1f; - private static final String TXT_IDENTIFY = + private static final String TXT_IDENTIFY = "you are now familiar enough with your %s to identify it. It is %s."; protected Buff buff; private static final Class[] rings = { - RingOfAccuracy.class, - RingOfEvasion.class, - RingOfElements.class, - RingOfForce.class, - RingOfFuror.class, - RingOfHaste.class, + RingOfAccuracy.class, + RingOfEvasion.class, + RingOfElements.class, + RingOfForce.class, + RingOfFuror.class, + RingOfHaste.class, RingOfMagic.class, RingOfMight.class, - RingOfSharpshooting.class, - RingOfTenacity.class, - RingOfWealth.class, + RingOfSharpshooting.class, + RingOfTenacity.class, + RingOfWealth.class, }; - private static final String[] gems = + private static final String[] gems = {"diamond", "opal", "garnet", "ruby", "amethyst", "topaz", "onyx", "tourmaline", "emerald", "sapphire", "quartz", "agate"}; private static final Integer[] images = { - ItemSpriteSheet.RING_DIAMOND, - ItemSpriteSheet.RING_OPAL, - ItemSpriteSheet.RING_GARNET, - ItemSpriteSheet.RING_RUBY, - ItemSpriteSheet.RING_AMETHYST, - ItemSpriteSheet.RING_TOPAZ, - ItemSpriteSheet.RING_ONYX, - ItemSpriteSheet.RING_TOURMALINE, - ItemSpriteSheet.RING_EMERALD, - ItemSpriteSheet.RING_SAPPHIRE, - ItemSpriteSheet.RING_QUARTZ, + ItemSpriteSheet.RING_DIAMOND, + ItemSpriteSheet.RING_OPAL, + ItemSpriteSheet.RING_GARNET, + ItemSpriteSheet.RING_RUBY, + ItemSpriteSheet.RING_AMETHYST, + ItemSpriteSheet.RING_TOPAZ, + ItemSpriteSheet.RING_ONYX, + ItemSpriteSheet.RING_TOURMALINE, + ItemSpriteSheet.RING_EMERALD, + ItemSpriteSheet.RING_SAPPHIRE, + ItemSpriteSheet.RING_QUARTZ, ItemSpriteSheet.RING_AGATE}; private static ItemStatusHandler handler; @@ -95,7 +95,7 @@ public class Ring extends KindofMisc { public Ring() { super(); - syncVisuals(); + syncVisuals(); } public void syncVisuals() { @@ -148,27 +148,27 @@ public class Ring extends KindofMisc { buff.attachTo( ch ); } - @Override - public boolean doUnequip( Hero hero, boolean collect, boolean single ) { - if (super.doUnequip( hero, collect, single )) { + @Override + public boolean doUnequip( Hero hero, boolean collect, boolean single ) { + if (super.doUnequip( hero, collect, single )) { - if (hero.belongings.misc1 == this) { - hero.belongings.misc1 = null; - } else { - hero.belongings.misc2 = null; - } + if (hero.belongings.misc1 == this) { + hero.belongings.misc1 = null; + } else { + hero.belongings.misc2 = null; + } - hero.remove( buff ); - buff = null; + hero.remove( buff ); + buff = null; - return true; + return true; - } else { + } else { - return false; + return false; - } - } + } + } @Override public boolean isEquipped( Hero hero ) { @@ -211,7 +211,7 @@ public class Ring extends KindofMisc { @Override public String desc() { - return + return "This metal band is adorned with a large " + gem + " gem " + "that glitters in the darkness. Who knows what effect it has when worn?"; } @@ -220,7 +220,7 @@ public class Ring extends KindofMisc { public String info() { if (isEquipped( Dungeon.hero )) { - return desc() + "\n\n" + "The " + name() + " is on your finger" + + return desc() + "\n\n" + "The " + name() + " is on your finger" + (cursed ? ", and because it is cursed, you are powerless to remove it." : "." ); } else if (cursed && cursedKnown) { @@ -259,7 +259,7 @@ public class Ring extends KindofMisc { level = -n; cursed = true; } else - level = n; + level = n; return this; } @@ -309,7 +309,7 @@ public class Ring extends KindofMisc { public class RingBuff extends Buff { - private static final String TXT_KNOWN = "This is a %s"; + private static final String TXT_KNOWN = "This is a %s"; public int level; public RingBuff() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java index eb10a6770..207a190c2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java @@ -32,7 +32,7 @@ public class RingOfAccuracy extends Ring { public String desc() { return isKnown() ? "This ring increases your focus, reducing your enemy's ability to dodge your attacks. "+ - "A degraded ring will instead make you easier to evade.": + "A degraded ring will instead make you easier to evade.": super.desc(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java index c1ddc2c12..cb5af88da 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java @@ -36,46 +36,46 @@ public class RingOfEvasion extends Ring { public String desc() { return isKnown() ? "This ring obfuscates the true position of the wearer, making them harder to detect and attack. " + - "This ring is much stronger while the user remains undetected, and if the user is targeted the power of " + - "evasion will slowly fade away, remaining undetected will restore the ring's effectiveness. " + - "A degraded ring will instead make the user easier to detect and strike.": + "This ring is much stronger while the user remains undetected, and if the user is targeted the power of " + + "evasion will slowly fade away, remaining undetected will restore the ring's effectiveness. " + + "A degraded ring will instead make the user easier to detect and strike.": super.desc(); } - //yup, the only ring in the game with logic inside of its class + //yup, the only ring in the game with logic inside of its class public class Evasion extends RingBuff { - public int effectiveLevel; - private int pos; + public int effectiveLevel; + private int pos; - @Override - public boolean attachTo( Char target ) { + @Override + public boolean attachTo( Char target ) { - pos = target.pos; - effectiveLevel = Math.min(0, level); - return super.attachTo(target); - } + pos = target.pos; + effectiveLevel = Math.min(0, level); + return super.attachTo(target); + } - @Override - public boolean act() { + @Override + public boolean act() { - boolean seen = false; + boolean seen = false; - for (Mob enemy : Dungeon.level.mobs.toArray(new Mob[0])){ - if (enemy.focusingHero()) { - seen = true; - break; - } - } + for (Mob enemy : Dungeon.level.mobs.toArray(new Mob[0])){ + if (enemy.focusingHero()) { + seen = true; + break; + } + } - if (level < 1){ - effectiveLevel = level; - } else if (seen) { - effectiveLevel = Math.max(effectiveLevel - 1, 0); - } else { - effectiveLevel = Math.min(effectiveLevel + 1, level); - } + if (level < 1){ + effectiveLevel = level; + } else if (seen) { + effectiveLevel = Math.max(effectiveLevel - 1, 0); + } else { + effectiveLevel = Math.min(effectiveLevel + 1, level); + } - return super.act(); - } + return super.act(); + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java index 53bc49394..ec6d40370 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java @@ -2,39 +2,36 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfForce extends Ring { - { - name = "Ring of Force"; - } + { + name = "Ring of Force"; + } - @Override - protected RingBuff buff( ) { - return new Force(); - } + @Override + protected RingBuff buff( ) { + return new Force(); + } - @Override - public String desc() { - if (isKnown()){ - String desc = "This ring enhances the force of the wearer's blows. " + - "This extra power is largely wasted when wielding weapons, " + - "but an unarmed attack will be made much stronger. " + - "A degraded ring will instead weaken the wearer's blows.\n\n" + - "When unarmed, at your current strength, "; - int str = Dungeon.hero.STR() - 8; - desc += levelKnown ? - "average damage with this ring is " + (str/2+level + (int)(str*0.5f*level) + str*2)/2 + " points per hit.": - "typical average damage with this ring is" + (str/2+1 + (int)(str*0.5f) + str*2)/2 + " points per hit."; - desc += " Wearing a second ring of force would enhance this."; - return desc; - } else - return super.desc(); - } + @Override + public String desc() { + if (isKnown()){ + String desc = "This ring enhances the force of the wearer's blows. " + + "This extra power is largely wasted when wielding weapons, " + + "but an unarmed attack will be made much stronger. " + + "A degraded ring will instead weaken the wearer's blows.\n\n" + + "When unarmed, at your current strength, "; + int str = Dungeon.hero.STR() - 8; + desc += levelKnown ? + "average damage with this ring is " + (str/2+level + (int)(str*0.5f*level) + str*2)/2 + " points per hit.": + "typical average damage with this ring is" + (str/2+1 + (int)(str*0.5f) + str*2)/2 + " points per hit."; + desc += " Wearing a second ring of force would enhance this."; + return desc; + } else + return super.desc(); + } - public class Force extends RingBuff { - } + public class Force extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java index 442d27003..f9d053799 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java @@ -1,28 +1,25 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfFuror extends Ring { - { - name = "Ring of Furor"; - } + { + name = "Ring of Furor"; + } - @Override - protected RingBuff buff( ) { - return new Furor(); - } + @Override + protected RingBuff buff( ) { + return new Furor(); + } - @Override - public String desc() { - return isKnown() ? - "This ring grants the wearer an inner fury, allowing them to attack more rapidly. " + - "This fury works best in large bursts, so slow weapons benefit far more than fast ones. " + - "A degraded ring will instead slow the wearer's speed of attack." : - super.desc(); - } + @Override + public String desc() { + return isKnown() ? + "This ring grants the wearer an inner fury, allowing them to attack more rapidly. " + + "This fury works best in large bursts, so slow weapons benefit far more than fast ones. " + + "A degraded ring will instead slow the wearer's speed of attack." : + super.desc(); + } - public class Furor extends RingBuff { - } + public class Furor extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java index b74855abc..c22b14a38 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java @@ -32,7 +32,7 @@ public class RingOfHaste extends Ring { public String desc() { return isKnown() ? "This ring reduces the stress of movement on the wearer, allowing them to run " + - "at superhuman speeds. A degraded ring will instead weigh the wearer down.": + "at superhuman speeds. A degraded ring will instead weigh the wearer down.": super.desc(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java index cf02dfeda..70c665d01 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java @@ -1,30 +1,27 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfMight extends Ring { - { - name = "Ring of Might"; - } + { + name = "Ring of Might"; + } - @Override - protected RingBuff buff( ) { - return new Might(); - } + @Override + protected RingBuff buff( ) { + return new Might(); + } - @Override - public String desc() { - return isKnown() ? - "This ring enhances the physical traits of the wearer, " + - "granting them greater physical strength and constitution. " + - "A degraded ring will weaken the wearer." : - super.desc(); - } + @Override + public String desc() { + return isKnown() ? + "This ring enhances the physical traits of the wearer, " + + "granting them greater physical strength and constitution. " + + "A degraded ring will weaken the wearer." : + super.desc(); + } - public class Might extends RingBuff { - } + public class Might extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java index ad91dd4e9..e167bd377 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java @@ -1,28 +1,25 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfSharpshooting extends Ring { - { - name = "Ring of Sharpshooting"; - } + { + name = "Ring of Sharpshooting"; + } - @Override - protected RingBuff buff( ) { - return new Aim(); - } + @Override + protected RingBuff buff( ) { + return new Aim(); + } - @Override - public String desc() { - return isKnown() ? - "This ring enhances the wearer's precision and aim, which will " + - "make all projectile weapons more accurate and durable. " + - "A degraded ring will have the opposite effect.": - super.desc(); - } + @Override + public String desc() { + return isKnown() ? + "This ring enhances the wearer's precision and aim, which will " + + "make all projectile weapons more accurate and durable. " + + "A degraded ring will have the opposite effect.": + super.desc(); + } - public class Aim extends RingBuff { - } + public class Aim extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java index e2d727c06..8815fe82a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java @@ -1,29 +1,26 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfTenacity extends Ring { - { - name = "Ring of Tenacity"; - } + { + name = "Ring of Tenacity"; + } - @Override - protected RingBuff buff( ) { - return new Tenacity(); - } + @Override + protected RingBuff buff( ) { + return new Tenacity(); + } - @Override - public String desc() { - return isKnown() ? - "When worn, this ring will allow the wearer to resist normally mortal strikes. " + - "The more injured the user is, the more resistant they will be to damage. " + - "A degraded ring will instead make it easier for enemies to execute the wearer." : - super.desc(); - } + @Override + public String desc() { + return isKnown() ? + "When worn, this ring will allow the wearer to resist normally mortal strikes. " + + "The more injured the user is, the more resistant they will be to damage. " + + "A degraded ring will instead make it easier for enemies to execute the wearer." : + super.desc(); + } - public class Tenacity extends RingBuff { - } + public class Tenacity extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java index 16542a7ee..350d39e82 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java @@ -1,28 +1,25 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; -/** - * Created by debenhame on 10/09/2014. - */ public class RingOfWealth extends Ring { - { - name = "Ring of Wealth"; - } + { + name = "Ring of Wealth"; + } - @Override - protected RingBuff buff( ) { - return new Wealth(); - } + @Override + protected RingBuff buff( ) { + return new Wealth(); + } - @Override - public String desc() { - return isKnown() ? - "It's not clear what this ring does exactly, good luck may influence " + - "the life an an adventurer in many subtle ways. " + - "Naturally a degraded ring would give bad luck." : - super.desc(); - } + @Override + public String desc() { + return isKnown() ? + "It's not clear what this ring does exactly, good luck may influence " + + "the life an an adventurer in many subtle ways. " + + "Naturally a degraded ring would give bad luck." : + super.desc(); + } - public class Wealth extends RingBuff { - } + public class Wealth extends RingBuff { + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java index 24cc1c651..1fe138a34 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java @@ -30,7 +30,7 @@ public abstract class InventoryScroll extends Scroll { protected String inventoryTitle = "Select an item"; protected WndBag.Mode mode = WndBag.Mode.ALL; - private static final String TXT_WARNING = + private static final String TXT_WARNING = "Do you really want to cancel this scroll usage? " + "It will be consumed anyway."; private static final String TXT_YES = "Yes, I'm positive"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index b9274c426..a31ca4ce1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -44,12 +44,12 @@ public abstract class Scroll extends Item { protected String initials; private static final Class[] scrolls = { - ScrollOfIdentify.class, - ScrollOfMagicMapping.class, - ScrollOfRecharging.class, - ScrollOfRemoveCurse.class, - ScrollOfTeleportation.class, - ScrollOfUpgrade.class, + ScrollOfIdentify.class, + ScrollOfMagicMapping.class, + ScrollOfRecharging.class, + ScrollOfRemoveCurse.class, + ScrollOfTeleportation.class, + ScrollOfUpgrade.class, ScrollOfRage.class, ScrollOfTerror.class, ScrollOfLullaby.class, @@ -57,20 +57,20 @@ public abstract class Scroll extends Item { ScrollOfPsionicBlast.class, ScrollOfMirrorImage.class }; - private static final String[] runes = + private static final String[] runes = {"KAUNAN", "SOWILO", "LAGUZ", "YNGVI", "GYFU", "RAIDO", "ISAZ", "MANNAZ", "NAUDIZ", "BERKANAN", "ODAL", "TIWAZ"}; private static final Integer[] images = { - ItemSpriteSheet.SCROLL_KAUNAN, - ItemSpriteSheet.SCROLL_SOWILO, - ItemSpriteSheet.SCROLL_LAGUZ, - ItemSpriteSheet.SCROLL_YNGVI, - ItemSpriteSheet.SCROLL_GYFU, - ItemSpriteSheet.SCROLL_RAIDO, - ItemSpriteSheet.SCROLL_ISAZ, - ItemSpriteSheet.SCROLL_MANNAZ, - ItemSpriteSheet.SCROLL_NAUDIZ, - ItemSpriteSheet.SCROLL_BERKANAN, - ItemSpriteSheet.SCROLL_ODAL, + ItemSpriteSheet.SCROLL_KAUNAN, + ItemSpriteSheet.SCROLL_SOWILO, + ItemSpriteSheet.SCROLL_LAGUZ, + ItemSpriteSheet.SCROLL_YNGVI, + ItemSpriteSheet.SCROLL_GYFU, + ItemSpriteSheet.SCROLL_RAIDO, + ItemSpriteSheet.SCROLL_ISAZ, + ItemSpriteSheet.SCROLL_MANNAZ, + ItemSpriteSheet.SCROLL_NAUDIZ, + ItemSpriteSheet.SCROLL_BERKANAN, + ItemSpriteSheet.SCROLL_ODAL, ItemSpriteSheet.SCROLL_TIWAZ}; private static ItemStatusHandler handler; @@ -80,7 +80,7 @@ public abstract class Scroll extends Item { public boolean ownedByBook = false; { - stackable = true; + stackable = true; defaultAction = AC_READ; } @@ -103,11 +103,11 @@ public abstract class Scroll extends Item { syncVisuals(); } - @Override - public void syncVisuals(){ - image = handler.image( this ); - rune = handler.label( this ); - }; + @Override + public void syncVisuals(){ + image = handler.image( this ); + rune = handler.label( this ); + }; @Override public ArrayList actions( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfIdentify.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfIdentify.java index 9b01d7bf4..3917c3a48 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfIdentify.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfIdentify.java @@ -32,7 +32,7 @@ public class ScrollOfIdentify extends InventoryScroll { inventoryTitle = "Select an item to identify"; mode = WndBag.Mode.UNIDENTIFED; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java index a4847c7b1..33a9c6f92 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java @@ -45,11 +45,11 @@ public class ScrollOfLullaby extends Scroll { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { if (Level.fieldOfView[mob.pos]) { Buff.affect( mob, Drowsy.class ); - mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 ); + mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 ); } } - Buff.affect( curUser, Drowsy.class ); + Buff.affect( curUser, Drowsy.class ); GLog.i( "The scroll utters a soothing melody. You feel very sleepy." ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java index a7d6ceb60..de59c97c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java @@ -37,7 +37,7 @@ public class ScrollOfMagicalInfusion extends InventoryScroll { inventoryTitle = "Select an item to infuse"; mode = WndBag.Mode.ENCHANTABLE; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java index 24b5265e1..aec340f84 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java @@ -74,7 +74,7 @@ public class ScrollOfMirrorImage extends Scroll { @Override public String desc() { - return + return "The incantation on this scroll will create illusionary twins of the reader, which will chase his enemies."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java index 4098ce3d8..a1bd4311c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java @@ -38,7 +38,7 @@ public class ScrollOfPsionicBlast extends Scroll { name = "Scroll of Psionic Blast"; initials = "PB"; - bones = true; + bones = true; } @Override @@ -56,7 +56,7 @@ public class ScrollOfPsionicBlast extends Scroll { } curUser.damage(Math.max(curUser.HT/5, curUser.HP/2), this); - Buff.prolong( curUser, Paralysis.class, Random.Int( 4, 6 ) ); + Buff.prolong( curUser, Paralysis.class, Random.Int( 4, 6 ) ); Buff.prolong( curUser, Blindness.class, Random.Int( 6, 9 ) ); Dungeon.observe(); @@ -64,10 +64,10 @@ public class ScrollOfPsionicBlast extends Scroll { curUser.spendAndNext( TIME_TO_READ ); - if (!curUser.isAlive()) { - Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name )); - GLog.n("The Psionic Blast tears your mind apart..."); - } + if (!curUser.isAlive()) { + Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name )); + GLog.n("The Psionic Blast tears your mind apart..."); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java index d90bedc58..4e99bcd61 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java @@ -40,12 +40,12 @@ public class ScrollOfRage extends Scroll { @Override protected void doRead() { - for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - mob.beckon( curUser.pos ); - if (Level.fieldOfView[mob.pos]) { - Buff.prolong(mob, Amok.class, 5f); - } - } + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { + mob.beckon( curUser.pos ); + if (Level.fieldOfView[mob.pos]) { + Buff.prolong(mob, Amok.class, 5f); + } + } for (Heap heap : Dungeon.level.heaps.values()) { if (heap.type == Heap.Type.MIMIC) { @@ -60,7 +60,7 @@ public class ScrollOfRage extends Scroll { GLog.w( "The scroll emits an enraging roar that echoes throughout the dungeon!" ); setKnown(); - curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); + curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); Sample.INSTANCE.play( Assets.SND_CHALLENGE ); Invisibility.dispel(); @@ -69,7 +69,7 @@ public class ScrollOfRage extends Scroll { @Override public String desc() { - return + return "When read aloud, this scroll will unleash a great roar " + "that draws all enemies to the reader, and enrages nearby ones."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java index 71f39bc77..88bd08665 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java @@ -30,9 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; public class ScrollOfRemoveCurse extends Scroll { - private static final String TXT_PROCCED = + private static final String TXT_PROCCED = "Your pack glows with a cleansing light, and a malevolent energy disperses."; - private static final String TXT_NOT_PROCCED = + private static final String TXT_NOT_PROCCED = "Your pack glows with a cleansing light, but nothing happens."; { @@ -47,19 +47,19 @@ public class ScrollOfRemoveCurse extends Scroll { Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); - boolean procced = uncurse( curUser, curUser.belongings.backpack.items.toArray( new Item[0] ) ); - procced = uncurse( curUser, - curUser.belongings.weapon, - curUser.belongings.armor, + boolean procced = uncurse( curUser, curUser.belongings.backpack.items.toArray( new Item[0] ) ); + procced = uncurse( curUser, + curUser.belongings.weapon, + curUser.belongings.armor, curUser.belongings.misc1, curUser.belongings.misc2) || procced; Weakness.detach( curUser, Weakness.class ); if (procced) { - GLog.p( TXT_PROCCED ); - } else { - GLog.i( TXT_NOT_PROCCED ); + GLog.p( TXT_PROCCED ); + } else { + GLog.i( TXT_NOT_PROCCED ); } setKnown(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java index 55f92f769..69fa26900 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java @@ -29,10 +29,10 @@ import com.watabou.noosa.tweeners.AlphaTweener; public class ScrollOfTeleportation extends Scroll { - public static final String TXT_TELEPORTED = + public static final String TXT_TELEPORTED = "In a blink of an eye you were teleported to another location of the level."; - public static final String TXT_NO_TELEPORT = + public static final String TXT_NO_TELEPORT = "Strong magic aura of this place prevents you from teleporting!"; { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java index 81039c1d5..ee8d8675d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java @@ -36,7 +36,7 @@ public class ScrollOfUpgrade extends InventoryScroll { inventoryTitle = "Select an item to upgrade"; mode = WndBag.Mode.UPGRADEABLE; - bones = true; + bones = true; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 78f358b05..7504962a7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -62,7 +62,7 @@ public abstract class Wand extends Item { public int maxCharges = initialCharges(); public int curCharges = maxCharges; - public float partialCharge = 0f; + public float partialCharge = 0f; protected Charger charger; @@ -128,10 +128,10 @@ public abstract class Wand extends Item { charger.setScaleFactor( chargeScaleFactor ); } - @Override - public void onDetach( ) { - stopCharging(); - } + @Override + public void onDetach( ) { + stopCharging(); + } public void stopCharging() { if (charger != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 466a7f944..d4df86c57 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -27,9 +27,6 @@ import com.watabou.utils.Callback; import com.watabou.utils.PointF; import com.watabou.utils.Random; -/** - * Created by debenhame on 05/05/2015. - */ public class WandOfBlastWave extends Wand { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index 904314b88..21d0e12d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -24,9 +24,6 @@ import com.watabou.utils.Random; import java.util.Arrays; import java.util.HashSet; -/** - * Created by Evan on 14/05/2015. - */ //TODO: balancing public class WandOfCorruption extends Wand { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java index c808be28c..fa04c2494 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java @@ -19,9 +19,6 @@ import com.watabou.utils.Callback; import com.watabou.utils.PointF; import com.watabou.utils.Random; -/** - * Created by debenhame on 23/04/2015. - */ public class WandOfFrost extends Wand { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java index 0c11e4ac1..cd5e29cb9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java @@ -32,132 +32,129 @@ import com.watabou.utils.Random; import java.util.Arrays; import java.util.HashSet; -/** - * Created by Evan on 10/04/2015. - */ public class WandOfPrismaticLight extends Wand { - { - name = "Wand of Prismatic Light"; - image = ItemSpriteSheet.WAND_PRISMATIC_LIGHT; + { + name = "Wand of Prismatic Light"; + image = ItemSpriteSheet.WAND_PRISMATIC_LIGHT; - collisionProperties = Ballistica.MAGIC_BOLT; - } + collisionProperties = Ballistica.MAGIC_BOLT; + } - //FIXME: this is sloppy - private static HashSet evilMobs = new HashSet(Arrays.asList( - //Any Location - Mimic.class, Wraith.class, - //Sewers - Ghost.FetidRat.class, - Goo.class, - //Prison - Skeleton.class , Thief.class, Bandit.class, - //Caves + //FIXME: this is sloppy + private static HashSet evilMobs = new HashSet(Arrays.asList( + //Any Location + Mimic.class, Wraith.class, + //Sewers + Ghost.FetidRat.class, + Goo.class, + //Prison + Skeleton.class , Thief.class, Bandit.class, + //Caves - //City - Warlock.class, Monk.class, Senior.class, - King.class, King.Undead.class, - //Halls - Succubus.class, Eye.class, Scorpio.class, Acidic.class, - Yog.class, Yog.RottingFist.class, Yog.BurningFist.class, Yog.Larva.class - )); + //City + Warlock.class, Monk.class, Senior.class, + King.class, King.Undead.class, + //Halls + Succubus.class, Eye.class, Scorpio.class, Acidic.class, + Yog.class, Yog.RottingFist.class, Yog.BurningFist.class, Yog.Larva.class + )); - @Override - protected void onZap(Ballistica beam) { - Char ch = Actor.findChar(beam.collisionPos); - if (ch != null){ - affectTarget(ch); - } - affectMap(beam); + @Override + protected void onZap(Ballistica beam) { + Char ch = Actor.findChar(beam.collisionPos); + if (ch != null){ + affectTarget(ch); + } + affectMap(beam); - if (curUser.viewDistance < 4) - Buff.prolong( curUser, Light.class, 10f+level*5); - } + if (curUser.viewDistance < 4) + Buff.prolong( curUser, Light.class, 10f+level*5); + } - private void affectTarget(Char ch){ - int dmg = Random.NormalIntRange(level, (int) (8+(level*(level/5f)))); + private void affectTarget(Char ch){ + int dmg = Random.NormalIntRange(level, (int) (8+(level*(level/5f)))); - //three in (5+lvl) chance of failing - if (Random.Int(5+level) >= 3) { - Buff.prolong(ch, Blindness.class, 2f + (level * 0.34f)); - ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 ); - } + //three in (5+lvl) chance of failing + if (Random.Int(5+level) >= 3) { + Buff.prolong(ch, Blindness.class, 2f + (level * 0.34f)); + ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 ); + } - if (evilMobs.contains(ch.getClass())){ - ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level ); - Sample.INSTANCE.play(Assets.SND_BURNING); + if (evilMobs.contains(ch.getClass())){ + ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level ); + Sample.INSTANCE.play(Assets.SND_BURNING); - ch.damage((int)(dmg*1.5), this); - } else { - ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level ); + ch.damage((int)(dmg*1.5), this); + } else { + ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level ); - ch.damage(dmg, this); - } + ch.damage(dmg, this); + } - } + } - private void affectMap(Ballistica beam){ - boolean noticed = false; - for (int c: beam.subPath(0, beam.dist)){ - for (int n : Level.NEIGHBOURS9DIST2){ - int cell = c+n; - if (!Level.insideMap(cell)) - continue; + private void affectMap(Ballistica beam){ + boolean noticed = false; + for (int c: beam.subPath(0, beam.dist)){ + for (int n : Level.NEIGHBOURS9DIST2){ + int cell = c+n; + if (!Level.insideMap(cell)) + continue; - if (Level.discoverable[cell]) - Dungeon.level.mapped[cell] = true; + if (Level.discoverable[cell]) + Dungeon.level.mapped[cell] = true; - int terr = Dungeon.level.map[cell]; - if ((Terrain.flags[terr] & Terrain.SECRET) != 0) { + int terr = Dungeon.level.map[cell]; + if ((Terrain.flags[terr] & Terrain.SECRET) != 0) { - Dungeon.level.discover( cell ); + Dungeon.level.discover( cell ); - GameScene.discoverTile( cell, terr ); - ScrollOfMagicMapping.discover(cell); + GameScene.discoverTile( cell, terr ); + ScrollOfMagicMapping.discover(cell); - noticed = true; - } - } + noticed = true; + } + } - CellEmitter.center(c).burst( RainbowParticle.BURST, Random.IntRange( 1, 2 ) ); - } - if (noticed) - Sample.INSTANCE.play( Assets.SND_SECRET ); + CellEmitter.center(c).burst( RainbowParticle.BURST, Random.IntRange( 1, 2 ) ); + } + if (noticed) + Sample.INSTANCE.play( Assets.SND_SECRET ); - Dungeon.observe(); - } + Dungeon.observe(); + } - @Override - protected void fx( Ballistica beam, Callback callback ) { - curUser.sprite.parent.add( - new Beam.LightRay(curUser.sprite.center(), DungeonTilemap.tileCenterToWorld(beam.collisionPos))); - callback.call(); - } + @Override + protected void fx( Ballistica beam, Callback callback ) { + curUser.sprite.parent.add( + new Beam.LightRay(curUser.sprite.center(), DungeonTilemap.tileCenterToWorld(beam.collisionPos))); + callback.call(); + } - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - //cripples enemy - Buff.prolong( defender, Cripple.class, 1f+staff.level); - } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //cripples enemy + Buff.prolong( defender, Cripple.class, 1f+staff.level); + } - @Override - public void staffFx(MagesStaff.StaffParticle particle) { - particle.color( Random.Int( 0x1000000 ) ); - particle.am = 0.3f; - particle.setLifespan(1f); - particle.speed.polar(Random.Float(PointF.PI2), 2f); - particle.setSize( 1f, 2.5f); - particle.radiateXY(1f); - } + @Override + public void staffFx(MagesStaff.StaffParticle particle) { + particle.color( Random.Int( 0x1000000 ) ); + particle.am = 0.3f; + particle.setLifespan(1f); + particle.speed.polar(Random.Float(PointF.PI2), 2f); + particle.setSize( 1f, 2.5f); + particle.radiateXY(1f); + } - @Override - public String desc() { - return - "This wand is made of a solid piece of translucent crystal, like a long chunk of smooth glass. " + - "It becomes clear towards the tip, where you can see colorful lights dancing around inside it.\n\n" + - "This wand shoots rays of light which damage and blind enemies and cut through the darkness of the dungeon, " + - "revealing hidden areas and traps. Evildoers, demons, and the undead will burn in the bright light " + - "of the wand, taking significant bonus damage."; - } + @Override + public String desc() { + return + "This wand is made of a solid piece of translucent crystal, like a long chunk of smooth glass. " + + "It becomes clear towards the tip, where you can see colorful lights dancing around inside it.\n\n" + + "This wand shoots rays of light which damage and blind enemies and cut through the darkness of the dungeon, " + + "revealing hidden areas and traps. Evildoers, demons, and the undead will burn in the bright light " + + "of the wand, taking significant bonus damage."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java index 7fe6c0a77..edffa2044 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java @@ -39,9 +39,6 @@ import com.watabou.utils.Random; import java.util.Arrays; import java.util.HashSet; -/** - * Created by debenhame on 13/05/2015. - */ public class WandOfTransfusion extends Wand { { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java index cb26da768..bd9ab97d8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java @@ -13,51 +13,48 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; -/** - * Created by Evan on 12/04/2015. - */ public class WandOfVenom extends Wand { - { - name = "Wand of Venom"; - image = ItemSpriteSheet.WAND_VENOM; + { + name = "Wand of Venom"; + image = ItemSpriteSheet.WAND_VENOM; - collisionProperties = Ballistica.STOP_TARGET | Ballistica.STOP_TERRAIN; - } + collisionProperties = Ballistica.STOP_TARGET | Ballistica.STOP_TERRAIN; + } - @Override - protected void onZap(Ballistica bolt) { - Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class); - ((VenomGas)venomGas).setStrength(level+1); - GameScene.add(venomGas); - } + @Override + protected void onZap(Ballistica bolt) { + Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class); + ((VenomGas)venomGas).setStrength(level+1); + GameScene.add(venomGas); + } - @Override - protected void fx(Ballistica bolt, Callback callback) { - MagicMissile.poison(curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback); - Sample.INSTANCE.play(Assets.SND_ZAP); - } + @Override + protected void fx(Ballistica bolt, Callback callback) { + MagicMissile.poison(curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback); + Sample.INSTANCE.play(Assets.SND_ZAP); + } - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - new Poison().proc(staff, attacker, defender, damage); - } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + new Poison().proc(staff, attacker, defender, damage); + } - @Override - public void staffFx(MagesStaff.StaffParticle particle) { - particle.color( 0x8844FF ); particle.am = 0.6f; - particle.setLifespan(0.6f); - particle.acc.set(0, 40); - particle.setSize( 0f, 3f); - particle.shuffleXY(2f); - } + @Override + public void staffFx(MagesStaff.StaffParticle particle) { + particle.color( 0x8844FF ); particle.am = 0.6f; + particle.setLifespan(0.6f); + particle.acc.set(0, 40); + particle.setSize( 0f, 3f); + particle.shuffleXY(2f); + } - @Override - public String desc() { - return - "This wand has a purple body which opens to a brilliant green gem. " + - "A small amount of foul smelling gas leaks from the gem.\n\n" + - "This wand shoots a bolt which explodes into a cloud of vile venomous gas at a targeted location. " + - "Anything caught inside this cloud will take continual damage, increasing with time."; - } + @Override + public String desc() { + return + "This wand has a purple body which opens to a brilliant green gem. " + + "A small amount of foul smelling gas leaks from the gem.\n\n" + + "This wand shoots a bolt which explodes into a cloud of vile venomous gas at a targeted location. " + + "Anything caught inside this cloud will take continual damage, increasing with time."; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index ba51dfc4e..1b448c440 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -42,7 +42,7 @@ public class Weapon extends KindOfWeapon { private static final String TXT_IDENTIFY = "You are now familiar enough with your %s to identify it. It is %s."; - private static final String TXT_INCOMPATIBLE = + private static final String TXT_INCOMPATIBLE = "Interaction of different types of magic has negated the enchantment on this weapon!"; private static final String TXT_TO_STRING = "%s :%d"; @@ -50,10 +50,10 @@ public class Weapon extends KindOfWeapon { public float ACU = 1; // Accuracy modifier public float DLY = 1f; // Speed modifier - public enum Imbue { - NONE, LIGHT, HEAVY - } - public Imbue imbue = Imbue.NONE; + public enum Imbue { + NONE, LIGHT, HEAVY + } + public Imbue imbue = Imbue.NONE; private int hitsToKnow = HITS_TO_KNOW; @@ -84,7 +84,7 @@ public class Weapon extends KindOfWeapon { super.storeInBundle( bundle ); bundle.put( UNFAMILIRIARITY, hitsToKnow ); bundle.put( ENCHANTMENT, enchantment ); - bundle.put( IMBUE, imbue ); + bundle.put( IMBUE, imbue ); } @Override @@ -94,7 +94,7 @@ public class Weapon extends KindOfWeapon { hitsToKnow = HITS_TO_KNOW; } enchantment = (Enchantment)bundle.get( ENCHANTMENT ); - imbue = bundle.getEnum( IMBUE, Imbue.class ); + imbue = bundle.getEnum( IMBUE, Imbue.class ); } @Override @@ -102,7 +102,7 @@ public class Weapon extends KindOfWeapon { int encumbrance = STR - hero.STR(); - float ACU = this.ACU; + float ACU = this.ACU; if (this instanceof MissileWeapon) { switch (hero.heroClass) { @@ -114,14 +114,14 @@ public class Weapon extends KindOfWeapon { break; default: } - int bonus = 0; - for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { - bonus += ((RingOfSharpshooting.Aim)buff).level; - } - ACU *= (float)(Math.pow(1.1, bonus)); + int bonus = 0; + for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { + bonus += ((RingOfSharpshooting.Aim)buff).level; + } + ACU *= (float)(Math.pow(1.1, bonus)); } - return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU; + return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU; } @Override @@ -132,17 +132,17 @@ public class Weapon extends KindOfWeapon { encumrance -= 2; } - float DLY = this.DLY * (imbue == Imbue.LIGHT ? 0.667f : (imbue == Imbue.HEAVY ? 1.667f : 1.0f)); + float DLY = this.DLY * (imbue == Imbue.LIGHT ? 0.667f : (imbue == Imbue.HEAVY ? 1.667f : 1.0f)); - int bonus = 0; - for (Buff buff : hero.buffs(RingOfFuror.Furor.class)) { - bonus += ((RingOfFuror.Furor)buff).level; - } + int bonus = 0; + for (Buff buff : hero.buffs(RingOfFuror.Furor.class)) { + bonus += ((RingOfFuror.Furor)buff).level; + } - DLY = (float)(0.25 + (DLY - 0.25)*Math.pow(0.8, bonus)); + DLY = (float)(0.25 + (DLY - 0.25)*Math.pow(0.8, bonus)); - return - (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY); + return + (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY); } @Override @@ -160,7 +160,7 @@ public class Weapon extends KindOfWeapon { return Math.round(damage * (imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1f))); } - public Item upgrade( boolean enchant ) { + public Item upgrade( boolean enchant ) { if (enchantment != null) { if (!enchant && Random.Int( level ) > 0) { GLog.w( TXT_INCOMPATIBLE ); @@ -233,8 +233,8 @@ public class Weapon extends KindOfWeapon { //FIXME: most enchantment names are pretty broken, should refactor public static abstract class Enchantment implements Bundlable { - private static final Class[] enchants = new Class[]{ - Fire.class, Poison.class, Death.class, Paralysis.class, Leech.class, + private static final Class[] enchants = new Class[]{ + Fire.class, Poison.class, Death.class, Paralysis.class, Leech.class, Slow.class, Shock.class, Instability.class, Horror.class, Luck.class }; private static final float[] chances= new float[]{ 10, 10, 1, 2, 1, 2, 6, 3, 2, 2 }; @@ -245,11 +245,11 @@ public class Weapon extends KindOfWeapon { } @Override - public void restoreFromBundle( Bundle bundle ) { + public void restoreFromBundle( Bundle bundle ) { } @Override - public void storeInBundle( Bundle bundle ) { + public void storeInBundle( Bundle bundle ) { } public ItemSprite.Glowing glowing() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java index b0c3c2baa..bcaa3006e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java @@ -42,9 +42,9 @@ public class Horror extends Weapon.Enchantment { if (Random.Int( level + 5 ) >= 4) { - if (defender == Dungeon.hero) { - Buff.affect( defender, Vertigo.class, Vertigo.duration(defender) ); - } else { + if (defender == Dungeon.hero) { + Buff.affect( defender, Vertigo.class, Vertigo.duration(defender) ); + } else { Buff.affect( defender, Terror.class, Terror.DURATION ).object = attacker.id(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 067cc145b..c863e2a47 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -25,9 +25,6 @@ import com.watabou.utils.Random; import java.util.ArrayList; -/** - * Created by debenhame on 13/03/2015. - */ public class MagesStaff extends MeleeWeapon { private Wand wand; @@ -61,8 +58,8 @@ public class MagesStaff extends MeleeWeapon { public MagesStaff(Wand wand){ this(); - wand.identify(); - wand.cursed = false; + wand.identify(); + wand.cursed = false; this.wand = wand; wand.maxCharges = Math.min(wand.maxCharges + 1, 10); wand.curCharges = wand.maxCharges; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index df2bc4da9..5f19ed06e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -55,7 +55,7 @@ public class MeleeWeapon extends Weapon { } public Item upgrade( boolean enchant ) { - STR--; + STR--; MIN++; MAX += tier; @@ -67,7 +67,7 @@ public class MeleeWeapon extends Weapon { } @Override - public Item degrade() { + public Item degrade() { STR++; MIN--; MAX -= tier; @@ -92,10 +92,10 @@ public class MeleeWeapon extends Weapon { if (levelKnown) { info.append( "Its average damage is " + - Math.round((MIN + (MAX - MIN) / 2)*(imbue == Imbue.LIGHT ? 0.75f : (imbue == Imbue.HEAVY ? 1.5f : 1))) - + " points per hit. " ); + Math.round((MIN + (MAX - MIN) / 2)*(imbue == Imbue.LIGHT ? 0.75f : (imbue == Imbue.HEAVY ? 1.5f : 1))) + + " points per hit. " ); } else { - info.append( + info.append( "Its typical average damage is " + (min() + (max() - min()) / 2) + " points per hit " + "and usually it requires " + typicalSTR() + " points of strength. " ); if (typicalSTR() > Dungeon.hero.STR()) { @@ -116,16 +116,16 @@ public class MeleeWeapon extends Weapon { info.append( " weapon. "); } else if (ACU != 1f) { info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " ); - } - switch (imbue) { - case LIGHT: - info.append( "It was balanced to be lighter. " ); - break; - case HEAVY: - info.append( "It was balanced to be heavier. " ); - break; - case NONE: - } + } + switch (imbue) { + case LIGHT: + info.append( "It was balanced to be lighter. " ); + break; + case HEAVY: + info.append( "It was balanced to be heavier. " ); + break; + case NONE: + } if (enchantment != null) { info.append( "It is enchanted." ); @@ -134,13 +134,13 @@ public class MeleeWeapon extends Weapon { if (levelKnown && Dungeon.hero.belongings.backpack.items.contains( this )) { if (STR > Dungeon.hero.STR()) { info.append( p ); - info.append( + info.append( "Because of your inadequate strength the accuracy and speed " + "of your attack with this " + name + " is decreased." ); } if (STR < Dungeon.hero.STR()) { info.append( p ); - info.append( + info.append( "Because of your excess strength the damage " + "of your attack with this " + name + " is increased." ); } @@ -148,8 +148,8 @@ public class MeleeWeapon extends Weapon { if (isEquipped( Dungeon.hero )) { info.append( p ); - info.append( "You hold the " + name + " at the ready" + - (cursed ? ", and because it is cursed, you are powerless to let go." : ".") ); + info.append( "You hold the " + name + " at the ready" + + (cursed ? ", and because it is cursed, you are powerless to let go." : ".") ); } else { if (cursedKnown && cursed) { info.append( p ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java index fc7dae6bb..6bf217aef 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java @@ -37,9 +37,9 @@ public class ShortSword extends MeleeWeapon { private static final String TXT_SELECT_WEAPON = "Select a weapon to upgrade"; - private static final String TXT_REFORGED = + private static final String TXT_REFORGED = "you reforged the short sword to upgrade your %s"; - private static final String TXT_NOT_BOOMERANG = + private static final String TXT_NOT_BOOMERANG = "you can't upgrade a boomerang this way"; private static final float TIME_TO_REFORGE = 2f; @@ -51,7 +51,7 @@ public class ShortSword extends MeleeWeapon { image = ItemSpriteSheet.SHORT_SWORD; unique = true; - bones = false; + bones = false; } public ShortSword() { @@ -95,7 +95,7 @@ public class ShortSword extends MeleeWeapon { @Override public String desc() { - return + return "It is indeed quite short, just a few inches longer, than a dagger."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java index 0345c93db..3251eb6a5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java @@ -32,7 +32,7 @@ public class WarHammer extends MeleeWeapon { @Override public String desc() { - return + return "Few creatures can withstand the crushing blow of this towering mass of lead and steel, " + "but only the strongest of adventurers can use it effectively."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java index c5e82d0c4..7a2fb7ec6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java @@ -37,8 +37,8 @@ public class Boomerang extends MissileWeapon { stackable = false; - unique = true; - bones = false; + unique = true; + bones = false; } @Override @@ -69,56 +69,56 @@ public class Boomerang extends MissileWeapon { return super.degrade(); } - @Override - public void proc( Char attacker, Char defender, int damage ) { - super.proc( attacker, defender, damage ); - if (attacker instanceof Hero && ((Hero)attacker).rangedWeapon == this) { - circleBack( defender.pos, (Hero)attacker ); - } - } + @Override + public void proc( Char attacker, Char defender, int damage ) { + super.proc( attacker, defender, damage ); + if (attacker instanceof Hero && ((Hero)attacker).rangedWeapon == this) { + circleBack( defender.pos, (Hero)attacker ); + } + } - @Override - protected void miss( int cell ) { - circleBack( cell, curUser ); - } + @Override + protected void miss( int cell ) { + circleBack( cell, curUser ); + } - private void circleBack( int from, Hero owner ) { + private void circleBack( int from, Hero owner ) { - ((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )). - reset( from, curUser.pos, curItem, null ); + ((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )). + reset( from, curUser.pos, curItem, null ); - if (throwEquiped) { - owner.belongings.weapon = this; - owner.spend( -TIME_TO_EQUIP ); + if (throwEquiped) { + owner.belongings.weapon = this; + owner.spend( -TIME_TO_EQUIP ); Dungeon.quickslot.replaceSimilar(this); updateQuickslot(); - } else - if (!collect( curUser.belongings.backpack )) { - Dungeon.level.drop( this, owner.pos ).sprite.drop(); - } - } + } else + if (!collect( curUser.belongings.backpack )) { + Dungeon.level.drop( this, owner.pos ).sprite.drop(); + } + } - private boolean throwEquiped; + private boolean throwEquiped; - @Override - public void cast( Hero user, int dst ) { - throwEquiped = isEquipped( user ); - super.cast( user, dst ); - } + @Override + public void cast( Hero user, int dst ) { + throwEquiped = isEquipped( user ); + super.cast( user, dst ); + } @Override public String desc() { String info = "Thrown to the enemy this flat curved wooden missile will return to the hands of its thrower."; - switch (imbue) { - case LIGHT: - info += "\n\nIt was balanced to be lighter. "; - break; - case HEAVY: - info += "\n\nIt was balanced to be heavier. "; - break; - case NONE: - } - return info; + switch (imbue) { + case LIGHT: + info += "\n\nIt was balanced to be lighter. "; + break; + case HEAVY: + info += "\n\nIt was balanced to be heavier. "; + break; + case NONE: + } + return info; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java index 67ee0d6b3..e3116ea7d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java @@ -55,7 +55,7 @@ public class CurareDart extends MissileWeapon { @Override public String desc() { - return + return "These little evil darts don't do much damage but they can paralyze " + "the target leaving it helpless and motionless for some time."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java index d10a82028..1c176c747 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java @@ -30,7 +30,7 @@ public class Dart extends MissileWeapon { MIN = 1; MAX = 4; - bones = false; //Finding them in bones would be semi-frequent and disappointing. + bones = false; //Finding them in bones would be semi-frequent and disappointing. } public Dart() { @@ -44,7 +44,7 @@ public class Dart extends MissileWeapon { @Override public String desc() { - return + return "These simple metal spikes are weighted to fly true and " + "sting their prey with a flick of the wrist."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java index 3085c344c..07a0712be 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java @@ -69,7 +69,7 @@ public class IncendiaryDart extends MissileWeapon { @Override public String desc() { - return + return "The spike on each of these darts is designed to pin it to its target " + "while the unstable compounds strapped to its length burst into brilliant flames."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java index 1b1fe1013..2dac16d3a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java @@ -53,7 +53,7 @@ public class Javelin extends MissileWeapon { @Override public String desc() { - return + return "This length of metal is weighted to keep the spike " + "at its tip foremost as it sails through the air."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 44427ec04..6ca172a7d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -38,7 +38,7 @@ public class MissileWeapon extends Weapon { private static final String TXT_MISSILES = "Missile weapon"; private static final String TXT_YES = "Yes, I know what I'm doing"; private static final String TXT_NO = "No, I changed my mind"; - private static final String TXT_R_U_SURE = + private static final String TXT_R_U_SURE = "Do you really want to equip it as a melee weapon?"; { @@ -61,37 +61,37 @@ public class MissileWeapon extends Weapon { protected void onThrow( int cell ) { Char enemy = Actor.findChar( cell ); if (enemy == null || enemy == curUser) { - if (this instanceof Boomerang) - super.onThrow( cell ); - else - miss( cell ); + if (this instanceof Boomerang) + super.onThrow( cell ); + else + miss( cell ); } else { if (!curUser.shoot( enemy, this )) { miss( cell ); } else if (!(this instanceof Boomerang)){ - int bonus = 0; + int bonus = 0; - for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) - bonus += ((RingOfSharpshooting.Aim)buff).level; + for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) + bonus += ((RingOfSharpshooting.Aim)buff).level; if (curUser.heroClass == HeroClass.HUNTRESS && enemy.buff(PinCushion.class) == null) bonus += 3; - if (Random.Float() > Math.pow(0.7, bonus)) - Buff.affect(enemy, PinCushion.class).stick(this); - } + if (Random.Float() > Math.pow(0.7, bonus)) + Buff.affect(enemy, PinCushion.class).stick(this); + } } } protected void miss( int cell ) { - int bonus = 0; - for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) { - bonus += ((RingOfSharpshooting.Aim)buff).level; - } + int bonus = 0; + for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) { + bonus += ((RingOfSharpshooting.Aim)buff).level; + } //degraded ring of sharpshooting will even make missed shots break. - if (Random.Float() < Math.pow(0.6, -bonus)) - super.onThrow( cell ); + if (Random.Float() < Math.pow(0.6, -bonus)) + super.onThrow( cell ); } @Override @@ -100,9 +100,9 @@ public class MissileWeapon extends Weapon { super.proc( attacker, defender, damage ); Hero hero = (Hero)attacker; - if (hero.rangedWeapon == null && stackable) { - if (quantity == 1) { - doUnequip( hero, false, false ); + if (hero.rangedWeapon == null && stackable) { + if (quantity == 1) { + doUnequip( hero, false, false ); } else { detach( null ); } @@ -111,7 +111,7 @@ public class MissileWeapon extends Weapon { @Override public boolean doEquip( final Hero hero ) { - GameScene.show( + GameScene.show( new WndOptions( TXT_MISSILES, TXT_R_U_SURE, TXT_YES, TXT_NO ) { @Override protected void onSelect(int index) { @@ -149,12 +149,12 @@ public class MissileWeapon extends Weapon { if (Dungeon.hero.belongings.backpack.items.contains( this )) { if (STR > Dungeon.hero.STR()) { - info.append( + info.append( "\n\nBecause of your inadequate strength the accuracy and speed " + "of your attack with this " + name + " is decreased." ); } if (STR < Dungeon.hero.STR() && Dungeon.hero.heroClass == HeroClass.HUNTRESS) { - info.append( + info.append( "\n\nBecause of your excess strength the damage " + "of your attack with this " + name + " is increased." ); } @@ -163,7 +163,7 @@ public class MissileWeapon extends Weapon { info.append( "\n\nAs this weapon is designed to be used at a distance, it is much less accurate if used at melee range."); if (isEquipped( Dungeon.hero )) { - info.append( "\n\nYou hold the " + name + " at the ready." ); + info.append( "\n\nYou hold the " + name + " at the ready." ); } return info.toString(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java index 6311cd4fe..2b13aaadd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java @@ -46,7 +46,7 @@ public class Shuriken extends MissileWeapon { @Override public String desc() { - return + return "Star-shaped pieces of metal with razor-sharp blades do significant damage " + "when they hit a target. They can be thrown at very high rate."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java index af99544c5..34a998675 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java @@ -49,11 +49,11 @@ public class Tamahawk extends MissileWeapon { public void proc( Char attacker, Char defender, int damage ) { super.proc( attacker, defender, damage ); Buff.affect( defender, Bleeding.class ).set( damage ); - } + } @Override public String desc() { - return + return "This throwing axe is not that heavy, but it still " + "requires significant strength to be used effectively."; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index ff430bd20..9bc2c7d33 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -123,18 +123,18 @@ public class CavesBossLevel extends Level { } } - Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1, + Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1, ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL ); - Painter.fill( this, ROOM_LEFT, ROOM_TOP + 1, + Painter.fill( this, ROOM_LEFT, ROOM_TOP + 1, ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP, Terrain.EMPTY ); - Painter.fill( this, ROOM_LEFT, ROOM_TOP, + Painter.fill( this, ROOM_LEFT, ROOM_TOP, ROOM_RIGHT - ROOM_LEFT + 1, 1, Terrain.INACTIVE_TRAP ); arenaDoor = Random.Int( ROOM_LEFT, ROOM_RIGHT ) + (ROOM_BOTTOM + 1) * WIDTH; map[arenaDoor] = Terrain.DOOR; - entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) + + entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) + Random.Int( ROOM_TOP + 1, ROOM_BOTTOM - 1 ) * WIDTH; map[entrance] = Terrain.ENTRANCE; @@ -149,7 +149,7 @@ public class CavesBossLevel extends Level { } @Override - protected void decorate() { + protected void decorate() { for (int i=WIDTH + 1; i < LENGTH - WIDTH; i++) { if (map[i] == Terrain.EMPTY) { @@ -186,7 +186,7 @@ public class CavesBossLevel extends Level { } @Override - protected void createMobs() { + protected void createMobs() { } public Actor respawner() { @@ -218,7 +218,7 @@ public class CavesBossLevel extends Level { if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { enteredArena = true; - seal(); + seal(); Mob boss = Bestiary.mob( Dungeon.depth ); boss.state = boss.HUNTING; @@ -246,7 +246,7 @@ public class CavesBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - unseal(); + unseal(); CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java index b0b432487..48963a842 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java @@ -251,8 +251,8 @@ public class CavesLevel extends RegularLevel { delay = Random.Float(); PointF p = DungeonTilemap.tileToWorld( pos ); - ((Sparkle)recycle( Sparkle.class )).reset( - p.x + Random.Float( DungeonTilemap.SIZE ), + ((Sparkle)recycle( Sparkle.class )).reset( + p.x + Random.Float( DungeonTilemap.SIZE ), p.y + Random.Float( DungeonTilemap.SIZE ) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java index bb700b294..1afa3c75f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java @@ -113,19 +113,19 @@ public class CityBossLevel extends Level { Painter.fill( this, LEFT, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF ); Painter.fill( this, LEFT + HALL_WIDTH - 1, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF ); - entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * WIDTH + LEFT + (/*1 +*/ Random.Int( HALL_WIDTH-2 )); + entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * WIDTH + LEFT + (/*1 +*/ Random.Int( HALL_WIDTH-2 )); map[entrance] = Terrain.ENTRANCE; return true; } @Override - protected void decorate() { + protected void decorate() { for (int i=0; i < LENGTH; i++) { - if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { + if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { map[i] = Terrain.EMPTY_DECO; - } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { + } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { map[i] = Terrain.WALL_DECO; } } @@ -143,7 +143,7 @@ public class CityBossLevel extends Level { } @Override - protected void createMobs() { + protected void createMobs() { } public Actor respawner() { @@ -156,8 +156,8 @@ public class CityBossLevel extends Level { if (item != null) { int pos; do { - pos = - Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) + + pos = + Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) + Random.IntRange( TOP + HALL_HEIGHT + 1, TOP + HALL_HEIGHT + CHAMBER_HEIGHT ) * WIDTH; } while (pos == entrance || map[pos] == Terrain.SIGN); drop( item, pos ).type = Heap.Type.REMAINS; @@ -177,7 +177,7 @@ public class CityBossLevel extends Level { if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { enteredArena = true; - seal(); + seal(); Mob boss = Bestiary.mob( Dungeon.depth ); boss.state = boss.HUNTING; @@ -208,7 +208,7 @@ public class CityBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - unseal(); + unseal(); set( arenaDoor, Terrain.DOOR ); GameScene.updateMap( arenaDoor ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java index 05e22636a..bb7c65564 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java @@ -70,9 +70,9 @@ public class CityLevel extends RegularLevel { protected void decorate() { for (int i=0; i < LENGTH; i++) { - if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { + if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { map[i] = Terrain.EMPTY_DECO; - } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { + } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { map[i] = Terrain.WALL_DECO; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/DeadEndLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/DeadEndLevel.java index 8cbc58738..d5e159be2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/DeadEndLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/DeadEndLevel.java @@ -53,7 +53,7 @@ public class DeadEndLevel extends Level { } for (int i=1; i <= SIZE; i++) { - map[WIDTH + i] = + map[WIDTH + i] = map[WIDTH * SIZE + i] = map[WIDTH * i + 1] = map[WIDTH * i + SIZE] = @@ -73,9 +73,9 @@ public class DeadEndLevel extends Level { @Override protected void decorate() { for (int i=0; i < LENGTH; i++) { - if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { + if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { map[i] = Terrain.EMPTY_DECO; - } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { + } else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) { map[i] = Terrain.WALL_DECO; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java index d3f9b36c6..e2aa0d9ef 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java @@ -105,12 +105,12 @@ public class HallsBossLevel extends Level { map[exit] = Terrain.LOCKED_EXIT; - Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1, + Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1, ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL ); - Painter.fill( this, ROOM_LEFT, ROOM_TOP, + Painter.fill( this, ROOM_LEFT, ROOM_TOP, ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP + 1, Terrain.EMPTY ); - entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) + + entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) + Random.Int( ROOM_TOP + 1, ROOM_BOTTOM - 1 ) * WIDTH; map[entrance] = Terrain.ENTRANCE; @@ -125,17 +125,17 @@ public class HallsBossLevel extends Level { } @Override - protected void decorate() { + protected void decorate() { for (int i=0; i < LENGTH; i++) { - if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { + if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { map[i] = Terrain.EMPTY_DECO; } } } @Override - protected void createMobs() { + protected void createMobs() { } public Actor respawner() { @@ -206,7 +206,7 @@ public class HallsBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - unseal(); + unseal(); entrance = stairs; set( entrance, Terrain.ENTRANCE ); @@ -240,7 +240,7 @@ public class HallsBossLevel extends Level { return "It looks like lava, but it's cold and probably safe to touch."; case Terrain.STATUE: case Terrain.STATUE_SP: - return "The pillar is made of real humanoid skulls. Awesome."; + return "The pillar is made of real humanoid skulls. Awesome."; default: return super.tileDesc( tile ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java index 8e5db1f5f..44266eaa3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java @@ -71,7 +71,7 @@ public class HallsLevel extends RegularLevel { protected void decorate() { for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) { - if (map[i] == Terrain.EMPTY) { + if (map[i] == Terrain.EMPTY) { int count = 0; for (int j=0; j < NEIGHBOURS8.length; j++) { @@ -121,7 +121,7 @@ public class HallsLevel extends RegularLevel { return "It looks like lava, but it's cold and probably safe to touch."; case Terrain.STATUE: case Terrain.STATUE_SP: - return "The pillar is made of real humanoid skulls. Awesome."; + return "The pillar is made of real humanoid skulls. Awesome."; case Terrain.BOOKSHELF: return "Books in ancient languages smoulder in the bookshelf."; default: @@ -169,8 +169,8 @@ public class HallsLevel extends RegularLevel { delay = Random.Float( 2 ); PointF p = DungeonTilemap.tileToWorld( pos ); - ((FireParticle)recycle( FireParticle.class )).reset( - p.x + Random.Float( DungeonTilemap.SIZE ), + ((FireParticle)recycle( FireParticle.class )).reset( + p.x + Random.Float( DungeonTilemap.SIZE ), p.y + Random.Float( DungeonTilemap.SIZE ) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java index 80499841e..358767744 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java @@ -84,7 +84,7 @@ public class LastLevel extends Level { map[pedestal] = Terrain.PEDESTAL; map[pedestal-1-WIDTH] = map[pedestal+1-WIDTH] = map[pedestal-1+WIDTH] = map[pedestal+1+WIDTH] = Terrain.STATUE_SP; - exit = pedestal; + exit = pedestal; int pos = pedestal; @@ -162,15 +162,15 @@ public class LastLevel extends Level { HallsLevel.addVisuals( this, scene ); } - @Override - public void restoreFromBundle(Bundle bundle) { - super.restoreFromBundle(bundle); - for (int i=0; i < LENGTH; i++) { - int flags = Terrain.flags[map[i]]; - if ((flags & Terrain.PIT) != 0){ - passable[i] = avoid[i] = false; - solid[i] = true; - } - } - } + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + for (int i=0; i < LENGTH; i++) { + int flags = Terrain.flags[map[i]]; + if ((flags & Terrain.PIT) != 0){ + passable[i] = avoid[i] = false; + solid[i] = true; + } + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastShopLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastShopLevel.java index cdefd35c0..c6e0d01bd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastShopLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastShopLevel.java @@ -105,7 +105,7 @@ public class LastShopLevel extends RegularLevel { int shopSquare = 0; for (Room r : rooms) { if (r.type == Type.NULL && r.connected.size() > 0) { - r.type = Type.PASSAGE; + r.type = Type.PASSAGE; if (r.square() > shopSquare) { roomShop = r; shopSquare = r.square(); @@ -128,10 +128,10 @@ public class LastShopLevel extends RegularLevel { } @Override - protected void decorate() { + protected void decorate() { for (int i=0; i < LENGTH; i++) { - if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { + if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { map[i] = Terrain.EMPTY_DECO; @@ -152,7 +152,7 @@ public class LastShopLevel extends RegularLevel { } @Override - protected void createMobs() { + protected void createMobs() { } public Actor respawner() { @@ -217,7 +217,7 @@ public class LastShopLevel extends RegularLevel { @Override public void addVisuals( Scene scene ) { - super.addVisuals( scene ); + super.addVisuals( scene ); CityLevel.addVisuals( this, scene ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 69a787cf4..f10189e14 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -102,17 +102,17 @@ public abstract class Level implements Bundlable { public static final int[] NEIGHBOURS8 = {-WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH}; public static final int[] NEIGHBOURS9 = {0, -WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH}; - //make sure to check insideMap() when using these, as there's a risk something may be outside the map - public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH, - +2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH, - +2, +1, -1, -2, - +2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH, - +2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH}; - public static final int[] NEIGHBOURS9DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH, - +2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH, - +2, +1, 0, -1, -2, - +2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH, - +2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH}; + //make sure to check insideMap() when using these, as there's a risk something may be outside the map + public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH, + +2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH, + +2, +1, -1, -2, + +2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH, + +2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH}; + public static final int[] NEIGHBOURS9DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH, + +2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH, + +2, +1, 0, -1, -2, + +2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH, + +2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH}; protected static final float TIME_TO_RESPAWN = 50; @@ -127,7 +127,7 @@ public abstract class Level implements Bundlable { public boolean[] visited; public boolean[] mapped; - public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 3: 8; + public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 3: 8; public static boolean[] fieldOfView = new boolean[LENGTH]; @@ -147,8 +147,8 @@ public abstract class Level implements Bundlable { public int entrance; public int exit; - //when a boss level has become locked. - public boolean locked = false; + //when a boss level has become locked. + public boolean locked = false; public HashSet mobs; public SparseArray heaps; @@ -170,7 +170,7 @@ public abstract class Level implements Bundlable { private static final String MAPPED = "mapped"; private static final String ENTRANCE = "entrance"; private static final String EXIT = "exit"; - private static final String LOCKED = "locked"; + private static final String LOCKED = "locked"; private static final String HEAPS = "heaps"; private static final String PLANTS = "plants"; private static final String TRAPS = "traps"; @@ -196,37 +196,37 @@ public abstract class Level implements Bundlable { } if (Dungeon.souNeeded()) { addItemToSpawn( new ScrollOfUpgrade() ); - Dungeon.limitedDrops.upgradeScrolls.count++; + Dungeon.limitedDrops.upgradeScrolls.count++; } if (Dungeon.asNeeded()) { addItemToSpawn( new Stylus() ); - Dungeon.limitedDrops.arcaneStyli.count++; + Dungeon.limitedDrops.arcaneStyli.count++; } - int bonus = 0; - for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { - bonus += ((RingOfWealth.Wealth) buff).level; - } - if (Random.Float() > Math.pow(0.95, bonus)){ - if (Random.Int(2) == 0) - addItemToSpawn( new ScrollOfMagicalInfusion() ); - else - addItemToSpawn( new PotionOfMight() ); - } + int bonus = 0; + for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { + bonus += ((RingOfWealth.Wealth) buff).level; + } + if (Random.Float() > Math.pow(0.95, bonus)){ + if (Random.Int(2) == 0) + addItemToSpawn( new ScrollOfMagicalInfusion() ); + else + addItemToSpawn( new PotionOfMight() ); + } - DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); - if (rose != null && !rose.cursed){ - //this way if a rose is dropped later in the game, player still has a chance to max it out. - int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3); + DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); + if (rose != null && !rose.cursed){ + //this way if a rose is dropped later in the game, player still has a chance to max it out. + int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3); - for (int i=1; i <= petalsNeeded; i++) { + for (int i=1; i <= petalsNeeded; i++) { //the player may miss a single petal and still max their rose. - if (rose.droppedPetals < 11) { - addItemToSpawn(new DriedRose.Petal()); - rose.droppedPetals++; - } - } - } + if (rose.droppedPetals < 11) { + addItemToSpawn(new DriedRose.Petal()); + rose.droppedPetals++; + } + } + } if (Dungeon.depth > 1) { switch (Random.Int( 10 )) { @@ -274,7 +274,7 @@ public abstract class Level implements Bundlable { createItems(); } - public void reset() { + public void reset() { for (Mob mob : mobs.toArray( new Mob[0] )) { if (!mob.reset()) { @@ -303,7 +303,7 @@ public abstract class Level implements Bundlable { entrance = bundle.getInt( ENTRANCE ); exit = bundle.getInt( EXIT ); - locked = bundle.getBoolean( LOCKED ); + locked = bundle.getBoolean( LOCKED ); weakFloorCreated = false; @@ -320,8 +320,8 @@ public abstract class Level implements Bundlable { if (resizingNeeded) { heap.pos = adjustPos( heap.pos ); } - if (!heap.isEmpty()) - heaps.put( heap.pos, heap ); + if (!heap.isEmpty()) + heaps.put( heap.pos, heap ); } collection = bundle.getCollection( PLANTS ); @@ -375,7 +375,7 @@ public abstract class Level implements Bundlable { bundle.put( MAPPED, mapped ); bundle.put( ENTRANCE, entrance ); bundle.put( EXIT, exit ); - bundle.put( LOCKED, locked ); + bundle.put( LOCKED, locked ); bundle.put( HEAPS, heaps.values() ); bundle.put( PLANTS, plants.values() ); bundle.put( TRAPS, traps.values() ); @@ -416,7 +416,7 @@ public abstract class Level implements Bundlable { this.mapped = mapped; entrance = adjustPos( entrance ); - exit = adjustPos( exit ); + exit = adjustPos( exit ); } else { resizingNeeded = false; } @@ -528,27 +528,27 @@ public abstract class Level implements Bundlable { } } - public Item findPrizeItem(){ return findPrizeItem(null); } + public Item findPrizeItem(){ return findPrizeItem(null); } - public Item findPrizeItem(Class match){ - if (itemsToSpawn.size() == 0) - return null; + public Item findPrizeItem(Class match){ + if (itemsToSpawn.size() == 0) + return null; - if (match == null){ - Item item = Random.element(itemsToSpawn); - itemsToSpawn.remove(item); - return item; - } + if (match == null){ + Item item = Random.element(itemsToSpawn); + itemsToSpawn.remove(item); + return item; + } - for (Item item : itemsToSpawn){ - if (match.isInstance(item)){ - itemsToSpawn.remove( item ); - return item; - } - } + for (Item item : itemsToSpawn){ + if (match.isInstance(item)){ + itemsToSpawn.remove( item ); + return item; + } + } - return null; - } + return null; + } private void buildFlagMaps() { @@ -590,7 +590,7 @@ public abstract class Level implements Bundlable { if (!pit[i - WIDTH]) { int c = map[i - WIDTH]; if (c == Terrain.EMPTY_SP || c == Terrain.STATUE_SP) { - map[i] = Terrain.CHASM_FLOOR_SP; + map[i] = Terrain.CHASM_FLOOR_SP; } else if (water[i - WIDTH]) { map[i] = Terrain.CHASM_WATER; } else if ((Terrain.flags[c] & Terrain.UNSTITCHABLE) != 0) { @@ -603,7 +603,7 @@ public abstract class Level implements Bundlable { } } - private void cleanWalls() { + private void cleanWalls() { for (int i=0; i < LENGTH; i++) { boolean d = false; @@ -653,26 +653,26 @@ public abstract class Level implements Bundlable { public Heap drop( Item item, int cell ) { //This messy if statement deals will items which should not drop in challenges primarily. - if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || - (Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) || - (Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) || - (Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) || - (Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade)) || item instanceof ScrollHolder)) || + if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || + (Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) || + (Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) || + (Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) || + (Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade)) || item instanceof ScrollHolder)) || item == null) { - //create a dummy heap, give it a dummy sprite, don't add it to the game, and return it. - //effectively nullifies whatever the logic calling this wants to do, including dropping items. - Heap heap = new Heap(); - ItemSprite sprite = heap.sprite = new ItemSprite(); - sprite.link( heap ); - return heap; + //create a dummy heap, give it a dummy sprite, don't add it to the game, and return it. + //effectively nullifies whatever the logic calling this wants to do, including dropping items. + Heap heap = new Heap(); + ItemSprite sprite = heap.sprite = new ItemSprite(); + sprite.link( heap ); + return heap; - } + } if ((map[cell] == Terrain.ALCHEMY) && ( !(item instanceof Plant.Seed || item instanceof Blandfruit) || item instanceof BlandfruitBush.Seed || - (item instanceof Blandfruit && (((Blandfruit) item).potionAttrib != null || heaps.get(cell) != null))|| + (item instanceof Blandfruit && (((Blandfruit) item).potionAttrib != null || heaps.get(cell) != null))|| Dungeon.hero.buff(AlchemistsToolkit.alchemy.class) != null && Dungeon.hero.buff(AlchemistsToolkit.alchemy.class).isCursed())) { int n; do { @@ -719,14 +719,14 @@ public abstract class Level implements Bundlable { plant.wither(); } - if (map[pos] == Terrain.HIGH_GRASS || - map[pos] == Terrain.EMPTY || - map[pos] == Terrain.EMBERS || - map[pos] == Terrain.EMPTY_DECO) { - map[pos] = Terrain.GRASS; - flamable[pos] = true; - GameScene.updateMap( pos ); - } + if (map[pos] == Terrain.HIGH_GRASS || + map[pos] == Terrain.EMPTY || + map[pos] == Terrain.EMBERS || + map[pos] == Terrain.EMPTY_DECO) { + map[pos] = Terrain.GRASS; + flamable[pos] = true; + GameScene.updateMap( pos ); + } plant = seed.couch( pos ); plants.put( pos, plant ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index 0c71b0d63..9ada446de 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -115,9 +115,9 @@ public class PrisonBossLevel extends RegularLevel { } roomExit = Random.element( rooms ); } while ( - roomExit == roomEntrance || - roomExit.width() < 7 || - roomExit.height() < 7 || + roomExit == roomEntrance || + roomExit.width() < 7 || + roomExit.height() < 7 || roomExit.top == 0); Graph.buildDistanceMap( rooms, roomExit ); @@ -128,7 +128,7 @@ public class PrisonBossLevel extends RegularLevel { roomEntrance.type = Type.ENTRANCE; roomExit.type = Type.BOSS_EXIT; - List path = Graph.buildPath( rooms, roomEntrance, roomExit ); + List path = Graph.buildPath( rooms, roomEntrance, roomExit ); Graph.setPrice( path, roomEntrance.distance ); Graph.buildDistanceMap( rooms, roomExit ); @@ -145,7 +145,7 @@ public class PrisonBossLevel extends RegularLevel { for (Room r : rooms) { if (r.type == Type.NULL && r.connected.size() > 0) { - r.type = Type.PASSAGE; + r.type = Type.PASSAGE; } } @@ -215,7 +215,7 @@ public class PrisonBossLevel extends RegularLevel { protected void decorate() { for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) { - if (map[i] == Terrain.EMPTY) { + if (map[i] == Terrain.EMPTY) { float c = 0.15f; if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) { @@ -238,7 +238,7 @@ public class PrisonBossLevel extends RegularLevel { } for (int i=0; i < WIDTH; i++) { - if (map[i] == Terrain.WALL && + if (map[i] == Terrain.WALL && (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && Random.Int( 4 ) == 0) { @@ -247,8 +247,8 @@ public class PrisonBossLevel extends RegularLevel { } for (int i=WIDTH; i < LENGTH - WIDTH; i++) { - if (map[i] == Terrain.WALL && - map[i - WIDTH] == Terrain.WALL && + if (map[i] == Terrain.WALL && + map[i - WIDTH] == Terrain.WALL && (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && Random.Int( 2 ) == 0) { @@ -262,7 +262,7 @@ public class PrisonBossLevel extends RegularLevel { arenaDoor = door.x + door.y * WIDTH; Painter.set( this, arenaDoor, Terrain.LOCKED_DOOR ); - Painter.fill( this, + Painter.fill( this, roomExit.left + 2, roomExit.top + 2, roomExit.width() - 3, @@ -305,7 +305,7 @@ public class PrisonBossLevel extends RegularLevel { if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) { enteredArena = true; - seal(); + seal(); int pos; do { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java index 6389beb15..2fedb72b5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java @@ -78,7 +78,7 @@ public class PrisonLevel extends RegularLevel { protected void decorate() { for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) { - if (map[i] == Terrain.EMPTY) { + if (map[i] == Terrain.EMPTY) { float c = 0.05f; if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) { @@ -101,7 +101,7 @@ public class PrisonLevel extends RegularLevel { } for (int i=0; i < WIDTH; i++) { - if (map[i] == Terrain.WALL && + if (map[i] == Terrain.WALL && (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && Random.Int( 6 ) == 0) { @@ -110,8 +110,8 @@ public class PrisonLevel extends RegularLevel { } for (int i=WIDTH; i < LENGTH - WIDTH; i++) { - if (map[i] == Terrain.WALL && - map[i - WIDTH] == Terrain.WALL && + if (map[i] == Terrain.WALL && + map[i - WIDTH] == Terrain.WALL && (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && Random.Int( 3 ) == 0) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 7b4226028..8b12c3493 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -149,14 +149,14 @@ public abstract class RegularLevel extends Level { if (Dungeon.bossLevel( Dungeon.depth + 1 )) { specials.remove( Room.Type.WEAK_FLOOR ); } - if (Dungeon.isChallenged( Challenges.NO_ARMOR )){ - //no sense in giving an armor reward room on a run with no armor. - specials.remove( Room.Type.CRYPT ); - } - if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){ - //sorry warden, no lucky sungrass or blandfruit seeds for you! - specials.remove( Room.Type.GARDEN ); - } + if (Dungeon.isChallenged( Challenges.NO_ARMOR )){ + //no sense in giving an armor reward room on a run with no armor. + specials.remove( Room.Type.CRYPT ); + } + if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){ + //sorry warden, no lucky sungrass or blandfruit seeds for you! + specials.remove( Room.Type.GARDEN ); + } if (!assignRoomType()) return false; @@ -203,7 +203,7 @@ public abstract class RegularLevel extends Level { int specialRooms = 0; for (Room r : rooms) { - if (r.type == Type.NULL && + if (r.type == Type.NULL && r.connected.size() == 1) { if (specials.size() > 0 && @@ -250,7 +250,7 @@ public abstract class RegularLevel extends Level { HashSet neigbours = new HashSet(); for (Room n : r.neigbours) { - if (!r.connected.containsKey( n ) && + if (!r.connected.containsKey( n ) && !Room.SPECIALS.contains( n.type ) && n.type != Type.PIT) { @@ -274,7 +274,7 @@ public abstract class RegularLevel extends Level { r.type = Type.STANDARD; count++; } else { - r.type = Type.TUNNEL; + r.type = Type.TUNNEL; } } } @@ -394,14 +394,14 @@ public abstract class RegularLevel extends Level { split( new Rect( rect.left, rect.top, vw, rect.bottom ) ); split( new Rect( vw, rect.top, rect.right, rect.bottom ) ); - } else + } else if (h > maxRoomSize && w < minRoomSize) { int vh = Random.Int( rect.top + 3, rect.bottom - 3 ); split( new Rect( rect.left, rect.top, rect.right, vh ) ); split( new Rect( rect.left, vh, rect.right, rect.bottom ) ); - } else + } else if ((Math.random() <= (minRoomSize * minRoomSize / rect.square()) && w <= maxRoomSize && h <= maxRoomSize) || w < minRoomSize || h < minRoomSize) { rooms.add( (Room)new Room().set( rect ) ); @@ -446,11 +446,11 @@ public abstract class RegularLevel extends Level { Rect i = r.intersect( n ); if (i.width() == 0) { - door = new Room.Door( - i.left, + door = new Room.Door( + i.left, Random.Int( i.top + 1, i.bottom ) ); } else { - door = new Room.Door( + door = new Room.Door( Random.Int( i.left + 1, i.right ), i.top); } @@ -654,12 +654,12 @@ public abstract class RegularLevel extends Level { protected void createItems() { int nItems = 3; - int bonus = 0; - for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { - bonus += ((RingOfWealth.Wealth) buff).level; - } - //just incase someone gets a ridiculous ring, cap this at 80% - bonus = Math.min(bonus, 10); + int bonus = 0; + for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { + bonus += ((RingOfWealth.Wealth) buff).level; + } + //just incase someone gets a ridiculous ring, cap this at 80% + bonus = Math.min(bonus, 10); while (Random.Float() < (0.3f + bonus*0.05f)) { nItems++; } @@ -756,7 +756,7 @@ public abstract class RegularLevel extends Level { public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); - rooms = new HashSet( (Collection) ((Collection) bundle.getCollection( "rooms" )) ); + rooms = new HashSet( (Collection) ((Collection) bundle.getCollection( "rooms" )) ); for (Room r : rooms) { if (r.type == Type.WEAK_FLOOR) { weakFloorCreated = true; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java index cc7e3a3cc..531e85649 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java @@ -106,7 +106,7 @@ public class Room extends Rect implements Graph.Node, Bundlable { public void addNeigbour( Room other ) { Rect i = intersect( other ); - if ((i.width() == 0 && i.height() >= 3) || + if ((i.width() == 0 && i.height() >= 3) || (i.height() == 0 && i.width() >= 3)) { neigbours.add( other ); other.neigbours.add( this ); @@ -132,7 +132,7 @@ public class Room extends Rect implements Graph.Node, Bundlable { } public Point center() { - return new Point( + return new Point( (left + right) / 2 + (((right - left) & 1) == 1 ? Random.Int( 2 ) : 0), (top + bottom) / 2 + (((bottom - top) & 1) == 1 ? Random.Int( 2 ) : 0) ); } @@ -170,7 +170,7 @@ public class Room extends Rect implements Graph.Node, Bundlable { @Override public Collection edges() { return neigbours; - } + } @Override public void storeInBundle( Bundle bundle ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java index e6729592f..3db642877 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java @@ -60,92 +60,92 @@ public class SewerBossLevel extends RegularLevel { initRooms(); int distance; - //if we ever need to try 20 or more times to find a room, better to give up and try again. + //if we ever need to try 20 or more times to find a room, better to give up and try again. int retry = 0; - //start with finding an entrance room (will also contain exit) - //the room must be at least 4x4 and be nearer the top of the map(so that it is less likely something connects to the top) - do { - if (retry++ > 20) { - return false; - } - roomEntrance = Random.element( rooms ); - } while (roomEntrance.width() != 8 || roomEntrance.height() < 5 || roomEntrance.top == 0 || roomEntrance.top >= 8); + //start with finding an entrance room (will also contain exit) + //the room must be at least 4x4 and be nearer the top of the map(so that it is less likely something connects to the top) + do { + if (retry++ > 20) { + return false; + } + roomEntrance = Random.element( rooms ); + } while (roomEntrance.width() != 8 || roomEntrance.height() < 5 || roomEntrance.top == 0 || roomEntrance.top >= 8); - roomEntrance.type = Type.ENTRANCE; - roomExit = roomEntrance; + roomEntrance.type = Type.ENTRANCE; + roomExit = roomEntrance; - //now find the rest of the rooms for this boss mini-maze - Room curRoom = null; - Room lastRoom = roomEntrance; - //we make 4 rooms, last iteration is tieing the final room to the start - for(int i = 0; i <= 4; i++){ - retry = 0; - //find a suitable room the first four times - //suitable room should be empty, have a distance of 2 from the current room, and not touch the entrance. - if (i < 4) { - do { - if (retry++ > 20) { - return false; - } - curRoom = Random.element(rooms); - Graph.buildDistanceMap(rooms, curRoom); - distance = lastRoom.distance(); - } while (curRoom.type != Type.NULL || distance != 3 || curRoom.neigbours.contains(roomEntrance)); + //now find the rest of the rooms for this boss mini-maze + Room curRoom = null; + Room lastRoom = roomEntrance; + //we make 4 rooms, last iteration is tieing the final room to the start + for(int i = 0; i <= 4; i++){ + retry = 0; + //find a suitable room the first four times + //suitable room should be empty, have a distance of 2 from the current room, and not touch the entrance. + if (i < 4) { + do { + if (retry++ > 20) { + return false; + } + curRoom = Random.element(rooms); + Graph.buildDistanceMap(rooms, curRoom); + distance = lastRoom.distance(); + } while (curRoom.type != Type.NULL || distance != 3 || curRoom.neigbours.contains(roomEntrance)); - curRoom.type = Type.STANDARD; + curRoom.type = Type.STANDARD; - //otherwise, we're on the last iteration. - } else { - //set the current room to the entrance, so we can build a connection to it. - curRoom = roomEntrance; - } + //otherwise, we're on the last iteration. + } else { + //set the current room to the entrance, so we can build a connection to it. + curRoom = roomEntrance; + } - //now build a connection between the current room and the last one. - Graph.buildDistanceMap( rooms, curRoom ); - List path = Graph.buildPath( rooms, lastRoom, curRoom ); + //now build a connection between the current room and the last one. + Graph.buildDistanceMap( rooms, curRoom ); + List path = Graph.buildPath( rooms, lastRoom, curRoom ); - Graph.setPrice( path, lastRoom.distance ); + Graph.setPrice( path, lastRoom.distance ); - path = Graph.buildPath( rooms, lastRoom, curRoom ); + path = Graph.buildPath( rooms, lastRoom, curRoom ); - Room room = lastRoom; - for (Room next : path) { - room.connect( next ); - room = next; - } + Room room = lastRoom; + for (Room next : path) { + room.connect( next ); + room = next; + } - if (i == 4) { + if (i == 4) { - //we must find a room for his royal highness! - //look at rooms adjacent to the final found room (likely to be furthest from start) - ArrayList candidates = new ArrayList(); - for (Room r : lastRoom.neigbours) { - if (r.type == Type.NULL && r.connected.size() == 0 && !r.neigbours.contains(roomEntrance)) { - candidates.add(r); - } - } + //we must find a room for his royal highness! + //look at rooms adjacent to the final found room (likely to be furthest from start) + ArrayList candidates = new ArrayList(); + for (Room r : lastRoom.neigbours) { + if (r.type == Type.NULL && r.connected.size() == 0 && !r.neigbours.contains(roomEntrance)) { + candidates.add(r); + } + } - //if we have candidates, pick a room and put the king there - if (candidates.size() > 0) { - Room kingsRoom = Random.element(candidates); - kingsRoom.connect(lastRoom); - kingsRoom.type = Room.Type.RAT_KING; + //if we have candidates, pick a room and put the king there + if (candidates.size() > 0) { + Room kingsRoom = Random.element(candidates); + kingsRoom.connect(lastRoom); + kingsRoom.type = Room.Type.RAT_KING; - //unacceptable! make a new level... - } else { - return false; - } - } - lastRoom = curRoom; - } + //unacceptable! make a new level... + } else { + return false; + } + } + lastRoom = curRoom; + } - //the connection structure ensures that (most of the time) there is a nice loop for the player to kite the - //boss around. What's nice is that there is enough chaos such that the loop is rarely straightforward - //and boring. + //the connection structure ensures that (most of the time) there is a nice loop for the player to kite the + //boss around. What's nice is that there is enough chaos such that the loop is rarely straightforward + //and boring. - //fills our connection rooms in with tunnel + //fills our connection rooms in with tunnel for (Room r : rooms) { if (r.type == Type.NULL && r.connected.size() > 0) { r.type = Type.TUNNEL; @@ -154,9 +154,9 @@ public class SewerBossLevel extends RegularLevel { paint(); - //sticks the exit in the room entrance. - exit = roomEntrance.top * Level.WIDTH + (roomEntrance.left + roomEntrance.right) / 2; - map[exit] = Terrain.LOCKED_EXIT; + //sticks the exit in the room entrance. + exit = roomEntrance.top * Level.WIDTH + (roomEntrance.left + roomEntrance.right) / 2; + map[exit] = Terrain.LOCKED_EXIT; //make sure the exit is only visible in the entrance room. int count = 0; @@ -184,7 +184,7 @@ public class SewerBossLevel extends RegularLevel { } @Override - protected void decorate() { + protected void decorate() { int start = roomExit.top * WIDTH + roomExit.left + 1; int end = start + roomExit.width() - 1; for (int i=start; i < end; i++) { @@ -208,10 +208,10 @@ public class SewerBossLevel extends RegularLevel { @Override protected void createMobs() { Mob mob = Bestiary.mob( Dungeon.depth ); - Room room; - do { - room = Random.element(rooms); - } while (room.type != Type.STANDARD); + Room room; + do { + room = Random.element(rooms); + } while (room.type != Type.STANDARD); mob.pos = room.random(); mobs.add( mob ); } @@ -255,7 +255,7 @@ public class SewerBossLevel extends RegularLevel { public void unseal() { if (stairs != 0) { - super.unseal(); + super.unseal(); entrance = stairs; stairs = 0; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java index 8d8ee4c6b..9a18bffda 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java @@ -60,7 +60,7 @@ public class SewerLevel extends RegularLevel { protected void decorate() { for (int i=0; i < WIDTH; i++) { - if (map[i] == Terrain.WALL && + if (map[i] == Terrain.WALL && map[i + WIDTH] == Terrain.WATER && Random.Int( 4 ) == 0) { @@ -69,8 +69,8 @@ public class SewerLevel extends RegularLevel { } for (int i=WIDTH; i < LENGTH - WIDTH; i++) { - if (map[i] == Terrain.WALL && - map[i - WIDTH] == Terrain.WALL && + if (map[i] == Terrain.WALL && + map[i - WIDTH] == Terrain.WALL && map[i + WIDTH] == Terrain.WATER && Random.Int( 2 ) == 0) { @@ -79,11 +79,11 @@ public class SewerLevel extends RegularLevel { } for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) { - if (map[i] == Terrain.EMPTY) { + if (map[i] == Terrain.EMPTY) { - int count = - (map[i + 1] == Terrain.WALL ? 1 : 0) + - (map[i - 1] == Terrain.WALL ? 1 : 0) + + int count = + (map[i + 1] == Terrain.WALL ? 1 : 0) + + (map[i - 1] == Terrain.WALL ? 1 : 0) + (map[i + WIDTH] == Terrain.WALL ? 1 : 0) + (map[i - WIDTH] == Terrain.WALL ? 1 : 0); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java index a1be1f145..406c3ac03 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Terrain.java @@ -71,7 +71,7 @@ public class Terrain { public static final int LIQUID = 0x40; public static final int PIT = 0x80; - public static final int UNSTITCHABLE = 0x100; + public static final int UNSTITCHABLE = 0x100; public static final int[] flags = new int[256]; static { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java index 1486ca18c..aab1ec3c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java @@ -31,48 +31,48 @@ import java.util.Iterator; public class AlchemyPot { private static final String TXT_SELECT_SEED = "Select a seed to throw"; - private static final String TXT_POT = "Alchemy Pot"; - private static final String TXT_FRUIT = "Cook a Blandfruit"; - private static final String TXT_POTION = "Brew a Potion"; - private static final String TXT_OPTIONS = - "Do you want to cook a Blandfruit with a seed, or brew a Potion from seeds?"; + private static final String TXT_POT = "Alchemy Pot"; + private static final String TXT_FRUIT = "Cook a Blandfruit"; + private static final String TXT_POTION = "Brew a Potion"; + private static final String TXT_OPTIONS = + "Do you want to cook a Blandfruit with a seed, or brew a Potion from seeds?"; public static Hero hero; public static int pos; - public static boolean foundFruit; - public static Item curItem = null; + public static boolean foundFruit; + public static Item curItem = null; public static void operate( Hero hero, int pos ) { AlchemyPot.hero = hero; AlchemyPot.pos = pos; - Iterator items = hero.belongings.iterator(); - foundFruit = false; - Heap heap = Dungeon.level.heaps.get( pos ); + Iterator items = hero.belongings.iterator(); + foundFruit = false; + Heap heap = Dungeon.level.heaps.get( pos ); - if (heap == null) - while (items.hasNext() && !foundFruit){ - curItem = items.next(); - if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){ - GameScene.show( - new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) { - @Override - protected void onSelect(int index) { - if (index == 0) { - curItem.cast( AlchemyPot.hero, AlchemyPot.pos ); - } else - GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); - } - } - ); - foundFruit = true; - } - } + if (heap == null) + while (items.hasNext() && !foundFruit){ + curItem = items.next(); + if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){ + GameScene.show( + new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) { + @Override + protected void onSelect(int index) { + if (index == 0) { + curItem.cast( AlchemyPot.hero, AlchemyPot.pos ); + } else + GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); + } + } + ); + foundFruit = true; + } + } - if (!foundFruit) - GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); + if (!foundFruit) + GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); } private static final WndBag.Listener itemSelector = new WndBag.Listener() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index b44ee1468..d2d228528 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -45,13 +45,13 @@ public class Chasm { private static final String TXT_CHASM = "Chasm"; private static final String TXT_YES = "Yes, I know what I'm doing"; private static final String TXT_NO = "No, I changed my mind"; - private static final String TXT_JUMP = + private static final String TXT_JUMP = "Do you really want to jump into the chasm? You can probably die."; public static boolean jumpConfirmed = false; public static void heroJump( final Hero hero ) { - GameScene.show( + GameScene.show( new WndOptions( TXT_CHASM, TXT_JUMP, TXT_YES, TXT_NO ) { @Override protected void onSelect( int index ) { @@ -73,8 +73,8 @@ public class Chasm { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); - for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) - if (mob instanceof DriedRose.GhostHero) mob.destroy(); + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); if (Dungeon.hero.isAlive()) { Dungeon.hero.interrupt(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 2f04495f2..dd0bcad5e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -44,41 +44,41 @@ public class HighGrass { Level.set( pos, Terrain.GRASS ); GameScene.updateMap( pos ); - if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) { - int naturalismLevel = 0; + if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) { + int naturalismLevel = 0; - if (ch != null) { - SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); - if (naturalism != null) { - if (!naturalism.isCursed()) { - naturalismLevel = naturalism.level() + 1; - naturalism.charge(); - } else { - naturalismLevel = -1; - } - } - } + if (ch != null) { + SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); + if (naturalism != null) { + if (!naturalism.isCursed()) { + naturalismLevel = naturalism.level() + 1; + naturalism.charge(); + } else { + naturalismLevel = -1; + } + } + } - if (naturalismLevel >= 0) { - // Seed, scales from 1/16 to 1/4 - if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) { - Item seed = Generator.random(Generator.Category.SEED); + if (naturalismLevel >= 0) { + // Seed, scales from 1/16 to 1/4 + if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) { + Item seed = Generator.random(Generator.Category.SEED); - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) { - level.drop(seed, pos).sprite.drop(); - Dungeon.limitedDrops.blandfruitSeed.count++; - } - } else - level.drop(seed, pos).sprite.drop(); - } + if (seed instanceof BlandfruitBush.Seed) { + if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) { + level.drop(seed, pos).sprite.drop(); + Dungeon.limitedDrops.blandfruitSeed.count++; + } + } else + level.drop(seed, pos).sprite.drop(); + } - // Dew, scales from 1/6 to 1/3 - if (Random.Int(24 - naturalismLevel*3) <= 3) { - level.drop(new Dewdrop(), pos).sprite.drop(); - } - } - } + // Dew, scales from 1/6 to 1/3 + if (Random.Int(24 - naturalismLevel*3) <= 3) { + level.drop(new Dewdrop(), pos).sprite.drop(); + } + } + } int leaves = 4; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java index 1a1219513..ef3e56c86 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java @@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage; public class Sign { - private static final String TXT_DEAD_END = + private static final String TXT_DEAD_END = "What are you doing here?!"; private static final String[] TIPS = { @@ -103,17 +103,17 @@ public class Sign { if (index < TIPS.length) { GameScene.show( new WndMessage( TIPS[index] ) ); - if (index >= 21) { + if (index >= 21) { - Level.set( pos, Terrain.EMBERS ); - GameScene.updateMap( pos ); - GameScene.discoverTile( pos, Terrain.SIGN ); + Level.set( pos, Terrain.EMBERS ); + GameScene.updateMap( pos ); + GameScene.discoverTile( pos, Terrain.SIGN ); - GLog.w( TXT_BURN ); + GLog.w( TXT_BURN ); - CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 ); - Sample.INSTANCE.play( Assets.SND_BURNING ); - } + CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 ); + Sample.INSTANCE.play( Assets.SND_BURNING ); + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/BlacksmithPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/BlacksmithPainter.java index be6400ae2..e8f072c9b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/BlacksmithPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/BlacksmithPainter.java @@ -40,9 +40,9 @@ public class BlacksmithPainter extends Painter { do { pos = room.random(); } while (level.map[pos] != Terrain.EMPTY_SP); - level.drop( - Generator.random( Random.oneOf( - Generator.Category.ARMOR, + level.drop( + Generator.random( Random.oneOf( + Generator.Category.ARMOR, Generator.Category.WEAPON ) ), pos ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/GardenPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/GardenPainter.java index 239188b9b..e20144a4c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/GardenPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/GardenPainter.java @@ -37,21 +37,21 @@ public class GardenPainter extends Painter { room.entrance().set( Room.Door.Type.REGULAR ); - if (Dungeon.isChallenged(Challenges.NO_FOOD)) { - if (Random.Int(2) == 0){ - level.plant(new Sungrass.Seed(), room.random()); - } - } else { - int bushes = Random.Int(3); - if (bushes == 0) { - level.plant(new Sungrass.Seed(), room.random()); - } else if (bushes == 1) { - level.plant(new BlandfruitBush.Seed(), room.random()); - } else if (Random.Int(5) == 0) { - level.plant(new Sungrass.Seed(), room.random()); - level.plant(new BlandfruitBush.Seed(), room.random()); - } - } + if (Dungeon.isChallenged(Challenges.NO_FOOD)) { + if (Random.Int(2) == 0){ + level.plant(new Sungrass.Seed(), room.random()); + } + } else { + int bushes = Random.Int(3); + if (bushes == 0) { + level.plant(new Sungrass.Seed(), room.random()); + } else if (bushes == 1) { + level.plant(new BlandfruitBush.Seed(), room.random()); + } else if (Random.Int(5) == 0) { + level.plant(new Sungrass.Seed(), room.random()); + level.plant(new BlandfruitBush.Seed(), room.random()); + } + } Foliage light = (Foliage)level.blobs.get( Foliage.class ); if (light == null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LaboratoryPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LaboratoryPainter.java index e9d5c9e78..0b3690de6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LaboratoryPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LaboratoryPainter.java @@ -60,7 +60,7 @@ public class LaboratoryPainter extends Painter { do { pos = room.random(); } while ( - level.map[pos] != Terrain.EMPTY_SP || + level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null); level.drop( prize( level ), pos ); } @@ -71,10 +71,10 @@ public class LaboratoryPainter extends Painter { private static Item prize( Level level ) { - Item prize = level.findPrizeItem( Potion.class ); - if (prize == null) - prize = Generator.random( Generator.Category.POTION ); + Item prize = level.findPrizeItem( Potion.class ); + if (prize == null) + prize = Generator.random( Generator.Category.POTION ); - return prize; + return prize; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LibraryPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LibraryPainter.java index 6df5ebcd4..1d6832749 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LibraryPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/LibraryPainter.java @@ -80,7 +80,7 @@ public class LibraryPainter extends Painter { Item prize = level.findPrizeItem( Scroll.class ); if (prize == null) - prize = Generator.random( Generator.Category.SCROLL ); + prize = Generator.random( Generator.Category.SCROLL ); return prize; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java index 92722c615..e1c06781c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java @@ -30,7 +30,7 @@ import com.watabou.utils.Random; public class MagicWellPainter extends Painter { - private static final Class[] WATERS = + private static final Class[] WATERS = {WaterOfAwareness.class, WaterOfHealth.class, WaterOfTransmutation.class}; public static void paint( Level level, Room room ) { @@ -42,9 +42,9 @@ public class MagicWellPainter extends Painter { set( level, c.x, c.y, Terrain.WELL ); @SuppressWarnings("unchecked") - Class waterClass = + Class waterClass = Dungeon.depth >= Dungeon.transmutation ? - WaterOfTransmutation.class : + WaterOfTransmutation.class : (Class)Random.element( WATERS ); if (waterClass == WaterOfTransmutation.class) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PitPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PitPainter.java index 122443235..e7379c084 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PitPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PitPainter.java @@ -60,10 +60,10 @@ public class PitPainter extends Painter { if (loot == 0) { level.drop( Generator.random( Generator.Category.RING ), remains ); } else if (loot == 1) { - level.drop( Generator.random( Generator.Category.ARTIFACT ), remains ); - } else { - level.drop( Generator.random( Random.oneOf( - Generator.Category.WEAPON, + level.drop( Generator.random( Generator.Category.ARTIFACT ), remains ); + } else { + level.drop( Generator.random( Random.oneOf( + Generator.Category.WEAPON, Generator.Category.ARMOR ) ), remains ); } @@ -77,15 +77,15 @@ public class PitPainter extends Painter { private static Item prize( Level level ) { if (Random.Int(2) != 0){ - Item prize = level.findPrizeItem(); - if (prize != null) - return prize; - } + Item prize = level.findPrizeItem(); + if (prize != null) + return prize; + } - return Generator.random( Random.oneOf( - Generator.Category.POTION, + return Generator.random( Random.oneOf( + Generator.Category.POTION, Generator.Category.SCROLL, - Generator.Category.FOOD, + Generator.Category.FOOD, Generator.Category.GOLD ) ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java index 0aaea3b94..66f3dbf45 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java @@ -37,7 +37,7 @@ public class PoolPainter extends Painter { fill( level, room, Terrain.WALL ); fill( level, room, 1, Terrain.WATER ); - Room.Door door = room.entrance(); + Room.Door door = room.entrance(); door.set( Room.Door.Type.REGULAR ); int x = -1; @@ -65,7 +65,7 @@ public class PoolPainter extends Painter { } int pos = x + y * Level.WIDTH; - level.drop( prize( level ), pos ).type = + level.drop( prize( level ), pos ).type = Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP; set( level, pos, Terrain.PEDESTAL ); @@ -82,29 +82,29 @@ public class PoolPainter extends Painter { private static Item prize( Level level ) { - Item prize; + Item prize; - if (Random.Int(3) != 0){ - prize = level.findPrizeItem(); - if (prize != null) - return prize; - } + if (Random.Int(3) != 0){ + prize = level.findPrizeItem(); + if (prize != null) + return prize; + } - prize = Generator.random( Random.oneOf( - Generator.Category.WEAPON, - Generator.Category.ARMOR - ) ); + prize = Generator.random( Random.oneOf( + Generator.Category.WEAPON, + Generator.Category.ARMOR + ) ); - for (int i=0; i < 4; i++) { - Item another = Generator.random( Random.oneOf( - Generator.Category.WEAPON, - Generator.Category.ARMOR - ) ); - if (another.level > prize.level) { - prize = another; - } - } + for (int i=0; i < 4; i++) { + Item another = Generator.random( Random.oneOf( + Generator.Category.WEAPON, + Generator.Category.ARMOR + ) ); + if (another.level > prize.level) { + prize = another; + } + } - return prize; + return prize; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RatKingPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RatKingPainter.java index b5e57fab4..0e1507b61 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RatKingPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RatKingPainter.java @@ -56,9 +56,9 @@ public class RatKingPainter extends Painter { private static void addChest( Level level, int pos, int door ) { - if (pos == door - 1 || - pos == door + 1 || - pos == door - Level.WIDTH || + if (pos == door - 1 || + pos == door + 1 || + pos == door - Level.WIDTH || pos == door + Level.WIDTH) { return; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java index 63d34ca6e..e0204a509 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java @@ -208,8 +208,8 @@ public class ShopPainter extends Painter { TimekeepersHourglass hourglass = Dungeon.hero.belongings.getItem(TimekeepersHourglass.class); if (hourglass != null){ int bags = 0; - //creates the given float percent of the remaining bags to be dropped. - //this way players who get the hourglass late can still max it, usually. + //creates the given float percent of the remaining bags to be dropped. + //this way players who get the hourglass late can still max it, usually. switch (Dungeon.depth) { case 6: bags = (int)Math.ceil(( 5-hourglass.sandBags) * 0.20f ); break; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StandardPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StandardPainter.java index 34d023f6f..3fcb7294f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StandardPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StandardPainter.java @@ -79,7 +79,7 @@ public class StandardPainter extends Painter { // Fissure } case 5: - if (!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && + if (!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Math.min( room.width(), room.height() ) >= 5) { paintFissure( level, room ); return; @@ -130,7 +130,7 @@ public class StandardPainter extends Painter { for (int i=0; i < nGraves; i++) { int pos = w > h ? room.left + 1 + shift + i * 2 + (room.top + 2 + Random.Int( h-2 )) * Level.WIDTH : - (room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH; + (room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH; level.drop( i == index ? Generator.random() : new Gold().random(), pos ).type = Heap.Type.TOMB; } } @@ -149,42 +149,42 @@ public class StandardPainter extends Painter { } } - //TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly. + //TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly. private static void paintStudy( Level level, Room room ) { fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF ); fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP ); - for (Point door : room.connected.values()) { - if (door.x == room.left) { - set( level, door.x + 1, door.y, Terrain.EMPTY ); - } else if (door.x == room.right) { - set( level, door.x - 1, door.y, Terrain.EMPTY ); - } else if (door.y == room.top) { - set( level, door.x, door.y + 1, Terrain.EMPTY ); - } else if (door.y == room.bottom) { - set( level, door.x , door.y - 1, Terrain.EMPTY ); - } - } + for (Point door : room.connected.values()) { + if (door.x == room.left) { + set( level, door.x + 1, door.y, Terrain.EMPTY ); + } else if (door.x == room.right) { + set( level, door.x - 1, door.y, Terrain.EMPTY ); + } else if (door.y == room.top) { + set( level, door.x, door.y + 1, Terrain.EMPTY ); + } else if (door.y == room.bottom) { + set( level, door.x , door.y - 1, Terrain.EMPTY ); + } + } Point center = room.center(); set( level, center, Terrain.PEDESTAL ); - if (Random.Int(2) != 0){ - Item prize = level.findPrizeItem(); - if (prize != null) { - level.drop(prize, (room.center().x + center.y * level.WIDTH)); - return; - } - } + if (Random.Int(2) != 0){ + Item prize = level.findPrizeItem(); + if (prize != null) { + level.drop(prize, (room.center().x + center.y * level.WIDTH)); + return; + } + } - level.drop(Generator.random( Random.oneOf( - Generator.Category.POTION, - Generator.Category.SCROLL)), (room.center().x + center.y * level.WIDTH)); - } + level.drop(Generator.random( Random.oneOf( + Generator.Category.POTION, + Generator.Category.SCROLL)), (room.center().x + center.y * level.WIDTH)); + } private static void paintBridge( Level level, Room room ) { - fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , - !Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Random.Int( 3 ) == 0 ? - Terrain.CHASM : + fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , + !Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Random.Int( 3 ) == 0 ? + Terrain.CHASM : Terrain.WATER ); Point door1 = null; @@ -197,7 +197,7 @@ public class StandardPainter extends Painter { } } - if ((door1.x == room.left && door2.x == room.right) || + if ((door1.x == room.left && door2.x == room.right) || (door1.x == room.right && door2.x == room.left)) { int s = room.width() / 2; @@ -206,8 +206,8 @@ public class StandardPainter extends Painter { drawInside( level, room, door2, s, Terrain.EMPTY_SP ); fill( level, room.center().x, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP ); - } else - if ((door1.y == room.top && door2.y == room.bottom) || + } else + if ((door1.y == room.top && door2.y == room.bottom) || (door1.y == room.bottom && door2.y == room.top)) { int s = room.height() / 2; @@ -216,7 +216,7 @@ public class StandardPainter extends Painter { drawInside( level, room, door2, s, Terrain.EMPTY_SP ); fill( level, Math.min( door1.x, door2.x ), room.center().y, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP ); - } else + } else if (door1.x == door2.x) { fill( level, door1.x == room.left ? room.left + 1 : room.right - 1, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP ); @@ -232,7 +232,7 @@ public class StandardPainter extends Painter { drawInside( level, room, door1, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP ); drawInside( level, room, door2, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP ); - } else + } else if (door1.x == room.left || door1.x == room.right) { drawInside( level, room, door1, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StoragePainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StoragePainter.java index ec3916042..259d618dd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StoragePainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/StoragePainter.java @@ -56,16 +56,16 @@ public class StoragePainter extends Painter { private static Item prize( Level level ) { - if (Random.Int(2) != 0){ - Item prize = level.findPrizeItem(); - if (prize != null) - return prize; - } + if (Random.Int(2) != 0){ + Item prize = level.findPrizeItem(); + if (prize != null) + return prize; + } - return Generator.random( Random.oneOf( - Generator.Category.POTION, + return Generator.random( Random.oneOf( + Generator.Category.POTION, Generator.Category.SCROLL, - Generator.Category.FOOD, + Generator.Category.FOOD, Generator.Category.GOLD ) ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java index b5b35bd22..c10f9c742 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java @@ -50,7 +50,7 @@ public class TrapsPainter extends Painter { fill(level, room, 1, Terrain.TRAP); } - Room.Door door = room.entrance(); + Room.Door door = room.entrance(); door.set( Room.Door.Type.REGULAR ); int lastRow = level.map[room.left + 1 + (room.top + 1) * Level.WIDTH] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY; @@ -101,23 +101,23 @@ public class TrapsPainter extends Painter { private static Item prize( Level level ) { - Item prize; + Item prize; - if (Random.Int(4) != 0){ - prize = level.findPrizeItem(); - if (prize != null) - return prize; - } + if (Random.Int(4) != 0){ + prize = level.findPrizeItem(); + if (prize != null) + return prize; + } - prize = Generator.random( Random.oneOf( - Generator.Category.WEAPON, - Generator.Category.ARMOR + prize = Generator.random( Random.oneOf( + Generator.Category.WEAPON, + Generator.Category.ARMOR ) ); for (int i=0; i < 3; i++) { - Item another = Generator.random( Random.oneOf( - Generator.Category.WEAPON, - Generator.Category.ARMOR + Item another = Generator.random( Random.oneOf( + Generator.Category.WEAPON, + Generator.Category.ARMOR ) ); if (another.level > prize.level) { prize = another; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java index 6cc6726c5..3d6dcb9ea 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java @@ -68,10 +68,10 @@ public class VaultPainter extends Painter { } private static Item prize( Level level ) { - return Generator.random( Random.oneOf( - Generator.Category.WAND, + return Generator.random( Random.oneOf( + Generator.Category.WAND, Generator.Category.RING, - Generator.Category.ARTIFACT + Generator.Category.ARTIFACT ) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java index 16b5844dc..eb04934bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java @@ -30,7 +30,7 @@ public class WeakFloorPainter extends Painter { fill( level, room, Terrain.WALL ); fill( level, room, 1, Terrain.CHASM ); - Room.Door door = room.entrance(); + Room.Door door = room.entrance(); door.set( Room.Door.Type.REGULAR ); if (door.x == room.left) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java b/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java index 9b3e8bdf1..cdfe98bdb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java @@ -92,7 +92,7 @@ public final class ShadowCaster { if (obs.isBlocked( a0 ) && obs.isBlocked( a1 ) && obs.isBlocked( a2 )) { - // Do nothing + // Do nothing } else { fieldOfView[pos] = true; } @@ -126,7 +126,7 @@ public final class ShadowCaster { if (length > limit && o1 <= a2[length-1]) { - // Merging several blocking cells + // Merging several blocking cells a2[length-1] = o2; } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java index 3bba516ab..834f0eb1b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java @@ -6,46 +6,43 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -/** - * Created by Evan on 13/08/2014. - */ public class BlandfruitBush extends Plant { - private static final String TXT_DESC = - "Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. " + - "The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked."; + private static final String TXT_DESC = + "Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. " + + "The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked."; - { - image = 8; - plantName = "Blandfruit"; - } + { + image = 8; + plantName = "Blandfruit"; + } - @Override - public void activate() { - Char ch = Actor.findChar(pos); + @Override + public void activate() { + Char ch = Actor.findChar(pos); - Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop(); - } + Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop(); + } - @Override - public String desc() { - return TXT_DESC; - } + @Override + public String desc() { + return TXT_DESC; + } - public static class Seed extends Plant.Seed { - { - plantName = "Blandfruit"; + public static class Seed extends Plant.Seed { + { + plantName = "Blandfruit"; - name = "seed of " + plantName; - image = ItemSpriteSheet.SEED_BLANDFRUIT; + name = "seed of " + plantName; + image = ItemSpriteSheet.SEED_BLANDFRUIT; - plantClass = BlandfruitBush.class; - alchemyClass = null; - } + plantClass = BlandfruitBush.class; + alchemyClass = null; + } - @Override - public String desc() { - return TXT_DESC; - } - } + @Override + public String desc() { + return TXT_DESC; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java index 35f68ca4f..c5a7c340f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java @@ -32,9 +32,9 @@ import com.watabou.utils.Random; public class Blindweed extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "Upon being touched a Blindweed perishes in a bright flash of light. " + - "The flash is strong enough to disorient for several seconds."; + "The flash is strong enough to disorient for several seconds."; { image = 3; @@ -46,9 +46,9 @@ public class Blindweed extends Plant { Char ch = Actor.findChar(pos); if (ch != null) { - int len = Random.Int( 5, 10 ); + int len = Random.Int( 5, 10 ); Buff.prolong( ch, Blindness.class, len ); - Buff.prolong( ch, Cripple.class, len ); + Buff.prolong( ch, Cripple.class, len ); if (ch instanceof Mob) { if (((Mob)ch).state == ((Mob)ch).HUNTING) ((Mob)ch).state = ((Mob)ch).WANDERING; ((Mob)ch).beckon( Dungeon.level.randomDestination() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java index d56344983..9794c50ac 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java @@ -36,55 +36,55 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; public class Dreamfoil extends Plant { - private static final String TXT_DESC = - "The Dreamfoil's prickly flowers contain a chemical which is known for its " + - "properties as a strong neutralizing agent. Most weaker creatures are overwhelmed " + - "and knocked unconscious, which gives the plant its namesake."; + private static final String TXT_DESC = + "The Dreamfoil's prickly flowers contain a chemical which is known for its " + + "properties as a strong neutralizing agent. Most weaker creatures are overwhelmed " + + "and knocked unconscious, which gives the plant its namesake."; - { - image = 10; - plantName = "Dreamfoil"; - } + { + image = 10; + plantName = "Dreamfoil"; + } - @Override - public void activate() { - Char ch = Actor.findChar(pos); + @Override + public void activate() { + Char ch = Actor.findChar(pos); - if (ch != null) { - if (ch instanceof Mob) - Buff.affect(ch, MagicalSleep.class); - else if (ch instanceof Hero){ - GLog.i( "You feel refreshed." ); - Buff.detach( ch, Poison.class ); - Buff.detach( ch, Cripple.class ); - Buff.detach( ch, Weakness.class ); - Buff.detach( ch, Bleeding.class ); - Buff.detach( ch, Drowsy.class ); - Buff.detach( ch, Slow.class ); - Buff.detach( ch, Vertigo.class); - } - } - } + if (ch != null) { + if (ch instanceof Mob) + Buff.affect(ch, MagicalSleep.class); + else if (ch instanceof Hero){ + GLog.i( "You feel refreshed." ); + Buff.detach( ch, Poison.class ); + Buff.detach( ch, Cripple.class ); + Buff.detach( ch, Weakness.class ); + Buff.detach( ch, Bleeding.class ); + Buff.detach( ch, Drowsy.class ); + Buff.detach( ch, Slow.class ); + Buff.detach( ch, Vertigo.class); + } + } + } - @Override - public String desc() { - return TXT_DESC; - } + @Override + public String desc() { + return TXT_DESC; + } - public static class Seed extends Plant.Seed { - { - plantName = "Dreamfoil"; + public static class Seed extends Plant.Seed { + { + plantName = "Dreamfoil"; - name = "seed of " + plantName; - image = ItemSpriteSheet.SEED_DREAMFOIL; + name = "seed of " + plantName; + image = ItemSpriteSheet.SEED_DREAMFOIL; - plantClass = Dreamfoil.class; - alchemyClass = PotionOfPurity.class; - } + plantClass = Dreamfoil.class; + alchemyClass = PotionOfPurity.class; + } - @Override - public String desc() { - return TXT_DESC; - } - } + @Override + public String desc() { + return TXT_DESC; + } + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java index 116ad7962..7124eb4a5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java @@ -32,7 +32,7 @@ import com.watabou.utils.Bundle; public class Earthroot extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "When a creature touches an Earthroot, its roots " + "create a kind of immobile natural armor around it."; @@ -51,7 +51,7 @@ public class Earthroot extends Plant { if (Dungeon.visible[pos]) { CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 ); - Camera.main.shake( 1, 0.4f ); + Camera.main.shake( 1, 0.4f ); } } @@ -70,7 +70,7 @@ public class Earthroot extends Plant { plantClass = Earthroot.class; alchemyClass = PotionOfParalyticGas.class; - bones = true; + bones = true; } @Override @@ -128,7 +128,7 @@ public class Earthroot extends Plant { @Override public String toString() { - return Utils.format("Herbal armor", level); + return Utils.format("Herbal armor", level); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java index 1e09d316e..9c513fe63 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java @@ -30,7 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class Fadeleaf extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "Touching a Fadeleaf will teleport any creature " + "to a random place on the current level."; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java index ea2d6a365..1012c8f77 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java @@ -28,9 +28,9 @@ import com.watabou.utils.PathFinder; public class Icecap extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "Upon being touched, an Icecap lets out a puff of freezing pollen. " + - "The freezing effect is much stronger if the environment is wet."; + "The freezing effect is much stronger if the environment is wet."; { image = 1; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 23bf3560b..390782842 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -75,22 +75,22 @@ public abstract class Plant implements Bundlable { if (Dungeon.hero.subClass == HeroSubClass.WARDEN) { - int naturalismLevel = 0; - SandalsOfNature.Naturalism naturalism = Dungeon.hero.buff( SandalsOfNature.Naturalism.class ); - if (naturalism != null) { - naturalismLevel = naturalism.level()+1; - } + int naturalismLevel = 0; + SandalsOfNature.Naturalism naturalism = Dungeon.hero.buff( SandalsOfNature.Naturalism.class ); + if (naturalism != null) { + naturalismLevel = naturalism.level()+1; + } if (Random.Int( 5 - (naturalismLevel/2) ) == 0) { - Item seed = Generator.random(Generator.Category.SEED); + Item seed = Generator.random(Generator.Category.SEED); - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) { - Dungeon.level.drop(seed, pos).sprite.drop(); - Dungeon.limitedDrops.blandfruitSeed.count++; - } - } else - Dungeon.level.drop(seed, pos).sprite.drop(); + if (seed instanceof BlandfruitBush.Seed) { + if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) { + Dungeon.level.drop(seed, pos).sprite.drop(); + Dungeon.limitedDrops.blandfruitSeed.count++; + } + } else + Dungeon.level.drop(seed, pos).sprite.drop(); } if (Random.Int( 5 - naturalismLevel ) == 0) { Dungeon.level.drop( new Dewdrop(), pos ).sprite.drop(); @@ -123,7 +123,7 @@ public abstract class Plant implements Bundlable { private static final float TIME_TO_PLANT = 1f; { - stackable = true; + stackable = true; defaultAction = AC_THROW; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java index 2dec65c13..1940a78d2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java @@ -29,7 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class Sorrowmoss extends Plant { - private static final String TXT_DESC = + private static final String TXT_DESC = "A Sorrowmoss is a flower (not a moss) with razor-sharp petals, coated with a deadly venom."; { @@ -42,7 +42,7 @@ public class Sorrowmoss extends Plant { Char ch = Actor.findChar(pos); if (ch != null) { - Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) ); + Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) ); } if (Dungeon.visible[pos]) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java index 3202ee74b..dab51cdb4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java @@ -7,48 +7,45 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -/** - * Created by Evan on 23/10/2014. - */ public class Stormvine extends Plant { - private static final String TXT_DESC = - "Gravity affects the Stormvine plant strangely, allowing its whispy blue tendrils " + - "to 'hang' on the air. Anything caught in the vine is affected by this, and becomes disoriented."; + private static final String TXT_DESC = + "Gravity affects the Stormvine plant strangely, allowing its whispy blue tendrils " + + "to 'hang' on the air. Anything caught in the vine is affected by this, and becomes disoriented."; - { - image = 9; - plantName = "Stormvine"; - } + { + image = 9; + plantName = "Stormvine"; + } - @Override - public void activate() { - Char ch = Actor.findChar(pos); + @Override + public void activate() { + Char ch = Actor.findChar(pos); - if (ch != null) { - Buff.affect(ch, Vertigo.class, Vertigo.duration( ch ) ); - } - } + if (ch != null) { + Buff.affect(ch, Vertigo.class, Vertigo.duration( ch ) ); + } + } - @Override - public String desc() { - return TXT_DESC; - } + @Override + public String desc() { + return TXT_DESC; + } - public static class Seed extends Plant.Seed { - { - plantName = "Stormvine"; + public static class Seed extends Plant.Seed { + { + plantName = "Stormvine"; - name = "seed of " + plantName; - image = ItemSpriteSheet.SEED_STORMVINE; + name = "seed of " + plantName; + image = ItemSpriteSheet.SEED_STORMVINE; - plantClass = Stormvine.class; - alchemyClass = PotionOfLevitation.class; - } + plantClass = Stormvine.class; + alchemyClass = PotionOfLevitation.class; + } - @Override - public String desc() { - return TXT_DESC; - } - } + @Override + public String desc() { + return TXT_DESC; + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java index b85d016aa..d7729f720 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java @@ -67,7 +67,7 @@ public class Sungrass extends Plant { plantClass = Sungrass.class; alchemyClass = PotionOfHealing.class; - bones = true; + bones = true; } @Override @@ -81,9 +81,9 @@ public class Sungrass extends Plant { private static final float STEP = 1f; private int pos; - private int healCurr = 1; - private int count = 0; - private int level; + private int healCurr = 1; + private int count = 0; + private int level; { type = buffType.POSITIVE; @@ -96,38 +96,38 @@ public class Sungrass extends Plant { } @Override - public boolean act() { - if (target.pos != pos) { - detach(); - } - if (count == 5) { - if (level <= healCurr*.025*target.HT) { - target.HP = Math.min(target.HT, target.HP + level); - target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); - detach(); - } else { - target.HP = Math.min(target.HT, target.HP+(int)(healCurr*.025*target.HT)); - level -= (healCurr*.025*target.HT); - if (healCurr < 6) - healCurr ++; - target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); - } - count = 1; - } else { - count++; - } - if (level <= 0) - detach(); - spend( STEP ); - return true; - } + public boolean act() { + if (target.pos != pos) { + detach(); + } + if (count == 5) { + if (level <= healCurr*.025*target.HT) { + target.HP = Math.min(target.HT, target.HP + level); + target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); + detach(); + } else { + target.HP = Math.min(target.HT, target.HP+(int)(healCurr*.025*target.HT)); + level -= (healCurr*.025*target.HT); + if (healCurr < 6) + healCurr ++; + target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); + } + count = 1; + } else { + count++; + } + if (level <= 0) + detach(); + spend( STEP ); + return true; + } - public int absorb( int damage ) { - level -= damage; - if (level <= 0) - detach(); - return damage; - } + public int absorb( int damage ) { + level -= damage; + if (level <= 0) + detach(); + return damage; + } public void boost( int amount ){ level += amount; @@ -140,7 +140,7 @@ public class Sungrass extends Plant { @Override public String toString() { - return "Herbal Healing"; + return "Herbal Healing"; } @Override @@ -154,26 +154,26 @@ public class Sungrass extends Plant { } private static final String POS = "pos"; - private static final String HEALCURR = "healCurr"; - private static final String COUNT = "count"; - private static final String LEVEL = "level"; + private static final String HEALCURR = "healCurr"; + private static final String COUNT = "count"; + private static final String LEVEL = "level"; - @Override + @Override public void storeInBundle( Bundle bundle ) { super.storeInBundle( bundle ); bundle.put( POS, pos ); - bundle.put( HEALCURR, healCurr); - bundle.put( COUNT, count); - bundle.put( LEVEL, level); + bundle.put( HEALCURR, healCurr); + bundle.put( COUNT, count); + bundle.put( LEVEL, level); } @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); pos = bundle.getInt( POS ); - healCurr = bundle.getInt( HEALCURR ); - count = bundle.getInt( COUNT ); - level = bundle.getInt( LEVEL ); + healCurr = bundle.getInt( HEALCURR ); + count = bundle.getInt( COUNT ); + level = bundle.getInt( LEVEL ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java index f8ad8a378..3e23b51b9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java @@ -35,21 +35,21 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window; public class AboutScene extends PixelScene { - private static final String TTL_SHPX = "Shattered Pixel Dungeon"; + private static final String TTL_SHPX = "Shattered Pixel Dungeon"; - private static final String TXT_SHPX = - "Design, Code, & Graphics: Evan\n\n" + - "Shattered Pixel is Evan's online home, check it out:"; + private static final String TXT_SHPX = + "Design, Code, & Graphics: Evan\n\n" + + "Shattered Pixel is Evan's online home, check it out:"; - private static final String LNK_SHPX = "ShatteredPixel.com"; + private static final String LNK_SHPX = "ShatteredPixel.com"; - private static final String TTL_WATA = "Original Pixel Dungeon"; + private static final String TTL_WATA = "Original Pixel Dungeon"; private static final String TXT_WATA = - "Code & Graphics: Watabou\n" + - "Music: Cube_Code\n\n" + - "Visit Watabou for more info:"; + "Code & Graphics: Watabou\n" + + "Music: Cube_Code\n\n" + + "Visit Watabou for more info:"; private static final String LNK_WATA = "pixeldungeon.watabou.ru"; @@ -61,65 +61,65 @@ public class AboutScene extends PixelScene { final float colTop = (Camera.main.height / 2) - (ShatteredPixelDungeon.landscape() ? 30 : 90); final float wataOffset = ShatteredPixelDungeon.landscape() ? colWidth : 0; - Image shpx = Icons.SHPX.get(); - shpx.x = align( (colWidth - shpx.width()) / 2 ); - shpx.y = align( colTop ); - add( shpx ); + Image shpx = Icons.SHPX.get(); + shpx.x = align( (colWidth - shpx.width()) / 2 ); + shpx.y = align( colTop ); + add( shpx ); - new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20; + new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20; - BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 ); - shpxtitle.maxWidth = (int) Math.min( colWidth, 120 ); - shpxtitle.measure(); - shpxtitle.hardlight( Window.SHPX_COLOR ); - add( shpxtitle ); + BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 ); + shpxtitle.maxWidth = (int) Math.min( colWidth, 120 ); + shpxtitle.measure(); + shpxtitle.hardlight( Window.SHPX_COLOR ); + add( shpxtitle ); - shpxtitle.x = align( (colWidth - shpxtitle.width()) / 2 ); - shpxtitle.y = align( shpx.y + shpx.height + 5 ); + shpxtitle.x = align( (colWidth - shpxtitle.width()) / 2 ); + shpxtitle.y = align( shpx.y + shpx.height + 5 ); - BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 ); - shpxtext.maxWidth = shpxtitle.maxWidth; - shpxtext.measure(); - add( shpxtext ); + BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 ); + shpxtext.maxWidth = shpxtitle.maxWidth; + shpxtext.measure(); + add( shpxtext ); - shpxtext.x = align( (colWidth - shpxtext.width()) / 2 ); - shpxtext.y = align( shpxtitle.y + shpxtitle.height() + 12 ); + shpxtext.x = align( (colWidth - shpxtext.width()) / 2 ); + shpxtext.y = align( shpxtitle.y + shpxtitle.height() + 12 ); - BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 ); - shpxlink.maxWidth = shpxtitle.maxWidth; - shpxlink.measure(); - shpxlink.hardlight( Window.SHPX_COLOR ); - add( shpxlink ); + BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 ); + shpxlink.maxWidth = shpxtitle.maxWidth; + shpxlink.measure(); + shpxlink.hardlight( Window.SHPX_COLOR ); + add( shpxlink ); - shpxlink.x = shpxtext.x; - shpxlink.y = shpxtext.y + shpxtext.height(); + shpxlink.x = shpxtext.x; + shpxlink.y = shpxtext.y + shpxtext.height(); - TouchArea shpxhotArea = new TouchArea( shpxlink ) { - @Override - protected void onClick( Touch touch ) { - Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://shatteredpixel.tumblr.com") ); - Game.instance.startActivity( intent ); - } - }; - add( shpxhotArea ); + TouchArea shpxhotArea = new TouchArea( shpxlink ) { + @Override + protected void onClick( Touch touch ) { + Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://shatteredpixel.tumblr.com") ); + Game.instance.startActivity( intent ); + } + }; + add( shpxhotArea ); - Image wata = Icons.WATA.get(); - wata.x = align( wataOffset + (colWidth - wata.width()) / 2 ); - wata.y = align( ShatteredPixelDungeon.landscape() ? - colTop: - shpxlink.y + wata.height + 20); - add( wata ); + Image wata = Icons.WATA.get(); + wata.x = align( wataOffset + (colWidth - wata.width()) / 2 ); + wata.y = align( ShatteredPixelDungeon.landscape() ? + colTop: + shpxlink.y + wata.height + 20); + add( wata ); - new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20; + new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20; - BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 ); - wataTitle.maxWidth = (int) Math.min( colWidth, 120 ); - wataTitle.measure(); - wataTitle.hardlight(Window.TITLE_COLOR); - add( wataTitle ); + BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 ); + wataTitle.maxWidth = (int) Math.min( colWidth, 120 ); + wataTitle.measure(); + wataTitle.hardlight(Window.TITLE_COLOR); + add( wataTitle ); - wataTitle.x = align( wataOffset + (colWidth - wataTitle.width()) / 2 ); - wataTitle.y = align( wata.y + wata.height + 11 ); + wataTitle.x = align( wataOffset + (colWidth - wataTitle.width()) / 2 ); + wataTitle.y = align( wata.y + wata.height + 11 ); BitmapTextMultiline wataText = createMultiline( TXT_WATA, 8 ); wataText.maxWidth = wataTitle.maxWidth; @@ -152,9 +152,9 @@ public class AboutScene extends PixelScene { archs.setSize( Camera.main.width, Camera.main.height ); addToBack( archs ); - ExitButton btnExit = new ExitButton(); - btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); - add( btnExit ); + ExitButton btnExit = new ExitButton(); + btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); + add( btnExit ); fadeIn(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java index a3ab9ab30..792dc4cb0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java @@ -39,7 +39,7 @@ public class AmuletScene extends PixelScene { private static final float SMALL_GAP = 2; private static final float LARGE_GAP = 8; - private static final String TXT = + private static final String TXT = "You finally hold it in your hands, the Amulet of Yendor. Using its power " + "you can take over the world or bring peace and prosperity to people or whatever. " + "Anyway, your life will change forever and this game will end here. " + @@ -67,7 +67,7 @@ public class AmuletScene extends PixelScene { RedButton btnExit = new RedButton( TXT_EXIT ) { @Override protected void onClick() { - Dungeon.win( ResultDescriptions.WIN ); + Dungeon.win( ResultDescriptions.WIN ); Dungeon.deleteGame( Dungeon.hero.heroClass, true ); Game.switchScene( noText ? TitleScene.class : RankingsScene.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java index 86654349c..ace531c26 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java @@ -47,8 +47,8 @@ public class CellSelector extends TouchArea { } else { - select( ((DungeonTilemap)target).screenToTile( - (int)touch.current.x, + select( ((DungeonTilemap)target).screenToTile( + (int)touch.current.x, (int)touch.current.y ) ); } } @@ -90,8 +90,8 @@ public class CellSelector extends TouchArea { dragging = false; } else if (t != touch) { - reset(); - } + reset(); + } } @Override @@ -111,7 +111,7 @@ public class CellSelector extends TouchArea { another = null; lastPos.set( touch.current ); } - } + } private boolean dragging = false; private PointF lastPos = new PointF(); @@ -124,9 +124,9 @@ public class CellSelector extends TouchArea { if (pinching) { float curSpan = PointF.distance( touch.current, another.current ); - camera.zoom( GameMath.gate( - PixelScene.minZoom, - startZoom * curSpan / startSpan, + camera.zoom( GameMath.gate( + PixelScene.minZoom, + startZoom * curSpan / startSpan, PixelScene.maxZoom ) ); } else { @@ -138,11 +138,11 @@ public class CellSelector extends TouchArea { } else if (dragging) { camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) ); - lastPos.set( t.current ); - } + lastPos.set( t.current ); + } } - } + } public void cancel() { @@ -153,24 +153,24 @@ public class CellSelector extends TouchArea { GameScene.ready(); } - @Override - public void reset() { - super.reset(); - another = null; - if (pinching){ - pinching = false; + @Override + public void reset() { + super.reset(); + another = null; + if (pinching){ + pinching = false; - int zoom = Math.round( camera.zoom ); - camera.zoom( zoom ); - ShatteredPixelDungeon.zoom((int) (zoom - PixelScene.defaultZoom)); - } - } + int zoom = Math.round( camera.zoom ); + camera.zoom( zoom ); + ShatteredPixelDungeon.zoom((int) (zoom - PixelScene.defaultZoom)); + } + } - public void enable(boolean value){ - if (enabled != value){ - enabled = value; - } - } + public void enable(boolean value){ + if (enabled != value){ + enabled = value; + } + } public interface Listener { void onSelect( Integer cell ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index afdf61701..5f2537342 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -142,8 +142,8 @@ public class GameScene extends PixelScene { terrain = new Group(); add( terrain ); - water = new SkinnedBlock( - Level.WIDTH * DungeonTilemap.SIZE, + water = new SkinnedBlock( + Level.WIDTH * DungeonTilemap.SIZE, Level.HEIGHT * DungeonTilemap.SIZE, Dungeon.level.waterTex() ); terrain.add( water ); @@ -265,7 +265,7 @@ public class GameScene extends PixelScene { GLog.i( TXT_WELCOME_BACK, Dungeon.depth ); else GLog.i( TXT_WELCOME, Dungeon.depth ); - Sample.INSTANCE.play( Assets.SND_DESCEND ); + Sample.INSTANCE.play( Assets.SND_DESCEND ); switch (Dungeon.level.feeling) { case CHASM: GLog.w( TXT_CHASM ); @@ -281,7 +281,7 @@ public class GameScene extends PixelScene { break; default: } - if (Dungeon.level instanceof RegularLevel && + if (Dungeon.level instanceof RegularLevel && ((RegularLevel)Dungeon.level).secretDoors > Random.IntRange( 3, 4 )) { GLog.w( TXT_SECRETS ); } @@ -337,7 +337,7 @@ public class GameScene extends PixelScene { } else if (item instanceof Plant.Seed) { Dungeon.level.plant( (Plant.Seed)item, pos ); } else if (item instanceof Honeypot) { - Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos); + Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos); } else { Dungeon.level.drop( item, pos ); } @@ -353,7 +353,7 @@ public class GameScene extends PixelScene { freezeEmitters = false; - scene = null; + scene = null; Badges.saveGlobal(); super.destroy(); @@ -387,19 +387,19 @@ public class GameScene extends PixelScene { if (tagAttack != attack.active || tagLoot != loot.visible || tagResume != resume.visible) { - boolean atkAppearing = attack.active && !tagAttack; - boolean lootAppearing = loot.visible && !tagLoot; - boolean resAppearing = resume.visible && !tagResume; + boolean atkAppearing = attack.active && !tagAttack; + boolean lootAppearing = loot.visible && !tagLoot; + boolean resAppearing = resume.visible && !tagResume; tagAttack = attack.active; tagLoot = loot.visible; tagResume = resume.visible; if (atkAppearing || lootAppearing || resAppearing) - layoutTags(); + layoutTags(); } - cellSelector.enable(Dungeon.hero.ready); + cellSelector.enable(Dungeon.hero.ready); } private boolean tagAttack = false; @@ -435,8 +435,8 @@ public class GameScene extends PixelScene { } public void brightness( boolean value ) { - water.rm = water.gm = water.bm = - tiles.rm = tiles.gm = tiles.bm = + water.rm = water.gm = water.bm = + tiles.rm = tiles.gm = tiles.bm = value ? 1.5f : 1.0f; if (value) { fog.am = +2f; @@ -705,9 +705,9 @@ public class GameScene extends PixelScene { private static final CellSelector.Listener defaultCellListener = new CellSelector.Listener() { @Override public void onSelect( Integer cell ) { - if (Dungeon.hero.handle( cell )) { - Dungeon.hero.next(); - } + if (Dungeon.hero.handle( cell )) { + Dungeon.hero.next(); + } } @Override public String prompt() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java index be457d4f8..ac846734e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java @@ -46,9 +46,9 @@ public class InterlevelScene extends PixelScene { private static final String TXT_FALLING = "Falling..."; private static final String ERR_FILE_NOT_FOUND = "Save file not found. If this error persists after restarting, " + - "it may mean this save game is corrupted. Sorry about that."; + "it may mean this save game is corrupted. Sorry about that."; private static final String ERR_IO = "Cannot read save file. If this error persists after restarting, " + - "it may mean this save game is corrupted. Sorry about that."; + "it may mean this save game is corrupted. Sorry about that."; public static enum Mode { DESCEND, ASCEND, CONTINUE, RESURRECT, RETURN, FALL @@ -59,7 +59,7 @@ public class InterlevelScene extends PixelScene { public static int returnPos; public static boolean noStory = false; - + public static boolean fallIntoPit; private enum Phase { @@ -101,7 +101,7 @@ public class InterlevelScene extends PixelScene { message = PixelScene.createText( text, 9 ); message.measure(); - message.x = (Camera.main.width - message.width()) / 2; + message.x = (Camera.main.width - message.width()) / 2; message.y = (Camera.main.height - message.height()) / 2; add( message ); @@ -201,7 +201,7 @@ public class InterlevelScene extends PixelScene { Game.switchScene( StartScene.class ); }; } ); - error = null; + error = null; } break; } @@ -209,7 +209,7 @@ public class InterlevelScene extends PixelScene { private void descend() throws IOException { - Actor.fixTime(); + Actor.fixTime(); if (Dungeon.hero == null) { Dungeon.init(); if (noStory) { @@ -232,7 +232,7 @@ public class InterlevelScene extends PixelScene { private void fall() throws IOException { - Actor.fixTime(); + Actor.fixTime(); Dungeon.saveLevel(); Level level; @@ -280,7 +280,7 @@ public class InterlevelScene extends PixelScene { private void resurrect() throws IOException { - Actor.fixTime(); + Actor.fixTime(); if (Dungeon.level.locked) { Dungeon.hero.resurrect( Dungeon.depth ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java index 56a23f592..6b106a2a1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java @@ -23,13 +23,13 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory; public class IntroScene extends PixelScene { private static final String TEXT = - "Many heroes have ventured into the dungeon before you from the city above. Some " + - "have returned with treasures and magical artifacts, most have never been heard from again.\n\n" + - "None, however, have ventured to the bottom and retrieved the Amulet of Yendor, " + - "which is said to be guarded by an ancient evil in the depths. " + - "Even now dark energy radiates from below, making its way up into the city.\n\n" + - "You consider yourself ready for the challenge. Most importantly, " + - "you feel that fortune smiles upon you. It's time to start your own adventure!"; + "Many heroes have ventured into the dungeon before you from the city above. Some " + + "have returned with treasures and magical artifacts, most have never been heard from again.\n\n" + + "None, however, have ventured to the bottom and retrieved the Amulet of Yendor, " + + "which is said to be guarded by an ancient evil in the depths. " + + "Even now dark energy radiates from below, making its way up into the city.\n\n" + + "You consider yourself ready for the challenge. Most importantly, " + + "you feel that fortune smiles upon you. It's time to start your own adventure!"; @Override public void create() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index 35affc441..5a7904961 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -88,10 +88,10 @@ public class PixelScene extends Scene { Game.width / (defaultZoom + 1) >= minWidth && Game.height / (defaultZoom + 1) >= minHeight) { defaultZoom++; - } + } } minZoom = 1; - maxZoom = defaultZoom * 2; + maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); @@ -103,31 +103,31 @@ public class PixelScene extends Scene { if (font1x == null) { // 3x5 (6) - font1x = Font.colorMarked( + font1x = Font.colorMarked( BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL ); font1x.baseLine = 6; font1x.tracking = -1; // 5x8 (10) - font15x = Font.colorMarked( + font15x = Font.colorMarked( BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL ); font15x.baseLine = 9; font15x.tracking = -1; // 6x10 (12) - font2x = Font.colorMarked( + font2x = Font.colorMarked( BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL ); font2x.baseLine = 11; font2x.tracking = -1; // 7x12 (15) - font25x = Font.colorMarked( + font25x = Font.colorMarked( BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL ); font25x.baseLine = 13; font25x.tracking = -1; // 9x15 (18) - font3x = Font.colorMarked( + font3x = Font.colorMarked( BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); font3x.baseLine = 17; font3x.tracking = -2; @@ -248,14 +248,14 @@ public class PixelScene extends Scene { v.y = align( c, v.y ); } - public static boolean noFade = false; - protected void fadeIn() { - if (noFade) { - noFade = false; - } else { - fadeIn( 0xFF000000, false ); - } - } + public static boolean noFade = false; + protected void fadeIn() { + if (noFade) { + noFade = false; + } else { + fadeIn( 0xFF000000, false ); + } + } protected void fadeIn( int color, boolean light ) { add( new Fader( color, light ) ); @@ -316,10 +316,10 @@ public class PixelScene extends Scene { private static class PixelCamera extends Camera { public PixelCamera( float zoom ) { - super( - (int)(Game.width - Math.ceil( Game.width / zoom ) * zoom) / 2, - (int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2, - (int)Math.ceil( Game.width / zoom ), + super( + (int)(Game.width - Math.ceil( Game.width / zoom ) * zoom) / 2, + (int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2, + (int)Math.ceil( Game.width / zoom ), (int)Math.ceil( Game.height / zoom ), zoom ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index f1156c513..a28dfd6aa 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -105,30 +105,30 @@ public class RankingsScene extends PixelScene { } if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) { - BitmapText label = PixelScene.createText( TXT_TOTAL, 8 ); - label.hardlight( 0xCCCCCC ); - label.measure(); - add( label ); + BitmapText label = PixelScene.createText( TXT_TOTAL, 8 ); + label.hardlight( 0xCCCCCC ); + label.measure(); + add( label ); - BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 ); - won.hardlight( Window.SHPX_COLOR ); - won.measure(); - add( won ); + BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 ); + won.hardlight( Window.SHPX_COLOR ); + won.measure(); + add( won ); - BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 ); - total.hardlight( 0xCCCCCC ); - total.measure(); - total.x = align( (w - total.width()) / 2 ); - total.y = align( top + pos * rowHeight + GAP ); - add( total ); + BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 ); + total.hardlight( 0xCCCCCC ); + total.measure(); + total.x = align( (w - total.width()) / 2 ); + total.y = align( top + pos * rowHeight + GAP ); + add( total ); - float tw = label.width() + won.width() + total.width(); - label.x = align( (w - tw) / 2 ); - won.x = label.x + label.width(); - total.x = won.x + won.width(); - label.y = won.y = total.y = align( h - label.height() - GAP ); + float tw = label.width() + won.width() + total.width(); + label.x = align( (w - tw) / 2 ); + won.x = label.x + label.width(); + total.x = won.x + won.width(); + label.y = won.y = total.y = align( h - label.height() - GAP ); - } + } } else { @@ -141,16 +141,16 @@ public class RankingsScene extends PixelScene { } - ExitButton btnExit = new ExitButton(); - btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); - add( btnExit ); + ExitButton btnExit = new ExitButton(); + btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); + add( btnExit ); fadeIn(); } @Override protected void onBackPressed() { - ShatteredPixelDungeon.switchNoFade(TitleScene.class); + ShatteredPixelDungeon.switchNoFade(TitleScene.class); } public static class Record extends Button { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java index 317a3d480..a47a52d9e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java @@ -50,480 +50,480 @@ import com.watabou.utils.Callback; public class StartScene extends PixelScene { - private static final float BUTTON_HEIGHT = 24; - private static final float GAP = 2; + private static final float BUTTON_HEIGHT = 24; + private static final float GAP = 2; - private static final String TXT_LOAD = "Load Game"; - private static final String TXT_NEW = "New Game"; + private static final String TXT_LOAD = "Load Game"; + private static final String TXT_NEW = "New Game"; - private static final String TXT_ERASE = "Erase current game"; - private static final String TXT_DPTH_LVL = "Depth: %d, level: %d"; + private static final String TXT_ERASE = "Erase current game"; + private static final String TXT_DPTH_LVL = "Depth: %d, level: %d"; - private static final String TXT_REALLY = "Do you really want to start new game?"; - private static final String TXT_WARNING = "Your current game progress will be erased."; - private static final String TXT_YES = "Yes, start new game"; - private static final String TXT_NO = "No, return to main menu"; - - private static final String TXT_UNLOCK = "To unlock this character class, slay the 3rd boss with any other class"; - - private static final String TXT_WIN_THE_GAME = - "To unlock \"Challenges\", win the game with any character class."; - - private static final float WIDTH_P = 116; - private static final float HEIGHT_P = 220; - - private static final float WIDTH_L = 224; - private static final float HEIGHT_L = 124; - - private static HashMap shields = new HashMap(); - - private float buttonX; - private float buttonY; - - private GameButton btnLoad; - private GameButton btnNewGame; - - private boolean huntressUnlocked; - private Group unlock; - - public static HeroClass curClass; - - @Override - public void create() { - - super.create(); - - Badges.loadGlobal(); - - uiCamera.visible = false; - - int w = Camera.main.width; - int h = Camera.main.height; - - float width, height; - if (ShatteredPixelDungeon.landscape()) { - width = WIDTH_L; - height = HEIGHT_L; - } else { - width = WIDTH_P; - height = HEIGHT_P; - } - - float left = (w - width) / 2; - float top = (h - height) / 2; - float bottom = h - top; - - Archs archs = new Archs(); - archs.setSize( w, h ); - add( archs ); - - Image title = BannerSprites.get( Type.SELECT_YOUR_HERO ); - title.x = align( (w - title.width()) / 2 ); - title.y = align( top ); - add( title ); - - buttonX = left; - buttonY = bottom - BUTTON_HEIGHT; - - btnNewGame = new GameButton( TXT_NEW ) { - @Override - protected void onClick() { - if (GamesInProgress.check( curClass ) != null) { - StartScene.this.add( new WndOptions( TXT_REALLY, TXT_WARNING, TXT_YES, TXT_NO ) { - @Override - protected void onSelect( int index ) { - if (index == 0) { - startNewGame(); - } - } - } ); - - } else { - startNewGame(); - } - } - }; - add( btnNewGame ); - - btnLoad = new GameButton( TXT_LOAD ) { - @Override - protected void onClick() { - InterlevelScene.mode = InterlevelScene.Mode.CONTINUE; - Game.switchScene( InterlevelScene.class ); - } - }; - add( btnLoad ); - - float centralHeight = buttonY - title.y - title.height(); - - HeroClass[] classes = { - HeroClass.WARRIOR, HeroClass.MAGE, HeroClass.ROGUE, HeroClass.HUNTRESS - }; - for (HeroClass cl : classes) { - ClassShield shield = new ClassShield( cl ); - shields.put( cl, shield ); - add( shield ); - } - if (ShatteredPixelDungeon.landscape()) { - float shieldW = width / 4; - float shieldH = Math.min( centralHeight, shieldW ); - top = title.y + title.height + (centralHeight - shieldH) / 2; - for (int i=0; i < classes.length; i++) { - ClassShield shield = shields.get( classes[i] ); - shield.setRect( left + i * shieldW, top, shieldW, shieldH ); - } - - ChallengeButton challenge = new ChallengeButton(); - challenge.setPos( - w/2 - challenge.width()/2, - top + shieldH/2 - challenge.height()/2 ); - add( challenge ); - - } else { - float shieldW = width / 2; - float shieldH = Math.min( centralHeight / 2, shieldW * 1.2f ); - top = title.y + title.height() + centralHeight / 2 - shieldH; - for (int i=0; i < classes.length; i++) { - ClassShield shield = shields.get( classes[i] ); - shield.setRect( - left + (i % 2) * shieldW, - top + (i / 2) * shieldH, - shieldW, shieldH ); - } - - ChallengeButton challenge = new ChallengeButton(); - challenge.setPos( - w/2 - challenge.width()/2, - top + shieldH - challenge.height()/2 ); - add( challenge ); - - } - - unlock = new Group(); - add( unlock ); - - if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) { - - BitmapTextMultiline text = PixelScene.createMultiline( TXT_UNLOCK, 9 ); - text.maxWidth = (int)width; - text.measure(); - - float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2; - for (BitmapText line : text.new LineSplitter().split()) { - line.measure(); - line.hardlight( 0xFFFF00 ); - line.x = PixelScene.align( w / 2 - line.width() / 2 ); - line.y = PixelScene.align( pos ); - unlock.add( line ); - - pos += line.height(); - } - } - - ExitButton btnExit = new ExitButton(); - btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); - add( btnExit ); - - curClass = null; - updateClass( HeroClass.values()[ShatteredPixelDungeon.lastClass()] ); - - fadeIn(); - - Badges.loadingListener = new Callback() { - @Override - public void call() { - if (Game.scene() == StartScene.this) { - ShatteredPixelDungeon.switchNoFade( StartScene.class ); - } - } - }; - } - - @Override - public void destroy() { - - Badges.saveGlobal(); - Badges.loadingListener = null; - - super.destroy(); - - } - - private void updateClass( HeroClass cl ) { - - if (curClass == cl) { - add( new WndClass( cl ) ); - return; - } - - if (curClass != null) { - shields.get( curClass ).highlight( false ); - } - shields.get( curClass = cl ).highlight( true ); - - if (cl != HeroClass.HUNTRESS || huntressUnlocked) { + private static final String TXT_REALLY = "Do you really want to start new game?"; + private static final String TXT_WARNING = "Your current game progress will be erased."; + private static final String TXT_YES = "Yes, start new game"; + private static final String TXT_NO = "No, return to main menu"; + + private static final String TXT_UNLOCK = "To unlock this character class, slay the 3rd boss with any other class"; + + private static final String TXT_WIN_THE_GAME = + "To unlock \"Challenges\", win the game with any character class."; + + private static final float WIDTH_P = 116; + private static final float HEIGHT_P = 220; + + private static final float WIDTH_L = 224; + private static final float HEIGHT_L = 124; + + private static HashMap shields = new HashMap(); + + private float buttonX; + private float buttonY; + + private GameButton btnLoad; + private GameButton btnNewGame; + + private boolean huntressUnlocked; + private Group unlock; + + public static HeroClass curClass; + + @Override + public void create() { + + super.create(); + + Badges.loadGlobal(); + + uiCamera.visible = false; + + int w = Camera.main.width; + int h = Camera.main.height; + + float width, height; + if (ShatteredPixelDungeon.landscape()) { + width = WIDTH_L; + height = HEIGHT_L; + } else { + width = WIDTH_P; + height = HEIGHT_P; + } + + float left = (w - width) / 2; + float top = (h - height) / 2; + float bottom = h - top; + + Archs archs = new Archs(); + archs.setSize( w, h ); + add( archs ); + + Image title = BannerSprites.get( Type.SELECT_YOUR_HERO ); + title.x = align( (w - title.width()) / 2 ); + title.y = align( top ); + add( title ); + + buttonX = left; + buttonY = bottom - BUTTON_HEIGHT; + + btnNewGame = new GameButton( TXT_NEW ) { + @Override + protected void onClick() { + if (GamesInProgress.check( curClass ) != null) { + StartScene.this.add( new WndOptions( TXT_REALLY, TXT_WARNING, TXT_YES, TXT_NO ) { + @Override + protected void onSelect( int index ) { + if (index == 0) { + startNewGame(); + } + } + } ); + + } else { + startNewGame(); + } + } + }; + add( btnNewGame ); + + btnLoad = new GameButton( TXT_LOAD ) { + @Override + protected void onClick() { + InterlevelScene.mode = InterlevelScene.Mode.CONTINUE; + Game.switchScene( InterlevelScene.class ); + } + }; + add( btnLoad ); + + float centralHeight = buttonY - title.y - title.height(); + + HeroClass[] classes = { + HeroClass.WARRIOR, HeroClass.MAGE, HeroClass.ROGUE, HeroClass.HUNTRESS + }; + for (HeroClass cl : classes) { + ClassShield shield = new ClassShield( cl ); + shields.put( cl, shield ); + add( shield ); + } + if (ShatteredPixelDungeon.landscape()) { + float shieldW = width / 4; + float shieldH = Math.min( centralHeight, shieldW ); + top = title.y + title.height + (centralHeight - shieldH) / 2; + for (int i=0; i < classes.length; i++) { + ClassShield shield = shields.get( classes[i] ); + shield.setRect( left + i * shieldW, top, shieldW, shieldH ); + } + + ChallengeButton challenge = new ChallengeButton(); + challenge.setPos( + w/2 - challenge.width()/2, + top + shieldH/2 - challenge.height()/2 ); + add( challenge ); + + } else { + float shieldW = width / 2; + float shieldH = Math.min( centralHeight / 2, shieldW * 1.2f ); + top = title.y + title.height() + centralHeight / 2 - shieldH; + for (int i=0; i < classes.length; i++) { + ClassShield shield = shields.get( classes[i] ); + shield.setRect( + left + (i % 2) * shieldW, + top + (i / 2) * shieldH, + shieldW, shieldH ); + } + + ChallengeButton challenge = new ChallengeButton(); + challenge.setPos( + w/2 - challenge.width()/2, + top + shieldH - challenge.height()/2 ); + add( challenge ); + + } + + unlock = new Group(); + add( unlock ); + + if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) { + + BitmapTextMultiline text = PixelScene.createMultiline( TXT_UNLOCK, 9 ); + text.maxWidth = (int)width; + text.measure(); + + float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2; + for (BitmapText line : text.new LineSplitter().split()) { + line.measure(); + line.hardlight( 0xFFFF00 ); + line.x = PixelScene.align( w / 2 - line.width() / 2 ); + line.y = PixelScene.align( pos ); + unlock.add( line ); + + pos += line.height(); + } + } + + ExitButton btnExit = new ExitButton(); + btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); + add( btnExit ); + + curClass = null; + updateClass( HeroClass.values()[ShatteredPixelDungeon.lastClass()] ); + + fadeIn(); + + Badges.loadingListener = new Callback() { + @Override + public void call() { + if (Game.scene() == StartScene.this) { + ShatteredPixelDungeon.switchNoFade( StartScene.class ); + } + } + }; + } + + @Override + public void destroy() { + + Badges.saveGlobal(); + Badges.loadingListener = null; + + super.destroy(); + + } + + private void updateClass( HeroClass cl ) { + + if (curClass == cl) { + add( new WndClass( cl ) ); + return; + } + + if (curClass != null) { + shields.get( curClass ).highlight( false ); + } + shields.get( curClass = cl ).highlight( true ); + + if (cl != HeroClass.HUNTRESS || huntressUnlocked) { - unlock.visible = false; + unlock.visible = false; - GamesInProgress.Info info = GamesInProgress.check( curClass ); - if (info != null) { + GamesInProgress.Info info = GamesInProgress.check( curClass ); + if (info != null) { - btnLoad.visible = true; - btnLoad.secondary( Utils.format( TXT_DPTH_LVL, info.depth, info.level ), info.challenges ); - btnNewGame.visible = true; - btnNewGame.secondary( TXT_ERASE, false ); + btnLoad.visible = true; + btnLoad.secondary( Utils.format( TXT_DPTH_LVL, info.depth, info.level ), info.challenges ); + btnNewGame.visible = true; + btnNewGame.secondary( TXT_ERASE, false ); - float w = (Camera.main.width - GAP) / 2 - buttonX; + float w = (Camera.main.width - GAP) / 2 - buttonX; - btnLoad.setRect( - buttonX, buttonY, w, BUTTON_HEIGHT ); - btnNewGame.setRect( - btnLoad.right() + GAP, buttonY, w, BUTTON_HEIGHT ); + btnLoad.setRect( + buttonX, buttonY, w, BUTTON_HEIGHT ); + btnNewGame.setRect( + btnLoad.right() + GAP, buttonY, w, BUTTON_HEIGHT ); - } else { - btnLoad.visible = false; + } else { + btnLoad.visible = false; - btnNewGame.visible = true; - btnNewGame.secondary( null, false ); - btnNewGame.setRect( buttonX, buttonY, Camera.main.width - buttonX * 2, BUTTON_HEIGHT ); - } + btnNewGame.visible = true; + btnNewGame.secondary( null, false ); + btnNewGame.setRect( buttonX, buttonY, Camera.main.width - buttonX * 2, BUTTON_HEIGHT ); + } - } else { + } else { - unlock.visible = true; - btnLoad.visible = false; - btnNewGame.visible = false; + unlock.visible = true; + btnLoad.visible = false; + btnNewGame.visible = false; - } - } + } + } - private void startNewGame() { + private void startNewGame() { - Dungeon.hero = null; - InterlevelScene.mode = InterlevelScene.Mode.DESCEND; + Dungeon.hero = null; + InterlevelScene.mode = InterlevelScene.Mode.DESCEND; - if (ShatteredPixelDungeon.intro()) { - ShatteredPixelDungeon.intro( false ); - Game.switchScene( IntroScene.class ); - } else { - Game.switchScene( InterlevelScene.class ); - } - } + if (ShatteredPixelDungeon.intro()) { + ShatteredPixelDungeon.intro( false ); + Game.switchScene( IntroScene.class ); + } else { + Game.switchScene( InterlevelScene.class ); + } + } - @Override - protected void onBackPressed() { - ShatteredPixelDungeon.switchNoFade( TitleScene.class ); - } + @Override + protected void onBackPressed() { + ShatteredPixelDungeon.switchNoFade( TitleScene.class ); + } - private static class GameButton extends RedButton { + private static class GameButton extends RedButton { - private static final int SECONDARY_COLOR_N = 0xCACFC2; - private static final int SECONDARY_COLOR_H = 0xFFFF88; + private static final int SECONDARY_COLOR_N = 0xCACFC2; + private static final int SECONDARY_COLOR_H = 0xFFFF88; - private BitmapText secondary; + private BitmapText secondary; - public GameButton( String primary ) { - super( primary ); + public GameButton( String primary ) { + super( primary ); - this.secondary.text( null ); - } + this.secondary.text( null ); + } - @Override - protected void createChildren() { - super.createChildren(); + @Override + protected void createChildren() { + super.createChildren(); - secondary = createText( 6 ); - add( secondary ); - } + secondary = createText( 6 ); + add( secondary ); + } - @Override - protected void layout() { - super.layout(); + @Override + protected void layout() { + super.layout(); - if (secondary.text().length() > 0) { - text.y = align( y + (height - text.height() - secondary.baseLine()) / 2 ); + if (secondary.text().length() > 0) { + text.y = align( y + (height - text.height() - secondary.baseLine()) / 2 ); - secondary.x = align( x + (width - secondary.width()) / 2 ); - secondary.y = align( text.y + text.height() ); - } else { - text.y = align( y + (height - text.baseLine()) / 2 ); - } - } + secondary.x = align( x + (width - secondary.width()) / 2 ); + secondary.y = align( text.y + text.height() ); + } else { + text.y = align( y + (height - text.baseLine()) / 2 ); + } + } - public void secondary( String text, boolean highlighted ) { - secondary.text( text ); - secondary.measure(); + public void secondary( String text, boolean highlighted ) { + secondary.text( text ); + secondary.measure(); - secondary.hardlight( highlighted ? SECONDARY_COLOR_H : SECONDARY_COLOR_N ); - } - } + secondary.hardlight( highlighted ? SECONDARY_COLOR_H : SECONDARY_COLOR_N ); + } + } - private class ClassShield extends Button { + private class ClassShield extends Button { - private static final float MIN_BRIGHTNESS = 0.6f; + private static final float MIN_BRIGHTNESS = 0.6f; - private static final int BASIC_NORMAL = 0x444444; - private static final int BASIC_HIGHLIGHTED = 0xCACFC2; + private static final int BASIC_NORMAL = 0x444444; + private static final int BASIC_HIGHLIGHTED = 0xCACFC2; - private static final int MASTERY_NORMAL = 0x666644; - private static final int MASTERY_HIGHLIGHTED= 0xFFFF88; + private static final int MASTERY_NORMAL = 0x666644; + private static final int MASTERY_HIGHLIGHTED= 0xFFFF88; - private static final int WIDTH = 24; - private static final int HEIGHT = 32; - private static final float SCALE = 1.75f; + private static final int WIDTH = 24; + private static final int HEIGHT = 32; + private static final float SCALE = 1.75f; - private HeroClass cl; + private HeroClass cl; - private Image avatar; - private BitmapText name; - private Emitter emitter; + private Image avatar; + private BitmapText name; + private Emitter emitter; - private float brightness; + private float brightness; - private int normal; - private int highlighted; + private int normal; + private int highlighted; - public ClassShield( HeroClass cl ) { - super(); + public ClassShield( HeroClass cl ) { + super(); - this.cl = cl; + this.cl = cl; - avatar.frame( cl.ordinal() * WIDTH, 0, WIDTH, HEIGHT ); - avatar.scale.set( SCALE ); + avatar.frame( cl.ordinal() * WIDTH, 0, WIDTH, HEIGHT ); + avatar.scale.set( SCALE ); - if (Badges.isUnlocked( cl.masteryBadge() )) { - normal = MASTERY_NORMAL; - highlighted = MASTERY_HIGHLIGHTED; - } else { - normal = BASIC_NORMAL; - highlighted = BASIC_HIGHLIGHTED; - } + if (Badges.isUnlocked( cl.masteryBadge() )) { + normal = MASTERY_NORMAL; + highlighted = MASTERY_HIGHLIGHTED; + } else { + normal = BASIC_NORMAL; + highlighted = BASIC_HIGHLIGHTED; + } - name.text( cl.name() ); - name.measure(); - name.hardlight( normal ); + name.text( cl.name() ); + name.measure(); + name.hardlight( normal ); - brightness = MIN_BRIGHTNESS; - updateBrightness(); - } + brightness = MIN_BRIGHTNESS; + updateBrightness(); + } - @Override - protected void createChildren() { + @Override + protected void createChildren() { - super.createChildren(); + super.createChildren(); - avatar = new Image( Assets.AVATARS ); - add( avatar ); + avatar = new Image( Assets.AVATARS ); + add( avatar ); - name = PixelScene.createText( 9 ); - add( name ); + name = PixelScene.createText( 9 ); + add( name ); - emitter = new Emitter(); - add( emitter ); - } + emitter = new Emitter(); + add( emitter ); + } - @Override - protected void layout() { + @Override + protected void layout() { - super.layout(); + super.layout(); - avatar.x = align( x + (width - avatar.width()) / 2 ); - avatar.y = align( y + (height - avatar.height() - name.height()) / 2 ); + avatar.x = align( x + (width - avatar.width()) / 2 ); + avatar.y = align( y + (height - avatar.height() - name.height()) / 2 ); - name.x = align( x + (width - name.width()) / 2 ); - name.y = avatar.y + avatar.height() + SCALE; + name.x = align( x + (width - name.width()) / 2 ); + name.y = avatar.y + avatar.height() + SCALE; - emitter.pos( avatar.x, avatar.y, avatar.width(), avatar.height() ); - } + emitter.pos( avatar.x, avatar.y, avatar.width(), avatar.height() ); + } - @Override - protected void onTouchDown() { + @Override + protected void onTouchDown() { - emitter.revive(); - emitter.start( Speck.factory( Speck.LIGHT ), 0.05f, 7 ); + emitter.revive(); + emitter.start( Speck.factory( Speck.LIGHT ), 0.05f, 7 ); - Sample.INSTANCE.play( Assets.SND_CLICK, 1, 1, 1.2f ); - updateClass( cl ); - } + Sample.INSTANCE.play( Assets.SND_CLICK, 1, 1, 1.2f ); + updateClass( cl ); + } - @Override - public void update() { - super.update(); + @Override + public void update() { + super.update(); - if (brightness < 1.0f && brightness > MIN_BRIGHTNESS) { - if ((brightness -= Game.elapsed) <= MIN_BRIGHTNESS) { - brightness = MIN_BRIGHTNESS; - } - updateBrightness(); - } - } + if (brightness < 1.0f && brightness > MIN_BRIGHTNESS) { + if ((brightness -= Game.elapsed) <= MIN_BRIGHTNESS) { + brightness = MIN_BRIGHTNESS; + } + updateBrightness(); + } + } - public void highlight( boolean value ) { - if (value) { - brightness = 1.0f; - name.hardlight( highlighted ); - } else { - brightness = 0.999f; - name.hardlight( normal ); - } + public void highlight( boolean value ) { + if (value) { + brightness = 1.0f; + name.hardlight( highlighted ); + } else { + brightness = 0.999f; + name.hardlight( normal ); + } - updateBrightness(); - } + updateBrightness(); + } - private void updateBrightness() { - avatar.gm = avatar.bm = avatar.rm = avatar.am = brightness; - } - } + private void updateBrightness() { + avatar.gm = avatar.bm = avatar.rm = avatar.am = brightness; + } + } - private class ChallengeButton extends Button { + private class ChallengeButton extends Button { - private Image image; + private Image image; - public ChallengeButton() { - super(); + public ChallengeButton() { + super(); - width = image.width; - height = image.height; + width = image.width; + height = image.height; - image.am = Badges.isUnlocked( Badges.Badge.VICTORY ) ? 1.0f : 0.5f; - } + image.am = Badges.isUnlocked( Badges.Badge.VICTORY ) ? 1.0f : 0.5f; + } - @Override - protected void createChildren() { + @Override + protected void createChildren() { - super.createChildren(); + super.createChildren(); - image = Icons.get( ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ); - add( image ); - } + image = Icons.get( ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ); + add( image ); + } - @Override - protected void layout() { + @Override + protected void layout() { - super.layout(); + super.layout(); - image.x = align( x ); - image.y = align( y ); - } + image.x = align( x ); + image.y = align( y ); + } - @Override - protected void onClick() { - if (Badges.isUnlocked( Badges.Badge.VICTORY )) { - StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(), true) { - public void onBackPressed() { - super.onBackPressed(); - image.copy( Icons.get( ShatteredPixelDungeon.challenges() > 0 ? - Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) ); - }; - } ); - } else { - StartScene.this.add( new WndMessage( TXT_WIN_THE_GAME ) ); - } - } + @Override + protected void onClick() { + if (Badges.isUnlocked( Badges.Badge.VICTORY )) { + StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(), true) { + public void onBackPressed() { + super.onBackPressed(); + image.copy( Icons.get( ShatteredPixelDungeon.challenges() > 0 ? + Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) ); + }; + } ); + } else { + StartScene.this.add( new WndMessage( TXT_WIN_THE_GAME ) ); + } + } - @Override - protected void onTouchDown() { - Sample.INSTANCE.play( Assets.SND_CLICK ); - } - } + @Override + protected void onTouchDown() { + Sample.INSTANCE.play( Assets.SND_CLICK ); + } + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java index e26bfe18c..f99b67bea 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java @@ -242,8 +242,8 @@ public class SurfaceScene extends PixelScene { script.camera( camera() ); script.uModel.valueM4( matrix ); - script.lighting( - rm, gm, bm, am, + script.lighting( + rm, gm, bm, am, ra, ga, ba, aa ); script.drawQuad( verticesBuffer ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index 1de1adb09..95d1c1863 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -50,14 +50,14 @@ public class TitleScene extends PixelScene { - int gameversion = ShatteredPixelDungeon.version(); + int gameversion = ShatteredPixelDungeon.version(); - if (gameversion != Game.versionCode) { - //new intro, make older players see it again. - if (gameversion < 9) - ShatteredPixelDungeon.intro(true); - Game.switchScene(WelcomeScene.class); - } + if (gameversion != Game.versionCode) { + //new intro, make older players see it again. + if (gameversion < 9) + ShatteredPixelDungeon.intro(true); + Game.switchScene(WelcomeScene.class); + } Music.INSTANCE.play( Assets.THEME, true ); Music.INSTANCE.volume( 1f ); @@ -104,7 +104,7 @@ public class TitleScene extends PixelScene { DashboardItem btnBadges = new DashboardItem( TXT_BADGES, 3 ) { @Override protected void onClick() { - ShatteredPixelDungeon.switchNoFade( BadgesScene.class ); + ShatteredPixelDungeon.switchNoFade( BadgesScene.class ); } }; add( btnBadges ); @@ -112,7 +112,7 @@ public class TitleScene extends PixelScene { DashboardItem btnAbout = new DashboardItem( TXT_ABOUT, 1 ) { @Override protected void onClick() { - ShatteredPixelDungeon.switchNoFade( AboutScene.class ); + ShatteredPixelDungeon.switchNoFade( AboutScene.class ); } }; add( btnAbout ); @@ -120,7 +120,7 @@ public class TitleScene extends PixelScene { DashboardItem btnPlay = new DashboardItem( TXT_PLAY, 0 ) { @Override protected void onClick() { - ShatteredPixelDungeon.switchNoFade( StartScene.class ); + ShatteredPixelDungeon.switchNoFade( StartScene.class ); } }; add( btnPlay ); @@ -128,7 +128,7 @@ public class TitleScene extends PixelScene { DashboardItem btnHighscores = new DashboardItem( TXT_HIGHSCORES, 2 ) { @Override protected void onClick() { - ShatteredPixelDungeon.switchNoFade( RankingsScene.class ); + ShatteredPixelDungeon.switchNoFade( RankingsScene.class ); } }; add( btnHighscores ); @@ -146,28 +146,28 @@ public class TitleScene extends PixelScene { btnHighscores.setPos( w / 2, btnPlay.top() ); } - BitmapText source = new BitmapText( "PD v 1.7.5", font1x ); - source.measure(); - source.hardlight( 0x444444 ); - source.x = w - source.width(); - source.y = h - source.height(); - add( source ); + BitmapText source = new BitmapText( "PD v 1.7.5", font1x ); + source.measure(); + source.hardlight( 0x444444 ); + source.x = w - source.width(); + source.y = h - source.height(); + add( source ); - BitmapText version = new BitmapText( "v " + Game.version + "", font1x ); - version.measure(); - version.hardlight( 0xCCCCCC ); - version.x = w - version.width(); - version.y = h - version.height() - source.height(); + BitmapText version = new BitmapText( "v " + Game.version + "", font1x ); + version.measure(); + version.hardlight( 0xCCCCCC ); + version.x = w - version.width(); + version.y = h - version.height() - source.height(); - add( version ); + add( version ); PrefsButton btnPrefs = new PrefsButton(); btnPrefs.setPos( 0, 0 ); add( btnPrefs ); - ExitButton btnExit = new ExitButton(); - btnExit.setPos( w - btnExit.width(), 0 ); - add( btnExit ); + ExitButton btnExit = new ExitButton(); + btnExit.setPos( w - btnExit.width(), 0 ); + add( btnExit ); fadeIn(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index 1564ab9ab..197e05255 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -17,219 +17,219 @@ import com.watabou.noosa.ui.Component; //TODO: update this class with relevant info as new versions come out. public class WelcomeScene extends PixelScene { - private static final String TTL_Welcome = "Welcome!"; + private static final String TTL_Welcome = "Welcome!"; - private static final String TTL_Update = "v0.3.0: The Wand Rework!"; + private static final String TTL_Update = "v0.3.0: The Wand Rework!"; - private static final String TTL_Future = "Wait What?"; + private static final String TTL_Future = "Wait What?"; - private static final String TXT_Welcome = - "Shattered Pixel Dungeon is a rework/expansion of Watabou's Pixel Dungeon.\n\n"+ - "The goal is to enhance the game by improving existing content and adding tonnes of new stuff!\n\n"+ - "Shattered Pixel Dungeon is being constantly updated, so expect more new content soon!\n\n"+ - "Happy Dungeoneering!"; + private static final String TXT_Welcome = + "Shattered Pixel Dungeon is a rework/expansion of Watabou's Pixel Dungeon.\n\n"+ + "The goal is to enhance the game by improving existing content and adding tonnes of new stuff!\n\n"+ + "Shattered Pixel Dungeon is being constantly updated, so expect more new content soon!\n\n"+ + "Happy Dungeoneering!"; - private static final String TXT_Update = - "v0.3.0d:\n" + - "- Various bugfixes\n" + - "\n" + - "v0.3.0c:\n" + - "- Lots of under-the-hood changes\n" + - "(let me know if you run into any bugs)\n" + - "- Many bugfixes\n" + - "Rebalances:\n" + - "- Wand of Corruption & Venom rebalanced.\n" + - "- Mages staff now has +1 max charges\n" + - "- Mage now partially IDs wands on use\n" + - "- Magic missile wand reduced to 3 max charges\n" + - "- Warlock gets more recharge from food\n" + - "- Battlemage only recharges his staff\n" + - "- Many battlemage effects tweaked\n" + - "- Yog Dzewa now heals 1hp per turn\n" + - "\n" + - "v0.3.0b & v0.3.0a:\n" + - "- Fixed many bugs\n" + - "- Buffed mage and huntress base damages to compensate for increased rat numbers on floor 1.\n" + - "\n" + - "v0.3.0:\n" + - "Mage reworked!:\n" + - "- No longer starts with knuckledusters or a wand\n" + - "- Can no longer equip wands\n" + - "- Now starts with a unique mages staff, empowered with magic missile to start.\n" + - "- Battlemage reworked, staff now deals bonus effects when used as a melee weapon.\n" + - "- Warlock reworked, gains more health and fullness from gaining exp, but food no longer restores hunger.\n" + - "\n" + - "General Wand Changes:\n" + - "- Wand types are now known by default.\n" + - "- Wands now each have unique sprites.\n" + - "- Wands now cap at 10 charges instead of 9\n" + - "- Wands now recharge faster the more charges are missing, for all classes.\n" + - "- Self-targeting with wands is no longer possible.\n" + - "- Wand recharge effects now give charge over time, instead of instantly.\n" + - "- Wands can now be cursed!\n" + - "\n" + - "All wands have been reworked!\n" + - "\n" + - "Removed wands:\n" + - "- Flock\n" + - "- Blink\n" + - "- Teleportation\n" + - "- Avalanche\n" + - "\n" + - "Reworked wands:\n" + - "- Magic Missile\n" + - "- Lightning\n" + - "- Disintegration\n" + - "- Fireblast (previously Firebolt)\n" + - "- Venom (previously poison)\n" + - "- Frost (previously Slowing)\n" + - "- Blast Wave (previously Telekinesis)\n" + - "- Corruption (previously Amok)\n" + - "- Regrowth\n" + - "\n" + - "New Wands:\n" + - "- Prismatic Light\n" + - "- Transfusion\n" + - "\n" + - "New Artifacts:\n" + - "- Ethereal Chains\n" + - "- Lloyd's Beacon\n" + - "\n" + - "Misc. Balance changes:\n" + - "- Blessed Ankhs now revive at 1/4hp, but also grant initiative.\n" + - "- Alchemist's Toolkit removed (will be reworked)\n" + - "- Chalice of blood nerfed, now regens less hp at high levels.\n" + - "- Cape of Thorns buffed, now absorbs all damage, but only deflects adjacent attacks.\n" + - "- Sandals of nature adjusted, now give more seeds, less dew.\n" + - "- Hunger no longer increases while fighting bosses.\n" + - "- Floor 1 now spawns 10 rats every time, exactly enough to level up.\n" + - "- Scrolls of recharging and mirror image are now more common.\n" + - "- Mimics are now less common, stronger, & give better loot.\n" + - "\n" + - "UI tweaks:\n" + - "- New app icon!\n" + - "- Shading added to main game interface\n" + - "- Buffs now have descriptions, tap their icons!\n" + - "- Visual indicator added for surprising enemies"; + private static final String TXT_Update = + "v0.3.0d:\n" + + "- Various bugfixes\n" + + "\n" + + "v0.3.0c:\n" + + "- Lots of under-the-hood changes\n" + + "(let me know if you run into any bugs)\n" + + "- Many bugfixes\n" + + "Rebalances:\n" + + "- Wand of Corruption & Venom rebalanced.\n" + + "- Mages staff now has +1 max charges\n" + + "- Mage now partially IDs wands on use\n" + + "- Magic missile wand reduced to 3 max charges\n" + + "- Warlock gets more recharge from food\n" + + "- Battlemage only recharges his staff\n" + + "- Many battlemage effects tweaked\n" + + "- Yog Dzewa now heals 1hp per turn\n" + + "\n" + + "v0.3.0b & v0.3.0a:\n" + + "- Fixed many bugs\n" + + "- Buffed mage and huntress base damages to compensate for increased rat numbers on floor 1.\n" + + "\n" + + "v0.3.0:\n" + + "Mage reworked!:\n" + + "- No longer starts with knuckledusters or a wand\n" + + "- Can no longer equip wands\n" + + "- Now starts with a unique mages staff, empowered with magic missile to start.\n" + + "- Battlemage reworked, staff now deals bonus effects when used as a melee weapon.\n" + + "- Warlock reworked, gains more health and fullness from gaining exp, but food no longer restores hunger.\n" + + "\n" + + "General Wand Changes:\n" + + "- Wand types are now known by default.\n" + + "- Wands now each have unique sprites.\n" + + "- Wands now cap at 10 charges instead of 9\n" + + "- Wands now recharge faster the more charges are missing, for all classes.\n" + + "- Self-targeting with wands is no longer possible.\n" + + "- Wand recharge effects now give charge over time, instead of instantly.\n" + + "- Wands can now be cursed!\n" + + "\n" + + "All wands have been reworked!\n" + + "\n" + + "Removed wands:\n" + + "- Flock\n" + + "- Blink\n" + + "- Teleportation\n" + + "- Avalanche\n" + + "\n" + + "Reworked wands:\n" + + "- Magic Missile\n" + + "- Lightning\n" + + "- Disintegration\n" + + "- Fireblast (previously Firebolt)\n" + + "- Venom (previously poison)\n" + + "- Frost (previously Slowing)\n" + + "- Blast Wave (previously Telekinesis)\n" + + "- Corruption (previously Amok)\n" + + "- Regrowth\n" + + "\n" + + "New Wands:\n" + + "- Prismatic Light\n" + + "- Transfusion\n" + + "\n" + + "New Artifacts:\n" + + "- Ethereal Chains\n" + + "- Lloyd's Beacon\n" + + "\n" + + "Misc. Balance changes:\n" + + "- Blessed Ankhs now revive at 1/4hp, but also grant initiative.\n" + + "- Alchemist's Toolkit removed (will be reworked)\n" + + "- Chalice of blood nerfed, now regens less hp at high levels.\n" + + "- Cape of Thorns buffed, now absorbs all damage, but only deflects adjacent attacks.\n" + + "- Sandals of nature adjusted, now give more seeds, less dew.\n" + + "- Hunger no longer increases while fighting bosses.\n" + + "- Floor 1 now spawns 10 rats every time, exactly enough to level up.\n" + + "- Scrolls of recharging and mirror image are now more common.\n" + + "- Mimics are now less common, stronger, & give better loot.\n" + + "\n" + + "UI tweaks:\n" + + "- New app icon!\n" + + "- Shading added to main game interface\n" + + "- Buffs now have descriptions, tap their icons!\n" + + "- Visual indicator added for surprising enemies"; - private static final String TXT_Future = - "It seems that your current saves are from a future version of Shattered Pixel Dungeon!\n\n"+ - "Either you're messing around with older versions of the app, or something has gone buggy.\n\n"+ - "Regardless, tread with caution! Your saves may contain things which don't exist in this version, "+ - "this could cause some very weird errors to occur."; + private static final String TXT_Future = + "It seems that your current saves are from a future version of Shattered Pixel Dungeon!\n\n"+ + "Either you're messing around with older versions of the app, or something has gone buggy.\n\n"+ + "Regardless, tread with caution! Your saves may contain things which don't exist in this version, "+ + "this could cause some very weird errors to occur."; - private static final String LNK = "https://play.google.com/store/apps/details?id=com.shatteredpixel.shatteredpixeldungeon"; + private static final String LNK = "https://play.google.com/store/apps/details?id=com.shatteredpixel.shatteredpixeldungeon"; - @Override - public void create() { - super.create(); + @Override + public void create() { + super.create(); - final int gameversion = ShatteredPixelDungeon.version(); + final int gameversion = ShatteredPixelDungeon.version(); - BitmapTextMultiline title; - BitmapTextMultiline text; + BitmapTextMultiline title; + BitmapTextMultiline text; - if (gameversion == 0) { + if (gameversion == 0) { - text = createMultiline(TXT_Welcome, 8); - title = createMultiline(TTL_Welcome, 16); + text = createMultiline(TXT_Welcome, 8); + title = createMultiline(TTL_Welcome, 16); - } else if (gameversion <= Game.versionCode) { + } else if (gameversion <= Game.versionCode) { - text = createMultiline(TXT_Update, 6 ); - title = createMultiline(TTL_Update, 9 ); + text = createMultiline(TXT_Update, 6 ); + title = createMultiline(TTL_Update, 9 ); - } else { + } else { - text = createMultiline( TXT_Future, 8 ); - title = createMultiline( TTL_Future, 16 ); + text = createMultiline( TXT_Future, 8 ); + title = createMultiline( TTL_Future, 16 ); - } + } - int w = Camera.main.width; - int h = Camera.main.height; + int w = Camera.main.width; + int h = Camera.main.height; - int pw = w - 10; - int ph = h - 50; + int pw = w - 10; + int ph = h - 50; - title.maxWidth = pw; - title.measure(); - title.hardlight(Window.SHPX_COLOR); + title.maxWidth = pw; + title.measure(); + title.hardlight(Window.SHPX_COLOR); - title.x = align( (w - title.width()) / 2 ); - title.y = align( 8 ); - add( title ); + title.x = align( (w - title.width()) / 2 ); + title.y = align( 8 ); + add( title ); - NinePatch panel = Chrome.get(Chrome.Type.WINDOW); - panel.size( pw, ph ); - panel.x = (w - pw) / 2; - panel.y = (h - ph) / 2; - add( panel ); + NinePatch panel = Chrome.get(Chrome.Type.WINDOW); + panel.size( pw, ph ); + panel.x = (w - pw) / 2; + panel.y = (h - ph) / 2; + add( panel ); - ScrollPane list = new ScrollPane( new Component() ); - add( list ); - list.setRect( - panel.x + panel.marginLeft(), - panel.y + panel.marginTop(), - panel.innerWidth(), - panel.innerHeight()); - list.scrollTo( 0, 0 ); + ScrollPane list = new ScrollPane( new Component() ); + add( list ); + list.setRect( + panel.x + panel.marginLeft(), + panel.y + panel.marginTop(), + panel.innerWidth(), + panel.innerHeight()); + list.scrollTo( 0, 0 ); - Component content = list.content(); - content.clear(); + Component content = list.content(); + content.clear(); - text.maxWidth = (int) panel.innerWidth(); - text.measure(); + text.maxWidth = (int) panel.innerWidth(); + text.measure(); - content.add(text); + content.add(text); - content.setSize( panel.innerWidth(), text.height() ); + content.setSize( panel.innerWidth(), text.height() ); - RedButton okay = new RedButton("Okay!") { - @Override - protected void onClick() { + RedButton okay = new RedButton("Okay!") { + @Override + protected void onClick() { - if (gameversion <= 32){ - //removes all bags bought badge from pre-0.2.4 saves. - Badges.disown(Badges.Badge.ALL_BAGS_BOUGHT); - Badges.saveGlobal(); + if (gameversion <= 32){ + //removes all bags bought badge from pre-0.2.4 saves. + Badges.disown(Badges.Badge.ALL_BAGS_BOUGHT); + Badges.saveGlobal(); - //imports new ranking data for pre-0.2.3 saves. - if (gameversion <= 29){ - Rankings.INSTANCE.load(); - Rankings.INSTANCE.save(); - } - } + //imports new ranking data for pre-0.2.3 saves. + if (gameversion <= 29){ + Rankings.INSTANCE.load(); + Rankings.INSTANCE.save(); + } + } - ShatteredPixelDungeon.version(Game.versionCode); - Game.switchScene(TitleScene.class); - } - }; + ShatteredPixelDungeon.version(Game.versionCode); + Game.switchScene(TitleScene.class); + } + }; - /* - okay.setRect(text.x, text.y + text.height() + 5, 55, 18); - add(okay); + /* + okay.setRect(text.x, text.y + text.height() + 5, 55, 18); + add(okay); - RedButton changes = new RedButton("Changes") { - @Override - protected void onClick() { - parent.add(new WndChanges()); - } - }; + RedButton changes = new RedButton("Changes") { + @Override + protected void onClick() { + parent.add(new WndChanges()); + } + }; - changes.setRect(text.x + 65, text.y + text.height() + 5, 55, 18); - add(changes);*/ + changes.setRect(text.x + 65, text.y + text.height() + 5, 55, 18); + add(changes);*/ - okay.setRect((w - pw) / 2, h - 22, pw, 18); - add(okay); + okay.setRect((w - pw) / 2, h - 22, pw, 18); + add(okay); - Archs archs = new Archs(); - archs.setSize( Camera.main.width, Camera.main.height ); - addToBack( archs ); + Archs archs = new Archs(); + archs.setSize( Camera.main.width, Camera.main.height ); + addToBack( archs ); - fadeIn(); - } + fadeIn(); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BurningFistSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BurningFistSprite.java index 3bed81480..b2315dc1f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BurningFistSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BurningFistSprite.java @@ -51,7 +51,7 @@ public class BurningFistSprite extends MobSprite { @Override public void attack( int cell ) { - posToShoot = cell; + posToShoot = cell; super.attack( cell ); } @@ -60,8 +60,8 @@ public class BurningFistSprite extends MobSprite { if (anim == attack) { Sample.INSTANCE.play( Assets.SND_ZAP ); - MagicMissile.shadow( parent, ch.pos, posToShoot, - new Callback() { + MagicMissile.shadow( parent, ch.pos, posToShoot, + new Callback() { @Override public void call() { ch.onAttackComplete(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 969947bbf..0701b430f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -54,7 +54,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip public static final int NEUTRAL = 0xFFFF00; private static final float MOVE_INTERVAL = 0.1f; - private static final float FLASH_INTERVAL = 0.05f; + private static final float FLASH_INTERVAL = 0.05f; public enum State { BURNING, LEVITATING, INVISIBLE, PARALYSED, FROZEN, ILLUMINATED, CHILLED, DARKENED @@ -90,7 +90,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip public Char ch; - public boolean isMoving = false; + public boolean isMoving = false; public CharSprite() { super(); @@ -145,7 +145,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip motion.listener = this; parent.add( motion ); - isMoving = true; + isMoving = true; turnTo( from , to ); @@ -153,7 +153,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip GameScene.ripple( from ); } - ch.onMotionComplete(); + ch.onMotionComplete(); } public void interruptMotion() { @@ -380,7 +380,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } emo = new EmoIcon.Sleep( this ); } - idle(); + idle(); } public void hideSleep() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/FetidRatSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/FetidRatSprite.java index e89b025c4..4de668cff 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/FetidRatSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/FetidRatSprite.java @@ -27,27 +27,27 @@ public class FetidRatSprite extends MobSprite { private Emitter cloud; - public FetidRatSprite() { - super(); + public FetidRatSprite() { + super(); - texture( Assets.RAT ); + texture( Assets.RAT ); - TextureFilm frames = new TextureFilm( texture, 16, 15 ); + TextureFilm frames = new TextureFilm( texture, 16, 15 ); - idle = new Animation( 2, true ); - idle.frames( frames, 32, 32, 32, 33 ); + idle = new Animation( 2, true ); + idle.frames( frames, 32, 32, 32, 33 ); - run = new Animation( 10, true ); - run.frames( frames, 38, 39, 40, 41, 42 ); + run = new Animation( 10, true ); + run.frames( frames, 38, 39, 40, 41, 42 ); - attack = new Animation( 15, false ); - attack.frames( frames, 34, 35, 36, 37, 32 ); + attack = new Animation( 15, false ); + attack.frames( frames, 34, 35, 36, 37, 32 ); - die = new Animation( 10, false ); - die.frames( frames, 43, 44, 45, 46 ); + die = new Animation( 10, false ); + die.frames( frames, 43, 44, 45, 46 ); - play( idle ); - } + play( idle ); + } @Override public void link( Char ch ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GhostSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GhostSprite.java index b772456cb..92d9490f4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GhostSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GhostSprite.java @@ -41,11 +41,11 @@ public class GhostSprite extends MobSprite { run = new Animation( 10, true ); run.frames( frames, 0, 1 ); - attack = new Animation( 10, false ); - attack.frames( frames, 0, 2, 3 ); + attack = new Animation( 10, false ); + attack.frames( frames, 0, 2, 3 ); - die = new Animation( 8, false ); - die.frames( frames, 0, 4, 5, 6, 7 ); + die = new Animation( 8, false ); + die.frames( frames, 0, 4, 5, 6, 7 ); play( idle ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GnollTricksterSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GnollTricksterSprite.java index 3210f871d..412b6e2cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GnollTricksterSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GnollTricksterSprite.java @@ -7,56 +7,53 @@ import com.watabou.noosa.MovieClip; import com.watabou.noosa.TextureFilm; import com.watabou.utils.Callback; -/** - * Created by Evan on 09/10/2014. - */ public class GnollTricksterSprite extends MobSprite { - private Animation cast; + private Animation cast; - public GnollTricksterSprite() { - super(); + public GnollTricksterSprite() { + super(); - texture( Assets.GNOLL ); + texture( Assets.GNOLL ); - TextureFilm frames = new TextureFilm( texture, 12, 15 ); + TextureFilm frames = new TextureFilm( texture, 12, 15 ); - idle = new MovieClip.Animation( 2, true ); - idle.frames( frames, 21, 21, 21, 22, 21, 21, 22, 22 ); + idle = new MovieClip.Animation( 2, true ); + idle.frames( frames, 21, 21, 21, 22, 21, 21, 22, 22 ); - run = new MovieClip.Animation( 12, true ); - run.frames( frames, 25, 26, 27, 28 ); + run = new MovieClip.Animation( 12, true ); + run.frames( frames, 25, 26, 27, 28 ); - attack = new MovieClip.Animation( 12, false ); - attack.frames( frames, 23, 24, 21 ); + attack = new MovieClip.Animation( 12, false ); + attack.frames( frames, 23, 24, 21 ); - cast = attack.clone(); + cast = attack.clone(); - die = new MovieClip.Animation( 12, false ); - die.frames( frames, 29, 30, 31 ); + die = new MovieClip.Animation( 12, false ); + die.frames( frames, 29, 30, 31 ); - play( idle ); - } + play( idle ); + } - @Override - public void attack( int cell ) { - if (!Level.adjacent(cell, ch.pos)) { + @Override + public void attack( int cell ) { + if (!Level.adjacent(cell, ch.pos)) { - ((MissileSprite)parent.recycle( MissileSprite.class )). - reset( ch.pos, cell, new CurareDart(), new Callback() { - @Override - public void call() { - ch.onAttackComplete(); - } - } ); + ((MissileSprite)parent.recycle( MissileSprite.class )). + reset( ch.pos, cell, new CurareDart(), new Callback() { + @Override + public void call() { + ch.onAttackComplete(); + } + } ); - play( cast ); - turnTo( ch.pos , cell ); + play( cast ); + turnTo( ch.pos , cell ); - } else { + } else { - super.attack( cell ); + super.attack( cell ); - } - } + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java index be652892e..e2984f0fc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java @@ -29,7 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; public class GooSprite extends MobSprite { private Animation pump; - private Animation pumpAttack; + private Animation pumpAttack; public GooSprite() { super(); @@ -47,8 +47,8 @@ public class GooSprite extends MobSprite { pump = new Animation( 20, true ); pump.frames( frames, 4, 3, 2, 1, 0 ); - pumpAttack = new Animation ( 20, false ); - pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7); + pumpAttack = new Animation ( 20, false ); + pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7); attack = new Animation( 10, false ); attack.frames( frames, 8, 9, 10 ); @@ -63,7 +63,7 @@ public class GooSprite extends MobSprite { play( pump ); } - public void pumpAttack() { play( pumpAttack ); } + public void pumpAttack() { play( pumpAttack ); } @Override public void play( Animation anim, boolean force ) { @@ -114,13 +114,13 @@ public class GooSprite extends MobSprite { } @Override - public void onComplete( Animation anim ) { - super.onComplete(anim); + public void onComplete( Animation anim ) { + super.onComplete(anim); - if (anim == pumpAttack) { + if (anim == pumpAttack) { - idle(); - ch.onAttackComplete(); - } - } + idle(); + ch.onAttackComplete(); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GreatCrabSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GreatCrabSprite.java index ebbb5e65a..64de81c4a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GreatCrabSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GreatCrabSprite.java @@ -4,35 +4,32 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.watabou.noosa.MovieClip; import com.watabou.noosa.TextureFilm; -/** - * Created by Evan on 09/10/2014. - */ public class GreatCrabSprite extends MobSprite { - public GreatCrabSprite() { - super(); + public GreatCrabSprite() { + super(); - texture( Assets.CRAB ); + texture( Assets.CRAB ); - TextureFilm frames = new TextureFilm( texture, 16, 16 ); + TextureFilm frames = new TextureFilm( texture, 16, 16 ); - idle = new MovieClip.Animation( 5, true ); - idle.frames( frames, 16, 17, 16, 18 ); + idle = new MovieClip.Animation( 5, true ); + idle.frames( frames, 16, 17, 16, 18 ); - run = new MovieClip.Animation( 10, true ); - run.frames( frames, 19, 20, 21, 22 ); + run = new MovieClip.Animation( 10, true ); + run.frames( frames, 19, 20, 21, 22 ); - attack = new MovieClip.Animation( 12, false ); - attack.frames( frames, 23, 24, 25 ); + attack = new MovieClip.Animation( 12, false ); + attack.frames( frames, 23, 24, 25 ); - die = new MovieClip.Animation( 12, false ); - die.frames( frames, 26, 27, 28, 29 ); + die = new MovieClip.Animation( 12, false ); + die.frames( frames, 26, 27, 28, 29 ); - play( idle ); - } + play( idle ); + } - @Override - public int blood() { - return 0xFFFFEA80; - } + @Override + public int blood() { + return 0xFFFFEA80; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java index 85ccc49ae..f8e5bc379 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java @@ -84,7 +84,7 @@ public class HeroSprite extends CharSprite { } @Override - public void move( int from, int to ) { + public void move( int from, int to ) { super.move( from, to ); if (ch.flying) { play( fly ); @@ -93,12 +93,12 @@ public class HeroSprite extends CharSprite { } @Override - public void jump( int from, int to, Callback callback ) { + public void jump( int from, int to, Callback callback ) { super.jump( from, to, callback ); - play( fly ); - } + play( fly ); + } - @Override + @Override public void update() { sleeping = ((Hero)ch).restoreHealth; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ImpSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ImpSprite.java index e2b7569ee..486c57a29 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ImpSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ImpSprite.java @@ -33,7 +33,7 @@ public class ImpSprite extends MobSprite { TextureFilm frames = new TextureFilm( texture, 12, 14 ); idle = new Animation( 10, true ); - idle.frames( frames, + idle.frames( frames, 0, 1, 2, 3, 0, 1, 2, 3, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 3, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java index 6f3f7b120..2a704bac0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java @@ -156,7 +156,7 @@ public class ItemSprite extends MovieClip { } else { float px = x; - float py = y; + float py = y; drop(); place(from); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index 77f5323b7..a09497212 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -19,219 +19,219 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; public class ItemSpriteSheet { - // Row definers - private static final int ROW1 = 0*16; - private static final int ROW2 = 1*16; - private static final int ROW3 = 2*16; - private static final int ROW4 = 3*16; - private static final int ROW5 = 4*16; - private static final int ROW6 = 5*16; - private static final int ROW7 = 6*16; - private static final int ROW8 = 7*16; - private static final int ROW9 = 8*16; - private static final int ROW10 = 9*16; - private static final int ROW11 = 10*16; - private static final int ROW12 = 11*16; - private static final int ROW13 = 12*16; - private static final int ROW14 = 13*16; - private static final int ROW15 = 14*16; - private static final int ROW16 = 15*16; + // Row definers + private static final int ROW1 = 0*16; + private static final int ROW2 = 1*16; + private static final int ROW3 = 2*16; + private static final int ROW4 = 3*16; + private static final int ROW5 = 4*16; + private static final int ROW6 = 5*16; + private static final int ROW7 = 6*16; + private static final int ROW8 = 7*16; + private static final int ROW9 = 8*16; + private static final int ROW10 = 9*16; + private static final int ROW11 = 10*16; + private static final int ROW12 = 11*16; + private static final int ROW13 = 12*16; + private static final int ROW14 = 13*16; + private static final int ROW15 = 14*16; + private static final int ROW16 = 15*16; - //Row One: Items which can't be obtained - //null warning occupies space 0, should only show up if there's a bug. - public static final int NULLWARN = ROW1+0; - public static final int DEWDROP = ROW1+1; - public static final int PETAL = ROW1+2; - public static final int SANDBAG = ROW1+3; - // Heaps (containers) - public static final int BONES = ROW1+4; - public static final int REMAINS = ROW1+5; - public static final int TOMB = ROW1+6; - public static final int GRAVE = ROW1+7; - public static final int CHEST = ROW1+8; - public static final int LOCKED_CHEST = ROW1+9; - public static final int CRYSTAL_CHEST = ROW1+10; - // Placeholders - public static final int WEAPON = ROW1+11; - public static final int ARMOR = ROW1+12; - public static final int RING = ROW1+13; - public static final int SMTH = ROW1+14; + //Row One: Items which can't be obtained + //null warning occupies space 0, should only show up if there's a bug. + public static final int NULLWARN = ROW1+0; + public static final int DEWDROP = ROW1+1; + public static final int PETAL = ROW1+2; + public static final int SANDBAG = ROW1+3; + // Heaps (containers) + public static final int BONES = ROW1+4; + public static final int REMAINS = ROW1+5; + public static final int TOMB = ROW1+6; + public static final int GRAVE = ROW1+7; + public static final int CHEST = ROW1+8; + public static final int LOCKED_CHEST = ROW1+9; + public static final int CRYSTAL_CHEST = ROW1+10; + // Placeholders + public static final int WEAPON = ROW1+11; + public static final int ARMOR = ROW1+12; + public static final int RING = ROW1+13; + public static final int SMTH = ROW1+14; - //Row Two: Miscellaneous single use items - public static final int GOLD = ROW2+0; - public static final int TORCH = ROW2+1; - public static final int STYLUS = ROW2+2; - public static final int ANKH = ROW2+3; - // Keys - public static final int IRON_KEY = ROW2+4; - public static final int GOLDEN_KEY = ROW2+5; - public static final int SKELETON_KEY = ROW2+6; - //Boss Rewards - public static final int BEACON = ROW2+7; - public static final int MASTERY = ROW2+8; - public static final int KIT = ROW2+9; - public static final int AMULET = ROW2+10; - public static final int WEIGHT = ROW2+11; + //Row Two: Miscellaneous single use items + public static final int GOLD = ROW2+0; + public static final int TORCH = ROW2+1; + public static final int STYLUS = ROW2+2; + public static final int ANKH = ROW2+3; + // Keys + public static final int IRON_KEY = ROW2+4; + public static final int GOLDEN_KEY = ROW2+5; + public static final int SKELETON_KEY = ROW2+6; + //Boss Rewards + public static final int BEACON = ROW2+7; + public static final int MASTERY = ROW2+8; + public static final int KIT = ROW2+9; + public static final int AMULET = ROW2+10; + public static final int WEIGHT = ROW2+11; public static final int BOMB = ROW2+12; - public static final int DBL_BOMB= ROW2+13; + public static final int DBL_BOMB= ROW2+13; public static final int HONEYPOT= ROW2+14; - public static final int SHATTPOT= ROW2+15; + public static final int SHATTPOT= ROW2+15; - //Row Three: Melee weapons - public static final int KNUCKLEDUSTER = ROW3+0; - public static final int DAGGER = ROW3+1; - public static final int SHORT_SWORD = ROW3+2; - public static final int MAGES_STAFF = ROW3+3; - public static final int QUARTERSTAFF = ROW3+4; - public static final int SPEAR = ROW3+5; - public static final int MACE = ROW3+6; - public static final int SWORD = ROW3+7; - public static final int BATTLE_AXE = ROW3+8; - public static final int LONG_SWORD = ROW3+9; - public static final int WAR_HAMMER = ROW3+10; - public static final int GLAIVE = ROW3+11; + //Row Three: Melee weapons + public static final int KNUCKLEDUSTER = ROW3+0; + public static final int DAGGER = ROW3+1; + public static final int SHORT_SWORD = ROW3+2; + public static final int MAGES_STAFF = ROW3+3; + public static final int QUARTERSTAFF = ROW3+4; + public static final int SPEAR = ROW3+5; + public static final int MACE = ROW3+6; + public static final int SWORD = ROW3+7; + public static final int BATTLE_AXE = ROW3+8; + public static final int LONG_SWORD = ROW3+9; + public static final int WAR_HAMMER = ROW3+10; + public static final int GLAIVE = ROW3+11; - //Row Four: Missile weapons - public static final int DART = ROW4+0; - public static final int BOOMERANG = ROW4+1; - public static final int INCENDIARY_DART = ROW4+2; - public static final int SHURIKEN = ROW4+3; - public static final int CURARE_DART = ROW4+4; - public static final int JAVELIN = ROW4+5; - public static final int TOMAHAWK = ROW4+6; + //Row Four: Missile weapons + public static final int DART = ROW4+0; + public static final int BOOMERANG = ROW4+1; + public static final int INCENDIARY_DART = ROW4+2; + public static final int SHURIKEN = ROW4+3; + public static final int CURARE_DART = ROW4+4; + public static final int JAVELIN = ROW4+5; + public static final int TOMAHAWK = ROW4+6; - //Row Five: Armors - public static final int ARMOR_CLOTH = ROW5+0; - public static final int ARMOR_LEATHER = ROW5+1; - public static final int ARMOR_MAIL = ROW5+2; - public static final int ARMOR_SCALE = ROW5+3; - public static final int ARMOR_PLATE = ROW5+4; - public static final int ARMOR_WARRIOR = ROW5+5; - public static final int ARMOR_MAGE = ROW5+6; - public static final int ARMOR_ROGUE = ROW5+7; - public static final int ARMOR_HUNTRESS = ROW5+8; + //Row Five: Armors + public static final int ARMOR_CLOTH = ROW5+0; + public static final int ARMOR_LEATHER = ROW5+1; + public static final int ARMOR_MAIL = ROW5+2; + public static final int ARMOR_SCALE = ROW5+3; + public static final int ARMOR_PLATE = ROW5+4; + public static final int ARMOR_WARRIOR = ROW5+5; + public static final int ARMOR_MAGE = ROW5+6; + public static final int ARMOR_ROGUE = ROW5+7; + public static final int ARMOR_HUNTRESS = ROW5+8; - //Row Six: Wands - public static final int WAND_MAGIC_MISSILE = ROW6+0; - public static final int WAND_FIREBOLT = ROW6+1; - public static final int WAND_FROST = ROW6+2; - public static final int WAND_LIGHTNING = ROW6+3; - public static final int WAND_DISINTEGRATION = ROW6+4; - public static final int WAND_PRISMATIC_LIGHT= ROW6+5; - public static final int WAND_VENOM = ROW6+6; - public static final int WAND_LIVING_EARTH = ROW6+7; - public static final int WAND_BLAST_WAVE = ROW6+8; - public static final int WAND_CORRUPTION = ROW6+9; - public static final int WAND_WARDING = ROW6+10; - public static final int WAND_REGROWTH = ROW6+11; - public static final int WAND_TRANSFUSION = ROW6+12; + //Row Six: Wands + public static final int WAND_MAGIC_MISSILE = ROW6+0; + public static final int WAND_FIREBOLT = ROW6+1; + public static final int WAND_FROST = ROW6+2; + public static final int WAND_LIGHTNING = ROW6+3; + public static final int WAND_DISINTEGRATION = ROW6+4; + public static final int WAND_PRISMATIC_LIGHT= ROW6+5; + public static final int WAND_VENOM = ROW6+6; + public static final int WAND_LIVING_EARTH = ROW6+7; + public static final int WAND_BLAST_WAVE = ROW6+8; + public static final int WAND_CORRUPTION = ROW6+9; + public static final int WAND_WARDING = ROW6+10; + public static final int WAND_REGROWTH = ROW6+11; + public static final int WAND_TRANSFUSION = ROW6+12; - //Row Seven: Rings - public static final int RING_GARNET = ROW7+0; - public static final int RING_RUBY = ROW7+1; - public static final int RING_TOPAZ = ROW7+2; - public static final int RING_EMERALD = ROW7+3; - public static final int RING_ONYX = ROW7+4; - public static final int RING_OPAL = ROW7+5; - public static final int RING_TOURMALINE = ROW7+6; - public static final int RING_SAPPHIRE = ROW7+7; - public static final int RING_AMETHYST = ROW7+8; - public static final int RING_QUARTZ = ROW7+9; - public static final int RING_AGATE = ROW7+10; - public static final int RING_DIAMOND = ROW7+11; + //Row Seven: Rings + public static final int RING_GARNET = ROW7+0; + public static final int RING_RUBY = ROW7+1; + public static final int RING_TOPAZ = ROW7+2; + public static final int RING_EMERALD = ROW7+3; + public static final int RING_ONYX = ROW7+4; + public static final int RING_OPAL = ROW7+5; + public static final int RING_TOURMALINE = ROW7+6; + public static final int RING_SAPPHIRE = ROW7+7; + public static final int RING_AMETHYST = ROW7+8; + public static final int RING_QUARTZ = ROW7+9; + public static final int RING_AGATE = ROW7+10; + public static final int RING_DIAMOND = ROW7+11; - //Row Eight: Artifacts with Static Images - public static final int ARTIFACT_CLOAK = ROW8+0; - public static final int ARTIFACT_ARMBAND = ROW8+1; - public static final int ARTIFACT_CAPE = ROW8+2; - public static final int ARTIFACT_TALISMAN = ROW8+3; - public static final int ARTIFACT_HOURGLASS = ROW8+4; - public static final int ARTIFACT_TOOLKIT = ROW8+5; - public static final int ARTIFACT_SPELLBOOK = ROW8+6; - public static final int ARTIFACT_BEACON = ROW8+7; - public static final int ARTIFACT_CHAINS = ROW8+8; + //Row Eight: Artifacts with Static Images + public static final int ARTIFACT_CLOAK = ROW8+0; + public static final int ARTIFACT_ARMBAND = ROW8+1; + public static final int ARTIFACT_CAPE = ROW8+2; + public static final int ARTIFACT_TALISMAN = ROW8+3; + public static final int ARTIFACT_HOURGLASS = ROW8+4; + public static final int ARTIFACT_TOOLKIT = ROW8+5; + public static final int ARTIFACT_SPELLBOOK = ROW8+6; + public static final int ARTIFACT_BEACON = ROW8+7; + public static final int ARTIFACT_CHAINS = ROW8+8; - //Row Nine: Artifacts with Dynamic Images - public static final int ARTIFACT_HORN1 = ROW9+0; - public static final int ARTIFACT_HORN2 = ROW9+1; - public static final int ARTIFACT_HORN3 = ROW9+2; - public static final int ARTIFACT_HORN4 = ROW9+3; - public static final int ARTIFACT_CHALICE1 = ROW9+4; - public static final int ARTIFACT_CHALICE2 = ROW9+5; - public static final int ARTIFACT_CHALICE3 = ROW9+6; - public static final int ARTIFACT_SANDALS = ROW9+7; - public static final int ARTIFACT_SHOES = ROW9+8; - public static final int ARTIFACT_BOOTS = ROW9+9; - public static final int ARTIFACT_GREAVES = ROW9+10; - public static final int ARTIFACT_ROSE1 = ROW9+11; - public static final int ARTIFACT_ROSE2 = ROW9+12; - public static final int ARTIFACT_ROSE3 = ROW9+13; + //Row Nine: Artifacts with Dynamic Images + public static final int ARTIFACT_HORN1 = ROW9+0; + public static final int ARTIFACT_HORN2 = ROW9+1; + public static final int ARTIFACT_HORN3 = ROW9+2; + public static final int ARTIFACT_HORN4 = ROW9+3; + public static final int ARTIFACT_CHALICE1 = ROW9+4; + public static final int ARTIFACT_CHALICE2 = ROW9+5; + public static final int ARTIFACT_CHALICE3 = ROW9+6; + public static final int ARTIFACT_SANDALS = ROW9+7; + public static final int ARTIFACT_SHOES = ROW9+8; + public static final int ARTIFACT_BOOTS = ROW9+9; + public static final int ARTIFACT_GREAVES = ROW9+10; + public static final int ARTIFACT_ROSE1 = ROW9+11; + public static final int ARTIFACT_ROSE2 = ROW9+12; + public static final int ARTIFACT_ROSE3 = ROW9+13; - //Row Ten: Scrolls - public static final int SCROLL_KAUNAN = ROW10+0; - public static final int SCROLL_SOWILO = ROW10+1; - public static final int SCROLL_LAGUZ = ROW10+2; - public static final int SCROLL_YNGVI = ROW10+3; - public static final int SCROLL_GYFU = ROW10+4; - public static final int SCROLL_RAIDO = ROW10+5; - public static final int SCROLL_ISAZ = ROW10+6; - public static final int SCROLL_MANNAZ = ROW10+7; - public static final int SCROLL_NAUDIZ = ROW10+8; - public static final int SCROLL_BERKANAN = ROW10+9; - public static final int SCROLL_ODAL = ROW10+10; - public static final int SCROLL_TIWAZ = ROW10+11; + //Row Ten: Scrolls + public static final int SCROLL_KAUNAN = ROW10+0; + public static final int SCROLL_SOWILO = ROW10+1; + public static final int SCROLL_LAGUZ = ROW10+2; + public static final int SCROLL_YNGVI = ROW10+3; + public static final int SCROLL_GYFU = ROW10+4; + public static final int SCROLL_RAIDO = ROW10+5; + public static final int SCROLL_ISAZ = ROW10+6; + public static final int SCROLL_MANNAZ = ROW10+7; + public static final int SCROLL_NAUDIZ = ROW10+8; + public static final int SCROLL_BERKANAN = ROW10+9; + public static final int SCROLL_ODAL = ROW10+10; + public static final int SCROLL_TIWAZ = ROW10+11; - //Row Eleven: Potions - public static final int POTION_CRIMSON = ROW11+0; - public static final int POTION_AMBER = ROW11+1; - public static final int POTION_GOLDEN = ROW11+2; - public static final int POTION_JADE = ROW11+3; - public static final int POTION_TURQUOISE = ROW11+4; - public static final int POTION_AZURE = ROW11+5; - public static final int POTION_INDIGO = ROW11+6; - public static final int POTION_MAGENTA = ROW11+7; - public static final int POTION_BISTRE = ROW11+8; - public static final int POTION_CHARCOAL = ROW11+9; - public static final int POTION_SILVER = ROW11+10; - public static final int POTION_IVORY = ROW11+11; + //Row Eleven: Potions + public static final int POTION_CRIMSON = ROW11+0; + public static final int POTION_AMBER = ROW11+1; + public static final int POTION_GOLDEN = ROW11+2; + public static final int POTION_JADE = ROW11+3; + public static final int POTION_TURQUOISE = ROW11+4; + public static final int POTION_AZURE = ROW11+5; + public static final int POTION_INDIGO = ROW11+6; + public static final int POTION_MAGENTA = ROW11+7; + public static final int POTION_BISTRE = ROW11+8; + public static final int POTION_CHARCOAL = ROW11+9; + public static final int POTION_SILVER = ROW11+10; + public static final int POTION_IVORY = ROW11+11; - //Row Twelve: Seeds - public static final int SEED_ROTBERRY = ROW12+0; - public static final int SEED_FIREBLOOM = ROW12+1; - public static final int SEED_STARFLOWER = ROW12+2; - public static final int SEED_BLINDWEED = ROW12+3; - public static final int SEED_SUNGRASS = ROW12+4; - public static final int SEED_ICECAP = ROW12+5; - public static final int SEED_STORMVINE = ROW12+6; - public static final int SEED_SORROWMOSS = ROW12+7; - public static final int SEED_DREAMFOIL = ROW12+8; - public static final int SEED_EARTHROOT = ROW12+9; - public static final int SEED_FADELEAF = ROW12+10; - public static final int SEED_BLANDFRUIT = ROW12+11; + //Row Twelve: Seeds + public static final int SEED_ROTBERRY = ROW12+0; + public static final int SEED_FIREBLOOM = ROW12+1; + public static final int SEED_STARFLOWER = ROW12+2; + public static final int SEED_BLINDWEED = ROW12+3; + public static final int SEED_SUNGRASS = ROW12+4; + public static final int SEED_ICECAP = ROW12+5; + public static final int SEED_STORMVINE = ROW12+6; + public static final int SEED_SORROWMOSS = ROW12+7; + public static final int SEED_DREAMFOIL = ROW12+8; + public static final int SEED_EARTHROOT = ROW12+9; + public static final int SEED_FADELEAF = ROW12+10; + public static final int SEED_BLANDFRUIT = ROW12+11; - //Row Thirteen: Food - public static final int MEAT = ROW13+0; - public static final int STEAK = ROW13+1; - public static final int OVERPRICED = ROW13+2; - public static final int CARPACCIO = ROW13+3; - public static final int BLANDFRUIT = ROW13+4; - public static final int RATION = ROW13+5; - public static final int PASTY = ROW13+6; + //Row Thirteen: Food + public static final int MEAT = ROW13+0; + public static final int STEAK = ROW13+1; + public static final int OVERPRICED = ROW13+2; + public static final int CARPACCIO = ROW13+3; + public static final int BLANDFRUIT = ROW13+4; + public static final int RATION = ROW13+5; + public static final int PASTY = ROW13+6; - //Row Fourteen: Quest Items - public static final int SKULL = ROW14+0; - public static final int DUST = ROW14+1; - public static final int PICKAXE = ROW14+2; - public static final int ORE = ROW14+3; - public static final int TOKEN = ROW14+4; + //Row Fourteen: Quest Items + public static final int SKULL = ROW14+0; + public static final int DUST = ROW14+1; + public static final int PICKAXE = ROW14+2; + public static final int ORE = ROW14+3; + public static final int TOKEN = ROW14+4; - //Row Fifteen: Containers/Bags - public static final int VIAL = ROW15+0; - public static final int POUCH = ROW15+1; - public static final int HOLDER = ROW15+2; - public static final int BANDOLIER = ROW15+3; - public static final int HOLSTER = ROW15+4; + //Row Fifteen: Containers/Bags + public static final int VIAL = ROW15+0; + public static final int POUCH = ROW15+1; + public static final int HOLDER = ROW15+2; + public static final int BANDOLIER = ROW15+3; + public static final int HOLSTER = ROW15+4; - //Row Sixteen: Unused + //Row Sixteen: Unused } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java index 6ee3b04f7..66d3d4bf9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java @@ -53,11 +53,11 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener { point( DungeonTilemap.tileToWorld( from ) ); PointF dest = DungeonTilemap.tileToWorld( to ); - PointF d = PointF.diff( dest, point() ); + PointF d = PointF.diff( dest, point() ); speed.set( d ).normalize().scale( SPEED ); if (image == ItemSpriteSheet.DART || image == ItemSpriteSheet.INCENDIARY_DART - || image == ItemSpriteSheet.CURARE_DART || image == ItemSpriteSheet.JAVELIN) { + || image == ItemSpriteSheet.CURARE_DART || image == ItemSpriteSheet.JAVELIN) { angularSpeed = 0; angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MobSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MobSprite.java index c7c42a486..10f66f940 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MobSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MobSprite.java @@ -40,7 +40,7 @@ public class MobSprite extends CharSprite { super.onComplete( anim ); - if (anim == die) { + if (anim == die) { parent.add( new AlphaTweener( this, 0, FADE_TIME ) { @Override protected void onComplete() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ScorpioSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ScorpioSprite.java index 498fb2f0a..9170da133 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ScorpioSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ScorpioSprite.java @@ -62,7 +62,7 @@ public class ScorpioSprite extends MobSprite { cellToAttack = cell; turnTo( ch.pos , cell ); - play( zap ); + play( zap ); } else { @@ -77,7 +77,7 @@ public class ScorpioSprite extends MobSprite { idle(); ((MissileSprite)parent.recycle( MissileSprite.class )). - reset( ch.pos, cellToAttack, new Dart(), new Callback() { + reset( ch.pos, cellToAttack, new Dart(), new Callback() { @Override public void call() { ch.onAttackComplete(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/SheepSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/SheepSprite.java index 4b3236467..7f4c7ff7e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/SheepSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/SheepSprite.java @@ -33,7 +33,7 @@ public class SheepSprite extends MobSprite { idle = new Animation( 8, true ); idle.frames( frames, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0 ); - run = idle.clone(); + run = idle.clone(); attack = idle.clone(); die = new Animation( 20, false ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java index 18585e986..c1cffece4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/TenguSprite.java @@ -60,13 +60,13 @@ public class TenguSprite extends MobSprite { play( run ); turnTo( from , to ); - isMoving = true; + isMoving = true; - if (Level.water[to]) { + if (Level.water[to]) { GameScene.ripple( to ); } - ch.onMotionComplete(); + ch.onMotionComplete(); } @Override @@ -74,7 +74,7 @@ public class TenguSprite extends MobSprite { if (!Level.adjacent( cell, ch.pos )) { ((MissileSprite)parent.recycle( MissileSprite.class )). - reset( ch.pos, cell, new Shuriken(), new Callback() { + reset( ch.pos, cell, new Shuriken(), new Callback() { @Override public void call() { ch.onAttackComplete(); @@ -94,8 +94,8 @@ public class TenguSprite extends MobSprite { @Override public void onComplete( Animation anim ) { if (anim == run) { - isMoving = false; - idle(); + isMoving = false; + idle(); } else { super.onComplete( anim ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/WarlockSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/WarlockSprite.java index b80359a5a..a547bc874 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/WarlockSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/WarlockSprite.java @@ -55,8 +55,8 @@ public class WarlockSprite extends MobSprite { turnTo( ch.pos , cell ); play( zap ); - MagicMissile.shadow( parent, ch.pos, cell, - new Callback() { + MagicMissile.shadow( parent, ch.pos, cell, + new Callback() { @Override public void call() { ((Warlock)ch).onZapComplete(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Archs.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Archs.java index 3f4e9ee41..9c8b3b382 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Archs.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Archs.java @@ -24,50 +24,50 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; public class Archs extends Component { - private static final float SCROLL_SPEED = 20f; + private static final float SCROLL_SPEED = 20f; - private SkinnedBlock arcsBg; - private SkinnedBlock arcsFg; + private SkinnedBlock arcsBg; + private SkinnedBlock arcsFg; - private static float offsB = 0; - private static float offsF = 0; + private static float offsB = 0; + private static float offsF = 0; - public boolean reversed = false; + public boolean reversed = false; - @Override - protected void createChildren() { - arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG ); - arcsBg.offsetTo( 0, offsB ); - add( arcsBg ); + @Override + protected void createChildren() { + arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG ); + arcsBg.offsetTo( 0, offsB ); + add( arcsBg ); - arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG ); - arcsFg.offsetTo( 0, offsF ); - add( arcsFg ); - } + arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG ); + arcsFg.offsetTo( 0, offsF ); + add( arcsFg ); + } - @Override - protected void layout() { - arcsBg.size( width, height ); - arcsBg.offset( arcsBg.texture.width / 4 - (width % arcsBg.texture.width) / 2, 0 ); + @Override + protected void layout() { + arcsBg.size( width, height ); + arcsBg.offset( arcsBg.texture.width / 4 - (width % arcsBg.texture.width) / 2, 0 ); - arcsFg.size( width, height ); - arcsFg.offset( arcsFg.texture.width / 4 - (width % arcsFg.texture.width) / 2, 0 ); - } + arcsFg.size( width, height ); + arcsFg.offset( arcsFg.texture.width / 4 - (width % arcsFg.texture.width) / 2, 0 ); + } - @Override - public void update() { + @Override + public void update() { - super.update(); + super.update(); - float shift = Game.elapsed * SCROLL_SPEED; - if (reversed) { - shift = -shift; - } + float shift = Game.elapsed * SCROLL_SPEED; + if (reversed) { + shift = -shift; + } - arcsBg.offset( 0, shift ); - arcsFg.offset( 0, shift * 2 ); + arcsBg.offset( 0, shift ); + arcsFg.offset( 0, shift * 2 ); - offsB = arcsBg.offsetY(); - offsF = arcsFg.offsetY(); - } + offsB = arcsBg.offsetY(); + offsF = arcsFg.offsetY(); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java index b7a306650..9e7de0171 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java @@ -66,7 +66,7 @@ public class AttackIndicator extends Tag { sprite.y = y + (height - sprite.height()) / 2; PixelScene.align( sprite ); } - } + } @Override public void update() { @@ -109,7 +109,7 @@ public class AttackIndicator extends Tag { } else { active = true; lastTarget = Random.element( candidates ); - updateImage(); + updateImage(); flash(); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 00c7587ed..202afeeec 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -65,11 +65,11 @@ public class BuffIndicator extends Component { public static final int BLEEDING = 26; public static final int MARK = 27; public static final int DEFERRED = 28; - public static final int DROWSY = 29; - public static final int MAGIC_SLEEP = 30; - public static final int THORNS = 31; - public static final int FORESIGHT = 32; - public static final int VERTIGO = 33; + public static final int DROWSY = 29; + public static final int MAGIC_SLEEP = 30; + public static final int THORNS = 31; + public static final int FORESIGHT = 32; + public static final int VERTIGO = 33; public static final int RECHARGING = 34; public static final int LOCKED_FLOOR= 35; public static final int CORRUPT = 36; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java index f3829acd9..d2fbc392d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java @@ -38,11 +38,11 @@ public class CheckBox extends RedButton { text.x = PixelScene.align( PixelScene.uiCamera, x + margin ); text.y = PixelScene.align( PixelScene.uiCamera, y + margin ); - margin = (height - icon.height) / 2; + margin = (height - icon.height) / 2; - icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width ); - icon.y = PixelScene.align( PixelScene.uiCamera, y + margin ); - } + icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width ); + icon.y = PixelScene.align( PixelScene.uiCamera, y + margin ); + } public boolean checked() { return checked; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Compass.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Compass.java index f3f20ee9a..c6cafb86b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Compass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Compass.java @@ -49,10 +49,10 @@ public class Compass extends Image { super.update(); if (!visible) { - visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell]; + visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell]; } - if (visible) { + if (visible) { PointF scroll = Camera.main.scroll; if (!scroll.equals( lastScroll )) { lastScroll.set( scroll ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java index 54fcbdacb..20adc9cd6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java @@ -17,58 +17,58 @@ */ package com.shatteredpixel.shatteredpixeldungeon.ui; - import com.watabou.noosa.Game; - import com.watabou.noosa.Image; - import com.watabou.noosa.audio.Sample; - import com.watabou.noosa.ui.Button; - import com.shatteredpixel.shatteredpixeldungeon.Assets; - import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; - import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene; + import com.watabou.noosa.Game; + import com.watabou.noosa.Image; + import com.watabou.noosa.audio.Sample; + import com.watabou.noosa.ui.Button; + import com.shatteredpixel.shatteredpixeldungeon.Assets; + import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; + import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene; public class ExitButton extends Button { - protected Image image; + protected Image image; - public ExitButton() { - super(); + public ExitButton() { + super(); - width = image.width; - height = image.height; - } + width = image.width; + height = image.height; + } - @Override - protected void createChildren() { - super.createChildren(); + @Override + protected void createChildren() { + super.createChildren(); - image = Icons.EXIT.get(); - add( image ); - } + image = Icons.EXIT.get(); + add( image ); + } - @Override - protected void layout() { - super.layout(); + @Override + protected void layout() { + super.layout(); - image.x = x; - image.y = y; - } + image.x = x; + image.y = y; + } - @Override - protected void onTouchDown() { - image.brightness( 1.5f ); - Sample.INSTANCE.play( Assets.SND_CLICK ); - } + @Override + protected void onTouchDown() { + image.brightness( 1.5f ); + Sample.INSTANCE.play( Assets.SND_CLICK ); + } - @Override - protected void onTouchUp() { - image.resetColor(); - } + @Override + protected void onTouchUp() { + image.resetColor(); + } - @Override - protected void onClick() { - if (Game.scene() instanceof TitleScene) { - Game.instance.finish(); - } else { - ShatteredPixelDungeon.switchNoFade( TitleScene.class ); - } - } + @Override + protected void onClick() { + if (Game.scene() instanceof TitleScene) { + Game.instance.finish(); + } else { + ShatteredPixelDungeon.switchNoFade( TitleScene.class ); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/GameLog.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/GameLog.java index ec49ea114..eb1a94af9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/GameLog.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/GameLog.java @@ -54,11 +54,11 @@ public class GameLog extends Component implements Signal.Listener { if (text.startsWith( GLog.POSITIVE )) { text = text.substring( GLog.POSITIVE.length() ); color = CharSprite.POSITIVE; - } else + } else if (text.startsWith( GLog.NEGATIVE )) { text = text.substring( GLog.NEGATIVE.length() ); color = CharSprite.NEGATIVE; - } else + } else if (text.startsWith( GLog.WARNING )) { text = text.substring( GLog.WARNING.length() ); color = CharSprite.WARNING; @@ -68,7 +68,7 @@ public class GameLog extends Component implements Signal.Listener { color = CharSprite.NEUTRAL; } - text = Utils.capitalize( text ) + + text = Utils.capitalize( text ) + (PUNCTUATION.matcher( text ).matches() ? "" : "."); if (lastEntry != null && color == lastColor) { @@ -96,7 +96,7 @@ public class GameLog extends Component implements Signal.Listener { } @Override - protected void layout() { + protected void layout() { float pos = y; for (int i=length-1; i >= 0; i--) { BitmapTextMultiline entry = (BitmapTextMultiline)members.get( i ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java index 816029fbb..c2c443528 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java @@ -26,13 +26,13 @@ public enum Icons { SKULL, BUSY, COMPASS, - INFO, + INFO, PREFS, WARNING, TARGET, MASTERY, WATA, - SHPX, + SHPX, WARRIOR, MAGE, ROGUE, @@ -49,9 +49,9 @@ public enum Icons { WAND_HOLSTER, CHECKED, UNCHECKED, - EXIT, - CHALLENGE_OFF, - CHALLENGE_ON, + EXIT, + CHALLENGE_OFF, + CHALLENGE_ON, RESUME; public Image get() { @@ -88,9 +88,9 @@ public enum Icons { case WATA: icon.frame( icon.texture.uvRect( 30, 16, 45, 26 ) ); break; - case SHPX: - icon.frame( icon.texture.uvRect( 64, 44, 80, 60 ) ); - break; + case SHPX: + icon.frame( icon.texture.uvRect( 64, 44, 80, 60 ) ); + break; case WARRIOR: icon.frame( icon.texture.uvRect( 0, 29, 16, 45 ) ); break; @@ -139,15 +139,15 @@ public enum Icons { case UNCHECKED: icon.frame( icon.texture.uvRect( 66, 12, 78, 24 ) ); break; - case EXIT: - icon.frame( icon.texture.uvRect( 108, 0, 124, 16 ) ); - break; - case CHALLENGE_OFF: - icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) ); - break; - case CHALLENGE_ON: - icon.frame( icon.texture.uvRect( 102, 16, 126, 40 ) ); - break; + case EXIT: + icon.frame( icon.texture.uvRect( 108, 0, 124, 16 ) ); + break; + case CHALLENGE_OFF: + icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) ); + break; + case CHALLENGE_ON: + icon.frame( icon.texture.uvRect( 102, 16, 126, 40 ) ); + break; case RESUME: icon.frame( icon.texture.uvRect( 13, 53, 24, 64 ) ); break; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ItemSlot.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ItemSlot.java index 29ef55441..a1a160416 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ItemSlot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ItemSlot.java @@ -54,30 +54,30 @@ public class ItemSlot extends Button { private static final String TXT_STRENGTH = ":%d"; private static final String TXT_TYPICAL_STR = "%d?"; - private static final String TXT_KEY_DEPTH = "\u007F%d"; + private static final String TXT_KEY_DEPTH = "\u007F%d"; private static final String TXT_LEVEL = "%+d"; - private static final String TXT_CURSED = "";//"-"; + private static final String TXT_CURSED = "";//"-"; - // Special "virtual items" + // Special "virtual items" public static final Item CHEST = new Item() { public int image() { return ItemSpriteSheet.CHEST; }; }; public static final Item LOCKED_CHEST = new Item() { public int image() { return ItemSpriteSheet.LOCKED_CHEST; }; }; - public static final Item CRYSTAL_CHEST = new Item() { - public int image() { return ItemSpriteSheet.CRYSTAL_CHEST; }; - }; + public static final Item CRYSTAL_CHEST = new Item() { + public int image() { return ItemSpriteSheet.CRYSTAL_CHEST; }; + }; public static final Item TOMB = new Item() { public int image() { return ItemSpriteSheet.TOMB; }; }; public static final Item SKELETON = new Item() { public int image() { return ItemSpriteSheet.BONES; }; }; - public static final Item REMAINS = new Item() { - public int image() { return ItemSpriteSheet.REMAINS; }; - }; + public static final Item REMAINS = new Item() { + public int image() { return ItemSpriteSheet.REMAINS; }; + }; public ItemSlot() { super(); @@ -162,8 +162,8 @@ public class ItemSlot extends Button { } else { - topRight.text( Utils.format( TXT_TYPICAL_STR, isArmor ? - ((Armor)item).typicalSTR() : + topRight.text( Utils.format( TXT_TYPICAL_STR, isArmor ? + ((Armor)item).typicalSTR() : ((MeleeWeapon)item).typicalSTR() ) ); topRight.hardlight( WARNING ); @@ -171,19 +171,19 @@ public class ItemSlot extends Button { topRight.measure(); } else if (item instanceof Key && !(item instanceof SkeletonKey)) { - topRight.text(Utils.format(TXT_KEY_DEPTH, ((Key) item).depth)); - topRight.measure(); - } else { + topRight.text(Utils.format(TXT_KEY_DEPTH, ((Key) item).depth)); + topRight.measure(); + } else { topRight.text( null ); } - int level = item.visiblyUpgraded(); + int level = item.visiblyUpgraded(); if (level != 0) { - bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED ); - bottomRight.measure(); + bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED ); + bottomRight.measure(); bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED ); } else if (item instanceof Scroll || item instanceof Potion) { if (item instanceof Scroll) bottomRight.text(((Scroll) item).initials()); @@ -216,14 +216,14 @@ public class ItemSlot extends Button { bottomRight.alpha( alpha ); } - public void showParams( boolean TL, boolean TR, boolean BR ) { - if (TL) add( topLeft ); - else remove( topLeft ); + public void showParams( boolean TL, boolean TR, boolean BR ) { + if (TL) add( topLeft ); + else remove( topLeft ); - if (TR) add( topRight ); - else remove( topRight ); + if (TR) add( topRight ); + else remove( topRight ); - if (BR) add( bottomRight ); - else remove( bottomRight ); - } + if (BR) add( bottomRight ); + else remove( bottomRight ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java index b8c1d1173..fb33322fa 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java @@ -66,10 +66,10 @@ public class LootIndicator extends Tag { Item item = heap.type == Heap.Type.CHEST || heap.type == Heap.Type.MIMIC ? ItemSlot.CHEST : heap.type == Heap.Type.LOCKED_CHEST ? ItemSlot.LOCKED_CHEST : - heap.type == Heap.Type.CRYSTAL_CHEST ? ItemSlot.CRYSTAL_CHEST : + heap.type == Heap.Type.CRYSTAL_CHEST ? ItemSlot.CRYSTAL_CHEST : heap.type == Heap.Type.TOMB ? ItemSlot.TOMB : heap.type == Heap.Type.SKELETON ? ItemSlot.SKELETON : - heap.type == Heap.Type.REMAINS ? ItemSlot.REMAINS : + heap.type == Heap.Type.REMAINS ? ItemSlot.REMAINS : heap.peek(); if (item != lastItem || item.quantity() != lastQuantity) { lastItem = item; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java index 62952bf40..0565d4f32 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java @@ -59,11 +59,11 @@ public class QuickSlotButton extends Button implements WndBag.Listener { reset(); } - public static void reset() { - instance = new QuickSlotButton[4]; + public static void reset() { + instance = new QuickSlotButton[4]; - lastTarget = null; - } + lastTarget = null; + } @Override protected void createChildren() { @@ -94,7 +94,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener { icon.resetColor(); } }; - slot.showParams( true, false, true ); + slot.showParams( true, false, true ); add( slot ); crossB = Icons.TARGET.get(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java index 77721d4a8..ac04d06a3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java @@ -90,9 +90,9 @@ public class RedButton extends Button { layout(); } - public void textColor( int value ) { - text.hardlight( value ); - } + public void textColor( int value ) { + text.hardlight( value ); + } public void icon( Image icon ) { if (this.icon != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java index 24e988f56..32112c0d1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java @@ -4,52 +4,49 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.watabou.noosa.Image; -/** - * Created by Evan on 21/01/2015. - */ public class ResumeIndicator extends Tag { - private Image icon; + private Image icon; - public ResumeIndicator() { - super(0xCDD5C0); + public ResumeIndicator() { + super(0xCDD5C0); - setSize( 24, 24 ); + setSize( 24, 24 ); - visible = false; + visible = false; - } + } - @Override - protected void createChildren() { - super.createChildren(); + @Override + protected void createChildren() { + super.createChildren(); - icon = Icons.get( Icons.RESUME ); - add( icon ); - } + icon = Icons.get( Icons.RESUME ); + add( icon ); + } - @Override - protected void layout() { - super.layout(); + @Override + protected void layout() { + super.layout(); - icon.x = PixelScene.align( PixelScene.uiCamera, x+1 + (width - icon.width) / 2 ); - icon.y = PixelScene.align( PixelScene.uiCamera, y + (height - icon.height) / 2 ); - } + icon.x = PixelScene.align( PixelScene.uiCamera, x+1 + (width - icon.width) / 2 ); + icon.y = PixelScene.align( PixelScene.uiCamera, y + (height - icon.height) / 2 ); + } - @Override - protected void onClick() { - Dungeon.hero.resume(); - } + @Override + protected void onClick() { + Dungeon.hero.resume(); + } - @Override - public void update() { - if (!Dungeon.hero.isAlive()) - visible = false; - else if (visible != (Dungeon.hero.lastAction != null)){ - visible = Dungeon.hero.lastAction != null; - if (visible) - flash(); - } - super.update(); - } + @Override + public void update() { + if (!Dungeon.hero.isAlive()) + visible = false; + else if (visible != (Dungeon.hero.lastAction != null)){ + visible = Dungeon.hero.lastAction != null; + if (visible) + flash(); + } + super.update(); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ScrollPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ScrollPane.java index b7c8fcd43..750c0e887 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ScrollPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ScrollPane.java @@ -84,7 +84,7 @@ public class ScrollPane extends Component { return content; } - public void onClick( float x, float y ) { + public void onClick( float x, float y ) { } public class TouchController extends TouchArea { @@ -114,7 +114,7 @@ public class ScrollPane extends Component { private PointF lastPos = new PointF(); @Override - protected void onDrag( Touch t ) { + protected void onDrag( Touch t ) { if (dragging) { Camera c = content.camera; @@ -134,7 +134,7 @@ public class ScrollPane extends Component { } - lastPos.set( t.current ); + lastPos.set( t.current ); } else if (PointF.distance( t.current, t.start ) > dragThreshold) { @@ -142,6 +142,6 @@ public class ScrollPane extends Component { lastPos.set( t.current ); } - } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index b9b028bbc..dd5412780 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -40,208 +40,208 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero; public class StatusPane extends Component { - private NinePatch shield; - private Image avatar; - private Emitter blood; + private NinePatch shield; + private Image avatar; + private Emitter blood; - private int lastTier = 0; + private int lastTier = 0; - private Image hp; - private Image exp; + private Image hp; + private Image exp; - private int lastLvl = -1; - private int lastKeys = -1; + private int lastLvl = -1; + private int lastKeys = -1; - private BitmapText level; - private BitmapText depth; - private BitmapText keys; + private BitmapText level; + private BitmapText depth; + private BitmapText keys; - private DangerIndicator danger; - private BuffIndicator buffs; - private Compass compass; + private DangerIndicator danger; + private BuffIndicator buffs; + private Compass compass; - private MenuButton btnMenu; + private MenuButton btnMenu; - @Override - protected void createChildren() { + @Override + protected void createChildren() { - shield = new NinePatch( Assets.STATUS, 80, 0, 30 + 18, 0 ); - add( shield ); + shield = new NinePatch( Assets.STATUS, 80, 0, 30 + 18, 0 ); + add( shield ); - add( new TouchArea( 0, 1, 31, 31 ) { - @Override - protected void onClick( Touch touch ) { - Image sprite = Dungeon.hero.sprite; - if (!sprite.isVisible()) { - Camera.main.focusOn( sprite ); - } - GameScene.show( new WndHero() ); - }; - } ); + add( new TouchArea( 0, 1, 31, 31 ) { + @Override + protected void onClick( Touch touch ) { + Image sprite = Dungeon.hero.sprite; + if (!sprite.isVisible()) { + Camera.main.focusOn( sprite ); + } + GameScene.show( new WndHero() ); + }; + } ); - btnMenu = new MenuButton(); - add( btnMenu ); + btnMenu = new MenuButton(); + add( btnMenu ); - avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier ); - add( avatar ); + avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier ); + add( avatar ); - blood = new Emitter(); - blood.pos( avatar ); - blood.pour( BloodParticle.FACTORY, 0.3f ); - blood.autoKill = false; - blood.on = false; - add( blood ); + blood = new Emitter(); + blood.pos( avatar ); + blood.pour( BloodParticle.FACTORY, 0.3f ); + blood.autoKill = false; + blood.on = false; + add( blood ); - compass = new Compass( Dungeon.level.exit ); - add( compass ); + compass = new Compass( Dungeon.level.exit ); + add( compass ); - hp = new Image( Assets.HP_BAR ); - add( hp ); + hp = new Image( Assets.HP_BAR ); + add( hp ); - exp = new Image( Assets.XP_BAR ); - add( exp ); + exp = new Image( Assets.XP_BAR ); + add( exp ); - level = new BitmapText( PixelScene.font1x ); - level.hardlight( 0xFFEBA4 ); - add( level ); + level = new BitmapText( PixelScene.font1x ); + level.hardlight( 0xFFEBA4 ); + add( level ); - depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x ); - depth.hardlight( 0xCACFC2 ); - depth.measure(); - add( depth ); + depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x ); + depth.hardlight( 0xCACFC2 ); + depth.measure(); + add( depth ); - Dungeon.hero.belongings.countIronKeys(); - keys = new BitmapText( PixelScene.font1x ); - keys.hardlight( 0xCACFC2 ); - add( keys ); + Dungeon.hero.belongings.countIronKeys(); + keys = new BitmapText( PixelScene.font1x ); + keys.hardlight( 0xCACFC2 ); + add( keys ); - danger = new DangerIndicator(); - add( danger ); + danger = new DangerIndicator(); + add( danger ); - buffs = new BuffIndicator( Dungeon.hero ); - add( buffs ); - } + buffs = new BuffIndicator( Dungeon.hero ); + add( buffs ); + } - @Override - protected void layout() { + @Override + protected void layout() { - height = 32; + height = 32; - shield.size( width, shield.height ); + shield.size( width, shield.height ); - avatar.x = PixelScene.align( camera(), shield.x + 15 - avatar.width / 2 ); - avatar.y = PixelScene.align( camera(), shield.y + 16 - avatar.height / 2 ); + avatar.x = PixelScene.align( camera(), shield.x + 15 - avatar.width / 2 ); + avatar.y = PixelScene.align( camera(), shield.y + 16 - avatar.height / 2 ); - compass.x = avatar.x + avatar.width / 2 - compass.origin.x; - compass.y = avatar.y + avatar.height / 2 - compass.origin.y; + compass.x = avatar.x + avatar.width / 2 - compass.origin.x; + compass.y = avatar.y + avatar.height / 2 - compass.origin.y; - hp.x = 30; - hp.y = 3; + hp.x = 30; + hp.y = 3; - depth.x = width - 24 - depth.width() - 18; - depth.y = 6; + depth.x = width - 24 - depth.width() - 18; + depth.y = 6; - keys.y = 6; + keys.y = 6; - danger.setPos( width - danger.width(), 18 ); + danger.setPos( width - danger.width(), 18 ); - buffs.setPos( 31, 9 ); + buffs.setPos( 31, 9 ); - btnMenu.setPos( width - btnMenu.width(), 1 ); - } + btnMenu.setPos( width - btnMenu.width(), 1 ); + } - @Override - public void update() { - super.update(); + @Override + public void update() { + super.update(); - float health = (float)Dungeon.hero.HP / Dungeon.hero.HT; + float health = (float)Dungeon.hero.HP / Dungeon.hero.HT; - if (health == 0) { - avatar.tint( 0x000000, 0.6f ); - blood.on = false; - } else if (health < 0.25f) { - avatar.tint( 0xcc0000, 0.4f ); - blood.on = true; - } else { - avatar.resetColor(); - blood.on = false; - } + if (health == 0) { + avatar.tint( 0x000000, 0.6f ); + blood.on = false; + } else if (health < 0.25f) { + avatar.tint( 0xcc0000, 0.4f ); + blood.on = true; + } else { + avatar.resetColor(); + blood.on = false; + } - hp.scale.x = health; - exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp(); + hp.scale.x = health; + exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp(); - if (Dungeon.hero.lvl != lastLvl) { + if (Dungeon.hero.lvl != lastLvl) { - if (lastLvl != -1) { - Emitter emitter = (Emitter)recycle( Emitter.class ); - emitter.revive(); - emitter.pos( 27, 27 ); - emitter.burst( Speck.factory( Speck.STAR ), 12 ); - } + if (lastLvl != -1) { + Emitter emitter = (Emitter)recycle( Emitter.class ); + emitter.revive(); + emitter.pos( 27, 27 ); + emitter.burst( Speck.factory( Speck.STAR ), 12 ); + } - lastLvl = Dungeon.hero.lvl; - level.text( Integer.toString( lastLvl ) ); - level.measure(); - level.x = PixelScene.align( 27.0f - level.width() / 2 ); - level.y = PixelScene.align( 27.5f - level.baseLine() / 2 ); - } + lastLvl = Dungeon.hero.lvl; + level.text( Integer.toString( lastLvl ) ); + level.measure(); + level.x = PixelScene.align( 27.0f - level.width() / 2 ); + level.y = PixelScene.align( 27.5f - level.baseLine() / 2 ); + } - int k = IronKey.curDepthQuantity; - if (k != lastKeys) { - lastKeys = k; - keys.text( Integer.toString( lastKeys ) ); - keys.measure(); - keys.x = width - 8 - keys.width() - 18; - } + int k = IronKey.curDepthQuantity; + if (k != lastKeys) { + lastKeys = k; + keys.text( Integer.toString( lastKeys ) ); + keys.measure(); + keys.x = width - 8 - keys.width() - 18; + } - int tier = Dungeon.hero.tier(); - if (tier != lastTier) { - lastTier = tier; - avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) ); - } - } + int tier = Dungeon.hero.tier(); + if (tier != lastTier) { + lastTier = tier; + avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) ); + } + } - private static class MenuButton extends Button { + private static class MenuButton extends Button { - private Image image; + private Image image; - public MenuButton() { - super(); + public MenuButton() { + super(); - width = image.width + 4; - height = image.height + 4; - } + width = image.width + 4; + height = image.height + 4; + } - @Override - protected void createChildren() { - super.createChildren(); + @Override + protected void createChildren() { + super.createChildren(); - image = new Image( Assets.STATUS, 114, 3, 12, 11 ); - add( image ); - } + image = new Image( Assets.STATUS, 114, 3, 12, 11 ); + add( image ); + } - @Override - protected void layout() { - super.layout(); + @Override + protected void layout() { + super.layout(); - image.x = x + 2; - image.y = y + 2; - } + image.x = x + 2; + image.y = y + 2; + } - @Override - protected void onTouchDown() { - image.brightness( 1.5f ); - Sample.INSTANCE.play( Assets.SND_CLICK ); - } + @Override + protected void onTouchDown() { + image.brightness( 1.5f ); + Sample.INSTANCE.play( Assets.SND_CLICK ); + } - @Override - protected void onTouchUp() { - image.resetColor(); - } + @Override + protected void onTouchUp() { + image.resetColor(); + } - @Override - protected void onClick() { - GameScene.show( new WndGame() ); - } - } + @Override + protected void onClick() { + GameScene.show( new WndGame() ); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java index c89f7cbeb..c46c899fc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java @@ -66,7 +66,7 @@ public class Toast extends Component { bg.y = y; bg.size( width, height ); - close.setPos( + close.setPos( bg.x + bg.width() - bg.marginHor() / 2 - MARGIN_HOR - close.width(), y + (height - close.height()) / 2 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index 453ac31d9..fe102e361 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -184,8 +184,8 @@ public class Toolbar extends Component { } public void pickup( Item item ) { - pickedUp.reset( item, - btnInventory.centerX(), + pickedUp.reset( item, + btnInventory.centerX(), btnInventory.centerY() ); } @@ -240,7 +240,7 @@ public class Toolbar extends Component { } GameScene.show( new WndInfoCell( cell ) ); - } + } @Override public String prompt() { return "Select a cell to examine"; @@ -342,16 +342,16 @@ public class Toolbar extends Component { originToCenter(); - active = - visible = + active = + visible = false; } public void reset( Item item, float dstX, float dstY ) { view( item ); - active = - visible = + active = + visible = true; this.dstX = dstX - ItemSprite.SIZE / 2; @@ -369,13 +369,13 @@ public class Toolbar extends Component { if ((left -= Game.elapsed) <= 0) { - visible = - active = + visible = + active = false; if (emitter != null) emitter.on = false; } else { - float p = left / DURATION; + float p = left / DURATION; scale.set( (float)Math.sqrt( p ) ); float offset = DISTANCE * p; x = dstX - offset; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java index 2028c2869..5f9f699af 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Window.java @@ -39,11 +39,11 @@ public class Window extends Group implements Signal.Listener { protected int height; protected TouchArea blocker; - protected ShadowBox shadow; - protected NinePatch chrome; + protected ShadowBox shadow; + protected NinePatch chrome; public static final int TITLE_COLOR = 0xFFFF44; - public static final int SHPX_COLOR = 0x33BB33; + public static final int SHPX_COLOR = 0x33BB33; public Window() { this( 0, 0, Chrome.get( Chrome.Type.WINDOW ) ); @@ -59,8 +59,8 @@ public class Window extends Group implements Signal.Listener { blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) { @Override protected void onClick( Touch touch ) { - if (!Window.this.chrome.overlapsScreenPoint( - (int)touch.current.x, + if (!Window.this.chrome.overlapsScreenPoint( + (int)touch.current.x, (int)touch.current.y )) { onBackPressed(); @@ -75,22 +75,22 @@ public class Window extends Group implements Signal.Listener { this.width = width; this.height = height; - shadow = new ShadowBox(); - shadow.am = 0.5f; - shadow.camera = PixelScene.uiCamera.visible ? - PixelScene.uiCamera : Camera.main; - add( shadow ); + shadow = new ShadowBox(); + shadow.am = 0.5f; + shadow.camera = PixelScene.uiCamera.visible ? + PixelScene.uiCamera : Camera.main; + add( shadow ); chrome.x = -chrome.marginLeft(); chrome.y = -chrome.marginTop(); - chrome.size( + chrome.size( width - chrome.x + chrome.marginRight(), height - chrome.y + chrome.marginBottom() ); add( chrome ); - camera = new Camera( 0, 0, - (int)chrome.width, - (int)chrome.height, + camera = new Camera( 0, 0, + (int)chrome.width, + (int)chrome.height, PixelScene.defaultZoom ); camera.x = (int)(Game.width - camera.width * camera.zoom) / 2; camera.y = (int)(Game.height - camera.height * camera.zoom) / 2; @@ -109,7 +109,7 @@ public class Window extends Group implements Signal.Listener { this.width = w; this.height = h; - chrome.size( + chrome.size( width + chrome.marginHor(), height + chrome.marginVer() ); @@ -138,10 +138,10 @@ public class Window extends Group implements Signal.Listener { if (key.pressed) { switch (key.code) { case Keys.BACK: - onBackPressed(); + onBackPressed(); break; case Keys.MENU: - onMenuPressed(); + onMenuPressed(); break; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java index 03242748a..ad7f4dea9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java @@ -41,13 +41,13 @@ public class IconTitle extends Component { public IconTitle() { super(); - } + } - public IconTitle( Item item ) { - ItemSprite icon = new ItemSprite(); - icon( icon ); - label( Utils.capitalize( item.toString() ) ); - icon.view( item ); + public IconTitle( Item item ) { + ItemSprite icon = new ItemSprite(); + icon( icon ); + label( Utils.capitalize( item.toString() ) ); + icon.view( item ); } public IconTitle( Image icon, String label ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java index d897cfe30..057658407 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java @@ -54,7 +54,7 @@ public class WndBadge extends Window { line.y = PixelScene.align( pos ); add( line ); - pos += line.height(); + pos += line.height(); } resize( (int)w, (int)(pos + MARGIN) ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java index 21406394c..50c46c84e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java @@ -65,7 +65,7 @@ public class WndBag extends WndTabbed { ENCHANTABLE, WAND, SEED, - FOOD, + FOOD, POTION, SCROLL, EQUIPMENT @@ -123,8 +123,8 @@ public class WndBag extends WndTabbed { Belongings stuff = Dungeon.hero.belongings; Bag[] bags = { - stuff.backpack, - stuff.getItem( SeedPouch.class ), + stuff.backpack, + stuff.getItem( SeedPouch.class ), stuff.getItem( ScrollHolder.class ), stuff.getItem( PotionBandolier.class ), stuff.getItem( WandHolster.class )}; @@ -142,7 +142,7 @@ public class WndBag extends WndTabbed { public static WndBag lastBag( Listener listener, Mode mode, String title ) { - if (mode == lastMode && lastBag != null && + if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); @@ -287,7 +287,7 @@ public class WndBag extends WndTabbed { } } - private static class Placeholder extends Item { + private static class Placeholder extends Item { { name = null; } @@ -328,7 +328,7 @@ public class WndBag extends WndTabbed { } @Override - protected void createChildren() { + protected void createChildren() { bg = new ColorBlock( SLOT_SIZE, SLOT_SIZE, NORMAL ); add( bg ); @@ -361,9 +361,9 @@ public class WndBag extends WndTabbed { if (item.name() == null) { enable( false ); } else { - enable( + enable( mode == Mode.FOR_SALE && (item.price() > 0) && (!item.isEquipped( Dungeon.hero ) || !item.cursed) || - mode == Mode.UPGRADEABLE && item.isUpgradable() || + mode == Mode.UPGRADEABLE && item.isUpgradable() || mode == Mode.UNIDENTIFED && !item.isIdentified() || mode == Mode.QUICKSLOT && (item.defaultAction != null) || mode == Mode.WEAPON && (item instanceof MeleeWeapon || item instanceof Boomerang) || @@ -371,7 +371,7 @@ public class WndBag extends WndTabbed { mode == Mode.ENCHANTABLE && (item instanceof MeleeWeapon || item instanceof Boomerang || item instanceof Armor) || mode == Mode.WAND && (item instanceof Wand) || mode == Mode.SEED && (item instanceof Seed) || - mode == Mode.FOOD && (item instanceof Food) || + mode == Mode.FOOD && (item instanceof Food) || mode == Mode.POTION && (item instanceof Potion) || mode == Mode.SCROLL && (item instanceof Scroll) || mode == Mode.EQUIPMENT && (item instanceof EquipableItem) || diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java index dfd5ee665..8ed84a9b2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java @@ -159,7 +159,7 @@ public class WndBlacksmith extends Window { protected void onClick() {}; @Override - protected void layout() { + protected void layout() { super.layout(); bg.x = x; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java index 129146933..ff6730818 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java @@ -28,64 +28,64 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window; public class WndChallenges extends Window { - private static final int WIDTH = 108; + private static final int WIDTH = 108; private static final int TTL_HEIGHT = 12; private static final int BTN_HEIGHT = 18; private static final int GAP = 1; - private static final String TITLE = "Challenges"; + private static final String TITLE = "Challenges"; - private boolean editable; - private ArrayList boxes; + private boolean editable; + private ArrayList boxes; - public WndChallenges( int checked, boolean editable ) { + public WndChallenges( int checked, boolean editable ) { - super(); + super(); - this.editable = editable; + this.editable = editable; - BitmapText title = PixelScene.createText( TITLE, 9 ); - title.hardlight( TITLE_COLOR ); - title.measure(); - title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 ); - title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 ); - add( title ); + BitmapText title = PixelScene.createText( TITLE, 9 ); + title.hardlight( TITLE_COLOR ); + title.measure(); + title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 ); + title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 ); + add( title ); - boxes = new ArrayList(); + boxes = new ArrayList(); - float pos = TTL_HEIGHT; - for (int i=0; i < Challenges.NAMES.length; i++) { + float pos = TTL_HEIGHT; + for (int i=0; i < Challenges.NAMES.length; i++) { - CheckBox cb = new CheckBox( Challenges.NAMES[i] ); - cb.checked( (checked & Challenges.MASKS[i]) != 0 ); - cb.active = editable; + CheckBox cb = new CheckBox( Challenges.NAMES[i] ); + cb.checked( (checked & Challenges.MASKS[i]) != 0 ); + cb.active = editable; - if (i > 0) { - pos += GAP; - } - cb.setRect( 0, pos, WIDTH, BTN_HEIGHT ); - pos = cb.bottom(); + if (i > 0) { + pos += GAP; + } + cb.setRect( 0, pos, WIDTH, BTN_HEIGHT ); + pos = cb.bottom(); - add( cb ); - boxes.add( cb ); - } + add( cb ); + boxes.add( cb ); + } - resize( WIDTH, (int)pos ); - } + resize( WIDTH, (int)pos ); + } - @Override - public void onBackPressed() { + @Override + public void onBackPressed() { - if (editable) { - int value = 0; - for (int i=0; i < boxes.size(); i++) { - if (boxes.get( i ).checked()) { - value |= Challenges.MASKS[i]; - } - } - ShatteredPixelDungeon.challenges( value ); - } + if (editable) { + int value = 0; + for (int i=0; i < boxes.size(); i++) { + if (boxes.get( i ).checked()) { + value |= Challenges.MASKS[i]; + } + } + ShatteredPixelDungeon.challenges( value ); + } - super.onBackPressed(); - } + super.onBackPressed(); + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java index 59aca3669..fe0eda818 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndClass.java @@ -28,173 +28,173 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; public class WndClass extends WndTabbed { - private static final String TXT_MASTERY = "Mastery"; + private static final String TXT_MASTERY = "Mastery"; - private static final int WIDTH = 110; + private static final int WIDTH = 110; - private static final int TAB_WIDTH = 50; + private static final int TAB_WIDTH = 50; - private HeroClass cl; + private HeroClass cl; - private PerksTab tabPerks; - private MasteryTab tabMastery; + private PerksTab tabPerks; + private MasteryTab tabMastery; - public WndClass( HeroClass cl ) { + public WndClass( HeroClass cl ) { - super(); + super(); - this.cl = cl; + this.cl = cl; - tabPerks = new PerksTab(); - add( tabPerks ); + tabPerks = new PerksTab(); + add( tabPerks ); - Tab tab = new RankingTab( Utils.capitalize( cl.title() ), tabPerks ); - tab.setSize( TAB_WIDTH, tabHeight() ); - add( tab ); + Tab tab = new RankingTab( Utils.capitalize( cl.title() ), tabPerks ); + tab.setSize( TAB_WIDTH, tabHeight() ); + add( tab ); - if (Badges.isUnlocked( cl.masteryBadge() )) { - tabMastery = new MasteryTab(); - add( tabMastery ); + if (Badges.isUnlocked( cl.masteryBadge() )) { + tabMastery = new MasteryTab(); + add( tabMastery ); - tab = new RankingTab( TXT_MASTERY, tabMastery ); - add( tab ); + tab = new RankingTab( TXT_MASTERY, tabMastery ); + add( tab ); - resize( - (int)Math.max( tabPerks.width, tabMastery.width ), - (int)Math.max( tabPerks.height, tabMastery.height ) ); - } else { - resize( (int)tabPerks.width, (int)tabPerks.height ); - } + resize( + (int)Math.max( tabPerks.width, tabMastery.width ), + (int)Math.max( tabPerks.height, tabMastery.height ) ); + } else { + resize( (int)tabPerks.width, (int)tabPerks.height ); + } - layoutTabs(); + layoutTabs(); - select( 0 ); - } + select( 0 ); + } - private class RankingTab extends LabeledTab { + private class RankingTab extends LabeledTab { - private Group page; + private Group page; - public RankingTab( String label, Group page ) { - super( label ); - this.page = page; - } + public RankingTab( String label, Group page ) { + super( label ); + this.page = page; + } - @Override - protected void select( boolean value ) { - super.select( value ); - if (page != null) { - page.visible = page.active = selected; - } - } - } + @Override + protected void select( boolean value ) { + super.select( value ); + if (page != null) { + page.visible = page.active = selected; + } + } + } - private class PerksTab extends Group { + private class PerksTab extends Group { - private static final int MARGIN = 4; - private static final int GAP = 4; + private static final int MARGIN = 4; + private static final int GAP = 4; - private static final String DOT = "\u007F"; + private static final String DOT = "\u007F"; - public float height; - public float width; + public float height; + public float width; - public PerksTab() { - super(); + public PerksTab() { + super(); - float dotWidth = 0; + float dotWidth = 0; - String[] items = cl.perks(); - float pos = MARGIN; + String[] items = cl.perks(); + float pos = MARGIN; - for (int i=0; i < items.length; i++) { + for (int i=0; i < items.length; i++) { - if (i > 0) { - pos += GAP; - } + if (i > 0) { + pos += GAP; + } - BitmapText dot = PixelScene.createText( DOT, 6 ); - dot.x = MARGIN; - dot.y = pos; - if (dotWidth == 0) { - dot.measure(); - dotWidth = dot.width(); - } - add( dot ); + BitmapText dot = PixelScene.createText( DOT, 6 ); + dot.x = MARGIN; + dot.y = pos; + if (dotWidth == 0) { + dot.measure(); + dotWidth = dot.width(); + } + add( dot ); - BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 ); - item.x = dot.x + dotWidth; - item.y = pos; - item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth); - item.measure(); - add( item ); + BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 ); + item.x = dot.x + dotWidth; + item.y = pos; + item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth); + item.measure(); + add( item ); - pos += item.height(); - float w = item.width(); - if (w > width) { - width = w; - } - } + pos += item.height(); + float w = item.width(); + if (w > width) { + width = w; + } + } - width += MARGIN + dotWidth; - height = pos + MARGIN; - } - } + width += MARGIN + dotWidth; + height = pos + MARGIN; + } + } - private class MasteryTab extends Group { + private class MasteryTab extends Group { - private static final int MARGIN = 4; + private static final int MARGIN = 4; - private BitmapTextMultiline normal; - private BitmapTextMultiline highlighted; + private BitmapTextMultiline normal; + private BitmapTextMultiline highlighted; - public float height; - public float width; + public float height; + public float width; - public MasteryTab() { - super(); + public MasteryTab() { + super(); - String text = null; - switch (cl) { - case WARRIOR: - text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc(); - break; - case MAGE: - text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc(); - break; - case ROGUE: - text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc(); - break; - case HUNTRESS: - text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc(); - break; - } + String text = null; + switch (cl) { + case WARRIOR: + text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc(); + break; + case MAGE: + text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc(); + break; + case ROGUE: + text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc(); + break; + case HUNTRESS: + text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc(); + break; + } - Highlighter hl = new Highlighter( text ); + Highlighter hl = new Highlighter( text ); - normal = PixelScene.createMultiline( hl.text, 6 ); - normal.maxWidth = WIDTH - MARGIN * 2; - normal.measure(); - normal.x = MARGIN; - normal.y = MARGIN; - add( normal ); + normal = PixelScene.createMultiline( hl.text, 6 ); + normal.maxWidth = WIDTH - MARGIN * 2; + normal.measure(); + normal.x = MARGIN; + normal.y = MARGIN; + add( normal ); - if (hl.isHighlighted()) { - normal.mask = hl.inverted(); + if (hl.isHighlighted()) { + normal.mask = hl.inverted(); - highlighted = PixelScene.createMultiline( hl.text, 6 ); - highlighted.maxWidth = normal.maxWidth; - highlighted.measure(); - highlighted.x = normal.x; - highlighted.y = normal.y; - add( highlighted ); + highlighted = PixelScene.createMultiline( hl.text, 6 ); + highlighted.maxWidth = normal.maxWidth; + highlighted.measure(); + highlighted.x = normal.x; + highlighted.y = normal.y; + add( highlighted ); - highlighted.mask = hl.mask; - highlighted.hardlight( TITLE_COLOR ); - } + highlighted.mask = hl.mask; + highlighted.hardlight( TITLE_COLOR ); + } - height = normal.y + normal.height() + MARGIN; - width = normal.x + normal.width() + MARGIN; - } - } + height = normal.y + normal.height() + MARGIN; + width = normal.x + normal.width() + MARGIN; + } + } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java index 00d0f3cba..2cc8f116a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java @@ -33,7 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window; public class WndGame extends Window { private static final String TXT_SETTINGS = "Settings"; - private static final String TXT_CHALLEGES = "Challenges"; + private static final String TXT_CHALLEGES = "Challenges"; private static final String TXT_RANKINGS = "Rankings"; private static final String TXT_START = "Start New Game"; private static final String TXT_MENU = "Main Menu"; @@ -58,26 +58,26 @@ public class WndGame extends Window { } } ); - // Challenges window - if (Dungeon.challenges > 0) { - addButton( new RedButton( TXT_CHALLEGES ) { - @Override - protected void onClick() { - hide(); - GameScene.show( new WndChallenges( Dungeon.challenges, false ) ); - } - } ); - } + // Challenges window + if (Dungeon.challenges > 0) { + addButton( new RedButton( TXT_CHALLEGES ) { + @Override + protected void onClick() { + hide(); + GameScene.show( new WndChallenges( Dungeon.challenges, false ) ); + } + } ); + } - // Restart - if (!Dungeon.hero.isAlive()) { + // Restart + if (!Dungeon.hero.isAlive()) { RedButton btnStart; addButton( btnStart = new RedButton( TXT_START ) { @Override protected void onClick() { Dungeon.hero = null; - ShatteredPixelDungeon.challenges( Dungeon.challenges ); + ShatteredPixelDungeon.challenges( Dungeon.challenges ); InterlevelScene.mode = InterlevelScene.Mode.DESCEND; InterlevelScene.noStory = true; Game.switchScene( InterlevelScene.class ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java index 491bfa3b6..8e51b2011 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java @@ -106,11 +106,11 @@ public class WndHero extends WndTabbed { Hero hero = Dungeon.hero; - IconTitle title = new IconTitle(); - title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) ); - title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9); - title.color(Window.SHPX_COLOR); - title.setRect( 0, 0, WIDTH, 0 ); + IconTitle title = new IconTitle(); + title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) ); + title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9); + title.color(Window.SHPX_COLOR); + title.setRect( 0, 0, WIDTH, 0 ); add(title); RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java index a1a0c5af3..1907881c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java @@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; public class WndImp extends Window { - private static final String TXT_MESSAGE = + private static final String TXT_MESSAGE = "Oh yes! You are my hero!\n" + "Regarding your reward, I don't have cash with me right now, but I have something better for you. " + "This is my family heirloom ring: my granddad took it off a dead paladin's finger."; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java index d7e47ece8..876464e10 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java @@ -11,9 +11,6 @@ import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Image; import com.watabou.noosa.TextureFilm; -/** - * Created by debenhame on 06/04/2015. - */ public class WndInfoBuff extends Window { private static final float GAP = 2; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java index 334b3ae9c..105567909 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java @@ -37,16 +37,16 @@ public class WndInfoItem extends Window { private static final String TTL_CRYSTAL_CHEST = "Crystal chest"; private static final String TTL_TOMB = "Tomb"; private static final String TTL_SKELETON = "Skeletal remains"; - private static final String TTL_REMAINS = "Heroes remains"; + private static final String TTL_REMAINS = "Heroes remains"; private static final String TXT_WONT_KNOW = "You won't know what's inside until you open it!"; private static final String TXT_NEED_KEY = TXT_WONT_KNOW + " But to open it you need a golden key."; private static final String TXT_INSIDE = "You can see %s inside, but to open the chest you need a golden key."; - private static final String TXT_OWNER = + private static final String TXT_OWNER = "This ancient tomb may contain something useful, " + "but its owner will most certainly object to checking."; - private static final String TXT_SKELETON = - "This is all that's left of some unfortunate adventurer. " + - "Maybe it's worth checking for any valuables."; + private static final String TXT_SKELETON = + "This is all that's left of some unfortunate adventurer. " + + "Maybe it's worth checking for any valuables."; private static final String TXT_REMAINS = "This is all that's left from one of your predecessors. " + "Maybe it's worth checking for any valuables."; @@ -65,9 +65,9 @@ public class WndInfoItem extends Window { int color = TITLE_COLOR; if (item.levelKnown && item.level > 0) { - color = ItemSlot.UPGRADED; + color = ItemSlot.UPGRADED; } else if (item.levelKnown && item.level < 0) { - color = ItemSlot.DEGRADED; + color = ItemSlot.DEGRADED; } fillFields( item.image(), item.glowing(), color, item.toString(), item.info() ); @@ -83,21 +83,21 @@ public class WndInfoItem extends Window { title = TTL_TOMB; info = TXT_OWNER; } else if (heap.type == Type.SKELETON) { - title = TTL_SKELETON; - info = TXT_SKELETON; - } else if (heap.type == Type.REMAINS) { - title = TTL_REMAINS; - info = TXT_REMAINS; + title = TTL_SKELETON; + info = TXT_SKELETON; + } else if (heap.type == Type.REMAINS) { + title = TTL_REMAINS; + info = TXT_REMAINS; } else if (heap.type == Type.CRYSTAL_CHEST) { title = TTL_CRYSTAL_CHEST; - if (heap.peek() instanceof Artifact) - info = Utils.format( TXT_INSIDE, "an artifact" ); - else if (heap.peek() instanceof Wand) - info = Utils.format( TXT_INSIDE, "a wand" ); - else if (heap.peek() instanceof Ring) - info = Utils.format( TXT_INSIDE, "a ring" ); + if (heap.peek() instanceof Artifact) + info = Utils.format( TXT_INSIDE, "an artifact" ); + else if (heap.peek() instanceof Wand) + info = Utils.format( TXT_INSIDE, "a wand" ); + else if (heap.peek() instanceof Ring) + info = Utils.format( TXT_INSIDE, "a ring" ); else - info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) ); + info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) ); } else { title = TTL_LOCKED_CHEST; info = TXT_NEED_KEY; @@ -114,9 +114,9 @@ public class WndInfoItem extends Window { int color = TITLE_COLOR; if (item.levelKnown && item.level > 0) { - color = ItemSlot.UPGRADED; + color = ItemSlot.UPGRADED; } else if (item.levelKnown && item.level < 0) { - color = ItemSlot.DEGRADED; + color = ItemSlot.DEGRADED; } fillFields( item.image(), item.glowing(), color, item.toString(), item.info() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java index 882266df0..d7ac0eeff 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java @@ -38,7 +38,7 @@ public class WndInfoMob extends WndTitledMessage { StringBuilder builder = new StringBuilder( mob.description() ); - builder.append( "\n\n" + mob.state.status() + "." ); + builder.append( "\n\n" + mob.state.status() + "." ); return builder.toString(); } @@ -56,7 +56,7 @@ public class WndInfoMob extends WndTitledMessage { name = PixelScene.createText( Utils.capitalize( mob.name ), 9 ); name.hardlight( TITLE_COLOR ); - name.measure(); + name.measure(); add( name ); image = mob.sprite(); @@ -83,7 +83,7 @@ public class WndInfoMob extends WndTitledMessage { health.setRect(image.width + GAP, image.height - health.height(), w, health.height()); - buffs.setPos( + buffs.setPos( name.x + name.width() + GAP-1, name.y + name.baseLine() - BuffIndicator.SIZE-2 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java index fd16aa7ac..fb4bc803d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java @@ -36,7 +36,7 @@ public class WndItem extends Window { private static final int WIDTH = 120; - public WndItem( final WndBag owner, final Item item ) { + public WndItem( final WndBag owner, final Item item ) { super(); @@ -48,7 +48,7 @@ public class WndItem extends Window { titlebar.color( ItemSlot.UPGRADED ); } else if (item.levelKnown && item.level < 0) { titlebar.color( ItemSlot.DEGRADED ); - } + } BitmapTextMultiline info = PixelScene.createMultiline( item.info(), 6 ); info.maxWidth = WIDTH; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java index 15a5b97dd..8164d3743 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java @@ -38,8 +38,8 @@ public class WndMessage extends Window { info.x = info.y = MARGIN; add( info ); - resize( - (int)info.width() + MARGIN * 2, + resize( + (int)info.width() + MARGIN * 2, (int)info.height() + MARGIN * 2 ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java index 55c7ea8f6..d3d9c17c7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndQuest.java @@ -22,7 +22,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; public class WndQuest extends WndTitledMessage { - public WndQuest( NPC questgiver, String text ) { - super( questgiver.sprite(), Utils.capitalize( questgiver.name ), text ); - } + public WndQuest( NPC questgiver, String text ) { + super( questgiver.sprite(), Utils.capitalize( questgiver.name ), text ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java index 5dd6d0480..cf91fc0a7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java @@ -79,7 +79,7 @@ public class WndRanking extends WndTabbed { }; thread.start(); - busy = Icons.BUSY.get(); + busy = Icons.BUSY.get(); busy.origin.set( busy.width / 2, busy.height / 2 ); busy.angularSpeed = 720; busy.x = (WIDTH - busy.width) / 2; @@ -105,9 +105,9 @@ public class WndRanking extends WndTabbed { private void createControls() { - String[] labels = + String[] labels = {TXT_STATS, TXT_ITEMS, TXT_BADGES}; - Group[] pages = + Group[] pages = {new StatsTab(), new ItemsTab(), new BadgesTab()}; for (int i=0; i < pages.length; i++) { @@ -145,9 +145,9 @@ public class WndRanking extends WndTabbed { private static final int GAP = 4; - private static final String TXT_TITLE = "Level %d %s"; + private static final String TXT_TITLE = "Level %d %s"; - private static final String TXT_CHALLENGES = "Challenges"; + private static final String TXT_CHALLENGES = "Challenges"; private static final String TXT_HEALTH = "Health"; private static final String TXT_STR = "Strength"; @@ -170,26 +170,26 @@ public class WndRanking extends WndTabbed { IconTitle title = new IconTitle(); title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) ); title.label( Utils.format( TXT_TITLE, Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) ); - title.color(Window.SHPX_COLOR); + title.color(Window.SHPX_COLOR); title.setRect( 0, 0, WIDTH, 0 ); add( title ); float pos = title.bottom(); - if (Dungeon.challenges > 0) { - RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) { - @Override - protected void onClick() { - Game.scene().add( new WndChallenges( Dungeon.challenges, false ) ); - } - }; - btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 ); - add( btnCatalogus ); + if (Dungeon.challenges > 0) { + RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) { + @Override + protected void onClick() { + Game.scene().add( new WndChallenges( Dungeon.challenges, false ) ); + } + }; + btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 ); + add( btnCatalogus ); - pos = btnCatalogus.bottom(); - } + pos = btnCatalogus.bottom(); + } - pos += GAP + GAP; + pos += GAP + GAP; pos = statSlot( this, TXT_STR, Integer.toString( Dungeon.hero.STR ), pos ); pos = statSlot( this, TXT_HEALTH, Integer.toString( Dungeon.hero.HT ), pos ); @@ -317,7 +317,7 @@ public class WndRanking extends WndTabbed { } @Override - protected void createChildren() { + protected void createChildren() { bg = new ColorBlock( HEIGHT, HEIGHT, 0xFF4A4D44 ); add( bg ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java index 88e247b13..efd2a135f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java @@ -33,20 +33,20 @@ import com.watabou.noosa.BitmapTextMultiline; public class WndSadGhost extends Window { - private static final String TXT_RAT = + private static final String TXT_RAT = "Thank you, that horrid rat is slain and I can finally rest..." + - "I wonder what twisted magic created such a foul creature...\n\n"; - private static final String TXT_GNOLL = - "Thank you, that scheming gnoll is slain and I can finally rest..." + - "I wonder what twisted magic made it so smart...\n\n"; - private static final String TXT_CRAB = - "Thank you, that giant crab is slain and I can finally rest..." + - "I wonder what twisted magic allowed it to live so long...\n\n"; - private static final String TXT_GIVEITEM= - "Please take one of these items, they are useless to me now... " + - "Maybe they will help you in your journey...\n\n" + - "Also... There is an item lost in this dungeon that is very dear to me..." + - "If you ever... find my... rose......"; + "I wonder what twisted magic created such a foul creature...\n\n"; + private static final String TXT_GNOLL = + "Thank you, that scheming gnoll is slain and I can finally rest..." + + "I wonder what twisted magic made it so smart...\n\n"; + private static final String TXT_CRAB = + "Thank you, that giant crab is slain and I can finally rest..." + + "I wonder what twisted magic allowed it to live so long...\n\n"; + private static final String TXT_GIVEITEM= + "Please take one of these items, they are useless to me now... " + + "Maybe they will help you in your journey...\n\n" + + "Also... There is an item lost in this dungeon that is very dear to me..." + + "If you ever... find my... rose......"; private static final String TXT_WEAPON = "Ghost's weapon"; private static final String TXT_ARMOR = "Ghost's armor"; @@ -59,25 +59,25 @@ public class WndSadGhost extends Window { super(); IconTitle titlebar = new IconTitle(); - BitmapTextMultiline message; - switch (type){ - case 1:default: - titlebar.icon( new FetidRatSprite() ); - titlebar.label( "DEFEATED FETID RAT" ); - message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 ); - break; - case 2: - titlebar.icon( new GnollTricksterSprite() ); - titlebar.label( "DEFEATED GNOLL TRICKSTER" ); - message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 ); - break; - case 3: - titlebar.icon( new GreatCrabSprite()); - titlebar.label( "DEFEATED GREAT CRAB" ); - message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 ); - break; + BitmapTextMultiline message; + switch (type){ + case 1:default: + titlebar.icon( new FetidRatSprite() ); + titlebar.label( "DEFEATED FETID RAT" ); + message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 ); + break; + case 2: + titlebar.icon( new GnollTricksterSprite() ); + titlebar.label( "DEFEATED GNOLL TRICKSTER" ); + message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 ); + break; + case 3: + titlebar.icon( new GreatCrabSprite()); + titlebar.label( "DEFEATED GREAT CRAB" ); + message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 ); + break; - } + } titlebar.setRect( 0, 0, WIDTH, 0 ); @@ -97,20 +97,20 @@ public class WndSadGhost extends Window { btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnWeapon ); - if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) { - RedButton btnArmor = new RedButton(TXT_ARMOR) { - @Override - protected void onClick() { - selectReward(ghost, Ghost.Quest.armor); - } - }; - btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT); - add(btnArmor); + if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) { + RedButton btnArmor = new RedButton(TXT_ARMOR) { + @Override + protected void onClick() { + selectReward(ghost, Ghost.Quest.armor); + } + }; + btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT); + add(btnArmor); - resize(WIDTH, (int) btnArmor.bottom()); - } else { - resize(WIDTH, (int) btnWeapon.bottom()); - } + resize(WIDTH, (int) btnArmor.bottom()); + } else { + resize(WIDTH, (int) btnWeapon.bottom()); + } } private void selectReward( Ghost ghost, Item reward ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index 35e8919c9..5bb5ea506 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -34,7 +34,7 @@ public class WndSettings extends Window { private static final String TXT_ZOOM_DEFAULT = "Default Zoom"; private static final String TXT_SCALE_UP = "Scale up UI"; - private static final String TXT_IMMERSIVE = "Immersive mode"; + private static final String TXT_IMMERSIVE = "Immersive mode"; private static final String TXT_MUSIC = "Music"; @@ -57,7 +57,7 @@ public class WndSettings extends Window { public WndSettings( boolean inGame ) { super(); - CheckBox btnImmersive = null; + CheckBox btnImmersive = null; if (inGame) { int w = BTN_HEIGHT; @@ -101,19 +101,19 @@ public class WndSettings extends Window { btnScaleUp.checked( ShatteredPixelDungeon.scaleUp() ); add( btnScaleUp ); - btnImmersive = new CheckBox( TXT_IMMERSIVE ) { - @Override - protected void onClick() { - super.onClick(); - ShatteredPixelDungeon.immerse( checked() ); - } - }; - btnImmersive.setRect( 0, btnScaleUp.bottom() + GAP, WIDTH, BTN_HEIGHT ); - btnImmersive.checked( ShatteredPixelDungeon.immersed() ); - btnImmersive.enable( android.os.Build.VERSION.SDK_INT >= 19 ); - add( btnImmersive ); + btnImmersive = new CheckBox( TXT_IMMERSIVE ) { + @Override + protected void onClick() { + super.onClick(); + ShatteredPixelDungeon.immerse( checked() ); + } + }; + btnImmersive.setRect( 0, btnScaleUp.bottom() + GAP, WIDTH, BTN_HEIGHT ); + btnImmersive.checked( ShatteredPixelDungeon.immersed() ); + btnImmersive.enable( android.os.Build.VERSION.SDK_INT >= 19 ); + add( btnImmersive ); - } + } CheckBox btnMusic = new CheckBox( TXT_MUSIC ) { @Override @@ -122,7 +122,7 @@ public class WndSettings extends Window { ShatteredPixelDungeon.music(checked()); } }; - btnMusic.setRect( 0, (btnImmersive != null ? btnImmersive.bottom() : BTN_HEIGHT) + GAP, WIDTH, BTN_HEIGHT ); + btnMusic.setRect( 0, (btnImmersive != null ? btnImmersive.bottom() : BTN_HEIGHT) + GAP, WIDTH, BTN_HEIGHT ); btnMusic.checked( ShatteredPixelDungeon.music() ); add( btnMusic ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java index d01cf4709..000501b4c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java @@ -31,8 +31,8 @@ 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_L = 144; + private static final int MARGIN = 6; private static final float bgR = 0.77f; private static final float bgG = 0.73f; @@ -47,25 +47,25 @@ public class WndStory extends Window { private static final SparseArray CHAPTERS = new SparseArray(); static { - CHAPTERS.put( ID_SEWERS, + CHAPTERS.put( ID_SEWERS, "The Dungeon lies right beneath the City, its upper levels actually constitute the City's sewer system.\n\n " + - "As dark energy has crept up from below the usually harmless sewer creatures have become more and more " + - "dangerous. The city sends guard patrols down here to try and maintain safety for those above, but " + - "they are slowly failing.\n\n This place is dangerous, but at least the evil magic at work here is weak." ); + "As dark energy has crept up from below the usually harmless sewer creatures have become more and more " + + "dangerous. The city sends guard patrols down here to try and maintain safety for those above, but " + + "they are slowly failing.\n\n This place is dangerous, but at least the evil magic at work here is weak." ); - CHAPTERS.put( ID_PRISON, + CHAPTERS.put( ID_PRISON, "Many years ago an underground prison was built here for the most dangerous criminals. At the time it seemed " + "like a very clever idea, because this place indeed was very hard to escape. But soon dark miasma started to permeate " + "from below, driving prisoners and guards insane. In the end the prison was abandoned, though some convicts " + "were left locked up here." ); - CHAPTERS.put( ID_CAVES, + CHAPTERS.put( ID_CAVES, "The caves, which stretch down under the abandoned prison, are sparcely populated. They lie too deep to be exploited " + "by the City and they are too poor in minerals to interest the dwarves. In the past there was a trade outpost " + "somewhere here on the route between these two states, but it has perished since the decline of Dwarven Metropolis. " + "Only omnipresent gnolls and subterranean animals dwell here now." ); - CHAPTERS.put( ID_METROPOLIS, + CHAPTERS.put( ID_METROPOLIS, "Dwarven Metropolis was once the greatest of dwarven city-states. In its heyday the mechanized army of dwarves " + "has successfully repelled the invasion of the old god and his demon army. But it is said, that the returning warriors " + "have brought seeds of corruption with them, and that victory was the beginning of the end for the underground kingdom." ); @@ -86,8 +86,8 @@ public class WndStory extends Window { tf = PixelScene.createMultiline( text, 7 ); tf.maxWidth = ShatteredPixelDungeon.landscape() ? - WIDTH_L - MARGIN * 2: - WIDTH_P - MARGIN *2; + WIDTH_L - MARGIN * 2: + WIDTH_P - MARGIN *2; tf.measure(); tf.ra = bgR; tf.ga = bgG; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTabbed.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTabbed.java index 30f43a2d9..23dc6f13f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTabbed.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTabbed.java @@ -40,7 +40,7 @@ public class WndTabbed extends Window { protected Tab add( Tab tab ) { - tab.setPos( tabs.size() == 0 ? + tab.setPos( tabs.size() == 0 ? -chrome.marginLeft() + 1 : tabs.get( tabs.size() - 1 ).right(), height ); tab.select( false ); @@ -75,7 +75,7 @@ public class WndTabbed extends Window { this.width = w; this.height = h; - chrome.size( + chrome.size( width + chrome.marginHor(), height + chrome.marginVer() ); @@ -102,7 +102,7 @@ public class WndTabbed extends Window { } public void layoutTabs(){ - //subract two as there's extra horizontal space for those nobs on the top. + //subract two as there's extra horizontal space for those nobs on the top. int fullWidth = width+chrome.marginHor()-2; int numTabs = tabs.size(); @@ -172,8 +172,8 @@ public class WndTabbed extends Window { remove( bg ); } - bg = Chrome.get( selected ? - Chrome.Type.TAB_SELECTED : + bg = Chrome.get( selected ? + Chrome.Type.TAB_SELECTED : Chrome.Type.TAB_UNSELECTED ); addToBack( bg ); @@ -181,7 +181,7 @@ public class WndTabbed extends Window { } @Override - protected void onClick() { + protected void onClick() { Sample.INSTANCE.play( Assets.SND_CLICK, 0.7f, 0.7f, 1.2f ); WndTabbed.this.onClick( this ); } @@ -223,6 +223,6 @@ public class WndTabbed extends Window { super.select( value ); btLabel.am = selected ? 1.0f : 0.6f; } - } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java index 4988b9078..b9c66abe3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java @@ -43,7 +43,7 @@ public class WndTradeItem extends Window { private static final String TXT_SALE = "FOR SALE: %s - %dg"; private static final String TXT_BUY = "Buy for %dg"; - private static final String TXT_STEAL = "Steal with %d%% chance"; + private static final String TXT_STEAL = "Steal with %d%% chance"; private static final String TXT_SELL = "Sell for %dg"; private static final String TXT_SELL_1 = "Sell 1 for %dg"; private static final String TXT_SELL_ALL = "Sell all for %dg"; @@ -51,7 +51,7 @@ public class WndTradeItem extends Window { private static final String TXT_SOLD = "You've sold your %s for %dg"; private static final String TXT_BOUGHT = "You've bought %s for %dg"; - private static final String TXT_STOLE = "You've stolen the %s"; + private static final String TXT_STOLE = "You've stolen the %s"; private WndBag owner; @@ -59,7 +59,7 @@ public class WndTradeItem extends Window { super(); - this.owner = owner; + this.owner = owner; float pos = createDescription( item, false ); @@ -138,46 +138,46 @@ public class WndTradeItem extends Window { btnBuy.enable( price <= Dungeon.gold ); add( btnBuy ); - RedButton btnCancel = new RedButton( TXT_CANCEL ) { - @Override - protected void onClick() { - hide(); - } - }; + RedButton btnCancel = new RedButton( TXT_CANCEL ) { + @Override + protected void onClick() { + hide(); + } + }; - final MasterThievesArmband.Thievery thievery = Dungeon.hero.buff(MasterThievesArmband.Thievery.class); - if (thievery != null) { - final float chance = thievery.stealChance(price); - RedButton btnSteal = new RedButton(Utils.format(TXT_STEAL, Math.min(100, (int)(chance*100)))) { - @Override - protected void onClick() { - if(thievery.steal(price)){ - Hero hero = Dungeon.hero; - Item item = heap.pickUp(); - GLog.i( TXT_STOLE, item.name()); - hide(); + final MasterThievesArmband.Thievery thievery = Dungeon.hero.buff(MasterThievesArmband.Thievery.class); + if (thievery != null) { + final float chance = thievery.stealChance(price); + RedButton btnSteal = new RedButton(Utils.format(TXT_STEAL, Math.min(100, (int)(chance*100)))) { + @Override + protected void onClick() { + if(thievery.steal(price)){ + Hero hero = Dungeon.hero; + Item item = heap.pickUp(); + GLog.i( TXT_STOLE, item.name()); + hide(); - if (!item.doPickUp( hero )) { - Dungeon.level.drop( item, heap.pos ).sprite.drop(); - } - } else { - for (Mob mob : Dungeon.level.mobs){ - if (mob instanceof Shopkeeper) { - mob.yell(((Shopkeeper) mob).TXT_THIEF); - ((Shopkeeper) mob).flee(); - break; - } - } - hide(); - } - } - }; - btnSteal.setRect(0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT); - add(btnSteal); + if (!item.doPickUp( hero )) { + Dungeon.level.drop( item, heap.pos ).sprite.drop(); + } + } else { + for (Mob mob : Dungeon.level.mobs){ + if (mob instanceof Shopkeeper) { + mob.yell(((Shopkeeper) mob).TXT_THIEF); + ((Shopkeeper) mob).flee(); + break; + } + } + hide(); + } + } + }; + btnSteal.setRect(0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT); + add(btnSteal); - btnCancel.setRect( 0, btnSteal.bottom() + GAP, WIDTH, BTN_HEIGHT ); - } else - btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT ); + btnCancel.setRect( 0, btnSteal.bottom() + GAP, WIDTH, BTN_HEIGHT ); + } else + btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT ); add( btnCancel ); @@ -206,17 +206,17 @@ public class WndTradeItem extends Window { // Title IconTitle titlebar = new IconTitle(); titlebar.icon( new ItemSprite( item ) ); - titlebar.label( forSale ? - Utils.format( TXT_SALE, item.toString(), price( item ) ) : + titlebar.label( forSale ? + Utils.format( TXT_SALE, item.toString(), price( item ) ) : Utils.capitalize( item.toString() ) ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); // Upgraded / degraded if (item.levelKnown && item.level > 0) { - titlebar.color( ItemSlot.UPGRADED ); + titlebar.color( ItemSlot.UPGRADED ); } else if (item.levelKnown && item.level < 0) { - titlebar.color( ItemSlot.DEGRADED ); + titlebar.color( ItemSlot.DEGRADED ); } // Description diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java index a34eb3c10..f51921441 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java @@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; public class WndWandmaker extends Window { - private static final String TXT_MESSAGE = + private static final String TXT_MESSAGE = "Oh, I see you have succeeded! I do hope it hasn't troubled you too much. " + "As I promised, you can choose one of my high quality wands.";