Esempio n. 1
0
    public void UpdateQuirk(QuirkInfo quirkInfo)
    {
        QuirkInfo = quirkInfo;

        if (QuirkInfo != null)
        {
            quirkText.text     = LocalizationManager.GetString("str_quirk_name_" + QuirkInfo.Quirk.Id);
            lockedIcon.enabled = quirkInfo.IsLocked;

            if (replacedIcon != null)
            {
                replacedIcon.gameObject.SetActive(QuirkInfo.IsReplaced);
            }

            gameObject.SetActive(true);
        }
        else
        {
            ResetSlot();
        }
    }
Esempio n. 2
0
    public void UpdateQuirk(QuirkInfo quirkInfo)
    {
        QuirkInfo = quirkInfo;

        if (QuirkInfo != null)
        {
            HasQuirk = true;
            gameObject.SetActive(true);
            quirkText.text = LocalizationManager.GetString("str_quirk_name_" + QuirkInfo.Quirk.Id);
            Selected       = false;
            if (quirkInfo.IsLocked)
            {
                if (QuirkInfo.Quirk.IsPositive)
                {
                    statusIcon.gameObject.SetActive(true);
                    statusIcon.sprite            = DarkestDungeonManager.Data.Sprites["lockquirk"];
                    statusIcon.material          = DarkestDungeonManager.GrayMaterial;
                    highlightBackground.enabled  = true;
                    highlightBackground.material = DarkestDungeonManager.GrayMaterial;
                }
                else
                {
                    statusIcon.gameObject.SetActive(true);
                    statusIcon.sprite            = DarkestDungeonManager.Data.Sprites["seriousquirk"];
                    statusIcon.material          = statusIcon.defaultMaterial;
                    highlightBackground.enabled  = false;
                    highlightBackground.material = highlightBackground.defaultMaterial;
                }
            }
            else
            {
                highlightBackground.enabled = false;
                statusIcon.gameObject.SetActive(false);
            }
        }
        else
        {
            ResetSlot();
        }
    }
Esempio n. 3
0
    public Condition(KMBombInfo bomb, QuirkInfo qi)
    {
        this.bomb = bomb;
        this.qi   = qi;

        rule = rnd.Range(0, 28);
        SetRandomPort();
        SetRandomIndicator();
        SetRandomWord();
        widgetType1 = rnd.Range(0, 3);
        do
        {
            widgetType2 = rnd.Range(0, 3);
        } while (widgetType1 == widgetType2);
        batteryType1     = rnd.Range(0, 2);
        batteryType2     = batteryType1 == 1 ? 0 : 1;
        indicatorType1   = rnd.Range(0, 2);
        indicatorType2   = indicatorType1 == 1 ? 0 : 1;
        evenOdd          = rnd.Range(0, 2);
        moreLess         = rnd.Range(0, 2);
        lettersDigits    = rnd.Range(0, 2);
        vowelPrime       = rnd.Range(0, 2);
        maxSModuleCount  = bomb.GetSolvableModuleNames().Count();
        selectedModCount = rnd.Range(0, maxSModuleCount);

        switch (rule)
        {
        case 0: text = "If the bomb contains " + GetPortName(true) + " port, "; break;

        case 1: text = "If the bomb has more " + GetWidgetName(widgetType1) + " than " + GetWidgetName(widgetType2) + ", "; break;

        case 2: text = "If the bomb has more " + GetBatteryName(batteryType1) + " than " + GetBatteryName(batteryType2) + ", "; break;

        case 3: text = "If the bomb has more " + GetIndicatorType(indicatorType1) + " than " + GetIndicatorType(indicatorType2) + ", "; break;

        case 4: text = "If the sum of all the Serial Number digits is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 5: text = "If the sum of all the Serial Number digits is " + (moreLess == 0 ? "more than 15" : "less than 15") + ", "; break;

        case 6: text = "If the current Key Number is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 7: text = "If the current Key Number is " + (moreLess == 0 ? "more than 50" : "less than 50") + ", "; break;

        case 8: text = "If there are 3 or " + (moreLess == 0 ? "more " : "less ") + GetWidgetName(widgetType1) + " on the bomb, "; break;

        case 9: text = "If the number of " + GetWidgetName(widgetType1) + " on the bomb is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 10: text = "If there are more " + GetPortName(false) + " ports than any other port type, "; break;

        case 11: text = "If there is " + GetIndicatorName() + " indicator on the bomb, "; break;

        case 12: text = "If the number of incurred strikes is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 13: text = "If there are " + (moreLess == 0 ? "more" : "less") + " solved modules than unsolved modules on the bomb, "; break;

        case 14: text = "If the starting bomb time (whole minutes) is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 15: text = "If the starting bomb time (whole minutes) is " + (moreLess == 0 ? "more than" : "less than") + " 30, "; break;

        case 16: text = "If the number of modules on the bomb is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 17: text = "If the number of modules on the bomb is " + (moreLess == 0 ? "more than" : "less than") + " 15, "; break;

        case 18: text = "If the number of " + (lettersDigits == 0 ? "letters" : "digits") + " on the Serial Number is " + (evenOdd == 0 ? "even" : "odd") + ", "; break;

        case 19: text = "If there is a Needy module on the bomb, "; break;

        case 20: text = "If the current Key Number is " + (moreLess == 0 ? "more than" : "less than") + " the sum of all the Serial Number digits, "; break;

        case 21: text = "If the Serial Number contains any character from the word " + word + ", "; break;

        case 22: text = "If there is an empty port plate on the bomb, "; break;

        case 23: text = "If the bomb has duplicate ports, "; break;

        case 24: text = "If there are no " + GetWidgetName(widgetType1) + " on the bomb, "; break;

        case 25: text = "If the Serial Number contains a " + (vowelPrime == 0 ? "vowel" : "prime digit") + ", "; break;

        case 26: text = "If the number of solved modules on the bomb is " + (moreLess == 0 ? "more than" : "less than") + " " + selectedModCount + ", "; break;

        case 27: text = "If the number of unsolved modules on the bomb is " + (moreLess == 0 ? "more than" : "less than") + " " + selectedModCount + ", "; break;

        default: text = "If this is a Double Expert module, "; break;
        }
    }
