Example #1
0
        /*
         * The "stun" and "cut" statuses need to be handled by special functions of
         * their own, as they are more complex than the ones handled by the generic
         * code.
         */
        /*
         * Set "p_ptr.timed[TMD_STUN]", notice observable changes
         *
         * Note the special code to only notice "range" changes.
         */
        static bool set_stun(Player p, int v)
        {
            throw new NotImplementedException();
            //int old_aux, new_aux;

            //bool notice = false;

            ///* Hack -- Force good values */
            //v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;

            ///* Knocked out */
            //if (p.timed[TMD_STUN] > 100)
            //{
            //    old_aux = 3;
            //}

            ///* Heavy stun */
            //else if (p.timed[TMD_STUN] > 50)
            //{
            //    old_aux = 2;
            //}

            ///* Stun */
            //else if (p.timed[TMD_STUN] > 0)
            //{
            //    old_aux = 1;
            //}

            ///* None */
            //else
            //{
            //    old_aux = 0;
            //}

            ///* Knocked out */
            //if (v > 100)
            //{
            //    new_aux = 3;
            //}

            ///* Heavy stun */
            //else if (v > 50)
            //{
            //    new_aux = 2;
            //}

            ///* Stun */
            //else if (v > 0)
            //{
            //    new_aux = 1;
            //}

            ///* None */
            //else
            //{
            //    new_aux = 0;
            //}

            ///* Increase cut */
            //if (new_aux > old_aux)
            //{
            //    /* Describe the state */
            //    switch (new_aux)
            //    {
            //        /* Stun */
            //        case 1:
            //        {
            //            msgt(MSG_STUN, "You have been stunned.");
            //            break;
            //        }

            //        /* Heavy stun */
            //        case 2:
            //        {
            //            msgt(MSG_STUN, "You have been heavily stunned.");
            //            break;
            //        }

            //        /* Knocked out */
            //        case 3:
            //        {
            //            msgt(MSG_STUN, "You have been knocked out.");
            //            break;
            //        }
            //    }

            //    /* Notice */
            //    notice = true;
            //}

            ///* Decrease cut */
            //else if (new_aux < old_aux)
            //{
            //    /* Describe the state */
            //    switch (new_aux)
            //    {
            //        /* None */
            //        case 0:
            //        {
            //            msgt(MSG_RECOVER, "You are no longer stunned.");
            //            if (OPT(disturb_state)) disturb(p_ptr, 0, 0);
            //            break;
            //        }
            //    }

            //    /* Notice */
            //    notice = true;
            //}

            ///* Use the value */
            //p.timed[TMD_STUN] = v;

            ///* No change */
            //if (!notice) return (false);

            ///* Disturb */
            //if (OPT(disturb_state)) disturb(p_ptr, 0, 0);

            ///* Recalculate bonuses */
            //p.update |= (PU_BONUS);

            ///* Redraw the "stun" */
            //p.redraw |= (PR_STATUS);

            ///* Handle stuff */
            //handle_stuff(p_ptr);

            ///* Result */
            //return (true);
        }
