Permalink
Browse files

iwd2: made all implemented skills respect their training needs

  • Loading branch information...
1 parent bafba9e commit 5e616267b0c3a7ed9aa787bcf83720d4f2d649f5 @lynxlynxlynx lynxlynxlynx committed Dec 28, 2013
@@ -4413,12 +4413,16 @@ void GameScript::PickPockets(Scriptable *Sender, Action* parameters)
int tgt = scr->GetStat(IE_PICKPOCKET);
int check;
if (core->HasFeature(GF_3ED_RULES)) {
+ int skill = snd->GetSkill(IE_PICKPOCKET);
int roll = core->Roll(1, 20, 0);
int level = scr->GetXPLevel(true);
int wismod = scr->GetAbilityBonus(IE_WIS);
// ~Pick pocket check. (10 + skill w/Dex bonus) %d vs. ((d20 + target's level) + Wisdom modifier) %d + %d.~
displaymsg->DisplayRollStringName(39302, DMC_LIGHTGREY, snd, 10+skill, roll+level, wismod);
check = (10 + skill) > (roll + level + wismod);
+ if (skill == 0) { // a trained skill, make sure we fail
+ check = 1;
+ }
} else {
//the original engine has no random here
if (tgt != 255) {
@@ -231,10 +231,15 @@ void Container::TryPickLock(Actor *actor)
}
int stat = actor->GetStat(IE_LOCKPICKING);
if (core->HasFeature(GF_3ED_RULES)) {
- stat *= 7; // convert to percent (magic 7 is from RE)
- int dexmod = actor->GetAbilityBonus(IE_DEX);
- stat += dexmod; // the original didn't use it, so let's not multiply it
- displaymsg->DisplayRollStringName(39301, DMC_LIGHTGREY, actor, stat-dexmod, LockDifficulty, dexmod);
+ int skill = actor->GetSkill(IE_LOCKPICKING);
+ if (skill == 0) { // a trained skill, make sure we fail
+ stat = 0;
+ } else {
+ stat *= 7; // convert to percent (magic 7 is from RE)
+ int dexmod = actor->GetAbilityBonus(IE_DEX);
+ stat += dexmod; // the original didn't use it, so let's not multiply it
+ displaymsg->DisplayRollStringName(39301, DMC_LIGHTGREY, actor, stat-dexmod, LockDifficulty, dexmod);
+ }
}
if (stat < LockDifficulty) {
displaymsg->DisplayConstantStringName(STR_LOCKPICK_FAILED, DMC_BG2XPGREEN, actor);
@@ -332,9 +332,13 @@ void Highlightable::TryDisarm(Actor *actor)
int trapDC = TrapRemovalDiff;
if (core->HasFeature(GF_3ED_RULES)) {
+ skill = actor->GetSkill(IE_TRAPS);
roll = core->Roll(1, 20, 0);
bonus = actor->GetAbilityBonus(IE_INT);
trapDC = TrapRemovalDiff/7 + 10; // oddity from the original
+ if (skill == 0) { // a trained skill
+ trapDC = 100;
+ }
} else {
roll = core->Roll(1, skill/2, 0);
skill /= 2;
@@ -377,10 +381,15 @@ void Door::TryPickLock(Actor *actor)
}
int stat = actor->GetStat(IE_LOCKPICKING);
if (core->HasFeature(GF_3ED_RULES)) {
- stat *= 7; // convert to percent (magic 7 is from RE)
- int dexmod = actor->GetAbilityBonus(IE_DEX);
- stat += dexmod; // the original didn't use it, so let's not multiply it
- displaymsg->DisplayRollStringName(39301, DMC_LIGHTGREY, actor, stat-dexmod, LockDifficulty, dexmod);
+ int skill = actor->GetSkill(IE_LOCKPICKING);
+ if (skill == 0) { // a trained skill, make sure we fail
+ stat = 0;
+ } else {
+ stat *= 7; // convert to percent (magic 7 is from RE)
+ int dexmod = actor->GetAbilityBonus(IE_DEX);
+ stat += dexmod; // the original didn't use it, so let's not multiply it
+ displaymsg->DisplayRollStringName(39301, DMC_LIGHTGREY, actor, stat-dexmod, LockDifficulty, dexmod);
+ }
}
if (stat < (signed)LockDifficulty) {
displaymsg->DisplayConstantStringName(STR_LOCKPICK_FAILED, DMC_BG2XPGREEN, actor);
@@ -1188,7 +1188,7 @@ void Scriptable::SpellcraftCheck(const Actor *caster, const ieResRef SpellResRef
poi++;
continue;
}
- if ((signed)detective->GetStat(IE_SPELLCRAFT) <= 0) {
+ if ((signed)detective->GetSkill(IE_SPELLCRAFT) <= 0) {
poi++;
continue;
}

0 comments on commit 5e61626

Please sign in to comment.