Esempio n. 4
0
 public void ResetSlot()
 {
     HasQuirk  = false;
     QuirkInfo = null;
     gameObject.SetActive(false);
 }
Esempio n. 5
0
 void CheckQuirks()
 {
     qi = new QuirkInfo(moduleId, bomb, startTime);
 }
Esempio n. 6
0
    public InstructionSet(KMBombInfo bomb, QuirkInfo qi)
    {
        if (rnd.Range(0, 2) == 0)
        {
            int prob = rnd.Range(0, 10);

            if (prob < 6)
            {
                letter        = new LetterAlt(bomb, qi);
                runtimeLetter = true;

                text = letter.GetText() + " Then, press NEXT.";
            }
            else if (prob < 9)
            {
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));

                text = "Apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Then, press NEXT.";
            }
            else
            {
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));

                text = "Apply rules " + trueRules.ElementAt(0) + ", " + trueRules.ElementAt(1) + " and " + trueRules.ElementAt(2) + ", in that order. Then, press NEXT.";
            }
        }
        else
        {
            cond = new Condition(bomb, qi);

            if (rnd.Range(0, 2) == 0)
            {
                if (rnd.Range(0, 4) == 0)
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                }
                else
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Then, press NEXT.";
                }
            }
            else
            {
                int prob = rnd.Range(0, 4);

                if (prob == 0)
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Otherwise, apply rule " + falseRules.ElementAt(0) + ". Then, press NEXT.";
                }
                else if (prob == 1)
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Otherwise, apply rule " + falseRules.ElementAt(0) + ". Then, press NEXT.";
                }
                else if (prob == 2)
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Otherwise, apply rules " + falseRules.ElementAt(0) + " and " + falseRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                }
                else
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Otherwise, apply rules " + falseRules.ElementAt(0) + " and " + falseRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                }
            }
        }
    }
Esempio n. 7
0
    public InstructionSet(KMBombInfo bomb, QuirkInfo qi)
    {
        if (rnd.Range(0, 2) == 0)
        {
            int prob = rnd.Range(0, 15);

            if (prob < 6 && bomb.GetSerialNumberLetters().Any()) // Check if the prob is under the value AND there are letters in the serial no.
            {
                letter        = new LetterAlt(bomb, qi);
                runtimeLetter = true;

                text = letter.GetText() + " Then, press NEXT.";
            }
            else if (prob < 9)
            {
                trueRules.Add((char)(rnd.Range(0, 26) + 65));

                text = "Apply rule " + trueRules.ElementAt(0) + ". Then, press NEXT.";
            }
            else if (prob < 12)
            {
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));

                text = "Apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Then, press NEXT.";
            }
            else
            {
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));
                trueRules.Add((char)(rnd.Range(0, 26) + 65));

                text = "Apply rules " + trueRules.ElementAt(0) + ", " + trueRules.ElementAt(1) + " and " + trueRules.ElementAt(2) + ", in that order. Then, press NEXT.";
            }
        }
        else
        {
            cond = new Condition(bomb, qi);

            if (rnd.Range(0, 2) == 0)
            {
                if (rnd.Range(0, 4) == 0)
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                }
                else
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Then, press NEXT.";
                }
            }
            else
            {
                int prob = rnd.Range(0, 4);
                switch (prob)
                {
                case 0:
                {        // if prob == 0
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Otherwise, apply rule " + falseRules.ElementAt(0) + ". Then, press NEXT.";
                    break;
                }

                case 1:
                {        // if prob == 1
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Otherwise, apply rule " + falseRules.ElementAt(0) + ". Then, press NEXT.";
                    break;
                }

                case 2:
                {        // if prob == 2
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rule " + trueRules.ElementAt(0) + ". Otherwise, apply rules " + falseRules.ElementAt(0) + " and " + falseRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                    break;
                }

                default:
                {
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    trueRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));
                    falseRules.Add((char)(rnd.Range(0, 26) + 65));

                    text = cond.GetText() + "apply rules " + trueRules.ElementAt(0) + " and " + trueRules.ElementAt(1) + ", in that order. Otherwise, apply rules " + falseRules.ElementAt(0) + " and " + falseRules.ElementAt(1) + ", in that order. Then, press NEXT.";
                    break;
                }
                }
            }
        }
    }
