v0.8.2c: various minor fixes for Yog-Dzewa:

- Yog now calculates its FOV and can be surprised from outside of it
- Yog is now formally immune to freeze/paralysis, instead of just being unaffected
- Yog now properly pushes items
This commit is contained in:
Evan Debenham 2020-08-26 16:46:59 -04:00
parent 220c96fbb5
commit 5b7ef9dacf
2 changed files with 31 additions and 9 deletions

View File

@ -133,18 +133,22 @@ public abstract class Char extends Actor {
//throw any items that are on top of an immovable char //throw any items that are on top of an immovable char
if (properties.contains(Property.IMMOVABLE)){ if (properties.contains(Property.IMMOVABLE)){
Heap heap = Dungeon.level.heaps.get( pos ); throwItems();
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; 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(){ public String name(){
return Messages.get(this, "name"); return Messages.get(this, "name");
} }

View File

@ -27,8 +27,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm; 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.Light;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; 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.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; 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. //so that allies can attack it. States are never actually used.
state = HUNTING; state = HUNTING;
viewDistance = 12;
properties.add(Property.BOSS); properties.add(Property.BOSS);
properties.add(Property.IMMOVABLE); properties.add(Property.IMMOVABLE);
properties.add(Property.DEMONIC); properties.add(Property.DEMONIC);
@ -112,7 +116,19 @@ public class YogDzewa extends Mob {
@Override @Override
protected boolean act() { 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 (phase == 0){
if (Dungeon.hero.viewDistance >= Dungeon.level.distance(pos, Dungeon.hero.pos)) { 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( Charm.class );
immunities.add( Sleep.class ); immunities.add( Sleep.class );
immunities.add( Vertigo.class ); immunities.add( Vertigo.class );
immunities.add( Frost.class );
immunities.add( Paralysis.class );
} }
private static final String PHASE = "phase"; private static final String PHASE = "phase";