IM.GetCompatibleSchemes

From Intrigues Wiki
Revision as of 16:32, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>GetCompatibleSchemes</code> Method in IM Class == === Overview === The <code>GetCompatibleSchemes</code> method in the IM class provides a list of schemes that an actor, identified as the conspirator, can initiate against a target. === Syntax === <syntaxhighlight lang="c#"> public static IEnumerable<Scheme> GetCompatibleSchemes(Actor conspirator, Actor target = null) </syntaxhighlight> === Parameters === * <code>conspirator</code>: The <code>Actor</code> obj...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GetCompatibleSchemes Method in IM Class

Overview

The GetCompatibleSchemes method in the IM class provides a list of schemes that an actor, identified as the conspirator, can initiate against a target.

Syntax

public static IEnumerable<Scheme> GetCompatibleSchemes(Actor conspirator, Actor target = null)

Parameters

  • conspirator: The Actor object representing the actor initiating the scheme.
  • target (optional): The Actor object representing the target of the scheme. If null, the method considers schemes applicable to any target.

Functionality

  • The method iterates over all available schemes and filters them based on several criteria:
    • The conspirator has not already activated the scheme against the specified target.
    • The scheme exists in the collection of all schemes.
    • The scheme's associated rules, when started with the given conspirator and target, evaluate to true.
  • Returns a list of Scheme objects that meet these criteria.

Usage

This method is used to dynamically determine which schemes are viable options for a conspirator to initiate against a target. It's particularly useful in gameplay scenarios involving strategic decisions, intrigue, and character interactions.

Example of Usage

public class SchemeSelectionManager : MonoBehaviour {
    public Actor target;

    public void DisplayAvailableSchemes() {
        if(IM.Player == null) return;
        var schemes = IM.GetCompatibleSchemes(IM.Player, target);
        foreach (var scheme in schemes) {
            Debug.Log($"Available scheme: {scheme.SchemeName}");
        }
    }
}

Description

  • DisplayAvailableSchemes: Demonstrates how to fetch and log compatible schemes that the player can initiate against a target.

Remarks

  • The GetCompatibleSchemes method is essential in games where characters engage in complex interactions, such as political intrigue or strategic manipulation.
  • It enables dynamic and context-sensitive gameplay, allowing schemes to be presented to the player based on the current state and relationships between characters.
  • This method is particularly relevant in narrative-driven or strategy games, where player choices significantly impact the story or game outcomes.