{
damage *= 1.04;
}
// defence modifier depending of the attacker weapon
L2Weapon weapon = attacker.getActiveWeaponItem();
Stats stat = null;
if(weapon != null)
{
switch(weapon.getItemType())
{
case BOW:
stat = Stats.BOW_WPN_VULN;
break;
case BLUNT:
stat = Stats.BLUNT_WPN_VULN;
break;
case DAGGER:
stat = Stats.DAGGER_WPN_VULN;
break;
case DUAL:
stat = Stats.DUAL_WPN_VULN;
break;
case DUALFIST:
stat = Stats.DUALFIST_WPN_VULN;
break;
case ETC:
stat = Stats.ETC_WPN_VULN;
break;
case FIST:
stat = Stats.FIST_WPN_VULN;
break;
case POLE:
stat = Stats.POLE_WPN_VULN;
break;
case SWORD:
stat = Stats.SWORD_WPN_VULN;
break;
case BIGSWORD:
stat = Stats.BIGSWORD_WPN_VULN;
break;
case BIGBLUNT:
stat = Stats.BIGBLUNT_WPN_VULN;
break;
}
}
if (crit)
{
//Finally retail like formula
double cAtkMultiplied = damage + attacker.calcStat(Stats.CRITICAL_DAMAGE, damage, target, skill);
double cAtkVuln = target.calcStat(Stats.CRIT_VULN, 1, target, null);
double improvedDamageByCriticalMulAndVuln = cAtkMultiplied * cAtkVuln;
double improvedDamageByCriticalMulAndAdd = improvedDamageByCriticalMulAndVuln + attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0, target, skill);
if(Config.DEBUG){
System.out.println("Attacker '"+attacker.getName()+"' Critical Damage Debug:");
System.out.println(" - Initial Damage: "+damage);
System.out.println(" - Damage increased of mult: "+cAtkMultiplied);
System.out.println(" - cAtkVuln Mult: "+cAtkVuln);
System.out.println(" - improvedDamageByCriticalMulAndVuln: "+improvedDamageByCriticalMulAndVuln);
System.out.println(" - improvedDamageByCriticalMulAndAdd: "+improvedDamageByCriticalMulAndAdd);
}
damage = improvedDamageByCriticalMulAndAdd;
}
damage = 70 * damage / defence;
if(shld && !Config.ALT_GAME_SHIELD_BLOCKS)
{
defence += target.getShldDef();
}
//damage = 70 * damage / defence;
if(stat != null)
{
// get the vulnerability due to skills (buffs, passives, toggles, etc)
damage = target.calcStat(stat, damage, target, null);
if(target instanceof L2NpcInstance)
{
// get the natural vulnerability for the template
damage *= ((L2NpcInstance) target).getTemplate().getVulnerability(stat);
}
}
damage += Rnd.nextDouble() * damage / 10;
// damage += _rnd.nextDouble()* attacker.getRandomDamage(target);
// }
if(shld && Config.ALT_GAME_SHIELD_BLOCKS)
{
damage -= target.getShldDef();
if(damage < 0)
{
damage = 0;
}
}
if(target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DAGGER && skill != null)
{
L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
if(armor != null)
{
if(((L2PcInstance) target).isWearingHeavyArmor())