示例#1
0
文件: ovr020.cs 项目: gowantervo/coab
        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;
                }
            }
        }
示例#2
0
文件: ovr020.cs 项目: gowantervo/coab
        /*sub_56285*/
        internal static void join_items(Item item)
        {
            var actual = gbl.SelectedPlayer.items.Find(i => i == item);

            var match = gbl.SelectedPlayer.items.FindAll(i =>
                {
                    return (i != item &&
                    i.count > 0 &&
                    i.namenum1 == item.namenum1 &&
                    i.namenum2 == item.namenum2 &&
                    i.namenum3 == item.namenum3 &&
                    i.type == item.type &&
                    i.plus == item.plus &&
                    i.plus_save == item.plus_save &&
                    i.cursed == item.cursed &&
                    i.weight == item.weight &&
                    i.affect_1 == item.affect_1 &&
                    (int)i.affect_1 < 2 &&
                    i.affect_2 == item.affect_2 &&
                    i.affect_3 == item.affect_3);
                });

            foreach (var item_ptr in match)
            {
                if (item_ptr.count + item.count <= 255)
                {
                    item.count += item_ptr.count;
                    ovr025.lose_item(item_ptr, gbl.SelectedPlayer);
                }
                else
                {
                    int tempCount = 255 - (item.count + item_ptr.count);
                    item.count = 255;
                    item_ptr.count = tempCount;

                    item = item_ptr;
                }
            }
        }
示例#3
0
文件: ovr020.cs 项目: gowantervo/coab
        /*sub_55B04*/
        internal static void calc_items_effects(bool add_item, Item item)
        {
            Player player = gbl.SelectedPlayer;

            int masked_affect = (int)item.affect_3 & 0x7F;

            switch (masked_affect)
            {
                case 0: // apply affect_2
                    gbl.applyItemAffect = true;
                    ovr013.CallAffectTable((add_item) ? Effect.Add : Effect.Remove, item, player, item.affect_3);
                    break;

                case 1: // ring of wizardy
                    if (add_item == true)
                    {
                        player.spellCastCount[2, 0] *= 2;
                        player.spellCastCount[2, 1] *= 2;
                        player.spellCastCount[2, 2] *= 2;
                    }
                    else
                    {
                        int muSkillLevel = player.SkillLevel(SkillType.MagicUser);

                        player.spellCastCount[2, 0] = 0;
                        player.spellCastCount[2, 1] = 0;
                        player.spellCastCount[2, 2] = 0;
                        player.spellCastCount[2, 3] = 0;
                        player.spellCastCount[2, 4] = 0;

                        player.spellCastCount[2, 0] = 1;

                        for (int sp_lvl = 0; sp_lvl < (muSkillLevel - 1); sp_lvl++)
                        {
                            /* unk_1A7C6 = seg600:44B6 */
                            player.spellCastCount[2, 0] += MU_spell_lvl_learn[sp_lvl, 0];
                            player.spellCastCount[2, 1] += MU_spell_lvl_learn[sp_lvl, 1];
                            player.spellCastCount[2, 2] += MU_spell_lvl_learn[sp_lvl, 2];
                            player.spellCastCount[2, 3] += MU_spell_lvl_learn[sp_lvl, 3];
                            player.spellCastCount[2, 4] += MU_spell_lvl_learn[sp_lvl, 4];
                        }

                        byte[] spCounts = new byte[5];
                        seg051.FillChar(0, 5, spCounts);

                        var removeList = new List<int>();

                        foreach (int id in player.spellList.IdList())
                        {
                            if (gbl.spellCastingTable[id].spellClass == SpellClass.MagicUser)
                            {
                                int spLvl = gbl.spellCastingTable[id].spellLevel - 1;
                                spCounts[spLvl] += 1;

                                if (spCounts[spLvl] > player.spellCastCount[2, spLvl])
                                {
                                    removeList.Add(id);
                                }
                            }
                        }

                        foreach (var id in removeList)
                        {
                            player.spellList.ClearSpell(id);
                        }
                    }
                    break;

                case 2: // Gauntlets of Dexterity
                    ovr024.CalcStatBonuses(Stat.DEX, player);
                    ovr026.reclac_thief_skills(player);
                    break;

                case 4:
                    if (((int)item.affect_2 & 0x0f) != player.alignment)
                    {
                        item.readied = false;
                        int damage = (int)item.affect_2 << 4;

                        gbl.damage_flags = DamageType.Magic;
                        if (gbl.game_state == GameState.Combat)
                        {
                            ovr025.RedrawCombatScreen();
                        }

                        ovr024.damage_person(false, 0, damage, player);
                        gbl.byte_1D2C8 = true;
                    }
                    break;

                case 5:
                    ovr024.CalcStatBonuses(Stat.STR, player);
                    break;

                case 6: // Girdle of the Dwarves
                    ovr024.CalcStatBonuses(Stat.CON, player);
                    ovr024.CalcStatBonuses(Stat.CHA, player);
                    break;

                case 8: //Ioun Stone
                    switch ((int)item.affect_2)
                    {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                            ovr024.CalcStatBonuses((Stat)item.affect_2, player);
                            break;
                    }
                    break;

                case 9:
                    if (add_item == false)
                    {
                        ovr024.remove_affect(null, Affects.spiritual_hammer, player);
                    }
                    break;

                case 10:
                    ovr024.CalcStatBonuses(Stat.DEX, player);
                    break;

                case 11: // Gloves of Thievery
                    ovr026.reclac_thief_skills(player);
                    break;

                case 12:
                    ovr024.CalcStatBonuses(Stat.INT, player);
                    break;

                case 13:
                    ovr024.CalcStatBonuses(Stat.STR, player);
                    ovr024.CalcStatBonuses(Stat.INT, player);
                    break;
            }
        }
