Loading...
Searching...
No Matches
PixelCrushers.LoveHate.FactionDatabase Class Reference

A faction database is a collection of traits, presets, and factions. More...

Inheritance diagram for PixelCrushers.LoveHate.FactionDatabase:
Collaboration diagram for PixelCrushers.LoveHate.FactionDatabase:

Public Member Functions

void Initialize ()
 
int CreateNewFaction (string factionName, string description)
 Creates a new faction in the faction database.
 
void DestroyFaction (string factionName)
 Permanently removes a faction from the faction database.
 
void DestroyFaction (int factionID)
 Permanently removes a faction from the faction database.
 
Faction GetFaction (int factionID)
 Gets the faction with the specified faction ID.
 
Faction GetFaction (string factionName)
 Gets the faction with the specified name.
 
int GetFactionID (string factionName)
 Gets a faction's ID from its name.
 
bool FactionHasAncestor (int factionID, int ancestorID)
 Determines whether a faction has another faction as its parent, grandparent, etc.
 
bool FactionHasDirectParent (int factionID, int parentID)
 Determines whether a faction has another faction as one of its direct parents.
 
void AddFactionParent (int factionID, int parentID)
 Adds a direct parent to a faction.
 
void RemoveFactionParent (int factionID, int parentID, bool inheritRelationships)
 Removes a direction parent from a faction.
 
int GetPersonalityTraitID (string traitName)
 Gets a personality trait ID by its name.
 
float GetPersonalityTrait (string factionName, int traitID)
 Gets a faction's personality trait value.
 
float GetPersonalityTrait (int factionID, int traitID)
 Gets a faction's personality trait value.
 
void SetPersonalityTrait (string factionName, int traitID, float value)
 Sets a faction's personality trait value.
 
void SetPersonalityTrait (int factionID, int traitID, float value)
 Sets a faction's personality trait value.
 
int GetRelationshipTraitID (string traitName)
 Gets a relationship trait ID by its name.
 
void InheritTraitsFromParents (string factionName)
 Sets a faction's traits to the average of its parents' traits.
 
void InheritTraitsFromParents (string factionName, FactionInheritanceType inheritanceType)
 Sets a faction's traits to its inherited parents' traits.
 
void InheritTraitsFromParents (int factionID)
 Sets a faction's traits to the average of its parents' traits.
 
void InheritTraitsFromParents (int factionID, FactionInheritanceType inheritanceType)
 Sets a faction's traits to its inherited parents' traits.
 
bool FindPersonalRelationship (int judgeFactionID, int subjectFactionID, out Relationship relationship)
 Finds the personal relationship trait of a judging faction to a subject faction if it exists.
 
bool FindPersonalRelationshipTrait (int judgeFactionID, int subjectFactionID, int traitID, out float value)
 Finds the personal relationship trait of a judging faction to a subject faction if it exists.
 
bool FindRelationshipTrait (int judgeFactionID, int subjectFactionID, int traitID, out float value)
 Finds the relationship trait of a judging faction to a subject faction.
 
float GetRelationshipTrait (int judgeFactionID, int subjectFactionID, int traitID)
 Gets a relationship trait of a judging faction to a subject faction.
 
float GetRelationshipTrait (string judgeFactionName, string subjectFactionName, int traitID)
 Gets a judge's relationship trait to a subject using their faction names.
 
void SetPersonalRelationshipTrait (int judgeFactionID, int subjectFactionID, int traitID, float value)
 Sets a faction's personal relationship trait to another faction.
 
void SetPersonalRelationshipTrait (string judgeFactionName, string subjectFactionName, int traitID, float value)
 Sets a faction's personal relationship trait to another faction.
 
void ModifyPersonalRelationshipTrait (int judgeFactionID, int subjectFactionID, int traitID, float change)
 Modifies (increments or decrements) a judge's personal relationship trait to a subject using their faction IDs.
 
void ModifyPersonalRelationshipTrait (string judgeFactionName, string subjectFactionName, int traitID, float change)
 Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.
 
void SetPersonalRelationshipInheritable (int judgeFactionID, int subjectFactionID, bool inheritable)
 
void SetPersonalRelationshipInheritable (string judgeFactionName, string subjectFactionName, bool inheritable)
 
