Esempio n. 1
0
        public static List <string> GetAllSkinToneVariants(string baseEmoji)
        {
            List <string> outStrings = new List <string>();

            foreach (string skinTone in Emoji.GetSkinTones())
            {
                outStrings.Add(baseEmoji + skinTone);
            }

            return(outStrings);
        }
Esempio n. 2
0
        string HandleThrowCommand(Command throwCommand, Game game)
        {
            string objectString    = throwCommand.GetParameter("object");
            string directionString = throwCommand.GetParameter("direction");

            Objects.ID objectTypeToThrow = Emoji.GetID(objectString);

            if (objectTypeToThrow == Objects.ID.Unknown)
            {
                return("You don't have that");
            }

            if (!game.mInventory.Contains(objectTypeToThrow))
            {
                return("You don't have " + objectString);
            }

            Direction direction = Room.GetDirection(directionString);

            if (direction == Direction.Unknown)
            {
                return("Invalid direction");
            }

            Point throwVector = MathUtils.GetVector(direction);

            Point?furthestLandingPoint = null;

            for (int distanceThrown = 1; distanceThrown <= 3; distanceThrown++)
            {
                Point testPoint = mPosition + throwVector * distanceThrown;

                if (game.mRoom.CanSpaceBeMovedTo(testPoint))
                {
                    furthestLandingPoint = testPoint;
                }

                if (!game.mRoom.CanSpaceBeThrownThrough(testPoint))
                {
                    break;
                }
            }

            if (furthestLandingPoint == null)
            {
                return("No space to throw to the " + direction);
            }

            game.mInventory.RemoveItem(objectTypeToThrow);
            game.mRoom.SpawnObject(objectTypeToThrow, furthestLandingPoint.Value);

            return("You threw " + objectString);
        }
Esempio n. 3
0
        string HandleEatCommand(Command eatCommand, Game game)
        {
            string objectString = eatCommand.GetParameter("object");

            Objects.ID objectType = Emoji.GetID(objectString);

            if (objectType == Objects.ID.Unknown)
            {
                mStatus = Status.Frustrated;
                return("You don't have that");
            }

            if (!game.mInventory.Contains(objectType))
            {
                mStatus = Status.Frustrated;
                return("You don't have " + objectString + " in your inventory.");
            }

            game.mInventory.RemoveItem(objectType);

            if (ObjectTraits.GetObjectTraits(objectType).mIsEdible)
            {
                if (ObjectTraits.GetObjectTraits(objectType).mCausesHallucinations)
                {
                    mStatus = Status.Tripping;
                    game.mRoom.mIsRenderingHallucination = true;
                    return(Emoji.Symbols.Dizzy + " Whoa " + Emoji.Symbols.Dizzy);
                }
                else if (ObjectTraits.GetObjectTraits(objectType).mIsHealthyToEat)
                {
                    mStatus = Status.SavoringFood;
                    return("That was delicious! You feel a renewed sense of determination.");
                }
                else
                {
                    Point?spaceToDropObject = game.mRoom.FindOpenSpaceAdjacentTo(mPosition);

                    if (spaceToDropObject != null)
                    {
                        game.mRoom.SpawnObject(objectType, spaceToDropObject.Value);
                    }

                    mStatus = Status.Vomiting;
                    return("Oh, that was a terrible idea.");
                }
            }
            else
            {
                mStatus = Status.Frustrated;
                return("You can't eat that!");
            }
        }
Esempio n. 4
0
        public static ICollection <string> GetAllGenderAndSkinToneVariants(string baseEmoji)
        {
            // Append all variants of skin tone and gender characters

            List <string> outStrings = new List <string>();

            foreach (string skinTone in Emoji.GetSkinTones())
            {
                foreach (string genderSuffix in Emoji.GetGenderSuffixes())
                {
                    outStrings.Add(baseEmoji + skinTone + genderSuffix);
                }
            }

            return(outStrings);
        }
Esempio n. 5
0
 private string RenderObject(GridObject gridObject)
 {
     if (mIsRenderingHallucination)
     {
         if (gridObject.GetTypeID() == Objects.ID.PlayerCharacter)
         {
             return(gridObject.Render());
         }
         else
         {
             return(Emoji.GetRandomHallucinationEmoji());
         }
     }
     else
     {
         return(gridObject.Render());
     }
 }
Esempio n. 6
0
        public void Stream(SaveStream stream)
        {
            if (stream.IsWriting())
            {
                Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));
                stream.Stream(ref mInitialRoomIndex);
            }
            else
            {
                InitialRooms.ID roomIndex = InitialRooms.ID.Unknown;
                stream.Stream(ref roomIndex);
                SetInitialRoomIndex(roomIndex);
                LoadStaticGridFromInitialRoom();
            }

            int dynamicObjectCount = mDynamicObjects.Count;

            stream.Stream(ref dynamicObjectCount, SaveUtils.GetNumBitsToStoreValue(maxNumDynamicObjects));

            if (stream.IsWriting())
            {
                foreach (DynamicObject dynamicObject in mDynamicObjects)
                {
                    dynamicObject.Stream(stream);
                }
            }
            else
            {
                mDynamicObjects.Clear();

                for (int dynamicObjectIndex = 0; dynamicObjectIndex < dynamicObjectCount; dynamicObjectIndex++)
                {
                    DynamicObject dynamicObject = (DynamicObject)Emoji.CreateObject(stream as ReadStream);

                    dynamicObject.Stream(stream);
                    mDynamicObjects.Add(dynamicObject);
                }
            }
        }
