PDA

View Full Version : Double Attack for bards and beastlords


Skomag
10-14-2009, 05:22 PM
Bards and Beastlords don't normally have the double attack skill until they put points in an AA. From a post I found (http://forums.beastlords.org/index.php?topic=409.0), for beastlords at least, each point should be 3% for 15% max chance to double attack.

Looking at attack.cpp's Client::CheckDoubleAttack(), it will immediately return false for beastlords and bards, even with the aa trained, because HasSkill() returns false since there's no skill_cap entry for them. Initially I thought that HasSkill() could be changed to CanThisClassDoubleAttack(), but in looking at the rest of the function, since there's 0 skill and 0 max skill, bard/bst would be double attacking a lot. Instead I've come up with this patch:

bool Client::CheckDoubleAttack(bool tripleAttack) {
-
- // If you don't have the double attack skill, return
- if(!HasSkill(DOUBLE_ATTACK))
- return false;

// You start with no chance of double attacking
int chance = 0;

// Used for maxSkill and triple attack calcs
int8 classtype = GetClass();

+ // If you don't have the double attack skill, return
+ if(!HasSkill(DOUBLE_ATTACK)) {
+ // Bard and Beastlord can only double attack with AA - 3% per rank, 15% max
+ if((classtype == BEASTLORD) || (classtype == BARD)) {
+ if(classtype == BEASTLORD) chance = 3 * GetAA(aaBestialFrenzy);
+ if(classtype == BARD) chance = 3 * GetAA(aaHarmoniousAttack);
+ if(chance > 0 && chance > MakeRandomInt(0, 99)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
// The current skill level
uint16 skill = GetSkill(DOUBLE_ATTACK);


With the rest left as is, including the check again for the harmonious/frenzy aas. This way, a server could decide to give bard/bst double attack skill by default and let the AA increase their chances.

I just tested this fix on latest build and after 500 rounds of combat, beastlord with 5 points in AA double attacked 62 times (15.5%). Also checked a bard for a few and looked good.

KLS
10-14-2009, 10:22 PM
I'll look at this more in depth when I finish my qglobal stuff hopefully tonight, it might be inconsistent with how we do other things of a similar nature but I don't know off hand, either way we'll get something in and get it fixed.

trevius
10-14-2009, 10:50 PM
Odd, I thought bard and beastlord double attack AAs already worked.

AndMetal
10-15-2009, 12:40 AM
My recommendation would be to ignore the class check completely & just check if they have an AA/spell/etc (preferably via bonuses instead of a check to GetAA()). That way, if someone wants to give the AA to other classes who may not get the skill otherwise (maybe for Necros or something), it's just a database change rather than a source change.