Search in sources :

Example 6 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class UpkeepRule method addUpkeep.

public static void addUpkeep(Obj payObj) {
    Obj spell = payObj.getRef().getObj(KEYS.ACTIVE);
    if (spell == null) {
        return;
    }
    Obj abil = payObj.getRef().getObj(KEYS.ABILITY);
    if (abil != null) {
        if (abil instanceof PassiveAbilityObj) {
            return;
        }
    }
    String property = spell.getProperty(PROPS.UPKEEP_FAIL_ACTION);
    if (new EnumMaster<UPKEEP_FAIL_ACTION>().retrieveEnumConst(UPKEEP_FAIL_ACTION.class, property) == null) {
        property = UPKEEP_FAIL_ACTION.DEATH + "";
    }
    payObj.setProperty(PROPS.UPKEEP_FAIL_ACTION, property);
    for (PARAMETER p : ValuePages.UPKEEP_PARAMETERS) {
        Integer param = spell.getIntParam(p);
        if (param > 0) {
            payObj.getType().setParam(p, param);
        }
    }
}
Also used : UPKEEP_FAIL_ACTION(main.ability.effects.Effect.UPKEEP_FAIL_ACTION) EnumMaster(main.system.auxiliary.EnumMaster) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 7 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class LocationBuilder method constructBlock.

@Refactor
public static // TODO the way it's done, we can't have Structures in non-Location dungeons!!!
MapBlock constructBlock(Node node, int id, MapZone zone, DungeonPlan map, Dungeon dungeon) {
    List<Coordinates> coordinates = new ArrayList<>();
    Map<Coordinates, ? extends Obj> objectMap = new HashMap<>();
    MapBlock b = new MapBlock(id, null, zone, map, coordinates);
    // TODO b-data, coordinates, objects
    for (Node subNode : XML_Converter.getNodeList(node)) {
        if (StringMaster.compareByChar(subNode.getNodeName(), COORDINATES_NODE)) {
            coordinates = CoordinatesMaster.getCoordinatesFromString(subNode.getTextContent());
        } else if (StringMaster.compareByChar(subNode.getNodeName(), OBJ_NODE)) {
            // TODO BETTER IN TYPES?
            objectMap = DC_ObjInitializer.initMapBlockObjects(dungeon, b, subNode.getTextContent());
        // TODO encounters?
        } else {
            // BLOCK TYPE
            if (StringMaster.compareByChar(subNode.getNodeName(), BLOCK_TYPE_NODE)) {
                BLOCK_TYPE type = new EnumMaster<BLOCK_TYPE>().retrieveEnumConst(BLOCK_TYPE.class, subNode.getTextContent());
                b.setType(type);
            }
            if (StringMaster.compareByChar(subNode.getNodeName(), ROOM_TYPE_NODE)) {
                ROOM_TYPE type = new EnumMaster<ROOM_TYPE>().retrieveEnumConst(ROOM_TYPE.class, subNode.getTextContent());
                b.setRoomType(type);
            }
        }
    }
    b.setCoordinates(coordinates);
    if (objectMap == null) {
        return b;
    }
    b.getMap().putAll(objectMap);
    b.getObjects().addAll(objectMap.values());
    return b;
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) Coordinates(main.game.bf.Coordinates) Node(org.w3c.dom.Node) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock) Refactor(main.system.util.Refactor)

Example 8 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class ArenaPositioner method getCoordinatesForUnitGroup.

public List<ObjAtCoordinate> getCoordinatesForUnitGroup(List<ObjType> presetGroupTypes, Wave wave, int unitLevel) {
    Map<Coordinates, ObjType> map = new LinkedHashMap<>();
    boolean custom = false;
    Coordinates presetCenterCoordinate = wave.getCoordinates();
    if (wave.isPresetCoordinate()) {
        if (presetCenterCoordinate != null) {
            custom = isAutoOptimalFacing();
        }
    }
    if (wave.getBlock() != null) {
    // TODO return
    // getCoordinatesForUnitGroupInMapBlock(presetGroupTypes, wave,
    // wave.getBlock());
    }
    if (forcedSide != null) {
        side = forcedSide;
    // forcedSide = null;
    } else {
        side = new EnumMaster<FACING_DIRECTION>().retrieveEnumConst(FACING_DIRECTION.class, wave.getProperty(PROPS.SPAWNING_SIDE));
        if (side == null) {
            nextSide();
        }
    }
    unitGroups.put(side, map);
    int maxUnitsPerRow = getMaxUnitsPerRow(side);
    List<Coordinates> list = getCoordinatesForUnits(presetGroupTypes, custom, presetCenterCoordinate, maxUnitsPerRow);
    List<ObjAtCoordinate> group = new ArrayList<>();
    int i = 0;
    for (Coordinates c : list) {
        ObjType type = new ObjType(presetGroupTypes.get(i));
        type.getGame().initType(type);
        i++;
        if (unitLevel > 0) {
            type = new UnitLevelManager().getLeveledType(type, unitLevel, false);
        }
        ObjAtCoordinate objAtCoordinate = new ObjAtCoordinate(type, c);
        group.add(objAtCoordinate);
    }
    return group;
}
Also used : ObjAtCoordinate(main.entity.type.ObjAtCoordinate) Coordinates(main.game.bf.Coordinates) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) UnitLevelManager(eidolons.client.cc.logic.UnitLevelManager) ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster)

