Search in sources :

Example 76 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class HeroObjectModifyingEffect method getObjectsToModify.

protected List<Obj> getObjectsToModify() {
    if (objName != null) {
        return getObjectsByName(objName);
    } else {
        // TODO simple condition format - prop,
        Ref REF = ref.getCopy();
        // value"
        initFilterConditions();
        Unit hero = (Unit) ref.getSourceObj();
        if (type != null) {
            List<Integer> list;
            try {
                list = getIdList(hero);
            } catch (Exception e) {
                LogMaster.log(1, "Group obj effect failed to getOrCreate targets: " + this);
                return new ArrayList<>();
            }
            List<Obj> objList = new ArrayList<>();
            for (Integer id : list) {
                objList.add(game.getObjectById(id));
            }
            return objList;
        }
        new AutoTargeting(conditions).select(REF);
        return REF.getGroup().getObjects();
    }
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) Ref(main.entity.Ref) Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Example 77 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class PartyEffect method getObjectsToModify.

@Override
protected List<Obj> getObjectsToModify() {
    Party party = (Party) ref.getSourceObj().getRef().getObj(KEYS.PARTY);
    List<Unit> list = party.getMembers();
    initFilterConditions();
    FilterMaster.filter(list, conditions);
    List<Obj> objList = new ArrayList<>();
    for (Unit j : list) {
        objList.add(j);
    }
    return objList;
}
Also used : Party(eidolons.client.cc.logic.party.Party) Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Example 78 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class WatchActionEffect method applyThis.

@Override
public boolean applyThis() {
    Obj sourceObj = ref.getSourceObj();
    List<DC_Obj> list = WatchRule.getWatchersMap().get(sourceObj);
    if (list == null) {
        list = new ArrayList<>();
        WatchRule.getWatchersMap().put((Unit) sourceObj, list);
    } else if (!alert) {
        if (list.contains(ref.getTargetObj())) {
            list.remove(ref.getTargetObj());
            if (RandomWizard.random()) {
                DC_SoundMaster.playStandardSound(STD_SOUNDS.BACK);
            } else {
                DC_SoundMaster.playStandardSound(STD_SOUNDS.CLOSE);
            }
            LogMaster.log(1, sourceObj.getName() + " no longer watching " + ref.getTargetObj().getNameIfKnown());
            return true;
        } else if (!list.isEmpty()) {
            if (RandomWizard.random()) {
                DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__BLOCKED);
            } else {
                DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ERROR);
            }
            // if (maxUnitsWatched<=1)
            return false;
        }
    }
    list.add((DC_Obj) ref.getTargetObj());
    if (!alert) {
        if (// (sourceObj.isMine())
        RandomWizard.random()) {
            DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__KNIFE);
        } else {
            DC_SoundMaster.playStandardSound(STD_SOUNDS.NOTE);
        }
    }
    return true;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj)

Example 79 with Obj

use of main.entity.obj.Obj 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;
}
Also used : Ref(main.entity.Ref) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj) BuffObj(main.entity.obj.BuffObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) BuffType(main.entity.type.BuffType) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) Unit(eidolons.entity.obj.unit.Unit) DC_BuffObj(eidolons.entity.obj.attach.DC_BuffObj)

Example 80 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class DC_Game method reinit.

public void reinit(boolean restart) {
    master = new DC_GameMaster(this);
    List<Obj> cachedObjects = new ArrayList<>();
    if (!restart)
        for (Obj sub : getState().getObjects().values()) {
            if (sub == null)
                continue;
            if (sub instanceof Unit)
                continue;
            if (sub.getRef() == null)
                continue;
            if (sub.getRef().getSourceObj() == null)
                continue;
            if (sub.getRef().getSourceObj().isMine()) {
                cachedObjects.add(sub);
            }
        }
    this.setState(new DC_GameState(this));
    this.setManager(new DC_GameManager(this.getState(), this));
    this.getManager().init();
    for (Obj sub : cachedObjects) {
        getState().addObject(sub);
    }
    visionMaster.reinit();
}
Also used : DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) MicroObj(main.entity.obj.MicroObj) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) Unit(eidolons.entity.obj.unit.Unit) DC_GameState(eidolons.game.core.state.DC_GameState)

Aggregations

Obj (main.entity.obj.Obj)127 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)34 DC_Obj (eidolons.entity.obj.DC_Obj)30 Coordinates (main.game.bf.Coordinates)27 Unit (eidolons.entity.obj.unit.Unit)24 ArrayList (java.util.ArrayList)19 Ref (main.entity.Ref)15 DC_SpellObj (eidolons.entity.active.DC_SpellObj)14 BuffObj (main.entity.obj.BuffObj)13 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)12 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)11 ActiveObj (main.entity.obj.ActiveObj)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)9 PassiveAbilityObj (main.ability.PassiveAbilityObj)9 ObjType (main.entity.type.ObjType)8 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)7 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)7 PARAMETER (main.content.values.parameters.PARAMETER)7 Conditions (main.elements.conditions.Conditions)6 MicroObj (main.entity.obj.MicroObj)6