Социальная интеллектуальная игра «ЗаБотань!»

Автор работы: Пользователь скрыл имя, 18 Декабря 2013 в 18:34, курсовая работа

Описание работы

Идея совместить популярные игровые механики и интеллектуальное развитие пришла ко мне ещё в 8-ом классе. Для реализации мечты не хватало опыта и единомышленников. БГУИР дал мне и то, и то другое. Я знал, что проект должен быть прост в реализации, а порог входа на выбранный рынок должен быть как можно ниже. И я выбрал рынок социальных игр.

Содержание работы

Введение 3
Классификация игры, сюжет и миссия 4
Структура программы 5
Диаграмма классов 6
Основные алгоритмы 7
Описание игрового процесса 9
Описание игровых вещей Ошибка! Закладка не определена.12
Описание игрового баланса Ошибка! Закладка не определена.13
Заключение 14
Литература 15
Исходный код…………………………………………….…………………………………………….16

Файлы: 1 файл

Пояснительная записка Заботань!.docx

— 739.55 Кб (Скачать файл)

                                        thisclient.Fight.IsFriendInviteSend = true;

                                    }

                                    else

                                    {

                                        thisclient.Fight.FriendInvite = null;

                                        thisclient.Fight.IsFriendInviteSend = false;

                                    }

                                }

                                #endregion

 

 

                                switch (thisclient.Flag)

                                {

                                    #region Lesson

                                    case PlayerFlags.LESSON:

                                        #region Start - отсчет времени

                                        if (thisclient.Fight.Status == FightStatus.Start)

                                        {

                                            if (thisclient.Fight.TimeStarting >= DateTime.Now)

                                                break;

                                            thisclient.Fight.Start();

                                        }

                                        #endregion

                                        #region Fighting - сражение

                                        else if (thisclient.Fight.Status == FightStatus.Fighting)

                                        {

                                            if (thisclient.Fight.TryDie())

                                                break;

                                            Bot bot = (Bot)thisclient.Fight.Enemy;

                                            sw2.Restart();

                                            thisclient.Fight.TrySendQuestion();

                                            sw2.Stop();

                                            if (sw2.ElapsedMilliseconds > 30)

                                                Log.Write(EType.Notice, "{0} [{1}]*SendQuestion-->{2}, flag:{3}", thisclient.ID, Thread.CurrentThread.Name, sw2.ElapsedMilliseconds,thisclient.Flag);

                                           

                                            //Нанести урон от бота

                                            sw2.Restart();

                                            if (thisclient.CurrentHP > 0f)

                                            {

                                                bot.CalculateDamage(thisclient);

                                            }

                                            sw2.Stop();

                                            if (sw2.ElapsedMilliseconds > 30)

                                                Log.Write(EType.Notice, "{0} [{1}]*CalculateDMG-->{2}, flag:{3}", thisclient.ID, Thread.CurrentThread.Name, sw2.ElapsedMilliseconds, thisclient.Flag);

 

                                            sw2.Restart();

                                            thisclient.Fight.TryBullet(bot.IsManiken);

                                            sw2.Stop();

                                            if (sw2.ElapsedMilliseconds > 30)

                                                Log.Write(EType.Notice, "{0} [{1}]*PlayerBullet-->{2}, flag:{3}", thisclient.ID, Thread.CurrentThread.Name, sw2.ElapsedMilliseconds, thisclient.Flag);

                                            sw2.Restart();

                                            for (int j = 0; j < bot.Fight.Bullet.Count; j++)

                                            {

                                                Bullet b = bot.Fight.Bullet[j];

                                                if ((DateTime.Now - b.StartTime).TotalMilliseconds > Config.TimeForBullet)

                                                {

                                                    thisclient.CurrentHP -= b.Dmg;

                                                    bot.Fight.Bullet.RemoveAt(j);

                                                }

                                            }

                                            sw2.Stop();

                                            if (sw2.ElapsedMilliseconds > 30)

                                                Log.Write(EType.Notice, "{0} [{1}]*BotBullet-->{2}, flag:{3}", thisclient.ID, Thread.CurrentThread.Name, sw2.ElapsedMilliseconds, thisclient.Flag);

 

                                        }

                                        #endregion

                                        #region End - конец тренировки. Записываем знания,даем деньги и т.п.

                                        else if (thisclient.Fight.Status == FightStatus.End)

                                        {

                                            Bot bot = (Bot)thisclient.Fight.Enemy;

                                            //byte itemIdForWinner = 0;

 

                                            int oldLevel = thisclient.Level;

 

 

                                            byte win = 0;//проиграл

                                            #region ничья

                                            if (thisclient.CurrentHP == 0f && bot.CurrentHP == 0f)

                                            {

                                                win = 2;//ничья

                                                thisclient.CountFightFriendBotTie++;

                                                thisclient.AddMoney(Config.MoneyForTieFriendBot);

                                            }

                                            #endregion

                                            #region win

                                            else if (bot.CurrentHP == 0f)

                                            {

                                                win = 1;//выйграл

                                                if (bot.IsManiken)

                                                {

                                                    thisclient.AddMoney(Config.MoneyForWinnerManiken);

                                                    thisclient.CountFightManikenWin++;

                                                }

                                                else

                                                {

                                                    thisclient.AddMoney(Config.MoneyForWinnerFriendBot);

                                                    thisclient.CountFightFriendBotWin++;

                                                }

 

 

                                            }

                                            #endregion

                                            else

                                            {

                                                if (bot.IsManiken)

                                                    thisclient.CountFightManikenLose++;

                                                else thisclient.CountFightFriendBotLose++;

                                            }

 

                                            School.GoSchool(thisclient);

                                            if (win == 1)

                                            {

                                                if (bot.IsManiken)

                                                    thisclient.SendFightEnd(PlayerFlags.LESSON, win, Config.MoneyForWinnerManiken, 0);

                                                else thisclient.SendFightEnd(PlayerFlags.LESSON, win, Config.MoneyForWinnerFriendBot, 0);

                                            }

                                            else if (win == 2)

                                                thisclient.SendFightEnd(PlayerFlags.LESSON, win, Config.MoneyForTieFriendBot, 0);

                                            else

                                                thisclient.SendFightEnd(PlayerFlags.LESSON, win, 0, 0);

                                            thisclient.Fight.Reset();

                                            for (int j = 0; j < thisclient.Brains.Count; j++)

                                            {

                                                Brain b = thisclient.Brains[j];

                                                if (b.InFight > 0)

                                                    b.Write(thisclient);

                                            }

                                            thisclient.CurrentHP = thisclient.MaxHP;

                                            if (oldLevel < thisclient.Level)

                                            {

                                                thisclient.AddMoney(Config.MoneyForLevelUp);

                                                if (thisclient.CurrentEP < thisclient.MaxEP)

                                                    thisclient.CurrentEP = thisclient.MaxEP;

                                                thisclient.SendUserLevelUp();

                                            }

                                            thisclient.SendAttributes();

                                            //награды

                                            if (bot.IsManiken)

                                                AwardsManager.UA_KillManiken(thisclient);

                                            else AwardsManager.UA_KillFriendBot(thisclient);

                                        }

                                        #endregion

                                        break;

                                    #endregion

                                    #region PVP

                                    case PlayerFlags.PVP:

                                        #region Wait - подбираем противника для тренировки

                                        if (thisclient.Fight.Status == FightStatus.Wait)

                                        {

                                            #region time up

                                            if (DateTime.Now > thisclient.Fight.TimeWeit)

                                            {

                                                #region setbot

                                                try

                                                {

                                                    List<PlDb> curBot = WorldServer.data_allusers.Where(n => n.id != thisclient.ID && Math.Abs(n.brains - thisclient.GetAllBrains) <= Config.RaznicaBrains).ToList();

                                                    PlDb mypl = new PlDb();

                                                    if (curBot.Count > 1)

                                                        mypl = curBot[WorldServer.rand_q.Next(0, curBot.Count - 1)];

                                                    else

                                                    {

                                                         if (Config.serverType == "vk")

                                                             mypl.id = WorldServer.rand_q.Next(100000, 9999999);

                                                         else mypl.id = WorldServer.rand_q.Next(1, 900000);

                                                         mypl.listBrains = thisclient.Brains;

                                                         mypl.brains = thisclient.GetAllBrains;

                                                    }

                                                    thisclient.Fight.BeginTraining(mypl.id, mypl.listBrains, 0, false);

                                                }

                                                catch (Exception ex)

                                                {

                                                    Arena.GoArena(thisclient);

                                                    Log.Write(EType.Player, "{0} Arena - Not Find Enemy!", thisclient.ID);

                                                    Log.Write(EType.Error, "{0} bot conn error:" + ex);

                                                }

                                                #endregion

 

                                                break;

                                            }

                                            #endregion

                                        }

                                        #endregion

                                        #region Start

                                        else if (thisclient.Fight.Status == FightStatus.Start)

                                        {

                                            BasePlayer enemy = thisclient.Fight.Enemy;

                                            if (enemy == null || (!enemy.IsBot && !WorldServer.world_players.Contains((Client)enemy)))

                                            {

                                                thisclient.Fight.End();

Информация о работе Социальная интеллектуальная игра «ЗаБотань!»