use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DC_StateManager method checkCellBuffs.
private void checkCellBuffs() {
for (BattleFieldObject unit : getGame().getBfObjects()) {
if (unit.isDead()) {
continue;
}
Obj cell = game.getCellByCoordinate(unit.getCoordinates());
if (cell == null) {
continue;
}
if (cell.getBuffs() == null) {
continue;
}
for (BuffObj buff : game.getCellByCoordinate(unit.getCoordinates()).getBuffs()) {
if (unit.hasBuff(buff.getName())) {
continue;
}
if (buff.isAppliedThrough()) {
Condition retainCondition = new PositionCondition(KEYS.SOURCE.toString(), cell);
getGame().getManager().copyBuff(buff, unit, retainCondition);
}
}
}
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class DispelEffect method applyThis.
@Override
public boolean applyThis() {
for (Attachment attachment : game.getState().getAttachmentsMap().get(ref.getTargetObj())) {
if (!(attachment instanceof BuffObj)) {
continue;
}
BuffObj buff = (BuffObj) attachment;
if (!buff.isDispelable()) {
continue;
}
if (!friendlyFire) {
if (buff.getOwner().isMe()) {
continue;
}
}
if (positiveOnly) {
// if (buff.getBuffType() ==)
}
boolean result = true;
// Ref REF = Ref.getCopy(ref);
// REF.setTarget(buff.getId());
// REF.setID(KEYS.SUMMONER, buff.getOwnerObj()); // is it owner or
// // basis? ;)
//
// Roll roll = new Roll(ROLL_TYPES.DISPEL, chance.getInt(ref));
// result = RollMaster.roll(roll);
// TODO ROLL!
Integer amount = durationMod.getInt(ref);
buff.modifyDuration(amount);
}
return true;
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class RemoveBuffEffect method applyThis.
@Override
public boolean applyThis() {
if (buffName.equals(AddBuffEffect.EMPTY_BUFF_NAME)) {
buffName = ref.getActive().getName();
}
BuffObj buff = ref.getTargetObj().getBuff(buffName, strict);
if (buff != null)
return buff.kill();
LogMaster.log(1, ref.getTargetObj().getNameAndCoordinate() + " has no buff named " + buffName + ref);
return false;
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class AnimMaster method updateContinuousAnims.
private void updateContinuousAnims() {
if (!continuousAnimsOn) {
return;
}
final List<BuffObj> toRemove = new ArrayList<>();
continuousAnims.keySet().forEach(buff -> {
if (buff.isDead()) {
continuousAnims.get(buff).finished();
toRemove.add(buff);
}
});
toRemove.forEach(buff -> {
continuousAnims.remove(buff);
});
DC_Game.game.getUnits().forEach(unit -> {
unit.getBuffs().forEach(buff -> {
if (// TODO or full reset always?
!continuousAnims.containsKey(buff)) {
if (buff.isVisible()) {
BuffAnim anim = constructor.getBuffAnim(buff);
// TODO cache!
if (anim != null) {
continuousAnims.put(buff, anim);
try {
anim.start();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
}
});
});
}
use of main.entity.obj.BuffObj in project Eidolons by IDemiurge.
the class ExploreCleaner method cleanUpAfterBattle.
public void cleanUpAfterBattle() {
Eidolons.getGame().getUnits().forEach(unit -> {
unit.resetDynamicParam(PARAMS.C_N_OF_ACTIONS);
removeMode(unit);
BuffObj buff = unit.getBuff(StealthRule.SPOTTED);
if (buff != null)
buff.remove();
cleanUpActions(unit);
});
}
Aggregations