Esempio n. 7
0
        public Room(string description, ICollection <string> roomLines, IEnumerable <GridObjectSetup> gridObjectSetups)
        {
            mDescription = description;

            Debug.Assert(roomLines.Count == Game.numRoomRows);

            int lineIndex = 0;

            foreach (string line in roomLines)
            {
                List <string> splitLine = StringUtils.SplitEmojiString(line);

                Debug.Assert(splitLine.Count == Game.numRoomColumns);

                for (int columnIndex = 0; columnIndex < splitLine.Count; columnIndex++)
                {
                    GridObject staticObject = GridObject.Create(Emoji.GetID(splitLine[columnIndex]), new Point(lineIndex, columnIndex));
                    mStaticRoomGrid[lineIndex, columnIndex] = (StaticObject)staticObject;
                }

                lineIndex++;
            }

            foreach (GridObjectSetup setup in gridObjectSetups)
            {
                GridObject gridObject = setup.CreateObject();

                if (gridObject as DynamicObject != null)
                {
                    mDynamicObjects.Add((DynamicObject)gridObject);
                }
                else
                {
                    Point position = gridObject.GetPosition();
                    mStaticRoomGrid[position.mRow, position.mColumn] = (StaticObject)gridObject;
                }
            }
        }
Esempio n. 8
0
        private string HandleDropCommand(Command dropCommand, Game game)
        {
            string objectString    = dropCommand.GetParameter("object");
            string directionString = dropCommand.GetParameter("direction");

            Objects.ID objectTypeToDrop = Emoji.GetID(objectString);

            if (objectTypeToDrop == Objects.ID.Unknown)
            {
                return("You don't have that");
            }

            if (!game.mInventory.Contains(objectTypeToDrop))
            {
                return("You don't have " + objectString);
            }

            Direction direction = Room.GetDirection(directionString);

            if (direction == Direction.Unknown)
            {
                return("Invalid direction");
            }

            Point prospectiveDropPosition = MathUtils.GetAdjacentPoint(mPosition, direction);

            if (!game.mRoom.CanSpaceBeMovedTo(prospectiveDropPosition))
            {
                return("Space to the " + direction + " isn't open");
            }

            game.mInventory.RemoveItem(objectTypeToDrop);
            game.mRoom.SpawnObject(objectTypeToDrop, prospectiveDropPosition);

            return("You dropped " + objectString);
        }
Esempio n. 9
0
 public override string Render()
 {
     return(mNPCIdentity.GetEmojiVariant(Emoji.GetEmoji(GetTypeID())));
 }
Esempio n. 10
0
        string HandleUseOnTargetCommand(Command useCommand, Game game)
        {
            string actorString  = useCommand.GetParameter("actor");
            string targetString = useCommand.GetParameter("target");

            Objects.ID actorType = Emoji.GetID(actorString);

            if (actorType == Objects.ID.Unknown)
            {
                mStatus = Status.Frustrated;
                return("You don't have that in your inventory.");
            }

            if (!game.mInventory.Contains(actorType))
            {
                mStatus = Status.Frustrated;
                return("You don't have " + actorString);
            }

            Objects.ID targetType = Emoji.GetID(targetString);

            if (targetType == Objects.ID.Unknown)
            {
                mStatus = Status.Frustrated;
                return("You can't find that");
            }

            GridObject targetObject = game.mRoom.FindObjectAdjacentTo(mPosition, targetType);

            if (targetObject == null)
            {
                mStatus = Status.Frustrated;
                return("There isn't " + targetString + " nearby");
            }

            string outText = "";

            if (targetType == Objects.ID.Lock)
            {
                Lock lockObject = targetObject as Lock;
                if (lockObject.CanBeUnlockedBy(actorType))
                {
                    lockObject.Unlock();
                    outText = "You unlocked the door with the " + actorString;
                }
            }
            else if (targetType == Objects.ID.Clamp)
            {
                Objects.ID crushingResult = ObjectTraits.GetObjectTraits(actorType).mCrushingResultType;
                if (crushingResult != Objects.ID.Unknown)
                {
                    game.mInventory.RemoveItem(actorType);
                    game.mInventory.AddItem(crushingResult);
                    outText = "You crushed the " + actorString;
                }
            }

            if (outText == "")
            {
                outText = "You don't think you can do that.";
                mStatus = Status.Frustrated;
            }

            return(outText);
        }
Esempio n. 11
0
        public string Render()
        {
            string outText = Emoji.GetEmoji(mType, 0);

            return(outText);
        }
Esempio n. 12
0
 public static int GetNumGenderVariations()
 {
     return(Emoji.GetGenderSuffixes().Length);
 }
Esempio n. 13
0
 public static int GetNumSkinToneVariations()
 {
     return(Emoji.GetSkinTones().Length);
 }