Exemple #1
0
        // sub_426FC
        internal static void AffectOwlbearHugRoundAttack(Effect arg_0, object param, Player player)
        {
            Affect affect = (Affect)param;

            gbl.spell_target = gbl.player_array[affect.affect_data];

            if (arg_0 == Effect.Remove ||
                player.in_combat == false ||
                gbl.spell_target.in_combat == false)
            {
                ovr024.remove_affect(null, Affects.clear_movement, gbl.spell_target);
                if (arg_0 == Effect.Add)
                {
                    affect.callAffectTable = false;
                    ovr024.remove_affect(affect, Affects.owlbear_hug_round_attack, player);
                }
            }
            else
            {
                player.attack1_AttacksLeft = 1;
                player.attack2_AttacksLeft = 0;
                player.attack1_DiceCount = 2;
                player.attack1_DiceSize = 8;

                AttackTarget(null, 2, gbl.spell_target, player);

                ovr025.clear_actions(player);

                if (gbl.spell_target.in_combat == false)
                {
                    ovr024.remove_affect(null, Affects.owlbear_hug_round_attack, player);
                    ovr024.remove_affect(null, Affects.clear_movement, gbl.spell_target);
                }
            }
        }
Exemple #2
0
        internal static void add_affect(bool call_spell_jump_list, int data, ushort minutes, Affects type, Player player)
        {
            Affect affect = new Affect(type, minutes, (byte)data, call_spell_jump_list);

            player.affects.Add(affect);
            //TODO simplify this funcation.
        }
Exemple #3
0
        // sub_4A60A
        internal static void AssignPlayerIconId(Player player)
        {
            player.icon_id = 0xff;

            gbl.TeamList.Add(player);
            gbl.SelectedPlayer = player;

            bool[] icon_slot = new bool[8];

            foreach (Player tmpPlayer in gbl.TeamList)
            {
                if (tmpPlayer.icon_id >= 0 && tmpPlayer.icon_id < 8)
                {
                    icon_slot[tmpPlayer.icon_id] = true;
                }
            }

            // Now find the lowest free icon slot.
            player.icon_id = 0;

            while (player.icon_id < 8 &&
                icon_slot[player.icon_id] == true)
            {
                player.icon_id += 1;
            }

            gbl.area2_ptr.party_size++;

            if (player.control_morale >= Control.NPC_Base)
            {
                ovr026.ReclacClassBonuses(player);
            }
        }
Exemple #4
0
 public void Clear()
 {
     target = null;
     map.x = 0;
     map.y = 0;
     originalBackgroundTile = 0;
 }
Exemple #5
0
        public void ExecuteDobbleMove(Player player)
        {
            Console.WriteLine("");
            Console.WriteLine("EXECUTE: Double move");

            for (int i = 0; i < 2; i++ )
            {
                Console.WriteLine("Hit arrow key for move");
                ConsoleKeyInfo keyInfo = Console.ReadKey();

                switch (keyInfo.Key)
                {
                    case ConsoleKey.UpArrow:
                        ExecuteMoveUp(player);
                        break;
                    case ConsoleKey.DownArrow:
                        ExecuteMoveDown(player);
                        break;
                    case ConsoleKey.LeftArrow:
                        executeMoveLeft(player);
                        break;
                    case ConsoleKey.RightArrow:
                        executeMoveRigth(player);
                        break;
                }
            }
            //Execute orer
        }
Exemple #6
0
        public void ExecuteMoveOrderTest(Player.Orders order, int end_x, int end_y)
        {
            //Arrange
            Team firsteTeam = new Team() { TeamName = "The greeks" };
            Team secondTeam = new Team() { TeamName = "Olsen banden" };

            Match thisMatch = new Match()
            {
                HomeTeam = firsteTeam,
                AwayTeam = secondTeam
            };

            Player alfred = new Player() { Name = "Alfred", Position = new Coordinate(1, 1), PlayerOrder = order, Team = firsteTeam };

            firsteTeam.PlayersOnTeam.Add(alfred);
            firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(2, 1), Team = firsteTeam });
            firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(1, 1), Team = firsteTeam });
            secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(1, 1), Team = secondTeam });
            secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(1, 1), Team = secondTeam });

            Player player = new Player();

            //act
            player.ExecuteOrders(thisMatch);

            //Assert
            Assert.Equal(end_x, alfred.Position.X);
            Assert.Equal(end_y, alfred.Position.Y);
        }
Exemple #7
0
 // has_action_timedout
 internal static void AffectBlink(Effect arg_0, object param, Player player)
 {
     if (player.actions.delay == 0)
     {
         gbl.targetInvisible = true;
         gbl.attack_roll = -1;
     }
 }
Exemple #8
0
        // sub_3A951
        internal static void AffectBlinded(Effect arg_0, object param, Player player)
        {
            gbl.attack_roll -= 4;

            player.ac -= 4;
            player.ac_behind -= 4;

            gbl.savingThrowRoll -= 4;
        }
Exemple #9
0
 public void Init()
 {
     Player player = new Player("Kindlar", "Fighter", "Elf", 1);
     Player = player;
     Player.PlayerClass.AssignBaseStats(10, 10, 10, 10, 10, 10);
     Player.CalculateTotalScore();
     Player.PlayerClass.CalculateBaseAttack();
     Player.GetTotalGroundSpeed();
 }
Exemple #10
0
 private void Awake()
 {
     repo = new PlayerRepository();
     DontDestroyOnLoad(this);
     //TODO: Vind uit waarom hier een Null Reference Exception uit komt
     if (player == null)
     {
         player = repo.Load();
         //player = new Classes.Player("Henk", 1, "Male", 0, 0, 0, 0, 0, 2); //Blijkbaar is dit een null reference exception
     }
 }
Exemple #11
0
        public GasCloud(Player _player, int count, Point pos)
        {
            player = _player;
            field_1C = count;
            targetPos = new Point(pos);
            field_1D = false;

            // zero the rest.
            groundTile = new int[10];
            present = new bool[10];
        }
Exemple #12
0
 internal static bool addAffect(ushort time, int data, Affects affect_type, Player player)
 {
     if (gbl.cureSpell == true)
     {
         return false;
     }
     else
     {
         ovr024.add_affect(true, data, time, affect_type, player);
         return true;
     }
 }
Exemple #13
0
        /*near_enermy*/
        internal static List<CombatPlayerIndex> BuildNearTargets(int max_range, Player player)
        {
            var scl = ovr032.Rebuild_SortedCombatantList(player, max_range, p => p.combat_team != player.combat_team);

            List<CombatPlayerIndex> nearTargets = new List<CombatPlayerIndex>();

            foreach (var sc in scl)
            {
                nearTargets.Add(new CombatPlayerIndex(sc.player, sc.pos));
            }

            return nearTargets;
        }
