use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class BuffMaster method atbTimeElapsed.
public void atbTimeElapsed(Float time) {
for (Obj sub : getBuffs()) {
BuffObj buff = ((BuffObj) sub);
if (buff.isDead())
continue;
buff.timeElapsed(time);
}
}
use of main.entity.obj.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 main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class BuffMaster method addAttachment.
public void addAttachment(Attachment attachment, Obj basis) {
List<Attachment> list = getState().getAttachmentsMap().get(basis);
if (list == null) {
list = new ArrayList<>();
getState().getAttachmentsMap().put(basis, list);
}
if (attachment instanceof BuffObj) {
basis.addBuff((BuffObj) attachment);
}
getState().addAttachment(attachment);
list.add(attachment);
if (// e.g. auras
attachment.isTransient()) {
return;
}
for (Effect e : attachment.getEffects()) {
// e.apply(basis.getRef()); // how to add retain conditions?
// else
// if (!(e instanceof AttachmentEffect))
getState().addEffect(e);
}
}
use of main.entity.obj.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;
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DC_PagedBuffPanel method createPageComponent.
@Override
protected G_Component createPageComponent(List<BuffObj> list) {
List<SmallItem> compList = new ArrayList<>();
for (BuffObj buff : list) {
if (buff == null) {
compList.add(new SmallItem());
} else {
compList.add(new SmallItem(buff));
}
}
BuffPage buffPage = new BuffPage(compList, getItemSize(), PAGE_SIZE);
buffPage.getList().setCellRenderer(buffPage);
return buffPage;
}
Aggregations