Search in sources :

Example 26 with PROPERTY

use of main.content.values.properties.PROPERTY in project Eidolons by IDemiurge.

the class BackgroundChoiceView method applyBackground.

private void applyBackground(Unit hero, ObjType bgType) {
    ObjType type = hero.getType();
    type.setProperty(G_PROPS.BASE_TYPE, bgType.getName());
    type.setProperty(G_PROPS.BACKGROUND_TYPE, bgType.getName());
    List<VALUE> backgroundParams = DC_ContentManager.getBackgroundStaticValues();
    for (VALUE v : backgroundParams) {
        if (v instanceof PARAMETER) {
            if (v.isWriteToType()) {
                hero.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
            } else {
                type.modifyParameter((PARAMETER) v, bgType.getIntParam((PARAMETER) v));
            }
        // type.multiplyParamByPercent((PARAMETER) v, 50, false);// TODO
        // feeble
        // fix!
        } else if (v instanceof PROPERTY) {
            type.setProperty((PROPERTY) v, bgType.getProperty((PROPERTY) v));
        }
    }
    hero.toBase();
}
Also used : ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) VALUE(main.content.VALUE) PARAMETER(main.content.values.parameters.PARAMETER)

Example 27 with PROPERTY

use of main.content.values.properties.PROPERTY in project Eidolons by IDemiurge.

the class Loader method createObjects.

