Merge remote-tracking branch 'origin/master'

Conflicts:
	src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/ConfusionGas.java
This commit is contained in:
Evan Debenham 2014-10-30 20:00:53 -04:00
commit 9d19a785ba
22 changed files with 102 additions and 75 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -18,10 +18,9 @@
package com.shatteredpixel.shatteredpixeldungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlot;
import com.watabou.noosa.Game;
import com.watabou.utils.Bundle;
@ -44,11 +43,14 @@ public class Bones {
private static Item item;
public static void leave() {
item = pickItem(Dungeon.hero);
depth = Dungeon.depth;
depth = Dungeon.depth;
//heroes which have already won the game, or who die much higher than their deepest depth drop no bones.
if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth)
return;
item = pickItem(Dungeon.hero);
Bundle bundle = new Bundle();
bundle.put( LEVEL, depth );
@ -92,22 +94,26 @@ public class Bones {
ArrayList<Item> items = new ArrayList<Item>();
while (iterator.hasNext()){
curItem = iterator.next();
if (curItem.bones && !(curItem instanceof EquipableItem))
if (curItem.bones)
items.add(curItem);
}
if (!items.isEmpty()) {
if (Random.Int(3) < items.size()) {
item = Random.element(items);
if (item.stackable){
item.quantity((int)Math.sqrt(item.quantity()));
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 > 0) {
item = new Gold( Random.NormalIntRange( 1, Dungeon.gold ) );
if (Dungeon.gold > 50) {
item = new Gold( Random.NormalIntRange( 50, Dungeon.gold ) );
} else {
item = new Gold( 1 );
item = new Gold( 50 );
}
}
return item;
@ -139,7 +145,8 @@ public class Bones {
item.cursed = true;
item.cursedKnown = true;
if (item.isUpgradable()) {
int lvl = (Dungeon.depth - 1) * 3 / 5 + 1;
//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 );
}

View File

@ -33,8 +33,7 @@ public class ConfusionGas 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, Vertigo.class, 1 );
Buff.prolong( ch, Vertigo.class, 2 );
}
}
}

View File

@ -29,7 +29,7 @@ public class Drowsy extends Buff {
}
public boolean attachTo( Char target ) {
if (super.attachTo(target)) {
if (super.attachTo(target) && !target.immunities().contains(Sleep.class)) {
if (cooldown() == 0)
spend(Random.Int(3, 6));
return true;

View File

@ -30,7 +30,7 @@ public class MagicalSleep extends Buff {
@Override
public boolean attachTo( Char target ) {
if (super.attachTo( target )) {
if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) {
if (target instanceof Hero)
if (target.HP == target.HT) {

View File

@ -658,6 +658,7 @@ public class Hero extends Char {
Camera.main.shake( 1, 0.5f );
break;
case SKELETON:
case REMAINS:
break;
default:
Sample.INSTANCE.play( Assets.SND_UNLOCK );
@ -1318,7 +1319,7 @@ public class Hero extends Char {
}
Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst );
if (heap.type == Type.SKELETON) {
if (heap.type == Type.SKELETON || heap.type == Type.REMAINS) {
Sample.INSTANCE.play( Assets.SND_BONES );
}
heap.open( this );

View File

@ -56,7 +56,8 @@ public class Heap implements Bundlable {
LOCKED_CHEST,
CRYSTAL_CHEST,
TOMB,
SKELETON
SKELETON,
REMAINS
}
public Type type = Type.HEAP;
@ -81,6 +82,8 @@ public class Heap implements Bundlable {
return ItemSpriteSheet.TOMB;
case SKELETON:
return ItemSpriteSheet.BONES;
case REMAINS:
return ItemSpriteSheet.REMAINS;
default:
return 0;
}
@ -96,6 +99,7 @@ public class Heap implements Bundlable {
Wraith.spawnAround( hero.pos );
break;
case SKELETON:
case REMAINS:
CellEmitter.center( pos ).start( Speck.factory( Speck.RATTLE ), 0.1f, 3 );
for (Item item : items) {
if (item.cursed) {

View File

@ -25,6 +25,8 @@ public class ClothArmor extends Armor {
{
name = "cloth armor";
image = ItemSpriteSheet.ARMOR_CLOTH;
bones = false; //Finding them in bones would be semi-frequent and disappointing.
}
public ClothArmor() {

View File

@ -201,7 +201,7 @@ public class CavesBossLevel extends Level {
do {
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * WIDTH;
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -159,7 +159,7 @@ public class CityBossLevel extends Level {
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.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -150,7 +150,7 @@ public class HallsBossLevel extends Level {
do {
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * WIDTH;
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -17,9 +17,6 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
import java.util.List;
import com.watabou.noosa.Scene;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@ -27,9 +24,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.watabou.noosa.Scene;
import com.watabou.utils.Graph;
import com.watabou.utils.Random;
import java.util.List;
public class LastShopLevel extends RegularLevel {
{
@ -170,7 +170,7 @@ public class LastShopLevel extends RegularLevel {
do {
pos = roomEntrance.random();
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -17,9 +17,6 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
import java.util.List;
import com.watabou.noosa.Scene;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -34,11 +31,14 @@ import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.Scene;
import com.watabou.utils.Bundle;
import com.watabou.utils.Graph;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
import java.util.List;
public class PrisonBossLevel extends RegularLevel {
{
@ -297,7 +297,7 @@ public class PrisonBossLevel extends RegularLevel {
do {
pos = roomEntrance.random();
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -17,11 +17,6 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@ -34,12 +29,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.*;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.watabou.utils.Bundle;
import com.watabou.utils.Graph;
import com.watabou.utils.Random;
import com.watabou.utils.Rect;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
public abstract class RegularLevel extends Level {
protected HashSet<Room> rooms;
@ -632,7 +632,7 @@ public abstract class RegularLevel extends Level {
Item item = Bones.get();
if (item != null) {
drop( item, randomDropCell() ).type = Heap.Type.SKELETON;
drop( item, randomDropCell() ).type = Heap.Type.REMAINS;
}
}

View File

@ -17,10 +17,6 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
import java.util.ArrayList;
import java.util.List;
import com.watabou.noosa.Scene;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -31,10 +27,14 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.Scene;
import com.watabou.utils.Bundle;
import com.watabou.utils.Graph;
import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.List;
public class SewerBossLevel extends RegularLevel {
{
@ -232,7 +232,7 @@ public class SewerBossLevel extends RegularLevel {
do {
pos = roomEntrance.random();
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.SKELETON;
drop( item, pos ).type = Heap.Type.REMAINS;
}
}

View File

@ -20,9 +20,12 @@ package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class Dreamfoil extends Plant {
@ -42,6 +45,10 @@ public class Dreamfoil extends Plant {
if (ch != null) {
if (ch instanceof Mob)
Buff.affect(ch, MagicalSleep.class);
else if (ch instanceof Hero){
GLog.w("The poison isn't strong enough to put you to sleep, you are weakened instead.");
Buff.affect(ch, Weakness.class, Weakness.duration(ch));
}
}
}

View File

@ -1,11 +1,8 @@
package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -15,8 +12,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Stormvine extends Plant {
private static final String TXT_DESC =
"Stormvine is an unusual sort fo vine which 'hangs' on the air. " +
"Gravity affects it strangely, and anything caught in the vine is confused as a result.";
"Stormvine is an unusual sort of vine which 'hangs' on the air. " +
"It somehow nuffies gravity around it, and anything caught in the vine is disoriented as a result.";
{
image = 9;

View File

@ -43,15 +43,16 @@ public class ItemSpriteSheet {
public static final int DEWDROP = ROW1+1;
// Heaps (containers)
public static final int BONES = ROW1+2;
public static final int TOMB = ROW1+3;
public static final int CHEST = ROW1+4;
public static final int LOCKED_CHEST = ROW1+5;
public static final int CRYSTAL_CHEST = ROW1+6;
public static final int REMAINS = ROW1+3;
public static final int TOMB = ROW1+4;
public static final int CHEST = ROW1+5;
public static final int LOCKED_CHEST = ROW1+6;
public static final int CRYSTAL_CHEST = ROW1+7;
// Placeholders
public static final int WEAPON = ROW1+7;
public static final int ARMOR = ROW1+8;
public static final int RING = ROW1+9;
public static final int SMTH = ROW1+10;
public static final int WEAPON = ROW1+8;
public static final int ARMOR = ROW1+9;
public static final int RING = ROW1+10;
public static final int SMTH = ROW1+11;
//Row Two: Miscellaneous single use items
public static final int GOLD = ROW2+0;

View File

@ -17,20 +17,19 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ui.Button;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ui.Button;
public class ItemSlot extends Button {
@ -68,6 +67,9 @@ public class ItemSlot extends Button {
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 ItemSlot() {
super();

View File

@ -69,6 +69,7 @@ public class LootIndicator extends Tag {
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.peek();
if (item != lastItem || item.quantity() != lastQuantity) {
lastItem = item;

View File

@ -62,12 +62,11 @@ public class WndInfoCell extends Window {
add( info );
StringBuilder desc = new StringBuilder( Dungeon.level.tileDesc( tile ) );
final char newLine = '\n';
for (Blob blob:Dungeon.level.blobs.values()) {
if (blob.cur[cell] > 0 && blob.tileDesc() != null) {
if (desc.length() > 0) {
desc.append( newLine );
desc.append( "\n\n" );
}
desc.append( blob.tileDesc() );
}

View File

@ -30,18 +30,22 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndInfoItem extends Window {
private static final String TXT_CHEST = "Chest";
private static final String TXT_LOCKED_CHEST = "Locked chest";
private static final String TXT_CRYSTAL_CHEST = "Crystal chest";
private static final String TXT_TOMB = "Tomb";
private static final String TXT_SKELETON = "Skeletal remains";
private static final String TTL_CHEST = "Chest";
private static final String TTL_LOCKED_CHEST = "Locked chest";
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 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 =
"This ancient tomb may contain something useful, " +
"but its owner will most certainly object to checking.";
private static final String TXT_REMAINS =
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.";
@ -71,22 +75,25 @@ public class WndInfoItem extends Window {
String info;
if (heap.type == Type.CHEST) {
title = TXT_CHEST;
title = TTL_CHEST;
info = TXT_WONT_KNOW;
} else if (heap.type == Type.TOMB) {
title = TXT_TOMB;
title = TTL_TOMB;
info = TXT_OWNER;
} else if (heap.type == Type.SKELETON) {
title = TXT_SKELETON;
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 = TXT_CRYSTAL_CHEST;
title = TTL_CRYSTAL_CHEST;
if (heap.peek() instanceof Artifact)
info = Utils.format( TXT_INSIDE, "an artifact" );
else
info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) );
} else {
title = TXT_LOCKED_CHEST;
title = TTL_LOCKED_CHEST;
info = TXT_NEED_KEY;
}