Exemplo n.º 1
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;
}
Exemplo n.º 2
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);
    }
  }
Exemplo n.º 3
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;
};