示例#4
0
文件: ovr014.cs 项目: gowantervo/coab
        // sub_3F4EB
        internal static bool AttackTarget01(Item item, int arg_8, Player target, Player attacker)
        {
            int target_ac;
            bool turnComplete = true;
            bool BehindAttack = arg_8 != 0;
            turnComplete = false;
            gbl.bytes_1D2C9[1] = 0;
            gbl.bytes_1D2C9[2] = 0;
            gbl.bytes_1D900[1] = 0;
            gbl.bytes_1D900[2] = 0;
            bool var_11 = false;
            bool targetNotInCombat = false;
            gbl.damage = 0;

            attacker.actions.field_8 = true;

            if (target.IsHeld() == true)
            {
                seg044.PlaySound(Sound.sound_attackHeld);

                while (attacker.AttacksLeft(attacker.actions.attackIdx) == 0)
                {
                    attacker.actions.attackIdx--;
                }

                gbl.bytes_1D900[attacker.actions.attackIdx] += 1;

                DisplayAttackMessage(true, 1, target.hit_point_current + 5, AttackType.Slay, target, attacker);
                ovr024.remove_invisibility(attacker);

                attacker.attack1_AttacksLeft = 0;
                attacker.attack2_AttacksLeft = 0;

                var_11 = true;
                turnComplete = true;
            }
            else
            {
                if (attacker.activeItems.primaryWeapon != null &&
                    (target.field_DE > 0x80 || (target.field_DE & 7) > 1))
                {
                    ItemData itemData = gbl.ItemDataTable[attacker.activeItems.primaryWeapon.type];

                    attacker.attack1_DiceCount = itemData.diceCountLarge;
                    attacker.attack1_DiceSize = itemData.diceSizeLarge;
                    attacker.attack1_DamageBonus -= itemData.bonusNormal;
                    attacker.attack1_DamageBonus += itemData.bonusLarge;
                }

                ovr025.reclac_player_values(target);
                ovr024.CheckAffectsEffect(target, CheckType.Type_11);

                if (CanBackStabTarget(target, attacker) == true)
                {
                    target_ac = target.ac_behind - 4;
                }
                else
                {
                    if (target.actions.AttacksReceived > 1 &&
                        getTargetDirection(target, attacker) == target.actions.direction &&
                        target.actions.directionChanges > 4)
                    {
                        BehindAttack = true;
                    }

                    if (BehindAttack == true)
                    {
                        target_ac = target.ac_behind;
                    }
                    else
                    {
                        target_ac = target.ac;
                    }
                }

                target_ac += RangedDefenseBonus(target, attacker);
                AttackType attack_type = AttackType.Normal;
                if (BehindAttack == true)
                {
                    attack_type = AttackType.Behind;
                }

                if (CanBackStabTarget(target, attacker) == true)
                {
                    attack_type = AttackType.Backstab;
                }

                for (int attackIdx = attacker.actions.attackIdx; attackIdx >= 1; attackIdx--)
                {
                    while (attacker.AttacksLeft(attackIdx) > 0 &&
                        targetNotInCombat == false)
                    {
                        attacker.AttacksLeftDec(attackIdx);
                        attacker.actions.attackIdx = attackIdx;

                        gbl.bytes_1D900[attackIdx] += 1;

                        if (ovr024.PC_CanHitTarget(target_ac, target, attacker) ||
                            target.IsHeld() == true)
                        {
                            gbl.bytes_1D2C9[attackIdx] += 1;

                            seg044.PlaySound(Sound.sound_attackHeld);
                            var_11 = true;
                            sub_3E192(attackIdx, target, attacker);
                            DisplayAttackMessage(true, gbl.damage, gbl.damage, attack_type, target, attacker);

                            if (target.in_combat == true)
                            {
                                ovr024.CheckAffectsEffect(attacker, (CheckType)attackIdx + 1);
                            }

                            if (target.in_combat == false)
                            {
                                targetNotInCombat = true;
                            }

                            if (attacker.in_combat == false)
                            {
                                attacker.AttacksLeftSet(attackIdx, 0);
                            }
                        }
                    }
                }

                if (item != null &&
                    item.count == 0 &&
                    item.type == ItemType.DartOfHornetsNest)
                {
                    attacker.attack1_AttacksLeft = 0;
                    attacker.attack2_AttacksLeft = 0;
                }

                if (var_11 == false)
                {
                    seg044.PlaySound(Sound.sound_9);
                    DisplayAttackMessage(false, 0, 0, attack_type, target, attacker);
                }

                turnComplete = true;
                if (attacker.attack1_AttacksLeft > 0 ||
                    attacker.attack2_AttacksLeft > 0)
                {
                    turnComplete = false;
                }

                attacker.actions.maxSweapTargets = 0;
            }

            if (attacker.in_combat == false)
            {
                turnComplete = true;
            }

            if (turnComplete == true)
            {
                ovr025.clear_actions(attacker);
            }

            return turnComplete;
        }
示例#5
0
文件: ovr020.cs 项目: gowantervo/coab
        /*sub_550A6*/
        internal static void ItemDisplayStats(Item arg_0)
        {
            seg037.DrawFrame_Outer();

            seg041.displayString("itemptr:      ", 0, 10, 1, 1);
            seg041.displayString(arg_0.type.ToString(), 0, 10, 1, 0x14);

            seg041.displayString("namenum(1):   ", 0, 10, 2, 1);
            seg041.displayString(arg_0.namenum1.ToString(), 0, 10, 2, 0x14);

            seg041.displayString("namenum(2):   ", 0, 10, 3, 1);
            seg041.displayString(arg_0.namenum2.ToString(), 0, 10, 3, 0x14);

            seg041.displayString("namenum(3):   ", 0, 10, 4, 1);
            seg041.displayString(arg_0.namenum3.ToString(), 0, 10, 4, 0x14);

            seg041.displayString("plus:         ", 0, 10, 5, 1);
            seg041.displayString(arg_0.plus.ToString(), 0, 10, 5, 0x14);

            seg041.displayString("plussave:     ", 0, 10, 6, 1);
            seg041.displayString(arg_0.plus_save.ToString(), 0, 10, 6, 0x14);

            seg041.displayString("ready:        ", 0, 10, 7, 1);
            seg041.displayString(arg_0.readied.ToString(), 0, 10, 7, 0x14);

            seg041.displayString("identified:   ", 0, 10, 8, 1);
            seg041.displayString(arg_0.hidden_names_flag.ToString(), 0, 10, 8, 0x14);

            seg041.displayString("cursed:       ", 0, 10, 9, 1);
            seg041.displayString(arg_0.cursed.ToString(), 0, 10, 9, 0x14);

            seg041.displayString("value:        ", 0, 10, 10, 1);
            seg041.displayString(arg_0._value.ToString(), 0, 10, 10, 0x14);

            seg041.displayString("special(1):   ", 0, 10, 11, 1);
            seg041.displayString(arg_0.affect_1.ToString(), 0, 10, 11, 0x14);

            seg041.displayString("special(2):   ", 0, 10, 12, 1);
            seg041.displayString(arg_0.affect_2.ToString(), 0, 10, 12, 0x14);

            seg041.displayString("special(3):   ", 0, 10, 13, 1);
            seg041.displayString(arg_0.affect_3.ToString(), 0, 10, 13, 0x14);

            seg041.displayString("dice large:   ", 0, 10, 14, 1);
            seg041.displayString(gbl.ItemDataTable[arg_0.type].diceCountLarge.ToString(), 0, 10, 14, 0x14);

            seg041.displayString("sides large:  ", 0, 10, 15, 1);
            seg041.displayString(gbl.ItemDataTable[arg_0.type].diceSizeLarge.ToString(), 0, 10, 15, 0x14);

            seg041.DisplayAndPause("press a key", 10);
        }
示例#6
0
文件: ovr007.cs 项目: gowantervo/coab
        private static int ItemsValue(Item item_ptr)
        {
            int val;
            switch (gbl.area2_ptr.field_6DA)
            {
                case 0x01:
                    val = item_ptr._value >> 4;
                    break;

                case 0x02:
                    val = item_ptr._value >> 3;
                    break;

                case 0x04:
                    val = item_ptr._value >> 2;
                    break;

                case 0x08:
                    val = item_ptr._value >> 1;
                    break;

                case 0x20:
                    val = item_ptr._value << 1;
                    break;

                case 0x40:
                    val = item_ptr._value << 2;
                    break;

                case 0x80:
                    val = item_ptr._value << 3;
                    break;

                default:
                    val = item_ptr._value;
                    break;
            }
            return val;
        }
示例#7
0
文件: ovr022.cs 项目: gowantervo/coab
        /// <summary>
        /// Turns if pictures need re-loading
        /// </summary>
        internal static bool appraiseGemsJewels()
        {
            bool special_key;
            short value;
            string sell_text;

            if (gbl.SelectedPlayer.Money.Gems == 0 && gbl.SelectedPlayer.Money.Jewels == 0)
            {
                ovr025.string_print01("No Gems or Jewelry");
                return false;
            }

            bool stop_loop;

            do
            {
                if (gbl.SelectedPlayer.Money.Gems == 0 && gbl.SelectedPlayer.Money.Jewels == 0)
                {
                    stop_loop = true;
                }
                else
                {
                    stop_loop = false;

                    string gem_text = gbl.SelectedPlayer.Money.Gems.ToString();
                    string jewel_text = gbl.SelectedPlayer.Money.Jewels.ToString();

                    if (gbl.SelectedPlayer.Money.Gems == 0)
                    {
                        gem_text = string.Empty;
                    }
                    else if (gbl.SelectedPlayer.Money.Gems == 1)
                    {
                        gem_text += " Gem";
                    }
                    else
                    {
                        gem_text += " Gems";
                    }

                    if (gbl.SelectedPlayer.Money.Jewels == 0)
                    {
                        jewel_text = string.Empty;
                    }
                    else if (gbl.SelectedPlayer.Money.Jewels == 1)
                    {
                        jewel_text += " piece of Jewelry";
                    }
                    else
                    {
                        jewel_text += " pieces of Jewelry";
                    }

                    seg037.draw8x8_clear_area(0x16, 0x26, 1, 1);
                    ovr025.displayPlayerName(false, 1, 1, gbl.SelectedPlayer);

                    seg041.displayString("You have a fine collection of:", 0, 0xf, 7, 1);
                    seg041.displayString(gem_text, 0, 0x0f, 9, 1);
                    seg041.displayString(jewel_text, 0, 0x0f, 0x0a, 1);
                    string prompt = string.Empty;

                    if (gbl.SelectedPlayer.Money.Gems != 0)
                    {
                        prompt = "  Gems";
                    }

                    if (gbl.SelectedPlayer.Money.Jewels != 0)
                    {
                        prompt += " Jewelry";
                    }

                    prompt += " Exit";

                    char input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, prompt, "Appraise : ");

                    if (input_key == 'G')
                    {
                        if (gbl.SelectedPlayer.Money.Gems > 0)
                        {
                            gbl.SelectedPlayer.Money.AddCoins(Money.Gems, -1);

                            int roll = ovr024.roll_dice(100, 1);

                            if (roll >= 1 && roll <= 25)
                            {
                                value = 10;
                            }
                            else if (roll >= 26 && roll <= 50)
                            {
                                value = 50;
                            }
                            else if (roll >= 51 && roll <= 70)
                            {
                                value = 100;
                            }
                            else if (roll >= 71 && roll <= 90)
                            {
                                value = 500;
                            }
                            else if (roll >= 91 && roll <= 99)
                            {
                                value = 1000;
                            }
                            else if (roll == 100)
                            {
                                value = 5000;
                            }
                            else
                            {
                                value = 0;
                            }

                            string value_text = "The Gem is Valued at " + value.ToString() + " gp.";

                            seg041.displayString(value_text, 0, 15, 12, 1);

                            bool must_sell;

                            if (willOverload(1, gbl.SelectedPlayer) == true ||
                                gbl.SelectedPlayer.items.Count >= Player.MaxItems)
                            {
                                sell_text = "Sell";
                                must_sell = true;
                            }
                            else
                            {
                                sell_text = "Sell Keep";
                                must_sell = false;
                            }

                            input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, sell_text, "You can : ");

                            if (input_key == 'K' && must_sell == false)
                            {
                                Item gem_item = new Item(0, 0, 0, value, 0, 1, false, 0, false, 0, 0, 0x65, 0, 0, ItemType.Necklace, true);

                                gbl.SelectedPlayer.items.Add(gem_item);
                            }
                            else
                            {
                                value /= 5;
                                addPlayerGold(value);
                            }
                        }
                    }
                    else if (input_key == 'J')
                    {
                        if (gbl.SelectedPlayer.Money.Jewels > 0)
                        {
                            gbl.SelectedPlayer.Money.AddCoins(Money.Jewelry, -1);

                            int roll = ovr024.roll_dice(100, 1);

                            if (roll >= 1 && roll <= 10)
                            {
                                value = (short)(seg051.Random(900) + 100);
                            }
                            else if (roll >= 11 && roll <= 20)
                            {
                                value = (short)(seg051.Random(1000) + 200);
                            }
                            else if (roll >= 21 && roll <= 40)
                            {
                                value = (short)(seg051.Random(1500) + 300);
                            }
                            else if (roll >= 41 && roll <= 50)
                            {
                                value = (short)(seg051.Random(2500) + 500);
                            }
                            else if (roll >= 51 && roll <= 70)
                            {
                                value = (short)(seg051.Random(5000) + 1000);
                            }
                            else if (roll >= 0x47 && roll <= 0x5A)
                            {
                                value = (short)(seg051.Random(6000) + 2000);
                            }
                            else if (roll >= 0x5B && roll <= 0x64)
                            {
                                value = (short)(seg051.Random(10000) + 2000);
                            }
                            else
                            {
                                value = 0;
                            }

                            string value_text = string.Format("The Jewel is Valued at {0} gp.", value);
                            seg041.displayString(value_text, 0, 15, 12, 1);

                            bool must_sell;
                            if (willOverload(1, gbl.SelectedPlayer) == true ||
                                gbl.SelectedPlayer.items.Count >= Player.MaxItems)
                            {
                                sell_text = "Sell";
                                must_sell = true;
                            }
                            else
                            {
                                sell_text = "Sell Keep";
                                must_sell = false;
                            }

                            input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, sell_text, "You can : ");

                            if (input_key == 'K' && must_sell == false)
                            {
                                Item jewel_item = new Item(0, 0, 0, value, 0, 1, false, 0, false, 0, 0, 0xd6, 0, 0, ItemType.Necklace, true);

                                gbl.SelectedPlayer.items.Add(jewel_item);
                            }
                            else
                            {
                                value /= 5;
                                addPlayerGold(value);
                            }
                        }
                    }
                    else if (input_key == 'E' || input_key == 0)
                    {
                        stop_loop = true;
                    }

                    ovr025.reclac_player_values(gbl.SelectedPlayer);
                }

            } while (stop_loop == false);

            return true;
        }
