Ejemplo n.º 1
0
        /**
         * Increase the timed effect `idx` by `v`.  Mention this if `notify` is true.
         * Check for resistance to the effect if `check` is true.
         */
        //formerly player_inc_timed
        public bool inc_timed(Timed_Effect idx, int v, bool notify, bool check)
        {
            GF effect;

            /* Check we have a valid effect */
            if ((idx < 0) || (idx > Timed_Effect.MAX))
            {
                return(false);
            }

            /* Find the effect */
            effect = GF.list[(int)idx];

            /* Check that @ can be affected by this effect */
            if (check)
            {
                Object.Object.wieldeds_notice_flag(Misc.p_ptr, effect.resist.value);
                if (check_state(effect.resist, state.flags))
                {
                    return(false);
                }
            }

            /* Paralysis should be non-cumulative */
            if (idx == Timed_Effect.PARALYZED && timed[(int)Timed_Effect.PARALYZED] > 0)
            {
                return(false);
            }

            /* Set v */
            v = v + timed[(int)idx];

            return(set_timed(idx, v, notify));
        }
Ejemplo n.º 2
0
        public Object_Flag(string name, bool pval, Timed_Effect timed, object_flag_id id, object_flag_type type,
                           int power, int p_m, int wpn, int bow, int ring, int amu, int light, int body, int cloak,
                           int shield, int hat, int gloves, int boots, string message)
        {
            this.value   = counter++;
            this.name    = name;
            this.pval    = pval;
            this.timed   = timed;
            this.id      = id;
            this.type    = type;
            this.power   = power;
            this.p_m     = p_m;
            this.weapon  = wpn;
            this.bow     = bow;
            this.ring    = ring;
            this.amulet  = amu;
            this.light   = light;
            this.body    = body;
            this.cloak   = cloak;
            this.shield  = shield;
            this.hat     = hat;
            this.gloves  = gloves;
            this.boots   = boots;
            this.message = message;

            list.Add(this);
        }
Ejemplo n.º 3
0
        /**
         * Decrease the timed effect `idx` by `v`.  Mention this if `notify` is true.
         */
        public bool dec_timed(Timed_Effect idx, int v, bool notify)
        {
            /* Check we have a valid effect */
            if ((idx < 0) || (idx > Timed_Effect.MAX))
            {
                return(false);
            }

            /* Set v */
            v = timed[(int)idx] - v;

            return(set_timed(idx, v, notify));
        }
Ejemplo n.º 4
0
        /**
         * Increase the timed effect `idx` by `v`.  Mention this if `notify` is true.
         * Check for resistance to the effect if `check` is true.
         */
        //formerly player_inc_timed
        public bool inc_timed(Timed_Effect idx, int v, bool notify, bool check)
        {
            GF effect;

            /* Check we have a valid effect */
            if ((idx < 0) || (idx > Timed_Effect.MAX)) return false;

            /* Find the effect */
            effect = GF.list[(int)idx];

            /* Check that @ can be affected by this effect */
            if (check) {
                Object.Object.wieldeds_notice_flag(Misc.p_ptr, effect.resist.value);
                if (check_state(effect.resist, state.flags)) return false;
            }

            /* Paralysis should be non-cumulative */
            if (idx == Timed_Effect.PARALYZED && timed[(int)Timed_Effect.PARALYZED] > 0)
                return false;

            /* Set v */
            v = v + timed[(int)idx];

            return set_timed(idx, v, notify);
        }
Ejemplo n.º 5
0
        /**
         * Decrease the timed effect `idx` by `v`.  Mention this if `notify` is true.
         */
        public bool dec_timed(Timed_Effect idx, int v, bool notify)
        {
            /* Check we have a valid effect */
            if ((idx < 0) || (idx > Timed_Effect.MAX)) return false;

            /* Set v */
            v = timed[(int)idx] - v;

            return set_timed(idx, v, notify);
        }
Ejemplo n.º 6
0
 public void addTimedEffect(Timed_Effect<CharacterState> effect)
 {
     state.add_timedEffect(effect);
 }
