Пример #1
0
        public override void Execute()
        {
            RetCode rc;

            Debug.Assert(DobjArtifact != null);

            if (DobjArtifact.IsReadyableByMonster(ActorMonster) && DobjArtifact.IsCarriedByMonster(ActorMonster))
            {
                ActorWeapon = gADB[ActorMonster.Weapon];

                if (ActorWeapon != null)
                {
                    rc = ActorWeapon.RemoveStateDesc(ActorWeapon.GetReadyWeaponDesc());

                    Debug.Assert(gEngine.IsSuccess(rc));
                }

                ActorMonster.Weapon = DobjArtifact.Uid;

                rc = DobjArtifact.AddStateDesc(DobjArtifact.GetReadyWeaponDesc());

                Debug.Assert(gEngine.IsSuccess(rc));

                Debug.Assert(gCharMonster != null);

                if (gCharMonster.IsInRoom(ActorRoom))
                {
                    if (ActorRoom.IsLit())
                    {
                        MonsterName = ActorMonster.EvalPlural(ActorMonster.GetTheName(true), ActorMonster.GetArticleName(true, true, false, true, Globals.Buf01));

                        gOut.Print("{0} readies {1}.", MonsterName, DobjArtifact.GetArticleName());
                    }
                    else
                    {
                        MonsterName = string.Format("An unseen {0}", ActorMonster.CheckNBTLHostility() ? "offender" : "entity");

                        gOut.Print("{0} readies {1}.", MonsterName, "a weapon");
                    }

                    if (ActorMonster.CheckNBTLHostility())
                    {
                        Globals.Thread.Sleep(gGameState.PauseCombatMs);
                    }
                }
            }

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IErrorState>(x =>
                {
                    x.ErrorMessage = string.Format("{0}: NextState == null", Name);
                });
            }
        }
Пример #2
0
        public override void Execute()
        {
            base.Execute();

            if (RevealSecretPassage)
            {
                gEngine.PrintEffectDesc(12);

                ActorRoom.SetDirs(Direction.East, 25);
            }
        }
