Generic Skill Object #19051
Aliases: Generic, Skill, Object
18 verbs · 22 properties · 1 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
resolve | this none this | | #19051 | 27 |
moveto | this none this | | #19051 | 6 |
penalty | this none this | | #19051 | 6 |
property_name | this none this | | #19051 | 2 |
initialize | this none this | rx | #19051 | 8 |
recycle | this none this | rx | #19051 | 8 |
description | this none this | | #19051 | 11 |
tell_stats | this none this | | #19051 | 10 |
stinkcloud_pen*alty | this none this | | #19051 | 29 |
fake_resolve pseudoresolve | this none this | | #19051 | 27 |
cap | this none this | | #19051 | 13 |
improve_learn_ok | this none this | | #19051 | 1 |
slowness_mod | this none this | | #19051 | 10 |
check_improve | this none this | | #19051 | 18 |
do_improve | this none this | | #19051 | 11 |
track_usage | this none this | | #19051 | 1 |
penalty_trusted | this none this | | #19051 | 3 |
stinkcloud_pen(old) | this none this | | #19051 | 28 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
dependant | #19051 | r | — | {{}, {}} |
learn | #19051 | r | — | 10 |
encumbrance | #19051 | r | — | 0 |
insanity | #19051 | r | — | 0 |
injury | #19051 | r | — | 0 |
fatigue | #19051 | r | — | 0 |
dep_names | #19051 | r | — | {} |
neg_deps | #19051 | r | — | {} |
neg_dep_names | #19051 | r | — | {} |
max_level | #19051 | r | — | 25 |
caps | #19051 | r | — | {} |
cap_names | #19051 | r | — | {} |
cap_boost_mult | #19051 | r | — | 1 |
enc_ins_inj_fat | #19051 | rc | — | {0, 0, 0, 0} |
improve_learn_ok | #19051 | rc | — | 1 |
improve_task | #19051 | r | — | 264748148 |
queue | #19051 | | — | not readable (E_PERM) |
move_dependent | #19051 | r | — | 0 |
key | #19051 | | — | not readable (E_PERM) |
aliases | #19051 | | — | {"Generic", "Skill", "Object"} |
description | #19051 | | — | "An indicator of skill in some nameless area." |
object_size | #19051 | | — | {15902, 1141286561} |
Ancestry
Ancestors (nearest first): none
Children: #22517 Generic Spell Skill Object
Call graph
Source
resolve
Referenced by
none
Source
1":resolve(<OBJ character>, <NUM modifier to resolve>, [FLAG no_improve], [OBJ permissions]) => NUM result of skill roll for character, with modfier added on."; 2"The no_improve flag, if given and true, prevents the doll's skill improvement routine from being called at all."; 3"The permissions argument overrides the regular perm check for gm probationary status in deciding whether or not to call the doll's improve routine."; 4if (caller_perms() in (rpg = $local.rpg).gms) 5 {char, mod, ?no_imp = 0, ?perms = caller_perms()} = args; 6 if (valid(doll = rpg:get_doll(char))) 7 no_imp = no_imp || (valid(doll.duelee) && (`rpg:get_doll(doll.duelee).duelee ! E_INVIND' == doll.character)); 8 res = rpg:roll(doll:total(this) + mod) - (pen = this:penalty(doll)); 9 res = this:slowness_mod(res - this:stinkcloud_pen(doll), doll); 10 ic = this:slowness_mod(max(20, random(180) - 60), doll) - pen; 11 if (no_imp) 12 "... don't call improve ..."; 13 else 14 if ((res > -20) && (res < ic)) 15 (perms in rpg.probation) || this:check_improve(doll); 16 endif 17 this:track_usage(); 18 endif 19 doll.last_action = time(); 20 return res; 21 else 22 return -200; 23 endif 24else 25 return 100 - random(200); 26 "Return some random nonsensical number, just so prospective GMs can practice with resolves and not get E_TYPEs from an E_PERM."; 27endif
moveto
Referenced by
- #19051:initialize line 2:
this:moveto
Source
1{where} = args; 2if ($local.rpg:is_grandmaster(caller_perms()) || caller_perms().wizard) 3 return pass(where); 4else 5 return E_PERM; 6endif
penalty
Referenced by
- #19051:resolve line 8:
this:penalty - #19051:penalty_trusted line 3:
this:penalty - #22517:penalty line 3:
pass(
Source
1{doll} = args; 2if (caller == this) 3 return ((((4 + (this.injury * doll.inj)) + (this.insanity * doll.ins)) + (this.fatigue * doll.fat)) + ((this.encumbrance * doll:encumbrance()) / 3)) / min(25, doll.end || 15); 4endif 5return 0; 6"THX (#105941) - Mon Mar 29, 1999 - subst /10/(doll.end || 15)/2";
property_name
Referenced by
- #19051:recycle line 2:
this:property_name - #19051:fake_resolve line 9:
this:property_name
Source
1"Return the corresponding property name on $local.rpg.doll."; 2return this.aliases[1];
initialize
Referenced by
none
Source
1if ((caller == this) || $perm_utils:controls(caller_perms(), this)) 2 this:moveto($local.rpg.skills); 3 $quota_utils:object_bytes(this); 4 return pass(@args); 5else 6 return E_PERM; 7endif 8"Profane 13-DEC-95 1126 EST -- $quota:utils:object_size.";
recycle
Referenced by
none
Source
1if ((caller == this) || $perm_utils:controls(caller_perms(), this)) 2 propname = this:property_name(); 3 delete_property($local.rpg.doll, propname); 4 delete_property($local.rpg.skills, propname); 5 return pass(@args); 6else 7 return E_PERM; 8endif
description
Referenced by
none
Source
1"Return the description, plus a line detailing which skills affect this one."; 2deps = this.dependant; 3atts = deps[1]; 4skills = deps[2]; 5if (atts || skills) 6 depstr = (((this:title() + " is a skill directly influenced by ") + (atts ? "the attributes " + $string_utils:title_list(atts) | "")) + (skills ? ((atts ? ", and " | "") + "the skill(s) ") + $string_utils:title_list(skills) | "")) + "."; 7else 8 depstr = this:title() + " is a basic attribute."; 9endif 10return {@(typeof(base = pass(@args)) == LIST) ? base | {base}, depstr}; 11"DR 10-APR-94 -- Tweaked the spacing in 'the skills'.";
tell_stats
Referenced by
none
Source
1stats = properties($local.RPG.skill_object); 2player:tell($string_utils:centre(this.name, 40, "-")); 3dep = this.dependant; 4player:tell("Dependant Attributes: ", $string_utils:nn(dep[1], "", "None")); 5player:tell("Dependant Skills: ", $string_utils:nn(dep[2], "", "None")); 6player:tell(""); 7for pn in (setremove(stats, "dependant")) 8 player:tell($string_utils:left(pn, 18), ": ", $string_utils:print(this.(pn))); 9endfor 10player:tell($string_utils:space(40, "-"));
stinkcloud_pen*alty
Referenced by
none
Source
1":stinkcloud_penalty(<OBJ doll>) => NUM penalty that doll should have to a resolve roll for being under the influence of stinkcloud"; 2{doll} = args; 3rpg = $local.rpg; 4if ((rpg.magic_db.sc_combat_effect in doll.view_effects) && (data = doll:read_misc_note("stinkcloud"))) 5 if (caller != this) 6 "Return some random nonsensical number, just so prospective GMs can practice with resolves and not get E_TYPEs from an E_PERM."; 7 return 99 - random(200); 8 endif 9 {qual, time} = data; 10 qual = (qual > 0) ? qual | 0; 11 cloud_pen = min(max((time - time()) + (qual * toint(sqrt(tofloat(qual)))), 1), qual); 12 if ((rpg.skills.shock:resolve(doll, -cloud_pen) >= 0) || ((time() - time) > 1200)) 13 doll:erase_misc_note("stinkcloud"); 14 rpg.magic_db.sc_combat_effect:remove(doll); 15 rpg:playertell(doll.character, "You have finally recovered from the effects of the stinking cloud."); 16 cloud_pen = 0; 17 else 18 if (random(4) == 1) 19 rpg:playertell(doll.character, "You are still reeling from the effects of the stinking cloud. . ."); 20 rpg:say_action("%N %<hacks> and %<wheezes>.", doll.character); 21 endif 22 endif 23 return cloud_pen; 24endif 25return 0; 26"Irin Mon Sep 9 17:15:12 1996 PDT -- replaced $math_utils:sqrt() with sqrt(). Set max penalty to equal quality."; 27"THX 18-FEB-1997 - tossed in scatters where appropriate to kill list indexings. Cleaned up a bit."; 28"Profane (#30788) - Tue Jan 13, 1998 - simplify security"; 29"THX (#105941) - Wed Jun 13, 2001 - Put security check inside the check for stinkcloud presence and checked for stinkcloud effect in doll.view_effects before doll:read_misc_note(\"stinkcloud\"). This saves ~100 ticks for every single resolve call! But we should still get rid of this hack.";
fake_resolve pseudoresolve
Referenced by
none
Source
1":fake_resolve(<OBJ character>, <NUM modifier to resolve>, [NUM skill score,LIST dependant, NUM learn, NUM encumbrance pen, NUM insanity pen, NUM injury pen, NUM fatigue pen]) => As a regular resolve, but allows you to pass parameters for various penalty bits."; 2if (!$local.rpg:trusted(caller_perms())) 3 return 100 - random(200); 4elseif (!valid(doll = $local.rpg:get_doll(args[1]))) 5 return E_INVARG; 6else 7 mod = args[2]; 8 l = length(args); 9 score = (l > 2) ? args[3] | doll.(this:property_name()); 10 dependant = (l > 3) ? args[4] | this.dependant; 11 learn = (l > 4) ? args[5] | this.learn; 12 insanity = (l > 5) ? args[6] | this.insanity; 13 injury = (l > 6) ? args[7] | this.injury; 14 fatigue = (l > 7) ? args[8] | this.fatigue; 15 total = score; 16 for dep_att in (dependant[1]) 17 total = total + doll.(dep_att.aliases[1]); 18 endfor 19 for dep_att in (dependant[2]) 20 total = total + doll:total(dep_att); 21 endfor 22 pen = ((((4 + (injury * doll.inj)) + (insanity * doll.ins)) + (fatigue * doll.fat)) + ((encumbrance * doll:encumbrance()) / 10)) / 10; 23 res = $local.rpg:roll((total + mod) - pen); 24 res = res - this:stinkcloud_pen(doll); 25 doll.last_action = time(); 26 return res; 27endif
cap
Referenced by
none
Source
1"#19051:cap(doll) => returns maximum value that the skill can have, for purposes of $local.rpg.doll:improve."; 2$local.rpg:secure(); 3if (cn = this.cap_names) 4 {doll} = args; 5 top = 0; 6 for c in (cn) 7 top = max(top, doll.(c)); 8 endfor 9 return top; 10else 11 return this.max_level; 12endif 13"Each skill has a list of cap names. These are compiled by #34595:update_skills, when skills are changed. Each skill has an individual cap, and each one depends on either its own cap, or if it has none, the caps of all skills higher on it in the hierarchy. Thus, melee is based on CAPmelee, while rapier is capped by CAPsword and CAPweap1. Somebody come up with a less obscure method. Please! ;) -- Irin.";
improve_learn_ok
Referenced by
none
Source
1return this.(verb);
slowness_mod
Referenced by
- #19051:resolve line 9:
this:slowness_mod - #19051:resolve line 10:
this:slowness_mod
Source
1"Makes it more difficult to improve if you're hasted. Easier of slowed."; 2"I realize the code is a bit of an eye-sore. So, what it does is take the first argument, `res' and will halve it for a slowness of 2 and make it half again its original value for a slowness of 18. Those are the min and max values and everything in-between is proportionate. A slowness of 10 would be unchanged."; 3{res, doll} = args; 4if (caller == this) 5 return toint(tofloat(res) * doll.slowness_mod); 6else 7 return res; 8endif 9"Mooshie (#106469) - Fri Dec 26, 1997 - Added. I hope I never have to look back on this and wonder how I was doing it."; 10"Mooshie (#106469) - Thu Feb 5, 1998 - Faster version. :set_att now hooks .slowness modifications and sets .slowness_mod appropriately.";
check_improve
Referenced by
- #19051:resolve line 15:
this:check_improve
Source
1":check_improve(OBJ doll)"; 2{doll} = args; 3(rpg = $local.rpg):secure(); 4who = doll.character; 5if ((`idle_seconds(who) ! ANY => -1' < 0) && (!(who.owner in rpg.gms))) 6 raise(E_PERM, "No skill improvement for disconnected players."); 7elseif (this.move_dependent && doll:stymied()) 8 return; 9endif 10root = $code_utils:verb_loc(); 11root.queue = {@root.queue, {doll, this, callers()}}; 12"Okay, we're basically checking if the improve_task has ended, or suspended in someone else's queue here. I.e., some idiot player's :tell verb."; 13if ((!$code_utils:task_valid(root.improve_task)) || (`task_stack(root.improve_task) ! ANY' == E_PERM)) 14 fork z (0) 15 root:do_improve(); 16 endfork 17 root.improve_task = z; 18endif
do_improve
Referenced by
none
Source
1":do_improve()"; 2(rpg = $local.rpg):secure(); 3root = $code_utils:verb_loc(); 4while (root.queue && (root.improve_task == task_id())) 5 {doll, skill, callers} = root.queue[1]; 6 root.queue = root.queue[2..$]; 7 if (`doll.(skill.aliases[1]) || 1 ! ANY') 8 doll:improve(skill, 0, callers); 9 endif 10 rpg:s_i_f_i_n(); 11endwhile
track_usage
Referenced by
- #19051:resolve line 17:
this:track_usage
Source
1return;
penalty_trusted
Referenced by
none
Source
1{doll} = args; 2$local.rpg:secure(); 3return this:penalty(doll);
stinkcloud_pen(old)
Referenced by
none
Source
1":stinkcloud_penalty(<OBJ doll>) => NUM penalty that doll should have to a resolve roll for being under the influence of stinkcloud"; 2if (caller != this) 3 "Return some random nonsensical number, just so prospective GMs can practice with resolves and not get E_TYPEs from an E_PERM."; 4 return 99 - random(200); 5else 6 {doll} = args; 7 rpg = $local.rpg; 8 if (data = doll:read_misc_note("stinkcloud")) 9 {qual, time} = data; 10 qual = (qual > 0) ? qual | 0; 11 cloud_pen = min(max((time - time()) + (qual * toint(sqrt(tofloat(qual)))), 1), qual); 12 if ((rpg.skills.shock:resolve(doll, -cloud_pen) >= 0) || ((time() - time) > 1200)) 13 doll:erase_misc_note("stinkcloud"); 14 rpg.magic_db.sc_combat_effect:remove(doll); 15 rpg:playertell(doll.character, "You have finally recovered from the effects of the stinking cloud."); 16 cloud_pen = 0; 17 else 18 if (random(4) == 1) 19 rpg:playertell(doll.character, "You are still reeling from the effects of the stinking cloud. . ."); 20 rpg:say_action("%N %<hacks> and %<wheezes>.", doll.character); 21 endif 22 endif 23 return cloud_pen; 24 endif 25endif 26"Irin Mon Sep 9 17:15:12 1996 PDT -- replaced $math_utils:sqrt() with sqrt(). Set max penalty to equal quality."; 27"THX1138 18-FEB-1997 - tossed in scatters where appropriate to kill list indexings. Cleaned up a bit."; 28"Profane (#30788) - Tue Jan 13, 1998 - simplify security";