コード例 #1
0
ファイル: RomanceGiftBoon.cs プロジェクト: acegiak/qudkissing
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            node.Text = "I hope you don't mind, but I got you a gift. It's " + Reward().a + Reward().DisplayNameOnly + ".";

            node.AddChoice("acceptgift", "Thankyou! [Accept " + Reward().the + Reward().DisplayNameOnly + "].", "You're very welcome.", -30, delegate(){ Reward().ForceUnequipAndRemove(); XRLCore.Core.Game.Player.Body.GetPart <Inventory>().AddObject(Reward()); Popup.ShowBlock("You receive " + Reward().a + Reward().DisplayNameOnly + "!"); this.reward = null; });
            node.AddChoice("rejectgift", "I couldn't possibly accept such a gift.", "Oh I'm sorry. That makes sense.", -30);
            return(node);
        }
コード例 #2
0
        public string GetStory(acegiak_RomanceChatNode node)
        {
            string story = preferences[Stat.Rnd2.Next(0, preferences.Count - 1)]
                           .GetStory(node, GetSelfEntity());

            story = ConsoleLib.Console.ColorUtility.StripFormatting(story);
            if (story.Count() > 0)
            {
                return(story);
            }
            return("&RI was going to tell you a story, but I forgot it.&y");
        }
コード例 #3
0
ファイル: RomanceMealBoon.cs プロジェクト: acegiak/qudkissing
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            node.Text = "Are you hungry? I'd like to make you " + Reward().GetDisplayName() + ".";

            node.AddChoice("End", "Thankyou! [Eat " + Reward().GetDisplayName() + "].", "You're very welcome.", -30, delegate(){
                IPart.PlayUISound("Human_Eating");
                Reward().ApplyEffectsTo(XRLCore.Core.Game.Player.Body);
                Popup.ShowBlock("You eat " + this.Romancable.ParentObject.the + this.Romancable.ParentObject.DisplayNameOnly + "'s " + Reward().GetDisplayName() + "!");
                this.reward = null;
            });
            node.AddChoice("rejectgift", "No thankyou.", "Oh I'm sorry. That makes sense.", -30);
            return(node);
        }
コード例 #4
0
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            node.Text = "I have a suggestion: I would like to join you and follow you on your adventures.";

            node.AddChoice("End", "Very well. [Accept " + this.Romancable.ParentObject.the + this.Romancable.ParentObject.DisplayNameOnly + " into your party].", "Excellent! We will have many adventures together!", -30, delegate(){
                this.Romancable.ParentObject.GetPart <Brain>().BecomeCompanionOf(XRLCore.Core.Game.Player.Body);
                this.Romancable.ParentObject.GetPart <Brain>().IsLedBy(XRLCore.Core.Game.Player.Body);
                this.Romancable.ParentObject.GetPart <Brain>().Goals.Clear();
                Popup.Show(this.Romancable.ParentObject.The + this.Romancable.ParentObject.DisplayNameOnly + " joins your party!");
            });
            node.AddChoice("rejectgift", "I'm sorry but you cannot join me.", "Oh I'm sorry. That makes sense.", -30);
            return(node);
        }
コード例 #5
0
ファイル: RomancablePart.cs プロジェクト: acegiak/qudkissing
 public acegiak_RomanceChatNode NameCheck(acegiak_RomanceChatNode node)
 {
     if (!ParentObject.HasProperName &&
         namegenerated == null &&
         ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) > 7)
     {
         namegenerated = HeroMaker.MakeHeroName(ParentObject, new string[0], new string[0], bIncludeTitle: false);
         ParentObject.SetIntProperty("ProperNoun", 1);
         ParentObject.SetIntProperty("Renamed", 1);
         node.Text = "[" + ParentObject.The + ParentObject.pRender.DisplayName + " tells you " + ParentObject.its + " name: " + namegenerated + "]\n\n" + node.Text;
         ParentObject.pRender.DisplayName = namegenerated + ", " + ParentObject.pRender.DisplayName;
         JournalAPI.AddAccomplishment("&y" + ParentObject.pRender.DisplayName + " shared " + ParentObject.its + " name with you.", "general", null);
     }
     return(node);
 }
コード例 #6
0
        public override string GetStory(acegiak_RomanceChatNode node, HistoricEntitySnapshot entity)
        {
            var    vars     = new Dictionary <string, string>();
            string storyTag = ((amount > 0) ?
                               "<spice.eros.opinion.food.like.story.!random>" :
                               "<spice.eros.opinion.food.dislike.story.!random>");

            while (this.tales.Count < 5)
            {
                SetSampleObject(vars, exampleObject());
                this.tales.Add(//"  &K"+storyTag.Substring(1,storyTag.Count()-2)+"&y\n"+
                    acegiak_RomanceText.ExpandString(
                        storyTag, entity, vars));
            }
            return(tales[Stat.Rnd2.Next(tales.Count)]);
        }
コード例 #7
0
        public void HandleBeginConversation(Conversation conversation, GameObject speaker)
        {
            if (conversation.NodesByID != null &&
                conversation.NodesByID.Count > 0 &&
                speaker != null &&
                speaker.GetPart <acegiak_Romancable>() != null)
            {
                conversation.NodesByID.ToList().Where(pair => pair.Key.StartsWith("acegiak_romance_")).ToList().ForEach(pair => conversation.NodesByID.Remove(pair.Key));


                string StartID = conversation.NodesByID.Keys.ToArray()[0];
                if (conversation.NodesByID.ContainsKey("Start"))
                {
                    StartID = "Start";
                }
                speaker.GetPart <acegiak_Romancable>().havePreference();

                acegiak_RomanceChatNode aboutme = new acegiak_RomanceChatNode();
                aboutme.ID   = "acegiak_romance_aboutme";
                aboutme.Text = "Very well.";
                aboutme.ParentConversation = conversation;


                ConversationChoice returntostart = new ConversationChoice();
                returntostart.Text       = "Ok.";
                returntostart.GotoID     = "End";
                returntostart.ParentNode = aboutme;

                aboutme.Choices.Add(returntostart);

                ConversationChoice romanticEnquiry = new ConversationChoice();
                romanticEnquiry.ParentNode = conversation.NodesByID[StartID];
                romanticEnquiry.ID         = "acegiak_romance_askaboutme";
                romanticEnquiry.Text       = "Let's chat.";
                romanticEnquiry.GotoID     = "acegiak_romance_aboutme";
                romanticEnquiry.Ordinal    = 800;


                conversation.AddNode(aboutme);
                foreach (ConversationNode node in conversation.StartNodes)
                {
                    node.Choices.RemoveAll(choice => choice.ID.StartsWith("acegiak_romance_"));
                    node.Choices.Add(romanticEnquiry);
                }
            }
        }
コード例 #8
0
            public void MakeChoiceFromCode(acegiak_RomanceChatNode node, string code)
            {
                string[] subparts = code.Split(',');
                if (subparts.Count() != 3)
                {
                    acegiak_RomanceText.Log("ERROR: Q&A choice needs 3 param: `" + code);
                    return;
                }

                int result_value = 0;

                if (!int.TryParse(subparts[2], out result_value))
                {
                    acegiak_RomanceText.Log("ERROR: Q&A param 3 is not integer: `" + code);
                }

                MakeChoice(node, subparts[0], subparts[1], result_value);
            }
コード例 #9
0
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            string bodytext = "whoah";

            float g = (float)Stat.Rnd2.NextDouble();

            var vars = new Dictionary <string, string>();

            if (g < 0.5)
            {
                vars["*sacredThing*"] = randomGood();
                return(Build_QA_Node(node, "patriot.qa.sacredThing", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*bodytext = "<What do you think of|How do you feel about|What is your opinion of> "+randomGood()+"?";
                 * node.AddChoice("likethem","I approve.",amount>0?"They are lovely, aren't they?":"Oh, You must keep awful company.",amount>0?1:-1);
                 * node.AddChoice("dislikethem","It is terrible.",amount>0?"That's very judgemental":"Aren't they horrible?",amount>0?-1:1);*/
            }
            else
            if (g < 1)
            {
                vars["*profaneThing*"] = randomBad();
                return(Build_QA_Node(node, "patriot.qa.profaneThing", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*bodytext = "<What do you think of|How do you feel about|What is your opinion of> "+randomBad()+"?";
                 * node.AddChoice("likethem","I approve.",amount>0?"Such blasphemy!":"They aren't so bad, are they?.",amount>0?1:-1);
                 * node.AddChoice("dislikethem","It is terrible.",amount>0?"Isn't it horrid?":"Then you are a fool.",amount>0?-1:1);*/
            }

            if (Romancable != null)
            {
                node.Text = node.Text + "\n\n" + Romancable.GetStory(node);
            }
            node.Text = node.Text + "\n\n" + bodytext;

            return(node);
        }
コード例 #10
0
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            string bodytext = "whoah";

            float g      = (float)Stat.Rnd2.NextDouble();
            bool  haskey = false;

            foreach (var item in verbs)
            {
                if (item.Key == wantedType)
                {
                    haskey = true;
                    break;
                }
            }

            var vars = new Dictionary <string, string>();

            vars["*type*"] = wantedType;

            if (g < 0.2 && haskey)
            {
                SetSampleObject(vars, exampleObject());
                return(Build_QA_Node(node, "weapon.qa.postal", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*bodytext = "Do you ever <think about|fantasize about|ponder|dream about> just "+verbs[wantedType]+" people?";
                 * node.AddChoice("yeahcleave","Oh yes, quite often.",amount>0?"Oh good. I thought I was the only one.":"Really? That is troubling.",amount>0?1:-1);
                 * node.AddChoice("nahcleave","No, that sounds bad.",amount>0?"Oh, I guess it is. Sorry.":"It does, doesn't it? How scary!",amount>0?-1:1);*/
            }
            else if (g < 0.4 && haskey)
            {
                bodytext = "How do you like to <slay|attack|fight|combat> your enemies?";
                foreach (var item in verbs)
                {
                    if ((item.Key == wantedType || Stat.Rnd2.NextDouble() < 0.5))
                    {
                        GameObject GO = EncountersAPI.GetAnObject((GameObjectBlueprint b) => b.GetPartParameter("MeleeWeapon", "Skill") == item.Key || b.GetPartParameter("MissileWeapon", "Skill") == item.Key);
                        if (item.Key == wantedType || (GO != null && Romancable.assessGift(GO, XRLCore.Core.Game.Player.Body).amount > 0))
                        {
                            node.AddChoice(item.Key, "&cI <like|prefer> " + item.Value + " them with a " + presentable[item.Key] + ".", amount > 0?"Me too!":"That's quite violent, isn't it?", amount > 0?1:-1);
                        }
                        else
                        {
                            node.AddChoice(item.Key, "&cI <like|prefer> " + item.Value + " them with a " + presentable[item.Key] + ".", amount > 0?"That sounds unpleasant.":"That's quite violent, isn't it?", amount > 0?1:-1);
                        }
                    }
                }
                node.AddChoice("notmelee", "&rI prefer to avoid combat entirely.", amount > 0?"That sounds cowardly.":"That sounds very wise.", amount > 0?-1:1);
            }
            else if (g < 0.60 && haskey)
            {
                SetSampleObject(vars, exampleObject());
                return(Build_QA_Node(node, "armor.qa.seen", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*string sample = exampleObjectName();
                 * bodytext = "Have you ever seen "+sample+"?";
                 * node.AddChoice("yesseen","Oh yes, I have seen "+sample+". It was great.",amount>0?"Wow, how excellent!":"Oh, I don't think I would agree.",amount>0?1:-1);
                 * node.AddChoice("yesseendislike","I have but I didn't like it.",amount>0?"Oh, I guess we have different tastes.":"I agree, I saw one once and didn't like it.",amount>0?-1:1);
                 * node.AddChoice("notseen","No, I've not seen such a thing.",amount>0?"Oh, that's disappointing.":"That's probably for the best.",amount>0?-1:1);*/
            }
            else if (g < 0.80)
            {
                return(Build_QA_Node(node, "weapon.qa.factoid", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*if(wantedType == "Cudgel"){
                 *  bodytext = "Did you know that heavy weapons like maces and clubs can sometimes stun people when they hit?";}
                 * if(wantedType == "ShortBlades"){
                 *  bodytext = "Are you familiar with short blades like daggers and knives? I hear that they make wounds that bleed profusely";}
                 * if(wantedType == "LongBlades"){
                 *  bodytext = "I hear long blades are very versatile. Talented swordsmen can use them for defence as well offence.";}
                 * if(wantedType == "Axe"){
                 *  bodytext = "Axes are very dangerous. No only can they crack armour but they can also cleave off whole limbs!";}
                 * if(wantedType == "Whip"){
                 *  bodytext = "I hear whips are usually used to keep dogs in line?";}
                 * if(wantedType == "Chain"){
                 *  bodytext = "I hear some people just beat their enemies with chains?";}
                 * if(wantedType == "HeavyWeapons"){
                 *  bodytext = "I heard heavy ranged weapons often fire explosives!";}
                 * if(wantedType == "Rifle"){
                 *  bodytext = "I hear bows and rifles are very good for shooting folks at long range.";}
                 * if(wantedType == "Pistol"){
                 *  bodytext = "Did you know some folks weild a pistol in each hand?";}
                 * node.AddChoice("approve","I have seen as much. It is <glorious|wonderful|fantastic>.",amount>0?"So fascinating!":"Oh, how scary.",amount>0?1:-1);
                 * node.AddChoice("disprove","That is, unfortunately, true.",amount>0?"Oh? I think it sounds very impressive.":"Yes it seems quite dangerous.",amount>0?-1:1);
                 * node.AddChoice("disagree","I'm not sure that is true.","Oh, isn't it? How odd.",-1);*/
            }
            else
            {
                return(Build_QA_Node(node, "weapon.qa.show_me", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*bodytext = "Do you have any interesting weapons?";
                 * List<GameObject> part2 = XRLCore.Core.Game.Player.Body.GetPart<Inventory>().GetObjects();
                 *
                 * List<BodyPart> equippedParts = XRLCore.Core.Game.Player.Body.GetPart<Body>().GetEquippedParts();
                 * foreach (BodyPart item in equippedParts)
                 * {
                 *  if(item.Equipped != null){
                 *      part2.Add(item.Equipped);
                 *  }
                 * }
                 *
                 * int c = 0;
                 * int s = 0;
                 * foreach(GameObject GO in part2)
                 * {
                 *  MeleeWeapon mw = GO.GetPart<MeleeWeapon>();
                 *  MissileWeapon rw = GO.GetPart<MissileWeapon>();
                 *  if((GO.GetBlueprint().InheritsFrom("BaseMissileWeapon") || GO.GetBlueprint().InheritsFrom("MeleeWeapon")) && (mw != null || rw != null) ){
                 *      if(Romancable.assessGift(GO,XRLCore.Core.Game.Player.Body).amount > 0){
                 *          node.AddChoice("weapon"+c.ToString(),"I have this "+GO.DisplayName+".",amount>0?"Wow, that's very interesting!":"Oh, is that all?",amount>0?2:-1);
                 *          s++;
                 *      }else{
                 *          node.AddChoice("weapon"+c.ToString(),"I have this "+GO.DisplayName+".",amount>0?"Oh, is that all?":"Hmm, that seems dangerous.",amount>0?0:-1);
                 *          s++;
                 *      }
                 *  }
                 *  // if(s>5){
                 *  //     break;
                 *  // }
                 *
                 * }
                 * node.AddChoice("noweapons","Not really, no.",amount>0?"That's a pity.":"That's sensible. Weapons are dangerous.",amount>0?-1:1);*/
            }

            if (Romancable != null)
            {
                node.Text = node.Text + "\n\n" + Romancable.GetStory(node);
            }
            node.Text = node.Text + "\n\n" + bodytext;

            return(node);
        }
コード例 #11
0
        public acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            havePreference();
            this.lockout = false;
            node.Choices.Clear();
            //IPart.AddPlayerMessage("They are:"+ParentObject.pBrain.GetOpinion(XRLCore.Core.Game.Player.Body)+": "+ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body).ToString()+" patience:"+patience.ToString());

            if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) < 1 && patience > 0)
            {
                ParentObject.pBrain.SetFeeling(XRLCore.Core.Game.Player.Body, 1);
            }

            if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) < 1 || patience <= 0)
            {
                List <string> Stories = new List <string>(new string[] {
                    "Sorry, I have other things to do.",
                    "Anyway, I'm very busy.",
                    "Maybe we could talk some more another time?"
                });
                node.Text = node.Text + "\n\n" + Stories[Stat.Rnd2.Next(0, Stories.Count - 1)];

                ConversationChoice returntostart = new ConversationChoice();
                returntostart.Ordinal    = 800;
                returntostart.Text       = "Ok.";
                returntostart.GotoID     = node.ParentConversation.StartNodes[0].ID;
                returntostart.ParentNode = node;
                node.Choices.Add(returntostart);
            }
            else if (boons.Where(b => b.BoonReady(XRLCore.Core.Game.Player.Body)).Count() > 0)
            {
                acegiak_RomanceBoon boon = boons.Where(b => b.BoonReady(XRLCore.Core.Game.Player.Body)).OrderBy(o => Stat.Rnd2.NextDouble()).FirstOrDefault();
                try
                {
                    node = boon.BuildNode(node);
                    node.InsertMyReaction(ParentObject, XRLCore.Core.Game.Player.Body);
                    node.ExpandText(GetSelfEntity());
                }
                catch (Exception e)
                {
                    node.Text = e.ToString() + "\n\n" + node.Text;
                }
            }
            else
            {
                int c             = 0;
                int whichquestion = 0;
                do
                {
                    whichquestion = Stat.Rnd2.Next(0, preferences.Count);
                    c++;
                }while(whichquestion == lastQuestion && c < 5);
                lastQuestion = whichquestion;
                try
                {
                    node = preferences[whichquestion].BuildNode(node);
                    node.InsertMyReaction(ParentObject, XRLCore.Core.Game.Player.Body);
                    node.ExpandText(GetSelfEntity());
                }
                catch (Exception e)
                {
                    node.Text = e.ToString() + "\n\n" + node.Text;
                }

                if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) > 5)
                {
                    acegiak_RomanceChatChoice giftoption = new acegiak_RomanceChatChoice();
                    giftoption.Ordinal    = 900;
                    giftoption.Text       = "[Offer A Gift]";
                    giftoption.action     = "*Gift";
                    giftoption.ParentNode = node;
                    giftoption.GotoID     = "End";
                    node.Choices.Add(giftoption);
                }
                if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) >= 25)
                {
                    acegiak_RomanceChatChoice kissoption = new acegiak_RomanceChatChoice();
                    kissoption.Ordinal    = 910;
                    kissoption.Text       = "[Propose a Date]";
                    kissoption.action     = "*Date";
                    kissoption.ParentNode = node;
                    kissoption.GotoID     = "End";
                    node.Choices.Add(kissoption);
                }
                if (ParentObject.GetPart <acegiak_Kissable>() != null && ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) >= 55)
                {
                    acegiak_RomanceChatChoice kissoption = new acegiak_RomanceChatChoice();
                    kissoption.Ordinal    = 910;
                    kissoption.Text       = "[Attempt to Kiss]";
                    kissoption.action     = "*Kiss";
                    kissoption.ParentNode = node;
                    kissoption.GotoID     = "End";
                    node.Choices.Add(kissoption);
                }
            }
            if (ParentObject.pBrain.GetFeeling(XRLCore.Core.Game.Player.Body) < 1)
            {
                ParentObject.pBrain.SetFeeling(XRLCore.Core.Game.Player.Body, 1);
            }



            patience--;


            ConversationChoice liveanddrink = new ConversationChoice();

            liveanddrink.Ordinal    = 99999;
            liveanddrink.Text       = "Live and drink.";
            liveanddrink.GotoID     = "End";
            liveanddrink.ParentNode = node;
            node.Choices.Add(liveanddrink);


            return(node);
        }
コード例 #12
0
 public abstract string GetStory(acegiak_RomanceChatNode node, HistoricEntitySnapshot entity);
コード例 #13
0
 public abstract acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node);
コード例 #14
0
        public acegiak_RomanceChatNode Build_QA_Node(
            acegiak_RomanceChatNode node,
            string qa_path,
            string gen_type,
            Dictionary <string, string> vars,
            HistoricEntitySnapshot entity = null)
        {
            var qa_text = new QA_Node_Helper(qa_path, entity, vars);

            string code = qa_text.Get(gen_type);

            acegiak_RomanceText.Log("Q&A Script: " + code);

            string[] parts = code.Split('|');
            if (parts.Count() < 1)
            {
                acegiak_RomanceText.Log("ERROR: Q&A blank: " + code);
            }

            string bodytext;

            if (parts[0] == "Q")
            {
                if (parts.Count() < 3)
                {
                    acegiak_RomanceText.Log("ERROR: Q&A too few params in quiz: " + code);
                }

                // Generated question.
                bodytext = qa_text.Get(parts[1]);

                for (int i = 2; i < parts.Count(); ++i)
                {
                    qa_text.MakeChoiceFromCode(node, parts[i]);
                }
            }
            else if (parts[0] == "S")
            {
                if (parts.Count() != 5)
                {
                    acegiak_RomanceText.Log("ERROR: Q&A need 5 params in show-and-tell: " + code);
                }

                // 1: Generated question.
                bodytext = qa_text.Get(parts[1]);

                // 2: Item types to include and exclude
                var item_filter = new acegiak_ItemFilter(parts[2]);

                // 3: Paths for show prompt and reactions
                string   choice_show;
                string[] react_text  = new string[3];
                int[]    react_value = new int   [3];
                {
                    string[] subparts = parts[3].Split(',');

                    if (subparts.Count() != 7)
                    {
                        acegiak_RomanceText.Log("ERROR: Q&A need 7 params in show section: " + parts[3]);
                    }

                    choice_show = subparts[0];

                    for (int i = 0; i < 3; ++i)
                    {
                        react_text [i] = qa_text.Get(choice_show + "." + subparts[1 + 2 * i]);
                        react_value[i] = 0;
                        if (!int.TryParse(subparts[2 + 2 * i], out react_value[i]))
                        {
                            acegiak_RomanceText.Log("ERROR: Q&A non-integer choice value: " + code);
                        }
                    }
                }

                // 3b: Generate list of showable items.
                List <GameObject> showables = XRLCore.Core.Game.Player.Body.GetPart <Inventory>().GetObjects();
                foreach (BodyPart item in XRLCore.Core.Game.Player.Body.GetPart <Body>().GetEquippedParts())
                {
                    if (item.Equipped != null)
                    {
                        showables.Add(item.Equipped);
                    }
                }

                // Filter and sort the items into buckets assessed quality.
                var itemsGood = new List <GameObject>();
                var itemsNeut = new List <GameObject>();
                var itemsBad  = new List <GameObject>();
                foreach (GameObject item in showables)
                {
                    if (!item_filter.Passes(item))
                    {
                        continue;
                    }

                    var amount = Romancable.assessGift(item, XRLCore.Core.Game.Player.Body).amount;
                    int kind   = 1;
                    if (amount > 0f)
                    {
                        itemsGood.Add(item);
                    }
                    else if (amount < 0f)
                    {
                        itemsBad.Add(item);
                    }
                    else
                    {
                        itemsNeut.Add(item);
                    }
                }

                // Make a set of up to 5 random choices (with value noted)
                //   Include at least one good and one bad option if possible.
                var options = new Dictionary <GameObject, int>();
                if (itemsGood.Count() != 0)
                {
                    int index = (Stat.Rnd2.Next() % itemsGood.Count());
                    options.Add(itemsGood.RemoveRandomElement(Stat.Rnd2), 0);
                    itemsGood.RemoveAt(index);
                }
                if (itemsBad.Count() != 0)
                {
                    int index = (Stat.Rnd2.Next() % itemsBad.Count());
                    options.Add(itemsBad.RemoveRandomElement(Stat.Rnd2), 2);
                    itemsBad.RemoveAt(index);
                }
                while (options.Count() < 5)
                {
                    int
                        good   = itemsGood.Count(),
                        notbad = itemsNeut.Count() + good,
                        total  = itemsBad.Count() + notbad;
                    if (total == 0)
                    {
                        break;
                    }

                    int index = (Stat.Rnd2.Next() % total);
                    if (index < good)
                    {
                        options.Add(itemsGood[index], 0);        itemsGood.RemoveAt(index);
                    }
                    else if (index < notbad)
                    {
                        options.Add(itemsNeut[index - good], 1);   itemsNeut.RemoveAt(index - good);
                    }
                    else
                    {
                        options.Add(itemsBad [index - notbad], 2); itemsBad.RemoveAt(index - notbad);
                    }
                }

                // Now place choices in random order.
                int optionNumber = 1;
                while (options.Count() > 0)
                {
                    int index  = (Stat.Rnd2.Next() % options.Count());
                    var option = options.ElementAt(index);
                    options.Remove(option.Key);

                    SetSampleObject(vars, option.Key, "item", true, 'g', 'y');

                    node.AddChoice(choice_show + optionNumber.ToString(),
                                   qa_text.Get(choice_show + ".a"),
                                   react_text [option.Value],
                                   react_value[option.Value]);
                }

                // 4: Generate neutral response
                qa_text.MakeChoiceFromCode(node, parts[4]);
            }
            else
            {
                bodytext = "&RI have failed to think of an interesting question!&y";
                node.AddChoice("ok", "How unfortunate.", "A terrible shame indeed!", 0);
            }

            // Insert story
            if (Romancable != null)
            {
                node.Text = node.Text + "\n\n" + Romancable.GetStory(node);
            }
            node.Text = node.Text + "\n\n" + bodytext;

            return(node);
        }
