Skip to content

Commit

Permalink
NWN2: Implement disableTrap call
Browse files Browse the repository at this point in the history
  • Loading branch information
rjshae authored and DrMcCoy committed Nov 23, 2018
1 parent 0a5080b commit 464b92e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/engines/nwn2/trap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ bool Trap::detectTrap(Creature *agent) {

// TODO: Check for a non-enemy faction so _isFlagged isn't set?

// Make the Search skil check vs. trap detect DC
// Make the Search skill check vs. trap detect DC
bool result = agent->getIsSkillSuccessful(kSkillSearch, _detectDC);

// On a success, set to detected
Expand All @@ -241,8 +241,20 @@ bool Trap::disarmTrap(Creature *agent, int adjustDC) {

assert(agent);

// TODO
return false;
// Must have at least one rank in disable device
uint8 ranks = agent->getSkillRank(kSkillDisableDevice);
if (ranks < 1)
return false;

// If DC is over 20, character must be a rogue
if (_disarmDC > 20)
if (agent->getClassLevel(kCClassRogue) < 1)
return false;

// Make the Disable Device skill check vs. trap disable DC
bool result = agent->getIsSkillSuccessful(kSkillDisableDevice, _disarmDC + adjustDC);

return result;
}

/**
Expand Down

0 comments on commit 464b92e

Please sign in to comment.