void ShareRelationshipTraits (int judgeFactionID, int otherFactionID, int subjectFactionID)
 If the faction has personal relationship traits for a subject and the other doesn't, this gives them to the other based on the other's affinity for this faction.
 
bool FindPersonalAffinity (int judgeFactionID, int subjectFactionID, out float affinity)
 Finds a faction's personal affinity for another faction.
 
bool FindAffinity (int judgeFactionID, int subjectFactionID, out float affinity)
 Finds the affinity of a judging faction to a subject faction.
 
float GetAffinity (int judgeFactionID, int subjectFactionID)
 Gets the affinity of a judging faction to a subject faction.
 
float GetAffinity (string judgeFactionName, string subjectFactionName)
 Gets a judge's affinity to a subject using their faction names.
 
void SetPersonalAffinity (int judgeFactionID, int subjectFactionID, float affinity)
 Sets this faction's personal affinity to another faction.
 
void SetPersonalAffinity (string judgeFactionName, string subjectFactionName, float affinity)
 Sets a judge's personal affinity to a subject using their faction names.
 
void ModifyPersonalAffinity (int judgeFactionID, int subjectFactionID, float affinityChange)
 Modifies (increments or decrements) a judge's personal affinity to a subject using their faction IDs.
 
void ModifyPersonalAffinity (string judgeFactionName, string subjectFactionName, float affinityChange)
 Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.
 
void ShareAffinity (int judgeFactionID, int otherFactionID, int subjectFactionID)
 If the faction has personal affinity for a subject and the other doesn't, this gives the other an affinity (and all other relationship traits) for the subject based on the other's affinity for this faction.
 

Public Attributes

TraitDefinition[] personalityTraitDefinitions = new TraitDefinition[0]
 The personality trait definitions.
 
TraitDefinition[] relationshipTraitDefinitions = new TraitDefinition[1] { new TraitDefinition("Affinity", "(Required)") }
 The relationship trait definitions.
 
Preset[] presets = new Preset[0]
 The presets.
 
Faction[] factions = new Faction[0]
 The factions.
 
FactionInheritanceType traitInheritanceType = FactionInheritanceType.Average
 How traits are inherited from parents.
 
FactionInheritanceType relationshipInheritanceType = FactionInheritanceType.Average
 How relationships are inherited from parents.
 
int nextID = 0
 The next faction ID, used by the custom editor to auto-number factions.
 

Static Public Attributes

const int PlayerFactionID = 0
 Faction ID 0 is reserved for the player.
 

Events

PersonalityTraitChangedDelegate personalityTraitChanged = delegate { }
 

Detailed Description

A faction database is a collection of traits, presets, and factions.

The scope of a faction database is the definition of traits, presets, and factions, with no awareness of faction members or other scene-level objects.

Member Function Documentation

◆ AddFactionParent()

void PixelCrushers.LoveHate.FactionDatabase.AddFactionParent ( int  factionID,
int  parentID 
)
inline

Adds a direct parent to a faction.

Parameters
factionIDFaction ID.
parentIDParent ID.

◆ CreateNewFaction()

int PixelCrushers.LoveHate.FactionDatabase.CreateNewFaction ( string  factionName,
string  description 
)
inline

Creates a new faction in the faction database.

Returns
The new faction's faction ID.
Parameters
factionNameFaction name.

◆ DestroyFaction() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.DestroyFaction ( int  factionID)
inline

Permanently removes a faction from the faction database.

Parameters
factionIDFaction ID.

◆ DestroyFaction() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.DestroyFaction ( string  factionName)
inline

Permanently removes a faction from the faction database.

Parameters
factionNameFaction name.

◆ FactionHasAncestor()

bool PixelCrushers.LoveHate.FactionDatabase.FactionHasAncestor ( int  factionID,
int  ancestorID 
)
inline

Determines whether a faction has another faction as its parent, grandparent, etc.

Returns
true, if has ancestor, false otherwise.
Parameters
factionIDFaction ID.
ancestorIDAncestor ID.

◆ FactionHasDirectParent()

bool PixelCrushers.LoveHate.FactionDatabase.FactionHasDirectParent ( int  factionID,
int  parentID 
)
inline

