Add earring type

master
kts of kettek (nyaa) 2018-06-22 16:21:16 -07:00
parent d432052f3e
commit ba9542286a
9 changed files with 27 additions and 6 deletions

View File

@ -217,6 +217,7 @@ static const typedata item_types[] = {
{ SYMPTOM, "symptom", "symptoms", 0, 0 },
{ BUILDER, "item builder", "item builders", 0, 0 },
{ MATERIAL, "building material", "building materials", 0, 0 },
{ EARRING, "earring", "earrings", SK_JEWELER, 0 },
};
/** Number of items in ::item_types array. */
@ -302,6 +303,7 @@ int calc_item_power(const object *op, int flag) {
|| (op->type == HELMET)
|| (op->type == SHIELD)
|| (op->type == RING)
|| (op->type == EARRING)
|| (op->type == BOOTS)
|| (op->type == GLOVES)
|| (op->type == AMULET)
@ -595,6 +597,7 @@ void query_short_name(const object *op, char *buf, size_t size) {
case SKILL:
case AMULET:
case RING:
case EARRING:
if (!op->title) {
/* If ring has a title, full description isn't so useful */
char desc[VERY_BIG_BUF];
@ -691,6 +694,7 @@ void query_name(const object *op, char *buf, size_t size) {
case HELMET:
case SHIELD:
case RING:
case EARRING:
case BOOTS:
case GLOVES:
case AMULET:
@ -798,6 +802,7 @@ void query_base_name(const object *op, int plural, char *buf, size_t size) {
case SKILL:
case AMULET:
case RING:
case EARRING:
if (!op->title) {
/* If ring has a title, full description isn't so useful */
char s[MAX_BUF];
@ -896,6 +901,8 @@ void describe_monster(const object *op, char *retbuf, size_t size) {
snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wear armour)");
if (QUERY_FLAG(op, FLAG_USE_RING))
snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wear ring)");
if (QUERY_FLAG(op, FLAG_USE_EARRING))
snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wear earring)");
if (QUERY_FLAG(op, FLAG_USE_SCROLL))
snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(read scroll)");
if (QUERY_FLAG(op, FLAG_USE_RANGE))
@ -1111,6 +1118,7 @@ void describe_item(const object *op, const object *owner, char *retbuf, size_t s
case SKILL:
case RING:
case EARRING:
case AMULET:
if (op->item_power) {
snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(item_power %+d)", op->item_power);
@ -1159,6 +1167,7 @@ void describe_item(const object *op, const object *owner, char *retbuf, size_t s
case WEAPON:
case SKILL:
case RING:
case EARRING:
case AMULET:
case ARMOUR:
case BRACERS:
@ -1324,7 +1333,7 @@ int is_magical(const object *op) {
/* Handle rings and amulets specially. If they change any of these
* values, it means they are magical.
*/
if ((op->type == AMULET || op->type == RING)
if ((op->type == AMULET || op->type == RING || op->type == EARRING)
&& (op->stats.ac || op->stats.food || op->stats.exp || op->stats.dam || op->stats.wc || op->stats.sp || op->stats.hp || op->stats.luck))
return 1;
@ -1402,6 +1411,7 @@ int is_magical(const object *op) {
int need_identify(const object *op) {
switch (op->type) {
case RING:
case EARRING:
case WAND:
case ROD:
case HORN:

View File

@ -1059,7 +1059,7 @@ void fix_object(object *op) {
(tmp->type == AMULET) || (tmp->type == GIRDLE) ||
(tmp->type == BRACERS) || (tmp->type == CLOAK) ||
(tmp->type == DISEASE) || (tmp->type == FORCE) ||
(tmp->type == SKILL)) {
(tmp->type == SKILL) || (tmp->type == EARRING)) {
op->contr->digestion += tmp->stats.food;
op->contr->gen_hp += tmp->stats.hp;
op->contr->gen_sp += tmp->stats.sp;
@ -1198,6 +1198,7 @@ void fix_object(object *op) {
if (settings.spell_encumbrance == TRUE && op->type==PLAYER)
op->contr->encumbrance+=(int)tmp->weight/2000;
case RING:
case EARRING:
case AMULET:
case GIRDLE:
case HELMET:

View File

@ -915,6 +915,7 @@ A .+
^can_use_armour{S} SET_OR_CLEAR_FLAG(op, FLAG_USE_ARMOUR, IVAL);
^can_use_weapon{S} SET_OR_CLEAR_FLAG(op, FLAG_USE_WEAPON, IVAL);
^can_use_ring{S} SET_OR_CLEAR_FLAG(op, FLAG_USE_RING, IVAL);
^can_use_earring{S} SET_OR_CLEAR_FLAG(op, FLAG_USE_EARRING, IVAL);
^has_ready_bow{S} SET_OR_CLEAR_FLAG(op, FLAG_READY_BOW, IVAL);
^xrays{S} SET_OR_CLEAR_FLAG(op, FLAG_XRAYS, IVAL);
^is_floor{S} SET_OR_CLEAR_FLAG(op, FLAG_IS_FLOOR, IVAL);
@ -1258,7 +1259,7 @@ static const char *const flag_names[NUM_FLAGS+1] = {
"is_dust", "no_steal", "one_hit", NULL, "berserk", "neutral", /* 100 */
"no_attack", "no_damage", NULL, NULL, "activate_on_push",
"activate_on_release", "is_water", "use_content_on_gen", NULL, "is_buildable", /* 110 */
NULL, "blessed", "known_blessed"
NULL, "blessed", "known_blessed", "can_use_earring"
};

View File

@ -221,6 +221,7 @@ static const arttypename art_name_array[] = {
{ "Gloves", GLOVES },
{ "Gridle", GIRDLE },
{ "Ring", RING },
{ "Earring", EARRING },
{ "Horn", HORN },
{ "Missile Weapon", BOW },
{ "Missile", ARROW },

View File

@ -1210,6 +1210,7 @@ void fix_generated_item(object *op, object *creator, int difficulty, int max_mag
if (op->arch == amulet_arch)
op->value *= 5; /* Since it's not just decoration */
case RING:
case EARRING:
if (op->arch == NULL) {
remove_ob(op);
free_object(op);
@ -1223,7 +1224,7 @@ void fix_generated_item(object *op, object *creator, int difficulty, int max_mag
if (!(flags&GT_ONLY_GOOD) && !(RANDOM()%3))
SET_FLAG(op, FLAG_CURSED);
set_ring_bonus(op, QUERY_FLAG(op, FLAG_CURSED) ? -DICE2 : DICE2);
if (op->type != RING) /* Amulets have only one ability */
if (op->type != RING || op->type != EARRING) /* Amulets have only one ability */
break;
if (!(RANDOM()%4)) {
int d = (RANDOM()%2 || QUERY_FLAG(op, FLAG_CURSED)) ? -DICE2 : DICE2;

View File

@ -723,6 +723,7 @@ static int unapply_special(object *who, object *op, int aflags) {
case HELMET:
case SHIELD:
case RING:
case EARRING:
case BOOTS:
case GLOVES:
case AMULET:
@ -1050,6 +1051,8 @@ int can_apply_object(object *who, object *op) {
retval |= CAN_APPLY_RESTRICTION;
if (op->type == RING && !QUERY_FLAG(who, FLAG_USE_RING))
retval |= CAN_APPLY_RESTRICTION;
if (op->type == EARRING && !QUERY_FLAG(who, FLAG_USE_EARRING))
retval |= CAN_APPLY_RESTRICTION;
if (op->type == BOW && !QUERY_FLAG(who, FLAG_USE_BOW))
retval |= CAN_APPLY_RESTRICTION;
}
@ -1365,6 +1368,7 @@ int apply_special(object *who, object *op, int aflags) {
case BRACERS:
case CLOAK:
case RING:
case EARRING:
case AMULET:
SET_FLAG(op, FLAG_APPLIED);
if (!(aflags&AP_NOPRINT))

View File

@ -335,6 +335,7 @@ static player *get_player(player *p) {
strncpy(p->title, op->arch->clone.name, sizeof(p->title)-1);
p->title[sizeof(p->title)-1] = '\0';
LOG(llevError, "Trying to load race from: %s \n", op->arch->clone.name);
op->race = add_string(op->arch->clone.race);
CLEAR_FLAG(op, FLAG_READY_SKILL);
@ -1609,7 +1610,7 @@ int check_pick(object *op) {
/* rings & amulets - talismans seems to be typed AMULET */
if (op->contr->mode&PU_JEWELS)
if (tmp->type == RING || tmp->type == AMULET) {
if (tmp->type == RING || tmp->type == EARRING || tmp->type == AMULET) {
pick_up(op, tmp);
if (0)
fprintf(stderr, "JEWELS\n");

View File

@ -372,7 +372,7 @@ static void polymorph_item(object *who, object *op, int level) {
/* We don't want rings to keep sustenance/hungry status. There are probably
* other cases too that should be checked.
*/
if (charges && op->type != RING && op->type != FOOD)
if (charges && op->type != RING && op->type != EARRING && op->type != FOOD)
op->stats.food = charges;
new_ob->x = op->x;

View File

@ -146,6 +146,7 @@ static const flag_definition flags[] = {
{ "can_use_armour", "FLAG_USE_ARMOUR" },
{ "can_use_weapon", "FLAG_USE_WEAPON" },
{ "can_use_ring", "FLAG_USE_RING" },
{ "can_use_earring", "FLAG_USE_EARRING" },
{ "has_ready_range", "FLAG_READY_RANGE" },
{ "has_ready_bow", "FLAG_READY_BOW" },
{ "xrays", "FLAG_XRAYS" },
@ -271,6 +272,7 @@ static type_name type_names[] = {
{ "SHOP_FLOOR", SHOP_FLOOR },
{ "SHOP_MAT", SHOP_MAT },
{ "RING", RING },
{ "EARRING", EARRING },
{ "FLOOR", FLOOR },
{ "FLESH", FLESH },
{ "INORGANIC", INORGANIC },