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;
}
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;
}
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;
}
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;
}
Aggregations