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
type
ActionTypeThe type for this action.
info
ActionInfoThe 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
type
CompletionTypeThe 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
name
stringThe name of the action
priority
Func<PersonLike, float>The passive priority of this action
settings
TalkAction.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
name
stringThe name of the action
priority
Func<PersonLike, float>The passive priority of this action
settings
TalkAction.TalkSettingsThe additional settings for this action
humorSkillGain
intThe amount of Humor skill gain that this action should cause when successful. Defaults to 10000.
humorSkillRequired
intThe 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
name
stringThe name of the action
priority
Func<PersonLike, float>The passive priority of this action
settings
TalkAction.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
name
stringThe name of the action
priority
Func<PersonLike, float>The passive priority of this action
settings
TalkAction.TalkSettingsThe additional settings for this action
Returns
- ActionType.TypeSettings
A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed
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
time
GameTimeThe game's time
passedInGame
TimeSpanThe amount of time passed in game time
speedMultiplier
floatThe 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