Search in sources :

Example 11 with DC_HeroItemObj

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

the class DC_InventoryManager method execute.

private void execute(OPERATIONS operation, String typeName) {
    DC_HeroItemObj item = getHero().findItem(typeName, getMode(operation));
    execute(operation, item.getType());
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 12 with DC_HeroItemObj

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

the class DC_InventoryManager method execute.

private int execute(OPERATIONS operation, Entity type) {
    boolean alt = false;
    // if (operation == OPERATIONS.PICK_UP) {
    // item = unit.getGame().getDroppedItemManager().findDroppedItem(typeName,
    // unit.getCoordinates()); // TODO finish
    // }
    DC_HeroItemObj item = null;
    item = (DC_HeroItemObj) type;
    // getHero().
    // findItem(type.getName(),
    // getMode(operation));
    boolean drop = false;
    int cost = 0;
    switch(operation) {
        case EQUIP:
            cost = CharacterCreator.getHeroManager().addSlotItem(getHero(), type, alt);
            break;
        case DROP:
            drop = true;
        case UNEQUIP:
            cost = 1;
            getHero().unequip(item, drop);
            break;
        case EQUIP_QUICK_SLOT:
            // CharacterCreator.getHeroManager().addItem(unit, type,
            // OBJ_TYPES.ITEMS, PROPS.QUICK_ITEMS, true);
            cost = CharacterCreator.getHeroManager().addQuickItem(getHero(), type);
            break;
        case PICK_UP:
            cost = 1;
            game.getDroppedItemManager().pickUp(getHero(), type);
            break;
        case UNEQUIP_QUICK_SLOT:
            cost = 1;
            CharacterCreator.getHeroManager().removeQuickSlotItem(getHero(), type);
            break;
    }
    return cost;
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 13 with DC_HeroItemObj

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

the class CreateItemEffect method applyThis.

@Override
public boolean applyThis() {
    if (!groupInitialized) {
        initGroup();
    }
    String typeName = ListChooser.chooseType(typeList, TYPE);
    typeName = typeName.trim();
    if (!DataManager.isTypeName(material.getName() + " " + typeName)) {
        ItemGenerator.getDefaultGenerator().generateItem(ItemEnums.QUALITY_LEVEL.NORMAL, material, DataManager.getType(typeName, TYPE));
    }
    typeName = material.getName() + " " + typeName;
    ObjType type = new ObjType(DataManager.getType(typeName, TYPE));
    Integer durability = (type.getIntParam(PARAMS.DURABILITY) * durabilityFormula.getInt(ref)) / 100;
    type.setParam(PARAMS.DURABILITY, durability);
    DC_HeroItemObj item = ItemGenerator.getDefaultGenerator().createItem(type, ref, // init
    false);
    String itemName = prefix + item.getName();
    item.setName(itemName);
    // Entity hero = ref.getTargetObj();
    // if (!game.getRequirementsManager().preCheck(hero, item))
    // // if cannot use, add to inventory
    // return new ManipulateInventoryEffect(INVENTORY_ACTIONS.ADD)
    // .apply(ref);
    EquipEffect equipEffect = new EquipEffect(item);
    ref.setID((weapon) ? KEYS.WEAPON : KEYS.ARMOR, item.getId());
    return equipEffect.apply(ref);
}
Also used : ObjType(main.entity.type.ObjType) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 14 with DC_HeroItemObj

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

the class DurabilityReductionEffect method applyThis.

@Override
public boolean applyThis() {
    Obj weapon = ref.getObj(KEYS.WEAPON);
    Obj armorItem = ref.getTargetObj().getRef().getObj(KEYS.ARMOR);
    int amount = (dmg_amount == null) ? ref.getAmount() : dmg_amount;
    int armor = 0;
    durabilityLost = 0;
    if (armorItem != null) {
        armor = armorItem.getIntParam(PARAMS.ARMOR);
    }
    if (attacker == null) {
        // spell
        DC_HeroItemObj item = (DC_HeroItemObj) ref.getTargetObj();
        // mod = ref.getActive().getIntParam(param, base)
        durabilityLost = item.reduceDurabilityForDamage(dmg_amount, armor, 100, simulation);
        return true;
    }
    DC_HeroItemObj item = (DC_HeroItemObj) ((attacker) ? weapon : armorItem);
    if (item == null) {
        return false;
    }
    if (attacker) {
        if (ref.getObj(KEYS.SPELL) != null) {
            return false;
        }
    }
    // ref.getObj(KEYS.TARGET).getIntParam(PARAMS.ARMOR);
    int mod;
    mod = ((attacker) ? weapon : armorItem).getIntParam(PARAMS.DURABILITY_DAMAGE_MOD);
    int hardness = ((!attacker) ? weapon : armorItem).getIntParam(PARAMS.HARDNESS);
    int hardness2 = ((attacker) ? weapon : armorItem).getIntParam(PARAMS.HARDNESS);
    mod += hardness * 100 / hardness2;
    if (mod > 0) {
        durabilityLost = item.reduceDurabilityForDamage(amount, armor, mod, simulation);
    }
    return true;
}
Also used : Obj(main.entity.obj.Obj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 15 with DC_HeroItemObj

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

the class TossItemEffect method applyThis.

/*
     * size? from hand?
	 * 
	 * interrupt?
	 */
@Override
public boolean applyThis() {
    Unit source = (Unit) ref.getSourceObj();
    Ref REF = ref.getCopy();
    conditions = new OrConditions(DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.MY_ITEM), DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON));
    if (!new SelectiveTargeting(conditions).select(REF)) {
        ref.getActive().setCancelled(true);
        return false;
    }
    DC_HeroItemObj item = (DC_HeroItemObj) REF.getTargetObj();
    conditions = new Conditions(// ++ Max distance?
    new DistanceCondition(ref.getActive().getIntParam(PARAMS.RANGE, false) + ""), // new NumericCondition("{match_c_n_of_actions}", "1"),
    new CanActCondition(KEYS.MATCH), new NotCondition(ConditionMaster.getSelfFilterCondition()), DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.ANY_ALLY));
    // non-immobile, ++facing?
    if (!new SelectiveTargeting(conditions).select(REF)) {
        ref.getActive().setCancelled(true);
        return false;
    }
    Unit unit = (Unit) REF.getTargetObj();
    boolean result = roll(source, unit, item);
    if (item instanceof DC_QuickItemObj) {
        DC_QuickItemObj quickItem = (DC_QuickItemObj) item;
        source.removeQuickItem(quickItem);
        if (result) {
            unit.addQuickItem(quickItem);
        } else {
            dropped(item, unit);
        }
    } else {
        source.unequip(item, null);
        if (result) {
            // TODO equip in hand if
            unit.addItemToInventory(item);
        } else // possible? spend AP?
        {
            dropped(item, unit);
        }
    }
    // ref.getObj(KEYS.ITEM);
    unit.modifyParameter(PARAMS.C_N_OF_ACTIONS, -1);
    return true;
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) Ref(main.entity.Ref) CanActCondition(eidolons.ability.conditions.special.CanActCondition) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Unit(eidolons.entity.obj.unit.Unit)

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