Search in sources :

Example 1 with DC_ArmorObj

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

the class UnitDataSource method getParamValues.

@Override
public List<ValueContainer> getParamValues() {
    final DC_ArmorObj armor = unit.getArmor();
    List<ValueContainer> values = new ArrayList<>();
    if (armor != null) {
        final String cd = armor.getStrParam(PARAMS.C_DURABILITY);
        final String d = armor.getStrParam(PARAMS.DURABILITY);
        values.add(new ValueContainer(PARAMS.DURABILITY.getName(), cd + "/" + d));
        final String cover = armor.getStrParam(PARAMS.COVER_PERCENTAGE);
        values.add(new ValueContainer(PARAMS.COVER_PERCENTAGE.getName(), cover));
    }
    return values;
}
Also used : ArrayList(java.util.ArrayList) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 2 with DC_ArmorObj

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

the class ArmorMaster method getArmorBlockDamage.

private int getArmorBlockDamage(boolean shield, boolean spell, boolean canCritOrBlock, boolean average, Integer damage, Unit attacked, Unit attacker, boolean offhand, DAMAGE_TYPE dmg_type, DC_ActiveObj action) {
    /*
         * if blocks, apply armor's resistance values too
		 */
    if (action == null) {
        return 0;
    }
    if (!offhand) {
        offhand = action.isOffhand();
    }
    DC_ArmorObj armorObj = attacked.getArmor();
    if (armorObj == null) {
        return 0;
    }
    if (dmg_type == null) {
        dmg_type = action.getDamageType();
    }
    if (simulation) {
        average = true;
        canCritOrBlock = true;
    }
    int blockedPercentage = getBlockPercentage(shield, spell, canCritOrBlock, average, armorObj, offhand, attacker, attacked, action);
    // action.getGame().getLogManager().newLogEntryNode(type, args)
    // TODO ??? damage =
    // getReducedDamageForArmorResistances(blockedPercentage, armorObj,
    // damage, dmg_type);
    int maxBlockValue = damage * blockedPercentage / 100;
    int blocked = Math.min(getArmorValue(armorObj, dmg_type), maxBlockValue);
    // blocked = MathMaster.applyMod(amount, mod);
    // blocked -= penetration;
    String name = "[No Weapon]";
    if (spell) {
        name = action.getName();
    } else if (attacker.getActiveWeapon(offhand) != null) {
        name = attacker.getActiveWeapon(offhand).getName();
    }
    if (!simulation) {
        action.getRef().setID(KEYS.BLOCK, armorObj.getId());
        String entry = armorObj.getName() + " takes " + blockedPercentage + "% of " + action.getName() + StringMaster.wrapInParenthesis(name) + " absorbing " + blocked + " " + dmg_type.getName() + " damage";
        if (blockedPercentage == 0 || blocked == 0) {
            entry = attacker.getNameIfKnown() + " penetrates " + armorObj.getName() + " with " + name + (action.getName().equals("Attack") ? "" : StringMaster.wrapInParenthesis(action.getName())) + "!";
        } else {
            DC_SoundMaster.playAttackImpactSound(attacker.getActiveWeapon(offhand), attacker, attacked, damage, blocked);
            int durabilityLost = reduceDurability(blocked, armorObj, spell, dmg_type, attacker.getActiveWeapon(offhand), damage);
            if (CoreEngine.isPhaseAnimsOn())
                if (!simulation) {
                    if (!shield) {
                        PhaseAnimation animation = action.getGame().getAnimationManager().getAnimation(Attack.getAnimationKey(action));
                        animation.addPhase(new AnimPhase(PHASE_TYPE.REDUCTION_ARMOR, blockedPercentage, blocked, durabilityLost, damage, dmg_type, armorObj));
                    }
                }
        }
        if (!simulation) {
            action.getGame().getLogManager().log(LOG.GAME_INFO, entry, ENTRY_TYPE.DAMAGE);
        }
    }
    return blocked;
}
Also used : AnimPhase(main.system.graphics.AnimPhase) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj)

Example 3 with DC_ArmorObj

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

the class UnitDataSource method getArmorObj.

@Override
public ValueContainer getArmorObj() {
    final DC_ArmorObj armor = unit.getArmor();
    final ValueContainer container;
    if (armor != null) {
        container = new ValueContainer(getOrCreateR(armor.getImagePath()));
        WeaponTooltip tooltip = new WeaponTooltip();
        tooltip.setUserObject(new WeaponToolTipDataSource() {

            @Override
            public List<ValueContainer> getMainParams() {
                return Arrays.stream(ARMOR_TOOLTIP).map(el -> new ValueContainer(el.getName(), armor.getStrParam(el)).pad(10)).collect(Collectors.toList());
            }

            @Override
            public List<ValueContainer> getBuffs() {
                return armor.getBuffs().stream().filter(obj -> StringUtils.isNoneEmpty(obj.getType().getProperty(G_PROPS.IMAGE))).map(AttackTooltipFactory.getObjValueContainerMapper()).collect(Collectors.toList());
            }
        });
        container.addListener(tooltip.getController());
    } else {
        container = new ValueContainer(getOrCreateR(CELL_TYPE.ARMOR.getSlotImagePath()));
    }
    return container;
}
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) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) ArrayList(java.util.ArrayList) List(java.util.List) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)

Example 4 with DC_ArmorObj

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

the class ItemGenerator method createItem.

public DC_HeroItemObj createItem(ObjType type, Ref ref, boolean addMaterialParams) {
    // if (addMaterialParams)//if building from blueprint type
    // type = generateItem_(quality, material, type, params, mod_params);
    MicroGame game = (MicroGame) ref.getGame();
    DC_HeroItemObj item = (type.getOBJ_TYPE_ENUM() == DC_TYPE.WEAPONS) ? new DC_WeaponObj(type, ref.getPlayer(), game, ref) : new DC_ArmorObj(type, ref.getPlayer(), game, ref);
    return item;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) MicroGame(main.game.core.game.MicroGame) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj)

Aggregations

DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)4 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)2 VerticalValueContainer (eidolons.libgdx.gui.generic.VerticalValueContainer)2 ArrayList (java.util.ArrayList)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 PARAMS (eidolons.content.PARAMS)1 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)1 ValuePages (eidolons.content.ValuePages)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 Unit (eidolons.entity.obj.unit.Unit)1 UiMaster (eidolons.libgdx.gui.UiMaster)1 CELL_TYPE (eidolons.libgdx.gui.panels.dc.inventory.InventoryClickHandler.CELL_TYPE)1 AttackTooltip (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip)1 AttackTooltipFactory (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltipFactory)1 WeaponToolTipDataSource (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)1 WeaponTooltip (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip)1 Tooltip (eidolons.libgdx.gui.tooltips.Tooltip)1 ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)1