use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class ModifyPropertyEffect method applyThis.
@Override
public boolean applyThis() {
map = new XLinkedMap<>();
boolean result = true;
Obj obj = ref.getObj(KEYS.TARGET);
if (obj == null) {
return false;
}
switch(modtype) {
case ADD:
result = obj.addProperty(prop, value);
break;
case REMOVE:
result = obj.removeProperty(prop, value);
break;
case SET:
obj.setProperty(prop, value);
break;
default:
break;
}
if (result) {
if (!isAnimationDisabled()) {
if (getAnimation() != null) {
map.put(prop, ListMaster.toList(modtype, value));
// if (!isContinuousWrapped()) {
getAnimation().addPhaseArgs(PHASE_TYPE.PROP_MODS, map);
// } else
// wrapInBuffPhase(map);
}
}
}
return true;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class CellCondition method getCoordinates.
@Override
protected Coordinates getCoordinates(Ref ref) {
if (obj_ref == null) {
obj_ref = KEYS.MATCH.toString();
}
if (direction == null) {
return super.getCoordinates(ref);
}
Obj obj = ref.getObj(obj_ref);
FACING_DIRECTION f = null;
if (obj instanceof DC_UnitModel) {
f = ((DC_UnitModel) obj).getFacing();
}
if (f == null) {
return null;
}
return super.getCoordinates(ref).getAdjacentCoordinate(DirectionMaster.getDirectionByFacing(f, direction));
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class LogManager method logStdRoll.
public void logStdRoll(Ref ref, int greater, int randomInt, int than, int randomInt2, ROLL_TYPES roll_type) {
Obj source = ref.getSourceObj();
Obj target = ref.getEvent().getRef().getTargetObj();
boolean fail = randomInt2 > randomInt;
String rollTarget = target.getNameIfKnown() + ((fail) ? " fails" : " wins") + " a " + roll_type.getName() + " roll with " + randomInt + " out of " + greater;
String rollSource = source.getNameIfKnown() + "'s " + randomInt2 + " out of " + than;
String string = rollTarget + " vs " + rollSource;
if (!target.getOwner().isMe()) {
fail = !fail;
}
if (fail) {
string = StringMaster.MESSAGE_PREFIX_FAIL + string;
} else {
string = StringMaster.MESSAGE_PREFIX_SUCCESS + string;
}
log(string);
}
use of main.entity.obj.Obj 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);
}
}
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class UpkeepRule method enactUpkeepFail.
public void enactUpkeepFail(UPKEEP_FAIL_ACTION ufa, Ref ref) {
Obj targetObj = ref.getTargetObj();
if (targetObj instanceof BuffObj) {
BuffObj buffObj = (BuffObj) targetObj;
ref.setTarget(buffObj.getBasis().getId());
new RemoveBuffEffect(targetObj.getName()).apply(ref);
ref.getGame().getLogManager().log(targetObj.getName() + " " + BUFF_DISPELLED_STRING);
return;
}
ref.getGame().getLogManager().log(targetObj.getName() + " " + ufa.getLogString());
// TODO enemy string should be different!
Effect e = getFailEffects(ufa);
e.apply(ref);
}
Aggregations