Search in sources :

Example 1 with DC_HeroAttachedObj

use of eidolons.entity.obj.attach.DC_HeroAttachedObj in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getUnitPriority.

@Override
public int getUnitPriority(UnitAI unit_ai, Obj targetObj, Boolean less_or_more_for_health) {
    BattleFieldObject target_unit = (BattleFieldObject) targetObj;
    if (targetObj instanceof DC_HeroAttachedObj) {
        DC_HeroAttachedObj attachedObj = (DC_HeroAttachedObj) targetObj;
        targetObj = attachedObj.getOwnerObj();
    }
    Integer basePriority = targetObj.getIntParam(PARAMS.POWER);
    if (unit_ai != null) {
        if (unit_ai.getBehaviorMode() == AiEnums.BEHAVIOR_MODE.BERSERK) {
            basePriority = 100;
        } else if (targetObj.getOBJ_TYPE_ENUM() == DC_TYPE.BF_OBJ) {
            if (!Analyzer.isBlockingMovement(unit_ai.getUnit(), (Unit) targetObj)) {
                return 0;
            }
            basePriority = 20;
        }
    }
    Integer healthMod = 100;
    if (less_or_more_for_health != null) {
        healthMod = getHealthFactor(targetObj, less_or_more_for_health);
    } else {
        if (targetObj instanceof Unit)
            if (((Unit) targetObj).isUnconscious()) {
                return Math.round(// [QUICK FIX] - more subtle?
                basePriority * getConstValue(AiConst.UNCONSCIOUS_UNIT_PRIORITY_MOD));
            }
    }
    basePriority = basePriority * healthMod / 100;
    // TODO
    return basePriority;
// limit?
}
Also used : DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with DC_HeroAttachedObj

use of eidolons.entity.obj.attach.DC_HeroAttachedObj in project Eidolons by IDemiurge.

the class DC_ItemPanel method getData.

@Override
public Collection<DC_HeroAttachedObj> getData() {
    if (obj instanceof Unit) {
        Unit hero = (Unit) obj;
        ArrayList<DC_HeroAttachedObj> items = new ArrayList<>();
        if (hero.getMainWeapon() == null && hero.getNaturalWeapon(false) != null) {
            items.add(hero.getNaturalWeapon(false));
        } else {
            items.add(hero.getMainWeapon());
        }
        items.add((hero).getArmor());
        if (hero.getOffhandWeapon() == null && hero.getNaturalWeapon(true) != null) {
            items.add(hero.getNaturalWeapon(true));
        } else {
            items.add((hero).getOffhandWeapon());
        }
        return items;
    } else {
        return getEmptyData();
    }
}
Also used : DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) ArrayList(java.util.ArrayList) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

DC_HeroAttachedObj (eidolons.entity.obj.attach.DC_HeroAttachedObj)2 Unit (eidolons.entity.obj.unit.Unit)2 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 ArrayList (java.util.ArrayList)1