Search in sources :

Example 16 with DC_QuickItemObj

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

the class InventoryTransactionManager method equipOriginalItems.

public static void equipOriginalItems(Unit to, Obj from) {
    for (Obj i : to.getGame().getDroppedItemManager().getDroppedItems(to.getGame().getCellByCoordinate(to.getCoordinates()))) {
        if (i.getRef().getSourceObj() == from) {
            ITEM_SLOT slot = null;
            if (i.getOBJ_TYPE_ENUM() == DC_TYPE.ARMOR) {
                slot = ItemEnums.ITEM_SLOT.ARMOR;
            } else {
                if (from.getRef().getObj(KEYS.WEAPON) == i) {
                    slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
                } else if (from.getRef().getObj(KEYS.OFFHAND) == i) {
                    slot = ItemEnums.ITEM_SLOT.OFF_HAND;
                }
            }
            if (slot == null) {
                if (i instanceof DC_WeaponObj) {
                    DC_WeaponObj weaponObj = (DC_WeaponObj) i;
                    if (weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.MAIN_HAND_ONLY || weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.TWO_HANDED || weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.DOUBLE) {
                        slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
                    } else if (to.getMainWeapon() != null) {
                        slot = ItemEnums.ITEM_SLOT.OFF_HAND;
                    } else {
                        slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
                    }
                }
            }
            // ITEM_SLOT.MAIN_HAND;
            to.getGame().getDroppedItemManager().pickedUp(i);
            i.setRef(to.getRef());
            // equip() !
            if (slot == null) {
                to.getQuickItems().add((DC_QuickItemObj) i);
            } else {
                to.equip((DC_HeroItemObj) i, slot);
            }
        }
    }
}
Also used : ITEM_SLOT(main.content.enums.entity.ItemEnums.ITEM_SLOT) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Obj(main.entity.obj.Obj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 17 with DC_QuickItemObj

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

the class AnimMaster3d method preloadAtlases.

public static void preloadAtlases(Unit unit) {
    DC_WeaponObj weapon = unit.getWeapon(false);
    if (weapon != null)
        preloadAtlas(weapon);
    weapon = unit.getWeapon(true);
    if (weapon != null)
        preloadAtlas(weapon);
    weapon = unit.getNaturalWeapon(false);
    if (weapon != null)
        preloadAtlas(weapon);
    weapon = unit.getNaturalWeapon(true);
    if (weapon != null)
        preloadAtlas(weapon);
    for (DC_QuickItemObj sub : unit.getQuickItems()) {
        if (sub.isAmmo()) {
            preloadAtlas(sub.getWrappedWeapon());
        } else {
            if (sub.getWrappedWeapon() == null) {
                String path = getPotionAtlasPath(sub.getActive());
                preloadAtlas(path);
            }
        }
    }
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

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