Class TalkAction
TalkAction is a generic social action with a set of pre-defined parameters. Things like PersonalityType and Charisma automatically influence this interaction's FriendshipGain and GoBadlyChance. Create(string, Func<PersonLike, float>, TalkSettings) should be used to create a talk action.
public class TalkAction : SocialAction, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderTalkAction
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
TalkAction(ActionType, ActionInfo)
Creates a new action with the given action information.
public TalkAction(ActionType type, ActionInfo info)
Parameters
typeActionTypeThe type for this action.
infoActionInfoThe information for this action.
Properties
Settings
The TalkAction.TalkSettings for this action, derived from its type's settings
protected TalkAction.TalkSettings Settings { get; }
Property Value
Methods
AndThenOnCompleted(CompletionType)
MultiAction version of OnCompleted(CompletionType). This method gets called when the main action completes.
protected override void AndThenOnCompleted(CompletionType type)
Parameters
typeCompletionTypeThe completion of the main action
Create(string, Func<PersonLike, float>, TalkSettings)
A helper method to create a TalkAction, which is a very simple implementation of a SocialAction. The passed TalkAction.TalkSettings will be modified in this method by modifying its underlying Settings, including its CanExecute, Name, PassivePriority, and more.
public static ActionType.TypeSettings Create(string name, Func<PersonLike, float> priority, TalkAction.TalkSettings settings)
Parameters
namestringThe name of the action
priorityFunc<PersonLike, float>The passive priority of this action
settingsTalkAction.TalkSettingsThe additional settings for this action
Returns
- ActionType.TypeSettings
A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed
CreateFunny(string, Func<PersonLike, float>, TalkSettings, int, int)
A helper method to create a TalkAction using Create(string, Func<PersonLike, float>, TalkSettings), but with default settings applied for an action in the Funny category. The passed TalkAction.TalkSettings will be modified in this method, setting its GainedSkill to Humor, its RestoredNeed to Entertainment, modifying its GoBadlyChance to be lowered if the persoin is feeling Goofy, and more.
public static ActionType.TypeSettings CreateFunny(string name, Func<PersonLike, float> priority, TalkAction.TalkSettings settings, int humorSkillGain = 10000, int humorSkillRequired = 0)
Parameters
namestringThe name of the action
priorityFunc<PersonLike, float>The passive priority of this action
settingsTalkAction.TalkSettingsThe additional settings for this action
humorSkillGainintThe amount of Humor skill gain that this action should cause when successful. Defaults to 10000.
humorSkillRequiredintThe level of Humor skill that this action requires to be able to be executed. Defaults to 0, which means no skill is required.
Returns
- ActionType.TypeSettings
A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed
CreateMean(string, Func<PersonLike, float>, TalkSettings)
A helper method to create a TalkAction using Create(string, Func<PersonLike, float>, TalkSettings), but with default settings applied for an action in the Mean category. The passed TalkAction.TalkSettings will be modified in this method, modifying its CanExecute delegate to check IsDislikedOrMean(ActionInfo, bool) as well.
public static ActionType.TypeSettings CreateMean(string name, Func<PersonLike, float> priority, TalkAction.TalkSettings settings)
Parameters
namestringThe name of the action
priorityFunc<PersonLike, float>The passive priority of this action
settingsTalkAction.TalkSettingsThe additional settings for this action
Returns
- ActionType.TypeSettings
A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed
CreateRomantic(string, Func<PersonLike, float>, TalkSettings)
A helper method to create a TalkAction using Create(string, Func<PersonLike, float>, TalkSettings), but with default settings applied for an action in the Romantic category. The passed TalkAction.TalkSettings will be modified in this method, modifying its CanExecute delegate to check IsReadyForRomance(ActionInfo, bool) as well, modifying its GoBadlyChance to be increased if the partner is already Dating someone else, defaulting its GainRomancePercentage to return 1 if not already set, and settings its FailEmotion to FailedRomance.
public static ActionType.TypeSettings CreateRomantic(string name, Func<PersonLike, float> priority, TalkAction.TalkSettings settings)
Parameters
namestringThe name of the action
priorityFunc<PersonLike, float>The passive priority of this action
settingsTalkAction.TalkSettingsThe additional settings for this action
Returns
- ActionType.TypeSettings
A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed
Evaluate(CompletionType)
Evaluates this talk action after it has been completed. By default, this method calls EvaluateFully(SocialAction) on the TalkAction.TalkSettings of this action.
protected virtual void Evaluate(CompletionType completion)
Parameters
completionCompletionTypeThe completion of this action.
IsConversationCompleted()
SocialAction version of IsCompleted(). This method returns whether the conversation should be marked as completed. Note that this method is only called for the IsMain part of the conversation.
protected override CompletionType IsConversationCompleted()
Returns
- CompletionType
Whether this conversation is completed
UpdateConversation(GameTime, TimeSpan, float)
SocialAction version of Update(GameTime, TimeSpan, float). This method is called every update frame during an active conversation for both conversation partners. By default, this method only increases ConversationTime.
protected override void UpdateConversation(GameTime time, TimeSpan passedInGame, float speedMultiplier)
Parameters
timeGameTimeThe game's time
passedInGameTimeSpanThe amount of time passed in game time
speedMultiplierfloatThe game speed multiplier, which represents how fast things should happen, which is usually determined by Speed
Events
OnEvaluate
An event that is invoked when EvaluateSimple(Action, PersonLike, float, float) is called. A mod can subscribe to this event to change the outcome of any basic conversation.
public static event TalkAction.TalkSettings.EvaluationResult OnEvaluate
Event Type
OnTalkFailure
An event that is invoked together with OnFailure, and it receives the Partner as an additional parameter. A mod can subscribe to this event to change the outcome of any basic conversation.
public static event Action<Action, PersonLike> OnTalkFailure
Event Type
OnTalkSuccess
An event that is invoked together with OnSuccess, and it receives the Partner as an additional parameter. A mod can subscribe to this event to change the outcome of any basic conversation.
public static event Action<Action, PersonLike> OnTalkSuccess