Heir

From Intrigues Wiki
Revision as of 06:51, 22 December 2023 by Tayfunwiki (talk | contribs) (Created page with "== <code>Heir</code> Property in Actor Class == === Overview === The <code>Heir</code> property in the <code>Actor</code> class is designed to identify the heir of an actor, a key element in games involving lineage, inheritance, and succession. === Syntax === <syntaxhighlight lang="c#"> public Actor Heir { get { // logic to determine the heir } } </syntaxhighlight> === Description === * Property Type: <code>Actor</code>. The <code>Heir</code> property...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Heir Property in Actor Class

Overview

The Heir property in the Actor class is designed to identify the heir of an actor, a key element in games involving lineage, inheritance, and succession.

Syntax

public Actor Heir {
    get {
        // logic to determine the heir
    }
}

Description

  • Property Type: Actor. The Heir property returns an Actor object, representing the actor's heir.
  • Property Logic: The property uses a series of conditional checks to determine the heir:
    • Checks if the actor's Clan is not null.
    • Checks if the actor's Role is not null.
    • If there is an overridden heir (_overrideHeir) who is alive (State == IState.Active) and designated as an inheritor, this actor is returned as the heir.
    • If the above conditions are not met, the default heir (_heir) is considered.
  • Purpose: The Heir property is essential for games where inheritance and succession are significant, impacting the storyline, character relationships, and gameplay dynamics.

Usage

This property is used to access the heir of an actor, which can be pivotal in scenarios such as inheritance disputes, succession planning, or in the event of an actor's demise.

Example:

Actor actorHeir = someActor.Heir;
if (actorHeir != null && actorHeir.Family.FamilyName == "Royal") {
    // Execute logic specific to heirs of the "Royal" family
}

In this example, the heir of the actor is checked for being part of a specific family, "Royal." If the heir belongs to the "Royal" family, corresponding game logic is executed.

Remarks

  • The nested conditional logic ensures a robust and flexible determination of the heir, accommodating various scenarios and conditions.
  • The property's ability to handle overridden heirs allows for dynamic gameplay, where heirship can change based on in-game events or decisions.
  • The Heir property is crucial in games with complex family dynamics and where the concept of inheritance plays a central role in the narrative and mechanics.