Add Mob/Client CheckDualWield functions

This commit is contained in:
Michael Cook (mackal) 2015-07-05 00:45:46 -04:00
parent 8d3d3d2af2
commit 99620f8535
4 changed files with 31 additions and 9 deletions

View File

@ -5075,3 +5075,31 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
}
}
}
bool Mob::CheckDualWield()
{
// Pets /might/ follow a slightly different progression
// although it could all be from pets having different skills than most mobs
int chance = GetSkill(SkillDualWield);
if (GetLevel() > 35)
chance += GetLevel();
chance += aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity;
int per_inc = spellbonuses.DualWieldChance + aabonuses.DualWieldChance + itembonuses.DualWieldChance;
if (per_inc)
chance += chance * per_inc / 100;
return zone->random.Int(1, 375) <= chance;
}
bool Client::CheckDualWield()
{
int chance = GetSkill(SkillDualWield) + GetLevel();
chance += aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity;
int per_inc = spellbonuses.DualWieldChance + aabonuses.DualWieldChance + itembonuses.DualWieldChance;
if (per_inc)
chance += chance * per_inc / 100;
return zone->random.Int(1, 375) <= chance;
}

View File

@ -890,6 +890,7 @@ public:
void Insight(uint32 t_id);
bool CheckDoubleAttack(bool tripleAttack = false);
bool CheckDoubleRangedAttack();
bool CheckDualWield();
//remove charges/multiple objects from inventory:
//bool DecreaseByType(uint32 type, uint8 amt);

View File

@ -428,16 +428,8 @@ bool Client::Process() {
//you can't see your target
}
else if(auto_attack_target->GetHP() > -10) {
float DualWieldProbability = 0.0f;
int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity;
DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
float random = zone->random.Real(0, 1);
CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10);
if (random < DualWieldProbability) { // Max 78% of DW
if (CheckDualWield()) {
ItemInst *wpn = GetInv().GetItem(MainSecondary);
TryWeaponProc(wpn, auto_attack_target, MainSecondary);

View File

@ -166,6 +166,7 @@ public:
void CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse);
void CommonBreakInvisible();
bool HasDied();
virtual bool CheckDualWield();
//Appearance
void SendLevelAppearance();