PDA

View Full Version : Adding a Rule to use Dex and Agi in Hit Chance calculation


LordKahel
03-13-2008, 04:06 AM
Here is a mod that will give the option of making Dex and agi matter in hit probability . Dex is used by the attacker to help hit and agi is used by the defender to avoid the hit. This will give the possibility to world builder to tune mob and make them hard to hit or very good at hitting.

Add the bold line to commons/ruletypes.h


RULE_CATEGORY( Combat )
RULE_REAL ( Combat, BaseCritChance, 0.0 ) //The base crit chance for non warriors, NOTE: This will apply to NPCs as well
RULE_REAL ( Combat, WarBerBaseCritChance, 0.03 ) //The base crit chance for warriors and berserkers, only applies to clients
RULE_REAL ( Combat, BerserkBaseCritChance, 0.06 ) //The bonus base crit chance you get when you're berserk
RULE_INT ( Combat, NPCBashKickLevel, 6 ) //The level that npcs can KICK/BASH
RULE_REAL ( Combat, ClientBaseCritChance, 0.0 ) //The base crit chance for all clients, this will stack with warrior's/zerker's crit chance.
RULE_BOOL ( Combat, UseIntervalAC, false)
RULE_INT ( Combat, PetAttackMagicLevel, 30)
RULE_BOOL ( Combat, UseDexAgiForHitChance, false)
RULE_CATEGORY_END()



And add the following Bold code to the Mob::CheckHitChance in attack.cpp



AA_mod += 3*GetAA(aaPhysicalEnhancement);
AA_mod += 2*GetAA(aaLightningReflexes);
chancetohit -= chancetohit * AA_mod / 100;

if (RuleB(Combat, UseDexAgiForHitChance))
{
chancetohit += ((attacker->GetDEX() / 200) - (defender->GetAGI() / 200));
}

// Chance to hit; Max 95%, Min 30%
if(chancetohit > 1000) {
//if chance to hit is crazy high, that means a discipline is in use, and let it stay there
}
else if(chancetohit > 99) {
chancetohit = 99;
}
else if(chancetohit < 5) {
chancetohit = 5;
}




By giving high amount of AGI or DEX you can make a npc very hard to hit or give him more chance to hit the player without raising the levels .

I divide the stat by 200 so that the change does not unbalance the current system. A player with 600 dex hitting a mob with 200 agi will only gain a 2% hit chance increase. This value can be adjusted has the dev see fit or put has a rule if they want to .

Thanks,

--
Pyronis/Kahell
Dev Jest 3 server

ChaosSlayer
03-13-2008, 06:00 AM
i am kind of confused.. isn't dex allreday used vs agi to determine the hit factor?
or you giving us an option to INCRESE its performance?

i don't knwo the excat formulas but from what I understand (logicaly) an attacker with 200 DEX vs defender with 200 AGI should have 50% chance to hit. With 400 Dex vs 200 agi that should become 95%

LordKahel
03-13-2008, 06:15 AM
Dex and Agi play a role in Dodge / Riposte / Block Calculations but not in the direct hit chance formula.

Right now the calculation is based on Level vs level and weapons skill vs defensive skill. Since npc uses the caps this also only change by level making level the only deciding factor that can be changed for hit chance.

You can check the CheckHitChance function and you will see that no dex or agi is used.

i don't knwo the excat formulas but from what I understand (logicaly) an attacker with 200 DEX vs defender with 200 AGI should have 50% chance to hit. With 400 Dex vs 200 agi that should become 95%
Reply With Quote

No 200 vs 200 would not give any bonus or penalty to the hit chance. My function only modifies the end result . 400 dex vs 200 agi gives a 2% bonus to hit chances. 2000 dex VS 200 agi gives a 9% hit chance bonus. I was conservative in the value that i gave stats but you can gain more bonus by lowering the number the stats are divided by.

ChaosSlayer
03-13-2008, 06:38 AM
Dex and Agi play a role in Dodge / Riposte / Block Calculations but not in the direct hit chance formula.

Right now the calculation is based on Level vs level and weapons skill vs defensive skill. Since npc uses the caps this also only change by level making level the only deciding factor that can be changed for hit chance.

You can check the CheckHitChance function and you will see that no dex or agi is used.


well that kind of totaly sucks - this means a shit load of AGI don't do a thing to anyone expect like a monk, and tons of DEX not realy making you hit any better.

IMHO the entire combat model is wrong and should rewriten so stats actualy MATTER


anyway. If you adding a RULE, is that just a Yes/No rule? In thsi case How about a numerical modifier?
So if modifier is 0 - the new agi/de4 is turned OFF, if modifier goes UP, the benefit from AGI and DEX increases?

KLS
03-13-2008, 06:52 AM
Stats do matter, for every 200 points of agility you gain 1% dodge, for every 200 points of dexterity you gain 1% parry, riposte and block if you can use those skills. All in all a tank with their stats and skills maxed will be sporting nearly 30% avoidance on top of their chance to be missed which is pretty significant.

I'd say in this case I'd rather add an accuracy field to npc_types than go this route. Dex and agil was removed from the hit chance calculations because they were for one not supposed to be there and also it made them difficult to balance, especially dex on npcs which also controls their proc rate and parry/block/riposte chances, to have an all encompassing stat in this case I think is not a good thing. But I digress, I'm still putting everything together from the last couple days and hope to have a new build out soon and I'll see about adding something in for accuracy tuning.

ChaosSlayer
03-13-2008, 07:04 AM
I understand that, KLS. But talking about pure TO HIT chance - how come DEX does not matter at all?
Dex after all - by defenition of the very word- is Eye-hand coordination, which means the more DEX you have the easier it is for you to strike the target - not talking about damage, parry, etc- only about landing a hit.

also 1% per 200 agi.. ummm what is excatly stat cap? I think the highest AGi i ever saw was like 400
thats a total of 2% according to you... DOn't seem like alot.

Now if this would be like 1% per 10 agi - that would make sence.
Then you could have the same 1% taken down for each 10 DEX the opponent has.
So if 600 agi and 600 dex opponents meet - they would be equal before each other, with defender havign total bonus of 0

LordKahel
03-13-2008, 07:08 AM
I'd say in this case I'd rather add an accuracy field to npc_types than go this route.

I agree with this 100% . This was my first idea but i was afraid another field in the db would put people off.

Also i am afraid adding alot of dex would mess up a npc chances to proc , making them proc like crazy.

Accuracy field for the npcs is the best solution.

ChaosSlayer
03-13-2008, 07:54 AM
i am somewhat more worried about players than mobs
it seems that a player with 400 DEX won't have any better hitting chance than a player with 200 dex. thats kind of sad