CBaseEntity *pAttacker = Damage.pAttacker;
if( IsAlive( ) && pAttacker && pAttacker->IsMSMonster() )
{
CMSMonster *pMonster = (CMSMonster *)pAttacker;
int ParryValue = GetSkillStat( "parry", STATPROP_SKILL );
int AccRoll = RANDOM_LONG(Damage.AccuracyRoll,100), ParryRoll = RANDOM_LONG(0,ParryValue);
//Using a weapon that can parry (shield, some swords) gives a parry bonus
int iAttackNum = 0, iHand = 0;;
CGenericItem *pHandItem = FindParryWeapon( this, iHand, iAttackNum );
if( pHandItem )
{
attackdata_t *pAttack = &pHandItem->m_Attacks[iAttackNum];
ParryRoll *= 1 + (pAttack->flAccuracyDefault / 100.f); //If 100% bonus, the roll gets multiplied by 2
}
//Awareness gives a small parry bonus
ParryRoll += GetNatStat( NATURAL_AWR );
//Thothie - do not parry certain damage types
msstring thoth_dmgtype = Damage.sDamageType;
if ( thoth_dmgtype.starts_with("target") ) ParryRoll = 0;
if ( thoth_dmgtype.starts_with("fire") ) ParryRoll = 0;
if ( thoth_dmgtype.starts_with("poison") ) ParryRoll = 0;
if ( thoth_dmgtype.starts_with("lightning") ) ParryRoll = 0;
if ( thoth_dmgtype.starts_with("cold") ) ParryRoll = 0;
if ( thoth_dmgtype.starts_with("magic") ) ParryRoll = 0;
if ( Damage.flDamage == 0 ) ParryRoll = 0; //do not parry 0 damage atks
if ( ParryRoll > 90 ) ParryRoll = 90; //always allow at least 10% chance to be hit
if( ParryRoll > AccRoll )
{
//thothie attemptig to pass parry vars
msstringlist ParametersB;
ParametersB.add( pAttacker ? EntToString( pAttacker ) : "none" );
ParametersB.add( UTIL_VarArgs("%f",Damage.flDamage) );
ParametersB.add( Damage.sDamageType );
ParametersB.add( UTIL_VarArgs("%i",ParryRoll) );
ParametersB.add( UTIL_VarArgs("%i",AccRoll) );
CallScriptEvent( "game_parry", &ParametersB );
if( pHandItem ) pHandItem->CallScriptEvent( "game_parry", &ParametersB );
Damage.flDamage = -1; // -1 means the monster dodged the attack
ClearMultiDamage( );
//Learn parry skill from a successful parry
if( !pAttacker->IsPlayer() ) //Can't learn from being attacked by players
if (pMonster->m_SkillLevel * 2 > 0)
LearnSkill (SKILL_PARRY, STATPROP_SKILL, pMonster->m_SkillLevel * 2 );
else
LearnSkill (SKILL_PARRY, STATPROP_SKILL, 0 );
//LearnSkill( SKILL_PARRY, STATPROP_SKILL, max(pAttacker->m_SkillLevel * 2,0) );
}
}
Holy sh*tThothie said:Large Iron Shield: +190%
FER said:I guess damage does matter. Once i got to high level in parry, I often leveled up when fighting the morc chief, who does loads of damage.