Determines whether a faction has another faction as one of its direct parents.

Returns
true, if has direct parent, false otherwise.
Parameters
factionIDFaction ID.
parentIDParent ID.

◆ FindAffinity()

bool PixelCrushers.LoveHate.FactionDatabase.FindAffinity ( int  judgeFactionID,
int  subjectFactionID,
out float  affinity 
)
inline

Finds the affinity of a judging faction to a subject faction.

Returns
true, if affinity was found, false otherwise.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
affinityAffinity of judge to subject.

◆ FindPersonalAffinity()

bool PixelCrushers.LoveHate.FactionDatabase.FindPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
out float  affinity 
)
inline

Finds a faction's personal affinity for another faction.

Doesn't check parents.

Returns
true if personal affinity was found, false otherwise.
Parameters
subjectFactionIDThe other faction ID.
affinityAffinity of this faction to the subject.

◆ FindPersonalRelationship()

bool PixelCrushers.LoveHate.FactionDatabase.FindPersonalRelationship ( int  judgeFactionID,
int  subjectFactionID,
out Relationship  relationship 
)
inline

Finds the personal relationship trait of a judging faction to a subject faction if it exists.

Returns
true, if personal relationship was found, false otherwise.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.
valueTrait value of judge to subject.

◆ FindPersonalRelationshipTrait()

bool PixelCrushers.LoveHate.FactionDatabase.FindPersonalRelationshipTrait ( int  judgeFactionID,
int  subjectFactionID,
int  traitID,
out float  value 
)
inline

Finds the personal relationship trait of a judging faction to a subject faction if it exists.

Returns
true, if personal relationship was found, false otherwise.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.
valueTrait value of judge to subject.

◆ FindRelationshipTrait()

bool PixelCrushers.LoveHate.FactionDatabase.FindRelationshipTrait ( int  judgeFactionID,
int  subjectFactionID,
int  traitID,
out float  value 
)
inline

Finds the relationship trait of a judging faction to a subject faction.

Returns
true, if relationship was found, false otherwise.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.
valueTrait value of judge to subject.

◆ GetAffinity() [1/2]

float PixelCrushers.LoveHate.FactionDatabase.GetAffinity ( int  judgeFactionID,
int  subjectFactionID 
)
inline

Gets the affinity of a judging faction to a subject faction.

Returns
The affinity.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.

◆ GetAffinity() [2/2]

float PixelCrushers.LoveHate.FactionDatabase.GetAffinity ( string  judgeFactionName,
string  subjectFactionName 
)
inline

Gets a judge's affinity to a subject using their faction names.

Returns
The affinity.
Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.

◆ GetFaction() [1/2]

Faction PixelCrushers.LoveHate.FactionDatabase.GetFaction ( int  factionID)
inline

Gets the faction with the specified faction ID.

Returns
The faction, or null if no faction exists with the ID.
Parameters
factionIDFaction ID.

◆ GetFaction() [2/2]

Faction PixelCrushers.LoveHate.FactionDatabase.GetFaction ( string  factionName)
inline

Gets the faction with the specified name.

Returns
The faction, or null if no faction exists by that name.
Parameters
factionNameFaction name.

◆ GetFactionID()

int PixelCrushers.LoveHate.FactionDatabase.GetFactionID ( string  factionName)
inline

Gets a faction's ID from its name.

Returns
The faction ID, or -1 if no faction exists by that name.
Parameters
factionNameFaction name.

◆ GetPersonalityTrait() [1/2]

float PixelCrushers.LoveHate.FactionDatabase.GetPersonalityTrait ( int  factionID,
int  traitID 
)
inline

Gets a faction's personality trait value.

Parameters
factionIDFaction.
traitIDTrait ID.
Returns

◆ GetPersonalityTrait() [2/2]

float PixelCrushers.LoveHate.FactionDatabase.GetPersonalityTrait ( string  factionName,
int  traitID 
)
inline

Gets a faction's personality trait value.

Parameters
factionNameFaction.
traitIDTrait ID.
Returns

◆ GetPersonalityTraitID()

int PixelCrushers.LoveHate.FactionDatabase.GetPersonalityTraitID ( string  traitName)
inline

