Example #1
0
        public void set_arg_choice(int n, int choice)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_CHOICE) != 0);

            arg[n]         = new cmd_arg();
            arg[n].value   = choice;
            arg_type[n]    = cmd_arg_type.arg_CHOICE;
            arg_present[n] = true;
        }
Example #2
0
        public void set_arg_number(int n, int num)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_NUMBER) != 0);

            arg[n]         = new cmd_arg();
            arg[n].value   = num;
            arg_type[n]    = cmd_arg_type.arg_NUMBER;
            arg_present[n] = true;
        }
Example #3
0
        public void set_arg_direction(int n, int dir)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_DIRECTION) != 0);

            arg[n]         = new cmd_arg();
            arg[n].value   = dir;
            arg_type[n]    = cmd_arg_type.arg_DIRECTION;
            arg_present[n] = true;
        }
Example #4
0
        public void set_arg_choice(int n, string choice)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_STRING) != 0);

            arg[n]         = new cmd_arg();
            arg[n].text    = choice;
            arg_type[n]    = cmd_arg_type.arg_STRING;
            arg_present[n] = true;
        }
Example #5
0
        public void set_arg_item(int n, int item)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_ITEM) != 0);

            arg[n]         = new cmd_arg();
            arg[n].value   = item;
            arg_type[n]    = cmd_arg_type.arg_ITEM;
            arg_present[n] = true;
        }
Example #6
0
        public void set_arg_point(int n, int x, int y)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_POINT) != 0);

            arg[n]         = new cmd_arg();
            arg[n].point   = new Loc();
            arg[n].point.x = x;
            arg[n].point.y = y;
            arg_type[n]    = cmd_arg_type.arg_POINT;
            arg_present[n] = true;
        }
Example #7
0
 public static void save_game(Command_Code code, cmd_arg[] args)
 {
     Files.save_game();
 }
Example #8
0
        /* Cast a spell from a book */
        public static void cast(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int spell = args[0].choice;
            //int dir = args[1].direction;

            //int item_list[INVEN_TOTAL + MAX_FLOOR_STACK];
            //int item_num;
            //int i;

            //const char *verb = ((p_ptr.class.spell_book == TV_MAGIC_BOOK) ? "cast" : "recite");
            //const char *noun = ((p_ptr.class.spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer");

            ///* Check the player can cast spells at all */
            //if (!player_can_cast())
            //    return;

            ///* Check spell is in a book they can access */
            //item_tester_hook = obj_can_browse;
            //item_num = scan_items(item_list, N_ELEMENTS(item_list), (USE_INVEN | USE_FLOOR));

            ///* Check through all available books */
            //for (i = 0; i < item_num; i++)
            //{
            //    if (spell_in_book(spell, item_list[i]))
            //    {
            //        if (spell_okay_to_cast(spell))
            //        {
            //            /* Get the spell */
            //            const magic_type *s_ptr = &p_ptr.class.spells.info[spell];

            //            /* Verify "dangerous" spells */
            //            if (s_ptr.smana > p_ptr.csp)
            //            {
            //                /* Warning */
            //                msg("You do not have enough mana to %s this %s.", verb, noun);

            //                /* Flush input */
            //                flush();

            //                /* Verify */
            //                if (!get_check("Attempt it anyway? ")) return;
            //            }

            //            /* Cast a spell */
            //            if (spell_cast(spell, dir))
            //                p_ptr.energy_use = 100;
            //        }
            //        else
            //        {
            //            /* Spell is present, but player incapable. */
            //            msg("You cannot %s that %s.", verb, noun);
            //        }

            //        return;
            //    }
            //}
        }
