Exemplo n.º 1
0
        /**
         * Determine whether a flagset includes any curse flags.
         */
        public static bool cursed_p(Bitflag f)
        {
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);

            f2.wipe();
            create_mask(f2, false, object_flag_type.CURSE);

            return(f.is_inter(f2));
        }
Exemplo n.º 2
0
        static int obj_desc_pval(Object o_ptr, string buf, int max, int end, bool spoil)
        {
            Bitflag f  = new Bitflag(Object_Flag.SIZE);
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);
            int     i;

            o_ptr.object_flags(ref f);
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.PVAL, Object_Flag.object_flag_type.STAT);

            if (!f.is_inter(f2))
            {
                return(end);
            }

            buf += " <";
            //strnfcat(buf, max, &end, " <");
            for (i = 0; i < o_ptr.num_pvals; i++)
            {
                if (spoil || o_ptr.this_pval_is_visible(i))
                {
                    if (i > 0)
                    {
                        buf += ", ";
                        //strnfcat(buf, max, &end, ", ");
                    }
                    buf += o_ptr.pval[i] > 0 ? "+" + o_ptr.pval[i] : o_ptr.pval[i].ToString();
                    //strnfcat(buf, max, &end, "%+d", o_ptr.pval[i]);
                }
            }

            buf += ">";
            end  = buf.Length;            //f**k it.
            //strnfcat(buf, max, &end, ">");

            return(end);
        }
Exemplo n.º 3
0
        static int obj_desc_inscrip(Object o_ptr, ref string buf, int max, int end)
        {
            string[] u = { "", "", "", "" };
            int      n = 0;

            Object.obj_pseudo_t feel        = o_ptr.pseudo();
            Bitflag             flags_known = new Bitflag(Object_Flag.SIZE);
            Bitflag             f2          = new Bitflag(Object_Flag.SIZE);

            o_ptr.object_flags_known(ref flags_known);

            /* Get inscription */
            if (o_ptr.note != null && o_ptr.note.value != null)
            {
                u[n++] = o_ptr.note.ToString();
            }

            /* Use special inscription, if any */
            if (!o_ptr.is_known() && feel != 0)
            {
                /* cannot tell excellent vs strange vs splendid until wield */
                if (!o_ptr.was_worn() && o_ptr.ego != null)
                {
                    u[n++] = "ego";
                }
                else
                {
                    u[n++] = Misc.inscrip_text[(int)feel];             //I know that feel bro.
                }
            }
            else if (((o_ptr.ident & Object.IDENT_EMPTY) != 0) && !o_ptr.is_known())
            {
                u[n++] = "empty";
            }
            else if (!o_ptr.is_known() && o_ptr.was_worn())
            {
                if (o_ptr.wield_slot() == Misc.INVEN_WIELD || o_ptr.wield_slot() == Misc.INVEN_BOW)
                {
                    u[n++] = "wielded";
                }
                else
                {
                    u[n++] = "worn";
                }
            }
            else if (!o_ptr.is_known() && o_ptr.was_fired())
            {
                u[n++] = "fired";
            }
            else if (!o_ptr.flavor_is_aware() && o_ptr.flavor_was_tried())
            {
                u[n++] = "tried";
            }

            /* Note curses */
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE);
            if (flags_known.is_inter(f2))
            {
                u[n++] = "cursed";
            }

            /* Note squelch */
            if (Squelch.item_ok(o_ptr))
            {
                u[n++] = "squelch";
            }

            if (n != 0)
            {
                int i;
                for (i = 0; i < n; i++)
                {
                    if (i == 0)
                    {
                        buf = buf + " {";
                    }
                    buf = buf + u[i];
                    if (i < n - 1)
                    {
                        buf += ", ";
                    }
                }

                buf += "}";
            }

            return(end);
        }
Exemplo n.º 4
0
        /**
         * Determine whether a flagset includes any curse flags.
         */
        public static bool cursed_p(Bitflag f)
        {
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);

            f2.wipe();
            create_mask(f2, false, object_flag_type.CURSE);

            return f.is_inter(f2);
        }
