Skip to content

API Reference

mewcodex edited this page Sep 2, 2026 · 5 revisions

API Reference

English | 简体中文

Generator namespace: ChaosCardGenerator

ComponentProfileRequest

Identifies one generation profile with ProfileId, balance Character, and UnlockComponentRoles. Use stable ASCII profile IDs. The two-argument constructor is for built-in profiles.

ComponentGenerationProfile

Contains ShellCatalog, ComponentCatalog, NameCatalog, an occurrence-policy factory, and an IComponentValuePolicy. CreateOccurrencePolicy() must return fresh pool-scoped state. Its optional ComponentKeywordPolicy independently controls native base-keyword and upgrade availability.

ComponentPackageApi

Register(ComponentPackageRegistration) installs profile, localization, keyword-upgrade, multiplicity, and custom valuation metadata. Register before the first ComponentApi.Resolve. Duplicate package IDs are rejected. IncludeInUltimateChaos defaults to true and contributes the complete normal source catalog to the weighted union.

ComponentApi.ComposeCatalog combines complete source catalogs without losing occurrence weighting. An external normal profile can be resolved with UnlockComponentRoles=true without registering a duplicate Ultimate profile.

ImmutableComponentCatalog

Builds all structural indexes from reviewed IroncladCardRecipe values. The historical type name is retained for binary/source compatibility; it is valid for any balance archetype.

IComponentOccurrencePolicy

  • SourcePriorWeight: native/source family prior.
  • SelectionWeight: closed-loop correction after accepted cards.
  • VariantWeight: choice within a family.
  • Observe: receives finalized cards only, never failed attempts.

Use ComponentApi.CreateNativeOccurrencePolicy(catalog) unless the character needs a custom distribution.

IComponentValuePolicy

Controls numeric scalability, native-value preservation, sampling, clamping, value bonuses, and trigger payoff scaling. Use ComponentApi.DefaultValuePolicy unless you need a fully custom numeric model.

IComponentValuation

Returns finalized effect value in hundredths of one point of single-target damage. Exact opcode/variant routes win over opcode-wide routes.

ComponentValuationRegistration also supports one downside mode:

  • NegativeLinearValuePerUnit > 0: linear compensation per unit; or
  • NegativeMultiplier > 1: whole-card multiplicative downside compensation.

Do not set both.

ComponentMultiplicity

  • Repeatable: ordinary component.
  • SinglePerCard: at most once on one generated card.
  • UniquePerPool: at most once in the generated pool.

Register with ComponentMultiplicityRegistration. Pool uniqueness is consumed only by accepted finalized cards.

Runtime namespace: AutoAnthony

ComponentRuntimeApi

  • Register(opcode, variant, handler) registers one route.
  • RegisterPackage(packageId, routes) validates and commits a route set.
  • HasRoute and RegisteredRoutes support startup audits.
  • Registration freezes when the first generated operation executes.

ComponentPresentationApi

Registers optional IComponentHoverTipProvider routes. Registration freezes on first generated hover-tip render.

ExternalComponentCharacterApi

  • Register declares profile identity, archetype, and energy-icon prefix.
  • An optional IExternalAncientRelicAdapter supplies Archaic Tooth and Dusty Tome behavior without a hard-coded character ID.
  • InstallDefinitions replaces one profile's complete run-scoped definition list.
  • GetDefinitions returns the installed immutable list.
  • ClearDefinitions removes run-scoped definitions.

Character registration freezes when definitions are first installed or read.

Deliberate boundaries

Native execution still contains compatibility branches for built-in templates; custom namespaced opcodes use the generic runtime registry. The game's keyword enums are closed, so a genuinely new semantic keyword is represented by a standalone_keyword component plus its runtime and hover-tip routes. The owning mod still supplies save-field, host-authoritative definition synchronization, custom token/orb/status resolution, and any novel card hook.

ExternalChaosCardModel

Base class for concrete fixed-slot card models. Override ComponentProfileId, Slot, and Pool; generated text, upgrades, trigger dispatch, and operation execution are inherited.

Validation and failure behavior

Registration throws immediately for non-ASCII IDs, duplicate routes, missing RuntimeSpecs, duplicate semantic IDs, invalid trigger owners, empty catalogs, or a catalog whose character differs from its profile archetype. Treat these as initialization errors and fail loudly rather than continuing with a partially registered package.

Clone this wiki locally