Example #9
0
        /**
         * Fire an object from the quiver, pack or floor at a target.
         */
        public static void fire(Command_Code code, cmd_arg[] args)
        {
            int item = args[0].value;
            int dir = args[1].value;
            int range = 6 + 2 * Misc.p_ptr.state.ammo_mult;
            int shots = Misc.p_ptr.state.num_shots;

            Attack.ranged_attack attack = Attack.make_ranged_shot;

            Object.Object j_ptr = Misc.p_ptr.inventory[Misc.INVEN_BOW];
            Object.Object o_ptr = Object.Object.object_from_item_idx(item);

            /* Require a usable launcher */
            if (j_ptr.tval == 0 || Misc.p_ptr.state.ammo_tval == 0) {
                Utilities.msg("You have nothing to fire with.");
                return;
            }

            /* Check the item being fired is usable by the player. */
            if (!Object.Object.item_is_available(item, null, Misc.USE_EQUIP | Misc.USE_INVEN | Misc.USE_FLOOR)) {
                Utilities.msg("That item is not within your reach.");
                return;
            }

            /* Check the ammo can be used with the launcher */
            if (o_ptr.tval != Misc.p_ptr.state.ammo_tval) {
                Utilities.msg("That ammo cannot be fired by your current weapon.");
                return;
            }

            Attack.ranged_helper(item, dir, range, shots, attack);
        }
Example #10
0
        public void set_arg_number(int n, int num)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_NUMBER) != 0);

            arg[n] = new cmd_arg();
            arg[n].value = num;
            arg_type[n] = cmd_arg_type.arg_NUMBER;
            arg_present[n] = true;
        }
Example #11
0
        /* Destroy an item */
        public static void destroy(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //object_type *o_ptr;
            //int item = args[0].item;

            //if (!item_is_available(item, null, USE_INVEN | USE_EQUIP | USE_FLOOR))
            //{
            //    msg("You do not have that item to ignore it.");
            //    return;
            //}

            //o_ptr = object_from_item_idx(item);

            //if ((item >= INVEN_WIELD) && cursed_p(o_ptr.flags)) {
            //    msg("You cannot ignore cursed items.");
            //} else {
            //    char o_name[80];

            //    object_desc(o_name, sizeof o_name, o_ptr, ODESC_PREFIX | ODESC_FULL);
            //    msgt(MSG_DESTROY, "Ignoring %s.", o_name);

            //    o_ptr.ignore = true;
            //    p_ptr.notice |= PN_SQUELCH;
            //}
        }
Example #12
0
        public void set_arg_choice(int n, int choice)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_CHOICE) != 0);

            arg[n] = new cmd_arg();
            arg[n].value = choice;
            arg_type[n] = cmd_arg_type.arg_CHOICE;
            arg_present[n] = true;
        }
Example #13
0
        public void set_arg_direction(int n, int dir)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_DIRECTION) != 0);

            arg[n] = new cmd_arg();
            arg[n].value = dir;
            arg_type[n] = cmd_arg_type.arg_DIRECTION;
            arg_present[n] = true;
        }
Example #14
0
        /*
         * Open a closed/locked/jammed door or a closed/locked chest.
         *
         * Unlocking a locked door/chest is worth one experience point.
         */
        public static void open(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int y, x, dir;

            //s16b o_idx;

            //bool more = false;

            //dir = args[0].direction;

            ///* Get location */
            //y = p_ptr.py + ddy[dir];
            //x = p_ptr.px + ddx[dir];

            ///* Check for chests */
            //o_idx = chest_check(y, x);

            ///* Verify legality */
            //if (!o_idx && !do_cmd_open_test(y, x))
            //{
            //    /* Cancel repeat */
            //    disturb(p_ptr, 0, 0);
            //    return;
            //}

            ///* Take a turn */
            //p_ptr.energy_use = 100;

            ///* Apply confusion */
            //if (player_confuse_dir(p_ptr, &dir, false))
            //{
            //    /* Get location */
            //    y = p_ptr.py + ddy[dir];
            //    x = p_ptr.px + ddx[dir];

            //    /* Check for chest */
            //    o_idx = chest_check(y, x);
            //}

            ///* Monster */
            //if (cave.m_idx[y][x] > 0)
            //{
            //    int m_idx = cave.m_idx[y][x];

            //    /* Mimics surprise the player */
            //    if (is_mimicking(m_idx)) {
            //        become_aware(m_idx);

            //        /* Mimic wakes up */
            //        mon_clear_timed(m_idx, MON_TMD_SLEEP, MON_TMD_FLG_NOMESSAGE, false);
            //    } else {
            //        /* Message */
            //        msg("There is a monster in the way!");

            //        /* Attack */
            //        py_attack(y, x);
            //    }
            //}

            ///* Chest */
            //else if (o_idx)
            //{
            //    /* Open the chest */
            //    more = do_cmd_open_chest(y, x, o_idx);
            //}

            ///* Door */
            //else
            //{
            //    /* Open the door */
            //    more = do_cmd_open_aux(y, x);
            //}

            ///* Cancel repeat unless we may continue */
            //if (!more) disturb(p_ptr, 0, 0);
        }
