Search in sources :

Example 61 with Obj

use of main.entity.obj.Obj 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 62 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class StateCloner method cloneMaps.

private void cloneMaps(DC_GameState state, DC_GameState clone) {
    for (OBJ_TYPE TYPE : state.getObjMaps().keySet()) {
        Map<Integer, Obj> cloneMap = getObjMap();
        Map<Integer, Obj> map = state.getObjMaps().get(TYPE);
        if (map == null) {
            continue;
        }
        for (Obj e : map.values()) {
            Obj cloneObj = cloneObj(e);
            cloneMap.put(cloneObj.getId(), cloneObj);
        }
        clone.getObjMaps().put(TYPE, cloneMap);
    }
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) 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_SpellObj(eidolons.entity.active.DC_SpellObj) Obj(main.entity.obj.Obj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) PassiveAbilityObj(main.ability.PassiveAbilityObj)

Example 63 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class StateCloner method cloneObj.

private Obj cloneObj(Obj e) {
    // TODO only modified values? compare with type? ONLY DYNAMIC!
    Obj clone = getInstance(e);
    clone.setId(e.getId());
    clone.reset();
    copyDynamicValues(e, clone);
    return clone;
}
Also used : 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_SpellObj(eidolons.entity.active.DC_SpellObj) Obj(main.entity.obj.Obj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) PassiveAbilityObj(main.ability.PassiveAbilityObj)

Example 64 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class StateCloner method cloneAttachments.

private void cloneAttachments(DC_GameState state, DC_GameState clone) {
    state.getAttachments().forEach(attachment -> {
        Attachment a = cloneAttachment(attachment);
        clone.getAttachments().add(a);
        Obj basis = a.getBasis();
        if (basis != null) {
            MapMaster.addToListMap(clone.getAttachmentsMap(), basis, a);
        }
    });
}
Also used : 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_SpellObj(eidolons.entity.active.DC_SpellObj) Obj(main.entity.obj.Obj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) PassiveAbilityObj(main.ability.PassiveAbilityObj) Attachment(main.entity.obj.Attachment)

Example 65 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class DC_Game method exit.

public void exit(boolean mainMenu) throws InterruptedException {
    // TODO review this! only for arcade-game, btw!
    stop();
    // dungeonMaster.setDungeon(null);
    getManager().setSelectedInfoObj(null);
    WaitRule.reset();
    for (Obj obj : getObjects(DC_TYPE.BUFFS)) {
        BuffObj buff = (BuffObj) obj;
        if (buff.isDispelable() || !buff.isPermanent()) {
            buff.kill();
        }
    }
    state.reset();
    logManager.clear();
    for (Obj obj : getUnits()) {
        if (!obj.getOriginalOwner().isMe()) {
            obj.kill(obj, false, true);
        }
        if (!mainMenu && obj.getOwner().isMe()) {
            continue;
        }
        state.removeObject(obj.getId());
    }
    if (mainMenu) {
        getMaster().clear();
    }
    for (Obj obj : getCells()) {
        obj.kill(obj, false, true);
        state.removeObject(obj.getId());
    }
}
Also used : DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) MicroObj(main.entity.obj.MicroObj) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) BuffObj(main.entity.obj.BuffObj)

Aggregations

Obj (main.entity.obj.Obj)127 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)34 DC_Obj (eidolons.entity.obj.DC_Obj)30 Coordinates (main.game.bf.Coordinates)27 Unit (eidolons.entity.obj.unit.Unit)24 ArrayList (java.util.ArrayList)19 Ref (main.entity.Ref)15 DC_SpellObj (eidolons.entity.active.DC_SpellObj)14 BuffObj (main.entity.obj.BuffObj)13 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)12 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)11 ActiveObj (main.entity.obj.ActiveObj)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)9 PassiveAbilityObj (main.ability.PassiveAbilityObj)9 ObjType (main.entity.type.ObjType)8 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)7 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)7 PARAMETER (main.content.values.parameters.PARAMETER)7 Conditions (main.elements.conditions.Conditions)6 MicroObj (main.entity.obj.MicroObj)6