Fix bad logic for getting ring image

master
kts of kettek (nyaa) 2019-08-13 16:46:03 -07:00
parent 8dd6d34357
commit b2d044ce6a
3 changed files with 6 additions and 3 deletions

View File

@ -284,6 +284,7 @@ void init_globals(void) {
nrofartifacts = 0; nrofartifacts = 0;
nrofallowedstr = 0; nrofallowedstr = 0;
ring_arch = NULL; ring_arch = NULL;
earring_arch = NULL;
amulet_arch = NULL; amulet_arch = NULL;
staff_arch = NULL; staff_arch = NULL;
undead_name = add_string("undead"); undead_name = add_string("undead");

View File

@ -69,6 +69,8 @@ void init_archetype_pointers(void) {
warn_archetypes = 1; warn_archetypes = 1;
if (ring_arch == NULL) if (ring_arch == NULL)
ring_arch = find_archetype("ring"); ring_arch = find_archetype("ring");
if (earring_arch == NULL)
earring_arch = find_archetype("earring");
if (amulet_arch == NULL) if (amulet_arch == NULL)
amulet_arch = find_archetype("amulet"); amulet_arch = find_archetype("amulet");
if (staff_arch == NULL) if (staff_arch == NULL)
@ -1217,14 +1219,14 @@ void fix_generated_item(object *op, object *creator, int difficulty, int max_mag
op = NULL; op = NULL;
break; break;
} }
if (op->arch != ring_arch && op->arch != amulet_arch) if (op->arch != earring_arch && op->arch != ring_arch && op->arch != amulet_arch)
/* It's a special artifact!*/ /* It's a special artifact!*/
break; break;
if (!(flags&GT_ONLY_GOOD) && !(RANDOM()%3)) if (!(flags&GT_ONLY_GOOD) && !(RANDOM()%3))
SET_FLAG(op, FLAG_CURSED); SET_FLAG(op, FLAG_CURSED);
set_ring_bonus(op, QUERY_FLAG(op, FLAG_CURSED) ? -DICE2 : DICE2); set_ring_bonus(op, QUERY_FLAG(op, FLAG_CURSED) ? -DICE2 : DICE2);
if (op->type != RING || op->type != EARRING) /* Amulets have only one ability */ if (op->type == AMULET) /* Amulets have only one ability */
break; break;
if (!(RANDOM()%4)) { if (!(RANDOM()%4)) {
int d = (RANDOM()%2 || QUERY_FLAG(op, FLAG_CURSED)) ? -DICE2 : DICE2; int d = (RANDOM()%2 || QUERY_FLAG(op, FLAG_CURSED)) ? -DICE2 : DICE2;

View File

@ -235,7 +235,7 @@ EXTERN long ob_count;
/* /*
* Used in treasure.c * Used in treasure.c
*/ */
EXTERN archetype *ring_arch, *amulet_arch, *staff_arch, *crown_arch; EXTERN archetype *ring_arch, *earring_arch, *amulet_arch, *staff_arch, *crown_arch;
EXTERN const char *undead_name; /* Used in hit_player() in main.c */ EXTERN const char *undead_name; /* Used in hit_player() in main.c */
EXTERN Animations *animations; EXTERN Animations *animations;