v0.3.3: added char properties, starting with IMMOVABLE implementation
This commit is contained in:
@@ -447,4 +447,16 @@ public abstract class Char extends Actor {
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
protected HashSet<Property> properties = new HashSet<>();
|
||||
|
||||
public HashSet<Property> properties() { return properties; }
|
||||
|
||||
public enum Property{
|
||||
BOSS,
|
||||
MINIBOSS,
|
||||
UNDEAD,
|
||||
EVIL,
|
||||
IMMOVABLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class Guard extends Mob {
|
||||
}
|
||||
|
||||
private boolean chain(int target){
|
||||
if (chainsUsed)
|
||||
if (chainsUsed || enemy.properties().contains(Property.IMMOVABLE))
|
||||
return false;
|
||||
|
||||
Ballistica chain = new Ballistica(pos, target, Ballistica.PROJECTILE);
|
||||
|
||||
@@ -43,6 +43,8 @@ public class RotHeart extends Mob {
|
||||
EXP = 4;
|
||||
|
||||
state = PASSIVE;
|
||||
|
||||
properties.add(Property.IMMOVABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,6 +49,8 @@ public class RotLasher extends Mob {
|
||||
lootChance = 1f;
|
||||
|
||||
state = WANDERING = new Waiting();
|
||||
|
||||
properties.add(Property.IMMOVABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,6 +70,8 @@ public class Yog extends Mob {
|
||||
EXP = 50;
|
||||
|
||||
state = PASSIVE;
|
||||
|
||||
properties.add(Property.IMMOVABLE);
|
||||
}
|
||||
|
||||
private static final String TXT_DESC =
|
||||
|
||||
@@ -40,18 +40,13 @@ public class Shopkeeper extends NPC {
|
||||
{
|
||||
name = "shopkeeper";
|
||||
spriteClass = ShopkeeperSprite.class;
|
||||
|
||||
properties.add(Property.IMMOVABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean act() {
|
||||
|
||||
if (startPos == -1) startPos = pos;
|
||||
|
||||
if (startPos != pos){
|
||||
flee();
|
||||
return true;
|
||||
}
|
||||
|
||||
throwItem();
|
||||
|
||||
sprite.turnTo( pos, Dungeon.hero.pos );
|
||||
|
||||
Reference in New Issue
Block a user