Пример #1
0
static int
keep_undead_check(struct command *c, int check_bond)
{
	int target = c->a;

	if (kind(target) != T_char || subkind(target) != sub_demon_lord)
	{
	    wout(c->who, "%s is not a demon lord.", box_code(target));
	    return FALSE;
	}

	if (subloc(target) != subloc(c->who))
	{
		wout(c->who, "%s is not here.", box_code(target));
		return FALSE;
	}

	if (check_bond && loyal_kind(target) != LOY_summon)
	{
		wout(c->who, "%s is no longer bonded.", box_code(target));
		return FALSE;
	}

	return TRUE;
}
Пример #2
0
int
d_bird_spy(struct command *c)
{
	int targ = c->d;

	if (!has_holy_symbol(c->who)) {
	  wout(c->who, "A holy symbol is required to bird spy.");
	  return FALSE;
	};

	if (!use_piety(c->who, skill_piety(c->use_skill))) {
	  wout(c->who, "You don't have the piety required to use that prayer.");
	  return FALSE;
	};

	if (!is_loc_or_ship(targ))
	{
		wout(c->who, "%s is not a location.", box_code(targ));
		return FALSE;
	}

	wout(c->who, "The bird returns with a report:");
	out(c->who, "");
	show_loc(c->who, targ);

	return TRUE;
}
Пример #3
0
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;
}
Пример #4
0
int
v_scry_region(struct command *c)
{
  int targ_loc = c->a;
  int aura = c->b;

  if (!is_loc_or_ship(targ_loc)) {
    wout(c->who, "%s is not a location.", box_code(targ_loc));
    return FALSE;
  }

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

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

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

  return TRUE;
}
Пример #5
0
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));
}
Пример #6
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;
}
Пример #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;
}
Пример #8
0
int
v_eat_dead(struct command *c)
{
  int body = c->a;

  /*
   *  Sun Jun  1 10:31:40 1997 -- Scott Turner
   *
   *  Might have a lost soul as a prisoner...
   *
   */
  if (!valid_box(body)) {
    wout(c->who, "Don't have %s.", box_code(body));
    return FALSE;
  }

  if (kind(body) == T_item) {
    if (subkind(body) != sub_dead_body) {
      wout(c->who, "%s is not a dead body.", box_code(body));
      return FALSE;
    };
    if (!has_item(c->who, body)) {
      wout(c->who, "You do not possess that body.");
      return FALSE;
    };
  }
  else if (kind(body) == T_char) {
    if (subkind(body) != sub_lost_soul) {
      wout(c->who, "%s is not a lost soul.", box_code(body));
      return FALSE;
    };
    if (!has_prisoner(c->who, body)) {
      wout(c->who, "You have not captured that lost soul.");
      return FALSE;
    };
  };

  return TRUE;
}
Пример #9
0
char *
box_name(int n)
{
	char *s;

	if (n == garrison_magic)
		return "Garrison";

	if (valid_box(n))
	{
		s = display_name(n);
		if (s && *s)
		{
		  if (options.output_tags > 0)
		    return sout("<tag type=box id=%d>%s~%s</tag type=box id=%d>",
				n,
				s, box_code(n),n);
		  else
		    return sout("%s~%s", s, box_code(n));
		}
	}

	return box_code(n);
}
Пример #10
0
int
cast_check_char_here(int who, int target)
{
  int where;
  int basic;
  int pl;

  basic = char_proj_cast(who);

  if (is_loc_or_ship(basic))
    where = basic;
  else
    where = subloc(who);

#if 1
  p_magic(who)->project_cast = 0;
#endif

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

  if (kind(target) != T_char || where != subloc(target)) {
    wout(who, "%s is not a character in range of this cast.",
         box_code(target));
    return FALSE;
  }

  if (char_really_hidden(target)) {
    pl = player(who);
    if (pl == player(target))
      return TRUE;

    if (contacted(target, who))
      return TRUE;

    return FALSE;
  }

#if 0
  if (basic == where)
    p_magic(who)->project_cast = 0;
#endif

  return TRUE;
}
Пример #11
0
char *
just_name(int n)
{
	char *s;

	if (n == garrison_magic)
		return "Garrison";

	if (valid_box(n))
	{
		s = display_name(n);
		if (s && *s)
			return s;
	}

	return box_code(n);
}
Пример #12
0
int
v_los(struct command *c)
{
  int target = c->a;
  int d;

  if (!is_loc_or_ship(target)) {
    wout(c->who, "%s is not a location.", box_code(target));
    return FALSE;
  }

  d = los_province_distance(subloc(c->who), target);

  wout(c->who, "distance=%d", d);

  return TRUE;
}
Пример #13
0
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;
}
Пример #14
0
char *
plural_item_name(int item, int qty)
{
	char *s;

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

	s = rp_item(item) ? rp_item(item)->plural_name : "";

	if (s == NULL || *s == '\0')
	{
		fprintf(stderr, "warning: plural name not set for "
				"item %s\n", box_code(item));
		s = display_name(item);
	}

	return s;
}
Пример #15
0
int
v_hinder_med(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 (!check_aura(c->who, aura))
		return FALSE;

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

	return TRUE;
}
Пример #16
0
int
d_breed(struct command *c)
{
  int i1 = c->a;
  int i2 = c->b;
  int offspring;
  int breed_accident = BREED_ACCIDENT;
  int killed = FALSE;

  if (is_real_npc(c->who)) return d_npc_breed(c);

  if (kind(i1) != T_item)
    {
      wout(c->who, "%s is not an item.", c->parse[1]);
      return FALSE;
    }

  if (kind(i2) != T_item)
    {
      wout(c->who, "%s is not an item.", c->parse[2]);
      return FALSE;
    }

  if (has_item(c->who, i1) < 1)
    {
      wout(c->who, "Don't have any %s.", box_code(i1));
      return FALSE;
    }

  if (has_item(c->who, i2) < 1)
    {
      wout(c->who, "Don't have any %s.", box_code(i2));
      return FALSE;
    }

  if (i1 == i2 && has_item(c->who, i1) < 2)
    {
      wout(c->who, "Don't have two %s.", box_code(i1));
      return FALSE;
    }

  /*
   *  A normal union just succeeds.
   *
   */
  if (normal_union(i1, i2)) {
    offspring = find_breed(i1, i2);
    wout(c->who, "Produced %s.", box_name_qty(offspring, 1));
    gen_item(c->who, offspring, 1);
    add_skill_experience(c->who, sk_breed_beasts);
    p_skill(sk_breed_beasts)->use_count++;
    return TRUE;
  };

  /*
   *  A non-normal union is more problematic.
   *
   */
  if (!has_holy_symbol(c->who)) {
    wout(c->who, "A holy symbol is required for that breeding.");
    return FALSE;
  };

  /*
   *  Wed Feb 23 12:01:17 2000 -- Scott Turner
   *
   *  Have to directly encode the piety required here so it won't
   *  be charged automatically in use.c
   *
   */
  if (!use_piety(c->who, 3)) {
    wout(c->who, "You don't have the piety required to use that prayer.");
    return FALSE;
  };

  p_skill(sk_breed_beasts)->use_count++;

  /*
   *  The following isn't quite right -- there is no chance of
   *  killing both the breeders if they are of the same type.
   */

  offspring = find_breed(i1, i2);

  if (offspring == item_dragon)
    breed_accident = 13;

  if (i1 == i2)
    breed_accident *= 2;

  if (i1 && rnd(1,100) <= breed_accident)
    {
      wout(c->who, "%s was killed in the breeding attempt.",
	   cap(box_name_qty(i1, 1)));
      consume_item(c->who, i1, 1);
      killed = TRUE;
    }

  if (i2 && rnd(1,100) <= breed_accident && i1 != i2)
    {
      wout(c->who, "%s was killed in the breeding attempt.",
	   cap(box_name_qty(i2, 1)));
      consume_item(c->who, i2, 1);
      killed = TRUE;
    }

  if (offspring == 0 || rnd(1,4) == 1)
    {
      wout(c->who, "No offspring was produced.");
      return FALSE;
    }

  wout(c->who, "Produced %s.", box_name_qty(offspring, 1));

  gen_item(c->who, offspring, 1);
  add_skill_experience(c->who, sk_breed_beasts);

  return TRUE;
};
Пример #17
0
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;
}
Пример #18
0
/*
 *  Wed Mar  5 12:14:55 1997 -- Scott Turner
 *
 *  Added hooks for npc_breed, which is used by the NPC chars.
 *
 */
