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

            var ac = artifact.GetArtifactCategory(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);
            }
        }
Example #2
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);
            }
        }