Constructor
new FactionRegistry(configopt)
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | <optional> | {} | Registry configuration. Properties
|
- Source
Classes
Methods
(static) deserialize(data) → {FactionRegistry}
Creates and deserializes a new FactionRegistry instance.
| Name | Type | Description |
|---|---|---|
data | Object | Serialized data. |
- Source
- Type:
- FactionRegistry
(static) resolveFaction(target) → {string}
Resolves a faction name from a string, entity, or combatant.
| Name | Type | Description |
|---|---|---|
target | Object | | Entity, combatant, or faction string. |
- Source
Faction name.
- Type:
- string
clear()
Clears all recorded standings and registrations.
- Source
getDisposition(source, target) → {string}
Gets the disposition of source towards target ("friendly", "neutral", or "hostile"). Respects explicit disposition overrides and derives from reputation thresholds.
| Name | Type | Description |
|---|---|---|
source | Object | | Source faction or entity. |
target | Object | | Target faction or entity. |
- Source
Disposition string.
- Type:
- string
getFactions() → {Array}
Returns all registered faction names.
- Source
List of faction names.
- Type:
- Array
getReputation(source, target) → {number}
Gets the numerical reputation of source faction towards target.
| Name | Type | Description |
|---|---|---|
source | Object | | Source faction or entity. |
target | Object | | Target faction or entity. |
- Source
Numerical reputation.
- Type:
- number
hasFaction(name) → {boolean}
Checks if a faction is registered.
| Name | Type | Description |
|---|---|---|
name | string | Faction name. |
- Source
- Type:
- boolean
isFriendly(source, target) → {boolean}
Checks if source faction considers target friendly.
| Name | Type | Description |
|---|---|---|
source | Object | | Source faction or entity. |
target | Object | | Target faction or entity. |
- Source
True if friendly.
- Type:
- boolean
isHostile(source, target) → {boolean}
Checks if source faction considers target hostile.
| Name | Type | Description |
|---|---|---|
source | Object | | Source faction or entity. |
target | Object | | Target faction or entity. |
- Source
True if hostile.
- Type:
- boolean
isNeutral(source, target) → {boolean}
Checks if source faction considers target neutral.
| Name | Type | Description |
|---|---|---|
source | Object | | Source faction or entity. |
target | Object | | Target faction or entity. |
- Source
True if neutral.
- Type:
- boolean
modifyReputation(source, target, delta, optionsopt) → {number}
Modifies numerical reputation between source and target by delta.
| Name | Type | Attributes | Default | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source | Object | | Source faction or entity. | ||||||||||||
target | Object | | Target faction or entity. | ||||||||||||
delta | number | Amount to adjust reputation by. | ||||||||||||
options | Object | <optional> | {} | Options object. Properties
|
- Source
New reputation score.
- Type:
- number
registerFaction(name) → {FactionRegistry}
Registers a faction name into the registry.
| Name | Type | Description |
|---|---|---|
name | string | Faction name. |
- Source
This instance.
- Type:
- FactionRegistry
restore(data) → {FactionRegistry}
Restores faction standings from serialized data.
| Name | Type | Description |
|---|---|---|
data | Object | Serialized state object. |
- Source
This instance.
- Type:
- FactionRegistry
serialize() → {Object}
Serializes faction standings into a plain JSON-compatible object.
- Source
- Type:
- Object
setDisposition(source, target, disposition, optionsopt) → {FactionRegistry}
Sets an explicit disposition override from source towards target.
| Name | Type | Attributes | Default | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source | Object | | Source faction or entity. | |||||||||||||||||
target | Object | | Target faction or entity. | |||||||||||||||||
disposition | string | "friendly", "neutral", or "hostile". | |||||||||||||||||
options | Object | <optional> | {} | Options object. Properties
|
- Source
This instance.
- Type:
- FactionRegistry
setReputation(source, target, value, optionsopt) → {FactionRegistry}
Sets numerical reputation from source towards target. Supports asymmetric (default) or bidirectional updates.
| Name | Type | Attributes | Default | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source | Object | | Source faction or entity. | |||||||||||||||||
target | Object | | Target faction or entity. | |||||||||||||||||
value | number | Numerical reputation value. | |||||||||||||||||
options | Object | <optional> | {} | Options object. Properties
|
- Source
This instance.
- Type:
- FactionRegistry