Search in sources :

Example 1 with ActionType

use of main.entity.type.ActionType in project Eidolons by IDemiurge.

the class ActionGenerator method generateOffhandActions.

public static void generateOffhandActions(ACTION_TYPE action_type) {
    for (ObjType type : DataManager.getTypesGroup(DC_TYPE.ACTIONS, "" + action_type)) {
        if (StringMaster.contains(type.getProperty(G_PROPS.ACTION_TAGS), ActionEnums.ACTION_TAGS.MAIN_HAND + "")) {
            ActionType offHandType = new ActionType(type);
            offHandType.addProperty(G_PROPS.ACTION_TAGS, StringMaster.getWellFormattedString(ActionEnums.ACTION_TAGS.OFF_HAND + ""));
            offHandType.removeProperty(G_PROPS.ACTION_TAGS, StringMaster.getWellFormattedString(ActionEnums.ACTION_TAGS.MAIN_HAND + ""));
            // 
            offHandType.setName(getOffhandActionName(type.getName()));
            offHandType.addProperty(G_PROPS.ACTION_TAGS, getOffhandActionName(type.getName()));
            DataManager.addType(offHandType);
        }
    }
}
Also used : ActionType(main.entity.type.ActionType) ObjType(main.entity.type.ObjType)

Example 2 with ActionType

use of main.entity.type.ActionType in project Eidolons by IDemiurge.

the class DC_ActionManager method init.

public static void init() {
    stdActionTypes = new ArrayList<>();
    for (STD_ACTIONS name : STD_ACTIONS.values()) {
        if (!(DataManager.getType(StringMaster.getWellFormattedString(name.name()), DC_TYPE.ACTIONS) instanceof ActionType)) {
            continue;
        }
        ObjType type = DataManager.getType(StringMaster.getWellFormattedString(name.name()), DC_TYPE.ACTIONS);
        stdActionTypes.add(type);
    }
    modeActionTypes = new ArrayList<>();
    for (STD_MODE_ACTIONS name : STD_MODE_ACTIONS.values()) {
        ObjType type = DataManager.getType(StringMaster.getWellFormattedString(name.name()), DC_TYPE.ACTIONS);
        modeActionTypes.add(type);
    }
    orderActionTypes = new ArrayList<>();
    for (STD_ORDER_ACTIONS type : STD_ORDER_ACTIONS.values()) {
        ObjType actionType = DataManager.getType(StringMaster.getWellFormattedString(type.toString()), DC_TYPE.ACTIONS);
        orderActionTypes.add(actionType);
    }
    hiddenActions = new ArrayList<>();
    for (HIDDEN_ACTIONS name : HIDDEN_ACTIONS.values()) {
        ObjType type = DataManager.getType(StringMaster.getWellFormattedString(name.name()), DC_TYPE.ACTIONS);
        hiddenActions.add(type);
    }
}
Also used : ActionType(main.entity.type.ActionType) ObjType(main.entity.type.ObjType)

Example 3 with ActionType

use of main.entity.type.ActionType in project Eidolons by IDemiurge.

the class DC_ActionManager method newAction.

@Override
public DC_UnitAction newAction(String typeName, Entity entity) {
    Map<String, ActiveObj> map = actionsCache.get(entity);
    if (map == null) {
        map = new HashMap<>();
        actionsCache.put(entity, map);
    }
    if (map.get(typeName) != null) {
        return (DC_UnitAction) map.get(typeName);
    }
    ActionType type = (ActionType) DataManager.getType(typeName, DC_TYPE.ACTIONS);
    if (type == null) {
        LogMaster.log(1, "no such active: " + typeName);
        return null;
    }
    Ref ref = Ref.getCopy(entity.getRef());
    return newAction(type, ref, entity.getOwner(), game);
}
Also used : Ref(main.entity.Ref) ActiveObj(main.entity.obj.ActiveObj) ActionType(main.entity.type.ActionType)

Example 4 with ActionType

use of main.entity.type.ActionType in project Eidolons by IDemiurge.

the class DC_ActionManager method generateModeAction.

private DC_UnitAction generateModeAction(STD_ACTION_MODES mode, DC_ActiveObj baseAction) {
    ActionType type = new ActionType(baseAction.getType());
    if (mode.getAddPropMap() != null) {
        for (String s : mode.getAddPropMap().keySet()) {
            type.addProperty(s, mode.getAddPropMap().get(s));
        }
    }
    if (mode.getSetPropMap() != null) {
        for (String s : mode.getSetPropMap().keySet()) {
            type.setProperty(s, mode.getSetPropMap().get(s));
        }
    }
    if (mode.getParamBonusMap() != null) {
        for (String s : mode.getParamBonusMap().keySet()) {
            // type.setModifierKey(mode.getName());
            type.modifyParameter(s, mode.getParamBonusMap().get(s));
        }
    }
    if (mode.getParamModMap() != null) {
        for (String s : mode.getParamModMap().keySet()) {
            PARAMETER param = ContentManager.getPARAM(s);
            if (type.getIntParam(param) == 0) {
                type.setParam(param, param.getDefaultValue());
            }
            type.modifyParamByPercent(param, StringMaster.getInteger(mode.getParamModMap().get(s)), false);
        }
    }
    if (mode != STD_ACTION_MODES.STANDARD) {
        type.setName(mode.getPrefix() + baseAction.getName());
    }
    DC_UnitAction subAction = newAction(type, new Ref(baseAction.getOwnerObj()), baseAction.getOwner(), game);
    // TODO not all!..
    subAction.setActionType(ActionEnums.ACTION_TYPE.HIDDEN);
    subAction.setActionTypeGroup(ActionEnums.ACTION_TYPE_GROUPS.HIDDEN);
    return subAction;
}
Also used : Ref(main.entity.Ref) ActionType(main.entity.type.ActionType) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

ActionType (main.entity.type.ActionType)4 Ref (main.entity.Ref)2 ObjType (main.entity.type.ObjType)2 PARAMETER (main.content.values.parameters.PARAMETER)1 ActiveObj (main.entity.obj.ActiveObj)1