Example #2
0
        /*
         * Set "p_ptr.timed[TMD_CUT]", notice observable changes
         *
         * Note the special code to only notice "range" changes.
         */
        static bool set_cut(Player p, int v)
        {
            throw new NotImplementedException();
            //int old_aux, new_aux;

            //bool notice = false;

            ///* Hack -- Force good values */
            //v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;

            ///* Mortal wound */
            //if (p.timed[TMD_CUT] > 1000)
            //{
            //    old_aux = 7;
            //}

            ///* Deep gash */
            //else if (p.timed[TMD_CUT] > 200)
            //{
            //    old_aux = 6;
            //}

            ///* Severe cut */
            //else if (p.timed[TMD_CUT] > 100)
            //{
            //    old_aux = 5;
            //}

            ///* Nasty cut */
            //else if (p.timed[TMD_CUT] > 50)
            //{
            //    old_aux = 4;
            //}

            ///* Bad cut */
            //else if (p.timed[TMD_CUT] > 25)
            //{
            //    old_aux = 3;
            //}

            ///* Light cut */
            //else if (p.timed[TMD_CUT] > 10)
            //{
            //    old_aux = 2;
            //}

            ///* Graze */
            //else if (p.timed[TMD_CUT] > 0)
            //{
            //    old_aux = 1;
            //}

            ///* None */
            //else
            //{
            //    old_aux = 0;
            //}

            ///* Mortal wound */
            //if (v > 1000)
            //{
            //    new_aux = 7;
            //}

            ///* Deep gash */
            //else if (v > 200)
            //{
            //    new_aux = 6;
            //}

            ///* Severe cut */
            //else if (v > 100)
            //{
            //    new_aux = 5;
            //}

            ///* Nasty cut */
            //else if (v > 50)
            //{
            //    new_aux = 4;
            //}

            ///* Bad cut */
            //else if (v > 25)
            //{
            //    new_aux = 3;
            //}

            ///* Light cut */
            //else if (v > 10)
            //{
            //    new_aux = 2;
            //}

            ///* Graze */
            //else if (v > 0)
            //{
            //    new_aux = 1;
            //}

            ///* None */
            //else
            //{
            //    new_aux = 0;
            //}

            ///* Increase cut */
            //if (new_aux > old_aux)
            //{
            //    /* Describe the state */
            //    switch (new_aux)
            //    {
            //        /* Graze */
            //        case 1:
            //        {
            //            msgt(MSG_CUT, "You have been given a graze.");
            //            break;
            //        }

            //        /* Light cut */
            //        case 2:
            //        {
            //            msgt(MSG_CUT, "You have been given a light cut.");
            //            break;
            //        }

            //        /* Bad cut */
            //        case 3:
            //        {
            //            msgt(MSG_CUT, "You have been given a bad cut.");
            //            break;
            //        }

            //        /* Nasty cut */
            //        case 4:
            //        {
            //            msgt(MSG_CUT, "You have been given a nasty cut.");
            //            break;
            //        }

            //        /* Severe cut */
            //        case 5:
            //        {
            //            msgt(MSG_CUT, "You have been given a severe cut.");
            //            break;
            //        }

            //        /* Deep gash */
            //        case 6:
            //        {
            //            msgt(MSG_CUT, "You have been given a deep gash.");
            //            break;
            //        }

            //        /* Mortal wound */
            //        case 7:
            //        {
            //            msgt(MSG_CUT, "You have been given a mortal wound.");
            //            break;
            //        }
            //    }

            //    /* Notice */
            //    notice = true;
            //}

            ///* Decrease cut */
            //else if (new_aux < old_aux)
            //{
            //    /* Describe the state */
            //    switch (new_aux)
            //    {
            //        /* None */
            //        case 0:
            //        {
            //            msgt(MSG_RECOVER, "You are no longer bleeding.");
            //            if (OPT(disturb_state)) disturb(p_ptr, 0, 0);
            //            break;
            //        }
            //    }

            //    /* Notice */
            //    notice = true;
            //}

            ///* Use the value */
            //p.timed[TMD_CUT] = v;

            ///* No change */
            //if (!notice) return (false);

            ///* Disturb */
            //if (OPT(disturb_state)) disturb(p_ptr, 0, 0);

            ///* Recalculate bonuses */
            //p.update |= (PU_BONUS);

            ///* Redraw the "cut" */
            //p.redraw |= (PR_STATUS);

            ///* Handle stuff */
            //handle_stuff(p_ptr);

            ///* Result */
            //return (true);
        }