Exemplo n.º 5
0
        /*
         * Determine whether a weapon or missile weapon is obviously {excellent} when
         * worn.
         *
         * 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
         */
        public void notice_on_wield()
        {
            Bitflag f = new Bitflag(Object_Flag.SIZE);
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);
            Bitflag obvious_mask = new Bitflag(Object_Flag.SIZE);
            bool obvious = false;

            Object_Flag.create_mask(obvious_mask, true, Object_Flag.object_flag_id.WIELD);

            /* Save time of wield for later */
            object_last_wield = Misc.turn;

            /* Only deal with un-ID'd items */
            if (is_known()) return;

            /* Wear it */
            flavor_tried();
            if (add_ident_flags(IDENT_WORN))
                check_for_ident();

            /* CC: may wish to be more subtle about this once we have ego lights
             * with multiple pvals */
            if (is_light() && ego != null)
                notice_ego();

            if (flavor_is_aware() && easy_know())
            {
                notice_everything();
                return;
            }

            /* Automatically sense artifacts upon wield */
            sense_artifact();

            /* Note artifacts when found */
            if (artifact != null)
                History.add_artifact(artifact, is_known(), true);

            /* special case FA, needed at least for mages wielding gloves */
            if (FA_would_be_obvious())
                obvious_mask.on(Object_Flag.FREE_ACT.value);

            /* Extract the flags */
            object_flags(ref f);

            /* Find obvious things (disregarding curses) - why do we remove the curses?? */
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE);
            obvious_mask.diff(f2);
            if (f.is_inter(obvious_mask)) obvious = true;
            Object_Flag.create_mask(obvious_mask, true, Object_Flag.object_flag_id.WIELD);

            /* Notice any obvious brands or slays */
            Slay.object_notice_slays(this, obvious_mask);

            /* Learn about obvious flags */
            known_flags.union(obvious_mask);

            /* 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 (is_jewelry())
            {
                /* Learn the flavor of jewelry with obvious flags */
                if (EASY_LEARN && obvious)
                    flavor_aware();

                /* Learn all flags on any aware non-artifact jewelry */
                if (flavor_is_aware() && artifact == null)
                    know_all_flags();
            }

            check_for_ident();

            if (!obvious) return;

            /* XXX Eddie need to add stealth here, also need to assert/double-check everything is covered */
            /* CC: also need to add FA! */
            if (f.has(Object_Flag.STR.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.STR.value)] > 0 ? "stronger" : "weaker");
            if (f.has(Object_Flag.INT.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.INT.value)] > 0 ? "smarter" : "more stupid");
            if (f.has(Object_Flag.WIS.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.WIS.value)] > 0 ? "wiser" : "more naive");
            if (f.has(Object_Flag.DEX.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.DEX.value)] > 0 ? "more dextrous" : "clumsier");
            if (f.has(Object_Flag.CON.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.CON.value)] > 0 ? "healthier" : "sicklier");
            if (f.has(Object_Flag.CHR.value))
                Utilities.msg("You feel %s!", pval[which_pval(
                    Object_Flag.CHR.value)] > 0 ? "cuter" : "uglier");
            if (f.has(Object_Flag.SPEED.value))
                Utilities.msg("You feel strangely %s.", pval[which_pval(
                    Object_Flag.SPEED.value)] > 0 ? "quick" : "sluggish");
            if (f.has(Object_Flag.BLOWS.value))
                Utilities.msg("Your weapon %s in your hands.",
                    pval[which_pval(Object_Flag.BLOWS.value)] > 0 ?
                        "tingles" : "aches");
            if (f.has(Object_Flag.SHOTS.value))
                Utilities.msg("Your bow %s in your hands.",
                    pval[which_pval(Object_Flag.SHOTS.value)] > 0 ?
                        "tingles" : "aches");
            if (f.has(Object_Flag.INFRA.value))
                Utilities.msg("Your eyes tingle.");
            if (f.has(Object_Flag.LIGHT.value))
                Utilities.msg("It glows!");
            if (f.has(Object_Flag.TELEPATHY.value))
                Utilities.msg("Your mind feels strangely sharper!");

            /* WARNING -- masking f by obvious mask -- this should be at the end of this function */
            /* CC: I think this can safely go, but just in case ... */
            /*flags_mask(f, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); */

            /* Remember the flags */
            notice_sensing();

            /* XXX Eddie should we check_for_ident here? */
        }
