Steal & Pick Pockets pseudocode
Pseudocode for stealing and picking pockets is outlined below. The code indicates there is always a chance of failure, regardless of the skill of the creature performing the action.
pick pockets: r = rand(1,100) if (r == 100) pp_fail() diff = actor->mod_pp_skill - target->mod_pp_skill if (r >= diff) pp_fail() if (target->mod_pp_skill == 255) pp_fail() steal in store: if ((actor->mod_pp_skill < store_steal_rate) or (store_steal_rate == 100)) diff = 0 else diff = actor->mod_pp_skill - store_steal_rate r = rand(1,100) if (r > diff) steal_fail()