Skip to content

add Chain namespace#1258

Open
that-hatter wants to merge 7 commits intomasterfrom
chain-namespace
Open

add Chain namespace#1258
that-hatter wants to merge 7 commits intomasterfrom
chain-namespace

Conversation

@that-hatter
Copy link
Copy Markdown
Member

@that-hatter that-hatter commented May 2, 2026

  • Added a Chain namespace for functions related to Chains and Chain Links.
  • Broke down Duel.GetChainInfo into multiple functions that retrieve one thing, making it more modular and friendlier to documentation/typing.
    • Also added equivalent checker functions for triggering properties.
    • Also added functions for retrieving and checking "dynamic" Chain properties (refers to the current properties if the card is still the same copy, otherwise refers to the triggering properties).
  • Added a mechanism for associating an arbitrary amount of information to a specific Chain Link, as opposed to Effect.SetLabel and Effect.SetLabelObject (which are associated to the effect itself), and Duel.SetTargetParam (which only allows saving one value).
  • Moved existing Chain-related functions to the new namespace. The old names should eventually be deprecated.
  • Updated several cards to use the new Chain functions:
    • All cards that use CHAININFO_TRIGGERING_SETCODES.

@that-hatter that-hatter requested a review from pyrQ as a code owner May 2, 2026 22:32
* Added sepatate `Chain.GetTriggeringLocationSymbolic` and `Chain.GetTriggeringSequenceSymbolic`.
* Made `Chain.GetTriggeringType` and `Chain.IsTriggeringType` only refer to `CHAININFO_TRIGGERING_TYPE`. Separate functions may be added later for `CHAININFO_TYPE` and `CHAININFO_EXTTYPE` when they're needed.
* Integrated symbolic locations into `Chain.IsTriggeringLocation` to be consistent with `Card.IsLocation`.
    * Symbolic sequences, however, are not integrated into `Chain.IsTriggeringSequence`, and there's no separate function for it (it's currently unused).
* Added `Chain.IsTriggeringEffect`.
* Minor optimization: Since all chain info functions only pass a single param now, removed variadic args handling from `chaininfo_fn` .
* Used Lua's `select` function for `chain_event_fn`.
* Renamed `Chain.Info` to `Chain.Data` to avoid confusion with existing "chain info" functions
* overwrote `Debug.ReloadFIleBegin` to avoid having the tracking global effect deleted
* allowed `Chain.Data` to take an optional `key` parameter, which makes it return different tables associated to the same chain link, avoiding potential conflicts when two effects try to access the same chain link data
    * by passing `nil` as key, a "shared" table can be accessed
* added `Effect.GetChainData` which passes the effect as the `key` to `Chain.Data`
* `Cost.Choice` now stores the selected choice as chain data, instead of a label
* `Cost.DetachFromSelf` now stores the detached material as chain data
@that-hatter that-hatter requested a review from larry126 as a code owner May 6, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant