Search in sources :

Example 1 with DC_HeroItemObj

use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.

the class CampEffect method applyThis.

@Override
public boolean applyThis() {
    /*
        restore fully, dispel all timed buffs, apply bonus
         */
    List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
    if (allies.isEmpty())
        getGame().getMetaMaster().getPartyManager().getParty().addMember(getGame().getMetaMaster().getPartyManager().getParty().getLeader());
    // mystery fix
    for (Unit sub : new LinkedList<>(allies)) {
        DC_HeroItemObj item = sub.getItemFromInventory("Food");
        if (item != null) {
            sub.removeFromInventory(item);
            continue;
        }
        DC_QuickItemObj qitem = sub.getQuickItem("Food");
        if (item != null) {
            sub.removeQuickItem(qitem);
            continue;
        }
        allies.remove(sub);
        continue;
    // remove
    }
    if (allies.isEmpty()) {
        FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "You need food supplies to camp!", ref.getSourceObj());
        return false;
    }
    Effects restorationEffects = new Effects();
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ENDURANCE, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.SET_TO_PERCENTAGE, "70", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ESSENCE, MOD.SET_TO_PERCENTAGE, "100", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_STAMINA, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_TOUGHNESS, MOD.SET_TO_PERCENTAGE, "100", true));
    for (Unit sub : allies) {
        Ref REF = sub.getRef().getTargetingRef(sub);
        restorationEffects.apply(REF);
    }
    float time = 20;
    getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
    // applyRested();
    for (Unit sub : allies) {
    }
    return true;
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Effects(main.ability.effects.Effects) Unit(eidolons.entity.obj.unit.Unit) LinkedList(java.util.LinkedList)

Example 2 with DC_HeroItemObj

use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.

the class ModifyCounterEffect method applyThis.

@Override
public boolean applyThis() {
    Ref REF = Ref.getCopy(ref);
    Integer amount = formula.getInt(ref);
    // MODIFY_BY_CONST Counter: {ACTIVE_PARAMS.BLEEDING_MOD}/100*(20-({TARGET_C_TOUGHNESS}*100/{TARGET_TOUGHNESS})*10/100)
    if (getResistanceMod() != null) {
        amount = MathMaster.applyMod(amount, getResistanceMod());
    }
    int mod = 0;
    if (ref.getTargetObj() instanceof DC_HeroItemObj) {
        try {
            mod = ref.getSourceObj().getIntParam(DC_ContentManager.getCoatingAppliedModParam(CounterMaster.findCounterConst(counterName)));
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    Integer modValue = MathMaster.addFactor(amount, mod);
    REF.setAmount(modValue);
    REF.setValue(KEYS.STRING, counterName);
    new Event(STANDARD_EVENT_TYPE.COUNTER_BEING_MODIFIED, REF).fire();
    boolean result = false;
    switch(modtype) {
        case MODIFY_BY_CONST:
            result = ref.getTargetObj().modifyCounter(counterName, modValue);
            break;
        case MODIFY_BY_PERCENT:
            result = ref.getTargetObj().modifyCounter(counterName, modValue);
            break;
        case SET:
            result = ref.getTargetObj().setCounter(counterName, modValue);
            break;
        default:
            break;
    }
    if (CoreEngine.isPhaseAnimsOn())
        if (result) {
            try {
                getAnimation().addPhaseArgs(PHASE_TYPE.COUNTER, counterName, modtype, modValue);
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        } else {
            return false;
        }
    REF.setAmount(ref.getTargetObj().getCounter(counterName));
    return new Event(STANDARD_EVENT_TYPE.COUNTER_MODIFIED, REF).fire();
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) Event(main.game.logic.event.Event)

Example 3 with DC_HeroItemObj

use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.

the class UnitShop method equip.

private static void equip(Unit unit, DC_HeroItemObj item, ITEM_SLOT slot) {
    if (slot != null) {
        if (!unit.equip(item, slot)) {
            LogMaster.log(1, unit.getName() + " failed to equip " + item.getName());
        }
    } else {
        if (item instanceof DC_JewelryObj) {
            unit.addJewelryItem((DC_JewelryObj) item);
        } else {
            if (item instanceof DC_QuickItemObj) {
                unit.getQuickItems().add((DC_QuickItemObj) item);
            } else {
                DC_HeroItemObj itemObj = ItemFactory.createItemObj(item.getType(), unit.getOriginalOwner(), unit.getGame(), unit.getRef(), true);
                unit.getQuickItems().add((DC_QuickItemObj) itemObj);
            }
        }
    }
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_JewelryObj(eidolons.entity.item.DC_JewelryObj)

Example 4 with DC_HeroItemObj

use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.

the class UnitShop method buy.

private static boolean buy(String repertoire, Unit unit, ITEM_SLOT slot, OBJ_TYPE OBJ_TYPE_ENUM) {
    // Map<ObjType, Integer>
    List<ObjType> itemPool = new ArrayList<>();
    // ++ add weight! choose from repertoire!
    WeightMap<ObjType> map = new WeightMap<>(new RandomWizard<ObjType>().constructWeightMap(repertoire, ObjType.class, OBJ_TYPE_ENUM));
    Loop.startLoop(map.size());
    while (!Loop.loopEnded() && !map.isEmpty()) {
        ObjType baseType = getItem(map);
        map.remove(baseType);
        if (baseType == null) {
            // *empty*
            return false;
        }
        for (ObjType type : DataManager.getTypes(OBJ_TYPE_ENUM)) {
            if (!checkItemType(type, baseType)) {
                continue;
            }
            if (!checkCanEquip(baseType, unit, slot)) {
                continue;
            }
            if (!specialCheck(unit, type)) {
                continue;
            }
            // TODO for potions/jewelry?
            if (// for potions/ammo?
            !checkQualityRange(type, unit)) {
                continue;
            }
            itemPool.add(type);
        }
        try {
            itemPool = (List<ObjType>) SortMaster.sortByValue(itemPool, PARAMS.GOLD_COST, true);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
        DC_HeroItemObj item = null;
        for (ObjType type : itemPool) {
            // sort by cost? then go from top to bottom trying to buy...
            if (!checkCost(type, unit)) {
                continue;
            }
            item = buy(type, unit);
            break;
        }
        if (item == null) {
            continue;
        }
        equip(unit, item, slot);
        return true;
    }
    return false;
// ++ sell TODO
}
Also used : ObjType(main.entity.type.ObjType) RandomWizard(main.system.auxiliary.RandomWizard) ArrayList(java.util.ArrayList) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) WeightMap(main.system.datatypes.WeightMap)

Example 5 with DC_HeroItemObj

use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.

the class SwapItemManager method removeType.

@Override
public void removeType(Entity type, PROPERTY p) {
    if (!hasOperations()) {
        return;
    }
    DC_HeroItemObj item = (DC_HeroItemObj) ObjUtilities.findObjByType(type, getHero().getInventory());
    getHero().removeFromInventory(item);
    // getHero().setInventory(null);
    getHero().getGame().getDroppedItemManager().drop(item, getHero());
    operationDone(OPERATIONS.DROP, type.getName());
    CharacterCreator.getHeroManager().update(getHero());
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Aggregations

DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)29 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)7 Obj (main.entity.obj.Obj)6 Ref (main.entity.Ref)5 ObjType (main.entity.type.ObjType)5 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)3 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)3 Unit (eidolons.entity.obj.unit.Unit)3 ArrayList (java.util.ArrayList)3 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)2 Coordinates (main.game.bf.Coordinates)2 RandomWizard (main.system.auxiliary.RandomWizard)2 WeightMap (main.system.datatypes.WeightMap)2 CanActCondition (eidolons.ability.conditions.special.CanActCondition)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1