char * deserted_s(int n) { static char deserted[80]; int pl = player(n); deserted[0] = 0; /* * Wed Apr 14 10:50:34 1999 -- Scott Turner * * Print "deserted" if a noble belongs to an NPC faction * but has a body_old_lord. * */ if (is_real_npc(pl) && body_old_lord(n)) { sprintf(deserted, ", deserted"); }; return deserted; };
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; };
/* * 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; }