int d_dispel_abil(struct command *c) { int target = c->a; struct char_magic *p; p = rp_magic(target); if (p && p->ability_shroud > 0) { if (!charge_aura(c->who, 3)) return FALSE; wout(c->who, "Dispeled an aura %s ability shroud from %s.", nice_num(p->ability_shroud), box_name(target)); p->ability_shroud = 0; wout(target, "The magical ability shroud has dissipated."); } else { wout(c->who, "%s had no ability shroud.", box_name(target)); } return TRUE; }
int d_detect_abil(struct command *c) { if (!charge_aura(c->who, 1)) return FALSE; return TRUE; }
int d_undead_lord(struct command *c) { int where = subloc(c->who); int aura = c->a; int undead; int rating; if (!may_cookie_npc(c->who, where, item_undead_cookie)) return FALSE; if (!charge_aura(c->who, aura)) return FALSE; undead = do_cookie_npc(c->who, where, item_undead_cookie, c->who); if (undead == 0) { log_write(LOG_CODE, "d_undead_lord: why not?"); wout(c->who, "Unable to summon a demon lord."); return FALSE; } switch (aura) { case 3: rating = 100; break; case 4: rating = 150; break; case 5: rating = 190; break; case 6: rating = 220; break; case 7: rating = 240; break; case 8: rating = 250; break; default: assert(FALSE); } p_char(undead)->attack = rating; p_char(undead)->defense = rating; set_loyal(undead, LOY_summon, 5); wout(c->who, "Summoned %s.", box_name(undead)); wout(where, "%s has summoned %s.", box_name(c->who), liner_desc(undead)); return TRUE; }
int d_heal(struct command *c) { int target = c->a; int aura = c->b; int chance; if (kind(target) != T_char) { wout(c->who, "%s is no longer a character.", box_code(target)); return FALSE; } if (!char_sick(target)) { wout(c->who, "%s is not sick.", box_name(target)); return FALSE; } if (!charge_aura(c->who, aura)) return FALSE; switch (aura) { case 1: chance = 30; break; case 2: chance = 15; break; case 3: chance = 5; break; default: assert(FALSE); } vector_clear(); vector_add(c->who); vector_add(target); wout(VECT, "%s casts Heal on %s:", box_name(c->who), box_name(target)); if (rnd(1, 100) <= chance) { wout(VECT, "Spell fails."); return FALSE; } p_char(target)->sick = FALSE; wout(VECT, "%s has been cured, and should now recover.", box_name(target)); return TRUE; }
int d_quick_cast(struct command *c) { int aura = c->a; struct char_magic *p; if (!charge_aura(c->who, aura)) return FALSE; p = p_magic(c->who); p->quick_cast += aura; wout(c->who, "Spell cast speedup now %d.", p->quick_cast); return TRUE; }
int d_shroud_abil(struct command *c) { int aura = c->a; struct char_magic *p; if (!charge_aura(c->who, aura)) return FALSE; p = p_magic(c->who); p->ability_shroud += aura; wout(c->who, "Now cloaked in an aura %s ability shroud.", nice_num(p->ability_shroud)); return TRUE; }
int d_keep_undead(struct command *c) { int target = c->a; if (!keep_undead_check(c, TRUE)) return FALSE; if (!charge_aura(c->who, 3)) return FALSE; set_loyal(target, LOY_summon, max(loyal_rate(target) + 4, 8)); wout(c->who, "%s will remain for %d months.", box_code(target), loyal_rate(target)); return TRUE; }
int d_banish_undead(struct command *c) { int target = c->a; int where = subloc(c->who); int head; if (!keep_undead_check(c, FALSE)) return FALSE; if (!charge_aura(c->who, 6)) return FALSE; head = stack_leader(target); wout(head, "%s banishes %s!", box_name(c->who), box_name(target)); wout(where, "%s banishes %s!", box_name(c->who), box_name(target)); extract_stacked_unit(target); kill_char(target, 0, S_body); return TRUE; }
int d_hinder_med(struct command *c) { int target = c->a; int aura = c->b; struct char_magic *p; if (!charge_aura(c->who, aura)) return FALSE; wout(c->who, "Successfully cast %s on %s.", box_name(sk_hinder_med), box_name(target)); p = p_magic(target); p->hinder_meditation += aura; if (p->hinder_meditation > 3) p->hinder_meditation = 3; hinder_med_omen(target, c->who); return TRUE; }
int d_view_aura(struct command *c) { int n; int level; int first = TRUE; int aura = c->a; int where = c->d; char *s; int has_detect; int learned; char *source; if (!is_loc_or_ship(where)) { wout(c->who, "%s is no longer a valid location.", box_code(where)); return FALSE; } if (!charge_aura(c->who, aura)) return FALSE; loop_char_here(where, n) { if (is_magician(n)) { /* * Does the viewed magician have Detect ability scry? */ level = char_cur_aura(n); if (aura <= char_abil_shroud(n)) { s = "???"; learned = FALSE; } else { s = sout("%d", level); learned = TRUE; } wout(c->who, "%s, current aura: %s", box_name(n), s); first = FALSE; has_detect = has_skill(n, sk_detect_abil); if (has_detect > exp_novice) source = box_name(c->who); else source = "Someone"; if (has_detect) wout(n, "%s cast View aura here.", source); if (has_detect > exp_journeyman) { if (learned) wout(n, "Our current aura rating was learned."); else wout(n, "Our current aura rating was " "not revealed."); } } } next_char_here; if (first) { wout(c->who, "No mages are seen here."); log_output(LOG_CODE, "d_view_aura: not a mage?\n"); } return TRUE; }
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; }