Exemple #14
0
        // hugs
        internal static void AffectOwlbearHugAttackCheck(Effect arg_0, object param, Player player)
        {
            if (gbl.attack_roll >= 18)
            {
                gbl.spell_target = player.actions.target;
                ovr025.DisplayPlayerStatusString(true, 12, "hugs " + gbl.spell_target.name, player);

                ovr024.add_affect(false, ovr033.GetPlayerIndex(gbl.spell_target), 0, Affects.clear_movement, gbl.spell_target);
                ovr013.CallAffectTable(Effect.Add, null, gbl.spell_target, Affects.clear_movement);

                ovr024.add_affect(true, ovr033.GetPlayerIndex(gbl.spell_target), 0, Affects.owlbear_hug_round_attack, player);
            }
        }
Exemple #15
0
        static void Main(string[] args)
        {
            Match newMatch = new Match();

            Match thisMatch = newMatch.SetupMatch();

            Board gameBoard = new Board();

            Player players = new Player();

            var homeTeamHand = thisMatch.HomeTeam.Hand();
            var awayTeamHand = thisMatch.AwayTeam.Hand();

            gameBoard.DrawBoard(thisMatch);

            //Turn loop
            for (int turn = 1; turn <= 9; turn++)
            {
                Console.WriteLine();
                Console.WriteLine("Start of turn {0}", turn);

                //Assign orders to all players in the Home match
                players.GiveOrders(thisMatch.HomeTeam, homeTeamHand);

                //Assign orders to all players in the away team
                players.GiveOrders(thisMatch.AwayTeam, awayTeamHand);

                //Execute Orders
                players.ExecuteOrders(thisMatch);

                //Find encounters - doesn't seem to work
                List<Coordinate> engagements = thisMatch.CompairePlayersCoordinates(thisMatch);
                Rolls roll = new Rolls();

                //Roll for all engagements
                foreach (Coordinate coordinate in engagements)
                {
                    Console.WriteLine("Engagement at {0},{1}", coordinate.X, coordinate.Y);
                    roll.RollForEngagement(coordinate, thisMatch);
                }

                Console.WriteLine("!-----New Turn------!");

                gameBoard.DrawBoard(thisMatch);
            }
        }
Exemple #16
0
        internal static void AffectBerzerk(Effect arg_0, object param, Player player)
        {
            if (arg_0 == Effect.Add)
            {
                player.quick_fight = QuickFight.True;

                if (player.control_morale < Control.NPC_Base ||
                    player.control_morale == Control.PC_Berzerk)
                {
                    player.control_morale = Control.PC_Berzerk;
                }
                else
                {
                    player.control_morale = Control.NPC_Berzerk;
                }

                if (gbl.game_state == GameState.Combat)
                {
                    player.actions.target = null;

                    var scl = ovr032.Rebuild_SortedCombatantList(player, 0xff, p => true);

                    player.actions.target = scl[0].player;

                    player.actions.can_cast = false;
                    player.combat_team = player.actions.target.OppositeTeam();

                    ovr025.DisplayPlayerStatusString(true, 10, "goes berzerk", player);
                }
            }
            else
            {
                if (player.control_morale == Control.PC_Berzerk)
                {
                    player.control_morale = Control.PC_Base;
                }

                player.combat_team = CombatTeam.Ours;
            }
        }
Exemple #17
0
        // sub_6621E
        internal static void CalcArmorWeightEffect(Item item, Player player)
        {
            if (gbl.ItemDataTable[item.type].item_slot == ItemSlot.Armor)
            {
                if (item.weight >= 0 && item.weight <= 150)
                {
                    player.movement = player.base_movement;
                }
                else if (item.weight >= 151 && item.weight <= 399)
                {
                    player.movement = 9;
                }
                else
                {
                    player.movement = 6;
                }

                if (player.movement != 0 && player.movement <= 9)
                {
                    player.movement += 3;
                }
            }
        }
Exemple #18
0
        private static void SaveVerseZeroBonus(Player player, bool applyBonus)
        {
            if (player.race == Race.dwarf ||
                player.race == Race.halfling ||
                applyBonus == true)
            {
                if (player.stats2.Con.full >= 4 && player.stats2.Con.full <= 6)
                {
                    player.saveVerse[0] += 1;
                }
                else if (player.stats2.Con.full >= 7 && player.stats2.Con.full <= 10)
                {
                    player.saveVerse[0] += 2;
                }
                else if (player.stats2.Con.full >= 11 && player.stats2.Con.full <= 13)
                {
                    player.saveVerse[0] += 3;
                }
                else if (player.stats2.Con.full >= 14 && player.stats2.Con.full <= 17)
                {
                    player.saveVerse[0] += 4;
                }
                else if (player.stats2.Con.full == 18)
                {
                    player.saveVerse[0] += 5;
                }
            }

            if (player.stats2.Con.full == 19 || player.stats2.Con.full == 20)
            {
                player.saveVerse[0] += 1;
            }
            else if (player.stats2.Con.full == 21 || player.stats2.Con.full == 22)
            {
                player.saveVerse[0] += 2;
            }
            else if (player.stats2.Con.full == 23 || player.stats2.Con.full == 24)
            {
                player.saveVerse[0] += 3;
            }
            else if (player.stats2.Con.full == 25)
            {
                player.saveVerse[0] += 4;
            }
        }
Exemple #19
0
        // getFirstSkill
        static ClassId HumanCurrentClass_Unknown(Player player)
        {
            if (player.race != Race.human)
            {
                return ClassId.unknown;
            }

            for (ClassId index = ClassId.cleric; index <= ClassId.monk; index++)
            {
                if (player.ClassLevel[(int)index] > 0)
                {
                    return index;
                }
            }

            return ClassId.unknown;
        }
Exemple #20
0
 // sub_6B3D1
 static bool DualClassExceedLastLevel(Player player)
 {
     return HumanCurrentClassLevel_Zero(player) > player.multiclassLevel;
 }
