Search in sources :

Example 21 with DC_WeaponObj

use of eidolons.entity.item.DC_WeaponObj 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 22 with DC_WeaponObj

use of eidolons.entity.item.DC_WeaponObj 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_WeaponObj (eidolons.entity.item.DC_WeaponObj)22 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)7 Unit (eidolons.entity.obj.unit.Unit)3 ArrayList (java.util.ArrayList)3 PARAMS (eidolons.content.PARAMS)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)2 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)2 Ref (main.entity.Ref)2 Obj (main.entity.obj.Obj)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)1 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)1 ValuePages (eidolons.content.ValuePages)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)1 DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)1