Search in sources :

Example 1 with Structure

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);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) BuffObj(main.entity.obj.BuffObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) Structure(eidolons.entity.obj.Structure) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with Structure

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;
}
Also used : UNIT_VISION(main.content.enums.rules.VisionEnums.UNIT_VISION) Structure(eidolons.entity.obj.Structure)

Example 3 with Structure

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;
}
Also used : COLOR_THEME(main.content.CONTENT_CONSTS.COLOR_THEME) EnumMaster(main.system.auxiliary.EnumMaster) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) Color(com.badlogic.gdx.graphics.Color) Structure(eidolons.entity.obj.Structure)

Example 4 with Structure

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);
}
Also used : Obj(main.entity.obj.Obj) DIRECTION(main.game.bf.Coordinates.DIRECTION) GridCellContainer(eidolons.libgdx.bf.grid.GridCellContainer) BaseView(eidolons.libgdx.bf.grid.BaseView) Unit(eidolons.entity.obj.unit.Unit) Structure(eidolons.entity.obj.Structure)

Example 5 with Structure

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;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) Structure(eidolons.entity.obj.Structure) Unit(eidolons.entity.obj.unit.Unit) ITEM_MATERIAL_GROUP(main.content.enums.entity.ItemEnums.ITEM_MATERIAL_GROUP) OBJECT_ARMOR_TYPE(main.content.CONTENT_CONSTS.OBJECT_ARMOR_TYPE)

Aggregations

Structure (eidolons.entity.obj.Structure)5 Unit (eidolons.entity.obj.unit.Unit)3 Obj (main.entity.obj.Obj)3 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 Color (com.badlogic.gdx.graphics.Color)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 Dungeon (eidolons.game.battlecraft.logic.dungeon.universal.Dungeon)1 BaseView (eidolons.libgdx.bf.grid.BaseView)1 GridCellContainer (eidolons.libgdx.bf.grid.GridCellContainer)1 COLOR_THEME (main.content.CONTENT_CONSTS.COLOR_THEME)1 OBJECT_ARMOR_TYPE (main.content.CONTENT_CONSTS.OBJECT_ARMOR_TYPE)1 ITEM_MATERIAL_GROUP (main.content.enums.entity.ItemEnums.ITEM_MATERIAL_GROUP)1 UNIT_VISION (main.content.enums.rules.VisionEnums.UNIT_VISION)1 BuffObj (main.entity.obj.BuffObj)1 DIRECTION (main.game.bf.Coordinates.DIRECTION)1 EnumMaster (main.system.auxiliary.EnumMaster)1