Slay Undead to String IDs (and better filtering)

This commit is contained in:
Michael Cook (mackal)
2014-10-06 01:30:01 -04:00
parent cab41487d5
commit 2bee906784
2 changed files with 15 additions and 11 deletions
+13 -11
View File
@@ -4203,24 +4203,26 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
}
#endif //BOTS
float critChance = 0.0f;
bool IsBerskerSPA = false;
//1: Try Slay Undead
if(defender && defender->GetBodyType() == BT_Undead || defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire){
if (defender && (defender->GetBodyType() == BT_Undead ||
defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire)) {
int16 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0];
if (SlayRateBonus) {
critChance += (float(SlayRateBonus)/100.0f);
critChance /= 100.0f;
if(MakeRandomFloat(0, 1) < critChance){
float slayChance = static_cast<float>(SlayRateBonus) / 10000.0f;
if (MakeRandomFloat(0, 1) < slayChance) {
int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1];
damage = (damage*SlayDmgBonus*2.25)/100;
entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s cleanses %s target!(%d)", GetCleanName(), this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its", damage);
damage = (damage * SlayDmgBonus * 2.25) / 100;
if (GetGender() == 1) // female
entity_list.FilteredMessageClose_StringID(this, false, 200,
MT_CritMelee, FilterMeleeCrits, FEMALE_SLAYUNDEAD,
GetCleanName(), itoa(damage));
else // males and neuter I guess
entity_list.FilteredMessageClose_StringID(this, false, 200,
MT_CritMelee, FilterMeleeCrits, MALE_SLAYUNDEAD,
GetCleanName(), itoa(damage));
return;
}
}