예제 #1
0
        public List <BasicMon> GetAllEnemies(BasicMon mon)
        {
            List <BasicMon> mons = new List <BasicMon>();

            foreach (Team t in Teams)
            {
                if (!t.Members.Contains(UserHandler.GetUser(mon.OwnerID)))
                {
                    foreach (UserAccount u in t.Members)
                    {
                        foreach (BasicMon m in u.Char.ActiveMons)
                        {
                            mons.Add(m);
                        }
                    }
                }
            }

            return(mons);
        }
예제 #2
0
        public static Bitmap PvPSoloLobby(CombatCreationTool tool)
        {
            Image back = Image.FromFile("C:\\Users\\lifei_jljypee\\Desktop\\Discomon Project\\DiscomonProject\\Assets\\UI Assets\\combatlobby.png");

            if (back == null)
            {
                throw new ArgumentNullException("background");
            }

            Image leader = Image.FromFile("C:\\Users\\lifei_jljypee\\Desktop\\Discomon Project\\DiscomonProject\\Assets\\UI Assets\\leader.png");

            if (leader == null)
            {
                throw new ArgumentNullException("leaderImage");
            }

            int    leaderWidth  = (int)(leader.Width * 0.2);
            int    leaderHeight = (int)(leader.Height * 0.2);
            Bitmap leaderImage  = new Bitmap(leaderWidth, leaderHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            int    finalImageWidth  = back.Width;
            int    finalImageHeight = back.Height;
            Bitmap finalImage       = new Bitmap(finalImageWidth, finalImageHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            using (Graphics graphics = Graphics.FromImage(finalImage))
            {
                graphics.DrawImage(back, new Rectangle(new Point(), back.Size),
                                   new Rectangle(new Point(), back.Size), GraphicsUnit.Pixel);

                Font electrolizeSmall = new Font("Electrolize", 56);
                Font electrolizeLarge = new Font("Electrolize", 66);

                int crownVal = 70;
                int xVal     = 180;
                foreach (Team t in tool.Teams)
                {
                    if (t.MemberIDs.Count != 0)
                    {
                        graphics.DrawString($"{UserHandler.GetUser(t.MemberIDs[0]).Char.Name}", electrolizeLarge, Brushes.White, new PointF(xVal, 260));
                        if (t.MemberIDs[0] == tool.PartyLeader)
                        {
                            graphics.DrawImage(leader, new Rectangle(crownVal, 250, 100, 100), new Rectangle(new Point(), leader.Size), GraphicsUnit.Pixel);
                        }
                    }
                    else
                    {
                        graphics.DrawString($"- - - -", electrolizeLarge, Brushes.White, new PointF(xVal, 260));
                    }

                    xVal     += 1170;
                    crownVal += 1170;
                }

                Brush selected    = new SolidBrush(Color.FromArgb(43, 121, 195));
                Brush nonselected = Brushes.Gray;

                Brush NatBrush      = selected;
                Brush CapBrush      = selected;
                Brush ItemsOnBrush  = selected;
                Brush ItemsOffBrush = selected;

                Brush OneBrush   = nonselected;
                Brush TwoBrush   = nonselected;
                Brush ThreeBrush = nonselected;
                Brush FourBrush  = nonselected;
                Brush FiveBrush  = nonselected;
                Brush SixBrush   = nonselected;

                if (tool.NaturalLevels)
                {
                    CapBrush = nonselected;
                }
                else
                {
                    NatBrush = nonselected;
                }

                if (tool.ItemsOn)
                {
                    ItemsOffBrush = nonselected;
                }
                else
                {
                    ItemsOnBrush = nonselected;
                }

                switch (tool.MonsPerTeam)
                {
                case 1:
                    OneBrush = selected;
                    break;

                case 2:
                    TwoBrush = selected;
                    break;

                case 3:
                    ThreeBrush = selected;
                    break;

                case 4:
                    FourBrush = selected;
                    break;

                case 5:
                    FiveBrush = selected;
                    break;

                case 6:
                    SixBrush = selected;
                    break;
                }

                graphics.DrawString($"Natural", electrolizeSmall, NatBrush, new PointF(415, 710));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(700, 710));
                graphics.DrawString($"Capped", electrolizeSmall, CapBrush, new PointF(770, 710));

                graphics.DrawString($"On", electrolizeSmall, ItemsOnBrush, new PointF(415, 840));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(540, 840));
                graphics.DrawString($"Off", electrolizeSmall, ItemsOffBrush, new PointF(600, 840));

                graphics.DrawString($"6", electrolizeSmall, SixBrush, new PointF(415, 970));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(495, 970));
                graphics.DrawString($"5", electrolizeSmall, FiveBrush, new PointF(575, 970));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(655, 970));
                graphics.DrawString($"4", electrolizeSmall, FourBrush, new PointF(735, 970));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(815, 970));
                graphics.DrawString($"3", electrolizeSmall, ThreeBrush, new PointF(895, 970));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(975, 970));
                graphics.DrawString($"2", electrolizeSmall, TwoBrush, new PointF(1055, 970));
                graphics.DrawString($"/", electrolizeSmall, Brushes.White, new PointF(1135, 970));
                graphics.DrawString($"1", electrolizeSmall, OneBrush, new PointF(1215, 970));
            }

            return(finalImage);
        }