Example #15
0
        /*
         * Start running with pathfinder.
         *
         * Note that running while confused is not allowed.
         */
        public static void pathfind(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            ///* Hack XXX XXX XXX */
            //int dir = 5;
            //if (player_confuse_dir(p_ptr, &dir, true))
            //{
            //    return;
            //}

            //if (findpath(args[0].point.x, args[0].point.y))
            //{
            //    p_ptr.running = 1000;
            //    /* Calculate torch radius */
            //    p_ptr.update |= (PU_TORCH);
            //    p_ptr.running_withpathfind = true;
            //    run_step(0);
            //}
        }
Example #16
0
        /* Add inscription */
        public static void inscribe(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //object_type *o_ptr = object_from_item_idx(args[0].item);

            //o_ptr.note = quark_add(args[1].string);

            //p_ptr.notice |= (PN_COMBINE | PN_SQUELCH | PN_SORT_QUIVER);
            //p_ptr.redraw |= (PR_INVEN | PR_EQUIP);
        }
Example #17
0
        /*
         * Walk into a trap.
         */
        public static void jump(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int x, y;
            //int dir = args[0].direction;

            ///* Apply confusion if necessary */
            //player_confuse_dir(p_ptr, &dir, false);

            ///* Verify walkability */
            //y = p_ptr.py + ddy[dir];
            //x = p_ptr.px + ddx[dir];
            //if (!do_cmd_walk_test(y, x))
            //    return;

            //p_ptr.energy_use = 100;

            //move_player(dir, false);
        }
Example #18
0
        /*
         * Stay still.  Search.  Enter stores.
         * Pick up treasure if "pickup" is true.
         */
        public static void hold(Command_Code code, cmd_arg[] args)
        {
            /* Take a turn */
            Misc.p_ptr.energy_use = 100;

            /* Spontaneous Searching */
            if ((Misc.p_ptr.state.skills[(int)Skill.SEARCH_FREQUENCY] >= 50) ||
                Random.one_in_(50 - Misc.p_ptr.state.skills[(int)Skill.SEARCH_FREQUENCY]))
            {
                Command.search(false);
            }

            /* Continuous Searching */
            if (Misc.p_ptr.searching != 0)
            {
                Command.search(false);
            }

            /* Pick things up, not using extra energy */
            Command.do_autopickup();

            /* Hack -- enter a store if we are on one */
            if ((Cave.cave.feat[Misc.p_ptr.py][Misc.p_ptr.px] >= Cave.FEAT_SHOP_HEAD) &&
                (Cave.cave.feat[Misc.p_ptr.py][Misc.p_ptr.px] <= Cave.FEAT_SHOP_TAIL))
            {
                /* Disturb */
                Cave.disturb(Misc.p_ptr, 0, 0);

                Game_Command.insert(Command_Code.ENTER_STORE);

                /* Free turn XXX XXX XXX */
                Misc.p_ptr.energy_use = 0;
            }
            else
            {
                Game_Event.signal(Game_Event.Event_Type.SEEFLOOR);
            }
        }
Example #19
0
        /*
         * Go up one level
         */
        public static void go_up(Command_Code code, cmd_arg[] args)
        {
            /* Verify stairs */
            if (Cave.cave.feat[Misc.p_ptr.py][Misc.p_ptr.px] != Cave.FEAT_LESS)
            {
                Utilities.msg("I see no up staircase here.");
                return;
            }

            /* Ironman */
            if (Option.birth_ironman.value)
            {
                Utilities.msg("Nothing happens!");
                return;
            }

            /* Hack -- take a turn */
            Misc.p_ptr.energy_use = 100;

            /* Success */
            Utilities.msgt(Message_Type.MSG_STAIRS_UP, "You enter a maze of up staircases.");

            /* Create a way back */
            Misc.p_ptr.create_up_stair = false;
            Misc.p_ptr.create_down_stair = true;

            /* Change level */
            Dungeon.dungeon_change_level(Misc.p_ptr.depth - 1);
        }
