Search in sources :

Example 21 with Obj

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

the class Ref method getObj.

public Obj getObj(String string) {
    if (objCache != null) {
        Obj obj = objCache.get(string.toLowerCase());
        if (obj == null)
            obj = game.getObjectById(getId(string));
        objCache.put(string.toLowerCase(), obj);
        return obj;
    }
    // try {
    return game.getObjectById(getId(string));
// } catch (Exception e) {
// main.system.ExceptionMaster.printStackTrace(e);
// return null;
// }
}
Also used : ActiveObj(main.entity.obj.ActiveObj) Obj(main.entity.obj.Obj)

Example 22 with Obj

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

the class PathingManager method checkCoordinatesForObj.

public void checkCoordinatesForObj(List<Obj> list, Coordinates c, int i, int j, boolean cell) {
    Coordinates c1 = new Coordinates(c.x + i, c.y + j);
    Obj obj = null;
    try {
        obj = (cell) ? getCell(c1) : getObj(c1);
    } catch (Exception e) {
    }
    if (obj != null) {
        list.add(obj);
    }
}
Also used : Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates)

Example 23 with Obj

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

the class StateManager method addObject.

public void addObject(Obj obj) {
    state.objMap.put(obj.getId(), obj);
    OBJ_TYPE TYPE = obj.getOBJ_TYPE_ENUM();
    if (TYPE == null) {
        LogMaster.log(1, obj.toString() + " has no TYPE!");
        return;
    }
    Map<Integer, Obj> map = state.getObjMaps().get(TYPE);
    if (map == null) {
        return;
    }
    // if (!map.containsValue(obj))
    map.put(obj.getId(), obj);
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) Obj(main.entity.obj.Obj)

Example 24 with Obj

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

the class BfAnalyzer method checkCells.

public Obj checkCells(Obj targetUnit, Collection<Obj> set, boolean canMove) {
    double cost = Double.MAX_VALUE;
    Obj cell = null;
    for (Obj adjCell : set) {
        if (canMove) {
            if (!movementManager.canMove(getAi().getUnit(), adjCell)) {
                LogMaster.log(LogMaster.AI_DEBUG, ai.getLogic().getUnit() + " can't move to " + adjCell);
                continue;
            }
        }
        Path path = movementManager.getPath(targetUnit, adjCell);
        if (path == null) {
            LogMaster.log(LogMaster.AI_DEBUG, ai.getLogic().getUnit() + " has no path to " + adjCell);
            continue;
        }
        if (cost > path.getCost()) {
            cost = path.getCost();
            cell = adjCell;
        }
    }
    return cell;
}
Also used : Path(main.game.bf.pathing.Path) Obj(main.entity.obj.Obj)

Example 25 with Obj

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

the class AddBuffEffect method getBuffTypeLazily.

public BuffType getBuffTypeLazily() {
    if (buffType != null) {
        return buffType;
    }
    this.buffType = (BuffType) DataManager.getType(getBuffTypeName(), DC_TYPE.BUFFS);
    if (buffType == null) {
        if (getBuffTypeName() == null) {
            return new BuffType();
        }
        boolean invisible = getBuffTypeName().contains(StringMaster.INVISIBLE_BUFF_CODE);
        if (TextParser.checkHasRefs(getBuffTypeName())) {
            ref.setID(KEYS.INFO, ref.getId(KEYS.ABILITY));
            String parsedName = TextParser.parse(getBuffTypeName(), ref, TextParser.BUFF_PARSING_CODE);
            setBuffTypeName(parsedName);
        }
        buffType = new BuffType(DataManager.getType(dummyBuffType, DC_TYPE.BUFFS));
        boolean empty = StringMaster.isEmpty(getBuffTypeName());
        if (!empty) {
            empty = StringMaster.isEmpty(getBuffTypeName().trim());
        }
        if (!empty) {
            empty = EMPTY_BUFF_NAME.equals(getBuffTypeName().trim());
        }
        if (empty) {
            setBuffTypeName(getActive().getName());
        }
        buffType.setProperty(G_PROPS.NAME, buffTypeName);
        Obj spell = ref.getObj(KEYS.SPELL);
        if (spell != null) {
            buffType.setProperty(G_PROPS.BUFF_TYPE, GenericEnums.BUFF_TYPE.SPELL.toString());
            if (spell.checkBool(GenericEnums.STD_BOOLS.NON_DISPELABLE)) {
                buffType.addProperty(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.NON_DISPELABLE.toString());
            }
            buffType.setImage(spell.getProperty(G_PROPS.IMAGE));
        }
        buffType.setImage(getActive().getProperty(G_PROPS.IMAGE));
        if (invisible) {
            buffType.addProperty(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.INVISIBLE_BUFF.toString());
        }
    // DataManager.addType(buffType); //what for?
    }
    return buffType;
}
Also used : BuffObj(main.entity.obj.BuffObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) BuffType(main.entity.type.BuffType)

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