v0.8.2c: immovable chars now all throw items by default

This commit is contained in:
Evan Debenham 2020-08-21 16:10:16 -04:00
parent c4e42cdab1
commit 593d4c26ac
8 changed files with 15 additions and 30 deletions

View File

@ -55,14 +55,15 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ShieldBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Speed;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Stamina;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Elemental;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
@ -131,6 +132,18 @@ public abstract class Char extends Actor {
fieldOfView = new boolean[Dungeon.level.length()];
}
Dungeon.level.updateFieldOfView( this, fieldOfView );
//throw any items that are on top of an immovable char
if (properties.contains(Property.IMMOVABLE)){
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null && heap.type == Heap.Type.HEAP) {
int n;
do {
n = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Dungeon.level.passable[n] && !Dungeon.level.avoid[n]);
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
}
}
return false;
}

View File

@ -63,7 +63,6 @@ public class Blacksmith extends NPC {
@Override
protected boolean act() {
throwItem();
if (Dungeon.level.heroFOV[pos] && !Quest.reforged){
Notes.add( Notes.Landmark.TROLL );
}

View File

@ -66,8 +66,6 @@ public class Imp extends NPC {
seenBefore = false;
}
throwItem();
return super.act();
}

View File

@ -21,11 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public abstract class NPC extends Mob {
@ -37,17 +33,6 @@ public abstract class NPC extends Mob {
state = PASSIVE;
}
protected void throwItem() {
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null && heap.type == Heap.Type.HEAP) {
int n;
do {
n = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Dungeon.level.passable[n] && !Dungeon.level.avoid[n]);
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
}
}
@Override
public void beckon( int cell ) {
}

View File

@ -49,15 +49,13 @@ public class Shopkeeper extends NPC {
@Override
protected boolean act() {
throwItem();
if (Dungeon.level.heroFOV[pos]){
Notes.add(Notes.Landmark.SHOP);
}
sprite.turnTo( pos, Dungeon.hero.pos );
spend( TICK );
return true;
return super.act();
}
@Override

View File

@ -60,7 +60,6 @@ public class Wandmaker extends NPC {
@Override
protected boolean act() {
throwItem();
if (Dungeon.level.heroFOV[pos] && Quest.wand1 != null){
Notes.add( Notes.Landmark.WANDMAKER );
}

View File

@ -374,7 +374,6 @@ public class WandOfRegrowth extends Wand {
@Override
protected boolean act() {
super.act();
throwItem();
if (--HP <= 0){
destroy();

View File

@ -190,12 +190,6 @@ public class WandOfWarding extends Wand {
state = WANDERING;
}
@Override
protected boolean act() {
throwItem();
return super.act();
}
@Override
public String name() {
return Messages.get(this, "name_" + tier );