示例#1
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);
        }