PDA

View Full Version : npc chancetohit?


moydock
03-28-2008, 08:39 AM
This code seems to be doing the calculations in attack.cpp but for some reason a lvl 1 npc hitting a lvl 1 player only hits about 30% or less, of his swings. I must be missing something?
else{
//some class combos have odd caps, base our attack skill based off of a warriors 1hslash since
//it scales rather evenly across all levels for warriors, based on the defenders level so things like
//light blues can still hit their target.
uint16 atkSkill = (database.GetSkillCap(WARRIOR, (SkillType)_1H_SLASHING, defender->GetLevel()) + 5);
int skilldiff = defender->GetSkill(DEFENSE) - atkSkill;
bonus = 0;
if(skilldiff > 10){
bonus = -(10 + ((defender->GetSkill(DEFENSE) - atkSkill - 10) * 2 / 5));
}
else if(skilldiff <= 10 && skilldiff > 0){
bonus = -(2 + ((defender->GetSkill(DEFENSE) - atkSkill) / 10));
}
else{
bonus = 1 + ((atkSkill - defender->GetSkill(DEFENSE)) / 25);
}
chancetohit += bonus;
}

LordKahel
03-28-2008, 09:33 AM
MeleeMitigation also plays a role , because if AC mitigation reduces the damage to 0 then it registers has a MISS. So not all the misses comes from the mob actually missing his hit roll.

moydock
03-28-2008, 09:46 AM
I've got my lvl 1 mobs hitting for min 7 max 8, i don't think it could be turning 20%+ of hits into misses.

moydock
03-28-2008, 09:51 AM
if i'm doing this right, a lvl 1 npc hitting a lvl 1 pc, the npc should have a 55.5% chance to hit. PC having 0 defense.

KLS
03-28-2008, 02:27 PM
A level 1 mob will have roughly the same chance to hit as to be hit by a level 1 player BEFORE mitigation mitigates any hits to misses. If your players have naturally high ac for level 1s the mobs will have to have more strength to compensate, and it scales very quickly in the first ten levels.

ChaosSlayer
03-28-2008, 03:03 PM
the biggest problem with "to hit" chance that there is no way to improve them with any stat =)
Originaly it was belived DEX makes you score hits more often (hence you could build your char towards DEX rather than STR, so you would hit for less dmg and every swing), but since you told us DEX is not improving your to hit chances - we are stuck at pre-set % chances for class/level etc

moydock
03-28-2008, 04:57 PM
Thanks for the response. My level 1's are naked, and have 0 skill. I just tested again on a level 1 wizard and got 26% hits.

ChaosSlayer
03-28-2008, 05:59 PM
Thanks for the response. My level 1's are naked, and have 0 skill. I just tested again on a level 1 wizard and got 26% hits.

the sad part that its gona remain like that at any level
If i remeber corectly paladins have 55% chance to hit cap, and no ammount of uber stats ever make them hit more often.

moydock
03-28-2008, 07:37 PM
I think the new system is an improvement. The old system was impossible to try to balance. I'm happy with the new one, I just wanted to make sure I wasn't missing something. I think it has room to grow, but it's a good new base.

I guess i'll start looking at the mitigation system, i didn't realize it would have an affect on the chancetohit.
Btw KLS, on the first line of the npc chancetohit code, I think there's a small error. I may be wrong, not that it makes much of a difference but shouldn't it be retrieving the attackers skill in 1hs?

uint16 atkSkill = (database.GetSkillCap(WARRIOR, (SkillType)_1H_SLASHING, defender->GetLevel()) + 5);