private static List<Obj> createObjects(List<String> objectNodes) {
    DC_Game game = DC_Game.game;
    List<Obj> objects = new ArrayList<>();
    // TODO ID ORDER MUST BE PRESERVED! put in parameter?
    for (String typesNode : objectNodes) {
        Document node = XML_Converter.getDoc(typesNode);
        DC_TYPE TYPE = DC_TYPE.getType(node.getNodeName());
        for (Node subNode : XML_Converter.getNodeList(node)) {
            String sub = XML_Converter.getStringFromXML(subNode);
            game.setIdManager(new DC_IdManager(game));
            Map<PROPERTY, String> props = getPropsFromNode(sub);
            Map<PARAMETER, String> params = getParamsFromNode(sub);
            ObjType type = DataManager.getType(subNode.getNodeName(), TYPE);
            // preset ID?! init containers by id... including buffs; but first create them
            Ref ref = new Ref(game);
            Node refNode = XML_Converter.findNode(sub, Saver.OBJ_NODE);
            if (refNode != null)
                for (String substring : StringMaster.open(refNode.getTextContent())) {
                    ref.setValue(KEYS.valueOf(substring.split("=")[0].toUpperCase()), substring.split("=")[1]);
                }
            String ownerName = null;
            DC_Player owner = game.getBattleMaster().getPlayerManager().getPlayer(// property?
            ownerName);
            if (owner == null) {
                owner = DC_Player.NEUTRAL;
            }
            Coordinates c = new Coordinates(params.get(G_PARAMS.POS_X) + "-" + params.get(G_PARAMS.POS_Y));
            Obj object = createObj(type, c.x, c.y, owner, game, ref);
            object.getPropMap().putAll(props);
            object.getParamMap().putAll(params);
            object.setId(StringMaster.getInteger(props.get(G_PROPS.ID)));
            objects.add(object);
            init(object);
        }
    }
    return objects;
}
Also used : DC_TYPE(main.content.DC_TYPE) PROPERTY(main.content.values.properties.PROPERTY) Node(org.w3c.dom.Node) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) DC_Game(eidolons.game.core.game.DC_Game) Document(org.w3c.dom.Document) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player) Ref(main.entity.Ref) DC_IdManager(eidolons.entity.DC_IdManager) ObjType(main.entity.type.ObjType) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) DC_JewelryObj(eidolons.entity.item.DC_JewelryObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) Obj(main.entity.obj.Obj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 28 with PROPERTY

use of main.content.values.properties.PROPERTY in project Eidolons by IDemiurge.

the class Loader method getPropsFromNode.

private static Map<PROPERTY, String> getPropsFromNode(String sub) {
    Node node = XML_Converter.findNode(sub, TypeBuilder.PROPS_NODE);
    Map<PROPERTY, String> map = new XLinkedMap<>();
    XML_Converter.getNodeList(node).forEach(subNode -> {
        PROPERTY prop = ContentManager.getPROP(subNode.getNodeName());
        String value = subNode.getTextContent();
        map.put(prop, value);
    });
    return map;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) XLinkedMap(main.data.XLinkedMap) Node(org.w3c.dom.Node)

Example 29 with PROPERTY

use of main.content.values.properties.PROPERTY in project Eidolons by IDemiurge.

the class Saver method getObjNodeXml.

private static String getObjNodeXml(DC_GameState state) {
    StringBuilder builder = new StringBuilder(80000);
    builder.append(XML_Converter.openXml(OBJ_NODE));
    for (OBJ_TYPE TYPE : state.getObjMaps().keySet()) {
        if (state.getObjMaps().get(TYPE).isEmpty())
            continue;
        builder.append(XML_Converter.openXml(TYPE.getName()));
        for (Integer id : state.getObjMaps().get(TYPE).keySet()) {
            Obj obj = state.getObjMaps().get(TYPE).get(id);
            obj.setProperty(G_PROPS.ID, id + "");
            builder.append(XML_Converter.openXmlFormatted(obj.getName()));
            builder.append(XML_Converter.openXml(PROPS_NODE));
            for (PROPERTY property : obj.getPropMap().keySet()) {
                if (property.isDynamic() || !obj.getProperty(property).equals(obj.getType().getProperty(property))) {
                    // only write values that aren't at base
                    builder.append(XML_Formatter.getValueNode(obj, property));
                }
            }
            builder.append(XML_Converter.closeXml(PROPS_NODE));
            builder.append(XML_Converter.openXml(PARAMS_NODE));
            for (PARAMETER parameter : obj.getParamMap().keySet()) {
                if (parameter.isDynamic() || !obj.getParam(parameter).equals(obj.getType().getParam(parameter))) {
                    // only write values that aren't at base
                    builder.append(XML_Formatter.getValueNode(obj, parameter));
                }
            }
            builder.append(XML_Converter.closeXml(PARAMS_NODE));
            // REF !
            builder.append(XML_Converter.closeXmlFormatted(obj.getName()));
        }
        builder.append(XML_Converter.closeXml(TYPE.getName()));
    }
    builder.append(XML_Converter.closeXml(OBJ_NODE));
    return builder.toString();
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) Obj(main.entity.obj.Obj) PROPERTY(main.content.values.properties.PROPERTY) PARAMETER(main.content.values.parameters.PARAMETER)

Example 30 with PROPERTY

use of main.content.values.properties.PROPERTY in project Eidolons by IDemiurge.

the class TextMaster method extractTypeText.

private static void extractTypeText() {
    DC_Engine.fullInit();
    int i = 0;
    for (OBJ_TYPE k : extractedTypes) {
        List<String> value = null;
        if (extractedTypeGroups.length > i) {
            value = StringMaster.openContainer(extractedTypeGroups[i]);
        }
        extractedTypesMap.put(k, value);
        i++;
    }
    for (PROPERTY prop : extract_props) {
        for (OBJ_TYPE t : extractedTypesMap.keySet()) {
            List<String> list = extractedTypesMap.get(t);
            if (list == null) {
                extractTypeText(t, null, prop);
            } else {
                for (String c : list) {
                    extractTypeText(t, c, prop);
                }
            }
        }
    }
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) PROPERTY(main.content.values.properties.PROPERTY)

Aggregations

PROPERTY (main.content.values.properties.PROPERTY)57 PARAMETER (main.content.values.parameters.PARAMETER)23 ObjType (main.entity.type.ObjType)17 OBJ_TYPE (main.content.OBJ_TYPE)6 ArrayList (java.util.ArrayList)5 VALUE (main.content.VALUE)5 Ref (main.entity.Ref)5 DC_TYPE (main.content.DC_TYPE)4 Node (org.w3c.dom.Node)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)3 Unit (eidolons.entity.obj.unit.Unit)3 XLinkedMap (main.data.XLinkedMap)3 Obj (main.entity.obj.Obj)3 EnumMaster (main.system.auxiliary.EnumMaster)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)2 File (java.io.File)2 List (java.util.List)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 MOD_PROP_TYPE (main.ability.effects.Effect.MOD_PROP_TYPE)2