Example 9 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class ItemGenerator method generateItemType.

@Override
public ObjType generateItemType(String typeName, OBJ_TYPE type) {
    if (type == (DC_TYPE.JEWELRY)) {
        if (ItemGenerator.isJewelryOn())
            return generateJewelry(typeName);
        return null;
    }
    if (type == (DC_TYPE.ITEMS)) {
    // return getOrCreateItem(typeName);
    }
    // TODO generic C_TYPE for armor?
    boolean weapon = type.equals(DC_TYPE.WEAPONS);
    // String baseTypeName = typeName;
    String name = StringMaster.getFirstItem(typeName, " ");
    QUALITY_LEVEL quality = new EnumMaster<QUALITY_LEVEL>().retrieveEnumConst(QUALITY_LEVEL.class, name);
    if (quality != null)
        typeName = typeName.replace(quality.toString(), "").trim();
    else
        quality = QUALITY_LEVEL.NORMAL;
    name = StringMaster.getFirstItem(typeName, " ");
    MATERIAL material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name, true, false);
    if (material == null) {
        name = name + StringMaster.getFirstItem(typeName.replace(name, "").trim(), " ");
        material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name);
    }
    if (material == null) {
        return null;
    }
    typeName = typeName.replace(material.toString(), "").trim();
    ObjType baseType = DataManager.getType(typeName, type, true);
    if (baseType == null)
        return null;
    return generateItem(weapon, quality, material, baseType);
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) ObjType(main.entity.type.ObjType) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 10 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class ItemGenerator method generateJewelry.

public ObjType generateJewelry(String typeName) {
    String string = StringMaster.getFirstItem(typeName, " ");
    MAGICAL_ITEM_LEVEL itemLevel = new EnumMaster<MAGICAL_ITEM_LEVEL>().retrieveEnumConst(MAGICAL_ITEM_LEVEL.class, string);
    typeName = typeName.replaceFirst(string + " ", "");
    ObjType objType = null;
    for (ObjType type : baseJewelryTypes) {
        if (typeName.contains(type.getName())) {
            objType = type;
            typeName = typeName.replaceFirst(type.getName(), "");
            break;
        }
    }
    JEWELRY_ITEM_TRAIT trait = new EnumMaster<JEWELRY_ITEM_TRAIT>().retrieveEnumConst(JEWELRY_ITEM_TRAIT.class, typeName);
    if (trait == null) {
        typeName = VariableManager.removeVarPart(typeName).replaceFirst("of", "").trim();
        trait = new EnumMaster<JEWELRY_ITEM_TRAIT>().retrieveEnumConst(JEWELRY_ITEM_TRAIT.class, typeName);
    }
    return generateJewelryItem(objType, trait, itemLevel);
}
Also used : ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster)

Aggregations

EnumMaster (main.system.auxiliary.EnumMaster)28 ObjType (main.entity.type.ObjType)10 Unit (eidolons.entity.obj.unit.Unit)4 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)3 ArrayList (java.util.ArrayList)3 PROPERTY (main.content.values.properties.PROPERTY)3 ListChooser (main.swing.generic.components.editors.lists.ListChooser)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RULE_SCOPE (eidolons.game.battlecraft.rules.RuleMaster.RULE_SCOPE)2 GAMEPLAY_OPTION (eidolons.system.options.GameplayOptions.GAMEPLAY_OPTION)2 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)2 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)2 Coordinates (main.game.bf.Coordinates)2 Color (com.badlogic.gdx.graphics.Color)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Align (com.badlogic.gdx.utils.Align)1 DC_Effect (eidolons.ability.effects.DC_Effect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 AbilityEffect (eidolons.ability.effects.containers.AbilityEffect)1 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)1