示例#8
0
文件: ovr020.cs 项目: gowantervo/coab
        // sub_56478
        internal static void UseMagicItem(ref bool arg_0, Item item)
        {
            gbl.spell_from_item = false;
            int spellId = 0;

            if (item.IsScroll() == true)
            {
                gbl.currentScroll = item;

                bool dummy_bool;
                int dummy_index = -1;
                spellId = spell_menu2(out dummy_bool, ref dummy_index, SpellSource.Cast, SpellLoc.scroll);
            }
            else if (item.affect_2 > 0 && (int)item.affect_3 < 0x80)
            {
                gbl.spell_from_item = true;
                spellId = (int)item.affect_2 & 0x7F;
            }

            if (spellId == 0)
            {
                arg_0 = false;
            }
            else
            {
                if (gbl.game_state == GameState.Combat &&
                    gbl.SelectedPlayer.quick_fight == QuickFight.False)
                {
                    ovr025.RedrawCombatScreen();
                }

                if (gbl.spell_from_item == true)
                {
                    ovr025.DisplayPlayerStatusString(false, 10, "uses an item", gbl.SelectedPlayer);

                    if (gbl.game_state == GameState.Combat)
                    {
                        seg041.displayString("Item:", 0, 10, 0x17, 0);

                        ovr025.ItemDisplayNameBuild(true, false, 0x17, 5, item);
                    }
                    else
                    {
                        ovr025.ItemDisplayNameBuild(true, false, 0x16, 1, item);
                    }

                    seg041.GameDelay();
                    ovr025.ClearPlayerTextArea();
                }

                gbl.spell_from_item = true;

                if (item.IsScroll() == true)
                {
                    if (gbl.SelectedPlayer.SkillLevel(SkillType.MagicUser) > 0 ||
                        gbl.SelectedPlayer.SkillLevel(SkillType.Cleric) > 0)
                    {
                        ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                    }
                    else if (gbl.SelectedPlayer.thief_lvl > 9 &&
                            ovr024.roll_dice(100, 1) <= 75)
                    {
                        ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                    }
                    else
                    {
                        ovr025.DisplayPlayerStatusString(true, gbl.textYCol, "oops!", gbl.SelectedPlayer);
                    }
                }
                else
                {
                    ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                }

                gbl.spell_from_item = false;

                if (gbl.game_state == GameState.Combat &&
                    gbl.spellCastingTable[spellId].whenCast != SpellWhen.Camp)
                {
                    arg_0 = true;
                    ovr025.clear_actions(gbl.SelectedPlayer);
                }
            }

            if (arg_0 == true)
            {
                if (item.IsScroll() == true)
                {
                    ovr023.remove_spell_from_scroll(spellId, item, gbl.SelectedPlayer);
                }
                else if (item.affect_1 > 0)
                {
                    if (item.count > 1)
                    {
                        item.count -= 1;
                    }
                    else
                    {
                        item.affect_1 -= 1;
                        if (item.affect_1 == 0)
                        {
                            ovr025.lose_item(item, gbl.SelectedPlayer);
                        }
                    }
                }
            }
        }
示例#9
0
文件: ovr020.cs 项目: gowantervo/coab
        internal static bool canCarry(Item item, Player player)
        {
            ovr025.reclac_player_values(player);
            bool too_heavy = false;

            if (player.items.Count >= Player.MaxItems)
            {
                too_heavy = true;
            }

            int item_weight = item.weight;

            if (item.count > 0)
            {
                item_weight *= item.count;
            }

            if ((player.weight + item_weight) > (ovr025.max_encumberance(player) + 1500))
            {
                too_heavy = true;
            }

            return too_heavy;
        }
