Congdar
09-26-2008, 06:31 PM
I think the Client::CheckDoubleAttack() method needs some modifications. Here it is currently:
bool Client::CheckDoubleAttack(bool AAadd, bool Triple) {
int skill = 0;
if (Triple)
{
if(!HasSkill(DOUBLE_ATTACK))
return(false);
if (GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER)
{
skill = GetSkill(DOUBLE_ATTACK)/2;
} else {
return(false);
}
}
else
{
//should these stack with skill, or does that ever even happen?
int aaskill = GetAA(aaBestialFrenzy)*25 + GetAA(aaHarmoniousAttack)*25
+ GetAA(aaKnightsAdvantage)*25 + GetAA(aaFerocity)*25;
if (!aaskill && !HasSkill(DOUBLE_ATTACK))
{
return false;
}
skill = GetSkill(DOUBLE_ATTACK) + aaskill;
//discipline effects
skill += (spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance) * 3;
if(skill < 300) //only gain if we arnt garunteed
CheckIncreaseSkill(DOUBLE_ATTACK);
}
if(MakeRandomInt(0, 299) < skill)
{
return true;
}
return false;
}
The first thing needing changes is the first argument bool AAadd, it doesn't get used anywhere in the method.
Next is the aa bonus *25 is too high. Max double attack skill for a 65 warrior is 255. In the following check if(skill < 300) if a warrior had only 225 skill + all 3 Ferocity AA's, the warrior would never skill up past 225 to max but would always double attack anyway in the random check below that. The magic number 299 is used there. If max skill and max ferocity, the warrior would always double attack. I think with the bonuses you should get real close to always, but not 100%. Rogue and Bards get a discipline that gives the a 10000% bonus so that's the only guarantee I know of.
Here's how I've rewritten the mentod. What do you think?
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
int class = GetClass();
// The current skill level
int skill = GetSkill(DOUBLE_ATTACK);
// Discipline bonuses give you 100% chance to double attack
int buffs = (spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance) * 3;
// The maximum value for the Class based on the server rule of MaxLevel
int maxSkill = MaxSkill(DOUBLE_ATTACK, class, RuleI(Character, MaxLevel));
// AA bonuses for the melee classes
int aaBonus = GetAA(aaBestialFrenzy)*10 +
GetAA(aaHarmoniousAttack)*10 +
GetAA(aaKnightsAdvantage)*10 +
GetAA(aaFerocity)*10 +
GetAA(aaDanceofBlades)*10;
// Half of Double Attack Skill used to check chance for Triple Attack
if(TripleAttack) {
// Only some Double Attack classes get Triple Attack
if(class == MONK || class == WARRIOR || class == RANGER || class == BERSERKER) {
// We only get half the skill, but should get all the bonuses
chance = (skill/2) + buffs + aaBonus;
}
else {
return false;
}
}
else {
// This is the actual Double Attack chance
chance = skill + buffs + aaBonus;
// You can gain skill even if you don't successfully double attack,
// but put it here so you don't skill up on triple attacks
CheckIncreaseSkill(DOUBLE_ATTACK);
}
// If your chance is greater than the RNG you are successful!
if(chance > MakeRandomInt(0, maxSkill*.92)) {
return true;
}
return false;
}
bool Client::CheckDoubleAttack(bool AAadd, bool Triple) {
int skill = 0;
if (Triple)
{
if(!HasSkill(DOUBLE_ATTACK))
return(false);
if (GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER)
{
skill = GetSkill(DOUBLE_ATTACK)/2;
} else {
return(false);
}
}
else
{
//should these stack with skill, or does that ever even happen?
int aaskill = GetAA(aaBestialFrenzy)*25 + GetAA(aaHarmoniousAttack)*25
+ GetAA(aaKnightsAdvantage)*25 + GetAA(aaFerocity)*25;
if (!aaskill && !HasSkill(DOUBLE_ATTACK))
{
return false;
}
skill = GetSkill(DOUBLE_ATTACK) + aaskill;
//discipline effects
skill += (spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance) * 3;
if(skill < 300) //only gain if we arnt garunteed
CheckIncreaseSkill(DOUBLE_ATTACK);
}
if(MakeRandomInt(0, 299) < skill)
{
return true;
}
return false;
}
The first thing needing changes is the first argument bool AAadd, it doesn't get used anywhere in the method.
Next is the aa bonus *25 is too high. Max double attack skill for a 65 warrior is 255. In the following check if(skill < 300) if a warrior had only 225 skill + all 3 Ferocity AA's, the warrior would never skill up past 225 to max but would always double attack anyway in the random check below that. The magic number 299 is used there. If max skill and max ferocity, the warrior would always double attack. I think with the bonuses you should get real close to always, but not 100%. Rogue and Bards get a discipline that gives the a 10000% bonus so that's the only guarantee I know of.
Here's how I've rewritten the mentod. What do you think?
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
int class = GetClass();
// The current skill level
int skill = GetSkill(DOUBLE_ATTACK);
// Discipline bonuses give you 100% chance to double attack
int buffs = (spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance) * 3;
// The maximum value for the Class based on the server rule of MaxLevel
int maxSkill = MaxSkill(DOUBLE_ATTACK, class, RuleI(Character, MaxLevel));
// AA bonuses for the melee classes
int aaBonus = GetAA(aaBestialFrenzy)*10 +
GetAA(aaHarmoniousAttack)*10 +
GetAA(aaKnightsAdvantage)*10 +
GetAA(aaFerocity)*10 +
GetAA(aaDanceofBlades)*10;
// Half of Double Attack Skill used to check chance for Triple Attack
if(TripleAttack) {
// Only some Double Attack classes get Triple Attack
if(class == MONK || class == WARRIOR || class == RANGER || class == BERSERKER) {
// We only get half the skill, but should get all the bonuses
chance = (skill/2) + buffs + aaBonus;
}
else {
return false;
}
}
else {
// This is the actual Double Attack chance
chance = skill + buffs + aaBonus;
// You can gain skill even if you don't successfully double attack,
// but put it here so you don't skill up on triple attacks
CheckIncreaseSkill(DOUBLE_ATTACK);
}
// If your chance is greater than the RNG you are successful!
if(chance > MakeRandomInt(0, maxSkill*.92)) {
return true;
}
return false;
}