Search in sources :

Example 1 with Ability

use of main.ability.Ability in project Eidolons by IDemiurge.

the class ActiveAuraEffect method applyThis.

@Override
public boolean applyThis() {
    AutoTargeting targeting = new AutoTargeting(new Conditions(new ObjTypeComparison(C_OBJ_TYPE.BF_OBJ), new DistanceCondition("" + radius.getInt(ref))));
    targeting.getConditions().add(ConditionMaster.getAliveCondition(KEYS.MATCH));
    if (onlyEnemiesOrAllies != null) {
        if (onlyEnemiesOrAllies) {
            targeting.getConditions().add(ConditionMaster.getEnemyCondition());
        } else {
            targeting.getConditions().add(ConditionMaster.getAllyCondition());
        }
    }
    targeting.getConditions().add(new NotCondition(new RefCondition(KEYS.MATCH, KEYS.SOURCE)));
    Ability ability = new ActiveAbility(targeting, effects);
    new AddTriggerEffect(event_type, conditions, ability).apply(ref);
    return true;
}
Also used : ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) ActiveAbility(main.ability.ActiveAbility) AutoTargeting(main.elements.targeting.AutoTargeting) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect)

Example 2 with Ability

use of main.ability.Ability in project Eidolons by IDemiurge.

the class WaitEffect method getAbility.

protected Ability getAbility(Ref ref) {
    Effect effect = new Effects(new RemoveBuffEffect(getBuffName()));
    Ability ability = new ActiveAbility(new FixedTargeting(KEYS.SOURCE), effect);
    ability.setRef(ref);
    return ability;
}
Also used : ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) ActiveAbility(main.ability.ActiveAbility) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) FixedTargeting(main.elements.targeting.FixedTargeting) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) MicroEffect(main.ability.effects.MicroEffect) SetCustomModeEffect(eidolons.ability.effects.continuous.SetCustomModeEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect) OneshotEffect(main.ability.effects.OneshotEffect) Effects(main.ability.effects.Effects)

Example 3 with Ability

use of main.ability.Ability in project Eidolons by IDemiurge.

the class StateCloner method cloneAbility.

private Ability cloneAbility(Ability abilities) {
    Effects effects = new Effects();
    for (Effect e : abilities.getEffects()) {
        effects.add(cloneEffect(e));
    }
    Ability ability = (abilities instanceof ActiveAbility) ? new ActiveAbility(abilities.getTargeting(), effects) : new PassiveAbility(abilities.getTargeting(), effects);
    return ability;
}
Also used : ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) PassiveAbility(main.ability.PassiveAbility) ActiveAbility(main.ability.ActiveAbility) ContinuousEffect(main.ability.effects.continuous.ContinuousEffect) Effect(main.ability.effects.Effect) PassiveAbility(main.ability.PassiveAbility) Effects(main.ability.effects.Effects)

Example 4 with Ability

use of main.ability.Ability in project Eidolons by IDemiurge.

the class DualAttackMaster method createDual.

private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
    Costs costs = getDualCosts(main, offhand);
    // cooldown!
    ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
    Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
    Abilities abilities = new Abilities();
    abilities.add(activateAttacks);
    abilities.add(setCooldown);
    ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
    for (Cost cost : costs.getCosts()) {
        PARAMETER p = cost.getCostParam();
        if (p == null)
            continue;
        newType.setParam(p, cost.getPayment().getAmountFormula().toString());
    }
    DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
    dual.setAbilities(abilities);
    dual.setCosts(costs);
    dual.setTargeting(main.getTargeting());
    dual.getTargeter().setTargetingInitialized(true);
    dual.setConstructed(true);
    return dual;
}
Also used : ActiveAbility(main.ability.ActiveAbility) ActiveAbility(main.ability.ActiveAbility) Ability(main.ability.Ability) AutoTargeting(main.elements.targeting.AutoTargeting) Costs(main.elements.costs.Costs) Abilities(main.ability.Abilities) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) PropCondition(main.elements.conditions.PropCondition) Cost(main.elements.costs.Cost) DC_UnitAction(eidolons.entity.active.DC_UnitAction) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) ActivateEffect(eidolons.ability.effects.oneshot.activation.ActivateEffect) PARAMETER(main.content.values.parameters.PARAMETER)

Example 5 with Ability

use of main.ability.Ability in project Eidolons by IDemiurge.

the class ScriptParser method parseScript.

public static <T> ScriptTrigger parseScript(String script, DC_Game game, ScriptExecutor<T> executor, Class<T> funcClass) {
    // TODO
    script = ScriptMaster.getScriptByName(script);
    // non-trigger scripts?
    String originalText = script;
    String processedPart = StringMaster.getFirstItem(script, ScriptSyntax.PART_SEPARATOR);
    STANDARD_EVENT_TYPE event_type = parseEvent(processedPart);
    script = StringMaster.cropFirstSegment(script, ScriptSyntax.PART_SEPARATOR);
    Condition condition = null;
    condition = getDefaultCondition(event_type, VariableManager.getVars(processedPart));
    if (condition != null) {
        condition.setXml(XML_Converter.wrap("ScriptedCondition", XML_Converter.wrap("STANDARD_EVENT_TYPE", event_type.toString()) + XML_Converter.wrap("STRING", VariableManager.getVars(processedPart))));
    } else {
        String conditionPart = StringMaster.getFirstItem(script, ScriptSyntax.PART_SEPARATOR);
        condition = parseConditions(conditionPart);
        condition.setXml(conditionPart);
    }
    boolean isRemove = true;
    // if (contains("cyclic"))remove = false;
    Ability abilities = null;
    // TODO Global
    Ref ref = new Ref(game);
    script = StringMaster.getLastPart(script, ScriptSyntax.PART_SEPARATOR);
    String funcPart = VariableManager.removeVarPart(script);
    @Refactor T // TODO this won't work in generic way!!!!
    func = new EnumMaster<T>().retrieveEnumConst(funcClass, funcPart);
    if (func != null) {
        // TODO for multiple scripts, need another SEPARATOR!
        String separator = executor.getSeparator(func);
        List<String> strings = StringMaster.openContainer(VariableManager.getVars(script), separator);
        String[] args = strings.toArray(new String[strings.size()]);
        abilities = new AbilityImpl() {

            @Override
            public boolean activatedOn(Ref ref) {
                executor.execute(func, ref, args);
                // reset after? not like normal action certainly...
                return true;
            }
        };
    } else {
        abilities = AbilityConstructor.getAbilities(script, ref);
        if (abilities.getEffects().getEffects().isEmpty()) {
            main.system.auxiliary.log.LogMaster.log(1, "SCRIPT NOT FOUND: " + funcPart);
            return null;
        }
    }
    abilities.setRef(ref);
    ScriptTrigger trigger = new ScriptTrigger(originalText, event_type, condition, abilities);
    trigger.setRemoveAfterTriggers(isRemove);
    return trigger;
}
Also used : Condition(main.elements.conditions.Condition) Ability(main.ability.Ability) AbilityImpl(main.ability.AbilityImpl) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) Refactor(main.system.util.Refactor) Ref(main.entity.Ref)

Aggregations

Ability (main.ability.Ability)6 ActiveAbility (main.ability.ActiveAbility)4 Effect (main.ability.effects.Effect)3 Effects (main.ability.effects.Effects)3 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)2 PARAMETER (main.content.values.parameters.PARAMETER)2 AutoTargeting (main.elements.targeting.AutoTargeting)2 Ref (main.entity.Ref)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 SetCustomModeEffect (eidolons.ability.effects.continuous.SetCustomModeEffect)1 ActivateEffect (eidolons.ability.effects.oneshot.activation.ActivateEffect)1 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)1 PARAMS (eidolons.content.PARAMS)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 Abilities (main.ability.Abilities)1 AbilityImpl (main.ability.AbilityImpl)1 AbilityObj (main.ability.AbilityObj)1 PassiveAbility (main.ability.PassiveAbility)1 MicroEffect (main.ability.effects.MicroEffect)1