Search in sources :

Example 1 with PropCondition

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

the class HqShop method initItems.

private void initItems() {
    items = new ArrayList<>();
    if (isPreset()) {
        items = DataManager.toTypeList(StringMaster.openContainer(getProperty(PROPS.SHOP_ITEMS)), C_OBJ_TYPE.ITEMS);
        return;
    }
    List<ObjType> templates = DataManager.toTypeList(StringMaster.openContainer(getProperty(PROPS.SHOP_ITEM_TEMPLATES)), C_OBJ_TYPE.ITEMS);
    items = getItemsFromTemplates(templates);
    if (getShopType() == null)
        return;
    // addStandardItems(); then randomize
    PROPERTY prop = getShopType().getFilterProp();
    int i = 0;
    String[] item_groups = getShopType().getItem_groups();
    for (String group : item_groups) {
        List<ObjType> pool;
        if (prop == null) {
            pool = DataManager.toTypeList(DataManager.getTypesSubGroupNames(C_OBJ_TYPE.ITEMS, group), C_OBJ_TYPE.ITEMS);
        } else {
            pool = ItemGenerator.getBaseTypes(C_OBJ_TYPE.ITEMS);
            FilterMaster.filter(pool, new PropCondition(prop, group));
        }
        pool = constructPool(pool);
        pool.addAll(getSpecialItems(group));
        i++;
        if (!isRandomized()) {
            for (ObjType item : pool) {
                buyItem(item, 0);
            }
            // buyAll();
            continue;
        }
        // 
        goldToSpend = (100 - spareGold - i * 5) / item_groups.length;
        // some params from Shop ObjType?
        Loop.startLoop(ShopMaster.getMaxItemsPerGroup(this));
        while (!Loop.loopEnded() && !pool.isEmpty()) {
            int randomListIndex = RandomWizard.getRandomListIndex(pool);
            ObjType t = pool.get(randomListIndex);
            if (t == null) {
                continue;
            }
            if (!buyItem(t)) {
                // second loop based on cheapest items?
                break;
            }
        }
    }
}
Also used : ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) PropCondition(main.elements.conditions.PropCondition)

Example 2 with PropCondition

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

the class AshAnnihilationRule method initConditions.

@Override
public void initConditions() {
    conditions = new Conditions(new NumericCondition("{match_blaze_counters}", "0"));
    conditions.add(new NotCondition(new ClassificationCondition(CLASSIFICATIONS.ELEMENTAL)));
    conditions.add(new NotCondition(new PropCondition(G_PROPS.STANDARD_PASSIVES, STANDARD_PASSIVES.IMMATERIAL.getName())));
}
Also used : NotCondition(main.elements.conditions.NotCondition) ClassificationCondition(main.elements.conditions.standard.ClassificationCondition) NumericCondition(main.elements.conditions.NumericCondition) PropCondition(main.elements.conditions.PropCondition) Conditions(main.elements.conditions.Conditions)

Example 3 with PropCondition

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

the class Shop method initItems.

private void initItems() {
    if (!getProperty(MACRO_PROPS.SHOP_ITEMS).isEmpty()) {
        DataManager.toTypeList(StringMaster.openContainer(getProperty(MACRO_PROPS.SHOP_ITEMS)), C_OBJ_TYPE.ITEMS);
    }
    if (getIntParam(PARAMS.GOLD) == 0) {
        setParam(PARAMS.GOLD, ShopMaster.getBaseGold(this));
    }
    if (getIntParam(PARAMS.GOLD_MOD) == 0) {
        setParam(PARAMS.GOLD_MOD, ShopMaster.getBaseGoldCostMod(this), true);
    }
    if (getIntParam(MACRO_PARAMS.SHOP_INCOME) == 0) {
        setParam(MACRO_PARAMS.SHOP_INCOME, ShopMaster.getBaseGoldIncome(this), true);
    }
    items = new ArrayList<>();
    // addStandardItems(); then randomize
    PROPERTY prop = getShopType().getFilterProp();
    int i = 0;
    String[] item_groups = getShopType().getItem_groups();
    // Up to 4 item groups!
    if (item_groups.length > MAX_ITEM_GROUPS) {
        List<String> list = new ArrayList<>(Arrays.asList(item_groups));
        item_groups = new String[MAX_ITEM_GROUPS];
        int j = 0;
        while (j < MAX_ITEM_GROUPS) {
            String e = list.get(RandomWizard.getRandomListIndex(list));
            list.remove(e);
            item_groups[j] = e;
            j++;
        }
    }
    for (String group : item_groups) {
        List<ObjType> pool;
        if (prop == null) {
            pool = DataManager.toTypeList(DataManager.getTypesSubGroupNames(C_OBJ_TYPE.ITEMS, group), C_OBJ_TYPE.ITEMS);
        } else {
            pool = ItemGenerator.getBaseTypes(C_OBJ_TYPE.ITEMS);
            FilterMaster.filter(pool, new PropCondition(prop, group));
        }
        pool = constructPool(pool);
        pool.addAll(getSpecialItems(group));
        i++;
        // 
        goldToSpend = (100 - spareGold - i * 5) / item_groups.length;
        // some params from Shop ObjType?
        Loop.startLoop(ShopMaster.getMaxItemsPerGroup(this));
        while (!Loop.loopEnded() && !pool.isEmpty()) {
            int randomListIndex = RandomWizard.getRandomListIndex(pool);
            ObjType t = pool.get(randomListIndex);
            if (t == null) {
                continue;
            }
            if (!buyItem(t)) {
                // second loop based on cheapest items?
                break;
            }
        }
    }
}
Also used : ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) ArrayList(java.util.ArrayList) PropCondition(main.elements.conditions.PropCondition)

Example 4 with PropCondition

use of main.elements.conditions.PropCondition 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)

Aggregations

PropCondition (main.elements.conditions.PropCondition)4 ObjType (main.entity.type.ObjType)3 PROPERTY (main.content.values.properties.PROPERTY)2 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 ActivateEffect (eidolons.ability.effects.oneshot.activation.ActivateEffect)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 ArrayList (java.util.ArrayList)1 Abilities (main.ability.Abilities)1 Ability (main.ability.Ability)1 ActiveAbility (main.ability.ActiveAbility)1 Effects (main.ability.effects.Effects)1 PARAMETER (main.content.values.parameters.PARAMETER)1 Conditions (main.elements.conditions.Conditions)1 NotCondition (main.elements.conditions.NotCondition)1 NumericCondition (main.elements.conditions.NumericCondition)1 ClassificationCondition (main.elements.conditions.standard.ClassificationCondition)1 Cost (main.elements.costs.Cost)1 Costs (main.elements.costs.Costs)1 AutoTargeting (main.elements.targeting.AutoTargeting)1 Ref (main.entity.Ref)1