Merging Source v1.7.2: actor changes

This commit is contained in:
Evan Debenham
2014-10-20 23:51:15 -04:00
parent 724338b57f
commit 4a49763309
30 changed files with 980 additions and 682 deletions
@@ -17,6 +17,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.actors;
import java.util.ArrayList;
import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
@@ -120,9 +121,9 @@ public abstract class Char extends Actor {
GLog.i( TXT_HIT, name, enemy.name );
}
// Refactoring needed!
int dr = this instanceof Hero && ((Hero)this).usingRanged && ((Hero)this).subClass == HeroSubClass.SNIPER ?
0 : Random.IntRange( 0, enemy.dr() );
// FIXME
int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass ==
HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() );
int dmg = damageRoll();
int effectiveDamage = Math.max( dmg - dr, 0 );;
@@ -367,8 +368,12 @@ public abstract class Char extends Actor {
} else if (buff instanceof Bleeding) {
sprite.showStatus( CharSprite.NEGATIVE, "bleeding" );
} else if (buff instanceof Sleep) {
} else if (buff instanceof Vertigo) {
sprite.showStatus( CharSprite.NEGATIVE, "dizzy" );
} else if (buff instanceof Sleep) {
sprite.idle();
}
@@ -441,6 +446,19 @@ public abstract class Char extends Actor {
}
public void move( int step ) {
if (buff( Vertigo.class ) != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
for (int dir : Level.NEIGHBOURS8) {
int p = pos + dir;
if ((Level.passable[p] || Level.avoid[p]) && Actor.findChar( p ) == null) {
candidates.add( p );
}
}
step = Random.element( candidates );
}
if (Dungeon.level.map[pos] == Terrain.OPEN_DOOR) {
Door.leave( pos );
}