Exemple #1
0
        public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact)
        {
            Debug.Assert(artifact != null);

            return(Enum.IsDefined(typeof(ContainerType), ContainerType) && !artifact.IsWornByCharacter());
        }
Exemple #2
0
        public override void PlayerExecute()
        {
            Debug.Assert(gDobjArtifact != null);

            var ac = gDobjArtifact.BoundMonster;

            if (ac != null)
            {
                var monsterUid = ac.GetMonsterUid();

                var keyUid = ac.GetKeyUid();

                var guardUid = ac.Field3;

                Monster = monsterUid > 0 ? gMDB[monsterUid] : null;

                Key = keyUid > 0 ? gADB[keyUid] : null;

                Guard = guardUid > 0 ? gMDB[guardUid] : null;

                Debug.Assert(Monster != null);

                PlayerProcessEvents(PpeBeforeGuardMonsterCheck);

                if (GotoCleanup)
                {
                    goto Cleanup;
                }

                if (Guard != null && Guard.IsInRoom(gActorRoom))
                {
                    gOut.Print("{0} won't let you!", Guard.GetTheName(true));

                    goto Cleanup;
                }

                if (keyUid == -1)
                {
                    gOut.Print("There's no obvious way to do that.");

                    goto Cleanup;
                }

                if (Key != null && !Key.IsCarriedByCharacter() && !Key.IsWornByCharacter() && !Key.IsInRoom(gActorRoom))
                {
                    gOut.Print("You don't have the key.");

                    goto Cleanup;
                }

                PrintMonsterFreed();

                Monster.SetInRoom(gActorRoom);

                gDobjArtifact.SetInLimbo();
            }
            else
            {
                PrintCantVerbObj(gDobjArtifact);

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }
Exemple #3
0
        public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact)
        {
            Debug.Assert(artifact != null);

            return(gCommandParser.ObjData == gCommandParser.IobjData || artifact.IsWornByCharacter());
        }
Exemple #4
0
        public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact)
        {
            Debug.Assert(artifact != null);

            return(artifact.IsWornByCharacter());
        }
Exemple #5
0
        public override bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact)
        {
            Debug.Assert(artifact != null);

            return(artifact.Wearable != null?artifact.IsCarriedByCharacter() || artifact.IsWornByCharacter() : true);
        }
Exemple #6
0
        public virtual bool ShouldShowUnseenArtifacts(IRoom room, IArtifact artifact)
        {
            if (Command is IGiveCommand)
            {
                Debug.Assert(artifact != null);

                return(artifact.IsCarriedByCharacter());
            }
            else if (Command is IRequestCommand)
            {
                return(false);
            }
            else if (Command is IDropCommand)
            {
                Debug.Assert(artifact != null);

                return(artifact.IsWornByCharacter());
            }
            else if (Command is IExamineCommand)
            {
                Debug.Assert(artifact != null);

                return(Enum.IsDefined(typeof(ContainerType), Command.ContainerType) && !artifact.IsWornByCharacter());
            }
            else if (Command is IGetCommand)
            {
                return(false);
            }
            else if (Command is ILightCommand)
            {
                Debug.Assert(room != null);

                Debug.Assert(artifact != null);

                return(room.IsLit() && (artifact.LightSource != null ? artifact.IsCarriedByCharacter() : true));
            }
            else if (Command is IPutCommand)
            {
                Debug.Assert(artifact != null);

                return(artifact.IsCarriedByCharacter());
            }
            else if (Command is IReadyCommand readyCommand)
            {
                Debug.Assert(artifact != null);

                var ac = artifact.GetArtifactCategory(readyCommand.ArtTypes, false);

                if (ac != null)
                {
                    if (ac.Type == ArtifactType.Wearable)
                    {
                        return(artifact.IsCarriedByCharacter());
                    }
                    else
                    {
                        return(!artifact.IsReadyableByCharacter() || artifact.IsCarriedByCharacter());
                    }
                }
                else
                {
                    return(true);
                }
            }
            else if (Command is IRemoveCommand)
            {
                Debug.Assert(artifact != null);

                return(Command.CommandParser.ObjData == Command.CommandParser.IobjData || artifact.IsWornByCharacter());
            }
            else if (Command is IUseCommand useCommand)
            {
                Debug.Assert(artifact != null);

                var ac = artifact.GetArtifactCategory(useCommand.ArtTypes, false);

                if (ac != null)
                {
                    if (ac.IsWeapon01())
                    {
                        return(!artifact.IsReadyableByCharacter() || artifact.IsCarriedByCharacter());
                    }
                    else if (ac.Type == ArtifactType.Wearable)
                    {
                        return(artifact.IsCarriedByCharacter());
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            }
            else if (Command is IWearCommand)
            {
                Debug.Assert(artifact != null);

                return(artifact.Wearable != null?artifact.IsCarriedByCharacter() || artifact.IsWornByCharacter() : true);
            }
            else
            {
                return(true);
            }
        }