コード例 #1
0
ファイル: ovr009.cs プロジェクト: gowantervo/coab
        internal static void sub_33B26(ref bool arg_0, char arg_4, Player player)
        {
            int movesBackup = player.actions.move;
            int dirBackup = player.actions.direction;
            Point pos = ovr033.PlayerMapPos(player);

            arg_0 = false;
            byte dir = 8;

            while (player.actions.move > 1 &&
                arg_4 != 0 &&
                arg_4 != 13)
            {
                seg037.draw8x8_clear_area(0x18, 0x27, 0x18, 0x18);

                if (arg_4 == ' ')
                {
                    string text = string.Format("Move/Attack, Move Left = {0} ", player.actions.move / 2);

                    arg_4 = ovr027.displayInput(false, 1, new MenuColorSet(15, 10, 10), string.Empty, text);
                }

                switch (arg_4)
                {
                    case '\0':
                        player.actions.move = movesBackup;

                        ovr033.RedrawPlayerBackground(ovr033.GetPlayerIndex(player));

                        if (ovr033.sub_7515A(false, pos, player) == false)
                        {
                            arg_0 = true;
                        }
                        else
                        {
                            arg_0 = false;
                        }

                        ovr033.redrawCombatArea(8, 0, ovr033.PlayerMapPos(player));
                        player.actions.direction = dirBackup;
                        dir = 8;
                        break;

                    case 'H':
                        dir = 0;
                        break;

                    case 'I':
                        dir = 1;
                        break;

                    case 'M':
                        dir = 2;
                        break;

                    case 'Q':
                        dir = 3;
                        break;

                    case 'P':
                        dir = 4;
                        break;

                    case 'O':
                        dir = 5;
                        break;

                    case 'K':
                        dir = 6;
                        break;

                    case 'G':
                        dir = 7;
                        break;

                    default:
                        dir = 8;
                        break;
                }

                if (dir < 8)
                {
                    ovr033.draw_74B3F(false, Icon.Normal, dir, player);
                    int ground_tile;
                    int target_index;

                    ovr033.getGroundInformation(out ground_tile, out target_index, dir, player);

                    if (target_index > 0)
                    {
                        sub_33F03(ref arg_0, gbl.player_array[target_index], player);
                    }
                    else if (ground_tile == 0)
                    {
                        char b = ovr027.yes_no(gbl.defaultMenuColors, "Flee:");
                        if (b == 'Y')
                        {
                            arg_0 = true;
                            ovr014.flee_battle(player);
                        }
                        else if (b == 'N')
                        {
                            arg_0 = false;
                        }
                    }
                    else
                    {
                        int cost;

                        if ((dir / 2) < 1)
                        {
                            cost = gbl.BackGroundTiles[ground_tile].move_cost * 3;
                        }
                        else
                        {
                            cost = gbl.BackGroundTiles[ground_tile].move_cost * 2;
                        }

                        if (gbl.BackGroundTiles[ground_tile].move_cost == 0xFF)
                        {
                            cost = 0xFFFF;
                        }

                        if (cost > player.actions.move)
                        {
                            ovr025.string_print01("can't go there");
                        }
                        else
                        {
                            ovr014.move_step_away_attack(dir, player);

                            if (player.in_combat == false)
                            {
                                arg_0 = true;
                                ovr025.clear_actions(player);
                            }
                            else
                            {
                                if (player.actions.move > 0)
                                {
                                    ovr014.sub_3E748(dir, player);
                                }

                                if (player.in_combat == false)
                                {
                                    arg_0 = true;
                                    ovr025.clear_actions(player);
                                }

                                ovr024.in_poison_cloud(1, player);

                                if (player.IsHeld())
                                {
                                    arg_0 = true;
                                    ovr025.clear_actions(player);
                                }
                            }
                        }
                    }
                }

                if (arg_4 != 0 &&
                    arg_4 != 13)
                {
                    arg_4 = ' ';
                }
            }

            if (player.actions.move < 2)
            {
                player.actions.move = 0;
            }
        }
