int v_reveal_mage(struct command *c) { int target = c->a; int category = c->b; int aura; if (c->c < 1) c->c = 1; aura = c->c; if (!cast_check_char_here(c->who, target)) return FALSE; if (!check_aura(c->who, aura)) return FALSE; if (!category || !magic_skill(category) || skill_school(category) != category) { wout(c->who, "%s is not a magical skill category.", box_code(category)); wout(c->who , "Assuming %s.", box_name(sk_basic)); c->b = sk_basic; category = sk_basic; } wout(c->who, "Attempt to scry the magical abilities of %s within %s.", box_name(target), box_name(category)); return TRUE; }
static void get_some_skills(int who, int body, int chance) { struct skill_ent *e; int parent; /* * First do category skills */ loop_char_skill_known(body, e) { parent = skill_school(e->skill); if (parent != e->skill) continue; if (has_skill(who, e->skill)) continue; if (e->skill == sk_adv_sorcery) continue; /* * Fri Sep 20 12:49:59 1996 -- Scott Turner * * Can't learn religions by eating the dead! * */ if (rp_relig_skill(e->skill)) continue; if (rnd(1, 100) > chance) continue; learn_skill(who, e->skill); }
loop_char_skill_known(body, e) { parent = skill_school(e->skill); if (parent == e->skill) continue; if (has_skill(who, e->skill) || has_skill(who, parent) == 0) continue; if (rnd(1, 100) > chance) continue; learn_skill(who, e->skill); }
/* * Sat Oct 3 18:31:24 1998 -- Scott Turner * * Select a random use skill. * */ static int random_use() { int i, choice = 0; int sum = 0; loop_skill(i) { if (i != skill_school(i) && find_use_entry(i)) { sum++; if (rnd(1, sum) == 1) { choice = i; }; }; } next_item; return choice; };
int d_reveal_mage(struct command *c) { int target = c->a; int category = c->b; int aura = c->c; int has_detect; char *source; if (!charge_aura(c->who, aura)) return FALSE; assert(valid_box(category)); assert(skill_school(category) == category && magic_skill(category)); has_detect = has_skill(target, sk_detect_abil); if (has_detect > exp_novice) source = box_name(c->who); else source = "Someone"; if (aura <= char_abil_shroud(target)) { wout(c->who, "The abilities of %s are shrouded from " "your scry.", box_name(target)); if (has_detect) wout(target, "%s cast %s on us, but failed to learn " "anything.", source, box_name(sk_reveal_mage)); if (has_detect > exp_teacher) wout(target, "They sought to learn what we " "know of %s.", box_name(category)); return FALSE; } { int first = TRUE; struct skill_ent *e; loop_char_skill_known(target, e) { if (skill_school(e->skill) != category || e->skill == category) continue; if (first) { wout(c->who, "%s knows the following " "%s spells:", box_name(target), box_name(category)); indent += 3; first = FALSE; } if (c->use_exp > exp_journeyman) list_skill_sup(c->who, e); else wout(c->who, "%s", box_name(e->skill)); } next_char_skill_known; if (first) wout(c->who, "%s knowns no %s spells.", box_name(target), box_name(category)); else indent -= 3; } if (has_detect) { wout(target, "%s successfully cast %s on us.", source, box_name(sk_reveal_mage)); if (has_detect > exp_teacher) wout(target, "Our knowledge of %s was revealed.", box_name(category)); } return TRUE; }