Exemple #21
0
        // sub_6A00F
        internal static void sub_6A00F(Player player)
        {
            for (int i = 0; i < 5; i++)
            {
                player.spellCastCount[0, i] = 0;
                player.spellCastCount[1, i] = 0;
                player.spellCastCount[2, i] = 0;
            }

            for (SkillType skill = SkillType.Cleric; skill <= SkillType.Monk; skill++)
            {
                int skillLevel = player.SkillLevel(skill);

                if (skillLevel > 0)
                {
                    switch (skill)
                    {
                        case SkillType.Cleric:
                            player.spellCastCount[0, 0] += 1;

                            for (int PlayerLvl = 0; PlayerLvl <= (skillLevel - 2); PlayerLvl++)
                            {
                                for (int sp_lvl = 0; sp_lvl < 5; sp_lvl++)
                                {
                                    player.spellCastCount[0, sp_lvl] += ClericSpellLevels[PlayerLvl, sp_lvl];
                                }
                            }

                            calc_cleric_spells(false, player);

                            foreach (Spells spell in System.Enum.GetValues(typeof(Spells)))
                            {
                                SpellEntry se = gbl.spellCastingTable[(int)spell];

                                int sp_class = (se.spellLevel - 1) / 5;
                                int sp_lvl = (se.spellLevel - 1) % 5;

                                if (se.spellClass == 0 &&
                                    player.spellCastCount[sp_class, sp_lvl] > 0 &&
                                    spell != Spells.animate_dead)
                                {
                                    player.LearnSpell(spell);
                                }
                            }
                            break;

                        case SkillType.Paladin:
                            if (skillLevel > 8)
                            {
                                for (int addLvl = 8; addLvl < skillLevel; addLvl++)
                                {
                                    for (int spellLvl = 0; spellLvl < 5; spellLvl++)
                                    {
                                        player.spellCastCount[0, spellLvl] += PaladinSpellLevels[addLvl, spellLvl];
                                    }
                                }

                                foreach (Spells spell in System.Enum.GetValues(typeof(Spells)))
                                {
                                    SpellEntry se = gbl.spellCastingTable[(int)spell];
                                    int sp_class = (se.spellLevel - 1) / 5;
                                    int sp_lvl = (se.spellLevel - 1) % 5;

                                    if (se.spellClass == 0 &&
                                        player.spellCastCount[sp_class, sp_lvl] > 0)
                                    {
                                        player.LearnSpell(spell);
                                    }
                                }
                            }
                            break;

                        case SkillType.Ranger:
                            if (skillLevel > 7)
                            {
                                for (int var_3 = 8; var_3 <= skillLevel; var_3++)
                                {
                                    for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++)
                                    {
                                        player.spellCastCount[1, sp_lvl] += unk_1A758[var_3, sp_lvl];
                                    }

                                    for (int sp_lvl = 3; sp_lvl < 5; sp_lvl++)
                                    {
                                        player.spellCastCount[2, sp_lvl - 3] += unk_1A758[var_3, sp_lvl];
                                    }
                                }

                                foreach (Spells spell in System.Enum.GetValues(typeof(Spells)))
                                {
                                    if (gbl.spellCastingTable[(int)spell].spellClass == SpellClass.Druid)
                                    {
                                        player.LearnSpell(spell);
                                    }
                                }
                            }

                            break;

                        case SkillType.MagicUser:
                            player.spellCastCount[2, 0] += 1;

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

            foreach (Item item in player.items)
            {
                if (item.affect_3 == Affects.protect_magic && item.readied)
                {
                    for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++)
                    {
                        player.spellCastCount[2, sp_lvl] *= 2;
                    }
                }
            }
        }
Exemple #22
0
        /* sub_6AD3E */
        internal static bool SecondClassAllowed(ClassId _class, Player player)
        {
            var firstClass = HumanCurrentClass_Unknown(player);
            bool var_2 = _class != firstClass;

            int var_3 = 0;
            while (var_3 <= 5 &&
                (gbl.class_stats_min[(int)firstClass][var_3] < 9 || player.stats2[var_3].cur > 14))
            {
                var_3++;
            }

            var_2 = (var_2 == true && var_3 > 5);
            var_3 = 0;

            while (var_3 <= 5 &&
                (gbl.class_stats_min[(int)_class][var_3] < 9 || player.stats2[var_3].cur > 16))
            {
                var_3++;
            }

            var_2 = (var_2 == true && var_3 > 5);

            byte var_4 = 1;

            while (gbl.class_alignments[(int)_class, 0] >= var_4 &&
                gbl.class_alignments[(int)_class, var_4] != player.alignment)
            {
                var_4++;
            }

            if (var_2 == false ||
                gbl.class_alignments[(int)_class, 0] < var_4)
            {
                var_2 = false;
            }
            else
            {
                var_2 = true;
            }

            return var_2;
        }
Exemple #23
0
        // sub_6AAEA
        internal static void reclac_thief_skills(Player player)
        {
            byte var_2 = 0; //Simeon

            var item_found = player.items.Find(item => item.readied && (item.ScrollLearning(3, 2) || item.ScrollLearning(3, 11)));
            var var_A = item_found != null && item_found.ScrollLearning(3, 11);
            var var_B = item_found != null && item_found.ScrollLearning(3, 2);

            int thiefLvl = player.SkillLevel(SkillType.Thief);

            if (thiefLvl < 4 && var_B == true)
            {
                thiefLvl = 4;
                var_B = false;
            }

            int orig_thief_lvl = thiefLvl;

            for (int skill = 1; skill <= 8; skill++)
            {
                if (var_A == true)
                {
                    switch (skill)
                    {
                        case 1:
                            if (thiefLvl < 5)
                            {
                                thiefLvl = 5;
                                var_2 = 0;
                            }
                            else
                            {
                                var_2 = 5;
                            }
                            break;

                        case 2:
                            if (thiefLvl < 7)
                            {
                                thiefLvl = 7;
                                var_2 = 0;
                            }
                            else
                            {
                                var_2 = 5;
                            }
                            break;
                    }
                }

                if (unk_1A230[(int)player.race, skill] < 0 &&
                    base_chance[thiefLvl, skill] < (System.Math.Abs(unk_1A230[(int)player.race, skill]) + var_2))
                {
                    player.thief_skills[skill - 1] = 0;
                }
                else
                {
                    player.thief_skills[skill - 1] = (byte)(var_2 + base_chance[thiefLvl, skill] + unk_1A230[(int)player.race, skill]);

                    if (skill < 6)
                    {
                        player.thief_skills[skill - 1] += (byte)unk_1A243[player.stats2.Dex.full, skill];
                    }

                }

                if (var_B == true)
                {
                    player.thief_skills[skill - 1] += 10;
                }

                thiefLvl = orig_thief_lvl;
            }
        }
Exemple #24
0
        // sub_6A3C6
        internal static void ReclacClassBonuses(Player player)
        {
            player.thac0 = 0;

            for (int _class = 0; _class <= 7; _class++)
            {
                byte class_lvl = player.ClassLevel[_class];

                player.thac0 = System.Math.Max(ovr018.thac0_table[_class, class_lvl], player.thac0);
                player.HitDice = System.Math.Max(class_lvl, player.HitDice);
            }

            if (player.fighter_lvl >= 7 ||
                player.paladin_lvl >= 7 ||
                player.ranger_lvl >= 8)
            {
                player.attacksCount = 3;
            }

            sub_6A00F(player);
            reclac_saving_throws(player);

            if (player.thief_lvl > 0)
            {
                reclac_thief_skills(player);
            }

            player.classFlags = 0;

            for (int skill = 0; skill <= 7; skill++)
            {
                if (player.ClassLevel[skill] > 0 ||
                    (player.ClassLevelsOld[skill] > 0 && player.ClassLevelsOld[skill] < player.HitDice))
                {
                    player.classFlags += ovr018.unk_1A1B2[skill];
                }
            }

            player.activeItems.UndreadyAll(player.classFlags);

            if (DualClassExceedLastLevel(player) == true)
            {
                for (int class_index = 0; class_index <= 7; class_index++)
                {
                    byte skill_lvl = player.ClassLevelsOld[class_index];

                    if (class_index == 2 || class_index == 3)
                    {
                        if (skill_lvl > 6)
                        {
                            player.attacksCount = 3;
                        }
                    }
                    else if (class_index == 4)
                    {
                        if (skill_lvl > 7)
                        {
                            player.attacksCount = 3;
                        }
                    }

                    if (ovr018.thac0_table[class_index, skill_lvl] > player.thac0)
                    {
                        player.thac0 = ovr018.thac0_table[class_index, skill_lvl];
                    }
                }

                if (player.fighter_old_lvl > 6 ||
                    player.ranger_old_lvl > 7 ||
                    player.paladin_old_lvl > 6)
                {
                    player.attacksCount = 3;
                }

                if (player.thief_old_lvl > 0)
                {
                    reclac_thief_skills(player);
                }
            }
        }
Exemple #25
0
        /* hasAnySkills */
        internal static byte HumanCurrentClassLevel_Zero(Player player)
        {
            if (player.race != Race.human)
            {
                return 0;
            }

            int loop_var = 0;

            while (loop_var < 7 &&
                player.ClassLevel[loop_var] == 0)
            {
                loop_var++;
            }

            return player.ClassLevel[loop_var];
        }
Exemple #26
0
        internal static void DuelClass(Player player)
        {
            List<MenuItem> list = new List<MenuItem>();

            list.Add(new MenuItem("Pick New Class", true));

            foreach (var _class in gbl.RaceClasses[(int)player.race])
            {
                if (SecondClassAllowed(_class, player) == true)
                {
                    list.Add(new MenuItem(ovr020.classString[(int)_class]));
                }
            }

            if (list.Count == 1)
            {
                seg041.DisplayStatusText(15, 4, player.name + " doesn't qualify.");
                list.Clear();
                return;
            }

            MenuItem list_ptr;
            int index = 1;
            bool show_exit = true;
            bool var_F = true;

            char input_key;

            do
            {
                input_key = ovr027.sl_select_item(out list_ptr, ref index, ref var_F, show_exit, list,
                    0x16, 0x26, 2, 1, gbl.defaultMenuColors, "Select", string.Empty);

                if (input_key == 0)
                {
                    return;
                }
            } while (input_key != 'S');

            player.exp = 0;
            player.attacksCount = 2;
            int newClass = 0;

            while (newClass <= 7 && ovr020.classString[newClass] != list_ptr.Text)
            {
                newClass++;
            }

            list.Clear();

            player.ClassLevelsOld[(int)HumanCurrentClass_Unknown(player)] = HumanCurrentClassLevel_Zero(player);

            player.multiclassLevel = player.HitDice;
            player.HitDice = 1;

            player.ClassLevel[(int)HumanCurrentClass_Unknown(player)] = 0;
            player.ClassLevel[newClass] = 1;

            for (int i = 0; i < 5; i++)
            {
                player.spellCastCount[0, i] = 0;
                player.spellCastCount[1, i] = 0;
                player.spellCastCount[2, i] = 0;
            }

            if (newClass == 0)
            {
                player.spellCastCount[0, 0] = 1;
            }
            else if (newClass == 5)
            {
                player.spellCastCount[2, 0] = 1;
                player.LearnSpell(Spells.detect_magic_MU);
                player.LearnSpell(Spells.read_magic);
                player.LearnSpell(Spells.sleep);
            }

            player._class = (ClassId)newClass;

            seg041.DisplayStatusText(0, 10, player.name + " is now a 1st level " + ovr020.classString[newClass] + ".");

            player.spellList.Clear();

            ReclacClassBonuses(player);
            calc_cleric_spells(true, player);
            reclac_saving_throws(player);
            reclac_thief_skills(player);

            foreach (var item in player.items)
            {
                if ((gbl.ItemDataTable[item.type].classFlags & player.classFlags) == 0 &&
                    item.cursed == false)
                {
                    item.readied = false;
                }
            }
        }
Exemple #27
0
        /* sub_6A686 */
        internal static void calc_cleric_spells(bool ResetSpellLevels, Player player)
        {
            int clericLvl = player.SkillLevel(SkillType.Cleric);

            if (clericLvl > 0)
            {
                if (ResetSpellLevels == true)
                {
                    for (int sp_lvl = 1; sp_lvl < 5; sp_lvl++)
                    {
                        player.spellCastCount[0, sp_lvl] = 0;
                    }

                    player.spellCastCount[0, 0] = 1;

                    for (int playerLvl = 0; playerLvl <= (clericLvl - 2); playerLvl++)
                    {
                        for (int spellLvl = 0; spellLvl < 5; spellLvl++)
                        {
                            player.spellCastCount[0, spellLvl] += ClericSpellLevels[playerLvl, spellLvl];
                        }
                    }
                }

                if (player.stats2.Wis.full > 12 && player.spellCastCount[0, 0] > 0)
                {
                    player.spellCastCount[0, 0] += 1;
                }

                if (player.stats2.Wis.full > 13 && player.spellCastCount[0, 0] > 0)
                {
                    player.spellCastCount[0, 0] += 1;
                }

                if (player.stats2.Wis.full > 14 && player.spellCastCount[0, 1] > 0)
                {
                    player.spellCastCount[0, 1] += 1;
                }

                if (player.stats2.Wis.full > 15 && player.spellCastCount[0, 1] > 0)
                {
                    player.spellCastCount[0, 1] += 1;
                }

                if (player.stats2.Wis.full > 16 && player.spellCastCount[0, 2] > 0)
                {
                    player.spellCastCount[0, 2] += 1;
                }

                if (player.stats2.Wis.full > 17 && player.spellCastCount[0, 3] > 0)
                {
                    player.spellCastCount[0, 3] += 1;
                }
            }
        }
Exemple #28
0
        /// <summary>
        /// Finds number of players for each team at a coordinate at rolls to find a winner
        /// 
        /// </summary>
        public void RollForEngagement(Coordinate coordinate, Match match)
        {
            List<Player> homePlayersAtCoordinate = new List<Player>();
            List<Player> awayPlayerAtCoordinate = new List<Player>();

            foreach (Player somePlayer in match.GetPlayersAtCoordinate(coordinate, match))
            {
                if (somePlayer.Team.TeamName == match.HomeTeam.TeamName)
                {
                    homePlayersAtCoordinate.Add(somePlayer);
                }
                else
                {
                    awayPlayerAtCoordinate.Add(somePlayer);
                }
            }

            Console.WriteLine(match.HomeTeam.TeamName + " has " + homePlayersAtCoordinate.Count + " players at coordinate 2,2");
            Console.WriteLine(match.AwayTeam.TeamName + " has " + awayPlayerAtCoordinate.Count + " players at coordinate 2,2");

            //roll for greek players at coordinate
            Random rnd = new Random();

            int rollHome = rnd.Next(1, 7);
            int rollAway = rnd.Next(1, 7);

            Console.WriteLine(match.HomeTeam.TeamName + " rolls " + rollHome);
            Console.WriteLine(match.AwayTeam.TeamName + " rolls " + rollAway);

            //+2 til roll pr. player at coordinate.
            int modifiedGreekRoll = rollHome + homePlayersAtCoordinate.Count * 2;
            int modifiedOlsenRoll = rollAway + awayPlayerAtCoordinate.Count * 2;

            Console.WriteLine("greek modified roll is" + modifiedGreekRoll);
            Console.WriteLine("Olsen modified roll is" + modifiedOlsenRoll);

            ResultOfEngagement engagementResult = FindWinner(match, modifiedGreekRoll, modifiedOlsenRoll);

            var downedPlayer = new Player();
            //add effect (down player, equals half a player next round and can't move.
            if (engagementResult != ResultOfEngagement.Tie)
            {
                downedPlayer = EffectOfEngangement(engagementResult, homePlayersAtCoordinate, awayPlayerAtCoordinate);
            }
            else
            {
                Console.WriteLine("Its was a tie, no player downed");
            }

            if (downedPlayer != null)
            {
                if (match.MatchBall.PlayerWithBall == downedPlayer)
                {
                    //give player to another player at that coordinate
                }
                Console.WriteLine(downedPlayer.Name + " " + downedPlayer.State);
            }

            Console.WriteLine(engagementResult.ToString());
        }
Exemple #29
0
        // free_players
        internal static Player FreeCurrentPlayer(Player player, bool free_icon, bool leave_party_size)
        {
            int index = gbl.TeamList.IndexOf(player);

            if (index >= 0)
            {
                gbl.TeamList.RemoveAt(index);

                if (free_icon)
                {
                    ovr034.ReleaseCombatIcon(player.icon_id);
                }

                if (leave_party_size == false)
                {
                    gbl.area2_ptr.party_size--;
                }

                FreePlayer(player);

                index = index > 0 ? index - 1 : 0;
                if (gbl.TeamList.Count > 0)
                {
                    return gbl.TeamList[index];
                }
            }

            return null;
        }
Exemple #30
0
        static void Main(string[] args)
        {
            string buffer;
            string greeting;

            if (DateTime.Now.Hour < 12)
            {
                greeting = "Morning";
            }
            else if (DateTime.Now.Hour < 5)
            {
                greeting = "Afternoon";
            }
            else
            {
                greeting = "Evening";
            }
            //Get Username
            Console.Write($"Good {greeting} adventurer! What is your name: ");
            string username = Console.ReadLine();
            Player user     = new Classes.Player(username);

            Console.Clear();

            //Get Difficulty Level
            Console.WriteLine($"AH! Yes {user.name} glad to see you as always. Or is this our first meeting? . . .");
            Console.WriteLine($"\t. . . no matter. As usual I will give you 10 gold and you will embark on an epic quest.\n");
            Console.WriteLine($"What level of difficulty are you looking for this time?");
            int selection;

            string[] difficulties = new string[] { "Easy", "Normal", "Hard", "Nightmare" };
            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine($"{(i + 1)}\t{difficulties[i]}");
            }
            //Selection error catching
            while (true)
            {
                Console.Write("Selection: ");
                buffer = Console.ReadLine();
                try
                {
                    selection = Int32.Parse(buffer);
                }
                catch
                {
                    buffer    = string.Empty;
                    selection = -1;
                }
                if (selection > 0 && selection < 5)
                {
                    selection--;
                    Console.WriteLine($"Ah, going with a(n) {difficulties[selection]} adventure. Good choice!");
                    break;
                }
                Console.WriteLine("\n\tInvalid Selection");
            }
            Console.Clear();

            Console.WriteLine($"Before you go {user.name}, make sure to get some gear.\n");
            bool onward = true;

            while (onward)
            {
                Shop introShop = new Shop(user.level);
                introShop.Use(ref user);

                //Combat Tutorial
                Console.WriteLine("\nWould you like to train in combat against the dummy first?");
                buffer = Console.ReadLine().ToLower();
                if (buffer.Contains('y'))
                {
                    Combat        combat = new Combat();
                    TrainingDummy dummy  = new TrainingDummy();
                    combat.Fight(ref user, dummy);
                }
                else
                {
                    Console.WriteLine("I get it. Eager to start.");
                }


                //game loop
                while (user.health >= 1)
                {
                    Difficulty difficulty = new Difficulty(0);
                    //Load Difficulty possibly add difficulty change later also to allow biome change
                    switch (difficulties[selection])
                    {
                    case ("Easy"):
                    {
                        difficulty = new Difficulty(0);
                        break;
                    }

                    case ("Normal"):
                    {
                        difficulty = new Difficulty(1);
                        break;
                    }

                    case ("Hard"):
                    {
                        difficulty = new Difficulty(2);
                        break;
                    }

                    case ("Nightmare"):
                    {
                        difficulty = new Difficulty(3);
                        break;
                    }

                    default:
                        break;
                    }

                    //Questing
                    difficulty.Display(ref user);
                    //Shop
                    if (user.health > 0)
                    {
                        Shop shop = new Shop(user.level);
                        shop.Use(ref user);
                    }
                }

                Console.WriteLine("You have died your quest has ended.");
                Console.Write("Retry?(y/n): ");
                if (Console.ReadLine() == "n")
                {
                    onward = false;
                }
                else
                {
                    user = new Player(username);
                }
            }
        }
