Пример #1
0
        // spell_breathes_acid
        internal static void DragonBreathAcid(Effect arg_0, object param, Player attacker)
        {
            Affect affect = (Affect)param;

            gbl.byte_1DA70 = false;

            if (gbl.combat_round == 0)
            {
                affect.affect_data = 3;
            }

            if (affect.affect_data > 0)
            {
                gbl.damage_flags = DamageType.DragonBreath | DamageType.Acid;

                var attackerPos = ovr033.PlayerMapPos(attacker);

                gbl.byte_1DA70 = gbl.SpellCastFunction(QuickFight.True, (int)Spells.spell_3d);

                if (gbl.byte_1DA70 == true)
                {
                    BuildAreaDamageTargets(6, 1, gbl.targetPos, attackerPos);
                }

                if (gbl.spellTargets.Exists(target => attacker.OppositeTeam() == target.combat_team))
                {
                    gbl.byte_1DA70 = false;
                }

                if (gbl.byte_1DA70 == true &&
                    gbl.spellTargets.Count > 0)
                {
                    ovr025.DisplayPlayerStatusString(true, 10, "breathes acid", attacker);
                    ovr025.load_missile_icons(0x12);

                    ovr025.draw_missile_attack(0x1E, 1, ovr033.PlayerMapPos(gbl.spellTargets[0]), ovr033.PlayerMapPos(attacker));

                    foreach (var target in gbl.spellTargets)
                    {
                        bool save_made = ovr024.RollSavingThrow(0, SaveVerseType.type3, target);
                        ovr024.damage_person(save_made, DamageOnSave.Half, attacker.hit_point_max, target);
                    }

                    affect.affect_data--;

                    ovr025.clear_actions(attacker);
                }
            }
        }
Пример #2
0
        internal static bool sub_3560B(Player player)
        {
            byte[] spell_list = new byte[gbl.max_spells];

            int spells_count = 0;

            if (player.actions.can_cast == true)
            {
                foreach (int id in player.spellList.LearntList())
                {
                    spell_list[spells_count++] = (byte)id;
                }
            }

            byte spell_id = 0;
            byte priority = 7;
            int var_5B = ovr024.roll_dice(7, 1);
            int var_5D = 1;

            if (spells_count > 0 &&
                (player.control_morale >= Control.NPC_Base || gbl.AutoPCsCastMagic == true))
            {
                if ((player.OppositeTeam() == CombatTeam.Ours ? gbl.friends_count : gbl.foe_count) > 0)
                {
                    while (var_5D <= var_5B && spell_id == 0)
                    {
                        for (int var_5E = 1; var_5E < 4 && spell_id == 0; var_5E++)
                        {
                            int random_spell_index = ovr024.roll_dice(spells_count, 1) - 1;
                            byte random_spell_id = spell_list[random_spell_index];

                            if (ShouldCastSpellX(priority, random_spell_id, player))
                            {
                                spell_id = random_spell_id;
                            }
                        }

                        priority--;
                        var_5D++;
                    }
                }
            }

            bool casting_spell;

            if (spell_id > 0)
            {
                ovr014.spell_menu3(out casting_spell, QuickFight.True, spell_id);
            }
            else
            {
                casting_spell = false;
            }

            return casting_spell;
        }
Пример #3
0
        /* sub_40F1F */
        internal static bool can_attack_target(Player target, Player attacker)
        {
            bool result;

            if (target.OppositeTeam() == attacker.combat_team ||
                attacker.quick_fight == QuickFight.True)
            {
                result = true;
            }
            else if (ovr027.yes_no(gbl.defaultMenuColors, "Attack Ally: ") != 'Y')
            {
                result = false;
            }
            else
            {
                result = true;
                gbl.area2_ptr.field_666 = 1;

                foreach (Player player in gbl.TeamList)
                {
                    if (player.health_status == Status.okey &&
                        player.control_morale >= Control.NPC_Base)
                    {
                        player.combat_team = CombatTeam.Enemy;
                        player.actions.target = null;
                    }
                }

                ovr025.CountCombatTeamMembers();
            }

            return result;
        }
Пример #4
0
        internal static bool sub_354AA(Player player)
        {
            Item bestWand = null;

            int teamCount = player.OppositeTeam() == CombatTeam.Ours ? gbl.friends_count : gbl.foe_count;
            if (player.actions.can_use == true &&
                teamCount > 0 &&
                gbl.area_ptr.can_cast_spells == false)
            {
                int prioritisToTry = ovr024.roll_dice(7, 1);
                for (int i = 0; i < prioritisToTry; i++)
                {
                    int priority = 7 - i;

                    foreach (var item_ptr in player.items)
                    {
                        byte spell_id = (byte)item_ptr.affect_2;

                        if (item_ptr.IsScroll() == false &&
                            (int)item_ptr.affect_3 < 0x80 &&
                            item_ptr.readied &&
                            spell_id > 0)
                        {
                            if (spell_id > 0x38)
                            {
                                spell_id -= 0x17;
                            }

                            if (ShouldCastSpellX(priority, spell_id, player))
                            {
                                bestWand = item_ptr;
                                break;
                            }
                        }
                    }
                }
            }

            if (bestWand != null)
            {
                bool var_15 = false; /* simeon */
                ovr020.UseMagicItem(ref var_15, bestWand);
                return true;
            }

            return false;
        }
Пример #5
0
        // sub_40E8F
        internal static int MaxOppositionMoves(Player player)
        {
            int maxMoves = 0;

            foreach (Player mob in gbl.TeamList)
            {
                if (player.OppositeTeam() == mob.combat_team && mob.in_combat == true)
                {
                    int moves = CalcMoves(mob) / 2;

                    maxMoves = System.Math.Max(moves, maxMoves);
                }
            }

            return maxMoves;
        }