Search in sources :

Example 6 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class DC_WeaponObj method apply.

@Override
public void apply() {
    toBase();
    super.apply();
    // applyMods();
    if (!mainHand) {
        if (isWeapon()) {
            checkApplyOffhandPenalties();
        }
    } else {
        if (hero.getOffhandWeapon() == null) {
            checkApplySingleHandBonus();
        }
    }
    Ref ref = getHero().getRef();
    if (isRanged()) {
        getHero().setRangedWeapon(this);
        ref.setID(KEYS.RANGED, getId());
    }
    if (mainHand) {
        ref.setID(KEYS.WEAPON, getId());
    } else {
        ref.setID(KEYS.OFFHAND, getId());
    }
}
Also used : Ref(main.entity.Ref)

Example 7 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class BattleFieldObject method kill.

@Override
public boolean kill(Entity killer, boolean leaveCorpse, Boolean quietly) {
    if (isDead()) {
        return false;
    }
    boolean ignoreInterrupt = false;
    if (quietly == null) {
        ignoreInterrupt = true;
        quietly = false;
    }
    if ((game.isDebugMode() && isMine()) || (!ignoreInterrupt && !quietly)) {
        if ((game.isDebugMode() && isMine()) || checkPassive(UnitEnums.STANDARD_PASSIVES.INDESTRUCTIBLE)) {
            preventDeath();
            return false;
        }
    }
    ref.setID(KEYS.KILLER, killer.getId());
    Ref REF = Ref.getCopy(killer.getRef());
    REF.setTarget(id);
    REF.setSource(killer.getId());
    if (!quietly) {
        if (!getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_IS_BEING_KILLED, REF))) {
            if (!ignoreInterrupt) {
                return false;
            }
        }
        ((BattleFieldObject) killer).applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_KILL, this, REF);
        applySpecialEffects(SPECIAL_EFFECTS_CASE.ON_DEATH, ((BattleFieldObject) killer), REF);
        if (!ignoreInterrupt) {
            if (ref.checkInterrupted()) {
                return false;
            }
        }
    }
    getGame().getManager().unitDies(this, (Obj) killer, leaveCorpse, quietly);
    return true;
}
Also used : Ref(main.entity.Ref) Event(main.game.logic.event.Event)

Example 8 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class BfGridComp method initCellsAndMap.

private void initCellsAndMap() {
    cells = new CellComp[getCellsX()][getCellsY()];
    for (int i = 0; i < getCellsX(); i++) {
        for (int j = 0; j < getCellsY(); j++) {
            DC_Cell cellEntity = new DC_Cell(i, j, game, new Ref(), game.getDungeon());
            Coordinates coordinates = new Coordinates(i, j);
            cellEntityMap.put(coordinates, cellEntity);
            if (!CoreEngine.isLevelEditor())
                continue;
            CellComp cell = new CellComp(game, coordinates, this);
            getMap().put(coordinates, cell);
            cells[i][j] = cell;
        }
    }
}
Also used : Ref(main.entity.Ref) DC_Cell(eidolons.entity.obj.DC_Cell) Coordinates(main.game.bf.Coordinates)

Example 9 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class ContainerTextElement method getRef.

@Override
protected Ref getRef() {
    if (entity == null) {
        return null;
    }
    int id = entity.getId();
    Ref ref;
    // if (entity.getGame().isSimulation())
    // ref = CharacterCreator.getHeroPanel().getHero().getRef();
    // else TODO
    ref = entity.getRef();
    if (entity.getOBJ_TYPE_ENUM() instanceof DC_TYPE) {
        switch((DC_TYPE) entity.getOBJ_TYPE_ENUM()) {
            case UNITS:
            case CHARS:
                ref = entity.getRef();
                break;
            case ACTIONS:
                ref.setID(KEYS.ACTIVE, id);
                break;
            case ARMOR:
                ref.setID(KEYS.ARMOR, id);
                break;
            case ITEMS:
                ref.setID(KEYS.ITEM, id);
                break;
            case SPELLS:
                ref.setID(KEYS.SPELL, id);
                ref.setID(KEYS.ACTIVE, id);
                break;
            case WEAPONS:
                ref.setID(KEYS.WEAPON, id);
                break;
        }
    }
    ref.setID(KEYS.INFO, id);
    ref.setInfoEntity(entity);
    if (CharacterCreator.getHero() != null) {
        if (Game.game.isSimulation()) {
            if (entity instanceof ObjType) {
                entity = HeroCreator.getObjForType(CharacterCreator.getHero(), (ObjType) entity);
            }
        }
        ref.setSource(CharacterCreator.getHero().getId());
        // if (item!=null )
        // ref.setSource(item.getRef().getSource());
        CharacterCreator.getHero().getRef().setInfoEntity(entity);
    }
    return ref;
}
Also used : Ref(main.entity.Ref) DC_TYPE(main.content.DC_TYPE) ObjType(main.entity.type.ObjType)

Example 10 with Ref

use of main.entity.Ref in project Eidolons by IDemiurge.

the class Trigger method trigger.

public boolean trigger() {
    if (LogMaster.TRIGGER_DEBUG_ON)
        LogMaster.log(LogMaster.TRIGGER_DEBUG, toString() + " has been triggered!");
    abilities.setForceTargeting(forceTargeting);
    if (removeAfterTriggers) {
        remove();
    }
    Ref REF = abilities.getRef().getCopy();
    REF.setEvent(event);
    boolean result = abilities.activatedOn(REF);
    if (result && game.isStarted()) {
        // if (
        game.getManager().checkForChanges(true);
    // game.getManager().refreshAll();
    }
    return result;
}
Also used : Ref(main.entity.Ref)

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