Exemplo n.º 6
0
        /**
         * Calculate the rating for a given slay combination
         */
        int slay_power(bool verbose, StreamWriter log_file, bool known)
        {
            Bitflag      s_index = new Bitflag(Object_Flag.SIZE);
            Bitflag      f = new Bitflag(Object_Flag.SIZE);
            Bitflag      f2 = new Bitflag(Object_Flag.SIZE);
            int          sv = 0;    //uint
            int          i, j;
            int          mult;
            Slay         best_s_ptr = null;
            Monster_Race r_ptr;

            Monster.Monster m_ptr;
            //monster_type monster_type_body;
            string[] desc   = new string[Slay.MAX.value];      // = { 0 }, *
            string[] brand  = new string[Slay.MAX.value];      // = { 0 };
            int[]    s_mult = new int[Slay.MAX.value];         // = { 0 };

            if (known)
            {
                object_flags(ref f);
            }
            else
            {
                object_flags_known(ref f);
            }

            /* Combine the slay bytes into an index value, return if there are none */
            s_index.copy(f);
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.SLAY,
                                    Object_Flag.object_flag_type.KILL, Object_Flag.object_flag_type.BRAND);

            if (!s_index.is_inter(f2))
            {
                return(Eval.tot_mon_power);
            }
            else
            {
                s_index.inter(f2);
            }

            /* Look in the cache to see if we know this one yet */
            sv = Slay.check_slay_cache(s_index);

            /* If it's cached (or there are no slays), return the value */
            if (sv != 0)
            {
                //file_putf(log_file, "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 < Misc.z_info.r_max; i++)
            {
                best_s_ptr = null;
                mult       = 1;
                r_ptr      = Misc.r_info[i];
                if (r_ptr == null)
                {
                    continue;
                }
                m_ptr       = new Monster.Monster();
                m_ptr.r_idx = (short)i;

                /* Find the best multiplier against this monster */
                Slay.improve_attack_modifier(this, m_ptr, ref best_s_ptr, false, !known);
                if (best_s_ptr != null)
                {
                    mult = best_s_ptr.mult;
                }

                /* Add the multiple to sv */
                sv += (int)(mult * r_ptr.scaled_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: ");

                j = Slay.list_slays(s_index, s_index, desc, brand, s_mult, false);

                //for (i = 0; i < j; i++) {
                //    if (brand[i]) {
                //        file_putf(log_file, brand[i]);
                //    } else {
                //        file_putf(log_file, desc[i]);
                //    }
                //    file_putf(log_file, "x%d ", s_mult[i]);
                //}
                //file_putf(log_file, "\nsv 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 */
            if (Slay.fill_slay_cache(s_index, sv))
            {
                //file_putf(log_file, "Added to slay cache\n");
            }

            return(sv);
        }
Exemplo n.º 7
0
        static int obj_desc_pval(Object o_ptr, string buf, int max, int end, bool spoil)
        {
            Bitflag f = new Bitflag(Object_Flag.SIZE);
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);
            int i;

            o_ptr.object_flags(ref f);
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.PVAL, Object_Flag.object_flag_type.STAT);

            if (!f.is_inter(f2)) return end;

            buf += " <";
            //strnfcat(buf, max, &end, " <");
            for (i = 0; i < o_ptr.num_pvals; i++) {
                if (spoil || o_ptr.this_pval_is_visible(i)) {
                    if(i > 0) {
                        buf += ", ";
                        //strnfcat(buf, max, &end, ", ");
                    }
                    buf += o_ptr.pval[i] > 0 ? "+" + o_ptr.pval[i] : o_ptr.pval[i].ToString();
                    //strnfcat(buf, max, &end, "%+d", o_ptr.pval[i]);
                }
            }

            buf += ">";
            end = buf.Length; //f**k it.
            //strnfcat(buf, max, &end, ">");

            return end;
        }
