|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum) |
|
|
|
08-25-2015, 11:09 AM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Very simple attack.cpp question (adding crit)
Hi
Been away for a LONG time. I just want to remember if I get the jist of things here...
Let's say I want to add a base crit chance to paladins(ok shd too). (I know it's humorous)
From all that I understand (which is very little) .. modify the attack.cpp and add some new rules.
modify this:
Code:
if (((GetClass() == WARRIOR || GetClass() == BERSERKER) && GetLevel() >= 12) || IsBerskerSPA) {
if (IsBerserk() || IsBerskerSPA)
critChance += RuleI(Combat, BerserkBaseCritChance);
else
critChance += RuleI(Combat, WarBerBaseCritChance);
to this
Code:
if (((GetClass() == WARRIOR || GetClass() == BERSERKER || GetClass() == Paladin || GetClass() == ShadowKnight) && GetLevel() >= 12) || IsBerskerSPA) {
if (IsBerserk() || IsBerskerSPA)
critChance += RuleI(Combat, BerserkBaseCritChance);
elseif
critChance += RuleI(Combat, PalShdBaseCritChance);
else
critChance += RuleI(Combat, WarBerBaseCritChance);
Add the appropriate rule to the rules table; PalShdBaseCritChance
Would this fly?
-lax
|
|
|
|
08-25-2015, 12:11 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
well the else statement is wrong, and I had to add the int to the rules and recompile.. let's see if that worked,,. aha
|
08-25-2015, 12:22 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
holy crap, that actually worked (I simply replaced the warrior section with the edited paladin section)
-- edited attack.cpp
-- edited rulestype.h
-- added the three entries in the database for rule sets 1,2,10
voila level 12 paladin critical hitting. Made me happy.
I suppose i should probably make ruleset 5 and just modify one set
-lax
|
08-25-2015, 12:23 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Yeah, you left out the condition for the 'elseif', and in C++ it needs a space. The class constants are also all uppercase, per C standards.
You'd want that line to read:
Quote:
else if (GetClass() == PALADIN || GetClass() == SHADOWKNIGHT)
|
And you'd want to fully capitalize them in the first 'if' statement as well.
|
08-25-2015, 12:26 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
... Did it work without the changes I suggested?
|
|
|
|
08-25-2015, 01:44 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Shendare,
Wow, I thought this forum was all but dead., thanks for such a quick response. !
I quickly get lost with all the elseing and elseif'ing so I tidied it up a bit. I missed a parantheses my first time and noticed my new level limitation wasn't working (going to give paladins and sk's crit at 15 and not 12)
so edited attack.cpp to read this:
Code:
if (IsClient()) {
critChance += RuleI(Combat, ClientBaseCritChance);
if (spellbonuses.BerserkSPA || itembonuses.BerserkSPA || aabonuses.BerserkSPA)
IsBerskerSPA = true;
if (((GetClass() == WARRIOR || GetClass() == BERSERKER) && GetLevel() >= 12) || IsBerskerSPA) {
if (IsBerserk() || IsBerskerSPA)
critChance += RuleI(Combat, BerserkBaseCritChance);
else
critChance += RuleI(Combat, WarBerBaseCritChance);
}
if (((GetClass() == PALADIN || GetClass() == SHADOWKNIGHT) && GetLevel() >= 15))
critChance += RuleI(Combat, PalShdBaseCritChance);
I'm thinking I don't understand this segment properly:: the note in this section states that there is the innate chance to score a crit.
How would that be possible since:
clientbasecritchance and meleebasecritchance in my rules are zero.
|
|
|
|
08-25-2015, 01:54 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Looks like it's saying that IF you define crit chance percentages for MeleeBaseCritChance or ClientBaseCritChance, melees (or everyone) will have an innate chance to crit at level 1, with melees getting the sum of the two rule values as their innate crit chance.
A little farther down, Rangers get a chance to crit archery at level 65, and Rogues get a chance to crit throwing at level 65.
Then any aa's, item bonuses, or crit chance buffs come into play to result in the final chance to critical hit.
The way you've coded it up there now looks like it should work fine!
|
08-25-2015, 02:05 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Thank you,
So.. do entries of Zero "0" (not a null entry) an actual zero count as being defined? I would say yes..?
That's what's striking me, my crit chance should be less than a 1.0% according to the documentation, based on loose parsing I'm around 20% 1 in 5 roughly..
|
08-25-2015, 02:12 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
No. If you don't define a rule at all, it falls back to the default hard-coded in the server code, which is likely zeroes as well.
So, you're seeing a 20% crit rate on a Paladin with these settings?
* MeleeBaseCritChance = 0
* ClientBaseCritChance = 0
* BerserkBaseCritChance = 6 (the default, active when you're berzerk)
* WarBerBaseCritChance = 3 (the default)
* PalShdBaseCritChance = 1 (your new rule)
* No equipped items granting +crit chance
* No active buffs granting +crit chance
* No AA's granting crit chance
|
08-25-2015, 02:21 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Oh my, you are quick on the draw.
MeleeBaseCritChance=0
ClientBaseCritChance=0
BeserkBaseCritChance=7 (i added one)
WarBerBaseCritChance=5 (added one)
PalShdBaseCritChance=4 (want them only a step behind warriors)
Too Generous? but I deleveled the paladin all the way to level 1 up through 16 crit rate is similar.. no exact parses.
I'd probably prefer no crits at all till a certain level, then you get class base chance + dex
|
08-25-2015, 02:33 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
That certainly doesn't seem to mesh with what you're going for, or what you've coded. It looks like a Paladin shouldn't crit at all until level 15, and then they'd have:
* A 4% base chance from the new rule
* +1% for each 125 points of DEX up to 255 (Max 2%)
* +1% for each 500 points of DEX after 255
20% doesn't make sense with those numbers. 10% doesn't even make sense.
You mind copy/pasting your full TryCriticalHit() function into a Code block?
|
|
|
|
08-25-2015, 02:51 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Definitely and Thank you as I'm with you, my percent should be around .6% at best (assuming innate crits based on dex)
But I want nothing till 15.. here is the block from attack.cpp
Code:
//2: Try Melee Critical
//Base critical rate for all classes is dervived from DEX stat, this rate is then augmented
//by item,spell and AA bonuses allowing you a chance to critical hit. If the following rules
//are defined you will have an innate chance to hit at Level 1 regardless of bonuses.
//Warning: Do not define these rules if you want live like critical hits.
critChance += RuleI(Combat, MeleeBaseCritChance);
if (IsClient()) {
critChance += RuleI(Combat, ClientBaseCritChance);
if (spellbonuses.BerserkSPA || itembonuses.BerserkSPA || aabonuses.BerserkSPA)
IsBerskerSPA = true;
if (((GetClass() == WARRIOR || GetClass() == BERSERKER) && GetLevel() >= 12) || IsBerskerSPA) {
if (IsBerserk() || IsBerskerSPA)
critChance += RuleI(Combat, BerserkBaseCritChance);
else
critChance += RuleI(Combat, WarBerBaseCritChance);
}
if (((GetClass() == PALADIN || GetClass() == SHADOWKNIGHT) && GetLevel() >= 15))
critChance += RuleI(Combat, PalShdBaseCritChance);
}
int deadlyChance = 0;
int deadlyMod = 0;
if(skill == SkillArchery && GetClass() == RANGER && GetSkill(SkillArchery) >= 65)
critChance += 6;
if (skill == SkillThrowing && GetClass() == ROGUE && GetSkill(SkillThrowing) >= 65) {
critChance += RuleI(Combat, RogueCritThrowingChance);
deadlyChance = RuleI(Combat, RogueDeadlyStrikeChance);
deadlyMod = RuleI(Combat, RogueDeadlyStrikeMod);
}
int CritChanceBonus = GetCriticalChanceBonus(skill);
if (CritChanceBonus || critChance) {
//Get Base CritChance from Dex. (200 = ~1.6%, 255 = ~2.0%, 355 = ~2.20%) Fall off rate > 255
//http://giline.versus.jp/shiden/su.htm , http://giline.versus.jp/shiden/damage_e.htm
if (GetDEX() <= 255)
critChance += (float(GetDEX()) / 125.0f);
else if (GetDEX() > 255)
critChance += (float(GetDEX()-255)/ 500.0f) + 2.0f;
critChance += critChance*(float)CritChanceBonus /100.0f;
}
if(opts) {
critChance *= opts->crit_percent;
critChance += opts->crit_flat;
}
I stopped where it starts calculating crippling blows
|
|
|
|
08-25-2015, 02:57 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Really don't see anything wrong there.
This is you playing a Paladin, right? Not a bot or npc or merc?
|
08-25-2015, 03:40 PM
|
Hill Giant
|
|
Join Date: Aug 2008
Location: NorthEast
Posts: 115
|
|
Correct, I just did a completely (I mean complete) setup, wiped the datebase, downloaded and compiled all new code.
I did not however delete my client profile files on my local client (the windows and views were all set) but I was not getting any crits until I modified this file.
|
08-25-2015, 03:44 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Take a look and Verify the rule values in your database and the ruleset you're using, and make sure you've shut the server software down and started it back up, with shared_memory being the first executable loading. Verify that the ruleset you're seeing there is the same as what you're expecting from the rule_values table. Also verify the ruleset field in the zone you're fighting in.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 06:43 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|