v0.3.3a: bugfixes and safety checks to tengu and ranged attacks
This commit is contained in:
parent
fe1fade887
commit
2bb18fcd14
|
@ -113,6 +113,8 @@ public abstract class Char extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean attack( Char enemy ) {
|
public boolean attack( Char enemy ) {
|
||||||
|
|
||||||
|
if (enemy == null || !enemy.isAlive()) return false;
|
||||||
|
|
||||||
boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos];
|
boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos];
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.watabou.noosa.TextureFilm;
|
import com.watabou.noosa.TextureFilm;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
|
||||||
|
@ -74,12 +76,15 @@ public class TenguSprite extends MobSprite {
|
||||||
@Override
|
@Override
|
||||||
public void attack( int cell ) {
|
public void attack( int cell ) {
|
||||||
if (!Level.adjacent( cell, ch.pos )) {
|
if (!Level.adjacent( cell, ch.pos )) {
|
||||||
|
|
||||||
|
final Char enemy = Actor.findChar(cell);
|
||||||
|
|
||||||
((MissileSprite)parent.recycle( MissileSprite.class )).
|
((MissileSprite)parent.recycle( MissileSprite.class )).
|
||||||
reset( ch.pos, cell, new Shuriken(), new Callback() {
|
reset( ch.pos, cell, new Shuriken(), new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void call() {
|
public void call() {
|
||||||
ch.onAttackComplete();
|
ch.next();
|
||||||
|
if (enemy != null) ch.attack(enemy);
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user