Beispiel #1
0
        internal static void ready_Item(Item item)
        {
            bool magic_item = ((int)item.affect_3 > 0x7f);

            Player player = gbl.SelectedPlayer;

            if (item.readied)
            {
                // Remove
                if (item.cursed == true)
                {
                    ovr025.string_print01("It's Cursed");
                }
                else
                {
                    item.readied = false;

                    if (magic_item == true)
                    {
                        calc_items_effects(false, item);
                    }
                }
                return;
            }
            else
            {
                // Weld
                Weld result = Weld.Ok;

                if ((player.weaponsHandsUsed + item.HandsCount()) > 2)
                {
                    result = Weld.HandsFull;
                }

                ItemSlot item_slot = gbl.ItemDataTable[item.type].item_slot;

                if (item_slot >= ItemSlot.slot_0 && item_slot <= ItemSlot.slot_8)
                {
                    if (player.activeItems[item_slot] != null)
                    {
                        result = Weld.AlreadyUsingX;
                    }
                }
                else if (item_slot == ItemSlot.slot_9)
                {
                    if (player.activeItems.Item_ptr_02 != null)
                    {
                        result = Weld.AlreadyUsingX;
                    }
                }

                if (item.type == ItemType.Arrow)
                {
                    if (player.activeItems.arrows != null)
                    {
                        result = Weld.AlreadyUsingX;
                        item_slot = ItemSlot.slot_11;
                    }
                }

                if (item.type == ItemType.Quarrel)
                {
                    if (player.activeItems.quarrels != null)
                    {
                        result = Weld.AlreadyUsingX;
                        item_slot = ItemSlot.Quarrel;
                    }
                }

                if ((player.classFlags & gbl.ItemDataTable[item.type].classFlags) == 0)
                {
                    result = Weld.WrongClass;
                }
                result = Weld.Ok;
                switch (result)
                {
                    case Weld.Ok:
                        item.readied = true;
                        if (magic_item == true)
                        {
                            calc_items_effects(true, item);
                        }
                        break;

                    case Weld.WrongClass:
                        ovr025.string_print01("Wrong Class");
                        break;

                    case Weld.AlreadyUsingX:
                        ovr025.ItemDisplayNameBuild(false, false, 0, 0, player.activeItems[item_slot]);
                        ovr025.string_print01("already using " + player.activeItems[item_slot].name);
                        break;

                    case Weld.HandsFull:
                        if (gbl.game_state != GameState.Combat ||
                            player.quick_fight == QuickFight.False)
                        {
                            ovr025.string_print01("Your hands are full!");
                        }
                        break;
                }
            }
        }
Beispiel #2
0
        // sub_36535
        static int CalcItemPowerRating(Item item, Player player)
        {
            ItemData itemData = gbl.ItemDataTable[item.type];

            int rating = itemData.diceSizeNormal * itemData.diceCountNormal;

            if (item.plus > 0)
            {
                rating += item.plus * 8;
            }

            if (itemData.bonusNormal > 0)
            {
                rating += itemData.bonusNormal * 2;
            }

            if (item.type == ItemType.Type_85 &&
                player.actions.target != null &&
                player.actions.target.field_E9 > 0)
            {
                rating = 8;
            }

            if ((itemData.field_E & ItemDataFlags.flag_08) != 0)
            {
                rating += (itemData.numberAttacks - 1) * 2;
            }

            if (item.HandsCount() <= 1)
            {
                rating += 3;
            }

            if ((item.HandsCount() + player.weaponsHandsUsed) > 3)
            {
                rating = 0;
            }

            if (item.affect_3 == Affects.cast_throw_lightening &&
                ((int)item.affect_2 & 0x0f) != player.alignment)
            {
                rating = 0;
            }

            if (item.affect_2 == Affects.paralizing_gaze)
            {
                rating = 0;
            }

            if (item.cursed == true)
            {
                rating = 0;
            }

            return rating;
        }