use of eidolons.entity.obj.attach.DC_BuffObj in project Eidolons by IDemiurge.
the class EffectAnimation method drawBuff.
private boolean drawBuff(AnimPhase phase) {
// TODO boolean source,
for (Object arg : phase.getArgs()) {
if ((arg instanceof DC_BuffObj)) {
DC_BuffObj buff = (DC_BuffObj) arg;
Image image = buff.getIcon().getImage();
int y = 0;
drawOnTargetCenterX(image, y);
y += image.getHeight(null);
Color c = getDefaultTextColor();
if (buff.isNegative() != null) {
c = getColorForModifier(buff.isNegative() ? -1 : 1);
}
y += drawTextOnTarget(buff.getName(), MigMaster.getCenteredTextPosition(buff.getName(), font, w), y, c);
}
if (arg instanceof Map) {
// drawParamMap(phase);
// drawTextColumn(map, onSource);
}
}
for (Object arg : phase.getArgs()) {
}
return true;
}
use of eidolons.entity.obj.attach.DC_BuffObj in project Eidolons by IDemiurge.
the class BuffMaster method createBuff.
public BuffObj createBuff(BuffType type, Obj active, Player player, Ref ref, Effect effect, double duration, Condition retainCondition) {
ref = Ref.getCopy(ref);
if (type.getName().equals(BuffObj.DUMMY_BUFF_TYPE)) {
try {
String name = ref.getObj(KEYS.ACTIVE.name()).getName() + "'s buff";
String img = ref.getObj(KEYS.ACTIVE.name()).getProperty(G_PROPS.IMAGE);
type = new BuffType(type);
type.setProperty(G_PROPS.NAME, name);
type.setProperty(G_PROPS.IMAGE, img);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
Obj basis = game.getObjectById(ref.getBasis());
if (basis == null) {
return null;
}
DC_BuffObj buff = (DC_BuffObj) basis.getBuff(type.getName());
if (buff != null) {
if (!type.checkBool(GenericEnums.STD_BOOLS.STACKING) && !active.checkBool(GenericEnums.STD_BOOLS.STACKING)) {
basis.removeBuff(type.getName());
// TODO duration or do nothing
} else {
if (buff.isMaxStacks()) {
return buff;
}
buff.modifyParameter(PARAMS.BUFF_STACKS, 1);
}
} else {
// preCheck cache
}
buff = new DC_BuffObj(type, player, getGame(), ref, effect, duration, retainCondition);
buff.setActive(active);
// be careful!
buff.applyEffect();
buffCreated(buff, basis);
if (type.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU) || active.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU)) {
buff.setAppliedThrough(true);
if (basis instanceof Unit) {
Ref REF = ref.getCopy();
Obj cell = game.getCellByCoordinate(basis.getCoordinates());
if (!cell.hasBuff(buff.getName())) {
REF.setBasis(cell.getId());
REF.setTarget(cell.getId());
// copy buff
Effect copy = effect.getCopy();
if (copy == null) {
LogMaster.error("APPLY THRU ERROR: " + effect + " HAS NO CONSTRUCT");
} else {
createBuff(type, active, player, REF, copy, duration, retainCondition).setAppliedThrough(true);
}
}
}
}
return buff;
}
use of eidolons.entity.obj.attach.DC_BuffObj in project Eidolons by IDemiurge.
the class DC_BuffPanel method getData.
@Override
public Collection<DC_BuffObj> getData() {
if (obj == null) {
return getEmptyData();
}
DequeImpl<BuffObj> attachments = obj.getBuffs();
if (attachments == null) {
return getEmptyData();
}
if (attachments.isEmpty()) {
return getEmptyData();
}
data = new ArrayList<>();
for (Attachment attachment : attachments) {
if (attachment instanceof DC_BuffObj) {
data.add((DC_BuffObj) attachment);
}
}
return data;
}
Aggregations