use of main.entity.Ref in project Eidolons by IDemiurge.
the class IlluminationRule method getLightEmissionEffect.
public LightEmittingEffect getLightEmissionEffect(DC_Obj source) {
LightEmittingEffect effect = effectCache.get(source);
if (effect == null) {
int value = getLightEmission(source);
if (value <= 0) {
return null;
}
Boolean circular = true;
if (source instanceof Unit)
circular = false;
else if (source.checkBool(GenericEnums.STD_BOOLS.SPECTRUM_LIGHT)) {
circular = false;
} else if (EntityCheckMaster.isOverlaying(source)) {
BattleFieldObject dc_Obj = (BattleFieldObject) source;
if (dc_Obj.getDirection() != null) {
circular = false;
}
}
effect = new LightEmittingEffect(("" + value), circular);
effect.setRef(new Ref(source));
effectCache.put(source, effect);
} else
effect.getEffects().setFormula(new Formula("" + getLightEmission(source)));
return effect;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class DC_CounterRule method check.
public boolean check(Unit unit) {
if (!checkApplies(unit)) {
return false;
}
this.unit = unit;
if (getNumberOfCounters(unit) <= 0) {
if (!isAppliedAlways()) {
// if (checkAlreadyApplied(unit)) TODO that's bullshit!
// log(getLiftedLogString());
// removeBuff(unit); // may not be needed now
removeEffects(unit);
return false;
}
}
if (ImmunityRule.checkImmune(unit, getCounterName())) {
return false;
}
// if (!checkAlreadyApplied(unit))
// log(getAppliedLogString());
Ref ref = unit.getRef().getCopy();
ref.setTarget(unit.getId());
initEffects();
addBuff(unit);
if (getSpread() != null) {
new CustomTargetEffect(new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ADJACENT), new ModifyCounterEffect(getCounterName(), MOD.MODIFY_BY_CONST, getSpread())).apply(Ref.getSelfTargetingRefCopy(unit));
}
// it only once!
return true;
// effects.apply(ref);
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class AtbController method processTimeElapsed.
private void processTimeElapsed(Float time) {
addTime(time);
getManager().getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.TIME_ELAPSED, new Ref(Math.round(time * TIME_LOGIC_MODIFIER))));
GuiEventManager.trigger(GuiEventType.TIME_PASSED, time);
GuiEventManager.trigger(GuiEventType.NEW_ATB_TIME, this.time);
if (this.time >= TIME_IN_ROUND) {
addTime(-TIME_IN_ROUND);
manager.getGame().getStateManager().newRound();
newRound();
}
if (!isPrecalc())
manager.getGame().getLogManager().log(getTimeString(time) + " passed, " + getTimeString(TIME_IN_ROUND - this.time) + " until end of round");
for (AtbUnit unit : this.unitsInAtb) {
unit.setAtbReadiness(unit.getAtbReadiness() + time * unit.getInitiative());
}
if (!isPrecalc())
manager.getGame().getManager().atbTimeElapsed(time);
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class SpellIlluminationRule method spellResolves.
public void spellResolves(DC_ActiveObj spell) {
Unit caster = spell.getOwnerObj();
Boolean circular = true;
// distance reductionBoolean circular = true;
if (spell.checkBool(GenericEnums.STD_BOOLS.SPECTRUM_LIGHT)) {
circular = false;
}
int value = spell.getIntParam(PARAMS.SPELL_DIFFICULTY);
LightEmittingEffect effect = new LightEmittingEffect(("" + value), circular);
effect.apply(new Ref(caster));
caster.getGame().getManager().reset();
WaitMaster.WAIT(delay);
caster.getGame().getVisionMaster().refresh();
caster.getGame().getBattleField().getGrid().refresh();
// reduce for distance
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class FilterMaster method getPlayerControlledUnits.
public static Set<Obj> getPlayerControlledUnits(Player player) {
Conditions c = new Conditions();
Ref ref;
if (player == Player.NEUTRAL) {
c.add(new OwnershipCondition("MATCH", true));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = new Ref(player.getGame());
} else {
c.add(new OwnershipCondition("MATCH", "SOURCE"));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = player.getHeroObj().getRef();
}
// spells too?
Filter<Obj> filter = new Filter<>(ref, c);
Set<Obj> set = filter.getObjects();
return set;
}
Aggregations