Search in sources :

Example 1 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class DrawMaster method draw.

public void draw(CellComp cellComp, Graphics compGraphics, int zoom, boolean editorMode) {
    this.cellComp = cellComp;
    this.zoom = zoom;
    initSizes();
    Map<Rectangle, Object> mouseMap = new XLinkedMap<>();
    cellComp.setMouseMap(mouseMap);
    Unit topObj = cellComp.getTopObj();
    if (isSingleObj()) {
        Image image = cellComp.getGame().getVisionMaster().getVisibilityMaster().getDisplayImageForUnit(topObj);
        if (image != null) {
            compGraphics.drawImage(image, 0, 0, null);
            if (topObj.isWall()) {
                drawWallOverlays(topObj, compGraphics, cellComp.getCoordinates());
            }
            if (GRAPHICS_TEST_MODE) {
                DC_Obj obj = cellComp.getTopObjOrCell();
                drawCI(obj, compGraphics);
                if (FULL_GRAPHICS_TEST_MODE) {
                    compGraphics.drawString("" + obj.getOutlineType(), 0, GuiManager.getCellHeight() - 40);
                    String tooltip = cellComp.getGame().getVisionMaster().getHintMaster().getTooltip(obj);
                    if (tooltip != null) {
                        compGraphics.drawString("" + tooltip, 0, GuiManager.getCellHeight() - 20);
                    }
                    drawSightBlockInfo(cellComp, compGraphics, zoom);
                }
            }
            drawSpecialOverlays(cellComp, compGraphics, zoom);
            return;
        }
    }
    // no overlays at all? Animations at least?
    if (isFramePaintZoom()) {
        if (!isMultiObj()) {
            try {
                drawCellFrame(compGraphics);
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
    }
    if (!cellComp.isTerrain()) {
        try {
            drawObjComps(compGraphics);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    } else {
        try {
            drawTerrainObj(compGraphics);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    if (!cellComp.isTerrain()) {
        if (topObj.isInfoSelected() || topObj.isActiveSelected()) {
            BufferedImage compOverlayImage = ImageManager.getNewBufferedImage(getCompWidth(), getCompHeight());
            drawComponentOverlays(compOverlayImage.getGraphics());
            BfGridComp.getOverlayMap().put(new XLine(new Point(topObj.getX(), topObj.getY()), new Point(5 - getObjCount() * 2, 0)), compOverlayImage);
        } else {
            drawComponentOverlays(compGraphics);
        }
    }
    drawOverlayingObjects(compGraphics, cellComp);
    // perhaps should work with Obj instead?
    if (isAnimationPaintZoom()) {
        if (cellComp.isAnimated()) {
            try {
                drawAnimations(cellComp, compGraphics);
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
    }
    if (GRAPHICS_TEST_MODE) {
        drawCI(topObj, compGraphics);
    }
    if (GRAPHICS_TEST_MODE || isEditorMode() || DC_Game.game.isDebugMode()) {
        Coordinates coordinates = cellComp.getCoordinates();
        BfGridComp grid = cellComp.getGrid();
        if (grid == null) {
            grid = cellComp.getGame().getBattleField().getGrid().getGridComp();
        }
        if (coordinates.x - grid.getOffsetX() == 0) {
            drawCoordinateMarkings(coordinates.y, compGraphics, false);
        }
        if (coordinates.y - grid.getOffsetY() == 0) {
            drawCoordinateMarkings(coordinates.x, compGraphics, true);
        }
        if (cellComp.isInfoSelected()) {
            drawCoordinateMarkings(coordinates.x, compGraphics, true);
            drawCoordinateMarkings(coordinates.y, compGraphics, false);
        }
    }
    if (isSightVisualsOn()) {
    // Unit obj = cellComp.getGame().getManager().getActiveObj();
    // // if (!obj.isMine()) return ;
    // boolean extended = !obj.getSightSpectrumCoordinates(false).contains(
    // cellComp.getCoordinates());
    // if (!extended) {
    // extended = obj.getSightSpectrumCoordinates(true)
    // .contains(cellComp.getCoordinates());
    // if (!extended) {
    // return;
    // }
    // }
    // 
    // drawSightVisualsOnCell((Graphics2D) compGraphics, extended, cellComp.getObjects().size() > 0);
    // drawSightBlockInfo(cellComp, compGraphics, zoom);
    }
    drawSpecialOverlays(cellComp, compGraphics, zoom);
}
Also used : BfGridComp(eidolons.swing.components.obj.BfGridComp) XLinkedMap(main.data.XLinkedMap) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage) XLine(main.swing.XLine) DC_Obj(eidolons.entity.obj.DC_Obj)

Example 2 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class VersionMaster method readVersionFile.

private static void readVersionFile(OBJ_TYPE t, String version) {
    String xml = FileManager.readFile(getVersionFolderPath(t, version));
    List<ObjType> types = XML_Reader.createCustomTypeList(xml, t, ArcaneTower.getSimulation(), false, false, false);
    Map<String, ObjType> idMap = new XLinkedMap<>();
    for (ObjType type : types) {
        String id = type.getUniqueId();
        idMap.put(id, type);
    }
    map.put(version, idMap);
}
Also used : ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap)

Example 3 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class ActionAnimation method getImageMapFromIds.

protected Map<Image, String> getImageMapFromIds(Attack attack, Map<MOD_IDENTIFIER, String> map) {
    Map<Image, String> iconMap = new XLinkedMap<>();
    subPhaseTypeMap = new XLinkedMap<>();
    for (MOD_IDENTIFIER modId : map.keySet()) {
        Image image = modId.getImage(map.get(modId), attack);
        PHASE_TYPE phaseType = getSubPhaseTypeForKey(modId);
        if (phaseType == null) {
            getSubPhaseTooltipMap().put(image, getTooltip(modId));
        }
        subPhaseTypeMap.put(image, phaseType);
        iconMap.put(image, map.get(modId));
    }
    return iconMap;
}
Also used : MOD_IDENTIFIER(eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER) XLinkedMap(main.data.XLinkedMap) PHASE_TYPE(main.system.graphics.AnimPhase.PHASE_TYPE)

Example 4 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class ActionAnimation method drawCosts.

protected boolean drawCosts(AnimPhase phase) {
    int base = getDefaultIconMapOffsetY();
    boolean invert = false;
    Boolean edge;
    boolean positive;
    if (getTarget() == source || phase.isDrawOnSource()) {
        edge = game.getBattleField().getGrid().isOnEdgeY(source.getCoordinates());
        // TODO
        positive = BooleanMaster.isTrue(edge) || edge == null;
        base = getOffsetBase(positive);
        if (base < 0) {
            invert = true;
        }
    }
    if (getTarget().getCoordinates().isAdjacent(source.getCoordinates())) {
        if (PositionMaster.inLine(source, target)) {
            if (PositionMaster.isAbove(target, source)) {
                invert = true;
            }
            if (PositionMaster.isAbove(source, target)) {
                invert = false;
            }
        }
    }
    Costs costs = (Costs) phase.getArgs()[0];
    Map<Image, String> map = new XLinkedMap<>();
    for (Cost s : costs.getCosts()) {
        if (s.isPaidAlt()) {
            s = s.getAltCost();
        }
        Formula formula = s.getPayment().getAmountFormula();
        PARAMETER param = s.getPayment().getParamToPay();
        Image image = ImageManager.getValueIcon(param);
        if (image == null) {
            continue;
        }
        String string = "" + (-s.getPayment().getLastPaid());
        map.put(image, string);
        List<String> list = new ArrayList<>();
        list.add(string);
        getSubPhaseTooltipMap().put(image, list);
    }
    drawIconMap(map, false, true, base, invert);
    return true;
}
Also used : Costs(main.elements.costs.Costs) XLinkedMap(main.data.XLinkedMap) Cost(main.elements.costs.Cost) Formula(main.system.math.Formula) PARAMETER(main.content.values.parameters.PARAMETER)

Example 5 with XLinkedMap

use of main.data.XLinkedMap in project Eidolons by IDemiurge.

the class OptionsMaster method readOptions.

public static Map<OPTIONS_GROUP, Options> readOptions(String data) {
    Document doc = XML_Converter.getDoc(data);
    Map<OPTIONS_GROUP, Options> optionsMap = new XLinkedMap<>();
    for (Node sub : XML_Converter.getNodeListFromFirstChild(doc, true)) {
        OPTIONS_GROUP group = OPTIONS_GROUP.valueOf(sub.getNodeName());
        Options options = createOptions(group, sub);
        if (options != null)
            optionsMap.put(group, options);
    }
    return optionsMap;
}
Also used : XLinkedMap(main.data.XLinkedMap) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document)

Aggregations

XLinkedMap (main.data.XLinkedMap)21 ObjType (main.entity.type.ObjType)11 PARAMETER (main.content.values.parameters.PARAMETER)4 Node (org.w3c.dom.Node)4 List (java.util.List)3 PROPERTY (main.content.values.properties.PROPERTY)3 Ref (main.entity.Ref)3 G_Panel (main.swing.generic.components.G_Panel)3 HC_PagedListPanel (eidolons.client.cc.gui.pages.HC_PagedListPanel)2 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)2 File (java.io.File)2 OBJ_TYPE (main.content.OBJ_TYPE)2 Coordinates (main.game.bf.Coordinates)2 MusicList (main.music.entity.MusicList)2 MusicListPanel (main.music.gui.MusicListPanel)2 Document (org.w3c.dom.Document)2 ClassTreeCondition (eidolons.ability.conditions.req.ClassTreeCondition)1 MultiClassCondition (eidolons.ability.conditions.req.MultiClassCondition)1 SkillPointCondition (eidolons.ability.conditions.req.SkillPointCondition)1 ValueGroupCondition (eidolons.ability.conditions.req.ValueGroupCondition)1