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
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;
}
Exemple #3
0
void
alert_scry_attempt(int who, int where, char *t)
{
  int n;
  int has_detect;
  char *source;

  loop_char_here(where, n) {
    has_detect = has_skill(n, sk_detect_scry);

    if (has_detect > exp_novice)
      source = box_name(who);
    else
      source = "Someone";

    if (has_detect)
      wout(n, "%s%s cast %s on this location.",
           source, t, box_name(sk_scry_region));

    if (has_detect >= exp_master)
      wout(n, "%s is in %s.", box_name(who), char_rep_location(who));
/*
 *  If another exp gradient is wanted, use box_name for the loc,
 *  then graduate to char_rep_location, since the latter gives
 *  more info
 */

  }
Exemple #4
0
char *
loc_inside_string(int where)
{
  char *name = NULL;
  char *trail = NULL;

  if (loc_depth(where) > LOC_region) {
    trail = loc_inside_string(loc(where));
  };

  switch (loc_depth(where)) {
  case LOC_region:
    name = just_name(region(where));
    break;
  case LOC_province:
    if (!valid_box(where))
      name = sout("adrift in the Cosmos");
    else
      name = box_name(where);
    break;
  default:
    name = box_name(where);
  };

  if (trail != NULL)
    return sout(", in %s%s", name, trail);

  return sout(", in %s", name);
};
Exemple #5
0
int
v_credit(struct command *c)
{
  int target = c->a;
  int amount = c->b;
  int item = c->c;
  int pl;
  extern int gold_times;

  if (amount) {
    if (kind(target) != T_char && kind(target) != T_player) {
      wout(c->who, "%s not a character or player.", c->parse[1]);
      return FALSE;
    }

    if (numargs(c) >= 3 && i_strcmp(c->parse[3], "np") == 0) {
      if (kind(target) != T_player) {
        wout(c->who, "%s not a player.", box_code(target));
        return FALSE;
      }

      add_np(target, amount);
      wout(c->who, "Credited %s %d NP.", box_name(target), amount);
      wout(target, "Received GM credit of %d NP.", amount);
      return TRUE;
    }

    if (item == 0)
      item = 1;

    gen_item(target, item, amount);
    wout(c->who, "Credited %s %s.", box_name(target),
         box_name_qty(item, amount));
    wout(target, "Received CLAIM credit of %s.", box_name_qty(item, amount));
    return TRUE;
  }

  if (kind(target) != T_char) {
    wout(c->who, "%s not a character.", c->parse[1]);
    return FALSE;
  }

  pl = player(target);

  if (times_paid(pl)) {
    wout(c->who, "Already paid faction %s.", box_name(pl));
    return FALSE;
  }

  p_player(pl)->times_paid = TRUE;

  wout(target, "The Times pays %s %s.", box_name(target), gold_s(25));

  gen_item(target, item_gold, 25);
  gold_times += 25;

  return TRUE;
}
Exemple #6
0
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;
}
Exemple #7
0
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;
}
/*
 *  Thu Oct 10 14:50:13 1996 -- Scott Turner
 *
 *  Capture Beasts is now an explicit skill
 *
 */