예제 #3
0
        //Post attack phase logic. Target is the list of mon who were hit.
        public async Task PostAttackPhase(BasicMon moveUser, List <BasicMon> targets, List <MoveResult> results)
        {
            Console.WriteLine($"101");
            //5- Post attack mini-phase. Check for death/on-hit abilities
            var userOwner = UserHandler.GetUser(moveUser.OwnerID);

            Console.WriteLine($"102");

            var swapout = false;

            Console.WriteLine($"103");
            BasicMon swapMon = null;

            Console.WriteLine($"104");
            foreach (MoveResult result in results)
            {
                Console.WriteLine($"105");
                if (result.Swapout != null)
                {
                    Console.WriteLine($"106");
                    swapout = true;
                    Console.WriteLine($"107");
                    swapMon = result.Swapout;
                }
                Console.WriteLine($"108");

                if (result.Hit && result.EnemyDmg > 0)
                {
                    Console.WriteLine($"109");
                    //WHEN HIT LOGIC HERE
                }
                Console.WriteLine($"110");
            }

            if (moveUser.CurrentHP <= 0)
            {
                Console.WriteLine($"111");
                moveUser.Fainted = true;
                Console.WriteLine($"112");
                await MessageHandler.Faint(Location, userOwner, moveUser);

                Console.WriteLine($"113");
                moveUser.ExitCombat();
                Console.WriteLine($"114");
            }
            else if (swapout)
            {
                Console.WriteLine($"115");
                moveUser.ExitCombat();
                Console.WriteLine($"116");
                var index = userOwner.Char.ActiveMons.IndexOf(moveUser);
                Console.WriteLine($"117");
                userOwner.Char.ActiveMons[index] = swapMon;
                Console.WriteLine($"118");
                userOwner.Char.ActiveMons[index].OnEnteredCombat(this);
            }
            Console.WriteLine($"119");

            foreach (BasicMon t in targets)
            {
                if (t.CurrentHP <= 0)
                {
                    Console.WriteLine($"120");
                    await FaintMon(t);

                    Console.WriteLine($"121");
                }
            }
        }