int
v_breed(struct command *c)
{
  int i1 = c->a;
  int i2 = c->b;
  int exp;

  if (is_real_npc(c->who)) {
    c->wait += 7;
    return TRUE;
  };

  if (!has_skill(c->who, sk_breed_beasts))
    {
      wout(c->who, "Requires %s.", box_name(sk_breed_beasts));
      return FALSE;
    }
  c->use_skill = sk_breed_beasts;

  if (numargs(c) < 2)
    {
      wout(c->who, "Usage: breed <item> <item>");
      return FALSE;
    }

  if (kind(i1) != T_item)
    {
      wout(c->who, "%s is not an item.", c->parse[1]);
      return FALSE;
    }

  if (kind(i2) != T_item)
    {
      wout(c->who, "%s is not an item.", c->parse[2]);
      return FALSE;
    }

  if (has_item(c->who, i1) < 1)
    {
      wout(c->who, "Don't have any %s.", box_code(i1));
      return FALSE;
    }

  if (has_item(c->who, i2) < 1)
    {
      wout(c->who, "Don't have any %s.", box_code(i2));
      return FALSE;
    }

  if (i1 == i2 && has_item(c->who, i1) < 2)
    {
      wout(c->who, "Don't have two %s.", box_code(i1));
      return FALSE;
    }

  /*
   *  Thu Oct 10 12:15:09 1996 -- Scott Turner
   *
   *  May need a holy symbol & piety.
   *
   */
  if (!normal_union(i1, i2)) {
    if (!has_holy_symbol(c->who)) {
      wout(c->who, "A holy symbol is required for that breeding.");
      return FALSE;
    };

    if (!has_piety(c->who, skill_piety(c->use_skill))) {
      wout(c->who, "You don't have the piety required to use that prayer.");
      return FALSE;
    };
  };

  /* 
   *  Hack to fold experience_use_speedup into this skill
   *  if they use BREED instead of USE xxxx
   */

  c->wait = 7;
  exp = max(has_skill(c->who, sk_breed_beasts) - 1, 0);
  if (exp)
    c->wait--;

  return TRUE;
}