bool ResolveIncident(IncidentResult result)
    {
        if (_modSettings.Settings.DebugMode)
        {
            PlayRandomSound();
            return(false);
        }
        Audio.HandlePlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
        if (_solved || _spinning)
        {
            return(false);
        }
        if (!_activated)
        {
            BombModule.HandleStrike();
            BombModule.LogFormat("Pressed {0} button before module was ready.", result);
            return(false);
        }
        bool           EvenStrikes  = (BombInfo.GetStrikes() % 2) == 0;
        IncidentResult strikeResult = EvenStrikes ? _correctIncidentResultEvenStrike : _correctIncidentResultOddStrike;

        if (_incident == Incidents.WorldlyDesires)
        {
            BombModule.LogFormat(EvenStrikes ? "Even number of strikes present - Fighting Wicked Hermit" : "Odd number of Strikes present - Fighting Wise Hermit");
        }

        if (result == strikeResult)
        {
            BombModule.LogFormat("Pressed {0}, Expected {1} - Correct", result, _correctIncidentResultEvenStrike);
            switch (result)
            {
            case IncidentResult.Win:
                _wins++;
                break;

            case IncidentResult.Loss:
                _losses++;
                break;

            default:
                ForcePass("Unknown Incident result was pressed.");
                return(false);
            }
            StartCoroutine(SetNextCharacter(false));
        }
        else
        {
            BombModule.LogFormat("Pressed {0}, Expected {1} - Incorrect", result, _correctIncidentResultEvenStrike);
            _losses++;
            StartCoroutine(SetNextCharacter(true));
        }
        return(false);
    }
        public IncidentResult LookupIncident(string num)
        {
            try
            {
                if (num.Equals("")) return new IncidentResult();
                string full = startURL + @"incident?sysparm_limit=10&sysparm_query=active%3Dtrue%5Enumber%3DINC" + num;

                var result = (SNIncident)callServiceNow(full, typeof(SNIncident));
                result.result[0].state = resolveState(result.result[0].state);
                return result.result[0];
            }
            catch
            {
                IncidentResult u = new IncidentResult();
                u.noResultData = true;
                return u;
            }
        }
    private void Initialize(int BossBuff, bool TwoFactorUpdate)
    {
        if (_solved)
        {
            return;
        }

        int         BossDistance;
        int         BossRange;
        IncidentSet incident = new IncidentSet {
            Name = "Error"
        };

        if ((int)_incident < _incidedentSets.Count && (int)_incident >= 0)
        {
            incident = _incidedentSets[(int)_incident];
        }
        bool boss1     = true;
        bool bossbonus = false;

        if (!TwoFactorUpdate)
        {
            RandomizeCharacter();
            RandomizeInventory();
            if (_NO_SIMULATION_RUNNING)
            {
                UpdateDisplay();
                BombModule.LogFormat("Resolving Incident: {0}", incident.Name);
            }
        }
        else
        {
            if (_NO_SIMULATION_RUNNING)
            {
                UpdateDisplay();
                BombModule.LogFormat("Updating Incident {0} results based on a change in the Two Factor sum", incident.Name);
            }
        }

        bool Strikes = false;

OddStrikes:
        if (_incident == Incidents.WorldlyDesires)
        {
            NoSimulationLog(!Strikes ? "Calculating the results for Even number of Strikes" : "Calculating the results for Odd number of Strikes");
        }

        int CharacterDistance = _characterBaseDistance;
        int CharacterRange    = _characterBaseRange;

        NoSimulationLog("Chararcter: {0} - Distance = {1}, Range = {2}, Season = {3}", _character.Name, CharacterDistance, CharacterRange, _season);

        if (_character.Heroine)
        {
            CharacterDistance++;
            CharacterRange++;
            NoSimulationLog("Character is a Heroine, Gets a bonus of 1/1 to Distance/Range");
        }

        if (_spellBonus)
        {
            CharacterDistance += _character.DistanceBonus;
            CharacterRange    += _character.RangeBonus;
            NoSimulationLog("Spell Bonus is Active. Character gets a bonus of {0} to Distance and {1} to Range", _character.DistanceBonus, _character.RangeBonus);
        }

        switch (_incident)
        {
        case Incidents.CosmicWeather:
            bossbonus = _season == CharacterSeasons.Summer;
            break;

        case Incidents.EndlessParty:
            boss1 = _edgeworkDefinedBoss;
            break;

        case Incidents.FairyWars:
            boss1     = _season == CharacterSeasons.Fall || _season == CharacterSeasons.Winter;
            bossbonus = _season == CharacterSeasons.Winter || _season == CharacterSeasons.Summer;
            break;

        case Incidents.LilyBlackandWhite:
            boss1     = _season == CharacterSeasons.Summer || _season == CharacterSeasons.Fall;
            bossbonus = _season == CharacterSeasons.Spring || _season == CharacterSeasons.Summer;
            break;

        case Incidents.LunarWar:
            boss1 = _edgeworkDefinedBoss;
            break;

        case Incidents.OccultInvasion:
            bossbonus = _season == CharacterSeasons.Spring || _season == CharacterSeasons.Summer;
            break;

        case Incidents.OverdrivenNight:
            boss1 = _season == CharacterSeasons.Fall || _season == CharacterSeasons.Winter;
            break;

        case Incidents.UndefinedFantasticObject:
            boss1 = _edgeworkDefinedBoss;
            break;

        case Incidents.ScarletMist:
            boss1 = _edgeworkDefinedBoss;
            break;

        case Incidents.WorldlyDesires:
            boss1 = Strikes;
            break;

        case Incidents.None:
            ForcePass("No idea why Incident.None was picked. That should not have happened.");
            return;

        default:
            ForcePass("Unknown Incident: {0}", _incident);
            return;
        }
        PrintIncident(incident, boss1, bossbonus, out BossDistance, out BossRange);

        foreach (Inventory item in _inventory.OrderBy(x => x.Item))
        {
            string footer = "";
            if (item == FindBestDistanceAdvantage)
            {
                int i = item.Distance;
                footer = " <--- Best Distance advantage";
                if (_inventory.Count(x => x.Distance == i) > 1)
                {
                    footer += " and worst Range disadvantage";
                }
            }
            else if (item == FindBestRangeAdvantage)
            {
                int i = item.Range;
                footer = " <--- Best Range advantage";
                if (_inventory.Count(x => x.Range == i) > 1)
                {
                    footer += " and worst Distance disadvantage";
                }
            }
            NoSimulationLog("Item: {0}, Distance: {1}, Range: {2}{3}", item.Item, item.Distance, item.Range, footer);
        }
        CharacterDistance += FindBestDistanceAdvantage.Distance;
        CharacterRange    += FindBestDistanceAdvantage.Range;

        CharacterDistance += FindBestRangeAdvantage.Distance;
        CharacterRange    += FindBestRangeAdvantage.Range;

        NoSimulationLog("Final character results - Distance = {0}, Range = {1}", CharacterDistance, CharacterRange);
        NoSimulationLog("Final Boss results - Distance = {0}, Range = {1}", BossDistance, BossRange);

        BossRange    += BossBuff;
        BossDistance += BossBuff;

        bool BossWins      = BossRange >= CharacterDistance;
        bool CharacterWins = CharacterRange >= BossDistance;

        if (CharacterWins)
        {
            NoSimulationLog(BossWins ? "Although the Boss was defeated, the character died in the process." : "The Boss was defeated and the character returned victorious");
        }
        else
        {
            NoSimulationLog(BossWins ? "The character was killed by the boss" : "The Battle ended in a stale-mate");
        }

        IncidentResult correctResult;

        if (CharacterWins && BossWins)
        {
            correctResult = _losses < 2 ? IncidentResult.Loss : IncidentResult.Win;
        }
        else
        {
            correctResult = CharacterWins ? IncidentResult.Win : IncidentResult.Loss;
        }
        NoSimulationLog("Expecting {0} to be pressed.", correctResult);

        if (!Strikes)
        {
            _correctIncidentResultEvenStrike = correctResult;
        }
        else
        {
            _correctIncidentResultOddStrike = correctResult;
        }

        if (boss1)
        {
            if (CharacterWins && BossWins)
            {
                _BOTHDEFEATEDLOSS = !_BOTHDEFEATEDLOSS;
                if (_BOTHDEFEATEDLOSS)
                {
                    _WINSBOSS1++;
                }
                else
                {
                    _LOSSESBOSS1++;
                }
            }
            else if (CharacterWins)
            {
                _WINSBOSS1++;
            }
            else
            {
                _LOSSESBOSS1++;
            }
        }
        else
        {
            if (CharacterWins && BossWins)
            {
                _BOTHDEFEATEDLOSS = !_BOTHDEFEATEDLOSS;
                if (_BOTHDEFEATEDLOSS)
                {
                    _WINSBOSS2++;
                }
                else
                {
                    _LOSSESBOSS2++;
                }
            }
            else if (CharacterWins)
            {
                _WINSBOSS2++;
            }
            else
            {
                _LOSSESBOSS2++;
            }
        }


        if (_incident == Incidents.WorldlyDesires)
        {
            NoSimulationLog(!Strikes ? "Done calculating for Even strikes" : "Done calculating for Odd strikes");
            if (!Strikes)
            {
                Strikes = true;
                goto OddStrikes;
            }
        }
        else
        {
            _correctIncidentResultOddStrike = _correctIncidentResultEvenStrike;
        }
    }