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