Ejemplo n.º 7
0
        public Object_Flag(string name, bool pval, Timed_Effect timed, object_flag_id id, object_flag_type type,
            int power, int p_m, int wpn, int bow, int ring, int amu, int light, int body, int cloak,
            int shield, int hat, int gloves, int boots, string message)
        {
            this.value = counter++;
            this.name = name;
            this.pval = pval;
            this.timed = timed;
            this.id = id;
            this.type = type;
            this.power = power;
            this.p_m = p_m;
            this.weapon = wpn;
            this.bow = bow;
            this.ring = ring;
            this.amulet = amu;
            this.light = light;
            this.body = body;
            this.cloak = cloak;
            this.shield = shield;
            this.hat = hat;
            this.gloves = gloves;
            this.boots = boots;
            this.message = message;

            list.Add(this);
        }
        public bool timed; /* true if timed, false if permanent */

        #endregion Fields

        #region Constructors

        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;
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
        /*
         * Set a timed event (except timed resists, cutting and stunning).
         */
        public bool set_timed(Timed_Effect idx, int v, bool notify)
        {
            /* Hack -- Force good values */
            v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
            if ((idx < 0) || (idx > Timed_Effect.MAX)) return false;

            /* No change */
            if (timed[(int)idx] == v) return false;

            /* Hack -- call other functions */
            if (idx == Timed_Effect.STUN) return set_stun(this, v);
            else if (idx == Timed_Effect.CUT) return set_cut(this, v);

            /* Don't mention effects which already match the player state. */
            if (idx == Timed_Effect.OPP_ACID && check_state(Object_Flag.IM_ACID, state.flags))
                notify = false;
            else if (idx == Timed_Effect.OPP_ELEC && check_state(Object_Flag.IM_ELEC, state.flags))
                notify = false;
            else if (idx == Timed_Effect.OPP_FIRE && check_state(Object_Flag.IM_FIRE, state.flags))
                notify = false;
            else if (idx == Timed_Effect.OPP_COLD && check_state(Object_Flag.IM_COLD, state.flags))
                notify = false;
            else if (idx == Timed_Effect.OPP_CONF && state.flags.has(Object_Flag.RES_CONFU.value))
                notify = false;

            /* Find the effect */
            timed_effect effect = effects[(int)idx];

            /* Turning off, always mention */
            if (v == 0)
            {
                Utilities.msgt(Message_Type.MSG_RECOVER, "{0}", effect.on_end);
                notify = true;
            }

            /* Turning on, always mention */
            else if (timed[(int)idx] == 0)
            {
                Utilities.msgt(effect.msg, "{0}", effect.on_begin);
                notify = true;
            }

            else if (notify)
            {
                /* Decrementing */
                if (timed[(int)idx] > v && effect.on_decrease != null)
                    Utilities.msgt(effect.msg, "{0}", effect.on_decrease);

                /* Incrementing */
                else if (v > timed[(int)idx] && effect.on_increase != null)
                    Utilities.msgt(effect.msg, "{0}", effect.on_increase);
            }

            /* Use the value */
            timed[(int)idx] = (short)v;

            /* Sort out the sprint effect */
            if (idx == Timed_Effect.SPRINT && v == 0)
                inc_timed(Timed_Effect.SLOW, 100, true, false);

            /* Nothing to notice */
            if (!notify) return false;

            /* Disturb */
            if (Option.disturb_state.value) Cave.disturb(this, 0, 0);

            /* Update the visuals, as appropriate. */
            update |= effect.flag_update;
            redraw |= (Misc.PR_STATUS | effect.flag_redraw);

            /* Handle stuff */
            handle_stuff();

            /* Result */
            return true;
        }
Ejemplo n.º 12
0
 /**
  * Clear the timed effect `idx`.  Mention this if `notify` is true.
  */
 public bool clear_timed(Timed_Effect idx, bool notify)
 {
     return set_timed(idx, 0, notify);
 }
Ejemplo n.º 13
0
        /*
         * Set a timed event (except timed resists, cutting and stunning).
         */
        public bool set_timed(Timed_Effect idx, int v, bool notify)
        {
            /* Hack -- Force good values */
            v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
            if ((idx < 0) || (idx > Timed_Effect.MAX))
            {
                return(false);
            }

            /* No change */
            if (timed[(int)idx] == v)
            {
                return(false);
            }

            /* Hack -- call other functions */
            if (idx == Timed_Effect.STUN)
            {
                return(set_stun(this, v));
            }
            else if (idx == Timed_Effect.CUT)
            {
                return(set_cut(this, v));
            }

            /* Don't mention effects which already match the player state. */
            if (idx == Timed_Effect.OPP_ACID && check_state(Object_Flag.IM_ACID, state.flags))
            {
                notify = false;
            }
            else if (idx == Timed_Effect.OPP_ELEC && check_state(Object_Flag.IM_ELEC, state.flags))
            {
                notify = false;
            }
            else if (idx == Timed_Effect.OPP_FIRE && check_state(Object_Flag.IM_FIRE, state.flags))
            {
                notify = false;
            }
            else if (idx == Timed_Effect.OPP_COLD && check_state(Object_Flag.IM_COLD, state.flags))
            {
                notify = false;
            }
            else if (idx == Timed_Effect.OPP_CONF && state.flags.has(Object_Flag.RES_CONFU.value))
            {
                notify = false;
            }

            /* Find the effect */
            timed_effect effect = effects[(int)idx];

            /* Turning off, always mention */
            if (v == 0)
            {
                Utilities.msgt(Message_Type.MSG_RECOVER, "{0}", effect.on_end);
                notify = true;
            }

            /* Turning on, always mention */
            else if (timed[(int)idx] == 0)
            {
                Utilities.msgt(effect.msg, "{0}", effect.on_begin);
                notify = true;
            }

            else if (notify)
            {
                /* Decrementing */
                if (timed[(int)idx] > v && effect.on_decrease != null)
                {
                    Utilities.msgt(effect.msg, "{0}", effect.on_decrease);
                }

                /* Incrementing */
                else if (v > timed[(int)idx] && effect.on_increase != null)
                {
                    Utilities.msgt(effect.msg, "{0}", effect.on_increase);
                }
            }

            /* Use the value */
            timed[(int)idx] = (short)v;

            /* Sort out the sprint effect */
            if (idx == Timed_Effect.SPRINT && v == 0)
            {
                inc_timed(Timed_Effect.SLOW, 100, true, false);
            }

            /* Nothing to notice */
            if (!notify)
            {
                return(false);
            }

            /* Disturb */
            if (Option.disturb_state.value)
            {
                Cave.disturb(this, 0, 0);
            }

            /* Update the visuals, as appropriate. */
            update |= effect.flag_update;
            redraw |= (Misc.PR_STATUS | effect.flag_redraw);

            /* Handle stuff */
            handle_stuff();

            /* Result */
            return(true);
        }
Ejemplo n.º 14
0
 /**
  * Clear the timed effect `idx`.  Mention this if `notify` is true.
  */
 public bool clear_timed(Timed_Effect idx, bool notify)
 {
     return(set_timed(idx, 0, notify));
 }
Ejemplo n.º 15
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);
        }