Search in sources :

Example 1 with DC_QuickItemAction

use of eidolons.entity.active.DC_QuickItemAction in project Eidolons by IDemiurge.

the class DC_QuickItemObj method construct.

@Override
public void construct() {
    if (active == null) {
        if (wrapped) {
            generateWrappedActive();
            return;
        }
    }
    if (!constructed) {
        ref.setID(KEYS.ACTIVE, getId());
    } else {
        if (getActive() == null) {
            generateWrappedActive();
        } else {
            // TODO for parsing?
            ref.setID(KEYS.ACTIVE, getActive().getId());
        }
    }
    super.construct();
    if (!StringMaster.isEmpty(getProperty(PROPS.ITEM_SPELL))) {
    }
    if (// ?
    actives == null) {
        return;
    }
    if (actives.isEmpty()) {
        return;
    }
    ObjType type = initActiveType();
    setActive(new DC_QuickItemAction(type, getOriginalOwner(), getGame(), ref));
    getActive().setActives(getActives());
    getActive().setConstructed(true);
    getActive().setItem(this);
}
Also used : ObjType(main.entity.type.ObjType) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction)

Example 2 with DC_QuickItemAction

use of eidolons.entity.active.DC_QuickItemAction in project Eidolons by IDemiurge.

the class AnimMaster3d method getPotionAtlasPath.

private static String getPotionAtlasPath(DC_ActiveObj activeObj) {
    DC_QuickItemAction action = (DC_QuickItemAction) activeObj;
    String name = action.getItem().getName();
    String level = name.split(" ")[0];
    return StrPathBuilder.build(PathFinder.getSpritesPathNew(), "potions", "atlas", level, name + ".txt").replace(" ", "_");
}
Also used : DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction)

Example 3 with DC_QuickItemAction

use of eidolons.entity.active.DC_QuickItemAction in project Eidolons by IDemiurge.

the class PriorityManagerImpl method applyThrowPenalty.

private void applyThrowPenalty(DC_ActiveObj active) {
    DC_WeaponObj item = null;
    boolean offhand = active.isOffhand();
    boolean quick = active instanceof DC_QuickItemAction;
    if (quick) {
        DC_QuickItemAction itemActiveObj = (DC_QuickItemAction) active;
        item = itemActiveObj.getItem().getWrappedWeapon();
    } else {
        item = getUnit().getWeapon(offhand);
    }
    if (item == null) {
        return;
    }
    int factor = (int) -Math.sqrt(item.getIntParam(PARAMS.GOLD_COST)) * 50;
    if (!quick) {
        factor *= 2;
    }
    if (!offhand) {
        factor *= 2;
    }
    addConstant(factor, "item thrown");
    if (priority > 0) {
        addMultiplier(factor / 5, "item thrown");
    }
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction)

Example 4 with DC_QuickItemAction

use of eidolons.entity.active.DC_QuickItemAction in project Eidolons by IDemiurge.

the class CoatingRule method unitIsHit.

public static void unitIsHit(BattleFieldObject target, Unit source, boolean offhand, DC_ActiveObj action, Attack attack, DC_Obj weapon) {
    boolean throwing = false;
    // DC_WeaponObj weaponObj = (DC_WeaponObj) weapon;
    if (action.isRanged()) {
        if (action.getRef().getObj(KEYS.RANGED) != null) {
            if (!action.isThrow()) {
                if (action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO) != null) {
                    weapon = (DC_Obj) action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO);
                }
            }
        }
    }
    if (action instanceof DC_QuickItemAction) {
        weapon = (DC_Obj) action.getRef().getObj(KEYS.ITEM);
        throwing = true;
    }
    DC_Obj armor = (DC_Obj) target.getRef().getObj(KEYS.ARMOR);
    for (COUNTER c : COATING_COUNTERS) {
        boolean ranged = action.isRanged() || throwing;
        applyCounters(target, weapon, source, c, action, throwing);
        if (// TODO throwing doesn't count?
        ranged) {
            continue;
        }
        // counters could have effect on items as well, durability at least
        if (armor != null) {
            applyCounters(source, armor, target, c, action, throwing);
        }
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction) COUNTER(main.content.enums.entity.UnitEnums.COUNTER)

Example 5 with DC_QuickItemAction

use of eidolons.entity.active.DC_QuickItemAction in project Eidolons by IDemiurge.

the class DC_QuickItemObj method generateWrappedActive.

private void generateWrappedActive() {
    String typeName;
    setWrappedWeapon(new DC_WeaponObj(type, owner, getGame(), ref));
    if (checkProperty(G_PROPS.WEAPON_TYPE, ItemEnums.WEAPON_TYPE.AMMO + "")) {
        this.ammo = true;
        typeName = DC_ActionManager.RELOAD + " " + type.getGroup();
        ref.setID(KEYS.AMMO, id);
        // TODO C_
        setParam(PARAMS.CHARGES, getIntParam(PARAMS.DURABILITY));
        // in
        // any
        // pesistent
        // version!
        setParam(PARAMS.C_CHARGES, getIntParam(PARAMS.CHARGES));
    } else {
        typeName = DC_ActionManager.THROW;
        // will it not have effect on hero?
        ref.setID(KEYS.WEAPON, getWrappedWeapon().getId());
        setParam(PARAMS.CHARGES, 1);
        setParam(PARAMS.C_CHARGES, 1);
    }
    ObjType type = new ObjType(DataManager.getType(typeName, DC_TYPE.ACTIONS));
    type.setProperty(G_PROPS.IMAGE, getImagePath());
    type.setProperty(G_PROPS.NAME, type.getName() + "" + StringMaster.wrapInParenthesis(getName()));
    type.setGame(game);
    setActive(new DC_QuickItemAction(type, getOriginalOwner(), getGame(), ref));
    getActive().setItem(this);
}
Also used : ObjType(main.entity.type.ObjType) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction)

Aggregations

DC_QuickItemAction (eidolons.entity.active.DC_QuickItemAction)6 ObjType (main.entity.type.ObjType)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 COUNTER (main.content.enums.entity.UnitEnums.COUNTER)1