void LAi_ApplyCharacterFireDamage(aref attack, aref enemy, float kDist)
{
//Åñëè íåóáèâàåìûé, òî íåòðîãàåì åãî
if(CheckAttribute(enemy, "chr_ai.immortal"))
{
if(sti(enemy.chr_ai.immortal) != 0) return;
}
//Âåðîÿòíîñòü ïîïîäàíèÿ
float p = LAi_GunCalcProbability(attack, kDist);
//Åñëè ïðîìàõíóëèñü, òî âûéäåì
if(rand(10000) > p*10000) return;
//Íà÷èñëÿåì ïîâðåæäåíèå
float damage = LAi_GunCalcDamage(attack);
// Baste - added possibility to score critical hit with pistol -->
float critical = 0.0;
if(IsCharacterPerkOn(attack, "GunProfessional"))
{
if(rand(100) <= 15)
{
critical = damage*2.0;
}
}else{
if(IsCharacterPerkOn(attack, "Gunman"))
{
if(rand(100) <= 10)
{
critical = damage*2.0;
}
}
}else{
if(rand(100) <= 5)
{
critical = damage*2.0;
}
}
//Àòòàêà ñâîåé ãðóïïû
bool noExp = false;
if(CheckAttribute(attack, "chr_ai.group"))
{
if(CheckAttribute(enemy, "chr_ai.group"))
{
if(attack.chr_ai.group == enemy.chr_ai.group && !CheckAttribute(GetMainCharacter(),"TrainingFight") && !HasSubStr(attack.id,"TrainingFight_") && !HasSubStr(enemy.id,"TrainingFight_"))//MAXIMUS
{
// LDH removed because fire might hit an enemy not in the current group. Too flaky to use. 19Dec08
// if(sti(attack.index) == GetMainCharacterIndex()) traceandlog("CHANGE REP for player: " + -1 + " - firing on friend"); // LDH 19Dec08
// LAi_ChangeReputation(attack, -1);
damage = 0.0;
critical = 0.0;
noExp = true;
}
}
}
if(critical > 0.0)
{
if(sti(attack.index) == GetMainCharacterIndex())
{
Log_SetStringToLog(XI_ConvertString("Critical Hit"));
}
}
if(critical > 0.0)
{
LAi_ApplyCharacterDamage(enemy, ApplyArmor(enemy, attack, critical, false) + 0.5)); // GreatZen-NK
}
else
{
LAi_ApplyCharacterDamage(enemy, ApplyArmor(enemy, attack, damage, false) + 0.5)); // GreatZen-NK
}
// Baste <--