Skip to content

add Chain namespace#1258

Open
that-hatter wants to merge 19 commits into
masterfrom
chain-namespace
Open

add Chain namespace#1258
that-hatter wants to merge 19 commits into
masterfrom
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
that-hatter and others added 12 commits May 20, 2026 21:32
* added tracking for "resolving properties": card properties at the start of resolution
* added tracking for "registering peroperties": card properties when they register a Duel effect
* integrated branches for resolving properties and registering properties in the various `Chain.Get...` and `Chain.Is...` functions
* added `Effect.GetCard...` and `Effect.IsCard...` functions, which work similarly to `Chain.Get...`/`Chain.Is...`, but also handles rulings for non-activated effects
* prevented `Debug.ReloadFieldBegin` from resetting global effects registered in the file
* general file reorganization
- 'effect_card_prop' function: default to current properties
- fusion proc: added the 'EFFECT_FLAG_IGNORE_IMMUNE' property to the global effects to prevent script errors with '"naffected by..." effects (should probably exclude global effects from the tracking altogether?)
- updated some more cards to use effect properties: "cannot be destroyed by..." (e.g. "Number 76: Harmonizer Gradielle") and "cannot be targeted by..." (e.g. "Sea Stealth II")
- Chain.IsTriggeringSetcode: which param should and shouldn't be passed as a table was flipped
- replaced 'Duel.GetCurrentChain' with 'Chain.GetCurrentLink'
- Power Patron Shadow Beast Nervedo: also check 're:IsMonsterEffect()'
- Evil★Twin Ki-sikil Deal: missing variable declaration
- Trickstar Light Stage: simplify a bit by using the effect properties
- use 'ev' + not triggering:
Azamina Moa Regina
Dracotail Gulamel
Dead-End Power Patron Realm - Viraia
* added Level to CARD_PROPERTIES
* added "composite type" and "exact type" functions
* excluded global effects from dynamic properties
use Chain.IsTriggeringCompositeType
* added Effect.IsGlobalEffect
* changed IsExactType to check if the card's type exactly matches the passed type(s)
* added Card.IsCompositeType which has IsExactType's old behavior
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.

2 participants