示例#10
0
文件: ovr020.cs 项目: gowantervo/coab
        // sell_Item
        internal static void ShopSellItem(Item item)
        {
            int item_value = 0;

            if (item._value > 0)
            {
                item_value = item._value / 2;
            }

            if (item.count > 1)
            {
                if (item.type != ItemType.Arrow &&
                    item.type != ItemType.Quarrel)
                {
                    item_value = (item.count * item_value) / 20;
                }
                else
                {
                    item_value *= item.count;
                }
            }

            ovr025.ItemDisplayNameBuild(false, false, 0, 0, item);

            string offer = "I'll give you " + item_value.ToString() + " gold pieces for your " + item.name;

            seg041.press_any_key(offer, true, 14, TextRegion.Normal2);

            if (ovr027.yes_no(gbl.defaultMenuColors, "Is It a Deal? ") == 'Y')
            {
                ovr025.string_print01("Sold!");

                ovr025.lose_item(item, gbl.SelectedPlayer);

                int plat = item_value / 5;
                int gold = item_value % 5;
                int overflow;

                if (ovr022.willOverload(out overflow, plat + gold, gbl.SelectedPlayer) == true)
                {
                    ovr025.string_print01("Overloaded. Money will be put in pool.");

                    if (overflow > plat)
                    {
                        gbl.SelectedPlayer.Money.AddCoins(Money.Platinum, plat);
                    }
                    else
                    {
                        gbl.SelectedPlayer.Money.AddCoins(Money.Platinum, overflow);
                        gbl.pooled_money.AddCoins(Money.Platinum, plat - overflow);
                    }

                    gbl.SelectedPlayer.Money.AddCoins(Money.Gold, gold);
                }
                else
                {
                    gbl.SelectedPlayer.Money.AddCoins(Money.Platinum, plat);
                    gbl.SelectedPlayer.Money.AddCoins(Money.Gold, gold);
                }
            }

            seg037.draw8x8_clear_area(TextRegion.Normal2);
        }
示例#11
0
文件: ovr020.cs 项目: gowantervo/coab
        internal static void trade_item(Item item)
        {
            Player player = gbl.tradeWith;
            ovr025.LoadPic();

            ovr025.selectAPlayer(ref player, true, "Trade with Whom?");

            if (player != null)
            {
                gbl.tradeWith = player;
                if (canCarry(item, player) == true)
                {
                    ovr025.string_print01("Overloaded");
                }
                else
                {
                    player.items.Add(item);
                    ovr025.lose_item(item, gbl.SelectedPlayer);
                    ovr025.reclac_player_values(player);
                }
            }
        }
示例#12
0
文件: ovr010.cs 项目: gowantervo/coab
        // 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;
        }
示例#13
0
文件: ovr013.cs 项目: gowantervo/coab
        /* sub_3A583 */
        internal static void affect_spiritual_hammer(Effect add_remove, object param, Player player)
        {
            Item item = player.items.Find(i => i.type == ItemType.Hammer && i.namenum3 == 0xf3);
            bool item_found = item != null;

            if (add_remove == Effect.Remove && item != null)
            {
                ovr025.lose_item(item, player);
            }

            if (add_remove == Effect.Add &&
                item_found == false &&
                player.items.Count < Player.MaxItems)
            {
                item = new Item(Affects.affect_78, Affects.spiritual_hammer, 0, 0, 0, 0, false, 0, false, 0, 1, 243, 20, 0, ItemType.Hammer, true);

                player.items.Add(item);
                ovr020.ready_Item(item);

                ovr025.DisplayPlayerStatusString(true, 10, "Gains an item", player);
            }

            ovr025.reclac_player_values(player);
        }
示例#14
0
文件: ovr014.cs 项目: gowantervo/coab
        /* sub_40BF1 */
        internal static void DrawRangedAttack(Item item, Player target, Player attacker)
        {
            seg044.PlaySound(Sound.sound_c);

            int dir = getTargetDirection(target, attacker);

            int frame_count = 1;
            int delay = 10;
            int iconId = 13;

            switch (item.type)
            {
                case ItemType.Dart:
                case ItemType.Javelin:
                case ItemType.DartOfHornetsNest:
                case ItemType.Quarrel:
                case ItemType.Spear:
                case ItemType.Arrow:
                    if ((dir & 1) == 1)
                    {
                        if (dir == 3 || dir == 5)
                        {
                            ovr025.load_missile_dax((dir == 5), 0, Icon.Attack, iconId + 1);
                        }
                        else
                        {
                            ovr025.load_missile_dax((dir == 7), 0, Icon.Normal, iconId + 1);
                        }
                    }
                    else
                    {
                        if (dir >= 4)
                        {
                            ovr025.load_missile_dax(false, 0, Icon.Attack, iconId + (dir % 4));
                        }
                        else
                        {
                            ovr025.load_missile_dax(false, 0, Icon.Normal, iconId + (dir % 4));
                        }
                    }
                    seg044.PlaySound(Sound.sound_c);
                    break;

                case ItemType.HandAxe:
                case ItemType.Club:
                case ItemType.Glaive:
                    ovr025.load_missile_icons(iconId + 3);
                    frame_count = 4;
                    delay = 50;
                    seg044.PlaySound(Sound.sound_9);
                    break;

                case ItemType.Type_85:
                case ItemType.FlaskOfOil:
                    ovr025.load_missile_icons(iconId + 4);
                    frame_count = 4;
                    delay = 50;
                    seg044.PlaySound(Sound.sound_6);
                    break;

                case ItemType.StaffSling:
                case ItemType.Sling:
                case ItemType.Spine:
                    iconId++;
                    ovr025.load_missile_dax(false, 0, Icon.Normal, iconId + 7);
                    ovr025.load_missile_dax(false, 1, Icon.Attack, iconId + 7);
                    frame_count = 2;
                    delay = 10;
                    seg044.PlaySound(Sound.sound_6);
                    break;

                default:
                    ovr025.load_missile_dax(false, 0, Icon.Normal, iconId + 7);
                    ovr025.load_missile_dax(false, 1, Icon.Attack, iconId + 7);
                    frame_count = 2;
                    delay = 20;
                    seg044.PlaySound(Sound.sound_9);
                    break;
            }

            ovr025.draw_missile_attack(delay, frame_count, ovr033.PlayerMapPos(target), ovr033.PlayerMapPos(attacker));
        }
示例#15
0
文件: ovr007.cs 项目: gowantervo/coab
        /*was overloaded */
        internal static bool PlayerAddItem(Item item)
        {
            bool wouldOverload;
            if (ovr020.canCarry(item, gbl.SelectedPlayer) == true)
            {
                ovr025.string_print01("Overloaded");
                wouldOverload = true;
            }
            else
            {
                wouldOverload = false;

                gbl.SelectedPlayer.items.Add(item.ShallowClone());

                ovr025.reclac_player_values(gbl.SelectedPlayer);
            }

            return wouldOverload;
        }
示例#16
0
文件: ovr020.cs 项目: gowantervo/coab
        // sub_54EC1
        internal static bool CanSellDropTradeItem(Item item)
        {
            bool canSellDropTradeItem = false;

            if (item.readied)
            {
                ovr025.string_print01("Must be unreadied");
            }
            else if (item.IsScroll() == false)
            {
                canSellDropTradeItem = true;
            }
            else if ((int)item.affect_1 > 0x7F || (int)item.affect_2 > 0x7F || (int)item.affect_3 > 0x7F)
            {
                ovr025.displayPlayerName(false, 15, 1, gbl.SelectedPlayer);

                gbl.textXCol = gbl.SelectedPlayer.name.Length + 2;
                gbl.textYCol = 0x15;

                seg041.press_any_key(" was going to scribe from that scroll", false, 14, TextRegion.Normal2);
                if (ovr027.yes_no(gbl.defaultMenuColors, "is it Okay to lose it? ") == 'Y')
                {
                    canSellDropTradeItem = true;
                }
            }
            else
            {
                canSellDropTradeItem = true;
            }

            seg037.draw8x8_clear_area(TextRegion.Normal2);

            return canSellDropTradeItem;
        }
示例#17
0
文件: ovr007.cs 项目: gowantervo/coab
        // sub_2F04E
        internal static char ShopChooseItem(ref int index, out Item selectedItem)
        {
            List<MenuItem> list = new List<MenuItem>();
            foreach (var item in gbl.items_pointer)
            {
                if (item._value == 0)
                {
                    item._value = 1;
                }

                int val = ItemsValue(item);

                list.Insert(0, new MenuItem(string.Format("{0,-21}{1,9}", item.name.Trim(), val), item));
            }

            gbl.menuSelectedWord = 0;

            MenuItem mi;
            selectedItem = null;

            char input_key = ovr027.sl_select_item(out mi, ref index, ref gbl.shopRedrawMenuItems, true, list,
                0x16, 0x26, 1, 1, gbl.defaultMenuColors, "Buy", "Items: ");

            if (mi != null)
            {
                selectedItem = mi.Item;
            }

            foreach (var item in gbl.items_pointer)
            {
                ovr025.ItemDisplayNameBuild(false, false, 0, 0, item);
            }

            return input_key;
        }
示例#18
0
文件: ovr020.cs 项目: gowantervo/coab
        internal static void halve_items(Item item)
        {
            int half_number = item.count / 2;

            if (half_number > 0)
            {
                int half_and_remander = item.count - half_number;

                Item new_item = item.ShallowClone();
                item.count = half_and_remander;

                new_item.count = half_number;
                new_item.readied = false;

                gbl.SelectedPlayer.items.Add(new_item);
            }
            else
            {
                ovr025.string_print01("Can't halve that");
            }
        }
