v0.7.3a: adjusted the behaviour of Tengu's thrown attacks

This commit is contained in:
Evan Debenham 2019-05-24 22:09:13 -04:00
parent 37611029a4
commit 3864d5c21e
3 changed files with 18 additions and 14 deletions

View File

@ -158,12 +158,10 @@ public class Tengu extends Mob {
//tengu's attack is always visible //tengu's attack is always visible
@Override @Override
protected boolean doAttack(Char enemy) { protected boolean doAttack(Char enemy) {
if (enemy == Dungeon.hero)
Dungeon.hero.resting = false;
sprite.attack( enemy.pos ); sprite.attack( enemy.pos );
spend( attackDelay() ); spend( attackDelay() );
return !Dungeon.level.adjacent(pos, enemy.pos); return false;
} }
private void jump() { private void jump() {

View File

@ -99,6 +99,8 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener {
ANGULAR_SPEEDS.put(Bolas.class, 1440); ANGULAR_SPEEDS.put(Bolas.class, 1440);
ANGULAR_SPEEDS.put(Shuriken.class, 2160); ANGULAR_SPEEDS.put(Shuriken.class, 2160);
ANGULAR_SPEEDS.put(TenguSprite.TenguShuriken.class, 2160);
} }
//TODO it might be nice to have a source and destination angle, to improve thrown weapon visuals //TODO it might be nice to have a source and destination angle, to improve thrown weapon visuals
@ -137,10 +139,13 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener {
float speed = SPEED; float speed = SPEED;
if (item instanceof Dart && Dungeon.hero.belongings.weapon instanceof Crossbow){ if (item instanceof Dart && Dungeon.hero.belongings.weapon instanceof Crossbow){
speed *= 3f; speed *= 3f;
}
if (item instanceof SpiritBow.SpiritArrow || item instanceof ScorpioSprite.ScorpioShot){ } else if (item instanceof SpiritBow.SpiritArrow
|| item instanceof ScorpioSprite.ScorpioShot
|| item instanceof TenguSprite.TenguShuriken){
speed *= 1.5f; speed *= 1.5f;
} }
PosTweener tweener = new PosTweener( this, to, d.length() / speed ); PosTweener tweener = new PosTweener( this, to, d.length() / speed );
tweener.listener = this; tweener.listener = this;
parent.add( tweener ); parent.add( tweener );

View File

@ -23,9 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
@ -84,14 +82,11 @@ public class TenguSprite extends MobSprite {
public void attack( int cell ) { public void attack( int cell ) {
if (!Dungeon.level.adjacent( cell, ch.pos )) { if (!Dungeon.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 TenguShuriken(), new Callback() {
@Override @Override
public void call() { public void call() {
ch.next(); ch.onAttackComplete();
if (enemy != null) ch.attack(enemy);
} }
} ); } );
@ -118,4 +113,10 @@ public class TenguSprite extends MobSprite {
super.onComplete( anim ); super.onComplete( anim );
} }
} }
public static class TenguShuriken extends Item {
{
image = ItemSpriteSheet.SHURIKEN;
}
}
} }