Search in sources :

Example 6 with DC_QuickItemObj

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

the class DC_HeroManager method addQuickItem_.

private int addQuickItem_(Unit hero, DC_HeroItemObj itemObj) {
    hero.removeFromInventory(itemObj);
    // } else
    if (itemObj instanceof DC_WeaponObj) {
        hero.getQuickItems().add(new DC_QuickItemObj(itemObj.getType(), hero.getOwner(), game, hero.getRef(), true));
    } else {
        hero.getQuickItems().add((DC_QuickItemObj) itemObj);
    }
    update(hero);
    return 1;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Example 7 with DC_QuickItemObj

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

the class PanelActionsDataSource method getQuickSlotActions.

@Override
public List<ActionValueContainer> getQuickSlotActions() {
    final DequeImpl<DC_QuickItemObj> items = unit.getQuickItems();
    if (items == null)
        return (List<ActionValueContainer>) ListMaster.fillWithNullElements(new ArrayList<ActionValueContainer>(), unit.getRemainingQuickSlots());
    List<ActionValueContainer> list = items.stream().map((DC_QuickItemObj key) -> {
        boolean valid = key.getActive().canBeManuallyActivated();
        final ActionValueContainer valueContainer = new ActionValueContainer(valid, getOrCreateR(key.getImagePath()), key::invokeClicked);
        ActionCostTooltip tooltip = new ActionCostTooltip(key.getActive());
        tooltip.setUserObject(new ActionCostSourceImpl(key.getActive()));
        valueContainer.addListener(tooltip.getController());
        return valueContainer;
    }).collect(Collectors.toList());
    ObjType type = DataManager.getType(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()), DC_TYPE.ACTIONS);
    TextureRegion invTexture = TextureCache.getOrCreateR(type.getImagePath());
    DC_UnitAction action = unit.getAction(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()));
    if (action == null)
        return list;
    boolean valid = action.canBeManuallyActivated();
    ActionValueContainer invButton = new ActionValueContainer(valid, invTexture, () -> {
        action.clicked();
    });
    list.add(invButton);
    for (int i = 0; i < unit.getRemainingQuickSlots() - 1; i++) {
        list.add(null);
    }
    return list;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ActionValueContainer(eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer) ObjType(main.entity.type.ObjType) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 8 with DC_QuickItemObj

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

the class RadialManager method configureAttackParentNode.

protected static RadialValueContainer configureAttackParentNode(List<RadialValueContainer> list, RADIAL_PARENT_NODE parentNode, DC_Obj target, DC_ActiveObj parent) {
    if (parent.getActiveWeapon().isRanged()) {
        if (parent.getRef().getObj(Ref.KEYS.AMMO) == null) {
            for (DC_QuickItemObj ammo : parent.getOwnerObj().getQuickItems()) {
                final RadialValueContainer valueContainer = new RadialValueContainer(getOrCreateR(ammo.getImagePath()), getRunnable(target, ammo.getActive()));
                addSimpleTooltip(valueContainer, ammo.getName());
                list.add(valueContainer);
            }
        }
    }
    RadialValueContainer valueContainer = new RadialValueContainer(new TextureRegion(getTextureForActive(parent, target)), null, checkValid(parent, target), parent, target);
    addSimpleTooltip(valueContainer, parentNode.getName());
    valueContainer.setChildNodes(list);
    return valueContainer;
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Example 9 with DC_QuickItemObj

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

the class AmmoEffect method applyThis.

@Override
public boolean applyThis() {
    DC_WeaponObj rangedWeapon = (DC_WeaponObj) ref.getObj(KEYS.RANGED);
    if (add) {
        DC_QuickItemObj ammo = (DC_QuickItemObj) ref.getActive().getRef().getObj(KEYS.AMMO);
        rangedWeapon.setAmmo(ammo);
    } else {
        rangedWeapon.setAmmo(null);
    }
    return true;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Example 10 with DC_QuickItemObj

use of eidolons.entity.item.DC_QuickItemObj 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_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)17 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)7 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)6 Ref (main.entity.Ref)4 Unit (eidolons.entity.obj.unit.Unit)3 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 Obj (main.entity.obj.Obj)2 CanActCondition (eidolons.ability.conditions.special.CanActCondition)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)1 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)1 ActionValueContainer (eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer)1 ActionCostTooltip (eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Effects (main.ability.effects.Effects)1 ITEM_SLOT (main.content.enums.entity.ItemEnums.ITEM_SLOT)1 WEAPON_GROUP (main.content.enums.entity.ItemEnums.WEAPON_GROUP)1