Пример #1
0
 public Quest(FreeStrategy strategy, int shadowHuntAllocated, ILogger log)
 {
     FreeStrategy        = strategy;
     ShadowHuntAllocated = shadowHuntAllocated;
     HuntBag             = new HuntBag();
     Log = log;
 }
Пример #2
0
 private void EnterMordor()
 {
     HuntBag.EnterMordor();
     if (null == TookMoria)
     {
         TookMoria = 10 == EffectiveDistanceFromRivendell;
     }
     Progress   = 0;
     IsInMordor = true;
     Log.Log($"____Enter Mordor____  took moria = {TookMoria}");
 }
Пример #3
0
        void RevealFellowshipOutsideMordorAndResolveStrongholdTiles()
        {
            int ntiles = RevealFellowshipOutsideMordor();

            for (; ntiles > 0; ntiles--)
            {
                var tile = HuntBag.DrawTile();
                Log.Log($"    stronghold tile {tile}");
                FreeStrategy.Hunt(tile.Value(0), false, tile, this);
            }
        }
Пример #4
0
        public Quest MordorTrack()
        {
            for (; ; Turns++)
            {
                // int eyes = ShadowHuntAllocated + D6.CountHits(ShadowRolled, 6);
                ShadowActionDiceRoll shadowDice = new ShadowActionDiceRoll(7 + Minions, ShadowHuntAllocated);
                bool movedOrHidThisTurn         = false;
                var  freeDice    = new FreeActionDiceRoll(FreeActionDiceCount);
                int  freeHuntBox = 0;

                Log.Log($"Turn {Turns}: {shadowDice.Eyes} eyes, {freeDice}");

                while (freeDice.CharacterOrWills > 0 || StriderCanHide(freeDice))
                {
                    if (StriderCanHide(freeDice))
                    {
                        Revealed = false;
                        Log.Log($"  Strider hide");
                        freeDice.SpendMostUselessDie();
                    }
                    else if (Revealed)
                    {
                        Revealed = false;
                        Log.Log($"  hide");
                        freeDice.SpendCharacterOrWill();
                    }
                    else
                    {
                        var tile      = HuntBag.DrawTile();
                        int huntValue = tile.Value(shadowDice.Eyes + freeHuntBox);
                        Log.Log($"  from step {MordorTrackStep} {tile} = {huntValue}");
                        FreeStrategy.Hunt(huntValue, tile.Reveal(), tile, this);
                        if (!tile.Stop())
                        {
                            MordorTrackStep++;
                        }
                        freeHuntBox++;
                        Log.Log($"    corruption {Corruption}, {shadowDice.Eyes} eyes");
                        freeDice.SpendCharacterOrWill();
                        if (IsOver())
                        {
                            return(this);
                        }
                    }
                    movedOrHidThisTurn = true;
                }
                if (!movedOrHidThisTurn)
                {
                    Corruption++;
                    Log.Log("  lazy hobbit corruption");
                }
            }
        }
Пример #5
0
        public Quest FromRivendell()
        {
            for (Turns = 1; ; Turns++)
            {
                if (AtTheGatesOfMordor())
                {
                    EnterMordor();
                    return(MordorTrack());
                }
                ShadowActionDiceRoll shadowDice = new ShadowActionDiceRoll(7 + Minions, ShadowHuntAllocated);
                int freeHuntBoxDiceCount        = 0;
                var freeDice = new FreeActionDiceRoll(FreeActionDiceCount);
                Log.Log($"Turn {Turns}: {shadowDice.Eyes} eyes, {freeDice}");

                while (freeDice.CharacterOrWills > 0 || StriderCanHide(freeDice))
                {
                    if (PromoteGandalfIfAble(freeDice))
                    {
                        // do nothing
                    }
                    else if (StriderCanHide(freeDice))
                    {
                        Revealed = false;
                        Log.Log($"  Strider hide");
                        freeDice.SpendMostUselessDie();
                    }
                    else if (Revealed)
                    {
                        Revealed = false;
                        Log.Log($"  hide");
                        freeDice.SpendCharacterOrWill();
                    }
                    else if (AtTheGatesOfMordor())
                    {
                        EnterMordor();
                        return(MordorTrack());
                    }
                    else
                    {
                        int hits = D6.CountHits(shadowDice.Eyes, 6 - freeHuntBoxDiceCount);
                        if (hits > 0)
                        {
                            var  tile        = HuntBag.DrawTile();
                            int  huntValue   = tile.Value(hits);
                            bool wasRevealed = Revealed;
                            Log.Log($"  walk {EffectiveDistanceFromRivendell + 1} {Pluralize("step", EffectiveDistanceFromRivendell + 1)} from Rivendell  - {hits} {Pluralize("hit", hits)} - {tile}");
                            FreeStrategy.Hunt(huntValue, tile.Reveal(), tile, this);
                            ++Progress;
                            bool freshlyRevealed = (!wasRevealed) && Revealed;
                            if (freshlyRevealed)
                            {
                                RevealFellowshipOutsideMordorAndResolveStrongholdTiles();
                            }
                            ++freeHuntBoxDiceCount;
                            Log.Log($"    corruption {Corruption}, {shadowDice.Eyes} eyes");
                        }
                        else
                        {
                            Progress++;
                            Log.Log($"  walk {EffectiveDistanceFromRivendell} {Pluralize("step", EffectiveDistanceFromRivendell)} from Rivendell");
                        }
                        freeDice.SpendCharacterOrWill();
                    }
                    if (IsOver())
                    {
                        return(this);
                    }
                }
            }
        }