Search in sources :

Example 96 with Ref

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;
}
Also used : Formula(main.system.math.Formula) Ref(main.entity.Ref) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Unit(eidolons.entity.obj.unit.Unit) LightEmittingEffect(eidolons.ability.effects.common.LightEmittingEffect)

Example 97 with Ref

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);
}
Also used : Ref(main.entity.Ref) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Example 98 with 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);
}
Also used : Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 99 with Ref

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
}
Also used : Ref(main.entity.Ref) Unit(eidolons.entity.obj.unit.Unit) LightEmittingEffect(eidolons.ability.effects.common.LightEmittingEffect)

Example 100 with Ref

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;
}
Also used : Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) Filter(main.elements.Filter) Obj(main.entity.obj.Obj) Conditions(main.elements.conditions.Conditions)

Aggregations

Ref (main.entity.Ref)155 Unit (eidolons.entity.obj.unit.Unit)28 ObjType (main.entity.type.ObjType)23 Event (main.game.logic.event.Event)16 ArrayList (java.util.ArrayList)15 Obj (main.entity.obj.Obj)15 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)13 Coordinates (main.game.bf.Coordinates)13 Conditions (main.elements.conditions.Conditions)12 Formula (main.system.math.Formula)11 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)10 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)9 PARAMETER (main.content.values.parameters.PARAMETER)9 DC_SpellObj (eidolons.entity.active.DC_SpellObj)8 Effects (main.ability.effects.Effects)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)7 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)7 Effect (main.ability.effects.Effect)7 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)5 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)5