Example #20
0
        /*
         * Go down one level
         */
        public static void go_down(Command_Code code, cmd_arg[] args)
        {
            /* Verify stairs */
            if (Cave.cave.feat[Misc.p_ptr.py][Misc.p_ptr.px] != Cave.FEAT_MORE)
            {
                Utilities.msg("I see no down staircase here.");
                return;
            }

            /* Hack -- take a turn */
            Misc.p_ptr.energy_use = 100;

            /* Success */
            Utilities.msgt(Message_Type.MSG_STAIRS_DOWN, "You enter a maze of down staircases.");

            /* Create a way back */
            Misc.p_ptr.create_up_stair = true;
            Misc.p_ptr.create_down_stair = false;

            /* Change level */
            Dungeon.dungeon_change_level(Misc.p_ptr.depth + 1);
        }
Example #21
0
 /*
  * Simple command to "search" for one turn
  */
 public static void search(Command_Code code, cmd_arg[] args)
 {
     /* Only take a turn if attempted */
     if (Command.search(true))
         Misc.p_ptr.energy_use = 100;
 }
Example #22
0
        /*
         * Pick up objects on the floor beneath you.  -LM-
         */
        public static void pickup(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int energy_cost;

            ///* Pick up floor objects, forcing a menu for multiple objects. */
            //energy_cost = py_pickup(1) * 10;

            ///* Charge this amount of energy. */
            //p_ptr.energy_use = energy_cost;
        }
Example #23
0
        /*
         * Sell an item to the current store.
         */
        public static void sell(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //    int item = args[0].item;
            //    int amt = args[1].number;
            //    object_type sold_item;
            //    struct store *store = current_store();
            //    int price, dummy, value;
            //    char o_name[120];

            //    /* Get the item */
            //    object_type *o_ptr = object_from_item_idx(item);

            //    /* Cannot remove cursed objects */
            //    if ((item >= INVEN_WIELD) && cursed_p(o_ptr.flags)) {
            //        msg("Hmmm, it seems to be cursed.");
            //        return;
            //    }

            //    /* Check we are somewhere we can sell the items. */
            //    if (!store) {
            //        msg("You cannot sell items when not in a store.");
            //        return;
            //    }

            //    /* Check the store wants the items being sold */
            //    if (!store_will_buy(store, o_ptr)) {
            //        msg("I do not wish to purchase this item.");
            //        return;
            //    }

            //    /* Get a copy of the object representing the number being sold */
            //    object_copy_amt(&sold_item, o_ptr, amt);

            //    /* Check if the store has space for the items */
            //    if (!store_check_num(store, &sold_item))
            //    {
            //        msg("I have not the room in my store to keep it.");
            //        return;
            //    }

            //    price = price_item(&sold_item, true, amt);

            //    /* Get some money */
            //    p_ptr.au += price;

            //    /* Update the display */
            //    store_flags |= STORE_GOLD_CHANGE;

            //    /* Update the auto-history if selling an artifact that was previously un-IDed. (Ouch!) */
            //    if (o_ptr.artifact)
            //        history_add_artifact(o_ptr.artifact, true, true);

            //    /* Combine / Reorder the pack (later) */
            //    p_ptr.notice |= (PN_COMBINE | PN_REORDER | PN_SORT_QUIVER);

            //    /* Redraw stuff */
            //    p_ptr.redraw |= (PR_INVEN | PR_EQUIP);

            //    /* Get the "apparent" value */
            //    dummy = object_value(&sold_item, amt, false);
            ///*	msg("Dummy is %d", dummy); */

            //    /* Identify original object */
            //    object_notice_everything(o_ptr);

            //    /* Take a new copy of the now known-about object. */
            //    object_copy_amt(&sold_item, o_ptr, amt);

            //    /* The item belongs to the store now */
            //    sold_item.ident |= IDENT_STORE;

            //    /*
            //    * Hack -- Allocate charges between those wands, staves, or rods
            //    * sold and retained, unless all are being sold.
            //     */
            //    distribute_charges(o_ptr, &sold_item, amt);

            //    /* Get the "actual" value */
            //    value = object_value(&sold_item, amt, false);
            ///*	msg("Value is %d", value); */

            //    /* Get the description all over again */
            //    object_desc(o_name, sizeof(o_name), &sold_item, ODESC_PREFIX | ODESC_FULL);

            //    /* Describe the result (in message buffer) */
            //    msg("You sold %s (%c) for %ld gold.",
            //        o_name, index_to_label(item), (long)price);

            //    /* Analyze the prices (and comment verbally) */
            //    purchase_analyze(price, value, dummy);

            //    /* Set squelch flag */
            //    p_ptr.notice |= PN_SQUELCH;

            //    /* Take the object from the player */
            //    inven_item_increase(item, -amt);
            //    inven_item_optimize(item);

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

            //    /* The store gets that (known) object */
            //    store_carry(store, &sold_item);

            //    event_signal(EVENT_INVENTORY);
            //    event_signal(EVENT_EQUIPMENT);
        }
