Magic_Ling_Pixel_Dungeon/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GnollTricksterSprite.java

80 lines
2.1 KiB
Java
Raw Normal View History

2015-06-12 20:44:04 +00:00
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
2016-05-08 23:54:12 +00:00
* Copyright (C) 2014-2016 Evan Debenham
2015-06-12 20:44:04 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.CurareDart;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.noosa.MovieClip;
import com.watabou.noosa.TextureFilm;
import com.watabou.utils.Callback;
public class GnollTricksterSprite extends MobSprite {
private Animation cast;
public GnollTricksterSprite() {
super();
texture( Assets.GNOLL );
TextureFilm frames = new TextureFilm( texture, 12, 15 );
idle = new MovieClip.Animation( 2, true );
idle.frames( frames, 21, 21, 21, 22, 21, 21, 22, 22 );
run = new MovieClip.Animation( 12, true );
run.frames( frames, 25, 26, 27, 28 );
attack = new MovieClip.Animation( 12, false );
attack.frames( frames, 23, 24, 21 );
cast = attack.clone();
die = new MovieClip.Animation( 12, false );
die.frames( frames, 29, 30, 31 );
play( idle );
}
@Override
public void attack( int cell ) {
if (!Level.adjacent(cell, ch.pos)) {
((MissileSprite)parent.recycle( MissileSprite.class )).
reset( ch.pos, cell, new CurareDart(), new Callback() {
@Override
public void call() {
ch.onAttackComplete();
}
} );
play( cast );
turnTo( ch.pos , cell );
} else {
super.attack( cell );
}
}
}