Search in sources :

Example 1 with DC_FeatObj

use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.

the class Unit method saveRanks.

public void saveRanks(DequeImpl<DC_FeatObj> container, PROPERTY property) {
    String value = "";
    for (DC_FeatObj featObj : container) {
        value += featObj.getName();
        if (featObj.getIntParam(PARAMS.RANK) > 0) {
            value += StringMaster.wrapInParenthesis(featObj.getParam(PARAMS.RANK));
        }
        value += ";";
    }
    setProperty(property, value, true);
}
Also used : DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj)

Example 2 with DC_FeatObj

use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.

the class UnitInitializer method initFeatContainer.

// TODO reqs: save() ; modify() ; resetSkillRanks() for (s s : skills)
public void initFeatContainer(PROPERTY PROP, DC_TYPE TYPE, DequeImpl<DC_FeatObj> list) {
    // TODO make it dynamic and clean!
    List<String> feats = StringMaster.openContainer(getProperty(PROP));
    for (String feat : feats) {
        DC_FeatObj featObj = null;
        int rank = 0;
        // or special separator!
        if (StringMaster.isInteger(StringMaster.cropParenthesises(VariableManager.getVarPart(feat)))) {
            rank = StringMaster.getInteger(StringMaster.cropParenthesises(VariableManager.getVarPart(feat)));
            feat = VariableManager.removeVarPart(feat);
        }
        ObjType featType = DataManager.getType(feat, TYPE);
        if (game.isSimulation()) {
            featObj = (DC_FeatObj) getGame().getSimulationObj(getEntity(), featType, PROP);
        }
        if (featObj == null) {
            try {
                featObj = new DC_FeatObj(featType, getEntity().getOriginalOwner(), getGame(), getRef());
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
                continue;
            }
            if (game.isSimulation()) {
                getGame().addSimulationObj(getEntity(), featType, featObj, PROP);
            }
        }
        if (rank != 0) {
            featObj.setParam(PARAMS.RANK, rank);
        }
        list.add(featObj);
    }
}
Also used : DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) ObjType(main.entity.type.ObjType) ExpressionParseException(com.graphbuilder.math.ExpressionParseException)

Example 3 with DC_FeatObj

use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.

the class UnitResetter method resetRanks.

public void resetRanks(DequeImpl<DC_FeatObj> container, PROPERTY property) {
    List<DC_FeatObj> list = new ArrayList<>(container);
    for (String feat : StringMaster.open(getProperty(property))) {
        Integer rank = StringMaster.getInteger(VariableManager.getVarPart(feat));
        if (rank == 0) {
            continue;
        }
        feat = (VariableManager.removeVarPart(feat));
        for (DC_FeatObj featObj : container) {
            if (!featObj.getName().equals(feat)) {
                continue;
            }
            featObj.setParam(PARAMS.RANK, rank);
            list.remove(featObj);
        }
    }
    for (DC_FeatObj featObj : list) {
        featObj.setParam(PARAMS.RANK, 0);
    }
}
Also used : DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) ArrayList(java.util.ArrayList)

Example 4 with DC_FeatObj

use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.

the class ClassTreeCondition method check.

@Override
public boolean check(Ref ref) {
    ObjType type = DataManager.getType(className, DC_TYPE.CLASSES);
    if (type == null) {
        return true;
    }
    Unit hero = (Unit) ref.getSourceObj();
    for (DC_FeatObj c : hero.getClasses()) {
        if (c.getType().equals(type)) {
            return true;
        }
        if (c.getProperty(G_PROPS.CLASS_GROUP).equalsIgnoreCase(type.getProperty(G_PROPS.CLASS_GROUP))) {
            if (c.getIntParam(PARAMS.CIRCLE) >= type.getIntParam(PARAMS.CIRCLE)) {
                return false;
            }
        }
    }
    return true;
}
Also used : DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) ObjType(main.entity.type.ObjType) Unit(eidolons.entity.obj.unit.Unit)

Example 5 with DC_FeatObj

use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.

the class DC_ActionManager method checkSetFeatRef.

private void checkSetFeatRef(DC_UnitAction action) {
    DequeImpl<DC_FeatObj> skills = new DequeImpl<>(action.getOwnerObj().getSkills());
    skills.addAll(action.getOwnerObj().getClasses());
    for (DC_FeatObj s : skills) {
        if (StringMaster.contains(s.getProperty(G_PROPS.ACTIVES), action.getName())) {
            action.getRef().setID(KEYS.SKILL, s.getId());
            return;
        }
    }
}
Also used : DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) DequeImpl(main.system.datatypes.DequeImpl)

Aggregations

DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)11 ObjType (main.entity.type.ObjType)3 ArrayList (java.util.ArrayList)2 ExpressionParseException (com.graphbuilder.math.ExpressionParseException)1 PROPS (eidolons.content.PROPS)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 Unit (eidolons.entity.obj.unit.Unit)1 G_PROPS (main.content.values.properties.G_PROPS)1 ListItem (main.swing.generic.components.list.ListItem)1 DequeImpl (main.system.datatypes.DequeImpl)1 Before (org.junit.Before)1