v0.7.5: improved necromancer sprite

This commit is contained in:
Evan Debenham
2019-10-01 02:53:29 -04:00
parent 1942b07cd3
commit b5642be3c7
3 changed files with 60 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 448 B

View File

@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.NecromancerSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.NecromancerSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SkeletonSprite;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@@ -62,7 +63,7 @@ public class Necromancer extends Mob {
HUNTING = new Hunting(); HUNTING = new Hunting();
} }
private boolean summoning = false; public boolean summoning = false;
private Emitter summoningEmitter = null; private Emitter summoningEmitter = null;
private int summoningPos = -1; private int summoningPos = -1;
@@ -78,7 +79,7 @@ public class Necromancer extends Mob {
if (summoning && summoningEmitter == null){ if (summoning && summoningEmitter == null){
summoningEmitter = CellEmitter.get( summoningPos ); summoningEmitter = CellEmitter.get( summoningPos );
summoningEmitter.pour(Speck.factory(Speck.RATTLE), 0.2f); 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{ private class Hunting extends Mob.Hunting{
@Override @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 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; summoningPos = -1;
for (int c : PathFinder.NEIGHBOURS8){ for (int c : PathFinder.NEIGHBOURS8){
@@ -236,7 +259,7 @@ public class Necromancer extends Mob {
summoningEmitter = CellEmitter.get(summoningPos); summoningEmitter = CellEmitter.get(summoningPos);
summoningEmitter.pour(Speck.factory(Speck.RATTLE), 0.2f); summoningEmitter.pour(Speck.factory(Speck.RATTLE), 0.2f);
((NecromancerSprite)sprite).charge(summoningPos); sprite.zap( summoningPos );
spend( firstSummon ? TICK : 2*TICK ); spend( firstSummon ? TICK : 2*TICK );
} else { } else {
@@ -274,24 +297,11 @@ public class Necromancer extends Mob {
} else { } else {
//heal skeleton first //zap skeleton
if (mySkeleton.HP < mySkeleton.HT){ if (mySkeleton.HP < mySkeleton.HT || mySkeleton.buff(Adrenaline.class) == null) {
sprite.zap(mySkeleton.pos); 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); spend(TICK);
@@ -305,12 +315,13 @@ public class Necromancer extends Mob {
} }
} }
//TODO should give this its own sprite
public static class NecroSkeleton extends Skeleton { public static class NecroSkeleton extends Skeleton {
{ {
state = WANDERING; state = WANDERING;
spriteClass = NecroSkeletonSprite.class;
//no loot or exp //no loot or exp
maxLvl = -5; maxLvl = -5;
@@ -322,5 +333,19 @@ public class Necromancer extends Mob {
spend(TICK); spend(TICK);
} }
public static class NecroSkeletonSprite extends SkeletonSprite{
public NecroSkeletonSprite(){
super();
brightness(0.75f);
}
@Override
public void resetColor() {
super.resetColor();
brightness(0.75f);
}
}
} }
} }

View File

@@ -22,9 +22,9 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites; package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Necromancer;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
//TODO placeholder graphics atm
public class NecromancerSprite extends MobSprite { public class NecromancerSprite extends MobSprite {
private Animation charging; private Animation charging;
@@ -38,25 +38,24 @@ public class NecromancerSprite extends MobSprite {
idle = new Animation( 1, true ); idle = new Animation( 1, true );
idle.frames( film, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); idle.frames( film, 0, 0, 0, 1, 0, 0, 0, 0, 1 );
run = new Animation( 10, true ); run = new Animation( 8, true );
run.frames( film, 0, 2, 3, 4, 0 ); run.frames( film, 0, 0, 0, 2, 3, 4 );
zap = new Animation( 5, false ); zap = new Animation( 10, false );
zap.frames( film, 5, 1 ); zap.frames( film, 5, 6, 7, 8 );
charging = new Animation( 5, true ); charging = new Animation( 5, true );
charging.frames( film, 1, 5 ); charging.frames( film, 7, 8 );
die = new Animation( 10, false ); die = new Animation( 10, false );
die.frames( film, 6, 7, 8, 9 ); die.frames( film, 9, 10, 11, 12 );
attack = zap.clone(); attack = zap.clone();
idle(); idle();
} }
public void charge( int pos ){ public void charge(){
turnTo(ch.pos, pos);
play(charging); play(charging);
} }
@@ -64,7 +63,12 @@ public class NecromancerSprite extends MobSprite {
public void onComplete(Animation anim) { public void onComplete(Animation anim) {
super.onComplete(anim); super.onComplete(anim);
if (anim == zap){ if (anim == zap){
idle(); if (((Necromancer) ch).summoning){
charge();
} else {
((Necromancer)ch).onZapComplete();
idle();
}
} }
} }
} }