/** * Copy artifact data to a normal object, and set various slightly hacky * globals. */ static void copy_artifact_data(object_type *o_ptr, const artifact_type *a_ptr) { /* Extract the other fields */ o_ptr->pval = a_ptr->pval; o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; o_ptr->to_a = a_ptr->to_a; o_ptr->to_h = a_ptr->to_h; o_ptr->to_d = a_ptr->to_d; o_ptr->weight = a_ptr->weight; /* Hack -- extract the "cursed" flags */ if (cursed_p(a_ptr)) { bitflag curse_flags[OF_SIZE]; of_copy(curse_flags, a_ptr->flags); flags_mask(curse_flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_union(o_ptr->flags, curse_flags); } /* Mega-Hack -- increase the level rating * - a sizeable increase for any artifact (c.f. up to 30 for ego items) * - a bigger increase for more powerful artifacts */ rating += 30; rating += object_power(o_ptr, FALSE, NULL, TRUE) / 25; /* Set the good item flag */ good_item_flag = TRUE; /* Cheat -- peek at the item */ if (OPT(cheat_peek)) object_mention(o_ptr); }
/** * Copy artifact data to a normal object, and set various slightly hacky * globals. */ static void copy_artifact_data(object_type *o_ptr, const artifact_type *a_ptr) { /* Extract the other fields */ o_ptr->pval = a_ptr->pval; o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; o_ptr->to_a = a_ptr->to_a; o_ptr->to_h = a_ptr->to_h; o_ptr->to_d = a_ptr->to_d; o_ptr->weight = a_ptr->weight; /* Hack -- extract the "cursed" flags */ if (cursed_p(a_ptr)) { bitflag curse_flags[OF_SIZE]; of_copy(curse_flags, a_ptr->flags); flags_mask(curse_flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_union(o_ptr->flags, curse_flags); } /* Mega-Hack -- increase the rating */ rating += 10; /* Mega-Hack -- increase the rating again */ if (a_ptr->cost > 50000L) rating += 10; /* Set the good item flag */ good_item_flag = TRUE; /* Cheat -- peek at the item */ if (OPT(cheat_peek)) object_mention(o_ptr); }
/* * Create the artifact with the specified number */ static void wiz_create_artifact(int a_idx) { object_type *i_ptr; object_type object_type_body; int k_idx; artifact_type *a_ptr = &a_info[a_idx]; /* Ignore "empty" artifacts */ if (!a_ptr->name) return; /* Get local object */ i_ptr = &object_type_body; /* Wipe the object */ object_wipe(i_ptr); /* Acquire the "kind" index */ k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); /* Oops */ if (!k_idx) return; /* Create the artifact */ object_prep(i_ptr, &k_info[k_idx], a_ptr->alloc_min, RANDOMISE); /* Save the name */ i_ptr->name1 = a_idx; /* Extract the fields */ i_ptr->pval = a_ptr->pval; i_ptr->ac = a_ptr->ac; i_ptr->dd = a_ptr->dd; i_ptr->ds = a_ptr->ds; i_ptr->to_a = a_ptr->to_a; i_ptr->to_h = a_ptr->to_h; i_ptr->to_d = a_ptr->to_d; i_ptr->weight = a_ptr->weight; /* Hack -- extract the "cursed" flags */ if (cursed_p(a_ptr)) { bitflag curse_flags[OF_SIZE]; of_copy(curse_flags, a_ptr->flags); flags_mask(curse_flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_union(i_ptr->flags, curse_flags); } /* Mark that the artifact has been created. */ a_ptr->created = TRUE; /* Mark as cheat */ i_ptr->origin = ORIGIN_CHEAT; /* Drop the artifact from heaven */ drop_near(i_ptr, 0, p_ptr->py, p_ptr->px, TRUE); /* All done */ msg_print("Allocated."); }
/** * \returns whether the object is known to be cursed */ bool object_is_known_cursed(const object_type *o_ptr) { bitflag f[OF_SIZE]; object_flags_known(o_ptr, f); /* Know whatever curse flags there are to know */ flags_mask(f, OF_SIZE, OF_CURSE_MASK, FLAG_END); return !of_is_empty(f); }
/** * Notice curses on an object. * * \param o_ptr is the object to notice curses on */ bool object_notice_curses(object_type *o_ptr) { bitflag f[OF_SIZE]; object_flags(o_ptr, f); /* Know whatever curse flags there are to know */ flags_mask(f, OF_SIZE, OF_CURSE_MASK, FLAG_END); /* give knowledge of which curses are present */ object_notice_flags(o_ptr, f); object_check_for_ident(o_ptr); p_ptr->notice |= PN_SQUELCH; return !of_is_empty(f); }
/** * Use various selection criteria (set elsewhere) to restrict monster * generation. * * This function is capable of selecting monsters by: * - racial symbol (may be any of the characters allowed) * - symbol color (may be any of up to four colors). * - racial flag(s) (monster may have any allowed flag) * - breath flag(s) (monster must have exactly the flags specified) * * Uniques may be forbidden, or allowed on rare occasions. * * Some situations (like the elemental war themed level) require special * processing; this is done in helper functions called from this one. */ static bool mon_select(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; bool ok = FALSE; bitflag mon_breath[RSF_SIZE]; /* Require correct breath attack */ rsf_copy(mon_breath, r_ptr->spell_flags); flags_mask(mon_breath, RSF_SIZE, RSF_BREATH_MASK, FLAG_END); /* Special case: Elemental war themed level. */ if (p_ptr->themed_level == THEME_ELEMENTAL) { return (vault_aux_elemental(r_idx)); } /* Special case: Estolad themed level. */ if (p_ptr->themed_level == THEME_ESTOLAD) { if (!(rf_has(r_ptr->flags, RF_RACIAL))) return (FALSE); } /* Require that the monster symbol be correct. */ if (d_char_req[0] != '\0') { if (strchr(d_char_req, r_ptr->d_char) == 0) return (FALSE); } /* Require correct racial type. */ if (racial_flag_mask) { if (!(rf_has(r_ptr->flags, racial_flag_mask))) return (FALSE); /* Hack -- no invisible undead until deep. */ if ((p_ptr->danger < 40) && (rf_has(r_ptr->flags, RF_UNDEAD)) && (rf_has(r_ptr->flags, RF_INVISIBLE))) return (FALSE); } /* Require that monster breaths be exactly those specified. */ /* Exception for winged dragons */ if (!rsf_is_empty(breath_flag_mask)) { /* 'd'ragons */ if (!rsf_is_equal(mon_breath, breath_flag_mask) && (r_ptr->d_char != 'D')) return (FALSE); /* Winged 'D'ragons */ if (r_ptr->d_char == 'D') { if (!rsf_is_subset(mon_breath, breath_flag_mask)) return (FALSE); /* Hack - this deals with all current Ds that need excluding */ if (rsf_has(r_ptr->flags, RSF_BRTH_SOUND)) return (FALSE); } } /* Require that the monster color be correct. */ if (d_attr_req[0]) { /* Check all allowed colors, if given. */ if ((d_attr_req[0]) && (r_ptr->d_attr == d_attr_req[0])) ok = TRUE; if ((d_attr_req[1]) && (r_ptr->d_attr == d_attr_req[1])) ok = TRUE; if ((d_attr_req[2]) && (r_ptr->d_attr == d_attr_req[2])) ok = TRUE; if ((d_attr_req[3]) && (r_ptr->d_attr == d_attr_req[3])) ok = TRUE; /* Hack -- No multihued dragons allowed in the arcane dragon pit. */ if ((strchr(d_char_req, 'd') || strchr(d_char_req, 'D')) && (d_attr_req[0] == TERM_VIOLET) && (rf_has(r_ptr->flags, RSF_BRTH_ACID) || rf_has(r_ptr->flags, RSF_BRTH_ELEC) || rf_has(r_ptr->flags, RSF_BRTH_FIRE) || rf_has(r_ptr->flags, RSF_BRTH_COLD) || rf_has(r_ptr->flags, RSF_BRTH_POIS))) { return (FALSE); } /* Doesn't match any of the given colors? Not good. */ if (!ok) return (FALSE); } /* Usually decline unique monsters. */ if (rf_has(r_ptr->flags, RF_UNIQUE)) { if (!allow_unique) return (FALSE); else if (randint0(5) != 0) return (FALSE); } /* Okay */ return (TRUE); }
/** * Complete object creation by applying magic to it. * * Magic includes rolling for random bonuses, applying flags to ego-items, * charging charged items, fuelling lights, and trapping chests. * * The `good` argument forces the item to be at least `good`, and the `great` * argument does likewise. Setting `allow_artifacts` to TRUE allows artifacts * to be created here. * * If `good` or `great` are not set, then the `lev` argument controls the * quality of item. See the function itself for the specifics of the * calculations involved. */ void apply_magic(object_type *o_ptr, int lev, bool allow_artifacts, bool good, bool great) { int power = 0; /*u32b xtra = 0;*/ /*bool new = FALSE;*/ /* Chance of being `good` and `great` */ int good_chance = (lev+2) * 3; int great_chance = MIN(lev/4 + lev, 50); /* Limit depth */ if (lev > MAX_DEPTH - 1) lev = MAX_DEPTH - 1; /* Roll for "good" */ if (good || (randint0(100) < good_chance)) { /* Assume "good" */ power = 1; /* Roll for "great" */ if (great || (randint0(100) < great_chance)) power = 2; } /* Roll for "cursed" */ else if (randint0(100) < good_chance) { /* Assume "cursed" */ power = -1; /* Roll for "broken" */ if (randint0(100) < great_chance) power = -2; } /* Roll for artifact creation */ if (allow_artifacts) { int i; int rolls = 0; /* Get one roll if excellent */ if (power >= 2) rolls = 1; /* Get four rolls if forced great */ if (great) rolls = 4; /* Roll for artifacts if allowed */ for (i = 0; i < rolls; i++) { if (make_artifact(o_ptr)) return; } } /* Apply magic */ switch (o_ptr->tval) { case TV_DIGGING: case TV_HAFTED: case TV_POLEARM: case TV_SWORD: case TV_BOW: case TV_SHOT: case TV_ARROW: case TV_BOLT: { if (power == 2 || power == -2) { int ego_power; ego_power = make_ego_item(o_ptr, lev, (bool)(power > 0)); if (ego_power) power = ego_power; } if (power) a_m_aux_1(o_ptr, lev, power); break; } case TV_DRAG_ARMOR: case TV_HARD_ARMOR: case TV_SOFT_ARMOR: case TV_SHIELD: case TV_HELM: case TV_CROWN: case TV_CLOAK: case TV_GLOVES: case TV_BOOTS: { if (power == 2 || power == -2) { int ego_power; ego_power = make_ego_item(o_ptr, lev, (bool)(power > 0)); if (ego_power) power = ego_power; } if (power) a_m_aux_2(o_ptr, lev, power); break; } case TV_RING: case TV_AMULET: { if (!power && (randint0(100) < 50)) power = -1; a_m_aux_3(o_ptr, lev, power); break; } case TV_LIGHT: { if (power == 2 || power == -2) make_ego_item(o_ptr, lev, (bool)(power > 0)); /* Fuel it */ a_m_aux_4(o_ptr, lev, power); break; } default: { a_m_aux_4(o_ptr, lev, power); break; } } /* Hack -- analyze ego-items */ if (o_ptr->name2) { ego_item_type *e_ptr = &e_info[o_ptr->name2]; bitflag flags[OF_SIZE]; object_flags(o_ptr, flags); /* Extra powers */ if (e_ptr->xtra == OBJECT_XTRA_TYPE_SUSTAIN) of_on(o_ptr->flags, get_new_attr(flags, ego_sustains, N_ELEMENTS(ego_sustains))); else if (e_ptr->xtra == OBJECT_XTRA_TYPE_RESIST) of_on(o_ptr->flags, get_new_attr(flags, ego_resists, N_ELEMENTS(ego_resists))); else if (e_ptr->xtra == OBJECT_XTRA_TYPE_POWER) of_on(o_ptr->flags, get_new_attr(flags, ego_powers, N_ELEMENTS(ego_powers))); /* Hack -- acquire "cursed" flags */ if (cursed_p(e_ptr)) { bitflag curse_flags[OF_SIZE]; of_copy(curse_flags, e_ptr->flags); flags_mask(curse_flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_union(o_ptr->flags, curse_flags); } /* Hack -- apply extra penalties if needed */ if (cursed_p(o_ptr)) { /* Apply extra ego bonuses */ o_ptr->to_h -= randcalc(e_ptr->to_h, lev, RANDOMISE); o_ptr->to_d -= randcalc(e_ptr->to_d, lev, RANDOMISE); o_ptr->to_a -= randcalc(e_ptr->to_a, lev, RANDOMISE); /* Apply ego pval */ o_ptr->pval -= randcalc(e_ptr->pval, lev, RANDOMISE); /* Apply minimums */ if (o_ptr->to_h > -1 * e_ptr->min_to_h) o_ptr->to_h = -1 * e_ptr->min_to_h; if (o_ptr->to_d > -1 * e_ptr->min_to_d) o_ptr->to_d = -1 * e_ptr->min_to_d; if (o_ptr->to_a > -1 * e_ptr->min_to_a) o_ptr->to_a = -1 * e_ptr->min_to_a; if (o_ptr->pval > -1 * e_ptr->min_pval) o_ptr->pval = -1 * e_ptr->min_pval; } /* Hack -- apply extra bonuses if needed */ else { /* Apply extra ego bonuses */ o_ptr->to_h += randcalc(e_ptr->to_h, lev, RANDOMISE); o_ptr->to_d += randcalc(e_ptr->to_d, lev, RANDOMISE); o_ptr->to_a += randcalc(e_ptr->to_a, lev, RANDOMISE); /* Apply ego pval */ o_ptr->pval += randcalc(e_ptr->pval, lev, RANDOMISE); /* Apply minimums */ if (o_ptr->to_h < e_ptr->min_to_h) o_ptr->to_h = e_ptr->min_to_h; if (o_ptr->to_d < e_ptr->min_to_d) o_ptr->to_d = e_ptr->min_to_d; if (o_ptr->to_a < e_ptr->min_to_a) o_ptr->to_a = e_ptr->min_to_a; if (o_ptr->pval < e_ptr->min_pval) o_ptr->pval = e_ptr->min_pval; } /* Hack -- apply rating bonus */ rating += e_ptr->rating; /* Cheat -- describe the item */ if (OPT(cheat_peek)) object_mention(o_ptr); /* Done */ return; } /* Examine real objects */ if (o_ptr->k_idx) { object_kind *k_ptr = &k_info[o_ptr->k_idx]; /* Hack -- acquire "cursed" flag */ if (cursed_p(k_ptr)) { bitflag curse_flags[OF_SIZE]; of_copy(curse_flags, k_ptr->flags); flags_mask(curse_flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_union(o_ptr->flags, curse_flags); } } }
/* XXX Eddie should messages be adhoc all over the place? perhaps the main * loop should check for change in inventory/wieldeds and all messages be * printed from one place */ void object_notice_on_wield(object_type *o_ptr) { bitflag f[OF_SIZE], obvious_mask[OF_SIZE]; bool obvious = FALSE; const slay_t *s_ptr; flags_init(obvious_mask, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); /* Save time of wield for later */ object_last_wield = turn; /* Only deal with un-ID'd items */ if (object_is_known(o_ptr)) return; /* Wear it */ object_flavor_tried(o_ptr); if (object_add_ident_flags(o_ptr, IDENT_WORN)) object_check_for_ident(o_ptr); if (obj_is_light(o_ptr) && ego_item_p(o_ptr)) object_notice_ego(o_ptr); if (object_flavor_is_aware(o_ptr) && easy_know(o_ptr)) { object_notice_everything(o_ptr); return; } /* Automatically sense artifacts upon wield */ object_sense_artifact(o_ptr); /* Note artifacts when found */ if (artifact_p(o_ptr)) history_add_artifact(o_ptr->name1, object_is_known(o_ptr), TRUE); /* special case FA, needed at least for mages wielding gloves */ if (object_FA_would_be_obvious(o_ptr)) of_on(obvious_mask, OF_FREE_ACT); /* Learn about obvious flags */ of_union(o_ptr->known_flags, obvious_mask); /* Extract the flags */ object_flags(o_ptr, f); /* Find obvious things (disregarding curses) */ flags_clear(obvious_mask, OF_SIZE, OF_CURSE_MASK, FLAG_END); if (of_is_inter(f, obvious_mask)) obvious = TRUE; flags_init(obvious_mask, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); /* XXX Eddie should these next NOT call object_check_for_ident due to worries about repairing? */ /* XXX Eddie this is a small hack, but jewelry with anything noticeable really is obvious */ /* XXX Eddie learn =soulkeeping vs =bodykeeping when notice sustain_str */ if (object_is_jewelry(o_ptr)) { /* Learn the flavor of jewelry with obvious flags */ if (EASY_LEARN && obvious) object_flavor_aware(o_ptr); /* Learn all flags on any aware non-artifact jewelry */ if (object_flavor_is_aware(o_ptr) && !artifact_p(o_ptr)) object_know_all_flags(o_ptr); } object_check_for_ident(o_ptr); if (!obvious) return; /* Messages */ for (s_ptr = slay_table; s_ptr->slay_flag; s_ptr++) { if (of_has(f, s_ptr->slay_flag) && s_ptr->brand) { char o_name[40]; object_desc(o_name, sizeof(o_name), o_ptr, ODESC_BASE); msg_format("Your %s %s!", o_name, s_ptr->active_verb); } } /* XXX Eddie need to add stealth here, also need to assert/double-check everything is covered */ if (of_has(f, OF_STR)) msg_format("You feel %s!", o_ptr->pval > 0 ? "stronger" : "weaker"); if (of_has(f, OF_INT)) msg_format("You feel %s!", o_ptr->pval > 0 ? "smarter" : "more stupid"); if (of_has(f, OF_WIS)) msg_format("You feel %s!", o_ptr->pval > 0 ? "wiser" : "more naive"); if (of_has(f, OF_DEX)) msg_format("You feel %s!", o_ptr->pval > 0 ? "more dextrous" : "clumsier"); if (of_has(f, OF_CON)) msg_format("You feel %s!", o_ptr->pval > 0 ? "healthier" : "sicklier"); if (of_has(f, OF_CHR)) msg_format("You feel %s!", o_ptr->pval > 0 ? "cuter" : "uglier"); if (of_has(f, OF_SPEED)) msg_format("You feel strangely %s.", o_ptr->pval > 0 ? "quick" : "sluggish"); if (flags_test(f, OF_SIZE, OF_BLOWS, OF_SHOTS, FLAG_END)) msg_format("Your hands %s", o_ptr->pval > 0 ? "tingle!" : "ache."); if (of_has(f, OF_INFRA)) msg_format("Your eyes tingle."); if (of_has(f, OF_LIGHT)) msg_print("It glows!"); if (of_has(f, OF_TELEPATHY)) msg_print("Your mind feels strangely sharper!"); /* WARNING -- masking f by obvious mask -- this should be at the end of this function */ flags_mask(f, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); /* learn the ego on any obvious brand or slay */ if (EASY_LEARN && ego_item_p(o_ptr) && obvious && flags_test(f, OF_SIZE, OF_ALL_SLAY_MASK, FLAG_END)) object_notice_ego(o_ptr); /* Remember the flags */ object_notice_sensing(o_ptr); /* XXX Eddie should we check_for_ident here? */ }
/* * Given an object, return a short identifier which gives some idea of what * the item is. */ obj_pseudo_t object_pseudo(const object_type *o_ptr) { object_kind *k_ptr = &k_info[o_ptr->k_idx]; bitflag flags[OF_SIZE]; /* Get the known and obvious flags on the object, * not including curses or properties of the kind */ object_flags_known(o_ptr, flags); /* MEGA-hack : there needs to be a table of what is obvious in each slot perhaps for each class */ /* FA on gloves is obvious to mage casters */ if (object_FA_would_be_obvious(o_ptr)) flags_mask(flags, OF_SIZE, OF_OBVIOUS_MASK, OF_FREE_ACT, FLAG_END); else flags_mask(flags, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); flags_clear(flags, OF_SIZE, OF_CURSE_MASK, FLAG_END); of_diff(flags, k_ptr->flags); if (o_ptr->ident & IDENT_INDESTRUCT) return INSCRIP_SPECIAL; if ((object_was_sensed(o_ptr) || object_was_worn(o_ptr)) && artifact_p(o_ptr)) return INSCRIP_SPECIAL; /* jewelry does not pseudo */ if (object_is_jewelry(o_ptr)) return INSCRIP_NULL; /* XXX Eddie should also check for flags with pvals where the pval exceeds * the base pval for things like picks of digging, though for now acid brand gets those */ if (!of_is_empty(flags)) return INSCRIP_SPLENDID; if (!object_is_known(o_ptr) && !object_was_sensed(o_ptr)) return INSCRIP_NULL; if (ego_item_p(o_ptr)) { /* uncursed bad egos are not excellent */ if (flags_test(e_info[o_ptr->name2].flags, OF_SIZE, OF_CURSE_MASK, FLAG_END)) return INSCRIP_STRANGE; /* XXX Eddie need something worse */ else return INSCRIP_EXCELLENT; } if (o_ptr->to_a == randcalc(k_ptr->to_a, 0, MINIMISE) && o_ptr->to_h == randcalc(k_ptr->to_h, 0, MINIMISE) && o_ptr->to_d == randcalc(k_ptr->to_d, 0, MINIMISE)) return INSCRIP_AVERAGE; if (o_ptr->to_a >= randcalc(k_ptr->to_a, 0, MINIMISE) && o_ptr->to_h >= randcalc(k_ptr->to_h, 0, MINIMISE) && o_ptr->to_d >= randcalc(k_ptr->to_d, 0, MINIMISE)) return INSCRIP_MAGICAL; if (o_ptr->to_a <= randcalc(k_ptr->to_a, 0, MINIMISE) && o_ptr->to_h <= randcalc(k_ptr->to_h, 0, MINIMISE) && o_ptr->to_d <= randcalc(k_ptr->to_d, 0, MINIMISE)) return INSCRIP_MAGICAL; return INSCRIP_STRANGE; }
/* * Calculate the rating for a given slay combination */ static s32b slay_power(const object_type *o_ptr, int verbose, ang_file* log_file, const bitflag flags[OF_SIZE]) { bitflag s_index[OF_SIZE]; s32b sv = 0; int i; int mult; const slay_t *s_ptr; /* Combine the slay bytes into an index value */ of_copy(s_index, flags); flags_mask(s_index, OF_SIZE, OF_ALL_SLAY_MASK, FLAG_END); /* Look in the cache to see if we know this one yet */ for (i = 0; !of_is_empty(slay_cache[i].flags); i++) { if (of_is_equal(s_index, slay_cache[i].flags)) break; } sv = slay_cache[i].value; /* If it's cached (or there are no slays), return the value */ if (sv) { LOG_PRINT("Slay cache hit\n"); return sv; } /* * Otherwise we need to calculate the expected average multiplier * for this combination (multiplied by the total number of * monsters, which we'll divide out later). */ for (i = 0; i < z_info->r_max; i++) { monster_race *r_ptr = &r_info[i]; mult = 1; /* * Do the following in ascending order so that the best * multiple is retained */ for (s_ptr = slay_table; s_ptr->slay_flag; s_ptr++) { if (!of_has(flags, s_ptr->slay_flag)) continue; if (rf_has(r_ptr->flags, s_ptr->monster_flag) || (s_ptr->resist_flag && !rf_has(r_ptr->flags, s_ptr->resist_flag))) { mult = s_ptr->mult; } } /* Add the multiple to sv */ sv += mult * r_ptr->power; } /* * To get the expected damage for this weapon, multiply the * average damage from base dice by sv, and divide by the * total number of monsters. */ if (verbose) { /* Write info about the slay combination and multiplier */ file_putf(log_file,"Slay multiplier for:"); if (of_has(flags, OF_SLAY_EVIL)) file_putf(log_file,"Evl "); if (of_has(flags, OF_KILL_DRAGON)) file_putf(log_file,"XDr "); if (of_has(flags, OF_KILL_DEMON)) file_putf(log_file,"XDm "); if (of_has(flags, OF_KILL_UNDEAD)) file_putf(log_file,"XUn "); if (of_has(flags, OF_SLAY_ANIMAL)) file_putf(log_file,"Ani "); if (of_has(flags, OF_SLAY_UNDEAD)) file_putf(log_file,"Und "); if (of_has(flags, OF_SLAY_DRAGON)) file_putf(log_file,"Drg "); if (of_has(flags, OF_SLAY_DEMON)) file_putf(log_file,"Dmn "); if (of_has(flags, OF_SLAY_TROLL)) file_putf(log_file,"Tro "); if (of_has(flags, OF_SLAY_ORC)) file_putf(log_file,"Orc "); if (of_has(flags, OF_SLAY_GIANT)) file_putf(log_file,"Gia "); if (of_has(flags, OF_BRAND_ACID)) file_putf(log_file,"Acd "); if (of_has(flags, OF_BRAND_ELEC)) file_putf(log_file,"Elc "); if (of_has(flags, OF_BRAND_FIRE)) file_putf(log_file,"Fir "); if (of_has(flags, OF_BRAND_COLD)) file_putf(log_file,"Cld "); if (of_has(flags, OF_BRAND_POIS)) file_putf(log_file,"Poi "); file_putf(log_file,"sv is: %d\n", sv); file_putf(log_file," and t_m_p is: %d \n", tot_mon_power); file_putf(log_file,"times 1000 is: %d\n", (1000 * sv) / tot_mon_power); } /* Add to the cache */ for (i = 0; !of_is_empty(slay_cache[i].flags); i++) { if (of_is_equal(s_index, slay_cache[i].flags)) { slay_cache[i].value = sv; LOG_PRINT("Added to slay cache\n"); break; } } return sv; }