Exemplo n.º 8
0
        static int obj_desc_inscrip(Object o_ptr, ref string buf, int max, int end)
        {
            string[] u = {"", "", "", ""};
            int n = 0;
            Object.obj_pseudo_t feel = o_ptr.pseudo();
            Bitflag flags_known = new Bitflag(Object_Flag.SIZE);
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);

            o_ptr.object_flags_known(ref flags_known);

            /* Get inscription */
            if (o_ptr.note != null && o_ptr.note.value != null)
                u[n++] = o_ptr.note.ToString();

            /* Use special inscription, if any */
            if (!o_ptr.is_known() && feel != 0)
            {
                /* cannot tell excellent vs strange vs splendid until wield */
                if (!o_ptr.was_worn() && o_ptr.ego != null)
                    u[n++] = "ego";
                else
                    u[n++] = Misc.inscrip_text[(int)feel]; //I know that feel bro.
            }
            else if (((o_ptr.ident & Object.IDENT_EMPTY) != 0) && !o_ptr.is_known())
                u[n++] = "empty";
            else if (!o_ptr.is_known() && o_ptr.was_worn())
            {
                if (o_ptr.wield_slot() == Misc.INVEN_WIELD || o_ptr.wield_slot() == Misc.INVEN_BOW)
                    u[n++] = "wielded";
                else u[n++] = "worn";
            }
            else if (!o_ptr.is_known() && o_ptr.was_fired())
                u[n++] = "fired";
            else if (!o_ptr.flavor_is_aware() && o_ptr.flavor_was_tried())
                u[n++] = "tried";

            /* Note curses */
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE);
            if (flags_known.is_inter(f2))
                u[n++] = "cursed";

            /* Note squelch */
            if (Squelch.item_ok(o_ptr))
                u[n++] = "squelch";

            if (n != 0)
            {
                int i;
                for (i = 0; i < n; i++)
                {
                    if(i == 0)
                        buf = buf + " {";
                    buf = buf + u[i];
                    if (i < n-1)
                        buf += ", ";
                }

                buf += "}";
            }

            return end;
        }
Exemplo n.º 9
0
        /*
         * Determine whether a weapon or missile weapon is obviously {excellent} when
         * worn.
         *
         * 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
         */
        public void notice_on_wield()
        {
            Bitflag f            = new Bitflag(Object_Flag.SIZE);
            Bitflag f2           = new Bitflag(Object_Flag.SIZE);
            Bitflag obvious_mask = new Bitflag(Object_Flag.SIZE);
            bool    obvious      = false;

            Object_Flag.create_mask(obvious_mask, true, Object_Flag.object_flag_id.WIELD);

            /* Save time of wield for later */
            object_last_wield = Misc.turn;

            /* Only deal with un-ID'd items */
            if (is_known())
            {
                return;
            }

            /* Wear it */
            flavor_tried();
            if (add_ident_flags(IDENT_WORN))
            {
                check_for_ident();
            }

            /* CC: may wish to be more subtle about this once we have ego lights
             * with multiple pvals */
            if (is_light() && ego != null)
            {
                notice_ego();
            }

            if (flavor_is_aware() && easy_know())
            {
                notice_everything();
                return;
            }

            /* Automatically sense artifacts upon wield */
            sense_artifact();

            /* Note artifacts when found */
            if (artifact != null)
            {
                History.add_artifact(artifact, is_known(), true);
            }

            /* special case FA, needed at least for mages wielding gloves */
            if (FA_would_be_obvious())
            {
                obvious_mask.on(Object_Flag.FREE_ACT.value);
            }

            /* Extract the flags */
            object_flags(ref f);

            /* Find obvious things (disregarding curses) - why do we remove the curses?? */
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE);
            obvious_mask.diff(f2);
            if (f.is_inter(obvious_mask))
            {
                obvious = true;
            }
            Object_Flag.create_mask(obvious_mask, true, Object_Flag.object_flag_id.WIELD);

            /* Notice any obvious brands or slays */
            Slay.object_notice_slays(this, obvious_mask);

            /* Learn about obvious flags */
            known_flags.union(obvious_mask);

            /* 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 (is_jewelry())
            {
                /* Learn the flavor of jewelry with obvious flags */
                if (EASY_LEARN && obvious)
                {
                    flavor_aware();
                }

                /* Learn all flags on any aware non-artifact jewelry */
                if (flavor_is_aware() && artifact == null)
                {
                    know_all_flags();
                }
            }

            check_for_ident();

            if (!obvious)
            {
                return;
            }

            /* XXX Eddie need to add stealth here, also need to assert/double-check everything is covered */
            /* CC: also need to add FA! */
            if (f.has(Object_Flag.STR.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.STR.value)] > 0 ? "stronger" : "weaker");
            }
            if (f.has(Object_Flag.INT.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.INT.value)] > 0 ? "smarter" : "more stupid");
            }
            if (f.has(Object_Flag.WIS.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.WIS.value)] > 0 ? "wiser" : "more naive");
            }
            if (f.has(Object_Flag.DEX.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.DEX.value)] > 0 ? "more dextrous" : "clumsier");
            }
            if (f.has(Object_Flag.CON.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.CON.value)] > 0 ? "healthier" : "sicklier");
            }
            if (f.has(Object_Flag.CHR.value))
            {
                Utilities.msg("You feel %s!", pval[which_pval(
                                                       Object_Flag.CHR.value)] > 0 ? "cuter" : "uglier");
            }
            if (f.has(Object_Flag.SPEED.value))
            {
                Utilities.msg("You feel strangely %s.", pval[which_pval(
                                                                 Object_Flag.SPEED.value)] > 0 ? "quick" : "sluggish");
            }
            if (f.has(Object_Flag.BLOWS.value))
            {
                Utilities.msg("Your weapon %s in your hands.",
                              pval[which_pval(Object_Flag.BLOWS.value)] > 0 ?
                              "tingles" : "aches");
            }
            if (f.has(Object_Flag.SHOTS.value))
            {
                Utilities.msg("Your bow %s in your hands.",
                              pval[which_pval(Object_Flag.SHOTS.value)] > 0 ?
                              "tingles" : "aches");
            }
            if (f.has(Object_Flag.INFRA.value))
            {
                Utilities.msg("Your eyes tingle.");
            }
            if (f.has(Object_Flag.LIGHT.value))
            {
                Utilities.msg("It glows!");
            }
            if (f.has(Object_Flag.TELEPATHY.value))
            {
                Utilities.msg("Your mind feels strangely sharper!");
            }

            /* WARNING -- masking f by obvious mask -- this should be at the end of this function */
            /* CC: I think this can safely go, but just in case ... */
            /*flags_mask(f, OF_SIZE, OF_OBVIOUS_MASK, FLAG_END); */

            /* Remember the flags */
            notice_sensing();

            /* XXX Eddie should we check_for_ident here? */
        }
