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 7facf2810..0cd526400 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -133,18 +133,22 @@ public abstract class Char extends Actor { //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 ); - } + throwItems(); } return false; } + protected void throwItems(){ + 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 ); + } + } + public String name(){ return Messages.get(this, "name"); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java index bb8ddf77d..8a2908afc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java @@ -27,8 +27,10 @@ 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.Charm; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; @@ -70,6 +72,8 @@ public class YogDzewa extends Mob { //so that allies can attack it. States are never actually used. state = HUNTING; + viewDistance = 12; + properties.add(Property.BOSS); properties.add(Property.IMMOVABLE); properties.add(Property.DEMONIC); @@ -112,7 +116,19 @@ public class YogDzewa extends Mob { @Override protected boolean act() { - enemySeen = true; + //char logic + if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){ + fieldOfView = new boolean[Dungeon.level.length()]; + } + Dungeon.level.updateFieldOfView( this, fieldOfView ); + + throwItems(); + + //mob logic + enemy = chooseEnemy(); + + enemySeen = enemy != null && enemy.isAlive() && fieldOfView[enemy.pos] && enemy.invisible <= 0; + //end of char/mob logic if (phase == 0){ if (Dungeon.hero.viewDistance >= Dungeon.level.distance(pos, Dungeon.hero.pos)) { @@ -416,6 +432,8 @@ public class YogDzewa extends Mob { immunities.add( Charm.class ); immunities.add( Sleep.class ); immunities.add( Vertigo.class ); + immunities.add( Frost.class ); + immunities.add( Paralysis.class ); } private static final String PHASE = "phase";