Esempio n. 8
0
    public LetterAlt(KMBombInfo bomb, QuirkInfo qi)
    {
        rule      = rnd.Range(0, 8);
        this.bomb = bomb;

        switch (rule)
        {
        case 0:
        {
            IEnumerable <char> letters = bomb.GetSerialNumberLetters();
            int index = rnd.Range(0, letters.Count());

            letter = letters.ElementAt(index);
            text   = "Apply the rule that corresponds to the " + GetOrdinal(index + 1) + " letter of the Serial Number.";
            break;
        }

        case 1:
        {
            text = "Apply the rule that corresponds to the letter X of the Serial Number, where X is the number of solved modules on the bomb, modulo the number of letters in the Serial Number, plus 1.";
            break;
        }

        case 2:
        {
            text = "Apply the rule that corresponds to the letter X of the Serial Number, where X is your current Key Number, modulo the number of letters in the Serial Number, plus 1.";
            break;
        }

        case 3:
        {
            IEnumerable <char> letters = bomb.GetSerialNumberLetters();
            int index = bomb.GetSerialNumberNumbers().Sum() % letters.Count();

            letter = letters.ElementAt(index);
            text   = "Apply the rule that corresponds to the letter X of the Serial Number, where X is sum of all the Serial Number digits, modulo the number of letters in the Serial Number, plus 1.";
            break;
        }

        case 4:
        {
            IEnumerable <char> letters = bomb.GetSerialNumberLetters();
            int index = qi.startTime % letters.Count();

            letter = letters.ElementAt(index);
            text   = "Apply the rule that corresponds to the letter X of the Serial Number, where X is the bomb's starting time (whole minutes), modulo the number of letters in the Serial Number, plus 1.";
            break;
        }

        case 5:
        {
            List <char> letters = bomb.GetSerialNumberLetters().ToList();
            letters.Sort();

            if (rnd.Range(0, 2) == 0)
            {
                letter = letters.ElementAt(0);
                text   = "Apply the rule that corresponds to the letter of the Serial Number that comes first alphabetically.";
            }
            else
            {
                letter = letters.ElementAt(letters.Count() - 1);
                text   = "Apply the rule that corresponds to the letter of the Serial Number that comes last alphabetically.";
            }

            break;
        }

        case 6:
        {
            IEnumerable <char> letters = bomb.GetSerialNumberLetters();
            int index = bomb.GetModuleNames().Count() % letters.Count();

            letter = letters.ElementAt(index);
            text   = "Apply the rule that corresponds to the letter X of the Serial Number, where X is the number of modules on the bomb, modulo the number of letters in the Serial Number, plus 1.";
            break;
        }

        case 7:
        {
            List <String> names = bomb.GetModuleNames();
            names.Sort();

            if (rnd.Range(0, 2) == 0)
            {
                letter = names.ElementAt(0)[0];
                text   = "Apply the rule that corresponds to the first character of the name of the module on the bomb that comes first alphabetically (if such rule exists).";
            }
            else
            {
                letter = names.ElementAt(names.Count() - 1)[0];
                text   = "Apply the rule that corresponds to the first character of the name of the module on the bomb that comes last alphabetically (if such rule exists).";
            }

            break;
        }
        }
    }
