use of eidolons.entity.obj.Structure in project Eidolons by IDemiurge.
the class DC_StateManager method removeObject.
public void removeObject(Integer id) {
Obj obj = game.getObjectById(id);
if (obj == null) {
return;
}
if (obj instanceof BattleFieldObject) {
if (obj instanceof Structure) {
getGame().getStructures().remove(obj);
}
if (obj instanceof Unit) {
getGame().getUnits().remove(obj);
}
removeAttachedObjects((Unit) obj);
}
Map<Integer, Obj> map = state.getObjMaps().get(obj.getOBJ_TYPE_ENUM());
if (map != null) {
map.remove(id);
}
// super.removeObject(id);
}
use of eidolons.entity.obj.Structure in project Eidolons by IDemiurge.
the class VisionRule method visibility.
public VISIBILITY_LEVEL visibility(Unit source, DC_Obj object) {
UNIT_VISION sight = controller.getUnitVisionMapper().get(source, object);
boolean landmark = object instanceof Structure;
switch(sight) {
case IN_PLAIN_SIGHT:
return VISIBILITY_LEVEL.CLEAR_SIGHT;
case BLOCKED:
// if
return VISIBILITY_LEVEL.BLOCKED;
case IN_SIGHT:
if (landmark)
if (controller.getDetectionMapper().get(source.getOwner(), object)) {
return VISIBILITY_LEVEL.CONCEALED;
}
return VISIBILITY_LEVEL.OUTLINE;
case BEYOND_SIGHT:
if (landmark) {
if (controller.getDetectionMapper().get(source.getOwner(), object)) {
return VISIBILITY_LEVEL.CONCEALED;
}
}
}
return VISIBILITY_LEVEL.UNSEEN;
// TODO case CONCEALED:
// break;
}
use of eidolons.entity.obj.Structure in project Eidolons by IDemiurge.
the class ShadeLightCell method initTeamColor.
public Color initTeamColor() {
// for each coordinate?
// default per dungeon
// Eidolons.getGame().getMaster().getObjCache()
// IlluminationRule.
COLOR_THEME colorTheme = null;
if (type == SHADE_LIGHT.LIGHT_EMITTER) {
for (Structure sub : Eidolons.game.getStructures()) {
if (sub.isLightEmitter()) {
// if (sub.getCoordinates().equals(new Coordinates(x,y)))
colorTheme = new EnumMaster<COLOR_THEME>().retrieveEnumConst(COLOR_THEME.class, sub.getProperty(PROPS.COLOR_THEME, true));
if (colorTheme != null)
break;
}
}
}
if (colorTheme == null) {
Dungeon obj = Eidolons.game.getDungeon();
colorTheme = obj.getColorTheme();
}
Color c = null;
if (colorTheme != null)
c = GdxColorMaster.getColorForTheme(colorTheme);
if (c != null)
return c;
return DEFAULT_COLOR;
}
use of eidolons.entity.obj.Structure in project Eidolons by IDemiurge.
the class ShadeLightCell method adjustPosition.
public void adjustPosition(int x, int y) {
float offsetX = 0;
float offsetY = 0;
setScale(1f, 1f);
setVisible(true);
for (Obj sub : DC_Game.game.getRules().getIlluminationRule().getEffectCache().keySet()) {
if (sub instanceof Unit)
// TODO illuminate some other way for units...
continue;
if (sub instanceof Structure) {
if (sub.getCoordinates().x == x)
if (sub.getCoordinates().y == y)
if (((Structure) sub).isOverlaying()) {
DIRECTION d = ((Structure) sub).getDirection();
if (d == null) {
setScale(0.7f, 0.7f);
continue;
}
setScale(d.growX == null ? 1 : 0.8f, d.growY == null ? 1 : 0.8f);
Dimension dim = GridMaster.getOffsetsForOverlaying(d, (int) getWidth() - 64, (int) getHeight() - 64);
offsetX += dim.width;
offsetY += dim.height;
// so if 2+ overlays, will be centered between them...
} else {
BaseView view = DungeonScreen.getInstance().getGridPanel().getViewMap().get(sub);
offsetX += view.getX() * 3;
offsetY += view.getY() * 3;
if (view.getParent() instanceof GridCellContainer) {
if ((((GridCellContainer) view.getParent()).getUnitViews(true).size() > 1)) {
if (!view.isHovered())
setVisible(false);
}
}
}
}
}
setPosition(originalX + offsetX / 3, originalY + offsetY / 3);
}
use of eidolons.entity.obj.Structure in project Eidolons by IDemiurge.
the class HitAnim method getSpriteType.
private SPRITE_TYPE getSpriteType(BattleFieldObject targetObj) {
Obj block = getActive().getRef().getObj(KEYS.BLOCK);
if (block != null) {
ITEM_MATERIAL_GROUP group = new EnumMaster<ITEM_MATERIAL_GROUP>().retrieveEnumConst(ITEM_MATERIAL_GROUP.class, block.getProperty(G_PROPS.ITEM_MATERIAL_GROUP));
if (group == ITEM_MATERIAL_GROUP.METAL || group == ITEM_MATERIAL_GROUP.CRYSTAL)
return SPRITE_TYPE.SPARKS;
if (group == ITEM_MATERIAL_GROUP.STONE)
return SPRITE_TYPE.STONE;
}
OBJECT_ARMOR_TYPE type = new EnumMaster<OBJECT_ARMOR_TYPE>().retrieveEnumConst(OBJECT_ARMOR_TYPE.class, targetObj.getProperty(PROPS.OBJECT_ARMOR_TYPE));
if (type == OBJECT_ARMOR_TYPE.METAL) {
return SPRITE_TYPE.SPARKS;
}
if (type == OBJECT_ARMOR_TYPE.STONE) {
return SPRITE_TYPE.STONE;
}
if (type == OBJECT_ARMOR_TYPE.FLESH) {
return SPRITE_TYPE.BLOOD;
}
if (type == OBJECT_ARMOR_TYPE.BONE) {
return SPRITE_TYPE.BONE;
}
if (targetObj instanceof Structure) {
if (targetObj.isWall())
return SPRITE_TYPE.STONE;
return SPRITE_TYPE.DUST;
} else {
if (targetObj instanceof Unit) {
if (!((Unit) targetObj).getChecker().isLiving()) {
return SPRITE_TYPE.DUST;
}
}
}
return SPRITE_TYPE.BLOOD;
}
Aggregations