コード例 #2
0
ファイル: ovr025.cs プロジェクト: gowantervo/coab
        /* hitpoint_ac */
        internal static void CombatDisplayPlayerSummary(Player player)
        {
            if (gbl.display_hitpoints_ac == true)
            {
                gbl.display_hitpoints_ac = false;
                seg037.draw8x8_clear_area(TextRegion.CombatSummary);

                int line = 1;

                DisplayPlayerStatusString(false, line, " ", player);

                line++;

                seg041.displayString("Hitpoints", 0, 10, line + 1, 0x17);

                display_hp(false, line + 1, 0x21, player);
                line += 2;

                seg041.displayString("AC", 0, 10, line + 1, 0x17);
                display_AC(line + 1, 0x1A, player);

                gbl.textYCol = line + 1;

                if (player.activeItems.primaryWeapon != null)
                {
                    line += 2;
                    /*var_1 = 0x17;*/
                    ItemDisplayNameBuild(false, false, 0, 0, player.activeItems.primaryWeapon);

                    seg041.press_any_key(player.activeItems.primaryWeapon.name, true, 10, line + 3, 0x26, line + 1, 0x17);
                }

                line = gbl.textYCol + 1;

                if (player.in_combat == false)
                {
                    seg041.displayString(ovr020.statusString[(int)player.health_status], 0, 15, line + 1, 0x17);
                }
                else if (player.IsHeld() == true)
                {
                    seg041.displayString("(Helpless)", 0, 15, line + 1, 0x17);
                }
            }
        }
コード例 #3
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;
        }
コード例 #4
0
ファイル: ovr010.cs プロジェクト: gowantervo/coab
        // sub_361F7
        static void TryGuarding(Player player)
        {
            ovr025.ClearPlayerTextArea();

            if (player.IsHeld() == true ||
                ovr025.is_weapon_ranged(player) == true ||
                player.actions.delay == 0)
            {
                player.actions.Clear();
            }
            else
            {
                ovr025.guarding(player);
            }
        }
コード例 #5
0
ファイル: ovr014.cs プロジェクト: gowantervo/coab
        internal static void sub_3E748(int direction, Player player)
        {
            int player_index = ovr033.GetPlayerIndex(player);

            Point oldPos = gbl.CombatMap[player_index].pos;
            Point newPos = oldPos + gbl.MapDirectionDelta[direction];

            // TODO does this solve more problems than it causes? Regarding AI flee
            if (newPos.MapInBounds() == false)
            {
                return;
            }

            int costToMove = 0;
            if ((direction & 0x01) != 0)
            {
                // Diagonal walking...
                costToMove = gbl.BackGroundTiles[gbl.mapToBackGroundTile[newPos]].move_cost * 3;
            }
            else
            {
                costToMove = gbl.BackGroundTiles[gbl.mapToBackGroundTile[newPos]].move_cost * 2;
            }

            if (costToMove > player.actions.move)
            {
                player.actions.move = 0;
            }
            else
            {
                player.actions.move -= costToMove;
            }

            byte radius = 1;

            if (player.quick_fight == QuickFight.True)
            {
                radius = 3;

                if (ovr033.CoordOnScreen(newPos - gbl.mapToBackGroundTile.mapScreenTopLeft) == false &&
                    gbl.focusCombatAreaOnPlayer == true)
                {
                    ovr033.redrawCombatArea(8, 2, oldPos);
                }
            }

            if (gbl.focusCombatAreaOnPlayer == true)
            {
                ovr033.RedrawPlayerBackground(player_index);
            }

            gbl.CombatMap[player_index].pos = newPos;

            ovr033.setup_mapToPlayerIndex_and_playerScreen();

            if (gbl.focusCombatAreaOnPlayer == true)
            {
                ovr033.redrawCombatArea(8, radius, newPos);
            }

            player.actions.AttacksReceived = 0;
            player.actions.directionChanges = 0;
            seg044.PlaySound(Sound.sound_a);

            move_step_into_attack(player);

            if (player.in_combat == false ||
                player.IsHeld() == true)
            {
                player.actions.move = 0;
            }
        }