Gets a personality trait ID by its name.

Returns
The personality trait ID.
Parameters
traitNameTrait name.

◆ GetRelationshipTrait() [1/2]

float PixelCrushers.LoveHate.FactionDatabase.GetRelationshipTrait ( int  judgeFactionID,
int  subjectFactionID,
int  traitID 
)
inline

Gets a relationship trait of a judging faction to a subject faction.

Returns
The trait value.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.

◆ GetRelationshipTrait() [2/2]

float PixelCrushers.LoveHate.FactionDatabase.GetRelationshipTrait ( string  judgeFactionName,
string  subjectFactionName,
int  traitID 
)
inline

Gets a judge's relationship trait to a subject using their faction names.

Returns
The trait value.
Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
traitIDTrait ID.

◆ GetRelationshipTraitID()

int PixelCrushers.LoveHate.FactionDatabase.GetRelationshipTraitID ( string  traitName)
inline

Gets a relationship trait ID by its name.

Returns
The relationship trait I.
Parameters
traitNameTrait name.

◆ InheritTraitsFromParents() [1/4]

void PixelCrushers.LoveHate.FactionDatabase.InheritTraitsFromParents ( int  factionID)
inline

Sets a faction's traits to the average of its parents' traits.

Parameters
factionIDFaction name.

◆ InheritTraitsFromParents() [2/4]

void PixelCrushers.LoveHate.FactionDatabase.InheritTraitsFromParents ( int  factionID,
FactionInheritanceType  inheritanceType 
)
inline

Sets a faction's traits to its inherited parents' traits.

Parameters
factionIDFaction name.
inheritanceTypeHow to handle inheritance.

◆ InheritTraitsFromParents() [3/4]

void PixelCrushers.LoveHate.FactionDatabase.InheritTraitsFromParents ( string  factionName)
inline

Sets a faction's traits to the average of its parents' traits.

Parameters
factionNameFaction name.

◆ InheritTraitsFromParents() [4/4]

void PixelCrushers.LoveHate.FactionDatabase.InheritTraitsFromParents ( string  factionName,
FactionInheritanceType  inheritanceType 
)
inline

Sets a faction's traits to its inherited parents' traits.

Parameters
factionNameFaction name.
inheritanceTypeHow to handle inheritance.

◆ Initialize()

void PixelCrushers.LoveHate.FactionDatabase.Initialize ( )
inline

◆ ModifyPersonalAffinity() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.ModifyPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
float  affinityChange 
)
inline

Modifies (increments or decrements) a judge's personal affinity to a subject using their faction IDs.

Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
affinityChangeAffinity change.

◆ ModifyPersonalAffinity() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.ModifyPersonalAffinity ( string  judgeFactionName,
string  subjectFactionName,
float  affinityChange 
)
inline

Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
affinityChangeAffinity change.

◆ ModifyPersonalRelationshipTrait() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.ModifyPersonalRelationshipTrait ( int  judgeFactionID,
int  subjectFactionID,
int  traitID,
float  change 
)
inline

Modifies (increments or decrements) a judge's personal relationship trait to a subject using their faction IDs.

Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.
changeValue change.

◆ ModifyPersonalRelationshipTrait() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.ModifyPersonalRelationshipTrait ( string  judgeFactionName,
string  subjectFactionName,
int  traitID,
float  change 
)
inline

Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
traitIDTrait ID.
changeValue change.

◆ RemoveFactionParent()

void PixelCrushers.LoveHate.FactionDatabase.RemoveFactionParent ( int  factionID,
int  parentID,
bool  inheritRelationships 
)
inline

Removes a direction parent from a faction.

Parameters
factionIDFaction ID.
parentIDParent ID.
inheritRelationshipsIf set to true inherit any of the parents' relationships for which the faction doesn't already have a personal relationship.

◆ SetPersonalAffinity() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
float  affinity 
)
inline

Sets this faction's personal affinity to another faction.

Parameters
subjectFactionIDSubject faction ID.
affinityAffinity to the other faction.

◆ SetPersonalAffinity() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalAffinity ( string  judgeFactionName,
string  subjectFactionName,
float  affinity 
)
inline

