Search in sources :

Example 6 with DC_WeaponObj

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

the class AnimMaster3d method getAtlasFileKeyForAction.

public static String getAtlasFileKeyForAction(Boolean projection, DC_ActiveObj activeObj, WEAPON_ANIM_CASE aCase) {
    if (aCase == WEAPON_ANIM_CASE.POTION)
        return getPotionKey(activeObj);
    DC_WeaponObj weapon = activeObj.getActiveWeapon();
    String actionName = null;
    String projectionString = "to";
    // if (aCase != WEAPON_ANIM_CASE.RELOAD) {
    projectionString = (projection == null ? "hor" : (projection ? "from" : "to"));
    // }
    if (aCase.isMissile()) {
        if (weapon.getLastAmmo() == null)
            return null;
        weapon = weapon.getLastAmmo().getWrappedWeapon();
    }
    if (aCase.isMiss() && isMissSupported()) {
        actionName = "miss";
    } else
        switch(aCase) {
            case RELOAD:
                // weapon
                actionName = "reload";
                break;
            case MISSILE:
                actionName = null;
                break;
            case READY:
                actionName = "awaiting";
                break;
            case PARRY:
                actionName = "parry";
                break;
            case BLOCKED:
                actionName = "blocked";
                break;
            default:
                actionName = getActionAtlasKey(activeObj);
        }
    Boolean offhand = null;
    if (projection != null)
        if (isAssymetric(weapon.getProperty(G_PROPS.BASE_TYPE)))
            offhand = (activeObj.isOffhand());
    return getAtlasFileKeyForAction(projectionString, getWeaponAtlasKey(weapon), actionName, offhand);
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj)

Example 7 with DC_WeaponObj

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

the class ArmorMaster method getShieldDamageBlocked.

public int getShieldDamageBlocked(Integer damage, Unit attacked, Unit attacker, DC_ActiveObj action, DC_WeaponObj weapon, DAMAGE_TYPE damage_type) {
    if (checkCanShieldBlock(action, attacked)) {
        return 0;
    }
    DC_WeaponObj shield = (DC_WeaponObj) attacked.getRef().getObj(KEYS.OFFHAND);
    String message;
    boolean spell = action.isSpell();
    boolean zone = action.isZone();
    boolean offhand = action.isOffhand();
    Integer chance = getShieldBlockChance(shield, attacked, attacker, weapon, action, offhand, spell);
    if (!zone) {
        if (// will be average instead
        !simulation) {
            if (!RandomWizard.chance(chance)) {
                message = StringMaster.getMessagePrefix(true, attacked.getOwner().isMe()) + attacked.getName() + " fails to use " + shield.getName() + " to block " + action.getName() + StringMaster.wrapInParenthesis(chance + "%");
                action.getGame().getLogManager().log(LOG.GAME_INFO, message, ENTRY_TYPE.DAMAGE);
                return 0;
            }
        }
    }
    Integer blockValue = getShieldBlockValue(damage, shield, attacked, attacker, weapon, action, zone);
    blockValue = Math.min(blockValue, damage);
    if (!simulation) {
        action.getRef().setID(KEYS.BLOCK, shield.getId());
        int durabilityLost = reduceDurability(blockValue, shield, spell, damage_type, attacker.getActiveWeapon(offhand), damage);
        // attacked.getIntParam(PARAMS.SHIELD_MASTERY)) / 100;
        if (blockValue <= 0) {
            action.getGame().getLogManager().log(LOG.GAME_INFO, shield.getName() + " is ineffective against " + action.getName() + "!", ENTRY_TYPE.DAMAGE);
            return 0;
        }
        DC_SoundMaster.playBlockedSound(attacker, attacked, shield, weapon, blockValue, damage);
        // durabilityMod);
        if (CoreEngine.isPhaseAnimsOn()) {
            PhaseAnimation animation = action.getGame().getAnimationManager().getAnimation(Attack.getAnimationKey(action));
            animation.addPhase(new AnimPhase(PHASE_TYPE.REDUCTION_SHIELD, chance, blockValue, durabilityLost, damage, damage_type, shield));
        }
        message = attacked.getName() + " uses " + shield.getName() + " to block" + "" + " " + blockValue + " out of " + damage + " " + damage_type + " damage from " + // StringMaster.wrapInParenthesis
        (action.getName());
        action.getGame().getLogManager().log(LOG.GAME_INFO, message, ENTRY_TYPE.DAMAGE);
    }
    return blockValue;
}
Also used : AnimPhase(main.system.graphics.AnimPhase) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) PhaseAnimation(eidolons.system.graphics.PhaseAnimation)

Example 8 with DC_WeaponObj

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

the class DamageCalculator method getUnitAttackDamage.

/**
 * @param unit
 * @param offhand
 * @return Displayed damage value for units (average)
 */