コード例 #15
0
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            string bodytext = "whoah";

            float g = (float)Stat.Rnd2.NextDouble();

            var vars = new Dictionary <string, string>();

            vars["*type*"] = wantedType;

            if (g < 0.50)
            {
                SetSampleObject(vars, exampleObject());
                return(Build_QA_Node(node, "armor.qa.seen", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*string sample = exampleObjectName();
                 * bodytext = "Have you ever seen a "+sample+"?";
                 * node.AddChoice("yesseen","Oh yes, I have seen a "+sample+". It was great.",amount>0?"Wow, how excellent!":"Oh, I don't think I would agree.",amount>0?1:-1);
                 * node.AddChoice("yesseendislike","I have but I didn't like it.",amount>0?"Oh, I guess we have different tastes.":"I agree, I saw one once and didn't like it.",amount>0?-1:1);
                 * node.AddChoice("notseen","No, I've not seen such a thing.",amount>0?"Oh, that's disappointing.":"That's probably for the best.",amount>0?-1:1);*/
            }
            else
            {
                return(Build_QA_Node(node, "armor.qa.show_me", (amount > 0) ? "gen_good" : "gen_bad", vars));

                /*bodytext = "Do you have any interesting <clothing|armor|vestments>?";
                 * List<GameObject> part2 = XRLCore.Core.Game.Player.Body.GetPart<Inventory>().GetObjects();
                 *
                 * List<BodyPart> equippedParts = XRLCore.Core.Game.Player.Body.GetPart<Body>().GetEquippedParts();
                 * foreach (BodyPart item in equippedParts)
                 * {
                 *  if(item.Equipped != null){
                 *      part2.Add(item.Equipped);
                 *  }
                 * }
                 *
                 * int c = 0;
                 * int s = 0;
                 * foreach(GameObject GO in part2)
                 * {
                 *  Armor mw = GO.GetPart<Armor>();
                 *  if(GO.GetBlueprint().InheritsFrom("Armor") && mw != null  ){
                 *      if(Romancable.assessGift(GO,XRLCore.Core.Game.Player.Body).amount > 0){
                 *          node.AddChoice("armor"+c.ToString(),"I have this "+GO.ShortDisplayName+".",amount>0?"Wow, that's very interesting!":"Oh, is that all?",amount>0?2:-1);
                 *          s++;
                 *      }else{
                 *          node.AddChoice("armor"+c.ToString(),"I have this "+GO.ShortDisplayName+".",amount>0?"Oh, is that all?":"Oh, that's quite ugly.",amount>0?0:-1);
                 *          s++;
                 *      }
                 *  }
                 *  // if(s>5){
                 *  //     break;
                 *  // }
                 *
                 * }
                 * node.AddChoice("noweapons","Not really, no.",amount>0?"That's a pity.":"That's sensible. You probably don't need any.",amount>0?-1:1);*/
            }

            if (Romancable != null)
            {
                node.Text = node.Text + "\n\n" + Romancable.GetStory(node);
            }
            node.Text = node.Text + "\n\n" + bodytext;

            return(node);
        }
コード例 #16
0
        public override acegiak_RomanceChatNode BuildNode(acegiak_RomanceChatNode node)
        {
            string bodytext = "whoah";

            float g = (float)Stat.Rnd2.NextDouble();

            var vars = new Dictionary <string, string>();

            if (g < 0.3)
            {
                SetSampleObject(vars, exampleObject());
                return(Build_QA_Node(node, "food.qa.tasted", (amount > 0) ? "gen_good" : "gen_bad", vars));
            }
            else if (g < 0.6)
            {
                //SetSampleObject(vars, exampleObject());

                GameObject sample = exampleObject();
                SetSampleObject(vars, sample);
                string practice_name   = "default";
                string practice_result = null;

                if (sample != null)
                {
                    sample.MakeUnderstood();
                    if (sample.GetPart <PreparedCookingIngredient>() != null)
                    {
                        practice_name = "cooking";
                        string ingredient_type = "ProceduralCookingIngredient_" + sample.GetPart <PreparedCookingIngredient>().type;
                        practice_result = GameObjectFactory.Factory.CreateSampleObject(ingredient_type).GetTag("Description")
                                          + " effects";
                        //if (practice_result != null) practice_result = ingredient_type + ": " + practice_result.ToString();
                    }
                    else
                    if (sample.GetPart <PreservableItem>() != null)
                    {
                        practice_name   = "preserving";
                        practice_result = GameObjectFactory.Factory.CreateSampleObject(sample.GetPart <PreservableItem>().Result).DisplayNameOnlyDirect;
                    }
                    else
                    if (sample.GetPart <Food>() != null)
                    {
                        practice_name   = "eating";
                        practice_result = sample.GetPart <Food>().Satiation;
                    }
                }

                if (practice_result == null || practice_result.Count() == 0)
                {
                    practice_result = "sweet sustenance";
                }
                vars["*sampleResult*"] = practice_result;

                return(Build_QA_Node(node, "food.qa.practice_" + practice_name, (amount > 0) ? "gen_good" : "gen_bad", vars));
            }
            else
            {
                return(Build_QA_Node(node, "food.qa.show_me", (amount > 0) ? "gen_good" : "gen_bad", vars));
            }

            if (Romancable != null)
            {
                node.Text = node.Text + "\n\n" + Romancable.GetStory(node);
            }
            node.Text = node.Text + "\n\n" + bodytext;

            return(node);
        }