v0.7.5: improved necromancer sprite
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 448 B |
@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.NecromancerSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.SkeletonSprite;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.particles.Emitter;
|
||||
import com.watabou.utils.Bundle;
|
||||
@@ -62,7 +63,7 @@ public class Necromancer extends Mob {
|
||||
HUNTING = new Hunting();
|
||||
}
|
||||
|
||||
private boolean summoning = false;
|
||||
public boolean summoning = false;
|
||||
private Emitter summoningEmitter = null;
|
||||
private int summoningPos = -1;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class Necromancer extends Mob {
|
||||
if (summoning && summoningEmitter == null){
|
||||
summoningEmitter = CellEmitter.get( summoningPos );
|
||||
summoningEmitter.pour(Speck.factory(Speck.RATTLE), 0.2f);
|
||||
((NecromancerSprite)sprite).charge( summoningPos );
|
||||
sprite.zap( summoningPos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +153,28 @@ public class Necromancer extends Mob {
|
||||
}
|
||||
}
|
||||
|
||||
public void onZapComplete(){
|
||||
if (mySkeleton == null){
|
||||
return;
|
||||
}
|
||||
|
||||
//heal skeleton first
|
||||
if (mySkeleton.HP < mySkeleton.HT){
|
||||
|
||||
sprite.parent.add(new Beam.HealthRay(sprite.center(), mySkeleton.sprite.center()));
|
||||
|
||||
mySkeleton.HP = Math.min(mySkeleton.HP + 5, mySkeleton.HT);
|
||||
mySkeleton.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
|
||||
//otherwise give it adrenaline
|
||||
} else if (mySkeleton.buff(Adrenaline.class) == null) {
|
||||
|
||||
sprite.parent.add(new Beam.HealthRay(sprite.center(), mySkeleton.sprite.center()));
|
||||
|
||||
Buff.affect(mySkeleton, Adrenaline.class, 3f);
|
||||
}
|
||||
}
|
||||
|
||||
private class Hunting extends Mob.Hunting{
|
||||
|
||||
@Override
|
||||
@@ -218,7 +241,7 @@ public class Necromancer extends Mob {
|
||||
}
|
||||
|
||||
//if enemy is seen, and enemy is within range, and we haven no skeleton, summon a skeleton!
|
||||
if (enemySeen && Dungeon.level.distance(pos, enemy.pos) <= 4 && mySkeleton == null){
|
||||
if (enemySeen && Dungeon.level.distance(pos, enemy.pos) <= 1 && mySkeleton == null){
|
||||
|
||||
summoningPos = -1;
|
||||
for (int c : PathFinder.NEIGHBOURS8){
|
||||
@@ -236,7 +259,7 @@ public class Necromancer extends Mob {
|
||||
summoningEmitter = CellEmitter.get(summoningPos);
|
||||
summoningEmitter.pour(Speck.factory(Speck.RATTLE), 0.2f);
|
||||
|
||||
((NecromancerSprite)sprite).charge(summoningPos);
|
||||
sprite.zap( summoningPos );
|
||||
|
||||
spend( firstSummon ? TICK : 2*TICK );
|
||||
} else {
|
||||
@@ -274,24 +297,11 @@ public class Necromancer extends Mob {
|
||||
|
||||
} else {
|
||||
|
||||
//heal skeleton first
|
||||
if (mySkeleton.HP < mySkeleton.HT){
|
||||
|
||||
//zap skeleton
|
||||
if (mySkeleton.HP < mySkeleton.HT || mySkeleton.buff(Adrenaline.class) == null) {
|
||||
sprite.zap(mySkeleton.pos);
|
||||
sprite.parent.add(new Beam.HealthRay(sprite.center(), mySkeleton.sprite.center()));
|
||||
|
||||
int healRoll = Random.NormalIntRange(5, 8);
|
||||
mySkeleton.HP = Math.min(mySkeleton.HP + healRoll, mySkeleton.HT);
|
||||
mySkeleton.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
|
||||
//otherwise give it adrenaline
|
||||
} else if (mySkeleton.buff(Adrenaline.class) == null) {
|
||||
|
||||
sprite.zap(mySkeleton.pos);
|
||||
sprite.parent.add(new Beam.HealthRay(sprite.center(), mySkeleton.sprite.center()));
|
||||
|
||||
Buff.affect(mySkeleton, Adrenaline.class, 3f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
spend(TICK);
|
||||
@@ -305,12 +315,13 @@ public class Necromancer extends Mob {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO should give this its own sprite
|
||||
public static class NecroSkeleton extends Skeleton {
|
||||
|
||||
{
|
||||
state = WANDERING;
|
||||
|
||||
spriteClass = NecroSkeletonSprite.class;
|
||||
|
||||
//no loot or exp
|
||||
maxLvl = -5;
|
||||
|
||||
@@ -322,5 +333,19 @@ public class Necromancer extends Mob {
|
||||
spend(TICK);
|
||||
}
|
||||
|
||||
public static class NecroSkeletonSprite extends SkeletonSprite{
|
||||
|
||||
public NecroSkeletonSprite(){
|
||||
super();
|
||||
brightness(0.75f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetColor() {
|
||||
super.resetColor();
|
||||
brightness(0.75f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Necromancer;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
|
||||
//TODO placeholder graphics atm
|
||||
public class NecromancerSprite extends MobSprite {
|
||||
|
||||
private Animation charging;
|
||||
@@ -38,25 +38,24 @@ public class NecromancerSprite extends MobSprite {
|
||||
idle = new Animation( 1, true );
|
||||
idle.frames( film, 0, 0, 0, 1, 0, 0, 0, 0, 1 );
|
||||
|
||||
run = new Animation( 10, true );
|
||||
run.frames( film, 0, 2, 3, 4, 0 );
|
||||
run = new Animation( 8, true );
|
||||
run.frames( film, 0, 0, 0, 2, 3, 4 );
|
||||
|
||||
zap = new Animation( 5, false );
|
||||
zap.frames( film, 5, 1 );
|
||||
zap = new Animation( 10, false );
|
||||
zap.frames( film, 5, 6, 7, 8 );
|
||||
|
||||
charging = new Animation( 5, true );
|
||||
charging.frames( film, 1, 5 );
|
||||
charging.frames( film, 7, 8 );
|
||||
|
||||
die = new Animation( 10, false );
|
||||
die.frames( film, 6, 7, 8, 9 );
|
||||
die.frames( film, 9, 10, 11, 12 );
|
||||
|
||||
attack = zap.clone();
|
||||
|
||||
idle();
|
||||
}
|
||||
|
||||
public void charge( int pos ){
|
||||
turnTo(ch.pos, pos);
|
||||
public void charge(){
|
||||
play(charging);
|
||||
}
|
||||
|
||||
@@ -64,7 +63,12 @@ public class NecromancerSprite extends MobSprite {
|
||||
public void onComplete(Animation anim) {
|
||||
super.onComplete(anim);
|
||||
if (anim == zap){
|
||||
if (((Necromancer) ch).summoning){
|
||||
charge();
|
||||
} else {
|
||||
((Necromancer)ch).onZapComplete();
|
||||
idle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user