@Deprecated
public static Integer getUnitAttackDamage(Unit unit, boolean offhand) {
    int amount = unit.getIntParam(PARAMS.BASE_DAMAGE);
    DC_WeaponObj weapon = unit.getWeapon(offhand);
    if (weapon == null) {
        weapon = unit.getNaturalWeapon(offhand);
    }
    if (weapon == null) {
        return (offhand) ? 0 : amount;
    }
    amount = initializeDamageModifiers(amount, offhand, unit, weapon);
    return amount;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj)

Example 9 with DC_WeaponObj

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

the class DC_ActionManager method checkAddThrowAction.

private boolean checkAddThrowAction(Unit unit, boolean offhand) {
    DC_WeaponObj weapon = unit.getWeapon(offhand);
    if (weapon == null) {
        return false;
    }
    if (weapon.isShield()) {
        if (weapon.getWeaponGroup() == ItemEnums.WEAPON_GROUP.BUCKLERS) {
            if (unit.checkBool(GenericEnums.STD_BOOLS.BUCKLER_THROWER)) {
                return false;
            }
        }
    }
    if (!weapon.isWeapon()) {
        return false;
    }
    if (weapon.isRanged()) {
        return false;
    }
    if (weapon.isNatural()) {
        return false;
    }
    Integer bonus = unit.getIntParam(PARAMS.THROW_SIZE_BONUS);
    if (bonus > -2) {
        if (weapon.getWeaponSize() == ItemEnums.WEAPON_SIZE.TINY) {
            return true;
        }
    }
    if (bonus > -1) {
        if (weapon.getWeaponSize() == ItemEnums.WEAPON_SIZE.SMALL) {
            return true;
        }
    }
    if (bonus > 2) {
        if (weapon.getWeaponSize() == ItemEnums.WEAPON_SIZE.HUGE) {
            return true;
        }
    }
    if (bonus > 1) {
        if (weapon.getWeaponSize() == ItemEnums.WEAPON_SIZE.LARGE) {
            return true;
        }
    }
    if (bonus > 0) {
        if (weapon.getWeaponSize() == ItemEnums.WEAPON_SIZE.MEDIUM) {
            return true;
        }
    }
    return false;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj)

Example 10 with DC_WeaponObj

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

the class UnitDataSource method getWeaponValueContainer.

private ValueContainer getWeaponValueContainer(DC_WeaponObj weapon) {
    TextureRegion image;
    if (weapon != null) {
        image = getOrCreateR(weapon.getImagePath());
    } else {
        image = getOrCreateR(CELL_TYPE.WEAPON_MAIN.getSlotImagePath());
    }
    ValueContainer valueContainer = new ValueContainer(image);
    if (weapon != null) {
        List<ValueContainer> list = new ArrayList<>();
        for (int i = 0; i < WEAPON_DC_INFO_PARAMS.length; i++) {
            PARAMS p = WEAPON_DC_INFO_PARAMS[i];
            String value = String.valueOf(weapon.getIntParam(p));
            String name = p.getName();
            final ValueContainer tooltipContainer = new ValueContainer(name, value);
            tooltipContainer.pad(10);
            list.add(tooltipContainer);
        }
        Tooltip tooltip = new WeaponTooltip();
        tooltip.setUserObject(new WeaponToolTipDataSource() {

            @Override
            public List<ValueContainer> getMainParams() {
                return list;
            }

            @Override
            public List<ValueContainer> getBuffs() {
                return weapon.getBuffs().stream().filter(obj -> StringUtils.isNoneEmpty(obj.getType().getProperty(G_PROPS.IMAGE))).map(AttackTooltipFactory.getObjValueContainerMapper()).collect(Collectors.toList());
            }
        });
        valueContainer.addListener(tooltip.getController());
    }
    return valueContainer;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) Arrays(java.util.Arrays) AttackTooltipFactory(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltipFactory) UiMaster(eidolons.libgdx.gui.UiMaster) PARAMS(eidolons.content.PARAMS) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource) TextureCache.getOrCreateR(eidolons.libgdx.texture.TextureCache.getOrCreateR) Pair(org.apache.commons.lang3.tuple.Pair) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Tooltip(eidolons.libgdx.gui.tooltips.Tooltip) G_PROPS(main.content.values.properties.G_PROPS) DC_UnitAction(eidolons.entity.active.DC_UnitAction) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) CELL_TYPE(eidolons.libgdx.gui.panels.dc.inventory.InventoryClickHandler.CELL_TYPE) AttackTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip) Collectors(java.util.stream.Collectors) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) PARAMETER(main.content.values.parameters.PARAMETER) ImageManager(main.system.images.ImageManager) List(java.util.List) TextureCache(eidolons.libgdx.texture.TextureCache) ValuePages(eidolons.content.ValuePages) ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) Unit(eidolons.entity.obj.unit.Unit) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) Tooltip(eidolons.libgdx.gui.tooltips.Tooltip) AttackTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip) ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) ArrayList(java.util.ArrayList) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ArrayList(java.util.ArrayList) List(java.util.List) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) PARAMS(eidolons.content.PARAMS) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)

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