Sets a judge's personal affinity to a subject using their faction names.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
affinityAffinity.

◆ SetPersonalityTrait() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalityTrait ( int  factionID,
int  traitID,
float  value 
)
inline

Sets a faction's personality trait value.

Parameters
factionIDFaction.
traitIDTrait ID.
valueNew value.

◆ SetPersonalityTrait() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalityTrait ( string  factionName,
int  traitID,
float  value 
)
inline

Sets a faction's personality trait value.

Parameters
factionNameFaction.
traitIDTrait ID.
valueNew value.

◆ SetPersonalRelationshipInheritable() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalRelationshipInheritable ( int  judgeFactionID,
int  subjectFactionID,
bool  inheritable 
)
inline

◆ SetPersonalRelationshipInheritable() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalRelationshipInheritable ( string  judgeFactionName,
string  subjectFactionName,
bool  inheritable 
)
inline

◆ SetPersonalRelationshipTrait() [1/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalRelationshipTrait ( int  judgeFactionID,
int  subjectFactionID,
int  traitID,
float  value 
)
inline

Sets a faction's personal relationship trait to another faction.

Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
traitIDTrait ID.
valueTrait value.

◆ SetPersonalRelationshipTrait() [2/2]

void PixelCrushers.LoveHate.FactionDatabase.SetPersonalRelationshipTrait ( string  judgeFactionName,
string  subjectFactionName,
int  traitID,
float  value 
)
inline

Sets a faction's personal relationship trait to another faction.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
traitIDTrait ID.
valueTrait value.

◆ ShareAffinity()

void PixelCrushers.LoveHate.FactionDatabase.ShareAffinity ( int  judgeFactionID,
int  otherFactionID,
int  subjectFactionID 
)
inline

If the faction has personal affinity for a subject and the other doesn't, this gives the other an affinity (and all other relationship traits) for the subject based on the other's affinity for this faction.

Parameters
otherA member of a faction.
subjectFactionIDSubject faction ID.

◆ ShareRelationshipTraits()

void PixelCrushers.LoveHate.FactionDatabase.ShareRelationshipTraits ( int  judgeFactionID,
int  otherFactionID,
int  subjectFactionID 
)
inline

If the faction has personal relationship traits for a subject and the other doesn't, this gives them to the other based on the other's affinity for this faction.

Parameters
judgeFactionIDJudge faction ID (gives traits).
otherFactionIDOther faction ID (maybe receives traits).
subjectFactionIDSubject faction ID (traits about this faction).

Member Data Documentation

◆ factions

Faction [] PixelCrushers.LoveHate.FactionDatabase.factions = new Faction[0]

The factions.

◆ nextID

int PixelCrushers.LoveHate.FactionDatabase.nextID = 0

The next faction ID, used by the custom editor to auto-number factions.

◆ personalityTraitDefinitions

TraitDefinition [] PixelCrushers.LoveHate.FactionDatabase.personalityTraitDefinitions = new TraitDefinition[0]

The personality trait definitions.

Used for factions, deeds, and presets.

◆ PlayerFactionID

const int PixelCrushers.LoveHate.FactionDatabase.PlayerFactionID = 0
static

Faction ID 0 is reserved for the player.

◆ presets

Preset [] PixelCrushers.LoveHate.FactionDatabase.presets = new Preset[0]

The presets.

◆ relationshipInheritanceType

FactionInheritanceType PixelCrushers.LoveHate.FactionDatabase.relationshipInheritanceType = FactionInheritanceType.Average

How relationships are inherited from parents.

◆ relationshipTraitDefinitions

TraitDefinition [] PixelCrushers.LoveHate.FactionDatabase.relationshipTraitDefinitions = new TraitDefinition[1] { new TraitDefinition("Affinity", "(Required)") }

The relationship trait definitions.

Used for relationships.

◆ traitInheritanceType

FactionInheritanceType PixelCrushers.LoveHate.FactionDatabase.traitInheritanceType = FactionInheritanceType.Average

How traits are inherited from parents.

Event Documentation

◆ personalityTraitChanged

PersonalityTraitChangedDelegate PixelCrushers.LoveHate.FactionDatabase.personalityTraitChanged = delegate { }

The documentation for this class was generated from the following file: