Search in sources :

Example 6 with Condition

use of main.elements.conditions.Condition in project Eidolons by IDemiurge.

the class Crawler method launchFastDc.

private static void launchFastDc() {
    DC_Engine.jarInit();
    FontMaster.init();
    GuiManager.init();
    String dungeon = new FileChooser(PathFinder.getDungeonLevelFolder()).launch("", "");
    FAST_DC.DEFAULT_DUNGEON = (dungeon);
    Ref ref = new Ref();
    Condition conditions = new Conditions();
    FAST_DC.PLAYER_PARTY = ListChooser.chooseType(DC_TYPE.CHARS, ref, conditions);
    FAST_DC.main(new String[] { String.valueOf(PresetLauncher.OPTION_NEW) });
}
Also used : Condition(main.elements.conditions.Condition) Ref(main.entity.Ref) FileChooser(main.swing.generic.components.editors.FileChooser) Conditions(main.elements.conditions.Conditions)

Example 7 with Condition

use of main.elements.conditions.Condition in project Eidolons by IDemiurge.

the class Crawler method main.

public static void main(String[] args) {
    FAST_DC.FAST_MODE = false;
    ExplorationMaster.setTestMode(true);
    DC_Engine.jarInit();
    FontMaster.init();
    GuiManager.init();
    int index = DialogMaster.optionChoice(launch_options, "Choose the type of Eidolons game you want to launch...");
    List<String> parts = null;
    if (index == 0) {
        String data = FileManager.readFile(launchDataPath);
        parts = StringMaster.openContainer(data);
        index = 1;
    }
    if (index == 2) {
    // random  = true;
    // parts = Collections.nCopies(2, "");
    } else if (index == 3) {
        FAST_DC.main(new String[] { "" + (Arrays.asList(PresetLauncher.LAUNCH_OPTIONS)).indexOf(StringMaster.getWellFormattedString(LAUNCH.EXPLORATION.toString())) });
        return;
    } else if (index == 4) {
        FAST_DC.main(new String[] { "" + (Arrays.asList(PresetLauncher.LAUNCH_OPTIONS)).indexOf(StringMaster.getWellFormattedString(LAUNCH.EXPLORATION_TEST.toString())) });
        return;
    }
    DemoLauncher.main(null);
    DC_Engine.mainMenuInit();
    String dungeon = parts == null ? "crawl" + new FileChooser(PathFinder.getDungeonLevelFolder() + "crawl").launch("", "") : parts.get(0);
    launchData += dungeon;
    dungeon = StringMaster.removePreviousPathSegments(dungeon, PathFinder.getDungeonLevelFolder());
    ScreenData data = new ScreenData(ScreenType.BATTLE, dungeon);
    GameLauncher launcher = new GameLauncher(GAME_SUBCLASS.TEST);
    Ref ref = new Ref();
    Condition conditions = new Conditions();
    launcher.PLAYER_PARTY = parts == null ? ListChooser.chooseType(DC_TYPE.CHARS, ref, conditions) : parts.get(1);
    launchData += StringMaster.SEPARATOR + launcher.PLAYER_PARTY;
    launcher.setDungeon(dungeon);
    launcher.PARTY_CODE = CODE.PRESET;
    launcher.ENEMY_CODE = CODE.NONE;
    GuiEventManager.trigger(GuiEventType.SWITCH_SCREEN, data);
    DC_Engine.gameStartInit();
    DC_Game game = launcher.initDC_Game();
    game.start(true);
    if (!StringMaster.isEmpty(launchData)) {
        FileManager.write(launchData, launchDataPath);
    }
}
Also used : Condition(main.elements.conditions.Condition) Ref(main.entity.Ref) FileChooser(main.swing.generic.components.editors.FileChooser) GameLauncher(eidolons.game.core.launch.GameLauncher) DC_Game(eidolons.game.core.game.DC_Game) Conditions(main.elements.conditions.Conditions) ScreenData(eidolons.libgdx.screens.ScreenData)

Example 8 with Condition

use of main.elements.conditions.Condition in project Eidolons by IDemiurge.

the class ReasonMaster method getReasonsCannotTarget.