Esempio n. 9
0
    public LetterAlt(KMBombInfo bomb, QuirkInfo qi)
    {
        rule      = rnd.Range(0, 10);
        this.bomb = bomb;
        IEnumerable <char> letters = bomb.GetSerialNumberLetters();

        try
        {
            switch (rule)
            {
            case 0:
            {
                int index = rnd.Range(0, letters.Count());

                letter = letters.ElementAt(index);
                text   = "Apply the rule corresponding to the " + GetOrdinal(index + 1) + " letter of the Serial Number.";
                break;
            }

            case 1:
            {
                text = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is the number of solved modules on the bomb, modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            case 2:
            {
                text = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is your current Key Number, modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            case 3:
            {
                int index = bomb.GetSerialNumberNumbers().Sum() % letters.Count();

                letter = letters.ElementAt(index);
                text   = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is sum of all the Serial Number digits, modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            case 4:
            {
                int index = qi.startTime % letters.Count();

                letter = letters.ElementAt(index);
                text   = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is the bomb's starting time (whole minutes), modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            case 5:
            {
                List <char> sortedLetters = letters.ToList();
                sortedLetters.Sort();
                if (rnd.Range(0, 2) == 0)
                {
                    letter = sortedLetters.ElementAt(0);
                    text   = "Apply the rule corresponding to the letter of the Serial Number that comes " + GetOrdinal(1) + " alphabetically.";
                }
                else
                {
                    letter = sortedLetters.ElementAt(letters.Count() - 1);
                    text   = "Apply the rule corresponding to the letter of the Serial Number that comes last alphabetically.";
                }

                break;
            }

            case 6:
            {
                int[]    possibleNums  = new int[] { bomb.GetPortPlateCount(), bomb.GetPortCount(), bomb.GetBatteryHolderCount(), bomb.GetBatteryCount(), bomb.GetModuleNames().Count(), bomb.GetSolvableModuleNames().Count() };
                string[] possibleTexts = new string[] { "port plates", "ports", "battery holders", "batteries", "modules", "solvable modules" };
                int      idx           = rnd.Range(0, possibleNums.Length);
                letter = letters.ElementAt(possibleNums[idx] % letters.Count());
                text   = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is the number of " + possibleTexts[idx] + " on the bomb, modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            case 7:
            {
                List <string> solvablenames = bomb.GetSolvableModuleNames().Where(a => a.Length > 0 && "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".Contains(a[0])).ToList();
                solvablenames.Sort();
                if (solvablenames.Any())
                {
                    if (rnd.Range(0, 2) == 0)
                    {
                        letter = solvablenames.ElementAt(0)[0];
                        text   = "Apply the rule corresponding to the 1st character of the name of the solvable module on the bomb that comes 1st alphabetically, excluding modules that start with digits or symbols.";
                    }
                    else
                    {
                        letter = solvablenames.ElementAt(solvablenames.Count() - 1)[0];
                        text   = "Apply the rule corresponding to the 1st character of the name of the solvable module on the bomb that comes last alphabetically, excluding modules that start with digits or symbols.";
                    }
                }
                else
                {        // Implement failsafe to prevent an IndexOutOfBoundsException
                    letter = ' ';
                    text   = "Apply no rule in this instruction. Literally.";
                }
                break;
            }

            case 8:
            {
                List <string> modnames = bomb.GetModuleNames().Where(a => a.Length > 0 && "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".Contains(a[0])).ToList();
                modnames.Sort();
                if (modnames.Any())
                {
                    if (rnd.Range(0, 2) == 0)
                    {
                        letter = modnames.ElementAt(0)[0];
                        text   = "Apply the rule corresponding to the 1st character of the name of the module on the bomb that comes 1st alphabetically, excluding modules that start with digits or symbols.";
                    }
                    else
                    {
                        letter = modnames.ElementAt(modnames.Count() - 1)[0];
                        text   = "Apply the rule corresponding to the 1st character of the name of the module on the bomb that comes last alphabetically, excluding modules that start with digits or symbols.";
                    }
                }
                else
                {        // Implement failsafe to prevent an IndexOutOfBoundsException
                    letter = ' ';
                    text   = "Apply no rule in this instruction. Literally.";
                }
                break;
            }

            case 9:
            {
                text = "Apply the rule corresponding to the Xth letter of the Serial Number, where X is the number of unsolved modules on the bomb, modulo the number of letters in the Serial Number, plus 1.";
                break;
            }

            default:
            {
                letter = ' ';
                text   = "Apply no rule in this instruction. Literally.";
                break;
            }
            }
        }
        catch (Exception error)
        {
            letter = ' ';
            text   = "Apply no rule in this instruction because the attempted instruction was causing an error. Literally.";
            Debug.Log("An exception to Double Expert was caught for rare cases. Yes this is not noticable as much as other instances but it can still happen.");
            Debug.LogError(error);
        }
    }