int
v_capture_beasts(struct command *c)
{
  int target = c->a;
  
  if (!has_holy_symbol(c->who)) {
    wout(c->who, "You must have a holy symbol to capture wild beasts.");
    return FALSE;
  };

  if (!has_holy_plant(c->who)) {
    wout(c->who, "Capturing wild beasts requires a holy plant.");
    return FALSE;
  };

  /*
   *  Target should be a character (oddly enough)
   *
   */
  if (kind(target) != T_char) {
    wout(c->who, "You cannot capture beasts from %s.",box_name(c->a));
    return FALSE;
 };

  /*
   *  In same location.
   *
   */
  if (!check_char_here(c->who, target)) {
    wout(c->who, "%s is not here.",box_name(c->a));
    return FALSE;
  };

  if (is_prisoner(target)) {
    wout(c->who, "Cannot capture beasts from prisoners.");
    return FALSE;
  };

  if (c->who == target) {
    wout(c->who, "Can't capture beasts from oneself.");
    return FALSE;
  };

  if (stack_leader(c->who) == stack_leader(target)) {
    wout(c->who, "Can't capture beasts from a member of the same stack.");
    return FALSE;
  };

  return TRUE;
};
Exemple #9
0
int
v_heal(struct command *c)
{
  int target = c->a;
  int aura;

  if (c->b < 1)
    c->b = 1;
  if (c->b > 3)
    c->b = 3;
  aura = c->b;

  if (!cast_check_char_here(c->who, target))
    return FALSE;

  if (!char_sick(target)) {
    wout(c->who, "%s is not sick.", box_name(target));
    return FALSE;
  }

  if (!check_aura(c->who, aura))
    return FALSE;

  return TRUE;
}
void
hinder_med_omen(int who, int other)
{

  if (rnd(1,100) < 50) return;

	switch (rnd(1,3))
	{
	case 1:
		wout(who, "A disturbing image of %s appeared last "
				"night in a dream.", box_name(other));
		break;

	case 2:
		wout(who, "As a cloud drifts across the moon, it seems "
			"for an instant that it takes the shape of a "
			"ghoulish face, looking straight at you.");
		break;

	case 3:
		wout(who, "You are shocked out of your slumber in the "
			"middle of the night by cold fingers touching your "
			"neck, but when you glance about, there is no one "
			"to be seen.");
		break;

	default:
		assert(FALSE);
	}
}
int
v_view_aura(struct command *c)
{
	int aura;
	int where;

	if (c->a < 1)
		c->a = 1;
	aura = c->a;

	if (!check_aura(c->who, aura))
		return FALSE;

	if (crosses_ocean(cast_where(c->who),c->who)) {
	  wout(c->who,"Something seems to block your magic.");
	  return FALSE;
	};

	where = reset_cast_where(c->who);
	c->d = where;

	wout(c->who, "Will scry the current aura ratings of other "
		"mages in %s.", box_name(where));

	return TRUE;
}
Exemple #12
0
int
v_makeloc(struct command *c)
{
  int n;
  int sk;
  int kind;

  sk = lookup(subkind_s, c->parse[1]);

  if (sk < 0) {
    wout(c->who, "Unknown subkind.");
    return FALSE;
  }

  if (sk == sub_galley || sk == sub_roundship)
    kind = T_ship;
  else
    kind = T_loc;

  n = new_ent(kind, sk);

  if (n < 0) {
    wout(c->who, "Out of boxes.");
    return FALSE;
  }

  set_where(n, subloc(c->who));

  wout(c->who, "Created %s", box_name(n));

  if (sk == sub_temple)
    ilist_append(&p_subloc(n)->teaches, sk_religion);

  return TRUE;
}
Exemple #13
0
static char *
liner_desc_road(int n)
{
  int dest;
  char *hid = "";
  int dist;

  dest = road_dest(n);

  if (road_hidden(n))
    hid = ", hidden";

  dist = exit_distance(loc(n), dest);

  return sout("%s, to %s%s, %d~day%s",
              box_name(n), box_name(dest), hid, add_ds(dist));
}
Exemple #14
0
void
immediate_commands()
{
  struct command *c;
  char buf[LEN];
  char *line;

  printf("Olympia immediate mode\n");

  immediate = gm_player;
  out(immediate, "You are now %s.", box_name(immediate));
  init_locs_touched();

  show_day = TRUE;

  while (1) {
    c = p_command(immediate);
    c->who = immediate;
    c->wait = 0;

    printf("%d> ", immediate);
    fflush(stdout);

    if ((line = getlin(stdin)) == NULL)
      break;
    strcpy(buf, line);

    if (!oly_parse(c, buf)) {
      printf("Unrecognized command.\n");
      continue;
    }

    if (c->fuzzy)
      out(immediate, "(assuming you meant '%s')", cmd_tbl[c->cmd].name);

    c->pri = cmd_tbl[c->cmd].pri;
    c->wait = cmd_tbl[c->cmd].time;
    c->poll = cmd_tbl[c->cmd].poll;
    c->days_executing = 0;
    c->state = STATE_LOAD;

    do_command(c);

    while (c->state == STATE_RUN) {
      evening = 1;
      finish_command(c);
      evening = 0;
      olytime_increment(&sysclock);
    }

    if (ilist_len(trades_to_check) > 0)
      check_validated_trades();

    /* show_day = FALSE; */
  }

  putchar('\n');
}
int
check_allow(struct command *c, char *allow)
{
	int t;
	extern char *strchr();

	if (allow == NULL)
		return TRUE;

	if (immediate && strchr(allow, 'i') != NULL)
		return TRUE;

#if 0
	if (allow == NULL || immediate)
		return TRUE;			/* don't check */
#endif

	switch (bx[c->who]->kind)
	{
	case T_player:	t = 'p';	break;

	case T_char:
		t = restricted_control(c->who);
		if (t == 0)
			t = 'c';
		break;

	default:
		fprintf(stderr, "check_allow: bad kind: %s\n",
							box_name(c->who));
		assert(FALSE);
	}

	if (strchr(allow, 'm') != NULL && player(c->who) == gm_player)
		return TRUE;

	if (strchr(allow, t) == NULL)
	{
		wout(c->who, "%s may not issue that order.", box_name(c->who));
		return FALSE;
	}

	return TRUE;
}
Exemple #16
0
void
scry_show_where(int who, int target)
{

  if (crosses_ocean(who, target)) {
    out(who, "%s is in %s.", just_name(region(target)));
    return;
  }

  out(who, "%s is in %s.", box_name(province(target)));
}
Exemple #17
0
int
v_be(struct command *c)
{

  if (valid_box(c->a)) {
    immediate = c->a;
    out(immediate, "You are now %s.", box_name(c->a));
    return TRUE;
  }

  out(c->who, "'%s' not a valid box.", c->parse[1]);
  return FALSE;
}
Exemple #18
0
static int
show_loc_barrier(int who, int where)
{

  if (loc_barrier(where)) {
    tagout(who, "<tag type=loc_barrier id=%d>", where);
    wout(who, "A magical barrier surrounds %s.", box_name(where));
    tagout(who, "</tag type=loc_barrier>");
    return TRUE;
  }

  return FALSE;
}
Exemple #19
0
char *
loc_inside_string(int where)
{
  char *reg_name;

  if (loc_depth(where) == LOC_build) {
    if (subkind(loc(where)) == sub_ocean)
      return sout(", in %s", box_name(province(where)));

    if (loc_depth(loc(where)) == LOC_province)
      return sout(", in province %s", box_name(province(where)));

    return sout(", in %s", box_name(province(where)));
  }
  else if (loc_depth(where) == LOC_subloc) {
    if (subkind(province(where)) == sub_ocean)
      return sout(", in %s", box_name(province(where)));
    else if (!valid_box(province(where)))
      return sout(", adrift in the Cosmos");
    else
      return sout(", in province %s", box_name(province(where)));
  }
  else if (subkind(where) == sub_ocean) {
    reg_name = name(region(where));

    if (reg_name && *reg_name)
      return sout(", in %s", reg_name);
    return "";
  }
  else {
    reg_name = name(region(where));

    if (reg_name && *reg_name)
      return sout(", in %s", reg_name);

    return "";
  }
}
Exemple #20
0
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;
}
Exemple #21
0
int
v_add_item(struct command *c)
{

  if (kind(c->a) == T_item) {
    if (kind(c->who) != T_char)
      out(c->who, "Warning: %s not a character", box_name(c->who));
    gen_item(c->who, c->a, c->b);
    return TRUE;
  }

  wout(c->who, "%s is not a valid item.", c->parse[1]);
  return FALSE;
}
Exemple #22
0
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;
}
Exemple #23
0
static char *
priest_s(int n)
{
  static char priest_title[80];
  struct entity_religion_skill *e;

  if (!is_priest(n))
    return "";

  e = rp_relig_skill(is_priest(n));

  if (e && e->high_priest == n) {
    sprintf(priest_title, ", the High Priest of the %s",
            box_name(is_priest(n)));
  }
  else if (e && (e->bishops[0] == n || e->bishops[1] == n)) {
    sprintf(priest_title, ", Bishop of the %s", box_name(is_priest(n)));
  }
  else {
    sprintf(priest_title, ", priest of the %s", box_name(is_priest(n)));
  };
  return priest_title;

}
int
v_dispel_abil(struct command *c)
{
	int target = c->a;

	if (!cast_check_char_here(c->who, target))
		return FALSE;

	if (!check_aura(c->who, 3))
		return FALSE;

	wout(c->who, "Attempt to dispel any ability shroud from %s.",
					box_name(target));

	return TRUE;
}
char *
plural_item_box(int item, int qty)
{
	char *s;

	if (qty == 1)
		return box_name(item);

	s = plural_item_name(item, qty);

	if (options.output_tags > 0)
	  return sout("<tag type=box id=%d link=%d>%s~%s</tag type=box id=%d>",
		      item, item,
		      s, box_code(item), item);
	else 
	  return sout("%s~%s", s, box_code(item));
}
Exemple #26
0
int
v_view_aura(struct command *c)
{
  int aura;
  int where;

  if (c->a < 1)
    c->a = 1;
  aura = c->a;

  if (!check_aura(c->who, aura))
    return FALSE;

  where = reset_cast_where(c->who);
  c->d = where;

  wout(c->who, "Will scry the current aura ratings of other "
       "mages in %s.", box_name(where));

  return TRUE;
}
Exemple #27
0
/*
 *  Fri Oct  9 18:19:22 1998 -- Scott Turner
 *
 *  Destroying monster.
 *
 */
