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

View File

@ -4203,24 +4203,26 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
} }
#endif //BOTS #endif //BOTS
float critChance = 0.0f; float critChance = 0.0f;
bool IsBerskerSPA = false; bool IsBerskerSPA = false;
//1: Try Slay Undead //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]; int16 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0];
if (SlayRateBonus) { if (SlayRateBonus) {
float slayChance = static_cast<float>(SlayRateBonus) / 10000.0f;
critChance += (float(SlayRateBonus)/100.0f); if (MakeRandomFloat(0, 1) < slayChance) {
critChance /= 100.0f;
if(MakeRandomFloat(0, 1) < critChance){
int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1];
damage = (damage * SlayDmgBonus * 2.25) / 100; 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); 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; return;
} }
} }

View File

@ -163,6 +163,8 @@
#define CANNOT_WAKE 555 //%1 tells you, 'I am unable to wake %2, master.' #define CANNOT_WAKE 555 //%1 tells you, 'I am unable to wake %2, master.'
#define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server. #define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server.
#define GM_GAINXP 1002 //[GM] You have gained %1 AXP and %2 EXP (%3). #define GM_GAINXP 1002 //[GM] You have gained %1 AXP and %2 EXP (%3).
#define MALE_SLAYUNDEAD 1007 //%1's holy blade cleanses his target!(%2)
#define FEMALE_SLAYUNDEAD 1008 //%1's holy blade cleanses her target!(%2)
#define FINISHING_BLOW 1009 //%1 scores a Finishing Blow!! #define FINISHING_BLOW 1009 //%1 scores a Finishing Blow!!
#define ASSASSINATES 1016 //%1 ASSASSINATES their victim!! #define ASSASSINATES 1016 //%1 ASSASSINATES their victim!!
#define CRIPPLING_BLOW 1021 //%1 lands a Crippling Blow!(%2) #define CRIPPLING_BLOW 1021 //%1 lands a Crippling Blow!(%2)