public PartData GetTarget(MonsterData targetMonster, MonsterData attackingMonster, bool criticalHit)
        {
            PartData target = null;

            while (target == null)
            {
                if (criticalHit)
                {
                    Console.WriteLine(attackingMonster.Name + " prepares a technical strike!");
                    for (int i = 0; i < 2; i++)
                    {
                        if (targetMonster.Parts[i] != null && (RNG.Next(i, 1)) == i && targetMonster.Parts[i].PartDurability > 0)
                        {
                            target = targetMonster.Parts[i];
                            break;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < targetMonster.Parts.Length; i++)
                    {
                        if (targetMonster.Parts[i] != null && (RNG.Next(i, targetMonster.Parts.Length - 1)) == i && targetMonster.Parts[i].PartDurability > 0)
                        {
                            target = targetMonster.Parts[i];
                            break;
                        }
                    }
                }
            }
            return(target);
        }
Example #2
0
        public void AddParts(Random RNG, int players)
        {
            for (int i = 1; i < 5; i++)
            {
                int roll = RNG.Next(1, players * 5);

                for (int j = 0; j < roll; j++)
                {
                    PartData newPart = new PartData(RNG);
                    newPart.PartStructure = Locations[i].ParkPart;
                    Locations[i].PartsList.AddLast(newPart);
                }
            }
        }
Example #3
0
        private MonsterData BuildMonster(bool isNew)
        {
            int intInput;

            PartData[]      table = new PartData[6];
            string          type  = "";
            PartData        chosenPart;
            bool            halt           = false;
            bool            leave          = false;
            int             loopStart      = 0;
            MonsterData     currentMonster = Data.CurrentPlayer.Monster;
            List <PartData> workshopCopy   = new List <PartData>();

            if (isNew)
            {
                Console.WriteLine("You aproach the empty table...");
            }
            else
            {
                Console.WriteLine("Would you like to end " + currentMonster.Name + "'s career?  This is permanent...");
                Console.WriteLine("1 - Yes, kill " + currentMonster.Name);
                Console.WriteLine("2 - No, upgrade limbs");
                intInput = StaticUtility.CheckInput(1, 2);
                if (intInput == 2)
                {
                    loopStart = 2;
                    Console.WriteLine(currentMonster.Name + " slides onto the table...");
                    for (int i = 0; i < 6; i++)
                    {
                        table[i] = currentMonster.Parts[i];
                    }
                }
                else
                {
                    Data.Graveyard.Add(new MonsterGhost(currentMonster, Data.GameDayNumber));
                    loopStart = 0;
                    Console.WriteLine("You gently dismember " + currentMonster.Name + " and bury its head and torso in the communal graveyard.");
                    Console.WriteLine(currentMonster.Name + " will be missed.");
                    Console.WriteLine("Limbs have been added to your workshop inventory");
                    for (int i = 2; i < currentMonster.Parts.Length; i++)
                    {
                        if (currentMonster.Parts[i] != null)
                        {
                            Console.WriteLine(currentMonster.Parts[i].PartName + ", Durability: " + currentMonster.Parts[i].PartDurability);
                            Data.CurrentPlayer.Workshop.Add(currentMonster.Parts[i]);
                        }
                    }
                    Data.CurrentPlayer.Monster = null;
                    currentMonster             = null;
                    Data.CurrentPlayer.Workshop.Sort(Data.CurrentPlayer.Comparer);
                    isNew = true;
                }
            }

            workshopCopy = Data.CurrentPlayer.Workshop.Select(x => x).ToList();

            for (int i = loopStart; i < 6; i++)
            {
                switch (i)
                {
                case 0:
                    type = "head";
                    break;

                case 1:
                    type = "torso";
                    break;

                case 2:
                    type = "left arm";
                    break;

                case 3:
                    type = "right arm";
                    break;

                case 4:
                    type = "left leg";
                    break;

                case 5:
                    type = "right leg";
                    break;

                default:
                    break;
                }

                halt = true;

                if (!workshopCopy.Any(x => x.PartType == i))
                {
                    Console.WriteLine("You do not have a " + type + " in your workshop.");
                    if (i == 0 || i == 1)
                    {
                        Console.WriteLine("A monster without a " + type + " is no moster at all, better luck tomorrow...");
                        table[0] = null; //this is in case they have a head but no torso
                        break;
                    }
                    halt = false;
                }

                while (halt)
                {
                    if (isNew == false && currentMonster.Parts[i] != null)
                    {
                        table[i] = currentMonster.Parts[i];
                        StaticUtility.TalkPause("Currently " + currentMonster.Name + " has the below " + type);
                        Console.WriteLine(currentMonster.Parts[i].PartName);
                        Console.WriteLine("Durability: " + currentMonster.Parts[i].PartDurability);
                        Console.WriteLine("Alacrity: " + currentMonster.Parts[i].Stats[0]);
                        Console.WriteLine("Strenght: " + currentMonster.Parts[i].Stats[1]);
                        Console.WriteLine("Endurance: " + currentMonster.Parts[i].Stats[2]);
                        StaticUtility.TalkPause("Technique: " + currentMonster.Parts[i].Stats[3]);
                    }

                    Console.WriteLine("Workshop Items:");
                    Console.WriteLine("0 - Leave Table");
                    int count = 0;
                    foreach (var item in workshopCopy)
                    {
                        count++;
                        Console.WriteLine(count + " - " + item.PartName);
                    }

                    Console.WriteLine("Please choose a " + type + ":");
                    intInput = StaticUtility.CheckInput(0, Data.CurrentPlayer.PartListCount(workshopCopy));

                    if (intInput == 0)
                    {
                        halt  = false;
                        leave = true;
                        break;
                    }
                    chosenPart = workshopCopy[intInput - 1];

                    Console.WriteLine(chosenPart.PartName);
                    if (chosenPart.PartType != (i))
                    {
                        Console.WriteLine("That is not a " + type + "!");
                    }
                    else
                    {
                        Console.WriteLine("Durability: " + chosenPart.PartDurability);
                        Console.WriteLine("Alacrity: " + chosenPart.Stats[0]);
                        Console.WriteLine("Strenght: " + chosenPart.Stats[1]);
                        Console.WriteLine("Endurance: " + chosenPart.Stats[2]);
                        StaticUtility.TalkPause("Technique: " + chosenPart.Stats[3]);
                        Console.WriteLine("Use this part?");
                        Console.WriteLine("1 - Yes");
                        Console.WriteLine("2 - No");
                        Console.WriteLine("3 - Skip part");
                        Console.WriteLine("4 - Leave Table");
                        int intInput2 = StaticUtility.CheckInput(1, 4);

                        switch (intInput2)
                        {
                        case 1:
                            if (table[i] != null)
                            {
                                workshopCopy.Add(table[i]);
                            }
                            table[i] = chosenPart;
                            workshopCopy[intInput - 1] = null;
                            workshopCopy = workshopCopy.Where(x => x != null).ToList();
                            halt         = false;
                            break;

                        case 2:
                            break;

                        case 3:
                            halt = false;
                            break;

                        case 4:
                            leave = true;
                            halt  = false;
                            break;

                        default:
                            break;
                        }
                    }
                }
                //leave table
                if (leave)
                {
                    break;
                }
            }

            if (table[0] != null && table[1] != null)
            {
                MonsterData newMonster = new MonsterData(null, table);

                StaticUtility.TalkPause("This is your monster...");
                foreach (var part in table)
                {
                    if (part != null)
                    {
                        Console.WriteLine(part.PartName);
                    }
                }
                int count = 0;
                foreach (var stat in newMonster.MonsterStats)
                {
                    Console.WriteLine(StaticReference.statList[count] + ": " + stat);
                    count++;
                }
                Console.WriteLine("Would you like to keep this monster?");
                Console.WriteLine("1 - Yes, 2 - No");
                intInput = StaticUtility.CheckInput(1, 2);
                if (intInput == 1)
                {
                    if (isNew)
                    {
                        Console.WriteLine("What is its name?");
                        currentMonster      = newMonster;
                        currentMonster.Name = Console.ReadLine();
                    }
                    else
                    {
                        currentMonster.Parts = table;
                    }
                    Data.CurrentPlayer.Workshop = workshopCopy.Select(x => x).ToList();
                }
                else
                {
                    Console.WriteLine("Better luck building tomorrow...");
                }
            }

            PlayerManager.DumpWorkshopNulls(Data.CurrentPlayer);
            return(currentMonster);
        }
Example #4
0
        public void AIBuildTurn(GameData data)
        {
            foreach (var ai in data.AiPlayers)
            {
                int start = 0;
                var monst = new PartData[6];
                if (ai.Monster != null)
                {
                    bool            betterBody = false;
                    List <PartData> heads      = ai.Workshop.Where(x => x.PartType == 0 && x.PartRarity < ai.Monster.Parts[0].PartRarity).ToList();
                    List <PartData> torsos     = ai.Workshop.Where(x => x.PartType == 1 && x.PartRarity < ai.Monster.Parts[1].PartRarity).ToList();
                    if (heads.Count > 0 || torsos.Count > 0)
                    {
                        betterBody = true;
                    }

                    if (betterBody)
                    {
                        data.Graveyard.Add(new MonsterGhost(ai.Monster, data.GameDayNumber));
                        for (int i = 2; i < ai.Monster.Parts.Length; i++)
                        {
                            if (ai.Monster.Parts[i] != null)
                            {
                                ai.Workshop.Add(ai.Monster.Parts[i]);
                            }
                        }
                        ai.Monster = null;
                        ai.Workshop.Sort(ai.Comparer);
                    }
                    else
                    {
                        for (int i = 0; i < 6; i++)
                        {
                            monst[i] = ai.Monster.Parts[i];
                        }
                        start = 2;
                    }
                }
                for (int i = start; i < 6; i++)
                {
                    for (int j = ai.Workshop.Count - 1; j >= 0; j--)
                    {
                        PartData oldP  = monst[i];
                        PartData newP  = ai.Workshop[j];
                        float    score = 0;

                        if (newP != null)
                        {
                            if (oldP != null && newP.PartType == i)
                            {
                                score += newP.Stats[0] - monst[i].Stats[0];
                                score += newP.Stats[1] - monst[i].Stats[1];
                                score += newP.Stats[2] - monst[i].Stats[2];
                                score += newP.Stats[3] - monst[i].Stats[3];
                            }
                            if ((oldP == null || score > 0f) && newP.PartType == i)
                            {
                                monst[i] = newP;
                            }
                        }
                    }
                }
                if (monst[0] != null && monst[1] != null)
                {
                    if (monst[2] != null || monst[3] != null || monst[4] != null || monst[5] != null)
                    {
                        ai.Monster = new MonsterData(ai.Name + "'s Monster", monst);
                        for (int i = ai.Workshop.Count - 1; i >= 0; i--)
                        {
                            if (ai.Workshop[i] != null)
                            {
                                PlayerManager.ScrapItem(ai, ai.Workshop, i);
                            }
                        }
                    }
                }
            }
        }