int
v_art_destroy(struct command *c)
{
  int item = c->use_skill;
  int where = province(subloc(c->who));
  int num;
  struct item_ent *t;
  int kind;

  assert(rp_item_artifact(item));
  kind = rp_item_artifact(item)->param1;

  if (rp_item_artifact(item)->uses < 1) {
    wout(c->who, "Nothing happens.");
    wout(c->who, "%s vanishes!", box_name(item));
    destroy_unique_item(c->who, item);
    return TRUE;
  };

  log_write(LOG_SPECIAL, "Destroy monster artifact %s used by %s",
            box_code_less(item), box_code_less(player(c->who)));

  wout(c->who, "A golden glow suffuses the province.");
  wout(where, "A golden glow suffuses the province.");

  loop_all_here(where, num) {
    wout(num, "A golden glow suffuses the province.");

    loop_inv(num, t) {
      if (t->item == kind) {
        wout(num, "%s vanished!", box_name_qty(t->item, t->qty));
        consume_item(num, t->item, t->qty);
      }
    }
    next_inv;

    if (subkind(num) == sub_ni && noble_item(num) == kind) {
      kill_char(num, MATES, S_body);
    }
  }
Exemple #28
0
int
v_hinder_med(struct command *c)
{
  int target = c->a;
  int aura;

  if (c->b < 1)
    c->b = 1;
  if (c->b > 5)
    c->b = 5;
  aura = c->b;

  if (!cast_check_char_here(c->who, target))
    return FALSE;

  if (!check_aura(c->who, aura))
    return FALSE;

  wout(c->who, "Attempt to hinder attempts at meditation by %s.",
       box_name(c->who));

  return TRUE;
}
char *
box_name_kind(int n)
{

	return sout("%s, %s", box_name(n), display_kind(n));
}
Exemple #30
0
static char *
liner_desc_char(int n)
{
  char buf[LEN];
  extern int show_combat_flag;
  char *s;
  int sk;

  strcpy(buf, box_name(n));

  sk = subkind(n);

  if (sk == sub_ni) {
    int mk = noble_item(n);
    int num = has_item(n, mk) + 1;

    if (num == 1)
      strcat(buf, sout(", %s", plural_item_name(mk, num)));
    else
      strcat(buf, sout(", %s, number:~%s",
                       plural_item_name(mk, num), comma_num(num)));
  }
  else if (sk) {
    if (sk == sub_temple) {
      if (is_temple(n)) {
        strcat(buf, sout(", Temple of %s", god_name(is_temple(n))));
      }
      else {
        strcat(buf, sout(", undedicated temple"));
      };
    }
    else if (sk == sub_guild) {
      strcat(buf, sout(", %s Guild", box_name(is_guild(n))));
    }
    else {
      strcat(buf, sout(", %s", subkind_s[sk]));
    };
  }

  strcat(buf, nation_s(n));
  strcat(buf, deserted_s(n));
  strcat(buf, rank_s(n));
  strcat(buf, mage_s(n));
  strcat(buf, priest_s(n));
#if 0
  strcat(buf, wield_s(n));
#endif

  if (show_combat_flag) {
    if (char_behind(n))
      strcat(buf, sout(", behind~%d%s", char_behind(n), combat_ally));
    else
      strcat(buf, combat_ally);
  }
  else if (char_guard(n) && stack_leader(n) == n &&
           subkind(n) != sub_garrison)
    strcat(buf, ", on guard");

#if 0
  if (subkind(n) == 0) {        /* only show lord for regular players */
    int sp = lord(n);

    if (sp != indep_player && !cloak_lord(n))
      strcat(buf, sout(", of~%s", box_code_less(sp)));
  }
#endif

  if (show_display_string) {
    s = banner(n);

    if (s && *s)
      strcat(buf, sout(", \"%s\"", s));
  }

  strcat(buf, with_inventory_string(n));

  if (is_prisoner(n))
    strcat(buf, ", prisoner");

  return sout("%s", buf);
}