diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 17df20be4..ae5d52f7f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -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; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index 6a7067ad0..9304f1a88 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -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 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 5be47f215..20d3667de 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -66,8 +66,6 @@ public class Imp extends NPC { seenBefore = false; } - throwItem(); - return super.act(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java index 685a41f27..5696bbc4a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/NPC.java @@ -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 ) { } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java index aeb59f2c9..841d48553 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java @@ -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 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index fc950962b..e063cb4d1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -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 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index 9ca0c4315..6a2572e57 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -374,7 +374,6 @@ public class WandOfRegrowth extends Wand { @Override protected boolean act() { super.act(); - throwItem(); if (--HP <= 0){ destroy(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index d6a433d74..3fe25076a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -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 );