v0.8.0: redesigned golems

This commit is contained in:
Evan Debenham 2019-12-12 19:41:50 -05:00
parent 8919b068c8
commit 4526445a43
4 changed files with 213 additions and 12 deletions

View File

@ -21,12 +21,17 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GolemSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class Golem extends Mob {
@ -34,18 +39,22 @@ public class Golem extends Mob {
{
spriteClass = GolemSprite.class;
HP = HT = 85;
defenseSkill = 18;
HP = HT = 100;
defenseSkill = 12;
EXP = 12;
maxLvl = 22;
properties.add(Property.INORGANIC);
properties.add(Property.LARGE);
WANDERING = new Wandering();
HUNTING = new Hunting();
}
@Override
public int damageRoll() {
return Random.NormalIntRange( 25, 40 );
return Random.NormalIntRange( 15, 35 );
}
@Override
@ -53,11 +62,6 @@ public class Golem extends Mob {
return 28;
}
@Override
protected float attackDelay() {
return super.attackDelay() * 1.5f;
}
@Override
public int drRoll() {
return Random.NormalIntRange(0, 12);
@ -69,6 +73,137 @@ public class Golem extends Mob {
super.rollToDropLoot();
}
private boolean teleporting = false;
private int selfTeleCooldown = 0;
private int enemyTeleCooldown = 0;
private static final String TELEPORTING = "vent_cooldown";
private static final String SELF_COOLDOWN = "self_cooldown";
private static final String ENEMY_COOLDOWN = "vent_cooldown";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(TELEPORTING, teleporting);
bundle.put(SELF_COOLDOWN, selfTeleCooldown);
bundle.put(ENEMY_COOLDOWN, enemyTeleCooldown);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
teleporting = bundle.getBoolean( TELEPORTING );
selfTeleCooldown = bundle.getInt( SELF_COOLDOWN );
enemyTeleCooldown = bundle.getInt( ENEMY_COOLDOWN );
}
@Override
protected boolean act() {
selfTeleCooldown--;
enemyTeleCooldown--;
if (teleporting){
((GolemSprite)sprite).teleParticles(false);
if (Actor.findChar(target) == null) {
ScrollOfTeleportation.appear(this, target);
selfTeleCooldown = 30;
}
teleporting = false;
spend(TICK);
return true;
}
return super.act();
}
public void onZapComplete(){
teleportEnemy();
next();
}
public void teleportEnemy(){
spend(TICK);
int bestPos = enemy.pos;
for (int i : PathFinder.NEIGHBOURS8){
if (Dungeon.level.passable[pos + i]
&& Actor.findChar(pos+i) == null
&& Dungeon.level.trueDistance(pos+i, enemy.pos) > Dungeon.level.trueDistance(bestPos, enemy.pos)){
bestPos = pos+i;
}
}
if (bestPos != enemy.pos){
ScrollOfTeleportation.appear(enemy, bestPos);
}
enemyTeleCooldown = 20;
}
private class Wandering extends Mob.Wandering{
@Override
protected boolean continueWandering() {
enemySeen = false;
int oldPos = pos;
if (target != -1 && getCloser( target )) {
spend( 1 / speed() );
return moveSprite( oldPos, pos );
} else if (target != -1 && target != pos && selfTeleCooldown <= 0) {
((GolemSprite)sprite).teleParticles(true);
teleporting = true;
spend( 2*TICK );
} else {
target = Dungeon.level.randomDestination( Golem.this );
spend( TICK );
}
return true;
}
}
private class Hunting extends Mob.Hunting{
@Override
public boolean act(boolean enemyInFOV, boolean justAlerted) {
if (!enemyInFOV || canAttack(enemy)) {
return super.act(enemyInFOV, justAlerted);
} else {
enemySeen = true;
target = enemy.pos;
int oldPos = pos;
if (enemyTeleCooldown <= 0 && Random.Int(100/distance(enemy)) == 0){
if (sprite != null && (sprite.visible || enemy.sprite.visible)) {
sprite.zap( enemy.pos );
return false;
} else {
teleportEnemy();
return true;
}
} else if (getCloser( target )) {
spend( 1 / speed() );
return moveSprite( oldPos, pos );
} else if (enemyTeleCooldown <= 0) {
if (sprite != null && (sprite.visible || enemy.sprite.visible)) {
sprite.zap( enemy.pos );
return false;
} else {
teleportEnemy();
return true;
}
} else {
spend( TICK );
return true;
}
}
}
}
{
immunities.add( Amok.class );

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.CorrosionParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.RainbowParticle;
@ -67,6 +68,7 @@ public class MagicMissile extends Emitter {
public static final int SHAMAN_BLUE = 12;
public static final int SHAMAN_PURPLE = 13;
public static final int TOXIC_VENT = 14;
public static final int ELMO = 15;
public static final int FIRE_CONE = 100;
public static final int FOLIAGE_CONE = 101;
@ -167,6 +169,10 @@ public class MagicMissile extends Emitter {
size( 10 );
pour( Speck.factory(Speck.TOXIC), 0.02f );
break;
case ELMO:
size( 5 );
pour( ElmoParticle.FACTORY, 0.01f );
break;
case FIRE_CONE:
size( 10 );

View File

@ -22,10 +22,18 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Golem;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.Callback;
public class GolemSprite extends MobSprite {
Emitter teleParticles;
public GolemSprite() {
super();
@ -42,23 +50,75 @@ public class GolemSprite extends MobSprite {
attack = new Animation( 10, false );
attack.frames( frames, 6, 7, 8 );
zap = attack.clone();
die = new Animation( 15, false );
die.frames( frames, 9, 10, 11, 12, 13 );
play( idle );
}
@Override
public void link(Char ch) {
super.link(ch);
teleParticles = emitter();
teleParticles.autoKill = false;
teleParticles.pour(ElmoParticle.FACTORY, 0.05f);
teleParticles.on = false;
}
@Override
public void update() {
super.update();
if (teleParticles != null){
teleParticles.pos( this );
teleParticles.visible = visible;
}
}
public void teleParticles(boolean value){
if (teleParticles != null) teleParticles.on = value;
}
@Override
public synchronized void play(Animation anim, boolean force) {
if (teleParticles != null) teleParticles.on = false;
super.play(anim, force);
}
@Override
public int blood() {
return 0xFF80706c;
}
public void zap( int cell ) {
turnTo( ch.pos , cell );
play( zap );
MagicMissile.boltFromChar( parent,
MagicMissile.ELMO,
this,
cell,
new Callback() {
@Override
public void call() {
((Golem)ch).onZapComplete();
}
} );
Sample.INSTANCE.play( Assets.SND_ZAP );
}
@Override
public void onComplete( Animation anim ) {
if (anim == die) {
emitter().burst( ElmoParticle.FACTORY, 4 );
}
if (anim == zap) {
idle();
}
super.onComplete( anim );
}
}

View File

@ -529,7 +529,7 @@ actors.mobs.goldenmimic.desc=Mimics are magical creatures which can take any sha
actors.mobs.golem.name=golem
actors.mobs.golem.def_verb=blocked
actors.mobs.golem.desc=The Dwarves tried to combine their knowledge of mechanisms with their newfound power of elemental binding. They used spirits of earth as the "soul" for the mechanical bodies of golems, which were believed to be most controllable of all. Despite this, the tiniest mistake in the ritual could cause an outbreak.
actors.mobs.golem.desc=Golems are an attempt to correct the previous flaws in dwarven machinery via the dwarves newfound use of magic. They are much more compact and efficient compared to the DM-300 while still being very deadly.\n\nWhile golems are still too large to fit into passageways, the dwarves have given them new magical abilities to compensate. Golems can teleport themselves between rooms, and teleport enemies to them when they are out of reach.
actors.mobs.goo.name=Goo
actors.mobs.goo.notice=GLURP-GLURP!