MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / TryDisarm

Function TryDisarm

Source/player.cpp:1123–1144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121}
1122
1123void TryDisarm(const Player &player, Object &object)
1124{
1125 if (&player == MyPlayer)
1126 NewCursor(CURSOR_HAND);
1127 if (!object._oTrapFlag) {
1128 return;
1129 }
1130 int trapdisper = 2 * player._pDexterity - 5 * currlevel;
1131 if (GenerateRnd(100) > trapdisper) {
1132 return;
1133 }
1134 for (int j = 0; j < ActiveObjectCount; j++) {
1135 Object &trap = Objects[ActiveObjects[j]];
1136 if (trap.IsTrap() && FindObjectAtPosition({ trap._oVar1, trap._oVar2 }) == &object) {
1137 trap._oVar4 = 1;
1138 object._oTrapFlag = false;
1139 }
1140 }
1141 if (object.IsTrappedChest()) {
1142 object._oTrapFlag = false;
1143 }
1144}
1145
1146void CheckNewPath(Player &player, bool pmWillBeCalled)
1147{

Callers 1

CheckNewPathFunction · 0.85

Calls 5

NewCursorFunction · 0.85
GenerateRndFunction · 0.85
FindObjectAtPositionFunction · 0.85
IsTrappedChestMethod · 0.80
IsTrapMethod · 0.45

Tested by

no test coverage detected