private static string GenerateUndecidedResponse(Character cData, CharacterAction aData) { string activeString = ""; //string completeString = ""; //int choice = 0; activeString = "I can't decide at this time, Your Excellence."; return activeString; // stub to test reader }
public static string GenerateResponse(Character cData, CharacterAction aData, float responseIndex, bool requiresDecision) { string activeString = ""; if (requiresDecision) { if (responseIndex > 65) activeString = GenerateAffirmativeResponse(cData, aData); else if (responseIndex > 35) activeString = GenerateUndecidedResponse(cData, aData); else activeString = GenerateDeclineResponse(cData, aData); } else { if (responseIndex > 65) activeString = GeneratePositiveResponse(cData, aData); // change to positive response else if (responseIndex > 35) activeString = GenerateNeutralResponse(cData, aData); // change to negative response else activeString = GenerateNegativeResponse(cData, aData); // change to negative response } return activeString; }
private static string GeneratePositiveResponse(Character cData, CharacterAction aData) { string activeString = ""; //string completeString = ""; //int choice = 0; activeString = "That sounds great, Your Excellence."; return activeString; // stub to test reader }
private static string GenerateNeutralResponse(Character cData, CharacterAction aData) { string activeString = ""; //string completeString = ""; //int choice = 0; activeString = "I guess that sounds OK, Your Excellence."; return activeString; // stub to test reader }
private static string GenerateNegativeResponse(Character cData, CharacterAction aData) { string activeString = ""; //string completeString = ""; //int choice = 0; activeString = "That is outrageous, Your Excellence!"; return activeString; // stub to test reader }
private static string GenerateDeclineResponse(Character cData, CharacterAction aData) { string activeString = ""; //string completeString = ""; //int choice = 0; activeString = "I refuse to do that, Your Excellence."; return activeString; // stub to test reader }
public static string GivePraisingSpeech(Character cData) { GlobalGameData gDataRef = GameObject.Find("GameManager").GetComponent <GlobalGameData>(); Character eData = gDataRef.CivList[0].Leader; // you CharacterAction aData = gDataRef.CharacterActionList.Find(p => p.ID == "A1"); bool speechSuccessful = false; float responseIndex = 0f; int speechEffectiveness = 0; string speechSuccess = ""; // debug code // make check based on charm + intelligence if (eData.Charm >= -30) { speechEffectiveness = UnityEngine.Random.Range(30, eData.Charm) + UnityEngine.Random.Range(0, eData.Intelligence); if (speechEffectiveness > 80) { speechSuccessful = true; speechSuccess = "successful, value of " + speechEffectiveness.ToString("N0"); // debug code } else { speechSuccessful = false; speechSuccess = "unsuccessful, value of " + speechEffectiveness.ToString("N0"); // debug code } } else { speechSuccessful = false; speechSuccess = "unsuccessful, minimum check not passed to try"; // debug code } // now determine effect of character responseIndex = speechEffectiveness; if (speechSuccessful) { if (cData.NewRelationships[eData.ID].Trust > 50) { cData.NewRelationships[eData.ID].Trust += UnityEngine.Random.Range(0, (speechEffectiveness / 5)); } else { cData.NewRelationships[eData.ID].Trust += UnityEngine.Random.Range(0, (speechEffectiveness / 8)); // less effective when more hated } // now determine effect of characters around them, checking each character individually foreach (string cID in cData.NewRelationships.Keys) { if (cData.NewRelationships.ContainsKey(cID)) { if (cData.NewRelationships[cID].RelationshipState == Relationship.eRelationshipState.Friends || cData.NewRelationships[cID].RelationshipState == Relationship.eRelationshipState.Allies) { cData.NewRelationships[cID].Trust += UnityEngine.Random.Range(0, (speechEffectiveness / 8)); HelperFunctions.DataRetrivalFunctions.GetCharacter(cID).NewRelationships[eData.ID].Trust += UnityEngine.Random.Range(0, (speechEffectiveness / 10)); // improve trust slightly with the emperor } if (cData.NewRelationships[cID].RelationshipState == Relationship.eRelationshipState.Rivals || cData.NewRelationships[cID].RelationshipState == Relationship.eRelationshipState.Vendetta) { cData.NewRelationships[cID].Trust -= UnityEngine.Random.Range(0, (speechEffectiveness / 8)); HelperFunctions.DataRetrivalFunctions.GetCharacter(cID).NewRelationships[eData.ID].Trust -= UnityEngine.Random.Range(0, (speechEffectiveness / 10)); // distrusts slightly with the emperor } if (cData.NewRelationships[cID].RelationshipState == Relationship.eRelationshipState.Vengeance) { cData.NewRelationships[cID].Trust -= UnityEngine.Random.Range(0, (speechEffectiveness / 6)); HelperFunctions.DataRetrivalFunctions.GetCharacter(cID).NewRelationships[eData.ID].Trust -= UnityEngine.Random.Range(0, (speechEffectiveness / 6)); // distrusts a lot with the emperor } } } } // now send to speech engine to create response and return response UnityEngine.Debug.Log("Give Praising Speech executed. Speech was " + speechSuccess); // debug code string response = ConversationEngine.GenerateResponse(cData, aData, responseIndex, false); return(response); }