Search in sources :

Example 26 with Obj

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

the class ModifyPropertyEffect method applyThis.

@Override
public boolean applyThis() {
    map = new XLinkedMap<>();
    boolean result = true;
    Obj obj = ref.getObj(KEYS.TARGET);
    if (obj == null) {
        return false;
    }
    switch(modtype) {
        case ADD:
            result = obj.addProperty(prop, value);
            break;
        case REMOVE:
            result = obj.removeProperty(prop, value);
            break;
        case SET:
            obj.setProperty(prop, value);
            break;
        default:
            break;
    }
    if (result) {
        if (!isAnimationDisabled()) {
            if (getAnimation() != null) {
                map.put(prop, ListMaster.toList(modtype, value));
                // if (!isContinuousWrapped()) {
                getAnimation().addPhaseArgs(PHASE_TYPE.PROP_MODS, map);
            // } else
            // wrapInBuffPhase(map);
            }
        }
    }
    return true;
}
Also used : Obj(main.entity.obj.Obj)

Example 27 with Obj

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

the class CellCondition method getCoordinates.

@Override
protected Coordinates getCoordinates(Ref ref) {
    if (obj_ref == null) {
        obj_ref = KEYS.MATCH.toString();
    }
    if (direction == null) {
        return super.getCoordinates(ref);
    }
    Obj obj = ref.getObj(obj_ref);
    FACING_DIRECTION f = null;
    if (obj instanceof DC_UnitModel) {
        f = ((DC_UnitModel) obj).getFacing();
    }
    if (f == null) {
        return null;
    }
    return super.getCoordinates(ref).getAdjacentCoordinate(DirectionMaster.getDirectionByFacing(f, direction));
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) DC_UnitModel(eidolons.entity.obj.unit.DC_UnitModel) Obj(main.entity.obj.Obj)

Example 28 with Obj

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

the class LogManager method logStdRoll.

public void logStdRoll(Ref ref, int greater, int randomInt, int than, int randomInt2, ROLL_TYPES roll_type) {
    Obj source = ref.getSourceObj();
    Obj target = ref.getEvent().getRef().getTargetObj();
    boolean fail = randomInt2 > randomInt;
    String rollTarget = target.getNameIfKnown() + ((fail) ? " fails" : " wins") + " a " + roll_type.getName() + " roll with " + randomInt + " out of " + greater;
    String rollSource = source.getNameIfKnown() + "'s " + randomInt2 + " out of " + than;
    String string = rollTarget + " vs " + rollSource;
    if (!target.getOwner().isMe()) {
        fail = !fail;
    }
    if (fail) {
        string = StringMaster.MESSAGE_PREFIX_FAIL + string;
    } else {
        string = StringMaster.MESSAGE_PREFIX_SUCCESS + string;
    }
    log(string);
}
Also used : ActiveObj(main.entity.obj.ActiveObj) Obj(main.entity.obj.Obj)

Example 29 with Obj

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

the class UpkeepRule method addUpkeep.

public static void addUpkeep(Obj payObj) {
    Obj spell = payObj.getRef().getObj(KEYS.ACTIVE);
    if (spell == null) {
        return;
    }
    Obj abil = payObj.getRef().getObj(KEYS.ABILITY);
    if (abil != null) {
        if (abil instanceof PassiveAbilityObj) {
            return;
        }
    }
    String property = spell.getProperty(PROPS.UPKEEP_FAIL_ACTION);
    if (new EnumMaster<UPKEEP_FAIL_ACTION>().retrieveEnumConst(UPKEEP_FAIL_ACTION.class, property) == null) {
        property = UPKEEP_FAIL_ACTION.DEATH + "";
    }
    payObj.setProperty(PROPS.UPKEEP_FAIL_ACTION, property);
    for (PARAMETER p : ValuePages.UPKEEP_PARAMETERS) {
        Integer param = spell.getIntParam(p);
        if (param > 0) {
            payObj.getType().setParam(p, param);
        }
    }
}
Also used : UPKEEP_FAIL_ACTION(main.ability.effects.Effect.UPKEEP_FAIL_ACTION) EnumMaster(main.system.auxiliary.EnumMaster) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 30 with Obj

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

the class UpkeepRule method enactUpkeepFail.

public void enactUpkeepFail(UPKEEP_FAIL_ACTION ufa, Ref ref) {
    Obj targetObj = ref.getTargetObj();
    if (targetObj instanceof BuffObj) {
        BuffObj buffObj = (BuffObj) targetObj;
        ref.setTarget(buffObj.getBasis().getId());
        new RemoveBuffEffect(targetObj.getName()).apply(ref);
        ref.getGame().getLogManager().log(targetObj.getName() + " " + BUFF_DISPELLED_STRING);
        return;
    }
    ref.getGame().getLogManager().log(targetObj.getName() + " " + ufa.getLogString());
    // TODO enemy string should be different!
    Effect e = getFailEffects(ufa);
    e.apply(ref);
}
Also used : RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) Effect(main.ability.effects.Effect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) BuffObj(main.entity.obj.BuffObj)

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