예제 #1
0
 public player_flag_record(string n, Object_Flag r, Object_Flag i, Object_Flag v)
 {
     name      = n;
     res_flag  = r;
     im_flag   = i;
     vuln_flag = v;
 }
예제 #2
0
 public timed_effect(string a, string b, string c, string d, uint e, uint f, Message_Type g, Object_Flag h)
 {
     on_begin    = a;
     on_end      = b;
     on_increase = c;
     on_decrease = d;
     flag_redraw = e;
     flag_update = f;
     msg         = g;
     resist      = h;
 }
예제 #3
0
        /**
         * Determine whether an object flag or its timed equivalent are set in the
         * passed-in flags (which probably come from a state structure). This assumes
         * that there are no p_ptr.timed effects which can be active yet unknown to
         * the player.
         *
         * \param p player to act upon
         * \param flag is the object flag for which we are checking.
         * \param f is the set of flags we're checking
         */
        public bool check_state(Object.Object_Flag flag, Bitflag f)
        {
            Object_Flag of_ptr = Object_Flag.list[flag.value];

            /* Sanity check */
            if (flag == null)
            {
                return(false);
            }

            if (f.has(flag.value) || (of_ptr.timed != (Timed_Effect)0 && timed[(int)of_ptr.timed] > 0))
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        /*
         * Learn about an "observed" resistance or other player state property, or
         * lack of it.
         */
        public void update_smart_learn(Player.Player p, Object_Flag what)
        {
            Monster_Race r_ptr = Misc.r_info[r_idx];

            /* Sanity check */
            if (what != null)
            {
                return;
            }

            /* anything a monster might learn, the player should learn */
            Object.Object.wieldeds_notice_flag(p, what.value);

            /* Not allowed to learn */
            if (!Option.birth_ai_learn.value)
            {
                return;
            }

            /* Too stupid to learn anything */
            if (r_ptr.flags.has(Monster_Flag.STUPID.value))
            {
                return;
            }

            /* Not intelligent, only learn sometimes */
            if (!r_ptr.flags.has(Monster_Flag.SMART.value) && Random.one_in_(2))
            {
                return;
            }

            /* Analyze the knowledge; fail very rarely */
            if (p.check_state(what, p.state.flags) && !Random.one_in_(100))
            {
                known_pflags.on(what.value);
            }
            else
            {
                known_pflags.off(what.value);
            }
        }
예제 #5
0
        public GF(string name, string desc, Object_Flag resist, int num, random_value denom, Timed_Effect opp,
                  Object_Flag immunity, bool side_immune, Object_Flag vuln, Monster_Flag mon_res, Monster_Flag mon_vuln,
                  Object_Flag obj_hates, Object_Flag obj_imm)
        {
            value            = counter++;
            this.name        = name;
            this.desc        = desc;
            this.resist      = resist;
            this.num         = num;
            this.denom       = denom;
            this.opp         = opp;
            this.immunity    = immunity;
            this.side_immune = side_immune;
            this.vuln        = vuln;
            this.mon_res     = mon_res;
            this.mon_vuln    = mon_vuln;
            this.obj_hates   = obj_hates;
            this.obj_imm     = obj_imm;

            list.Add(this);
        }
예제 #6
0
 public Monster_Spell_Effect_Flag(int index, Monster_Spell_Flag method, GF gf, bool timed, Timed_Effect flag,
                                  random_value Base, random_value dam, int chance, bool save, Object_Flag res_flag, random_value power)
 {
     this.index    = index;
     this.method   = method;
     this.gf       = gf;
     this.timed    = timed;
     this.flag     = flag;
     this.Base     = Base;
     this.dam      = dam;
     this.chance   = chance;
     this.save     = save;
     this.res_flag = res_flag;
     this.power    = power;
 }
예제 #7
0
        /*
         * Determine the squelch level of an object, which is similar to its pseudo.
         *
         * The main point is when the value is undetermined given current info,
         * return the maximum possible value.
         */
        public static quality_squelch squelch_level_of(Object.Object o_ptr)
        {
            quality_squelch value = quality_squelch.SQUELCH_NONE;
            Bitflag         f     = new Bitflag(Object_Flag.SIZE);
            Bitflag         f2    = new Bitflag(Object_Flag.SIZE);
            int             i;

            o_ptr.object_flags_known(ref f);

            /* Deal with jewelry specially. */
            if (o_ptr.is_jewelry())
            {
                /* CC: average jewelry has at least one known positive pval */
                for (i = 0; i < o_ptr.num_pvals; i++)
                {
                    if ((o_ptr.this_pval_is_visible(i)) && (o_ptr.pval[i] > 0))
                    {
                        return(quality_squelch.SQUELCH_AVERAGE);
                    }
                }

                if ((o_ptr.to_h > 0) || (o_ptr.to_d > 0) || (o_ptr.to_a > 0))
                {
                    return(quality_squelch.SQUELCH_AVERAGE);
                }
                if ((o_ptr.attack_plusses_are_visible() &&
                     ((o_ptr.to_h < 0) || (o_ptr.to_d < 0))) ||
                    (o_ptr.defence_plusses_are_visible() && o_ptr.to_a < 0))
                {
                    return(quality_squelch.SQUELCH_BAD);
                }

                return(quality_squelch.SQUELCH_AVERAGE);
            }

            /* And lights */
            if (o_ptr.tval == TVal.TV_LIGHT)
            {
                Object_Flag.create_mask(f2, true, Object_Flag.object_flag_id.WIELD);
                if (f.is_inter(f2))
                {
                    return(quality_squelch.SQUELCH_ALL);
                }
                if ((o_ptr.to_h > 0) || (o_ptr.to_d > 0) || (o_ptr.to_a > 0))
                {
                    return(quality_squelch.SQUELCH_GOOD);
                }
                if ((o_ptr.to_h < 0) || (o_ptr.to_d < 0) || (o_ptr.to_a < 0))
                {
                    return(quality_squelch.SQUELCH_BAD);
                }

                return(quality_squelch.SQUELCH_AVERAGE);
            }

            /* CC: we need to redefine "bad" with multiple pvals
             * At the moment we use "all pvals known and negative" */
            for (i = 0; i < o_ptr.num_pvals; i++)
            {
                if (!o_ptr.this_pval_is_visible(i) ||
                    (o_ptr.pval[i] > 0))
                {
                    break;
                }

                if (i == (o_ptr.num_pvals - 1))
                {
                    return(quality_squelch.SQUELCH_BAD);
                }
            }

            if (o_ptr.was_sensed())
            {
                Object.Object.obj_pseudo_t pseudo = o_ptr.pseudo();

                switch (pseudo)
                {
                case Object.Object.obj_pseudo_t.INSCRIP_AVERAGE: {
                    value = quality_squelch.SQUELCH_AVERAGE;
                    break;
                }

                case Object.Object.obj_pseudo_t.INSCRIP_EXCELLENT: {
                    /* have to assume splendid until you have tested it */
                    if (o_ptr.was_worn())
                    {
                        if (o_ptr.high_resist_is_possible())
                        {
                            value = quality_squelch.SQUELCH_EXCELLENT_NO_SPL;
                        }
                        else
                        {
                            value = quality_squelch.SQUELCH_EXCELLENT_NO_HI;
                        }
                    }
                    else
                    {
                        value = quality_squelch.SQUELCH_ALL;
                    }
                    break;
                }

                case Object.Object.obj_pseudo_t.INSCRIP_SPLENDID:
                    value = quality_squelch.SQUELCH_ALL;
                    break;

                case Object.Object.obj_pseudo_t.INSCRIP_null:
                case Object.Object.obj_pseudo_t.INSCRIP_SPECIAL:
                    value = quality_squelch.SQUELCH_MAX;
                    break;

                /* This is the interesting case */
                case Object.Object.obj_pseudo_t.INSCRIP_STRANGE:
                case Object.Object.obj_pseudo_t.INSCRIP_MAGICAL: {
                    value = quality_squelch.SQUELCH_GOOD;

                    if ((o_ptr.attack_plusses_are_visible() ||
                         Random.randcalc_valid(o_ptr.kind.to_h, o_ptr.to_h) ||
                         Random.randcalc_valid(o_ptr.kind.to_d, o_ptr.to_d)) &&
                        (o_ptr.defence_plusses_are_visible() ||
                         Random.randcalc_valid(o_ptr.kind.to_a, o_ptr.to_a)))
                    {
                        int isgood = is_object_good(o_ptr);
                        if (isgood > 0)
                        {
                            value = quality_squelch.SQUELCH_GOOD;
                        }
                        else if (isgood < 0)
                        {
                            value = quality_squelch.SQUELCH_BAD;
                        }
                        else
                        {
                            value = quality_squelch.SQUELCH_AVERAGE;
                        }
                    }
                    break;
                }

                default:
                    /* do not handle any other possible pseudo values */
                    Misc.assert(false);
                    break;
                }
            }
            else
            {
                if (o_ptr.was_worn())
                {
                    value = quality_squelch.SQUELCH_EXCELLENT_NO_SPL;             /* object would be sensed if it were splendid */
                }
                else if (o_ptr.is_known_not_artifact())
                {
                    value = quality_squelch.SQUELCH_ALL;
                }
                else
                {
                    value = quality_squelch.SQUELCH_MAX;
                }
            }

            return(value);
        }
예제 #8
0
        /*
         * Special display, part 2c
         *
         * How to print out the modifications and sustains.
         * Positive mods with no sustain will be light green.
         * Positive mods with a sustain will be dark green.
         * Sustains (with no modification) will be a dark green 's'.
         * Negative mods (from a curse) will be red.
         * Huge mods (>9), like from MICoMorgoth, will be a '*'
         * No mod, no sustain, will be a slate '.'
         */
        static void display_player_sust_info()
        {
            int j, stat;

            Player.Player p_ptr = Player.Player.instance;

            Bitflag f = new Bitflag(Object_Flag.SIZE);

            Object_Flag[] stat_flags    = new Object_Flag[(int)Stat.Max];
            Object_Flag[] sustain_flags = new Object_Flag[(int)Stat.Max];

            ConsoleColor a;
            char         c;


            /* Row */
            int row = 2;

            /* Column */
            int col = 26;

            /* Build the stat flags tables */
            stat_flags[(int)Stat.Str]    = Object_Flag.STR;
            stat_flags[(int)Stat.Int]    = Object_Flag.INT;
            stat_flags[(int)Stat.Wis]    = Object_Flag.WIS;
            stat_flags[(int)Stat.Dex]    = Object_Flag.DEX;
            stat_flags[(int)Stat.Con]    = Object_Flag.CON;
            stat_flags[(int)Stat.Chr]    = Object_Flag.CHR;
            sustain_flags[(int)Stat.Str] = Object_Flag.SUST_STR;
            sustain_flags[(int)Stat.Int] = Object_Flag.SUST_INT;
            sustain_flags[(int)Stat.Wis] = Object_Flag.SUST_WIS;
            sustain_flags[(int)Stat.Dex] = Object_Flag.SUST_DEX;
            sustain_flags[(int)Stat.Con] = Object_Flag.SUST_CON;
            sustain_flags[(int)Stat.Chr] = Object_Flag.SUST_CHR;

            /* Header */
            Utilities.c_put_str(ConsoleColor.White, "abcdefghijkl@", row - 1, col);

            /* Process equipment */
            for (int i = Misc.INVEN_WIELD; i < Misc.INVEN_TOTAL; ++i)
            {
                /* Get the object */
                Object.Object o_ptr = p_ptr.inventory[i];

                if (o_ptr.kind == null)
                {
                    col++;
                    continue;
                }

                /* Get the "known" flags */
                o_ptr.object_flags_known(ref f);

                /* Initialize color based of sign of pval. */
                for (stat = 0; stat < (int)Stat.Max; stat++)
                {
                    /* Default */
                    a = ConsoleColor.Gray;
                    c = '.';

                    /* Boost */
                    if (f.has(stat_flags[stat].value))
                    {
                        /* Default */
                        c = '*';

                        /* Work out which pval we're talking about */
                        j = o_ptr.which_pval(stat_flags[stat].value);

                        /* Good */
                        if (o_ptr.pval[j] > 0)
                        {
                            /* Good */
                            a = ConsoleColor.Green;

                            /* Label boost */
                            if (o_ptr.pval[j] < 10)
                            {
                                c = (char)Basic.I2D((char)o_ptr.pval[j]);
                            }
                        }

                        /* Bad */
                        if (o_ptr.pval[j] < 0)
                        {
                            /* Bad */
                            a = ConsoleColor.Red;

                            /* Label boost */
                            if (o_ptr.pval[j] > -10)
                            {
                                c = (char)Basic.I2D((char)-(o_ptr.pval[j]));
                            }
                        }
                    }

                    /* Sustain */
                    if (f.has(sustain_flags[stat].value))
                    {
                        /* Dark green */
                        a = ConsoleColor.DarkGreen;

                        /* Convert '.' to 's' */
                        if (c == '.')
                        {
                            c = 's';
                        }
                    }

                    if ((c == '.') && o_ptr.kind != null && !o_ptr.object_flag_is_known(sustain_flags[stat].value))
                    {
                        c = '?';
                    }

                    /* Dump proper character */
                    Term.putch(col, row + stat, a, c);
                }

                /* Advance */
                col++;
            }

            /* Player flags */
            Player.Player.player_flags(ref f);

            /* Check stats */
            for (stat = 0; stat < (int)Stat.Max; ++stat)
            {
                /* Default */
                a = ConsoleColor.Gray;
                c = '.';

                /* Sustain */
                if (f.has(sustain_flags[stat].value))
                {
                    /* Dark green "s" */
                    a = ConsoleColor.DarkGreen;
                    c = 's';
                }

                /* Dump */
                Term.putch(col, row + stat, a, c);
            }

            /* Column */
            col = 26;

            /* Footer */
            Utilities.c_put_str(ConsoleColor.White, "abcdefghijkl@", row + 6, col);

            /* Equippy */
            display_player_equippy(row + 7, col);
        }