示例#19
0
文件: ovr022.cs 项目: gowantervo/coab
        /* sub_5A007 */
        internal static Item create_item(ItemType item_type)
        {
            byte var_5 = 0; /* Simeon */
            int var_4 = -1;

            Item item = new Item(0, 0, 0, 0, 0, 0, false, 6, false, 0, 0, 0, 0, 0, item_type, false);

            var type = item.type;

            if ((type >= ItemType.BattleAxe && type <= ItemType.Shield) ||
                type == ItemType.Arrow ||
                type == ItemType.Bracers ||
                type == ItemType.RingOfProt)
            {
                item.plus = randomBonus();

                if (item.type == ItemType.Javelin)
                {
                    int var_1 = ovr024.roll_dice(5, 1);
                    if (var_1 == 5)
                    {
                        var_4 = 6;
                    }

                    item.namenum3 = 0x15;
                    item.namenum2 = item.plus + 0xA1;
                }
                else if (item.type == ItemType.Quarrel)
                {
                    item.namenum3 = 0x1C;
                    item.namenum2 = item.plus + 0xA1;
                }
                else if (item.type == ItemType.LeatherArmor ||
                         item.type == ItemType.PaddedArmor)
                {
                    item.namenum3 = (int)item.type;
                    item.namenum2 = 0x31;
                    item.namenum1 = item.plus + 0xA1;
                    item.hidden_names_flag = 4;
                }
                else if (item.type == ItemType.StuddedLeather)
                {
                    item.namenum3 = (int)item.type;
                    item.namenum2 = 0x32;
                    item.namenum1 = item.plus + 0xA1;
                    item.hidden_names_flag = 4;
                }
                else if (item.type >= ItemType.RingMail &&
                         item.type <= ItemType.PlateMail)
                {
                    item.namenum3 = (int)item.type;
                    item.namenum2 = 0x30;
                    item.namenum1 = item.plus + 0xA1;
                    item.hidden_names_flag = 4;
                }
                else if (item.type == ItemType.Arrow)
                {
                    item.namenum3 = 0x3D;
                    item.namenum2 = item.plus + 0xA1;
                }
                else if (item.type == ItemType.Bracers)
                {
                    item.namenum3 = 0x4F;
                    item.namenum2 = 0xA7;
                    item.plus = (item.plus << 1) + 2;

                    if (item.plus == 4)
                    {
                        item.namenum1 = 0xdd;
                    }
                    else if (item.plus == 6)
                    {
                        item.namenum1 = 0xde;
                    }
                }
                else if (item.type == ItemType.RingOfProt)
                {
                    item.namenum3 = 0x42;
                    item.namenum2 = 0xE0;
                    item.namenum1 = item.plus + 0xA1;
                }
                else
                {
                    item.namenum3 = (int)item.type;
                    item.namenum2 = item.plus + 0xA1;
                }

                item.plus_save = 0;
                item.count = 0;

                switch (item.type)
                {
                    case ItemType.BattleAxe:
                    case ItemType.MilitaryFork:
                    case ItemType.Glaive:
                    case ItemType.BroadSword:
                        item.weight = 75;
                        break;

                    case ItemType.HandAxe: // HandAxe
                    case ItemType.Hammer:
                    case ItemType.Ranseur:
                    case ItemType.Spear:
                    case ItemType.Spetum:
                    case ItemType.QuarterStaff:
                    case ItemType.Trident:
                    case ItemType.CompositeShortBow:
                    case ItemType.ShortBow:
                    case ItemType.LightCrossbow:
                    case ItemType.Shield:
                        item.weight = 50;
                        break;

                    case ItemType.Bardiche:
                    case ItemType.MorningStar:
                    case ItemType.Voulge:
                        item.weight = 0x7D;
                        break;

                    case ItemType.BecDeCorbin:
                    case ItemType.GlaiveGuisarme:
                    case ItemType.Mace:
                    case ItemType.BastardSword:
                    case ItemType.LongBow:
                    case ItemType.HeavyCrossbow:
                    case ItemType.PaddedArmor:
                        item.weight = 100;
                        break;

                    case ItemType.BillGuisarme:
                    case ItemType.Flail:
                    case ItemType.GuisarmeVoulge:
                    case ItemType.LucernHammer:
                    case ItemType.LeatherArmor:
                        item.weight = 0x96;
                        break;

                    case ItemType.BoStick:
                        item.weight = 15;
                        break;

                    case ItemType.Club:
                        item.weight = 0x1E;
                        break;

                    case ItemType.Dagger:
                    case ItemType.Bracers:
                        item.weight = 10;
                        break;

                    case ItemType.Dart:
                        item.weight = 0x19;
                        item.count = 5;
                        break;

                    case ItemType.Fauchard:
                    case ItemType.MilitaryPick:
                    case ItemType.LongSword:
                        item.weight = 0x3C;
                        break;

                    case ItemType.FauchardFork:
                    case ItemType.Guisarme:
                    case ItemType.Partisan:
                    case ItemType.AwlPike:
                    case ItemType.CompositeLongBow:
                    case ItemType.Sling:
                        item.weight = 80;
                        break;

                    case ItemType.Halberd:
                        item.weight = 175;
                        break;

                    case ItemType.Javelin:
                        item.weight = 20;
                        break;

                    case ItemType.JoStick:
                    case ItemType.Scimitar:
                        item.weight = 40;
                        break;

                    case ItemType.ShortSword:
                        item.weight = 35;
                        break;

                    case ItemType.TwoHandedSword:
                    case ItemType.RingMail:
                        item.weight = 250;
                        break;

                    case ItemType.StuddedLeather:
                        item.weight = 0x0C8;
                        break;

                    case ItemType.ScaleMail:
                    case ItemType.SplintMail:
                        item.weight = 400;
                        break;

                    case ItemType.ChainMail:
                        item.weight = 0x12C;
                        break;

                    case ItemType.BandedMail:
                        item.weight = 0x15E;
                        break;

                    case ItemType.PlateMail:
                        item.weight = 450;
                        break;

                    //case 0x2f: //wonder if this should have been 0x3f
                    case ItemType.RingOfProt:
                        item.weight = 1;
                        break;

                    default:
                        item.weight = 40;
                        item.count = 10;
                        break;
                }

                if (item.type == ItemType.Shield)
                {
                    item._value = (short)(item.plus * 2500);
                }
                else if (item.type == ItemType.Arrow || item.type == ItemType.Quarrel)
                {
                    item._value = (short)(item.plus * 150);
                }
                else if (item.type == ItemType.RingMail || item.type == ItemType.ScaleMail)
                {
                    item._value = (short)(item.plus * 3000);
                }
                else if (item.type == ItemType.ChainMail || item.type == ItemType.SplintMail)
                {
                    item._value = (short)(item.plus * 3500);
                }
                else if (item.type == ItemType.BandedMail)
                {
                    item._value = (short)(item.plus * 4000);

                }
                else if (item.type == ItemType.PlateMail)
                {
                    item._value = (short)(item.plus * 5000);
                }
                else if (item.type == ItemType.Bracers)
                {
                    item._value = (short)(item.plus * 3000);
                }
                else
                {
                    item._value = (short)(item.plus * 2000);
                }
            }
            else if (type == ItemType.MUScroll || type == ItemType.ClrcScroll)
            {
                byte spellsCount = ovr024.roll_dice(3, 1);

                if (item.type == ItemType.MUScroll)
                {
                    item.namenum3 = 0xD1;
                }
                else
                {
                    item.namenum3 = 0xD0;
                }

                item.namenum2 = spellsCount + 0xd1;
                item.namenum1 = 0;
                item.plus = 1;
                item.weight = 0x19;
                item.count = 0;
                item._value = 0;

                for (int var_3 = 1; var_3 <= spellsCount; var_3++)
                {
                    int var_1 = ovr024.roll_dice(5, 1);

                    if (item.type == ItemType.MUScroll)
                    {
                        switch (var_1)
                        {
                            case 1:
                                var_5 = (byte)(ovr024.roll_dice(13, 1) + 8);
                                break;

                            case 2:
                                var_5 = (byte)(ovr024.roll_dice(7, 1) + 28);
                                break;

                            case 3:
                                var_5 = (byte)(ovr024.roll_dice(0x0B, 1) + 44);
                                break;

                            case 4:
                                var_5 = (byte)(ovr024.roll_dice(9, 1) + 80);
                                break;

                            case 5:
                                var_5 = (byte)(ovr024.roll_dice(4, 1) + 90);
                                break;
                        }
                    }
                    else
                    {
                        switch (var_1)
                        {
                            case 1:
                                var_5 = ovr024.roll_dice(8, 1);
                                break;

                            case 2:
                                var_5 = (byte)(ovr024.roll_dice(7, 1) + 0x15);
                                break;

                            case 3:
                                var_5 = (byte)(ovr024.roll_dice(8, 1) + 0x24);
                                break;

                            case 4:
                                var_5 = (byte)(ovr024.roll_dice(5, 1) + 0x41);
                                break;

                            case 5:
                                var_5 = (byte)(ovr024.roll_dice(6, 1) + 0x46);
                                break;
                        }
                    }

                    item.setAffect(var_3, (Affects)var_5);
                    item._value += (short)(var_1 * 300);
                }
            }
            else if (type == ItemType.Gauntlets || type == ItemType.Type_67)
            {
                var_4 = 5;
            }
            else if (type == ItemType.WandA || type == ItemType.WandB)
            {
                var_4 = 4;
            }
            else if (type == ItemType.Type_89 || type == ItemType.Cloak)
            {
                var_4 = 1;
            }
            else if (type == ItemType.Potion)
            {
                int var_1 = ovr024.roll_dice(8, 1);

                if (var_1 >= 1 && var_1 <= 5)
                {
                    var_4 = 2;
                }
                else if (var_1 >= 6 && var_1 <= 8)
                {
                    var_4 = 0;
                }
            }

            if (var_4 > -1)
            {
                item.namenum1 = preconfiiguredItems[var_4, 0];
                item.namenum2 = preconfiiguredItems[var_4, 1];
                item.namenum3 = preconfiiguredItems[var_4, 2];

                item.plus = 1;
                item.plus_save = 1;

                item.weight = preconfiiguredItems[var_4, 3];
                item.count = 0;

                item._value = preconfiiguredItems[var_4, 4];

                for (int var_3 = 1; var_3 <= 3; var_3++)
                {
                    item.setAffect(var_3, (Affects)(byte)preconfiiguredItems[var_4, 4 + var_3]);
                }
            }

            ItemLibrary.Add(item);
            return item;
        }
