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;
// }
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations