public double InteractWithMe_InsultACreatorArchetype_ScoreDifferentThanZero() { // ReSharper disable once InconsistentNaming var Rick = new Person("Rick", Gender.Male, Sex.Male, Orientation.Pansexual, Guid.NewGuid()); //ARRANGE var testCharacter = new global::RNPC.Core.Character(Rick, Archetype.TheCreator); Action insult = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Message = "You're an asshole, Rick!", Target = "Rick", EventName = "Insult", Source = "Morty" }; //ACT var reaction = testCharacter.InteractWithMe(insult); //ASSERT Assert.IsNotNull(reaction); Assert.AreEqual(reaction[0].InitialEvent, insult); Assert.AreEqual(reaction[0].Target, @"Morty"); //int nbOfStrongPoints = CalculateNbOfStrongPoints(testCharacter.MyTraits); return(reaction[0].ReactionScore); }
public void EvaluateNode_WithNoWealthAsPersonalValue_EvaluationCompleted() { //ARRANGE // ReSharper disable once InconsistentNaming var Jess = new Person("Jessica Day", Gender.Female, Sex.Female, Orientation.Straight, Guid.NewGuid()); var character = new global::RNPC.Core.Character(Jess, Archetype.TheCaregiver) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; if (character.MyTraits.DoIPossessThisPersonalValue(PersonalValues.Wealth)) { character.MyTraits.PersonalValues.Remove(PersonalValues.Wealth); } AmIAfraidOfAFinancialLoss nodeToTest = new AmIAfraidOfAFinancialLoss { RightNode = new DecisionNodeStub(), LeftNode = new DecisionNodeStub() }; Action threat = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Message = "I'll make sure you have to beg for the rest of your life!", Target = character.MyName, EventName = "Threat", Source = "The Enemy" }; //ACT var reaction = nodeToTest.Evaluate(character.MyTraits, character.MyMemory, threat); //ASSERT Assert.IsNotNull(reaction); Assert.AreEqual(threat, reaction[0].InitialEvent); }
public void InteractWithMe_QuestionWhatIsLove_RightTreeLoadedAndQuetion() { //ARRANGE // ReSharper disable once InconsistentNaming var JessicaDay = new Person("Jess", Gender.Female, Sex.Female, Orientation.Straight, Guid.NewGuid()); var character = new global::RNPC.Core.Character(JessicaDay, Archetype.TheCaregiver) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; Action question = GetQuestion("Jessica Day", "What is love?"); //ACT var reaction = character.InteractWithMe(question); //ASSERT Assert.IsNotNull(reaction); Assert.AreEqual(question, reaction[0].InitialEvent); }
public void BuildTreeFromDocument_HostileMocking_TreeIsProperlyBuilt() { //ARRANGE DecisionTreeBuilder builder = new DecisionTreeBuilder(); // ReSharper disable once InconsistentNaming var Morty = new Person("Morty", Gender.Male, Sex.Male, Orientation.Undefined, Guid.NewGuid()); var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; //Hostile Mockery Action mockery = new Action { Tone = Tone.Mocking, EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Message = "Did your mother dress you up this morning?", Target = character.MyName, EventName = "Mocking", Source = "The Bully" }; //ACT var rootNode = builder.BuildTreeFromDocument(new DecisionTreeFileController(), mockery, "Morty") as AbstractDecisionNode; //ASSERT //ASSERT Assert.IsNotNull(rootNode); //ajusted per event Assert.IsFalse(string.IsNullOrEmpty(rootNode.DefaultTreeReaction)); Assert.AreEqual(60, rootNode.ConfiguredPassFailValue); Assert.IsTrue(rootNode.LeftNode != null); Assert.IsTrue(rootNode.RightNode != null); }
public void BuildTreeFromDocument_NeutralSalute_TreeIsProperlyBuilt() { //ARRANGE DecisionTreeBuilder builder = new DecisionTreeBuilder(); // ReSharper disable once InconsistentNaming var Morty = new Person("Morty", Gender.Male, Sex.Male, Orientation.Undefined, Guid.NewGuid()); var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; //Neutral Salute Action salute = new Action { EventType = EventType.Interaction, ActionType = ActionType.NonVerbal, Intent = Intent.Neutral, Message = "", Target = character.MyName, EventName = "Salute", Source = "The Ambassador" }; //ACT var rootNode = builder.BuildTreeFromDocument(new DecisionTreeFileController(), salute, "Morty") as AbstractDecisionNode; //ASSERT //ASSERT Assert.IsNotNull(rootNode); //ajusted per event Assert.IsFalse(string.IsNullOrEmpty(rootNode.DefaultTreeReaction)); Assert.AreEqual(0, rootNode.ConfiguredPassFailValue); Assert.IsTrue(rootNode.LeftNode != null); Assert.IsTrue(rootNode.RightNode != null); }
/// <summary> /// Submits a character to the 12 tests used for the psychology game /// </summary> /// <param name="character"></param> /// <param name="compiledResults"></param> private static void PutCharacterThroughTheTwelveLabours(global::RNPC.Core.Character character, IReadOnlyList <List <double> > compiledResults) { //Friendly Greeting Action greeting = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Friendly, Message = "Hi!", Target = character.MyName, EventName = "Greeting", Source = "The Friend" }; var reaction1 = character.InteractWithMe(greeting); compiledResults[0].Add(reaction1[0].ReactionScore); Action threat = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Tone = Tone.Threatening, Message = "I'm going to kill you!", Target = character.MyName, EventName = "Threat", Source = "The Enemy" }; var reaction2 = character.InteractWithMe(threat); compiledResults[1].Add(reaction2[0].ReactionScore); //Neutral Greeting Action neutralGreeting = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Neutral, Message = "Hi", Target = character.MyName, EventName = "Greeting", Source = "The Ambassador" }; var reaction3 = character.InteractWithMe(neutralGreeting); compiledResults[2].Add(reaction3[0].ReactionScore); //Friendly How Are You? Action enquire = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Friendly, Message = "How are you?", Target = character.MyName, EventName = "HowAreYou", Source = "The Friend" }; var reaction4 = character.InteractWithMe(enquire); compiledResults[3].Add(reaction4[0].ReactionScore); //Hostile-Insult Action insult = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Message = "You're really dumb.", Target = character.MyName, EventName = "Insult", Source = "The Frenemy" }; var reaction5 = character.InteractWithMe(insult); compiledResults[4].Add(reaction5[0].ReactionScore); //Neutral How Are You? Action neutralEnquire = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Neutral, Message = "How are you?", Target = character.MyName, EventName = "HowAreYou", Source = "The Ambassador" }; var reaction6 = character.InteractWithMe(neutralEnquire); compiledResults[5].Add(reaction6[0].ReactionScore); //Friendly Teasing Action teasing = new Action { EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Friendly, Message = "Did you have a fight with your comb this morning?", Target = character.MyName, EventName = "Teasing", Source = "The Friend" }; var reaction7 = character.InteractWithMe(teasing); compiledResults[6].Add(reaction7[0].ReactionScore); //Hostile Mockery Action mockery = new Action { Tone = Tone.Mocking, EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Hostile, Message = "Did your mother dress you up this morning?", Target = character.MyName, EventName = "Mocking", Source = "The Bully" }; var reaction8 = character.InteractWithMe(mockery); compiledResults[7].Add(reaction8[0].ReactionScore); //Neutral Apology Action apology = new Action { Tone = Tone.Apologetic, EventType = EventType.Interaction, ActionType = ActionType.Verbal, Intent = Intent.Neutral, Message = "My apologies", Target = character.MyName, EventName = "Apology", Source = "The Ambassador" }; var reaction9 = character.InteractWithMe(apology); compiledResults[8].Add(reaction9[0].ReactionScore); //Friendly Smile Action smile = new Action { EventType = EventType.Interaction, ActionType = ActionType.NonVerbal, Intent = Intent.Friendly, Message = "", Target = character.MyName, EventName = "Smile", Source = "The Friend" }; var reaction10 = character.InteractWithMe(smile); compiledResults[9].Add(reaction10[0].ReactionScore); //Hostile Glare Action glare = new Action { EventType = EventType.Interaction, ActionType = ActionType.NonVerbal, Intent = Intent.Hostile, Message = "", Target = character.MyName, EventName = "Glare", Source = "The Bully" }; var reaction11 = character.InteractWithMe(glare); compiledResults[10].Add(reaction11[0].ReactionScore); //Neutral Salute Action salute = new Action { EventType = EventType.Interaction, ActionType = ActionType.NonVerbal, Intent = Intent.Neutral, Message = "", Target = character.MyName, EventName = "Salute", Source = "The Ambassador" }; var reaction12 = character.InteractWithMe(salute); compiledResults[11].Add(reaction12[0].ReactionScore); }