Skip to content

add Chain namespace#1258

Merged
that-hatter merged 27 commits into
masterfrom
chain-namespace
Jun 9, 2026
Merged

add Chain namespace#1258
that-hatter merged 27 commits into
masterfrom
chain-namespace

Conversation

@that-hatter

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

Copy link
Copy Markdown
Member
  • 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.
    • Added equivalent checker functions for triggering properties.
    • Added functions for retrieving and checking "dynamic" Chain properties that integrate various rulings, as well as dynamic effect properties that also include rulings for non-activated effects.
  • 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 functions:
    • All cards that use CHAININFO_TRIGGERING_SETCODES.
    • All cards that are unaffected by the effects except of cards of a certain archetype.
    • Several other cards that check an effect's card properties.
    • All cards that use Cost.Choice and Cost.DetachFromSelf.
    • Several cards that use labels and label objects to store information.
  • Some general purpose (not strictly Chain-related) updates:
    • Added Effect.IsGlobalEffect.
    • Updated Card.IsScale to handle multiple arguments.
    • Changed Card.IsExactType to check if the card's type exactly matches the passed type(s), and added Card.IsCompositeType which has Card.IsExactType's former behavior.

@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 18 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
- Megalith Notrah Plura: not triggering
- updated the remaining 'unaffected by... except "archetype"...' cards
- replaced 're:IsCardType(TYPE_MONSTER)' with  're:IsMonsterEffect()' in scripts
- Cost.DetachFromSelf: use 'Effect.GetChainData' for consistency with everything else
accidentally reverted the chain data updates
reference the triggering property only if there's no resolving property
- Grandpa Demetto & Primathmech Laplacian: use 'Effect.GetChainData' for consistency
- Mirror Imagine Prism Coat 8: last 'unaffected by... except "achetype"...' card
specifically return nil when the queried property doesn't exist
* added functions for link and scale properties
* updated Is...ATK/DEF functions to allow multiple arguments to be consistent with Card.IsAttack/Defense
* updated Card.IsScale to allow multiple arguments to be consistent with Card.IsLevel/Rank/Link
* updated IsTriggeringCode and IsTriggeringSetcode to properly handle cases where there are no triggering properties
* updated IsSetCard functions to not take varargs, to be consistent with Card.IsSetCard
* should not unpack passed `setcodes`, since it could be a number
@that-hatter that-hatter merged commit 3a5a1b5 into master Jun 9, 2026
1 check passed
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