Search in sources :

Example 1 with WEAPON_GROUP

use of main.content.enums.entity.ItemEnums.WEAPON_GROUP in project Eidolons by IDemiurge.

the class ActionSequenceConstructor method getRangedReloadAction.

// now replaced with Atomic logic?
private List<AiQuickItemAction> getRangedReloadAction(Action action) {
    Obj weapon = action.getActive().getRef().getObj(KEYS.RANGED);
    WEAPON_GROUP weapon_group = null;
    List<AiQuickItemAction> list = new ArrayList<>();
    if (weapon instanceof DC_WeaponObj) {
        DC_WeaponObj dc_WeaponObj = (DC_WeaponObj) weapon;
        if (dc_WeaponObj.getWeaponGroup() == ItemEnums.WEAPON_GROUP.BOWS) {
            weapon_group = ItemEnums.WEAPON_GROUP.ARROWS;
        }
        if (dc_WeaponObj.getWeaponGroup() == ItemEnums.WEAPON_GROUP.CROSSBOWS) {
            weapon_group = ItemEnums.WEAPON_GROUP.BOLTS;
        }
        for (DC_QuickItemObj ammo : action.getSource().getQuickItems()) {
            if (!ammo.isAmmo()) {
                continue;
            }
            ammo.construct();
            if (ammo.getWrappedWeapon().getWeaponGroup() == weapon_group) {
                AiQuickItemAction qia = new AiQuickItemAction(ammo);
                if (qia.canBeActivated()) {
                    list.add(qia);
                }
            }
        }
    }
    return list;
}
Also used : AiQuickItemAction(eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) WEAPON_GROUP(main.content.enums.entity.ItemEnums.WEAPON_GROUP) ArrayList(java.util.ArrayList) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 AiQuickItemAction (eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction)1 ArrayList (java.util.ArrayList)1 WEAPON_GROUP (main.content.enums.entity.ItemEnums.WEAPON_GROUP)1 Obj (main.entity.obj.Obj)1