cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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 ) );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
+12
-12
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -132,9 +132,9 @@ public class WellWater extends Blob {
|
||||
|
||||
for (Class<?>waterClass : 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 );
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
{
|
||||
|
||||
@@ -37,9 +37,9 @@ public class Buff extends Actor {
|
||||
public enum buffType {POSITIVE, NEGATIVE, NEUTRAL, SILENT};
|
||||
public buffType type = buffType.SILENT;
|
||||
|
||||
public HashSet<Class<?>> resistances = new HashSet<Class<?>>();
|
||||
public HashSet<Class<?>> resistances = new HashSet<Class<?>>();
|
||||
|
||||
public HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
public HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
|
||||
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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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!";
|
||||
|
||||
@@ -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 {
|
||||
|
||||
{
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
@@ -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() );
|
||||
|
||||
@@ -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<MissileWeapon> items = new ArrayList<MissileWeapon>();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,16 +128,16 @@ public class Belongings implements Iterable<Item> {
|
||||
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<Item> {
|
||||
|
||||
@Override
|
||||
public Iterator<Item> iterator() {
|
||||
return new ItemIterator();
|
||||
return new ItemIterator();
|
||||
}
|
||||
|
||||
private class ItemIterator implements Iterator<Item> {
|
||||
|
||||
@@ -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<Mob> visibleEnemies;
|
||||
private ArrayList<Mob> 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<Class<?>> immunities() {
|
||||
HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
for (Buff buff : buffs()){
|
||||
for (Class<?> immunity : buff.immunities)
|
||||
immunities.add(immunity);
|
||||
}
|
||||
for (Class<?> immunity : buff.immunities)
|
||||
immunities.add(immunity);
|
||||
}
|
||||
return immunities;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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." );
|
||||
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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<Char> enemies = new HashSet<Char>();
|
||||
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<Char> enemies = new HashSet<Char>();
|
||||
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<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( Poison.class );
|
||||
IMMUNITIES.add( Amok.class );
|
||||
IMMUNITIES.add( Amok.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Terror.class );
|
||||
IMMUNITIES.add( Terror.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
static {
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class Mimic extends Mob {
|
||||
}
|
||||
|
||||
public static Mimic spawnAt( int pos, List<Item> items ) {
|
||||
Char ch = Actor.findChar( pos );
|
||||
Char ch = Actor.findChar( pos );
|
||||
if (ch != null) {
|
||||
ArrayList<Integer> candidates = new ArrayList<Integer>();
|
||||
for (int n : Level.NEIGHBOURS8) {
|
||||
|
||||
@@ -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<? extends CharSprite> 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<? extends Item>)loot );
|
||||
item = Generator.random( (Class<? extends Item>)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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
private static final HashSet<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
|
||||
static {
|
||||
RESISTANCES.add(Poison.class);
|
||||
}
|
||||
static {
|
||||
RESISTANCES.add(Poison.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> resistances() {
|
||||
return RESISTANCES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> resistances() {
|
||||
return RESISTANCES;
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
|
||||
static {
|
||||
IMMUNITIES.add(Roots.class);
|
||||
}
|
||||
static {
|
||||
IMMUNITIES.add(Roots.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -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<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( StenchGas.class );
|
||||
}
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( StenchGas.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> 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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -135,16 +135,16 @@ public class MirrorImage extends NPC {
|
||||
|
||||
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
|
||||
Dungeon.hero.busy();
|
||||
}
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Burning.class );
|
||||
}
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Burning.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user