Add CheckDoubleAttack for mobs

This commit is contained in:
Michael Cook (mackal) 2015-07-05 01:37:14 -04:00
parent 7c89ab3fec
commit 82fe15190b
2 changed files with 19 additions and 5 deletions

View File

@ -3452,6 +3452,21 @@ bool Client::CheckDoubleRangedAttack() {
return false; return false;
} }
bool Mob::CheckDoubleAttack(bool tripleAttack)
{
// Not 100% certain pets follow this or if it's just from pets not always
// having the same skills as most mobs
int chance = GetSkill(SkillDoubleAttack);
if (GetLevel() > 35)
chance += GetLevel();
int per_inc = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance;
if (per_inc)
chance += chance * per_inc / 100;
return zone->random.Int(1, 500) <= chance;
}
void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, const SkillUseTypes skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic) { void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, const SkillUseTypes skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic) {
// This method is called with skill_used=ABJURE for Damage Shield damage. // This method is called with skill_used=ABJURE for Damage Shield damage.
bool FromDamageShield = (skill_used == SkillAbjuration); bool FromDamageShield = (skill_used == SkillAbjuration);
@ -5029,8 +5044,7 @@ void NPC::SetAttackTimer()
//special offhand stuff //special offhand stuff
if (i == MainSecondary) { if (i == MainSecondary) {
//NPCs get it for free at 13 if(!CanThisClassDualWield()) {
if(GetLevel() < 13) {
attack_dw_timer.Disable(); attack_dw_timer.Disable();
continue; continue;
} }
@ -5152,9 +5166,8 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts)
if (GetSpecialAbility(SPECATK_INNATE_DW) || GetEquipment(MaterialSecondary) != 0) { if (GetSpecialAbility(SPECATK_INNATE_DW) || GetEquipment(MaterialSecondary) != 0) {
if (CheckDualWield()) { if (CheckDualWield()) {
Attack(target, MainSecondary, false, false, false, opts); Attack(target, MainSecondary, false, false, false, opts);
if (CanThisClassDoubleAttack()) { if (CanThisClassDoubleAttack() && GetLevel() > 35) {
// This isn't correct yet if (CheckDoubleAttack()) {
if (zone->random.Roll(GetLevel() + 20)) {
Attack(target, MainSecondary, false, false, false, opts); Attack(target, MainSecondary, false, false, false, opts);
} }
} }

View File

@ -169,6 +169,7 @@ public:
virtual bool CheckDualWield(); virtual bool CheckDualWield();
void DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts = nullptr); void DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts = nullptr);
void DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts = nullptr); void DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts = nullptr);
virtual bool CheckDoubleAttack(bool tripleAttack = false); // mob version doesn't use this flag
//Appearance //Appearance
void SendLevelAppearance(); void SendLevelAppearance();