Example #3
0
        /**
         * Try to wield everything wieldable in the inventory.
         */
        static void wield_all(Player.Player p)
        {
            Object.Object o_ptr;
            Object.Object i_ptr;
            //Object.Object object_type_body;

            int slot;
            int item;
            int num;
            bool is_ammo;

            /* Scan through the slots backwards */
            for (item = Misc.INVEN_PACK - 1; item >= 0; item--)
            {
                o_ptr = p.inventory[item];
                is_ammo = o_ptr.is_ammo();

                /* Skip non-objects */
                if (o_ptr.kind == null) continue;

                /* Make sure we can wield it */
                slot = o_ptr.wield_slot();
                if (slot < Misc.INVEN_WIELD) continue;

                i_ptr = p.inventory[slot];
                if (i_ptr.kind != null && (!is_ammo ||(is_ammo && !o_ptr.similar(i_ptr, Object.Object.object_stack_t.OSTACK_PACK))))
                    continue;

                /* Figure out how much of the item we'll be wielding */
                num = is_ammo ? o_ptr.number : 1;

                /* Get local object */
                i_ptr = new Object.Object();
                i_ptr = o_ptr.copy();
                //This entire bit was uber shadey... Rewrote above
                ////i_ptr = object_type_body;
                //p.inventory[slot] = o_ptr; //object_copy(i_ptr, o_ptr); //This might not work...
                //i_ptr = o_ptr;  //If wonky equips happen, check here

                /* Modify quantity */
                i_ptr.number = (byte)num;

                /* Decrease the item (from the pack) */
                Object.Object.inven_item_increase(item, -num);
                Object.Object.inven_item_optimize(item);

                /* Get the wield slot */
                //o_ptr = p.inventory[slot];

                /* Wear the new stuff */
                //object_copy(o_ptr, i_ptr);
                p.inventory[slot] = i_ptr;

                /* Increase the weight */
                p.total_weight += i_ptr.weight * i_ptr.number;

                /* Increment the equip counter by hand */
                p.equip_cnt++;
            }

            Object.Object.save_quiver_size(p);

            return;
        }
Example #4
0
        /*
         * Init players with some belongings
         *
         * Having an item identifies it and makes the player "aware" of its purpose.
         */
        static void player_outfit(Player.Player p)
        {
            //Object.Object object_type_body = new Object.Object();

            /* Give the player starting equipment */
            for (Start_Item si = Player.Player.instance.Class.start_items; si != null; si = si.next)
            {
                /* Get local object */
                Object.Object i_ptr = new Object.Object();

                /* Prepare the item */
                i_ptr.prep(si.kind, 0, aspect.MINIMISE);
                i_ptr.number = (byte)Random.rand_range(si.min, si.max);
                i_ptr.origin = Origin.BIRTH;

                i_ptr.flavor_aware();
                i_ptr.notice_everything();

                i_ptr.inven_carry(p);
                si.kind.everseen = true;

                /* Deduct the cost of the item from starting cash */
                p.au -= i_ptr.value(i_ptr.number, false);
            }

            /* Sanity check */
            if (p.au < 0)
                p.au = 0;

            /* Now try wielding everything */
            wield_all(p);
        }
Example #5
0
 public static void health_track(Player.Player p, int m_idx)
 {
     p.health_who = (short)m_idx;
     p.redraw |= Misc.PR_HEALTH;
 }
Example #6
0
        /*
         * Something has happened to disturb the player.
         *
         * The first arg indicates a major disturbance, which affects search.
         *
         * The second arg is currently unused, but could induce output flush.
         *
         * All disturbance cancels repeated commands, resting, and running.
         */
        public static void disturb(Player.Player p, int stop_search, int unused_flag)
        {
            /* Unused parameter */
            //(void)unused_flag;

            /* Cancel repeated commands */
            Game_Command.cancel_repeat();

            /* Cancel Resting */
            if (p.resting != 0) {
                p.resting = 0;
                p.redraw |= Misc.PR_STATE;
            }

            /* Cancel running */
            if (p.running != 0) {
                Misc.p_ptr.running = 0;

                /* Check for new panel if appropriate */
                if (Option.center_player.value) Xtra2.verify_panel();
                p.update |= Misc.PU_TORCH;
            }

            /* Cancel searching if requested */
            if (stop_search != 0 && p.searching != 0)
            {
                p.searching = 0; //false
                p.update |= Misc.PU_BONUS;
                p.redraw |= Misc.PR_STATE;
            }

            /* Flush input */
            Utilities.flush();
        }