v0.3.3a: bugfixes and safety checks to tengu and ranged attacks

This commit is contained in:
Evan Debenham 2015-12-24 03:47:13 -05:00
parent fe1fade887
commit 2bb18fcd14
2 changed files with 9 additions and 2 deletions

View File

@ -113,6 +113,8 @@ public abstract class Char extends Actor {
}
public boolean attack( Char enemy ) {
if (enemy == null || !enemy.isAlive()) return false;
boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos];

View File

@ -20,6 +20,8 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
@ -74,12 +76,15 @@ public class TenguSprite extends MobSprite {
@Override
public void attack( int cell ) {
if (!Level.adjacent( cell, ch.pos )) {
final Char enemy = Actor.findChar(cell);
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cell, new Shuriken(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
ch.next();
if (enemy != null) ch.attack(enemy);
}
} );