Exemple #31
0
        internal static void createPlayer()
        {
            bool menuRedraw;
            bool showExit;
            byte var_20;
            short var_1E;
            byte var_1B;

            char input_key;
            int index;
            MenuItem selected;

            Player player = new Player();

            for (int i = 0; i < 6; i++)
            {
                player.icon_colours[i] = (byte)(((gbl.default_icon_colours[i] + 8) << 4) + gbl.default_icon_colours[i]);
            }

            player.base_ac = 50;
            player.thac0 = 40;
            player.health_status = Status.okey;
            player.in_combat = true;
            player.field_DE = 1;
            player.mod_id = (byte)seg051.Random(256);
            player.icon_id = 0x0A;

            List<MenuItem> var_C = new List<MenuItem>();
            var_C.Add(new MenuItem("Pick Race", true));

            var_C.Add(new MenuItem("  " + ovr020.raceString[1]));
            var_C.Add(new MenuItem("  " + ovr020.raceString[2]));
            var_C.Add(new MenuItem("  " + ovr020.raceString[3]));
            var_C.Add(new MenuItem("  " + ovr020.raceString[4]));
            var_C.Add(new MenuItem("  " + ovr020.raceString[5]));
            var_C.Add(new MenuItem("  " + ovr020.raceString[7]));

            index = 0;
            menuRedraw = true;
            showExit = true;

            do
            {
                input_key = ovr027.sl_select_item(out selected, ref index, ref menuRedraw, showExit, var_C,
                    22, 38, 2, 1, gbl.defaultMenuColors, "Select", string.Empty);

                if (input_key == '\0')
                {
                    var_C.Clear();
                    return;
                }
            } while (input_key != 'S');

            if (index == 6)
            {
                index++;
            }

            player.race = (Race)index;

            switch (player.race)
            {
                case Race.halfling:
                    player.icon_size = 1;
                    ovr024.add_affect(false, 0xff, 0, Affects.con_saving_bonus, player);
                    break;

                case Race.dwarf:
                    player.icon_size = 1;
                    ovr024.add_affect(false, 0xff, 0, Affects.con_saving_bonus, player);
                    ovr024.add_affect(false, 0xff, 0, Affects.dwarf_vs_orc, player);
                    ovr024.add_affect(false, 0xff, 0, Affects.dwarf_and_gnome_vs_giants, player);
                    break;

                case Race.gnome:
                    player.icon_size = 1;
                    ovr024.add_affect(false, 0xff, 0, Affects.con_saving_bonus, player);
                    ovr024.add_affect(false, 0xff, 0, Affects.gnome_vs_man_sized_giant, player);
                    ovr024.add_affect(false, 0xff, 0, Affects.dwarf_and_gnome_vs_giants, player);
                    ovr024.add_affect(false, 0xff, 0, Affects.affect_30, player);
                    break;

                case Race.elf:
                    player.icon_size = 2;
                    ovr024.add_affect(false, 0xff, 0, Affects.elf_resist_sleep, player);

                    break;

                case Race.half_elf:
                    player.icon_size = 2;
                    ovr024.add_affect(false, 0xff, 0, Affects.halfelf_resistance, player);
                    break;

                default:
                    player.icon_size = 2;
                    break;
            }

            /* Gender */

            var_C.Clear();

            var_C.Add(new MenuItem("Pick Gender", true));
            var_C.Add(new MenuItem("  " + ovr020.sexString[0]));
            var_C.Add(new MenuItem("  " + ovr020.sexString[1]));

            index = 1;
            showExit = true;
            menuRedraw = true;

            do
            {
                input_key = ovr027.sl_select_item(out selected, ref index, ref menuRedraw, showExit, var_C,
                    22, 38, 2, 1, gbl.defaultMenuColors, "Select", string.Empty);

                if (input_key == '\0')
                {
                    var_C.Clear();
                    player = null;
                    return;
                }

            } while (input_key != 'S');

            player.sex = (byte)(index - 1);
            var_C.Clear();

            var_C.Add(new MenuItem("Pick Class", true));

            var ClassList = gbl.RaceClasses[(int)player.race];
            if (player.race != Race.human && Cheats.no_race_class_restrictions)
            {
                ClassList = gbl.RaceClasses[(int)Race.human + 1];
            }

            foreach (var _class in ClassList)
            {
                var_C.Add(new MenuItem("  " + ovr020.classString[(int)_class]));
            }

            index = 1;
            showExit = true;
            menuRedraw = true;

            do
            {
                input_key = ovr027.sl_select_item(out selected, ref index, ref menuRedraw, showExit, var_C,
                    22, 38, 2, 1, gbl.defaultMenuColors, "Select", string.Empty);

                if (input_key == '\0')
                {
                    var_C.Clear();
                    player = null;
                    return;
                }
            } while (input_key != 'S');

            player.exp = 25000;
            player._class = ClassList[index - 1];
            player.HitDice = 1;

            if (player._class >= ClassId.cleric && player._class <= ClassId.fighter)
            {
                player.ClassLevel[(int)player._class] = 1;
            }
            else if (player._class >= ClassId.magic_user && player._class <= ClassId.monk)
            {
                player.ClassLevel[(int)player._class] = 1;
            }
            else if (player._class == ClassId.paladin)
            {
                player.paladinCuresLeft = 1;
                player.paladin_lvl = 1;
                ovr024.add_affect(false, 0xff, 0, Affects.protection_from_evil, player);
            }
            else if (player._class == ClassId.ranger)
            {
                player.ranger_lvl = 1;
                ovr024.add_affect(false, 0xff, 0, Affects.ranger_vs_giant, player);
            }
            else if (player._class == ClassId.mc_c_f)
            {
                player.cleric_lvl = 1;
                player.fighter_lvl = 1;
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_c_f_m)
            {
                player.cleric_lvl = 1;
                player.fighter_lvl = 1;
                player.magic_user_lvl = 1;
                player.exp = 8333;
            }
            else if (player._class == ClassId.mc_c_r)
            {
                player.cleric_lvl = 1;
                player.ranger_lvl = 1;
                ovr024.add_affect(false, 0xff, 0, Affects.ranger_vs_giant, player);
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_c_mu)
            {
                player.cleric_lvl = 1;
                player.magic_user_lvl = 1;
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_c_t)
            {
                player.cleric_lvl = 1;
                player.thief_lvl = 1;
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_f_mu)
            {
                player.fighter_lvl = 1;
                player.magic_user_lvl = 1;
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_f_t)
            {
                player.fighter_lvl = 1;
                player.thief_lvl = 1;
                player.exp = 12500;
            }
            else if (player._class == ClassId.mc_f_mu_t)
            {
                player.fighter_lvl = 1;
                player.magic_user_lvl = 1;
                player.thief_lvl = 1;
                player.exp = 8333;
            }
            else if (player._class == ClassId.mc_mu_t)
            {
                player.magic_user_lvl = 1;
                player.thief_lvl = 1;
                player.exp = 8333;
            }

            if (player.thief_lvl > 0)
            {
                ovr026.reclac_thief_skills(player);
            }

            player.classFlags = 0;
            player.thac0 = 0;

            for (int class_idx = 0; class_idx <= 7; class_idx++)
            {
                if (player.ClassLevel[class_idx] > 0)
                {
                    int skill_lvl = player.ClassLevel[class_idx];

                    if (thac0_table[class_idx, skill_lvl] > player.thac0)
                    {
                        player.thac0 = thac0_table[class_idx, skill_lvl];
                    }

                    player.classFlags += unk_1A1B2[class_idx];
                }
            }

            ovr026.reclac_saving_throws(player);
            var_C.Clear();

            int alignments = gbl.class_alignments[(int)player._class, 0];

            var_C.Add(new MenuItem("Pick Alignment", true));

            for (int i = 1; i <= alignments; i++)
            {
                var_C.Add(new MenuItem("  " + ovr020.alignmentString[gbl.class_alignments[(int)player._class, i]]));
            }

            index = 1;
            showExit = true;
            menuRedraw = true;

            do
            {
                input_key = ovr027.sl_select_item(out selected, ref index, ref menuRedraw, showExit, var_C,
                    22, 38, 2, 1, gbl.defaultMenuColors, "Select", string.Empty);

                if (input_key == '\0')
                {
                    var_C.Clear();

                    player = null;
                    return;
                }
            } while (input_key != 'S');

            player.alignment = gbl.class_alignments[(int)player._class, index];

            var_C.Clear();

            if (player._class <= ClassId.monk)
            {
                SubStruct_1A35E v5 = gbl.race_ages[(int)player.race][player._class];

                player.age = (short)(ovr024.roll_dice(v5.dice_size, v5.dice_count) + v5.base_age);
            }
            else
            {
                int race = (int)player.race;

                switch (player._class)
                {
                    case ClassId.mc_c_f:
                    case ClassId.mc_c_f_m:
                    case ClassId.mc_c_t:
                    case ClassId.mc_c_r:
                        player.age = (short)(gbl.race_ages[race][0].base_age + (gbl.race_ages[race][0].dice_count * gbl.race_ages[race][0].dice_size));
                        break;

                    case ClassId.mc_f_mu:
                    case ClassId.mc_f_mu_t:
                    case ClassId.mc_mu_t:
                        player.age = (short)(gbl.race_ages[race][6].base_age + (gbl.race_ages[race][6].dice_count * gbl.race_ages[race][6].dice_size));
                        break;

                    case ClassId.mc_f_t:
                        player.age = (short)(gbl.race_ages[race][2].base_age + (gbl.race_ages[race][2].dice_count * gbl.race_ages[race][2].dice_size));
                        break;
                }
            }

            Player gblPlayerPtrBkup = gbl.SelectedPlayer;
            gbl.SelectedPlayer = player;
            ovr020.playerDisplayFull(player);

            do
            {
                for (int class_idx = 0; class_idx <= 7; class_idx++)
                {
                    if (player.ClassLevel[class_idx] > 0)
                    {
                        player.ClassLevel[class_idx] = 1;
                    }
                }

                player.stats2.Str.full = 0;
                player.stats2.Int.full = 0;
                player.stats2.Wis.full = 0;
                player.stats2.Dex.full = 0;
                player.stats2.Con.full = 0;
                player.stats2.Cha.full = 0;
                player.stats2.Str00.full = 0;

                for(int i = 0; i < 6; i++)
                {
                    player.stats2.Str.full = Math.Max(player.stats2.Str.full, ovr024.roll_dice(6, 3) + 1);
                    player.stats2.Int.full = Math.Max(player.stats2.Int.full, ovr024.roll_dice(6, 3) + 1);
                    player.stats2.Wis.full = Math.Max(player.stats2.Wis.full, ovr024.roll_dice(6, 3) + 1);
                    player.stats2.Dex.full = Math.Max(player.stats2.Dex.full, ovr024.roll_dice(6, 3) + 1);
                    player.stats2.Con.full = Math.Max(player.stats2.Con.full, ovr024.roll_dice(6, 3) + 1);
                    player.stats2.Cha.full = Math.Max(player.stats2.Cha.full, ovr024.roll_dice(6, 3) + 1);
                }

                int race = (int)player.race;
                int sex = player.sex;

                for (var_1B = 0; var_1B < 6; var_1B++)
                {
                    switch ((Stat)var_1B)
                    {
                        case Stat.STR:
                            player.stats2.Str.AgeEffects(race, player.age);
                            player.stats2.Str.EnforceRaceSexLimits(race, sex);
                            player.stats2.Str.EnforceClassLimits((int)player._class);

                            if (player.stats2.Str.full == 18)
                            {
                                if (player.fighter_lvl > 0 ||
                                    player.ranger_lvl > 0 ||
                                    player.paladin_lvl > 0)
                                {
                                    player.stats2.Str00.Load(seg051.Random(100) + 1);
                                    player.stats2.Str00.EnforceRaceSexLimits(race, sex);
                                }
                            }
                            break;

                        case Stat.INT:
                            player.stats2.Int.AgeEffects(race, player.age);
                            player.stats2.Int.EnforceRaceSexLimits(race, sex);
                            player.stats2.Int.EnforceClassLimits((int)player._class);
                            break;

                        case Stat.WIS:
                            player.stats2.Wis.AgeEffects(race, player.age);
                            player.stats2.Wis.EnforceRaceSexLimits(race, sex);
                            player.stats2.Wis.EnforceClassLimits((int)player._class);

                            if (player.stats2.Wis.full < 13 &&
                                player._class >= ClassId.mc_c_f && player._class <= ClassId.mc_c_t)
                            {
                                // Multi-Class Cleric
                                player.stats2.Wis.full = 13;
                            }
                            break;

                        case Stat.DEX:
                            player.stats2.Dex.AgeEffects(race, player.age);
                            player.stats2.Dex.EnforceRaceSexLimits(race, sex);
                            player.stats2.Dex.EnforceClassLimits((int)player._class);
                            break;

                        case Stat.CON:
                            player.stats2.Con.AgeEffects(race, player.age);
                            player.stats2.Con.EnforceRaceSexLimits(race, sex);
                            player.stats2.Con.EnforceClassLimits((int)player._class);
                            break;

                        case Stat.CHA:
                            player.stats2.Cha.AgeEffects(race, player.age);
                            player.stats2.Cha.EnforceRaceSexLimits(race, sex);
                            player.stats2.Cha.EnforceClassLimits((int)player._class);
                            break;
                    }

                    ovr020.display_stat(false, var_1B);
                }

                player.hit_point_current = player.hit_point_max;
                player.attacksCount = 2;
                player.attack1_DiceCountBase = 1;
                player.attack1_DiceSizeBase = 2;
                player.field_125 = 1;
                player.base_movement = 12;
                var_20 = 0;

                for (int i = 0; i < 5; i++)
                {
                    player.spellCastCount[0, i] = 0;
                    player.spellCastCount[1, i] = 0;
                    player.spellCastCount[2, i] = 0;
                }

                for (int class_idx = 0; class_idx <= 7; class_idx++)
                {
                    if (player.ClassLevel[class_idx] > 0)
                    {
                        if (class_idx == 0)
                        {
                            player.spellCastCount[0, 0] = 1;
                        }
                        else if (class_idx == 5)
                        {
                            player.spellCastCount[2, 0] = 1;
                        }

                        //var_21 += ovr024.roll_dice(unk_1A8C4[class_idx], unk_1A8C3[class_idx]);
                        //TODO this was not used in original code.

                        if (class_idx == 0)
                        {
                            ovr026.calc_cleric_spells(false, player);

                            foreach (Spells spell in System.Enum.GetValues(typeof(Spells)))
                            {
                                SpellEntry stru = gbl.spellCastingTable[(int)spell];

                                if (stru.spellClass == 0 && stru.spellLevel == 1)
                                {
                                    player.LearnSpell(spell);
                                }
                            }
                        }
                        else if (class_idx == 5)
                        {
                            player.LearnSpell(Spells.detect_magic_MU);
                            player.LearnSpell(Spells.read_magic);
                            player.LearnSpell(Spells.enlarge);
                            player.LearnSpell(Spells.sleep);
                        }

                        var_20++;
                    }
                }

                player.Money.SetCoins(Money.Platinum, 300);
                player.hit_point_rolled = sub_509E0(0xff, player);
                player.hit_point_max = player.hit_point_rolled;

                var_1E = get_con_hp_adj(player);

                if (var_1E < 0)
                {
                    if (player.hit_point_max > (System.Math.Abs(var_1E) + var_20))
                    {
                        player.hit_point_max = (byte)((player.hit_point_max + var_1E) / var_20);
                    }
                    else
                    {
                        player.hit_point_max = 1;
                    }
                }
                else
                {
                    player.hit_point_max = (byte)((player.hit_point_max + var_1E) / var_20);
                }

                player.hit_point_current = player.hit_point_max;
                player.hit_point_rolled = (byte)(player.hit_point_rolled / var_20);
                byte trainingClassMaskBackup = gbl.area2_ptr.training_class_mask;

                ovr017.SilentTrainPlayer();

                gbl.area2_ptr.training_class_mask = trainingClassMaskBackup;
                bool first_lvl = true;
                string text = string.Empty;

                for (int class_idx = 0; class_idx <= 7; class_idx++)
                {
                    if (player.ClassLevel[class_idx] > 0 ||
                        (player.ClassLevelsOld[class_idx] < ovr026.HumanCurrentClassLevel_Zero(player) &&
                         player.ClassLevelsOld[class_idx] > 0))
                    {
                        if (first_lvl == false)
                        {
                            text += "/";
                        }

                        byte b = player.ClassLevelsOld[class_idx];
                        b += player.ClassLevel[class_idx];

                        text += b.ToString();

                        first_lvl = false;
                    }
                }

                seg041.displayString(text, 0, 15, 15, 7);
                ovr020.display_player_stats01();
                ovr020.displayMoney();

                input_key = ovr027.yes_no(gbl.defaultMenuColors, "Reroll stats? ");

            } while (input_key != 'N');

            ovr020.playerDisplayFull(player);

            do
            {
                player.name = seg041.getUserInputString(15, 0, 13, "Character name: ");
            } while (player.name.Length == 0);

            icon_builder();

            //for (var_1B = 0; var_1B <= 5; var_1B++)
            //{
            //    player.stats2[var_1B].cur = player.stats2[var_1B].full;
            //}

            player.stats2.Str00.full = player.stats2.Str00.cur;

            input_key = ovr027.yes_no(gbl.defaultMenuColors, "Save " + player.name + "? ");

            if (input_key == 'Y')
            {
                ovr017.SavePlayer(string.Empty, player);
            }

            gbl.SelectedPlayer = gblPlayerPtrBkup;
        }
Exemple #32
0
        // sub_6A7FB
        internal static void reclac_saving_throws(Player player)
        {
            Item item = player.items.Find(i => i.affect_3 == Affects.item_affect_6 && i.readied);
            bool applyBonus = item != null;

            for (int save = 0; save < 5; save++)
            {
                int _class;

                player.saveVerse[save] = 20;
                for (_class = 0; _class <= 7; _class++)
                {
                    if (player.ClassLevel[_class] > 0)
                    {
                        byte dl = SaveThrowValues[_class, player.ClassLevel[_class], save];

                        if (player.saveVerse[save] > dl)
                        {
                            player.saveVerse[save] = dl;
                        }
                    }
                }

                _class = 7; /* Orignal code had a post use test and would exit on 7,
                        * but this for loops uses are pre-test increment so fix var_2 */

                if (player.ClassLevel[_class] > player.ClassLevelsOld[_class])
                {
                    byte dl = SaveThrowValues[_class, player.ClassLevelsOld[_class], save];

                    if (player.saveVerse[save] > dl)
                    {
                        player.saveVerse[save] = dl;
                    }
                }

                if (save == 0)
                {
                    SaveVerseZeroBonus(player, applyBonus);
                }
            }
        }