Exemplo n.º 10
0
        /**
         * Calculate the rating for a given slay combination
         */
        int slay_power(bool verbose, StreamWriter log_file, bool known)
        {
            Bitflag s_index = new Bitflag(Object_Flag.SIZE);
            Bitflag f = new Bitflag(Object_Flag.SIZE);
            Bitflag f2 = new Bitflag(Object_Flag.SIZE);
            int sv = 0; //uint
            int i, j;
            int mult;
            Slay best_s_ptr = null;
            Monster_Race r_ptr;
            Monster.Monster m_ptr;
            //monster_type monster_type_body;
            string[] desc = new string[Slay.MAX.value];// = { 0 }, *
            string[] brand = new string[Slay.MAX.value];// = { 0 };
            int[] s_mult = new int[Slay.MAX.value];// = { 0 };

            if (known)
                object_flags(ref f);
            else
                object_flags_known(ref f);

            /* Combine the slay bytes into an index value, return if there are none */
            s_index.copy(f);
            Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.SLAY,
                Object_Flag.object_flag_type.KILL, Object_Flag.object_flag_type.BRAND);

            if (!s_index.is_inter(f2))
                return Eval.tot_mon_power;
            else
                s_index.inter(f2);

            /* Look in the cache to see if we know this one yet */
            sv = Slay.check_slay_cache(s_index);

            /* If it's cached (or there are no slays), return the value */
            if (sv != 0)	{
                //file_putf(log_file, "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 < Misc.z_info.r_max; i++)	{
                best_s_ptr = null;
                mult = 1;
                r_ptr = Misc.r_info[i];
                if(r_ptr == null)
                    continue;
                m_ptr = new Monster.Monster();
                m_ptr.r_idx = (short)i;

                /* Find the best multiplier against this monster */
                Slay.improve_attack_modifier(this, m_ptr, ref best_s_ptr, false, !known);
                if (best_s_ptr != null)
                    mult = best_s_ptr.mult;

                /* Add the multiple to sv */
                sv += (int)(mult * r_ptr.scaled_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: ");

                j = Slay.list_slays(s_index, s_index, desc, brand, s_mult, false);

                //for (i = 0; i < j; i++) {
                //    if (brand[i]) {
                //        file_putf(log_file, brand[i]);
                //    } else {
                //        file_putf(log_file, desc[i]);
                //    }
                //    file_putf(log_file, "x%d ", s_mult[i]);
                //}
                //file_putf(log_file, "\nsv 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 */
            if(Slay.fill_slay_cache(s_index, sv)) {
                //file_putf(log_file, "Added to slay cache\n");
            }

            return sv;
        }