public static List<FILTER_REASON> getReasonsCannotTarget(Action action, boolean useConditionResultCache, Boolean checkMiscOrOnly, FILTER_REASON searchedReason) {
    Ref REF = action.getRef().getCopy();
    REF.setMatch(action.getRef().getTarget());
    Targeting targeting = action.getActive().getTargeting();
    if (targeting == null) {
        targeting = TargetingMaster.findTargeting(action.getActive());
    }
    if (targeting == null) {
        return new ArrayList<>();
    }
    Conditions conditions = targeting.getFilter().getConditions();
    // conditions.preCheck(REF);
    List<FILTER_REASON> reasons = new ArrayList<>();
    for (Condition c : conditions) {
        FILTER_REASON reason = getReason(c);
        if (searchedReason != null) {
            if (reason != searchedReason) {
                continue;
            }
        }
        if (checkMiscOrOnly == null) {
            if (reason != FILTER_REASON.OTHER) {
                continue;
            }
        } else if (!checkMiscOrOnly) {
            if (reason == FILTER_REASON.OTHER) {
                continue;
            }
        }
        boolean result = c.isTrue();
        if (!useConditionResultCache) {
            result = c.preCheck(REF);
        } else {
        // LogMaster.log(0, c + " uses cached result " + result);
        }
        if (!result) {
            if (reason != null) {
                reasons.add(reason);
            }
        }
    }
    return reasons;
}
Also used : DistanceCondition(main.elements.conditions.DistanceCondition) VisibilityCondition(eidolons.ability.conditions.VisibilityCondition) FacingCondition(eidolons.ability.conditions.FacingCondition) Condition(main.elements.conditions.Condition) Ref(main.entity.Ref) Targeting(main.elements.targeting.Targeting) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions)

Example 9 with Condition

use of main.elements.conditions.Condition in project Eidolons by IDemiurge.

the class CostRequirements method initConditions.

private void initConditions(List<Payment> toPay, Ref ref) {
    reqMap.clear();
    reqMap.putAll(additionalReqList);
    for (Payment payment : toPay) {
        if (payment.getAmountFormula().toString().equals("0")) {
            continue;
        }
        Formula amountFormula = payment.getAmountFormula();
        if (amountFormula.toString().contains(StringMaster.FORMULA_FUNC_OPEN_CHAR)) {
            continue;
        }
        String value = "" + amountFormula.getInt(ref);
        String r = InfoMaster.getParamReasonString(value, payment.getParamToPay());
        Condition c = new NumericCondition(false, StringMaster.getValueRef(KEYS.SOURCE.toString(), payment.getParamToPay().toString()), value);
        reqMap.put(r, c);
    }
}
Also used : NumericCondition(main.elements.conditions.NumericCondition) Condition(main.elements.conditions.Condition) Formula(main.system.math.Formula) NumericCondition(main.elements.conditions.NumericCondition)

Example 10 with Condition

use of main.elements.conditions.Condition in project Eidolons by IDemiurge.

the class ModeEffect method addEndTurnEffect.

private void addEndTurnEffect() {
    Condition condition = new StringComparison(prop, mode.toString(), true);
    if (mode == STD_MODES.DIVINATION) {
        Effect effect = new DivinationEffect();
        addBuffEffect.addEffect(new DelayedEffect(effect, condition));
        return;
    }
    String formula = mode.getFormula();
    if (ref.getActive() instanceof DC_ActiveObj) {
        DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
        if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
            formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
        } else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
            formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
        }
    }
    ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
    PARAMETER param = ContentManager.getPARAM(mode.getParameter());
    effect.setParam(param);
    effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
    Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
    effect.setFormula(appendedByModifier);
    addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) Formula(main.system.math.Formula) StringComparison(main.elements.conditions.StringComparison) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) SetCustomModeEffect(eidolons.ability.effects.continuous.SetCustomModeEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) PeriodicEffect(main.ability.effects.periodic.PeriodicEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

Condition (main.elements.conditions.Condition)17 Conditions (main.elements.conditions.Conditions)7 Ref (main.entity.Ref)4 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)3 Unit (eidolons.entity.obj.unit.Unit)3 RefCondition (main.elements.conditions.RefCondition)3 FacingCondition (eidolons.ability.conditions.FacingCondition)2 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)2 DC_Obj (eidolons.entity.obj.DC_Obj)2 ArrayList (java.util.ArrayList)2 NumericCondition (main.elements.conditions.NumericCondition)2 Obj (main.entity.obj.Obj)2 STANDARD_EVENT_TYPE (main.game.logic.event.Event.STANDARD_EVENT_TYPE)2 FileChooser (main.swing.generic.components.editors.FileChooser)2 Formula (main.system.math.Formula)2 VisibilityCondition (eidolons.ability.conditions.VisibilityCondition)1 GraveCondition (eidolons.ability.conditions.special.GraveCondition)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1