예제 #4
0
        public async Task ApplyMoves(BasicMon mon)
        {
            Console.WriteLine($"70 - {mon.SelectedMove.Targets.Count}");
            List <MoveResult> results = mon.SelectedMove.ApplyMove(this, mon, mon.SelectedMove.Targets);

            Console.WriteLine($"71 - ResultsCount: {results.Count} SelectedMove: {mon.SelectedMove.Name}");
            var allmons = GetAllMons();

            Console.WriteLine($"72");
            foreach (BasicMon m in allmons)
            {
                Console.WriteLine($"73");
                mon.UpdateStats();
                Console.WriteLine($"74");
            }

            Console.WriteLine($"75");
            await MessageHandler.SendMessage(Location, $"{UserHandler.GetUser(mon.OwnerID).Char.Name}'s {mon.Nickname} uses {mon.SelectedMove.Name}!");

            Console.WriteLine($"76");
            bool allFail = true;
            bool allMiss = true;

            Console.WriteLine($"77");
            foreach (MoveResult result in results)
            {
                Console.WriteLine($"78");
                if (!result.Fail)
                {
                    allFail = false;
                }
                Console.WriteLine($"79");
                if (!result.Miss)
                {
                    allMiss = false;
                }
                Console.WriteLine($"80");
            }
            Console.WriteLine($"81");

            string addon = "";

            Console.WriteLine($"82");
            foreach (MoveResult result in results)
            {
                Console.WriteLine($"83");
                if (results.Count <= 1)
                {
                    Console.WriteLine($"84");
                    if (result.Fail)
                    {
                        addon += $"\n{result.FailText}";
                    }
                    else if (result.Miss)
                    {
                        addon += $"\nBut it missed!";
                    }
                    else
                    {
                        Console.WriteLine($"85");
                        foreach (string message in result.Messages)
                        {
                            addon += $"\n{message}";
                        }
                        Console.WriteLine($"86");
                        if (result.SuperEffective)
                        {
                            addon += $"\nIt's **super effective**!";
                        }
                        Console.WriteLine($"87");
                        if (result.NotEffective)
                        {
                            addon += $"\nIt's **not very effective**!";
                        }
                        Console.WriteLine($"88");
                        if (result.Immune)
                        {
                            addon += $"\nIt has **no effect**!";
                        }
                        Console.WriteLine($"89");
                        if (result.Crit)
                        {
                            addon += $"\n**Critical Hit**!";
                        }
                        Console.WriteLine($"90");
                        foreach (string statchange in result.StatChangeMessages)
                        {
                            addon += $"\n{statchange}";
                        }
                        Console.WriteLine($"91");
                        foreach (string status in result.StatusMessages)
                        {
                            addon += $"\n{status}";
                        }
                        Console.WriteLine($"92");
                        if (result.Move.Type.Type.Equals("Fire") && result.Target.Status.Frozen)
                        {
                            Console.WriteLine($"93");
                            addon += $"\n{result.Target.Nickname} was unthawed by {result.Owner.Nickname}'s fire type move!";
                            Console.WriteLine($"94");
                            result.Target.Status.Frozen = false;
                            Console.WriteLine($"95");
                        }
                        Console.WriteLine($"96");
                    }
                }
                else
                {
                    Console.WriteLine($"97");
                    if (allFail)
                    {
                        addon += $"\n{result.FailText}";
                        break;
                    }
                    else if (allMiss)
                    {
                        addon += $"\nBut it missed!";
                        break;
                    }
                    else if (result.Fail)
                    {
                        addon += $"\n{result.FailText}";
                    }
                    else if (result.Miss)
                    {
                        addon += $"\nIt missed {result.Target}!";
                    }
                    else
                    {
                        foreach (string message in result.Messages)
                        {
                            addon += $"\n{message}";
                        }
                        if (result.SuperEffective)
                        {
                            addon += $"\nIt's **super effective** against {result.Target}!";
                        }
                        if (result.NotEffective)
                        {
                            addon += $"\nIt's **not very effective** against {result.Target}!";
                        }
                        if (result.Immune)
                        {
                            addon += $"\nIt has **no effect** against {result.Target}!";
                        }
                        if (result.Crit)
                        {
                            addon += $"\n**Critical Hit** against {result.Target}!";
                        }
                        foreach (string statchange in result.StatChangeMessages)
                        {
                            addon += $"\n{statchange}";
                        }
                        foreach (string status in result.StatusMessages)
                        {
                            addon += $"\n{status}";
                        }
                        if (result.Move.Type.Type.Equals("Fire") && result.Target.Status.Frozen)
                        {
                            addon += $"\n{result.Target.Nickname} was unthawed by {result.Owner.Nickname}'s fire type move!";
                            result.Target.Status.Frozen = false;
                        }
                    }
                }
                Console.WriteLine($"98");
                if (result.EnemyDmg > 0 && result.Target != null)
                {
                    await MessageHandler.UseMoveNew(Location, result.Target, addon);
                }
                else
                {
                    await MessageHandler.SendMessage(Location, addon);
                }
                Console.WriteLine($"99");
            }
            Console.WriteLine($"100");

            await PostAttackPhase(mon, mon.SelectedMove.Targets, results);

            Console.WriteLine($"122");

            //Console.WriteLine(result1.ToString());

            //await DebugPrintMoveResult(first, second, result1, inst.Location);

            /* FOR VALUE TESTING
             * string summ = "";
             * summ += $"\nOwner/Mon: {first.Name}/{first.Char.ActiveMon.Nickname}";
             * summ += $"\nLevel: {first.Char.ActiveMon.Level}";
             * summ += $"\nPower: {first.Char.ActiveMon.SelectedMove.Power}";
             * summ += $"\nAttack: {first.Char.ActiveMon.CurStats[1]}";
             * (double mod, string mess) = first.Char.ActiveMon.ChangeAttStage(0);
             * summ += $"\nAttack Stage Mod: {mod}";
             * summ += $"\nAttack Modified: {(int)(first.Char.ActiveMon.CurStats[1]*mod)}";
             * summ += $"\nDefense: {second.Char.ActiveMon.CurStats[2]}";
             * (double mod2, string mess2) = second.Char.ActiveMon.ChangeDefStage(0);
             * summ += $"\nDefense Stage Mod: {mod2}";
             * summ += $"\nDefense Modified: {(int)(second.Char.ActiveMon.CurStats[2]*mod2)}";
             * summ += $"\nModifier: {result1.Mod}";
             * summ += $"\nCrit: {result1.ModCrit}";
             * summ += $"\nRandom: {result1.ModRand}";
             * summ += $"\nType Eff: {result1.ModType}";
             * summ += $"\nDamage: {result1.EnemyDmg}";
             * await MessageHandler.SendMessage(inst.Location, $"**Move Summary:**{summ}");
             * //*/
        }