Exemplo n.º 1
0
 public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
                   int _fixedRange, int _perLvlRange,
                   int _fixedDuration, byte _perLvlDuration,
                   byte f6, SpellTargets _targets,
                   DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
                   Affects _affectId, SpellWhen _whenCast,
                   int _castingDelay, int _priority, byte fe, byte ff)
 {
     spellClass     = _spellClass;
     spellLevel     = _spellLevel;
     fixedRange     = _fixedRange;
     perLvlRange    = _perLvlRange;
     fixedDuration  = _fixedDuration;
     perLvlDuration = _perLvlDuration;
     field_6        = f6;
     targetType     = _targets;
     damageOnSave   = _damageOnSave;
     saveVerse      = _saveVerse;
     affect_id      = _affectId;
     whenCast       = _whenCast;
     castingDelay   = _castingDelay;
     priority       = _priority;
     field_E        = fe;
     field_F        = ff;
     spellIdx       = spell_idx;
 }
Exemplo n.º 2
0
        public SpellWhen whenCast; //seg600:37E7 unk_19AF7

        #endregion Fields

        #region Constructors

        public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
            int _fixedRange, int _perLvlRange,
            int _fixedDuration, byte _perLvlDuration,
            byte f6, SpellTargets _targets,
            DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
            Affects _affectId, SpellWhen _whenCast,
            int _castingDelay, int _priority, byte fe, byte ff)
        {
            spellClass = _spellClass;
            spellLevel = _spellLevel;
            fixedRange = _fixedRange;
            perLvlRange = _perLvlRange;
            fixedDuration = _fixedDuration;
            perLvlDuration = _perLvlDuration;
            field_6 = f6;
            targetType = _targets;
            damageOnSave = _damageOnSave;
            saveVerse = _saveVerse;
            affect_id = _affectId;
            whenCast = _whenCast;
            castingDelay = _castingDelay;
            priority = _priority;
            field_E = fe;
            field_F = ff;
            spellIdx = spell_idx;
        }
Exemplo n.º 3
0
        // do_saving_throw
        internal static bool RollSavingThrow(int saveBonus, SaveVerseType saveType, Player player)
        {
            gbl.savingThrowMade = true;
            gbl.savingThrowRoll = roll_dice(20, 1);

            if (Cheats.player_always_saves && player.combat_team == 0)
            {
                gbl.savingThrowRoll = 20;
            }

            if (gbl.savingThrowRoll == 1)
            {
                gbl.savingThrowMade = false;
            }
            else if (gbl.savingThrowRoll == 20)
            {
                gbl.savingThrowMade = true;
            }
            else
            {
                gbl.savingThrowRoll += saveBonus + player.field_186;
                gbl.saveVerseType = saveType;

                CheckAffectsEffect(player, CheckType.SavingThrow);

                gbl.savingThrowMade = gbl.savingThrowRoll >= player.saveVerse[(int)saveType];
            }

            return gbl.savingThrowMade;
        }
Exemplo n.º 4
0
        // sub_5F986
        static bool DoElecDamage(bool arg_0, int player_index, SaveVerseType bonusType, int damage, Point pos)
        {
            int groundTile;
            int playerIndex;

            ovr033.AtMapXY(out groundTile, out playerIndex, pos);

            if (groundTile > 0 &&
                gbl.BackGroundTiles[groundTile].move_cost == 0xff &&
                gbl.area_ptr.inDungeon == 1 &&
                arg_0 == false)
            {
                arg_0 = true;
            }
            else
            {
                arg_0 = false;
            }

            DoActualElecDamage(player_index, bonusType, damage, playerIndex);

            return arg_0;
        }
Exemplo n.º 5
0
        static void DoElecDamage(int player_index, SaveVerseType bonusType, int damage, Point pos)
        {
            int playerIndex = ovr033.PlayerIndexAtMapXY(pos.y, pos.x);

            DoActualElecDamage(player_index, bonusType, damage, playerIndex);
        }
Exemplo n.º 6
0
        private static void DoActualElecDamage(int player_index, SaveVerseType bonusType, int damage, int playerIndex)
        {
            if (playerIndex > 0 &&
                playerIndex != player_index)
            {
                Player player = gbl.player_array[playerIndex];
                gbl.damage_flags = DamageType.Magic | DamageType.Electricity;

                ovr024.damage_person(ovr024.RollSavingThrow(0, bonusType, player), DamageOnSave.Half, damage, player);
                ovr025.load_missile_icons(0x13);
                gbl.damage_flags = 0;
            }
        }
Exemplo n.º 7
0
        internal static void sub_5FA44(byte arg_0, SaveVerseType bonusType, int damage, byte arg_6)
        {
            int var_3A = 0; /* Simeon */
            bool var_36 = false;
            ovr025.load_missile_icons(0x13);

            int var_39;
            int groundTile;

            ovr033.AtMapXY(out groundTile, out var_39, gbl.targetPos);
            int var_3D = 0;
            int var_35 = 1;

            var playerPos = ovr033.PlayerMapPos(gbl.SelectedPlayer);
            byte var_38 = arg_0;

            if (playerPos != gbl.targetPos)
            {
                int var_3C = arg_6 * 2;
                gbl.byte_1D2C7 = true;

                while (var_3C > 0)
                {
                    var path_a = new SteppingPath();

                    path_a.attacker = gbl.targetPos;
                    path_a.target = gbl.targetPos + ((gbl.targetPos - playerPos) * var_35 * var_3C);

                    path_a.CalculateDeltas();

                    do
                    {
                        var tmppos = path_a.current;

                        if (path_a.attacker != path_a.target)
                        {
                            bool stepping;

                            do
                            {
                                stepping = path_a.Step();

                                ovr033.AtMapXY(out groundTile, out var_3A, path_a.current);

                                if (gbl.BackGroundTiles[groundTile].move_cost == 1)
                                {
                                    var_36 = false;
                                }

                            } while (stepping == true &&
                                (var_3A <= 0 || var_3A == var_39) &&
                                groundTile != 0 &&
                                gbl.BackGroundTiles[groundTile].move_cost <= 1 &&
                                path_a.steps < var_3C);
                        }

                        if (groundTile == 0)
                        {
                            var_3C = 0;
                        }

                        ovr025.draw_missile_attack(0x32, 4, path_a.current, tmppos);

                        var_36 = DoElecDamage(var_36, var_39, bonusType, damage, path_a.current);
                        var_39 = var_3A;

                        if (var_36 == true)
                        {
                            gbl.targetPos = path_a.current;

                            var path_b = new SteppingPath();

                            path_b.attacker = gbl.targetPos;
                            path_b.target = playerPos;

                            path_b.CalculateDeltas();

                            while (path_b.Step() == true)
                            {
                                /* empty */
                            }

                            if (var_38 != 0 && path_b.steps <= 8)
                            {
                                path_a.steps += 8;
                            }

                            var_35 = -var_35;
                            var_38 = 0;
                            var_39 = 0;
                        }

                        var_3D = (byte)(path_a.steps - var_3D);

                        if (var_3D < var_3C)
                        {
                            var_3C -= var_3D;
                        }
                        else
                        {
                            var_3C = 0;
                        }

                        var_3D = path_a.steps;
                    } while (var_36 == false && var_3C != 0);
                }

                gbl.byte_1D2C7 = false;
            }
        }