示例#20
0
文件: ovr020.cs 项目: gowantervo/coab
        internal static void IdentifyItem(ref bool arg_0, Item item)
        {
            bool id_item = false;
            ovr025.ItemDisplayNameBuild(false, false, 0, 0, item);

            seg041.press_any_key("For 200 gold pieces I'll identify your " + item.name, true, 14, TextRegion.Normal2);

            if (ovr027.yes_no(gbl.defaultMenuColors, "Is It a Deal? ") == 'Y')
            {
                int cost = 200;
                if (cost <= gbl.SelectedPlayer.Money.GetGoldWorth())
                {
                    id_item = true;
                    gbl.SelectedPlayer.Money.SubtractGoldWorth(cost);
                }
                else
                {
                    if (cost <= gbl.pooled_money.GetGoldWorth())
                    {
                        id_item = true;

                        gbl.pooled_money.SubtractGoldWorth(cost);
                    }
                    else
                    {
                        ovr025.string_print01("Not Enough Money");
                    }
                }
            }

            if (id_item == true)
            {
                if (item.hidden_names_flag == 0)
                {
                    seg041.press_any_key("I can't tell anything new about your " + item.name, true, 14, TextRegion.Normal2);
                }
                else
                {
                    item.hidden_names_flag = 0;
                    ovr025.ItemDisplayNameBuild(false, false, 0, 0, item);

                    seg041.press_any_key("It looks like some sort of " + item.name, true, 14, TextRegion.Normal2);

                    arg_0 = true;
                }

                seg041.GameDelay();
            }

            seg037.draw8x8_clear_area(TextRegion.Normal2);
        }
示例#21
0
文件: ovr006.cs 项目: gowantervo/coab
        /* sub_2DD2B */
        internal static void select_treasure(ref int index, out Item selectedItem, out char key)
        {
            seg037.DrawFrame_Outer();

            var list = new List<MenuItem>();

            if (Cheats.sort_treasure)
            {
                gbl.items_pointer.Sort((a, b) => a._value.CompareTo(b._value));
            }

            gbl.items_pointer.ForEach(item =>
                {
                    ovr025.ItemDisplayNameBuild(false, false, 0, 0, item);
                    list.Insert(0, new MenuItem(item.name, item));
                });

            bool redrawMenuItems = true;
            MenuItem selected;
            key = ovr027.sl_select_item(out selected, ref index, ref redrawMenuItems, true, list,
                 0x16, 0x26, 1, 1, gbl.defaultMenuColors, "Take", "Items: ");

            selectedItem = selected != null ? selected.Item : null;
        }
示例#22
0
文件: ovr014.cs 项目: gowantervo/coab
        // sub_3F9DB
        internal static bool AttackTarget(Item rangedWeapon, int attackType, Player target, Player attacker)
        {
            int dir = 0;

            gbl.focusCombatAreaOnPlayer = true;
            gbl.display_hitpoints_ac = true;

            gbl.combat_round_no_action_limit = gbl.combat_round + gbl.combat_round_no_action_value;

            if (target.actions.AttacksReceived < 2 && attackType == 0)
            {
                dir = getTargetDirection(attacker, target);

                target.actions.direction = (dir + 4) % 8;
            }
            else if (ovr033.PlayerOnScreen(false, target) == true)
            {
                dir = target.actions.direction;

                if (attackType == 0)
                {
                    target.actions.direction = (dir + 4) % 8;
                }
            }

            if (ovr033.PlayerOnScreen(false, target) == true)
            {
                ovr033.draw_74B3F(false, Icon.Normal, dir, target);
            }

            dir = getTargetDirection(target, attacker);
            ovr025.CombatDisplayPlayerSummary(attacker);

            ovr033.draw_74B3F(false, Icon.Attack, dir, attacker);

            attacker.actions.target = target;

            seg049.SysDelay(100);

            if (rangedWeapon != null)
            {
                DrawRangedAttack(rangedWeapon, target, attacker);
            }

            if (attacker.activeItems.primaryWeapon != null &&
                (attacker.activeItems.primaryWeapon.type == ItemType.Sling ||
                attacker.activeItems.primaryWeapon.type == ItemType.StaffSling))
            {
                DrawRangedAttack(attacker.activeItems.primaryWeapon, target, attacker);
            }

            bool turnComplete = true;

            if (attacker.attack1_AttacksLeft > 0 ||
                attacker.attack2_AttacksLeft > 0)
            {
                Player player_bkup = gbl.SelectedPlayer;

                gbl.SelectedPlayer = attacker;

                turnComplete = AttackTarget01(rangedWeapon, attackType, target, attacker);

                if (rangedWeapon != null)
                {
                    if (rangedWeapon.count > 0)
                    {
                        rangedWeapon.count = gbl.bytes_1D900[1];
                    }

                    if (rangedWeapon.count == 0)
                    {
                        if (ovr025.is_weapon_ranged_melee(attacker) == true &&
                            rangedWeapon.affect_3 != Affects.affect_89)
                        {
                            Item new_item = rangedWeapon.ShallowClone();
                            new_item.readied = false;

                            gbl.items_pointer.Add(new_item);

                            ovr025.lose_item(rangedWeapon, attacker);
                            gbl.item_ptr = new_item;
                        }
                        else
                        {
                            ovr025.lose_item(rangedWeapon, attacker);
                        }
                    }
                }

                ovr025.reclac_player_values(attacker);
                gbl.SelectedPlayer = player_bkup;
            }

            if (turnComplete == true)
            {
                ovr025.clear_actions(attacker);
            }

            if (ovr033.PlayerOnScreen(false, attacker) == true)
            {
                ovr033.draw_74B3F(true, Icon.Attack, attacker.actions.direction, attacker);
                ovr033.draw_74B3F(false, Icon.Normal, attacker.actions.direction, attacker);
            }

            return turnComplete;
        }