Example #1
0
        public static void MoveItem()
        {
            if (column == NPC_COLUMN)
            {
                var item = npcItems[row];
                npcItems.Remove(new Item(item.name, 1));
                playerItems.Add(new Item(item.name, 1));
            }
            else
            {
                var item = playerItems[row];
                playerItems.Remove(new Item(item.name, 1));
                npcItems.Add(new Item(item.name, 1));
            }

            if (npc.IsTradeAcceptable(npcItems))
            {
                tradeState      = TradeState.GOOD;
                currentNPCWords = RandUtil.Index(PRPGame.closestNPC.personality.goodTrade);
            }
            else
            {
                tradeState      = TradeState.BAD;
                currentNPCWords = RandUtil.Index(PRPGame.closestNPC.personality.badTrade);
            }
            CheckRow();
            CheckColumn();
        }
Example #2
0
        public CharSprites(Gender gender, ContentManager content)
        {
#if DEBUG
            PRPGame.npcSprited++;
#endif

            if (gender == Gender.Male)
            {
                baseSheet = RandUtil.Index(maleBodySheets);
                hairSheet = RandUtil.Index(maleHairSheets);
                eyeSheet  = RandUtil.Index(maleEyeSheets);
            }
            else
            {
                baseSheet = RandUtil.Index(femaleBodySheets);
                hairSheet = RandUtil.Index(femaleHairSheets);
                eyeSheet  = RandUtil.Index(femaleHairSheets);
            }


            // Compose a bunch of sprite sheets to make a uniqe npc as they
            // come on screen. The sheets contain all the animation frames.
            shirtSheet = RandUtil.Index(shirtSheets);
            pantSheet  = RandUtil.Index(pantsSheets);
            shoeSheet  = RandUtil.Index(shoeSheets);

            hairColor = new Color(new Vector3(RandUtil.Float(1.0f), RandUtil.Float(1.0f), RandUtil.Float(1.0f)));

            walkingAnimation = new Rectangle[4, WALKING_WIDTH];
            for (int y = 0; y < 4; y++)
            {
                for (int x = 0; x < WALKING_WIDTH; x++)
                {
                    int walkIndex = y + WALKING_INDEX;
                    walkingAnimation[y, x] = new Rectangle(x * CHAR_SIZE, walkIndex * CHAR_SIZE, CHAR_SIZE, CHAR_SIZE);
                }
            }


            swingAnimation = new Rectangle[4, SWING_WIDTH];
            for (int y = 0; y < 4; y++)
            {
                for (int x = 0; x < SWING_WIDTH; x++)
                {
                    int swingIndex = y + SWING_INDEX;
                    swingAnimation[y, x] = new Rectangle(x * CHAR_SIZE, swingIndex * CHAR_SIZE, CHAR_SIZE, CHAR_SIZE);
                }
            }

            oversizeWeaponAnimation = new Rectangle[4, SWING_WIDTH];
            for (int y = 0; y < 4; y++)
            {
                for (int x = 0; x < SWING_WIDTH; x++)
                {
                    int swingIndex = y;
                    oversizeWeaponAnimation[y, x] = new Rectangle(x * OVERSIZE_WEAPON_SIZE, swingIndex * OVERSIZE_WEAPON_SIZE, OVERSIZE_WEAPON_SIZE, OVERSIZE_WEAPON_SIZE);
                }
            }
        }
Example #3
0
        public string GetLikeResponse(Item item)
        {
            var response       = RandUtil.Index(like);
            var itemWord       = item.name.ToLower();
            var noun           = wordBank.QueryNoun(itemWord);
            var itemWordPlural = noun.Plural;
            var indefArticle   = noun.IndefiniteArticle;

            response = response.Replace("ITEMS", itemWordPlural);
            response = response.Replace("ITEM", itemWord);
            response = response.Replace("ARTICLE", indefArticle);
            response = response.Trim();
            return(response);
        }
Example #4
0
        public NPC(Vector2 pos, ContentManager content)
        {
            state             = new RestingState();
            this.pos          = pos;
            firstName         = RandUtil.Index(namePool);
            npcClass          = RandUtil.Index(classPool);
            lastAnimationTime = TimeSpan.FromMilliseconds(0);
            inventory         = new Inventory();

            facing = CharSprites.DOWN;

            if (RandUtil.Bool())
            {
                gender = Gender.Male;
            }
            else
            {
                gender = Gender.Female;
            }

            //Give them some things relevant to their class
            int numItems = RandUtil.Int(0, 5);

            for (int i = 0; i < numItems; i++)
            {
                inventory.Add(new Item(RandUtil.Index(npcClass.desires), 1));
            }



            desires = new HashSet <Desire>();
            var numDesires = RandUtil.Int(0, 4);

            for (int i = 0; i < numDesires; i++)
            {
                var    item       = RandUtil.Index(npcClass.desires);
                var    level      = RandUtil.Int(1, 10);
                var    sufficient = RandUtil.Int(1, 10);
                Desire d          = new Desire(new Item(item, 0), level, sufficient);
                desires.Add(d);
            }

            var lastNamePrefx  = RandUtil.Index(npcClass.lastNamePrefixes);
            var lastNameSuffix = RandUtil.Index(npcClass.lastNameSuffixes);

            lastName = lastNamePrefx + lastNameSuffix;

            personality = RandUtil.Index(personalityPool);
        }
Example #5
0
 public static GameCommand Selection()
 {
     if (selection == 0)
     {
         return(GameCommand.NONE);
     }
     else
     {
         if (PRPGame.closestNPC.desires.Count > 0)
         {
             var randomDesire = RandUtil.Index(PRPGame.closestNPC.desires.ToArray());
             currentResponse = PRPGame.closestNPC.personality.GetLikeResponse(randomDesire.item);
         }
         else
         {
             currentResponse = "There isn't much to say really...";
         }
         return(GameCommand.NONE);
     }
 }
Example #6
0
 public string GetIdleChat()
 {
     return(RandUtil.Index(idleChat));
 }