Example #24
0
        public static void refill(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //object_type *j_ptr = &p_ptr.inventory[INVEN_LIGHT];
            //bitflag f[OF_SIZE];

            //int item = args[0].item;
            //object_type *o_ptr = object_from_item_idx(item);

            //if (!item_is_available(item, null, USE_INVEN | USE_FLOOR))
            //{
            //    msg("You do not have that item to refill with it.");
            //    return;
            //}

            ///* Check what we're wielding. */
            //object_flags(j_ptr, f);

            //if (j_ptr.tval != TV_LIGHT)
            //{
            //    msg("You are not wielding a light.");
            //    return;
            //}

            //else if (of_has(f, OF_NO_FUEL))
            //{
            //    msg("Your light cannot be refilled.");
            //    return;
            //}

            ///* It's a lamp */
            //if (j_ptr.sval == SV_LIGHT_LANTERN)
            //    refill_lamp(j_ptr, o_ptr, item);

            ///* It's a torch */
            //else if (j_ptr.sval == SV_LIGHT_TORCH)
            //    refuel_torch(j_ptr, o_ptr, item);

            //p_ptr.energy_use = 50;
        }
Example #25
0
        public void set_arg_choice(int n, string choice)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_STRING) != 0);

            arg[n] = new cmd_arg();
            arg[n].text = choice;
            arg_type[n] = cmd_arg_type.arg_STRING;
            arg_present[n] = true;
        }
Example #26
0
        /*
         * Disarms a trap, or a chest
         */
        public static void disarm(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int y, x, dir;

            //s16b o_idx;

            //bool more = false;

            //dir = args[0].direction;

            ///* Get location */
            //y = p_ptr.py + ddy[dir];
            //x = p_ptr.px + ddx[dir];

            ///* Check for chests */
            //o_idx = chest_check(y, x);

            ///* Verify legality */
            //if (!o_idx && !do_cmd_disarm_test(y, x))
            //{
            //    /* Cancel repeat */
            //    disturb(p_ptr, 0, 0);
            //    return;
            //}

            ///* Take a turn */
            //p_ptr.energy_use = 100;

            ///* Apply confusion */
            //if (player_confuse_dir(p_ptr, &dir, false))
            //{
            //    /* Get location */
            //    y = p_ptr.py + ddy[dir];
            //    x = p_ptr.px + ddx[dir];

            //    /* Check for chests */
            //    o_idx = chest_check(y, x);
            //}

            ///* Monster */
            //if (cave.m_idx[y][x] > 0) {
            //    msg("There is a monster in the way!");
            //    py_attack(y, x);
            //}

            ///* Chest */
            //else if (o_idx)
            //    more = do_cmd_disarm_chest(y, x, o_idx);

            ///* Door to lock */
            //else if (cave.feat[y][x] == FEAT_DOOR_HEAD)
            //    more = do_cmd_lock_door(y, x);

            ///* Disarm trap */
            //else
            //    more = do_cmd_disarm_aux(y, x);

            ///* Cancel repeat unless told not to */
            //if (!more) disturb(p_ptr, 0, 0);
        }
Example #27
0
        public void set_arg_item(int n, int item)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_ITEM) != 0);

            arg[n] = new cmd_arg();
            arg[n].value = item;
            arg_type[n] = cmd_arg_type.arg_ITEM;
            arg_present[n] = true;
        }
Example #28
0
 public static void alter(Command_Code code, cmd_arg[] args)
 {
     Do_Command.alter_aux(args[0].value);
 }
Example #29
0
        public void set_arg_point(int n, int x, int y)
        {
            int idx = cmd_idx(command);

            Misc.assert(n <= CMD_MAX_ARGS);
            Misc.assert((game_cmds[idx].arg_type[n] & cmd_arg_type.arg_POINT) != 0);

            arg[n] = new cmd_arg();
            arg[n].point = new Loc();
            arg[n].point.x = x;
            arg[n].point.y = y;
            arg_type[n] = cmd_arg_type.arg_POINT;
            arg_present[n] = true;
        }
Example #30
0
        /*
         * Retrieve the item with the given index from the home's inventory.
         */
        public static void retrieve(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int item = args[0].item;
            //int amt = args[1].number;

            //object_type *o_ptr;
            //object_type picked_item;
            //char o_name[80];
            //int item_new;

            //struct store *store = current_store();

            //if (store.sidx != STORE_HOME) {
            //    msg("You are not currently at home.");
            //    return;
            //}

            ///* Get the actual object */
            //o_ptr = &store.stock[item];

            ///* Get desired object */
            //object_copy_amt(&picked_item, o_ptr, amt);

            ///* Ensure we have room */
            //if (!inven_carry_okay(&picked_item))
            //{
            //    msg("You cannot carry that many items.");
            //    return;
            //}

            ///* Distribute charges of wands, staves, or rods */
            //distribute_charges(o_ptr, &picked_item, amt);

            ///* Give it to the player */
            //item_new = inven_carry(p_ptr, &picked_item);

            ///* Describe just the result */
            //object_desc(o_name, sizeof(o_name), &p_ptr.inventory[item_new],
            //            ODESC_PREFIX | ODESC_FULL);

            ///* Message */
            //msg("You have %s (%c).", o_name, index_to_label(item_new));

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

            ///* Remove the items from the home */
            //store_item_increase(store, item, -amt);
            //store_item_optimize(store, item);

            //event_signal(EVENT_INVENTORY);
            //event_signal(EVENT_EQUIPMENT);
        }
Example #31
0
        /*
         * Close an open door.
         */
        public static void close(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int y, x, dir;

            //bool more = false;

            //dir = args[0].direction;

            ///* Get location */
            //y = p_ptr.py + ddy[dir];
            //x = p_ptr.px + ddx[dir];

            ///* Verify legality */
            //if (!do_cmd_close_test(y, x))
            //{
            //    /* Cancel repeat */
            //    disturb(p_ptr, 0, 0);
            //    return;
            //}

            ///* Take a turn */
            //p_ptr.energy_use = 100;

            ///* Apply confusion */
            //if (player_confuse_dir(p_ptr, &dir, false))
            //{
            //    /* Get location */
            //    y = p_ptr.py + ddy[dir];
            //    x = p_ptr.px + ddx[dir];
            //}

            ///* Monster */
            //if (cave.m_idx[y][x] > 0)
            //{
            //    /* Message */
            //    msg("There is a monster in the way!");

            //    /* Attack */
            //    py_attack(y, x);
            //}

            ///* Door */
            //else
            //{
            //    /* Close door */
            //    more = do_cmd_close_aux(y, x);
            //}

            ///* Cancel repeat unless told not to */
            //if (!more) disturb(p_ptr, 0, 0);
        }
Example #32
0
        /*
         * Start running.
         *
         * Note that running while confused is not allowed.
         */
        public static void run(Command_Code code, cmd_arg[] args)
        {
            int x, y;
            int dir = args[0].value;

            if (Misc.p_ptr.confuse_dir(ref dir, true))
            {
                return;
            }

            /* Get location */
            y = Misc.p_ptr.py + Misc.ddy[dir];
            x = Misc.p_ptr.px + Misc.ddx[dir];
            if (!Do_Command.walk_test(y, x))
                return;

            /* Start run */
            Pathfind.run_step(dir);
        }
Example #33
0
        /*
         * Rest (restores hit points and mana and such)
         */
        public static void rest(Command_Code code, cmd_arg[] args)
        {
            /*
             * A little sanity checking on the input - only the specified negative
             * values are valid.
             */
            if ((args[0].value < 0) &&
                ((args[0].value != (int)Misc.REST.COMPLETE) &&
                 (args[0].value != (int)Misc.REST.ALL_POINTS) &&
                 (args[0].value != (int)Misc.REST.SOME_POINTS)))
            {
                return;
            }

            /* Save the rest code */
            Misc.p_ptr.resting = (short)args[0].value;

            /* Truncate overlarge values */
            if (Misc.p_ptr.resting > 9999) Misc.p_ptr.resting = 9999;

            /* Take a turn XXX XXX XXX (?) */
            Misc.p_ptr.energy_use = 100;

            /* Cancel searching */
            Misc.p_ptr.searching = 0; //false

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

            /* Redraw the state */
            Misc.p_ptr.redraw |= (Misc.PR_STATE);

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

            /* Refresh XXX XXX XXX */
            Term.fresh();
        }
Example #34
0
        /* Drop an item */
        public static void drop(Command_Code code, cmd_arg[] args)
        {
            throw new NotImplementedException();
            //int item = args[0].item;
            //object_type* o_ptr = object_from_item_idx(item);
            //int amt = args[1].number;

            //if(!item_is_available(item, null, USE_INVEN | USE_EQUIP)) {
            //    msg("You do not have that item to drop it.");
            //    return;
            //}

            ///* Hack -- Cannot remove cursed items */
            //if((item >= INVEN_WIELD) && cursed_p(o_ptr.flags)) {
            //    msg("Hmmm, it seems to be cursed.");
            //    return;
            //}

            //inven_drop(item, amt);
            //p_ptr.energy_use = 50;
        }
Example #35
0
 /*
  * Pick up objects on the floor beneath you.  -LM-
  */
 public static void autopickup(Command_Code code, cmd_arg[] args)
 {
     throw new NotImplementedException();
     //p_ptr.energy_use = do_autopickup() * 10;
 }
Example #36
0
        /* Wield or wear an item */
        public static void wield(Command_Code code, cmd_arg[] args)
        {
            Object.Object equip_o_ptr;
            //char o_name[80];
            string o_name;

            int n;

            int item = args[0].value;
            int slot = args[1].value;
            Object.Object o_ptr = Object.Object.object_from_item_idx(item);

            if (!Object.Object.item_is_available(item, null, Misc.USE_INVEN | Misc.USE_FLOOR))
            {
                Utilities.msg("You do not have that item to wield.");
                return;
            }

            /* Check the slot */
            if (!o_ptr.slot_can_wield_item(slot))
            {
                Utilities.msg("You cannot wield that item there.");
                return;
            }

            equip_o_ptr = Misc.p_ptr.inventory[slot];

            /* If the slot is open, wield and be done */
            if (equip_o_ptr.kind == null)
            {
                o_ptr.wield_item(item, slot);
                return;
            }

            /* If the slot is in the quiver and objects can be combined */
            if (equip_o_ptr.is_ammo() && equip_o_ptr.similar(o_ptr, Object.Object.object_stack_t.OSTACK_QUIVER))
            {
                o_ptr.wield_item(item, slot);
                return;
            }

            /* Prevent wielding into a cursed slot */
            if (Object_Flag.cursed_p(equip_o_ptr.flags))
            {
                o_name = equip_o_ptr.object_desc(Object.Object.Detail.BASE);
                Utilities.msg("The {0} you are {1} appears to be cursed.", o_name,
                           Object.Object.describe_use(slot));
                return;
            }

            /* "!t" checks for taking off */
            n = equip_o_ptr.check_for_inscrip("!t")?1:0;
            while (n-- != 0)
            {
                /* Prompt */
                o_name = equip_o_ptr.object_desc(Object.Object.Detail.PREFIX | Object.Object.Detail.FULL);

                /* Forget it */
                if (!Utilities.get_check(String.Format("Really take off {0}? ", o_name))) return;
            }

            o_ptr.wield_item(item, slot);
        }