Пример #3
0
        public override void Execute()
        {
            ActorRoom.Seen = false;

            if (gGameState.GetNBTL(Friendliness.Enemy) <= 0)
            {
                var artTypes = new ArtifactType[] { ArtifactType.Treasure, ArtifactType.DoorGate };

                var goldCurtainArtifact = gADB[40];

                Debug.Assert(goldCurtainArtifact != null);

                var ac = goldCurtainArtifact.GetArtifactCategory(artTypes);

                Debug.Assert(ac != null);

                if (ActorRoom.Uid != 67 || ac.Type == ArtifactType.Treasure || ac.GetKeyUid() == 0)
                {
                    var numRooms = Globals.Module.NumRooms;

                    var directionValues = EnumUtil.GetValues <Direction>();

                    foreach (var dv in directionValues)
                    {
                        if (ActorRoom.GetDirs(dv) < 0 && ActorRoom.GetDirs(dv) >= -numRooms)
                        {
                            var direction = gEngine.GetDirections(dv);

                            Debug.Assert(direction != null);

                            gOut.Print("You found a secret passage {0}!", direction.Name.ToLower());

                            ActorRoom.SetDirs(dv, -ActorRoom.GetDirs(dv));
                        }
                    }
                }
            }

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }
Пример #4
0
        public override void Execute()
        {
            Debug.Assert(Direction == 0 || Enum.IsDefined(typeof(Direction), Direction));

            if (DobjArtifact != null && DobjArtifact.DoorGate == null)
            {
                PrintDontFollowYou();

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

            if (!ActorMonster.CheckNBTLHostility())
            {
                PrintCalmDown();

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

            if (DobjArtifact == null)
            {
                NumExits = 0;

                gEngine.CheckNumberOfExits(ActorRoom, ActorMonster, true, ref _numExits);

                if (NumExits == 0)
                {
                    PrintNoPlaceToGo();

                    NextState = Globals.CreateInstance <IStartState>();

                    goto Cleanup;
                }
            }

            ProcessEvents(EventType.AfterNumberOfExitsCheck);

            if (GotoCleanup)
            {
                goto Cleanup;
            }

            if (DobjArtifact == null)
            {
                if (Direction == 0)
                {
                    RandomDirection = 0;

                    gEngine.GetRandomMoveDirection(ActorRoom, ActorMonster, true, ref _randomDirection);

                    Direction = RandomDirection;
                }

                Debug.Assert(Enum.IsDefined(typeof(Direction), Direction));
            }

            if (DobjArtifact != null)
            {
                Globals.Buf.SetFormat("{0}", DobjArtifact.GetDoorGateFleeDesc());
            }
            else if (Direction == Direction.Up || Direction == Direction.Down || Direction == Direction.In || Direction == Direction.Out)
            {
                Globals.Buf.SetFormat(" {0}ward", Direction.ToString().ToLower());
            }
            else
            {
                Globals.Buf.SetFormat(" to the {0}", Direction.ToString().ToLower());
            }

            gOut.Print("Attempting to flee{0}.", Globals.Buf);

            gGameState.R2 = DobjArtifact != null ? 0 : ActorRoom.GetDirs(Direction);

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IPlayerMoveCheckState>(x =>
                {
                    x.Direction = Direction;

                    x.DoorGateArtifact = DobjArtifact;

                    x.Fleeing = true;
                });
            }
        }
Пример #5
0
        public override void Execute()
        {
            RetCode rc;

            Debug.Assert(GetAll || DobjArtifact != null);

            if (GetAll)
            {
                // screen out all weapons in the room which have monsters present with affinities to those weapons

                TakenArtifactList = ActorRoom.GetTakeableList().Where(a => gEngine.GetMonsterList(m => m.IsInRoom(ActorRoom) && m.Weapon == -a.Uid - 1 && m != ActorMonster).FirstOrDefault() == null).ToList();
            }
            else
            {
                TakenArtifactList = new List <IArtifact>()
                {
                    DobjArtifact
                };
            }

            if (TakenArtifactList.Count <= 0)
            {
                gOut.Print("There's nothing for you to get.");

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

            ArtTypes = new ArtifactType[] { ArtifactType.DisguisedMonster, ArtifactType.DeadBody, ArtifactType.BoundMonster, ArtifactType.Weapon, ArtifactType.MagicWeapon };

            NewlineFlag = false;

            foreach (var artifact in TakenArtifactList)
            {
                DobjArtAc = artifact.GetArtifactCategory(ArtTypes, false);

                if (DobjArtAc == null)
                {
                    DobjArtAc = artifact.GetCategories(0);
                }

                Debug.Assert(DobjArtAc != null);

                OmitWeightCheck = artifact.IsCarriedByCharacter(true);

                ProcessArtifact(artifact, DobjArtAc, ref _newlineFlag);

                if (artifact.IsCarriedByCharacter())
                {
                    // when a weapon is picked up all monster affinities to that weapon are broken

                    FumbleMonsterList = gEngine.GetMonsterList(m => m.Weapon == -artifact.Uid - 1 && m != ActorMonster);

                    foreach (var monster in FumbleMonsterList)
                    {
                        monster.Weapon = -1;
                    }

                    WeaponArtifactAc = artifact.GeneralWeapon;

                    if (artifact.IsReadyableByCharacter() && (WeaponArtifact == null || gEngine.WeaponPowerCompare(artifact, WeaponArtifact) > 0) && (!GetAll || TakenArtifactList.Count == 1 || gGameState.Sh < 1 || WeaponArtifactAc.Field5 < 2))
                    {
                        WeaponArtifact = artifact;
                    }
                }
            }

            if (NewlineFlag)
            {
                gOut.WriteLine();

                NewlineFlag = false;
            }

            if (ActorRoom.IsLit())
            {
                if (!gEngine.AutoDisplayUnseenArtifactDescs && !GetAll && DobjArtifact.IsCarriedByCharacter() && !DobjArtifact.Seen)
                {
                    Globals.Buf.Clear();

                    rc = DobjArtifact.BuildPrintedFullDesc(Globals.Buf, false);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    gOut.Write("{0}", Globals.Buf);

                    DobjArtifact.Seen = true;
                }
            }

            if (ActorMonster.Weapon <= 0 && WeaponArtifact != null && NextState == null)
            {
                RedirectCommand = Globals.CreateInstance <IReadyCommand>();

                CopyCommandData(RedirectCommand);

                RedirectCommand.Dobj = WeaponArtifact;

                NextState = RedirectCommand;
            }

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }
Пример #6
0
        public override void Execute()
        {
            if (CastSpell && !gEngine.CheckPlayerSpellCast(Spell.Power, ShouldAllowSkillGains()))
            {
                goto Cleanup;
            }

            ProcessEvents(EventType.AfterCastSpellCheck);

            if (GotoCleanup)
            {
                goto Cleanup;
            }

            PowerEventRoll = gEngine.RollDice(1, 100, 0);

            if (!Globals.IsRulesetVersion(5, 15, 25))
            {
                // 50% chance of boom

                if (PowerEventRoll > 50)
                {
                    PrintSonicBoom();
                }

                // 50% chance of fortune cookie

                else
                {
                    PrintFortuneCookie();
                }

                goto Cleanup;
            }

            // Raise the dead / Make stuff vanish

            if (gEngine.ResurrectDeadBodies(ActorRoom, ResurrectWhereClauseFuncs) || gEngine.MakeArtifactsVanish(ActorRoom, VanishWhereClauseFuncs))
            {
                goto Cleanup;
            }

            // 10% chance of death trap

            if (PowerEventRoll < 11)
            {
                gOut.Print("The section of {0} collapses and you die.", ActorRoom.EvalRoomType("tunnel you are in", "ground you are on"));

                gGameState.Die = 1;

                NextState = Globals.CreateInstance <IPlayerDeadState>(x =>
                {
                    x.PrintLineSep = true;
                });

                goto Cleanup;
            }

            // 75% chance of boom

            if (PowerEventRoll < 86)
            {
                PrintSonicBoom();

                goto Cleanup;
            }

            // 5% chance of full heal

            if (PowerEventRoll > 95)
            {
                gOut.Print("All of your wounds are healed.");

                ActorMonster.DmgTaken = 0;

                goto Cleanup;
            }

            // 10% chance of SPEED spell

            RedirectCommand = Globals.CreateInstance <ISpeedCommand>(x =>
            {
                x.CastSpell = false;
            });

            CopyCommandData(RedirectCommand);

            NextState = RedirectCommand;

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }
Пример #7
0
 public virtual void PrintSonicBoom()
 {
     if (Globals.IsRulesetVersion(5, 15, 25))
     {
         gOut.Print("You hear a very loud sonic boom that echoes through the {0}.", ActorRoom.EvalRoomType("tunnels", "area"));
     }
     else
     {
         gOut.Print("You hear a loud sonic boom which echoes all around you!");
     }
 }
Пример #8
0
        public override void Execute()
        {
            Debug.Assert(DobjArtifact != null || DobjMonster != null);

            if (BlastSpell || ActorMonster.Weapon > 0)
            {
                // ATTACK/BLAST statue

                if (DobjArtifact != null && DobjArtifact.Uid == 50)
                {
                    gEngine.PrintMonsterAlive(DobjArtifact);

                    DobjArtifact.SetInLimbo();

                    var ngurctMonster = gMDB[53];

                    Debug.Assert(ngurctMonster != null);

                    ngurctMonster.SetInRoom(ActorRoom);

                    var command = Globals.CreateInstance <IAttackCommand>(x =>
                    {
                        x.BlastSpell = BlastSpell;

                        x.CheckAttack = CheckAttack;
                    });

                    CopyCommandData(command);

                    command.Dobj = ngurctMonster;

                    NextState = command;
                }

                // Fireball wand

                else if (!BlastSpell && DobjMonster != null && ActorMonster.Weapon == 63)
                {
                    gOut.Write("{0}What is the trigger word? ", Environment.NewLine);

                    Globals.Buf.SetFormat("{0}", Globals.In.ReadLine());

                    if (!Globals.Buf.ToString().Equals("fire", StringComparison.OrdinalIgnoreCase))
                    {
                        gOut.Print("Wrong!  Nothing happens!");

                        NextState = Globals.CreateInstance <IMonsterStartState>();

                        goto Cleanup;
                    }

                    if (gGameState.WandCharges <= 0)
                    {
                        gOut.Print("The fireball wand is exhausted!");

                        NextState = Globals.CreateInstance <IMonsterStartState>();

                        goto Cleanup;
                    }

                    gGameState.WandCharges--;

                    gOut.Print("The {0} is filled with an incandescent fireball!", ActorRoom.EvalRoomType("room", "area"));

                    var slaveGirlFireballCheck = false;

                    var slaveGirlArtifact = gADB[81];

                    Debug.Assert(slaveGirlArtifact != null);

                    var slaveGirlMonster = gMDB[54];

                    Debug.Assert(slaveGirlMonster != null);

                    if (slaveGirlArtifact.IsInRoom(ActorRoom))
                    {
                        slaveGirlMonster.SetInRoom(ActorRoom);

                        slaveGirlMonster.Seen = true;

                        slaveGirlFireballCheck = true;
                    }

                    var monsterList = gEngine.GetRandomMonsterList(9, m => !m.IsCharacterMonster() && m.Uid != DobjMonster.Uid && m.Seen && m.IsInRoom(ActorRoom));

                    Debug.Assert(monsterList != null);

                    if (monsterList.Count > 0)
                    {
                        monsterList.Insert(0, DobjMonster);
                    }
                    else
                    {
                        monsterList.Add(DobjMonster);
                    }

                    Globals.FireDamage = true;

                    foreach (var m in monsterList)
                    {
                        var rl = gEngine.RollDice(1, 100, 0);

                        var savedVsFire = (m.Hardiness / 4) > 4 && rl < 51;

                        gEngine.MonsterGetsAggravated(m);

                        var combatSystem = Globals.CreateInstance <ICombatSystem>(x =>
                        {
                            x.SetNextStateFunc = s => NextState = s;

                            x.DfMonster = m;

                            x.OmitArmor = true;
                        });

                        combatSystem.ExecuteCalculateDamage(savedVsFire ? 3 : 6, 6);

                        Globals.Thread.Sleep(gGameState.PauseCombatMs);
                    }

                    Globals.FireDamage = false;

                    if (slaveGirlFireballCheck)
                    {
                        slaveGirlMonster.Seen = false;

                        if (slaveGirlMonster.IsInLimbo())
                        {
                            slaveGirlArtifact.SetInLimbo();
                        }
                        else
                        {
                            slaveGirlMonster.SetInLimbo();
                        }
                    }

                    NextState = Globals.CreateInstance <IMonsterStartState>();

                    goto Cleanup;
                }
                else
                {
                    base.Execute();
                }
            }
            else
            {
                base.Execute();
            }

Cleanup:

            ;
        }
Пример #9
0
        public virtual void Execute()
        {
            Debug.Assert(ActorMonster != null);

            ActorRoom = ActorMonster.GetInRoom();

            Debug.Assert(ActorRoom != null);

            if (InputBuf.Length == 0)
            {
                InputBuf.SetFormat("{0}", LastInputStr);

                if (InputBuf.Length > 0 && ActorMonster.IsCharacterMonster())
                {
                    if (Environment.NewLine.Length == 1 && Globals.CursorPosition.Y > -1 && Globals.CursorPosition.Y + 1 >= gOut.GetBufferHeight())
                    {
                        Globals.CursorPosition.Y--;
                    }

                    gOut.SetCursorPosition(Globals.CursorPosition);

                    if (Globals.LineWrapUserInput)
                    {
                        gEngine.LineWrap(InputBuf.ToString(), Globals.Buf, Globals.CommandPrompt.Length);
                    }
                    else
                    {
                        Globals.Buf.SetFormat("{0}", InputBuf.ToString());
                    }

                    gOut.WordWrap = false;

                    gOut.WriteLine(Globals.Buf);

                    gOut.WordWrap = true;
                }
            }

            LastInputStr = InputBuf.ToString();

            InputBuf = ReplacePrepositions(InputBuf);

            Tokens = InputBuf.ToString().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

            if (CurrToken < Tokens.Length)
            {
                if (Tokens.Length == 1)
                {
                    Globals.Buf.SetFormat("{0}", Tokens[CurrToken]);

                    Tokens[CurrToken] = Globals.Buf.TrimEndPunctuationMinusPound().ToString().Trim();
                }

                if (Tokens[CurrToken].Length == 0)
                {
                    Tokens[CurrToken] = "???";
                }
                else if (string.Equals(Tokens[CurrToken], "at", StringComparison.OrdinalIgnoreCase))
                {
                    Tokens[CurrToken] = "a";
                }

                var command = Globals.CommandList.FirstOrDefault(x => x.Verb != null && string.Equals(x.Verb, Tokens[CurrToken], StringComparison.OrdinalIgnoreCase) && x.IsEnabled(ActorMonster));

                if (command == null)
                {
                    command = Globals.CommandList.FirstOrDefault(x => x.Synonyms != null && x.Synonyms.FirstOrDefault(s => string.Equals(s, Tokens[CurrToken], StringComparison.OrdinalIgnoreCase)) != null && x.IsEnabled(ActorMonster));
                }

                if (command == null)
                {
                    command = Globals.CommandList.FirstOrDefault(x => x.Verb != null && (x.Verb.StartsWith(Tokens[CurrToken], StringComparison.OrdinalIgnoreCase) || x.Verb.EndsWith(Tokens[CurrToken], StringComparison.OrdinalIgnoreCase)) && x.IsEnabled(ActorMonster));
                }

                if (command == null)
                {
                    command = Globals.CommandList.FirstOrDefault(x => x.Synonyms != null && x.Synonyms.FirstOrDefault(s => s.StartsWith(Tokens[CurrToken], StringComparison.OrdinalIgnoreCase) || s.EndsWith(Tokens[CurrToken], StringComparison.OrdinalIgnoreCase)) != null && x.IsEnabled(ActorMonster));
                }

                if (command != null)
                {
                    CurrToken++;

                    NextState = Activator.CreateInstance(command.GetType()) as IState;

                    command = NextState as ICommand;

                    Debug.Assert(command != null);

                    command.CommandParser = this;

                    command.ActorMonster = ActorMonster;

                    command.ActorRoom = ActorRoom;

                    command.Dobj = DobjData.Obj;

                    command.Iobj = IobjData.Obj;

                    if (command.ShouldStripTrailingPunctuation() && Tokens.Length > 1)
                    {
                        Globals.Buf.SetFormat("{0}", Tokens[Tokens.Length - 1]);

                        Tokens[Tokens.Length - 1] = Globals.Buf.TrimEndPunctuationMinusPound().ToString().Trim();
                    }

                    if (ActorMonster.IsCharacterMonster())
                    {
                        CheckPlayerCommand(command, false);

                        if (NextState == command)
                        {
                            if (ActorRoom.IsLit() || command.IsDarkEnabled)
                            {
                                command.FinishParsing();

                                if (NextState == command)
                                {
                                    CheckPlayerCommand(command, true);
                                }
                            }
                            else
                            {
                                NextState = null;
                            }
                        }
                    }
                    else
                    {
                        command.FinishParsing();
                    }

                    if (NextState == null)
                    {
                        NextState = Globals.CreateInstance <IStartState>();
                    }
                }
            }
        }
Пример #10
0
        public override void Execute()
        {
            var waterWeirdMonster = gMDB[38];

            Debug.Assert(waterWeirdMonster != null);

            // Large fountain and water weird

            if (DobjArtifact?.Uid == 24 && waterWeirdMonster.IsInLimbo() && !gGameState.WaterWeirdKilled && !Enum.IsDefined(typeof(ContainerType), ContainerType))
            {
                gEngine.PrintEffectDesc(101);

                waterWeirdMonster.SetInRoom(ActorRoom);

                NextState = Globals.CreateInstance <IStartState>();
            }

            // Decoration

            else if (DobjArtifact?.Uid == 41 && DobjArtifact.Field1 > 0 && (!gActorRoom(this).IsDimLightRoomWithoutGlowingMonsters() || gGameState.Ls > 0 || DobjArtifact.Field1 == 61 || DobjArtifact.Field1 == 62) && !Enum.IsDefined(typeof(ContainerType), ContainerType))
            {
                switch (DobjArtifact.Field1)
                {
                case 1:

                    gEngine.PrintEffectDesc(18);

                    break;

                case 2:

                    gEngine.PrintEffectDesc(19);

                    break;

                case 3:

                    gEngine.PrintEffectDesc(20);

                    break;

                case 4:

                    gEngine.PrintEffectDesc(21);

                    break;

                case 5:

                    gEngine.PrintEffectDesc(22);

                    break;

                case 6:

                    gEngine.PrintEffectDesc(23);

                    break;

                case 7:

                    gEngine.PrintEffectDesc(24);

                    break;

                case 8:

                    gEngine.PrintEffectDesc(25);

                    break;

                case 9:

                    gEngine.PrintEffectDesc(26);

                    break;

                case 10:

                    gOut.Print("The grave, to your great surprise, has been dug out very recently, probably no more than {0} ago.  Hmm... it looks to be about your size.",
                               gGameState.Day > 0 ? string.Format("{0} day{1}", gEngine.GetStringFromNumber(gGameState.Day, false, Globals.Buf), gGameState.Day != 1 ? "s" : "") :
                               gGameState.Hour > 0 ? string.Format("{0} hour{1}", gEngine.GetStringFromNumber(gGameState.Hour, false, Globals.Buf), gGameState.Hour != 1 ? "s" : "") :
                               string.Format("{0} minute{1}", gEngine.GetStringFromNumber(gGameState.Minute, false, Globals.Buf), gGameState.Minute != 1 ? "s" : ""));

                    break;

                case 11:

                    gEngine.PrintEffectDesc(27);

                    break;

                case 12:

                    gEngine.PrintEffectDesc(28);

                    break;

                case 13:

                    gEngine.PrintEffectDesc(29);

                    break;

                case 14:

                    gEngine.PrintEffectDesc(30);

                    break;

                case 15:

                    gEngine.PrintEffectDesc(31);

                    break;

                case 16:

                    gEngine.PrintEffectDesc(32);

                    break;

                case 17:

                    gEngine.PrintEffectDesc(33);

                    break;

                case 18:
                {
                    var rl = gEngine.RollDice(1, 100, 0);

                    if (rl > 60)
                    {
                        var rl02 = 0L;

                        do
                        {
                            rl02 = gEngine.RollDice(1, 4, 0);
                        }while (rl02 == 2 && gGameState.GetNBTL(Friendliness.Enemy) > 0);

                        gOut.Print("The rune you pick to examine turns out to be a glyph of {0}!", rl02 == 1 ? "death" : rl02 == 2 ? "sleep" : rl02 == 3 ? "teleportation" : "warding");

                        if (rl02 == 1)
                        {
                            var saved = gEngine.SaveThrow(0);

                            if (!saved)
                            {
                                gEngine.PrintEffectDesc(34);

                                gGameState.Die = 1;

                                NextState = Globals.CreateInstance <IPlayerDeadState>(x =>
                                    {
                                        x.PrintLineSep = true;
                                    });

                                goto Cleanup;
                            }
                            else
                            {
                                gEngine.PrintEffectDesc(35);
                            }
                        }
                        else if (rl02 == 2)
                        {
                            gEngine.PrintEffectDesc(36);

                            gGameState.Day++;
                        }
                        else if (rl02 == 3)
                        {
                            gEngine.PrintEffectDesc(37);

                            var groundsRooms = gRDB.Records.Cast <Framework.IRoom>().Where(r => r.IsGroundsRoom()).ToList();                                       // TODO: maybe add this crypt's Rooms as well

                            var idx = gEngine.RollDice(1, groundsRooms.Count, -1);

                            var newRoom = groundsRooms[(int)idx];

                            gGameState.R2 = newRoom.Uid;

                            NextState = Globals.CreateInstance <IAfterPlayerMoveState>(x =>
                                {
                                    x.MoveMonsters = false;
                                });

                            goto Cleanup;
                        }
                        else
                        {
                            Direction direction = 0;

                            gEngine.GetRandomMoveDirection(ActorRoom, ActorMonster, true, ref direction);

                            Debug.Assert(Enum.IsDefined(typeof(Direction), direction));

                            if (direction == Direction.Up || direction == Direction.Down || direction == Direction.In || direction == Direction.Out)
                            {
                                Globals.Buf.SetFormat(" {0}ward", direction.ToString().ToLower());
                            }
                            else
                            {
                                Globals.Buf.SetFormat(" to the {0}", direction.ToString().ToLower());
                            }

                            gOut.Print("You flee in terror{0}!", Globals.Buf);

                            gGameState.R2 = ActorRoom.GetDirs(direction);

                            NextState = Globals.CreateInstance <IPlayerMoveCheckState>(x =>
                                {
                                    x.Direction = direction;

                                    x.Fleeing = true;
                                });

                            goto Cleanup;
                        }
                    }
                    else
                    {
                        gEngine.PrintEffectDesc(38);

                        gOut.WriteLine();

                        gEngine.PrintTitle("The sands of time pass slowly here,".PadTRight(35, ' '), false);
                        gEngine.PrintTitle("For those who've slipped away.".PadTRight(35, ' '), false);
                        gEngine.PrintTitle("Yet all will surely rise again,".PadTRight(35, ' '), false);
                        gEngine.PrintTitle("To see the break of day.".PadTRight(35, ' '), false);

                        gEngine.PrintEffectDesc(39);
                    }

                    break;
                }

                case 19:

                    gEngine.PrintEffectDesc(40);

                    break;

                case 20:

                    gEngine.PrintEffectDesc(41);

                    break;

                case 21:

                    gEngine.PrintEffectDesc(42);

                    break;

                case 22:

                    gEngine.PrintEffectDesc(43);

                    break;

                case 23:

                    gEngine.PrintEffectDesc(44);

                    break;

                case 24:

                    gEngine.PrintEffectDesc(45);

                    break;

                case 25:

                    gEngine.PrintEffectDesc(46);

                    break;

                case 26:

                    gEngine.PrintEffectDesc(47);

                    break;

                case 27:

                    gEngine.PrintEffectDesc(48);

                    break;

                case 28:

                    gEngine.PrintEffectDesc(49);

                    break;

                case 29:

                    gEngine.PrintEffectDesc(50);

                    break;

                case 30:

                    gOut.Print("The hole, which is several inches across, is far too small to fit into (and definitely too high up to reach), but when you stand directly under it, you can see {0}.",
                               gGameState.IsDayTime() ? "blue skies above you" : "the dark nighttime sky above");

                    break;

                case 31:

                    gEngine.PrintEffectDesc(51);

                    break;

                case 32:

                    gEngine.PrintEffectDesc(52);

                    break;

                case 33:

                    gEngine.PrintEffectDesc(53);

                    break;

                case 34:

                    gEngine.PrintEffectDesc(54);

                    break;

                case 35:

                    gEngine.PrintEffectDesc(55);

                    break;

                case 36:
                {
                    gEngine.PrintEffectDesc(56);

                    var rl = gEngine.RollDice(1, 4, 0);

                    if (rl == 1)
                    {
                        gOut.WriteLine();

                        gEngine.PrintTitle("...".PadTRight(51, ' '), false);
                        gEngine.PrintTitle("River shall overflow, and tree shall bear no fruit.".PadTRight(51, ' '), false);
                        gEngine.PrintTitle("...".PadTRight(51, ' '), false);

                        gEngine.PrintEffectDesc(57);
                    }
                    else if (rl == 2)
                    {
                        gEngine.PrintEffectDesc(58);
                    }
                    else if (rl == 3)
                    {
                        gOut.WriteLine();

                        gEngine.PrintTitle("How long have we lived in these valleys, dwelt upon these shores?".PadTRight(65, ' '), false);
                        gEngine.PrintTitle("When shall we understand those things around us that shape life?".PadTRight(65, ' '), false);
                        gEngine.PrintTitle("Our enemy wages war against us as we ponder such.".PadTRight(65, ' '), false);
                        gEngine.PrintTitle("This knowledge kept from us, forever veiled in shadow.".PadTRight(65, ' '), false);
                    }
                    else
                    {
                        gOut.WriteLine();

                        gEngine.PrintTitle("When the waves rise against you, pull you under, where shall you turn?".PadTRight(70, ' '), false);
                        gEngine.PrintTitle("What deliverance from an icy grip, when all hope is lost?".PadTRight(70, ' '), false);
                        gEngine.PrintTitle("Though the scales may cover your eyes, what's this - a revelation!".PadTRight(70, ' '), false);
                        gEngine.PrintTitle("Merely speak the words of truth, and life shall again be yours:".PadTRight(70, ' '), false);

                        gOut.WriteLine();

                        gEngine.PrintTitle("\"Avarchrom Yarei Uttoximo.\"", false);
                    }

                    break;
                }

                case 37:

                    gEngine.PrintEffectDesc(59);

                    break;

                case 38:

                    gEngine.PrintEffectDesc(60);

                    break;

                case 39:

                    gEngine.PrintEffectDesc(61);

                    break;

                case 40:

                    gEngine.PrintEffectDesc(62);

                    break;

                case 41:

                    gEngine.PrintEffectDesc(63);

                    break;

                case 42:

                    gEngine.PrintEffectDesc(64);

                    break;

                case 43:

                    gOut.Print("The dead goblins have been slain recently; you'd say no more than {0} days ago.  They appear to have been slashed severely, with well-placed strokes - blood lies splattered all over the walls and the floor.  All useful items have been taken from the bodies.",
                               gEngine.GetStringFromNumber(gGameState.Day + 2, false, Globals.Buf));

                    break;

                case 44:

                    gEngine.PrintEffectDesc(65);

                    break;

                case 45:

                    gEngine.PrintEffectDesc(66);

                    break;

                case 46:

                    gEngine.PrintEffectDesc(67);

                    break;

                case 47:

                    gEngine.PrintEffectDesc(68);

                    break;

                case 48:

                    gEngine.PrintEffectDesc(69);

                    break;

                case 49:

                    gEngine.PrintEffectDesc(70);

                    break;

                case 50:
                {
                    gEngine.PrintEffectDesc(71);

                    var rl = gEngine.RollDice(1, 100, 0);

                    if (rl > 70)
                    {
                        var saved = gEngine.SaveThrow(0);

                        gEngine.PrintEffectDesc(72);

                        if (saved)
                        {
                            gEngine.PrintEffectDesc(73);
                        }
                        else
                        {
                            gEngine.PrintEffectDesc(74);
                        }

                        if (!saved)
                        {
                            gGameState.Die = 1;

                            NextState = Globals.CreateInstance <IPlayerDeadState>(x =>
                                {
                                    x.PrintLineSep = true;
                                });

                            goto Cleanup;
                        }
                    }

                    break;
                }

                case 51:

                    gEngine.PrintEffectDesc(75);

                    break;

                case 52:

                    gOut.Print("The stains on the eastern wall are obviously dried blood.{0}", gEngine.SaveThrow(Stat.Intellect) ? "  You notice that the stains abruptly end at a fine vertical crack in the wall.  Strange." : "");

                    break;

                case 53:

                    gEngine.PrintEffectDesc(76);

                    break;

                case 54:
                {
                    var saved = gEngine.SaveThrow(Stat.Intellect);

                    var target = gEngine.GetRandomMonsterList(1, m => m.IsInRoom(ActorRoom)).FirstOrDefault();

                    Debug.Assert(target != null);

                    var rl = gEngine.RollDice(1, 100, 0);

                    gEngine.PrintEffectDesc(77);

                    if (saved)
                    {
                        gEngine.PrintEffectDesc(78);
                    }
                    else
                    {
                        gOut.Print("As you examine it, a crossbow bolt shoots out of the face's mouth, and strikes {0}!", rl > 50 ? (target.IsCharacterMonster() ? "you" : target.GetTheName()) : "the opposite wall");
                    }

                    if (!saved && rl > 50)
                    {
                        var combatSystem = Globals.CreateInstance <ICombatSystem>(x =>
                            {
                                x.Cast <Framework.Combat.ICombatSystem>().CrossbowTrap = true;

                                x.SetNextStateFunc = s => NextState = s;

                                x.DfMonster = target;
                            });

                        combatSystem.ExecuteCalculateDamage(2, 6);

                        goto Cleanup;
                    }

                    break;
                }

                case 55:

                    gEngine.PrintEffectDesc(79);

                    break;

                case 56:
                {
                    var giantCrayfishMonster = gMDB[37];

                    Debug.Assert(giantCrayfishMonster != null);

                    if (!giantCrayfishMonster.IsInLimbo() || gGameState.GiantCrayfishKilled)
                    {
                        gEngine.PrintEffectDesc(80);
                    }
                    else
                    {
                        gEngine.PrintEffectDesc(81);

                        giantCrayfishMonster.SetInRoom(ActorRoom);

                        var saved = gEngine.SaveThrow(Stat.Agility);

                        if (!saved)
                        {
                            gOut.Print("You've been taken entirely by surprise.");

                            Globals.InitiativeMonsterUid = giantCrayfishMonster.Uid;
                        }
                        else
                        {
                            NextState = Globals.CreateInstance <IStartState>();

                            goto Cleanup;
                        }
                    }

                    break;
                }

                case 57:
                case 58:
                case 59:
                case 60:

                    var command = Globals.CreateInstance <IReadCommand>();

                    CopyCommandData(command);

                    NextState = command;

                    break;

                case 61:

                    var rainDescs = new string[]
                    {
                        "",
                        string.Format("A sprinkling of rain falls on the cemetery from a patchwork of{0} clouds.", gGameState.IsDayTime() ? " light grey" : ""),
                        string.Format("The rain falls lightly{0}, covering the ground with small puddles and coating any tombstones or monuments present.", gGameState.IsDayTime() ? " from slate-grey clouds" : ""),
                        "A driving rain falls from ominous black clouds; you try to keep dry but quickly realize the effort is futile.  Large puddles form, and streams of water cut through the path, seeking lower ground.  Your footing is treacherous.",
                        "The fury of nature is on full display as you blindly stumble through a deluge.  Large sections of ground turn into pools, and the path disappears altogether.  You are soaked, chilled to the bone, feeling quite miserable, and must carefully navigate to avoid being swept away."
                    };

                    gOut.Print("{0}", rainDescs[gActorRoom(this).GetWeatherIntensity()]);

                    break;

                case 62:

                    var fogDescs = new string[]
                    {
                        "",
                        "A light mist hangs in the air, gently swirling as you move along the path, but your vision is otherwise unimpaired.",
                        "A fog hangs over the terrain and limits your vision to several dozen paces; familiar landmarks become dimly-lit silhouettes.",
                        "As you peer into the dense fog, you realize your vision is restricted to a dozen paces.  The imposing shapes of monuments and trees lurk in the gloom, just beyond your perception; a foreboding silence is broken occasionally by the cry of an unseen bird or rustle of leaves nearby.",
                        "The world is lost as you find yourself enveloped in a silent white cocoon, the fog so dense you can barely see your hand, held up at arms' length in front of your face.  Your eyes only occasionally leave the ground as you stumble across monuments or trees, hulking shadows that suddenly appear in the miasma, seemingly from nowhere."
                    };

                    gOut.Print("{0}", fogDescs[gActorRoom(this).GetWeatherIntensity()]);

                    break;
                }

Cleanup:

                if (NextState == null)
                {
                    NextState = Globals.CreateInstance <IMonsterStartState>();
                }
            }
            else
            {
                base.Execute();
            }
        }
Пример #11
0
        public override void PrintTaken(IArtifact artifact)
        {
            Debug.Assert(artifact != null);

            var bronzeKeyArtifact = gADB[27];

            Debug.Assert(bronzeKeyArtifact != null);

            var deviceArtifact1 = gADB[44];

            Debug.Assert(deviceArtifact1 != null);

            var deviceArtifact2 = gADB[49];

            Debug.Assert(deviceArtifact2 != null);

            var ac = artifact.Categories[0];

            // Get lever

            if (artifact.Uid == 48 && deviceArtifact1.IsInRoom(ActorRoom))
            {
                if (TakenArtifactList[0] != artifact)
                {
                    gOut.WriteLine();
                }

                deviceArtifact1.SetInLimbo();

                deviceArtifact2.SetInRoom(ActorRoom);

                gEngine.PrintEffectDesc(30);

                base.PrintTaken(artifact);
            }

            // Get medallion

            else if (artifact.Uid == 10 && gGameState.MedallionCharges > 0)
            {
                base.PrintTaken(artifact);

                gOut.Write("{0}{0}Your hand feels relaxed, but strong.", Environment.NewLine);

                if (TakenArtifactList[TakenArtifactList.Count - 1] != artifact)
                {
                    gOut.WriteLine();
                }
            }

            // Get straw mattress

            else if (artifact.Uid == 26 && bronzeKeyArtifact.IsInLimbo())
            {
                base.PrintTaken(artifact);

                bronzeKeyArtifact.SetInRoom(ActorRoom);

                gOut.Write("{0}{0}You found something under the mattress!", Environment.NewLine);

                if (TakenArtifactList[TakenArtifactList.Count - 1] != artifact)
                {
                    gOut.WriteLine();
                }
            }

            // Get gold curtain

            else if (artifact.Uid == 40 && ac.Type == ArtifactType.DoorGate)
            {
                base.PrintTaken(artifact);

                ActorRoom.SetDirs(Direction.South, 68);

                ac.Type = ArtifactType.Treasure;

                ac.Field1 = 0;

                ac.Field2 = 0;

                ac.Field3 = 0;

                ac.Field4 = 0;

                ac.Field5 = 0;
            }
            else
            {
                base.PrintTaken(artifact);
            }
        }
Пример #12
0
        public override void Execute()
        {
            RetCode rc;

            Debug.Assert(DobjArtifact != null);

            ArtTypes = new ArtifactType[] { ArtifactType.DisguisedMonster, ArtifactType.DeadBody, ArtifactType.BoundMonster, ArtifactType.Weapon, ArtifactType.MagicWeapon };

            DobjArtAc = DobjArtifact.GetArtifactCategory(ArtTypes, false);

            if (DobjArtAc == null)
            {
                DobjArtAc = DobjArtifact.GetCategories(0);
            }

            if (DobjArtAc != null && DobjArtAc.Type != ArtifactType.DisguisedMonster && DobjArtifact.Weight <= 900 && !DobjArtifact.IsUnmovable01() && (DobjArtAc.Type != ArtifactType.DeadBody || DobjArtAc.Field1 == 1) && DobjArtAc.Type != ArtifactType.BoundMonster)
            {
                OmitWeightCheck = DobjArtifact.IsCarriedByMonster(ActorMonster, true);

                DobjArtifactCount = 0;

                DobjArtifactWeight = DobjArtifact.Weight;

                if (DobjArtifact.GeneralContainer != null)
                {
                    rc = DobjArtifact.GetContainerInfo(ref _dobjArtifactCount, ref _dobjArtifactWeight, ContainerType.In, true);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    rc = DobjArtifact.GetContainerInfo(ref _dobjArtifactCount, ref _dobjArtifactWeight, ContainerType.On, true);

                    Debug.Assert(gEngine.IsSuccess(rc));
                }

                ActorMonsterInventoryWeight = 0;

                rc = ActorMonster.GetFullInventoryWeight(ref _actorMonsterInventoryWeight, recurse: true);

                Debug.Assert(gEngine.IsSuccess(rc));

                if (!gEngine.EnforceMonsterWeightLimits || OmitWeightCheck || (DobjArtifactWeight <= ActorMonster.GetWeightCarryableGronds() && DobjArtifactWeight + ActorMonsterInventoryWeight <= ActorMonster.GetWeightCarryableGronds() * ActorMonster.CurrGroupCount))
                {
                    DobjArtifact.SetCarriedByMonster(ActorMonster);

                    Debug.Assert(gCharMonster != null);

                    if (gCharMonster.IsInRoom(ActorRoom))
                    {
                        if (ActorRoom.IsLit())
                        {
                            MonsterName = ActorMonster.EvalPlural(ActorMonster.GetTheName(true), ActorMonster.GetArticleName(true, true, false, true, Globals.Buf01));

                            gOut.Print("{0} picks up {1}.", MonsterName, DobjArtifact.GetTheName());
                        }
                        else
                        {
                            MonsterName = string.Format("An unseen {0}", ActorMonster.CheckNBTLHostility() ? "offender" : "entity");

                            gOut.Print("{0} picks up {1}.", MonsterName, "a weapon");
                        }
                    }

                    // when a weapon is picked up all monster affinities to that weapon are broken

                    FumbleMonsterList = gEngine.GetMonsterList(m => m.Weapon == -DobjArtifact.Uid - 1 && m != ActorMonster);

                    foreach (var monster in FumbleMonsterList)
                    {
                        monster.Weapon = -1;
                    }
                }
            }

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IErrorState>(x =>
                {
                    x.ErrorMessage = string.Format("{0}: NextState == null", Name);
                });
            }
        }
Пример #13
0
        public override void Execute()
        {
            Debug.Assert(DobjArtifact != null);

            // Digging with shovel

            if (DobjArtifact.Uid == 7)
            {
                if (gGameState.GetNBTL(Friendliness.Enemy) <= 0)
                {
                    var buriedCasketArtifact = gADB[35];

                    Debug.Assert(buriedCasketArtifact != null);

                    if (ActorRoom.Uid == 5 && buriedCasketArtifact.IsInLimbo())
                    {
                        gEngine.PrintEffectDesc(92);

                        buriedCasketArtifact.SetInRoom(ActorRoom);
                    }
                    else
                    {
                        var digResult = ActorRoom.EvalRoomType("The floor is far to hard to dig into!", "You dig for a while but find nothing of interest.");

                        gOut.Print(digResult);
                    }

                    NextState = Globals.CreateInstance <IMonsterStartState>();
                }
                else
                {
                    PrintEnemiesNearby();

                    NextState = Globals.CreateInstance <IStartState>();
                }
            }

            // Bailing fountain water with wooden bucket

            else if (DobjArtifact.Uid == 6)
            {
                var waterWeirdMonster = gMDB[38];

                Debug.Assert(waterWeirdMonster != null);

                var largeFountainArtifact = gADB[24];

                Debug.Assert(largeFountainArtifact != null);

                var waterArtifact = gADB[40];

                Debug.Assert(waterArtifact != null);

                if (ActorRoom.Uid == 116 && !waterArtifact.IsInLimbo())
                {
                    if (waterWeirdMonster.IsInRoom(ActorRoom))
                    {
                        gOut.Print("{0} won't let you get close enough to do that!", waterWeirdMonster.GetTheName(true));
                    }
                    else if (!gGameState.WaterWeirdKilled)
                    {
                        gEngine.PrintEffectDesc(100);

                        waterWeirdMonster.SetInRoom(ActorRoom);

                        NextState = Globals.CreateInstance <IStartState>();
                    }
                    else if (gGameState.GetNBTL(Friendliness.Enemy) <= 0)
                    {
                        gEngine.PrintEffectDesc(93);

                        waterArtifact.SetInLimbo();

                        largeFountainArtifact.Desc = largeFountainArtifact.Desc.Replace("squirts", "squirted");
                    }
                    else
                    {
                        PrintEnemiesNearby();

                        NextState = Globals.CreateInstance <IStartState>();
                    }
                }
                else
                {
                    gOut.Print("That doesn't do anything right now.");
                }

                if (NextState == null)
                {
                    NextState = Globals.CreateInstance <IMonsterStartState>();
                }
            }

            // Using bronze cross on undead

            else if (DobjArtifact.Uid == 37)
            {
                var deadMonsterUids = new long[] { 3, 4, 6 };

                var wardedMonsterUids = new long[] { 7, 8, 9, 14, 16 };

                var deadMonsterList = gEngine.GetMonsterList(m => deadMonsterUids.Contains(m.Uid) && m.IsInRoom(ActorRoom));

                foreach (var m in deadMonsterList)
                {
                    gOut.Print("{0} is destroyed by the cross, its body disintegrates!", m.GetTheName(true));

                    m.SetInLimbo();

                    m.DmgTaken = 0;
                }

                var wardedMonsterList = gEngine.GetMonsterList(m => wardedMonsterUids.Contains(m.Uid) && m.IsInRoom(ActorRoom));

                foreach (var m in wardedMonsterList)
                {
                    gOut.Print("{0} is warded off by the cross!", m.GetTheName(true));

                    gEngine.MoveMonsterToRandomAdjacentRoom(ActorRoom, m, true, false);
                }

                if (deadMonsterList.Count == 0 && wardedMonsterList.Count == 0)
                {
                    gOut.Print("Nothing happens.");
                }

                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
            else
            {
                base.Execute();
            }
        }
Пример #14
0
 public virtual void BuildContentsSpillToFloor()
 {
     Globals.Buf.AppendFormat("; {0} contents spill to the {1}", DobjArtifact.EvalPlural("its", "their"), ActorRoom.EvalRoomType("floor", "ground"));
 }
Пример #15
0
        public override void Execute()
        {
            RetCode rc;

            Debug.Assert(DobjArtifact != null || DobjMonster != null);

            if (!ActorRoom.IsLit())
            {
                Debug.Assert(DobjMonster != null && DobjMonster.IsCharacterMonster());
            }

            if (DobjArtifact != null)
            {
                DobjArtAc = DobjArtifact.InContainer;

                if (DobjArtAc == null)
                {
                    DobjArtAc = DobjArtifact.OnContainer;
                }

                if (DobjArtAc == null && AllowExtendedContainers)
                {
                    DobjArtAc = DobjArtifact.UnderContainer;
                }

                if (DobjArtAc == null && AllowExtendedContainers)
                {
                    DobjArtAc = DobjArtifact.BehindContainer;
                }

                if (DobjArtAc == null)
                {
                    PrintCantVerbObj(DobjArtifact);

                    NextState = Globals.CreateInstance <IStartState>();

                    goto Cleanup;
                }

                DobjArtContainerType = gEngine.GetContainerType(DobjArtAc.Type);

                if (DobjArtifact.IsEmbeddedInRoom(ActorRoom))
                {
                    DobjArtifact.SetInRoom(ActorRoom);
                }

                if (DobjArtAc == DobjArtifact.InContainer && !DobjArtAc.IsOpen() && !DobjArtifact.ShouldExposeInContentsWhenClosed())
                {
                    PrintMustFirstOpen(DobjArtifact);

                    NextState = Globals.CreateInstance <IStartState>();

                    goto Cleanup;
                }

                DobjArtContainedArtifactList = DobjArtifact.GetContainedList(containerType: DobjArtContainerType);

                ShowCharOwned = !DobjArtifact.IsCarriedByCharacter() && !DobjArtifact.IsWornByCharacter();

                if (DobjArtContainedArtifactList.Count > 0)
                {
                    Globals.Buf.SetFormat("{0}{1} {2} you see ",
                                          Environment.NewLine,
                                          gEngine.EvalContainerType(DobjArtContainerType, "Inside", "On", "Under", "Behind"),
                                          DobjArtifact.GetTheName(false, ShowCharOwned, false, false, Globals.Buf01));

                    rc = gEngine.GetRecordNameList(DobjArtContainedArtifactList.Cast <IGameBase>().ToList(), ArticleType.A, ShowCharOwned, StateDescDisplayCode.None, false, false, Globals.Buf);

                    Debug.Assert(gEngine.IsSuccess(rc));
                }
                else
                {
                    Globals.Buf.SetFormat("{0}There's nothing {1} {2}",
                                          Environment.NewLine,
                                          gEngine.EvalContainerType(DobjArtContainerType, "inside", "on", "under", "behind"),
                                          DobjArtifact.GetTheName(false, ShowCharOwned, false, false, Globals.Buf01));
                }

                Globals.Buf.AppendFormat(".{0}", Environment.NewLine);

                gOut.Write("{0}", Globals.Buf);

                goto Cleanup;
            }

            IsCharMonster = DobjMonster.IsCharacterMonster();

            if (!IsCharMonster && DobjMonster.Reaction < Friendliness.Friend)
            {
                gEngine.MonsterEmotes(DobjMonster);

                gOut.WriteLine();

                goto Cleanup;
            }

            HasWornInventory = DobjMonster.HasWornInventory();

            if (HasWornInventory)
            {
                DobjMonsterWornArtifactList = DobjMonster.GetWornList();

                if (DobjMonsterWornArtifactList.Count > 0)
                {
                    Globals.Buf.SetFormat("{0}{1} {2} {3}",
                                          Environment.NewLine,
                                          IsCharMonster ? "You" : DobjMonster.EvalPlural(DobjMonster.GetTheName(true, true, false, true, Globals.Buf01), "They"),
                                          IsCharMonster ? "are" : DobjMonster.EvalPlural("is", "are"),
                                          IsCharMonster ? "wearing " : DobjMonster.EvalPlural("wearing ", "wearing among them "));

                    rc = gEngine.GetRecordNameList(DobjMonsterWornArtifactList.Cast <IGameBase>().ToList(), ArticleType.A, IsCharMonster ? false : true, IsCharMonster ? StateDescDisplayCode.AllStateDescs : StateDescDisplayCode.SideNotesOnly, IsCharMonster ? true : false, false, Globals.Buf);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    Globals.Buf.AppendFormat(".{0}", Environment.NewLine);

                    gOut.Write("{0}", Globals.Buf);
                }
            }

            HasCarriedInventory = DobjMonster.HasCarriedInventory();

            if (HasCarriedInventory)
            {
                DobjMonsterCarriedArtifactList = DobjMonster.GetCarriedList();

                if (IsCharMonster)
                {
                    // use total debt for characters with no assets; otherwise use HeldGold (which may be debt or asset)

                    TotalGold = gCharacter.HeldGold < 0 && gCharacter.BankGold < 0 ? gCharacter.HeldGold + gCharacter.BankGold : gCharacter.HeldGold;

                    if (TotalGold != 0)
                    {
                        GoldArtifact = Globals.CreateInstance <IArtifact>(x =>
                        {
                            x.Name = string.Format("{0}{1} gold piece{2}",
                                                   TotalGold < 0 ? "a debt of " : "",
                                                   gEngine.GetStringFromNumber(Math.Abs(TotalGold), false, Globals.Buf),
                                                   Math.Abs(TotalGold) != 1 ? "s" : "");
                        });

                        DobjMonsterCarriedArtifactList.Add(GoldArtifact);
                    }
                }

                Globals.Buf.SetFormat("{0}{1} {2} {3}",
                                      Environment.NewLine,
                                      IsCharMonster ? "You" : DobjMonster.EvalPlural(DobjMonster.GetTheName(true, true, false, true, Globals.Buf01), "They"),
                                      IsCharMonster ? "are" : DobjMonster.EvalPlural("is", "are"),
                                      DobjMonsterCarriedArtifactList.Count == 0 ? "" :
                                      IsCharMonster ? "carrying " : DobjMonster.EvalPlural("carrying ", "carrying among them "));

                if (DobjMonsterCarriedArtifactList.Count > 0)
                {
                    rc = gEngine.GetRecordNameList(DobjMonsterCarriedArtifactList.Cast <IGameBase>().ToList(), ArticleType.A, IsCharMonster ? false : true, IsCharMonster ? StateDescDisplayCode.AllStateDescs : StateDescDisplayCode.SideNotesOnly, IsCharMonster ? true : false, false, Globals.Buf);

                    Debug.Assert(gEngine.IsSuccess(rc));
                }
                else
                {
                    Globals.Buf.Append("empty handed");
                }

                Globals.Buf.AppendFormat(".{0}", Environment.NewLine);

                gOut.Write("{0}", Globals.Buf);
            }

            ShouldShowHealthStatusWhenInventoried = DobjMonster.ShouldShowHealthStatusWhenInventoried();

            if (ShouldShowHealthStatusWhenInventoried)
            {
                IsUninjuredGroup = DobjMonster.CurrGroupCount > 1 && DobjMonster.DmgTaken == 0;

                Globals.Buf.SetFormat("{0}{1} {2} ",
                                      Environment.NewLine,
                                      IsCharMonster ? "You" :
                                      IsUninjuredGroup ? "They" :
                                      DobjMonster.GetTheName(true, true, false, true, Globals.Buf01),
                                      IsCharMonster || IsUninjuredGroup ? "are" : "is");

                DobjMonster.AddHealthStatus(Globals.Buf);

                gOut.Write("{0}", Globals.Buf);
            }

            if (GoldArtifact != null)
            {
                GoldArtifact.Dispose();

                GoldArtifact = null;
            }

            if (!HasWornInventory && !HasCarriedInventory && !ShouldShowHealthStatusWhenInventoried)
            {
                PrintCantVerbObj(DobjMonster);

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }