A dump of #22517 (Generic Spell Skill Object)

@create #19051 named Generic Spell Skill Object:Generic Spell Skill Object
@prop #22517."slow" 10 rc
@prop #22517."diff" 10 rc
@prop #22517."sane" 10 rc
@prop #22517."sleep" 50 rc
"#22517.("usage") => E_PERM (Permission denied)
"#22517.("minus") => E_PERM (Permission denied)
@prop #22517."subskills" {} r
"#22517.("relative") => E_PERM (Permission denied)
@prop #22517."resist" "" rc
;;#22517.("encumbrance") = 25
;;#22517.("injury") = 10
;;#22517.("dep_names") = {"Generic Spell Skill Object"}
;;#22517.("cap_boost_mult") = 2
;;#22517.("improve_learn_ok") = 0
"#22517.("queue") => E_PERM (Permission denied)
"#22517.("key") => E_PERM (Permission denied)
;;#22517.("aliases") = {"Generic Spell Skill Object"}
;;#22517.("description") = "An indicator of skill in some nameless area, though the nameless area probably involves bearded old men with moons and stars on their drooping wee willie winkie caps."
;;#22517.("object_size") = {5801, 1141286561}

@verb #22517:"slowness_mod" this none this
@program #22517:slowness_mod
{res, doll} = args;
return res;
"Mooshie (#106469) - Sat Jan  3, 1998 - Added. Spells shouldn't be penalized for hasted individuals.";
.

@verb #22517:"track_usage" this none this
@program #22517:track_usage
if (caller == this)
  this.usage = this.usage + 1;
  if (((rndm = random(this.relative)) == 9) && (dep = this.dependant[2]))
    ((dep = dep[1]) in $local.rpg.magic_db.magic_forms) && (dep.minus = dep.minus - 1);
  elseif (rndm < 12)
    this:regulator();
  endif
endif
"THX (#105941) - Thu Mar  9, 2000 - Added this.relative that can be manually set by G_M for each Form.  The rough equation that I used to set these initially is: Form.relative = 35 + 20 * (# of direct combat Form spells) + 5 * (# of duration effect Form spells) + 2 * (# of Form spells used only on occasion).  Why is this important?  Because the direct combat spells (like firebolt) will be called more often than the duration effect spells (like backfire).";
.

@verb #22517:"regulator" this none this
@program #22517:regulator
if (caller != this)
  raise(E_PERM);
else
  forms = $local.rpg.magic_db.magic_forms;
  m = n = 0;
  for t in (forms)
    m = m + abs(t.minus);
    n = n + t.minus;
  endfor
  n = n / length(forms);
  if (n)
    integral = ((random(33) < 9) * m) / 99;
    for t in (forms)
      tminus = t.minus + (((t.minus < 0) ? 1 | -1) * integral);
      t.minus = max(min(tminus - n, 42), -42);
    endfor
  endif
  return n;
endif
"THX (#105941) - Fri Feb 18, 2000 - Added an integral term that tends to reduce all .minus values to 0 over time.";
.

@verb #22517:"tracker" this none this
@program #22517:tracker
$local.rpg:secure();
for t in ($list_utils:reverse($list_utils:sort(children($code_utils:verb_loc()), $list_utils:map_prop(children($code_utils:verb_loc()), "usage"))))
  t.usage && player:tell($string_utils:right(t.usage, 8), "   ", $string_utils:left(t.aliases[1], 15), " ", $string_utils:nn(t));
endfor
.

@verb #22517:"penalty" this none this
@program #22517:penalty
{doll} = args;
if (caller == this)
  return pass(doll) - this:playbalance_penalty();
endif
return 0;
.

@verb #22517:"update" this none this
@program #22517:update
(rpg = $local.rpg):secure();
update = {@rpg.magic_db.magic_forms, @rpg.magic_db.magic_techniques};
l_u = $list_utils;
for s in ($object_utils:descendents(rpg.spell_skill_object))
  for t in (l_u:flatten(s.dependant))
    (t in update) && (t.subskills = setadd(t.subskills, s));
  endfor
endfor
.

@verb #22517:"playbalance_penalty" this none this
@program #22517:playbalance_penalty
return (caller == this) ? max(min(`this.dependant[2][1].minus ! ANY => 0', 27), -27) | 0;
.

@verb #22517:"get_playbalance" this none this
@program #22517:get_playbalance
"Returns the amount that is effectively added to the skill resolve based on the playbalance effect given by the MagicK Form usage tracking.";
$local.rpg:secure();
return this:playbalance_penalty();
"THX (#105941) - Thu Feb 22, 2001 - Added so that gamemasters can see the current playbalance modifier on a given skill.";
.

"***finished***