diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c4287704..5c234615 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -5,40 +5,51 @@ on: branches: - main +permissions: + contents: write + jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v6 with: - dotnet-version: 6.0.x + dotnet-version: '10.0.x' - name: Restore Project run: dotnet restore - - name: Add Mono Repository - run: | - sudo apt install gnupg ca-certificates - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list - sudo apt update - - - name: Install Mono - run: sudo apt install mono-runtime mono-devel msbuild - - name: Install DocFX run: | - curl -LJ https://github.com/dotnet/docfx/releases/download/v2.59.0/docfx.zip -o docfx.zip + curl -LJ https://github.com/dotnet/docfx/releases/download/v2.81.0/docfx-linux-x64-v2.81.0.zip -o docfx.zip unzip -d docfx/ docfx.zip + chmod +x docfx/docfx - name: Generate documentation - run: mono docfx/docfx.exe docs/docfx.json + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + REPOSITORY_NAME: ${{ github.event.repository.name }} + run: | + if [ "$REPOSITORY_NAME" = "$REPOSITORY_OWNER.github.io" ]; then + DOCFX_BASE_URL="https://${REPOSITORY_OWNER}.github.io/" + else + DOCFX_BASE_URL="https://${REPOSITORY_OWNER}.github.io/${REPOSITORY_NAME}/" + fi + + jq --arg base "$DOCFX_BASE_URL" \ + '.build.globalMetadata._appBaseUrl = $base' \ + docs/docfx.json > docs/docfx.generated.json + + ./docfx/docfx docs/docfx.generated.json + + rm docs/docfx.generated.json - - uses: actions/checkout@v3 + - name: Checkout gh-pages + uses: actions/checkout@v4 with: ref: gh-pages path: gh-pages @@ -50,11 +61,10 @@ jobs: cp -R ../docs/_site/* . - name: Push update - continue-on-error: true run: | cd gh-pages git config user.name github-actions git config user.email github-actions@github.com git add . - git commit -a -m "Generated from ${{ github.event.head_commit.id }}" + git commit -a -m "Generated from ${{ github.event.head_commit.id }}" || echo "No changes needed" git push diff --git a/.github/workflows/ts-build.yml b/.github/workflows/ts-build.yml new file mode 100644 index 00000000..5f368da3 --- /dev/null +++ b/.github/workflows/ts-build.yml @@ -0,0 +1,34 @@ + +name: TS-Build + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Run TS-Build + runs-on: windows-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Run TS-Build Script + shell: cmd + run: call InscryptionAPI\TS-Build.bat + + - name: Send Artifacts to GitHub Workflow for Later Use. + uses: actions/upload-artifact@v4 + with: + name: InscryptionAPI-Thunderstore-${{ github.run_number }} + path: InscryptionAPI/GITHUB RELEASE/NET/*.zip + if-no-files-found: error + retention-days: 30 diff --git a/.gitignore b/.gitignore index dbfec368..5bac3001 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,8 @@ bin/ .vscode/ *.user build/ - +InscryptionAPI/GITHUB RELEASE/ +InscryptionAPI/GITHUB PRERELEASE/ +InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.dll +InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.pdb +InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.xml \ No newline at end of file diff --git a/.run/TS-Build InscryptionAPI.run.xml b/.run/TS-Build InscryptionAPI.run.xml new file mode 100644 index 00000000..ab052550 --- /dev/null +++ b/.run/TS-Build InscryptionAPI.run.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/APIPatcher/APIPatcher.csproj b/APIPatcher/APIPatcher.csproj index 296ee20b..bd589d91 100644 --- a/APIPatcher/APIPatcher.csproj +++ b/APIPatcher/APIPatcher.csproj @@ -1,16 +1,27 @@ - netframework4.7.2 + netframework4.7.2 + win-x64;win-x86;win-arm64;linux-x64;linux-arm;linux-arm64;linux-musl-x64;linux-musl-arm64;osx-x64;osx-arm64 + Assembly-CSharp.APIPatcher.mm + The MonoMod Patcher for the Inscryption API. + 2.24.2 + Cyantist, IngoH, WhistleWind, Chaosyr and Contibutors + true + Latest + APIPatcher + full + $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 enable disable - latest + false + true + false + false + true false - Assembly-CSharp.APIPatcher.mm - - - - $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 + true + ..\InscryptionAPI\Thunderstore-Package-Elements\monomod\ @@ -22,4 +33,16 @@ + + + + + + + + + + + + diff --git a/APIPatcher/ScriptableObjectLoader.cs b/APIPatcher/ScriptableObjectLoader.cs index 3c67a6dc..66c6beab 100644 --- a/APIPatcher/ScriptableObjectLoader.cs +++ b/APIPatcher/ScriptableObjectLoader.cs @@ -3,9 +3,16 @@ namespace APIPatcher; +/// +/// Uses MonoMod to patch Unity's ScriptableObjectLoader to also use our version of the ScriptableObjectLoader seen in the Inscryption API itself. +/// +/// [MonoModPatch("global::ScriptableObjectLoader`1")] internal class patch_ScriptableObjectLoader : ScriptableObjectLoader where T : UnityObject { + /// + /// A List of AllData used within the overarching system, e.g. a List of . + /// new public static List AllData { get diff --git a/APIPatcher/Singleton.cs b/APIPatcher/Singleton.cs index ce178f8a..1291c79f 100644 --- a/APIPatcher/Singleton.cs +++ b/APIPatcher/Singleton.cs @@ -4,9 +4,16 @@ namespace APIPatcher; +/// +/// Uses MonoMod to patch the Singleton for later usability by the Inscryption API. +/// +/// A ManagedBehaviour associated with the Singleton System. [MonoModPatch("global::Singleton`1")] internal class patch_Singleton : Singleton where T : ManagedBehaviour { + /// + /// A simple function used to Find a Specified UnityObject of the specified Type within the Active Scene, if it fails it tosses a Warning. + /// new protected static void FindInstance() { if (m_Instance == null) @@ -21,7 +28,13 @@ internal class patch_Singleton : Singleton where T : ManagedBehaviour } } +/// +/// A simple class object for singletons in correlation with the API. +/// internal static class Singleton { + /// + /// A ManualLogSource specifically for logging issues related to Singletons. + /// internal static readonly ManualLogSource SingletonLogSource = Logger.CreateLogSource("Singleton"); } diff --git a/CHANGELOG.md b/CHANGELOG.md index d4bddb22..4994339a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,783 +1,825 @@ +# 2.24.2 +* Updated Installation Guides to Include Pulsar Mod Manager. +* Added more null checks into the following patches `GainGemsForOpponents`, `LoseGemsForOpponents`, `GainTripleGemsForOpponents`, `LoseTripleGemsForOpponents`. +* Removed `_specialSequencer` from `SpecialSequenceManager` as it was unused. +* Removed `FontReplacementDataInitialized` from `LocalizationManager` as it was unused. +* Added new Support for Custom Appearances. + * Image Handling is to be handled by the mods using the API. + * We now provide a storage of Base Game Decals that mods can reference without needing to instantiate their own. + * This comes with 5 new Dictionaries `BaseGameCustomAppearances` (Internal), `BaseGameCustomAppearancesPublic`, `ModdedCustomAppearancesDictionary` (Internal), `ModdedCustomAppearancesDictionaryPublic`, `CombinedCustomAppearancesDictionaryPublic`. + * This system is stored under the `TextureHelper` class. +* Improved In-Code Documentation via XML Comments. +* Added a way to easily patch and modify the default bone gain when a player's card dies. +* Added the following class: `DefaultBoneGainOnDeath` and the following methods within that class: `DefaultBoneGainOnDeath.ShouldDoDefaultBoneGain` and `DefaultBoneGainOnDeeath.DoDefaultBoneGain` +* Privatized several Internal Functions. +* Rename and Reorder configs internally for clarity as to what they are for. +* Clean up Code formatting. +* Fix casing of some variables. +* Implement new Material Overrides to `MaterialOverride` related to changing `Metallic`, `Smoothness` and `Height` for consistency. +* Add `OverrideQueuedBackground` to the `PixelCardBehaviours`. + * This is used for overriding the Queued Background of a card. +* Upgraded the API's `.csproj`'s, and TCLI Build system. +* Publicized the `_originalColor`, `_enterColor`, and `_selectedColor` used within `ActivatedAbilityIconInteractable` of the Community Patch. +* Update the API to use Latest BepInEx. + # 2.24.1 * Added Extensions for setting the IconTexture of a Starter Deck. * Added 2 Alternate Constructors for making a StarterDeck with a Display Name different from its Internal Name. * Added Getters and Setters for Starter Deck Unlock Level. # 2.24.0 -- Fixed Part2CardCostRender.UpdatePlayableCardCost not being invoked -- Fixed Part2CardCostRender.UpdateVanillaPlayableCardCost not being invoked -- Fixed SetEmissiveSacrificablePortrait functions which used to refer to SteelTrapPortrait instead of SacrificablePortrait -- Updated API and community patch target frameworks to `netframework4.7.2` (closer to the Runtime netframework.) -- Updated community patch plugin's mod version to match the API's -- Updated list of API contributors -- Added ability to set custom card given by Steel Trap sigil (cr. Snowi and SpecialAPI) -- Added `GetSteelTrapPelt` and `SetSteelTrapPelt` card extensions -- Added debug mode cards for testing custom Steel Trap pelts -- Added functions to set 'TailLostPortrait' emission sprites -- Added functions for setting 'TailLostPortrait' from a Sprite object -- Added NoWarn property to API and community patch projects for AD0001, CS0612, CS0618, Publicizer001 +* Fixed Part2CardCostRender.UpdatePlayableCardCost not being invoked +* Fixed Part2CardCostRender.UpdateVanillaPlayableCardCost not being invoked +* Fixed SetEmissiveSacrificablePortrait functions which used to refer to SteelTrapPortrait instead of SacrificablePortrait +* Updated API and community patch target frameworks to `netframework4.7.2` (closer to the Runtime netframework.) +* Updated community patch plugin's mod version to match the API's +* Updated list of API contributors +* Added ability to set custom card given by Steel Trap sigil (cr. Snowi and SpecialAPI) +* Added `GetSteelTrapPelt` and `SetSteelTrapPelt` card extensions +* Added debug mode cards for testing custom Steel Trap pelts +* Added functions to set 'TailLostPortrait' emission sprites +* Added functions for setting 'TailLostPortrait' from a Sprite object +* Added NoWarn property to API and community patch projects for AD0001, CS0612, CS0618, Publicizer001 # 2.23.7 -- Fixed log spam due to inverted condition in CardExtensions.GemsCost +* Fixed log spam due to inverted condition in CardExtensions.GemsCost # 2.23.6 -- Fixed card modifications added to a card's base ice cube card via CardInfo.SetIceCube being ignored -- Fixed PlayableCard.CanPlay not consistently accounting for temporary mod cost adjustments -- Fixed dynamic play costs not consistently updating -- Added additional methods for adding specific types of resources to the ResourceBank -- Added CardSlot.ClearSlotModification extension method -- Added additional FullAbility helper extension methods for setting act-specific rulebook categories +* Fixed card modifications added to a card's base ice cube card via CardInfo.SetIceCube being ignored +* Fixed PlayableCard.CanPlay not consistently accounting for temporary mod cost adjustments +* Fixed dynamic play costs not consistently updating +* Added additional methods for adding specific types of resources to the ResourceBank +* Added CardSlot.ClearSlotModification extension method +* Added additional FullAbility helper extension methods for setting act-specific rulebook categories # 2.23.5 -- Fixed cards appearing as blank outside Act 1 -- Added extension methods for FullAbility that mirror AbilityInfo extension methods +* Fixed cards appearing as blank outside Act 1 +* Added extension methods for FullAbility that mirror AbilityInfo extension methods # 2.23.4 -- Fixed GemsDraw only considering the player's slots when determining how many cards to draw -- Fixed Act 2 Tutor sequence softlocking when there are no cards to display -- Fixed Act 2 Tutor sequence not displaying cards when you have less than 7 cards remaining in your deck -- Fixed Gemify reducing multiple card costs at once for multicost cards - now only affects 1 as intended -- Fixed emission textures appearing stretched on Giant cards -- Added Gems Cost support for ExtendedActivatedAbilityBehaviour class -- Added extension AbilityManager.FullAbility.FlipYIfOpponent -- Added config option to prevent Act 1 card emissions from rendering above the play costs +* Fixed GemsDraw only considering the player's slots when determining how many cards to draw +* Fixed Act 2 Tutor sequence softlocking when there are no cards to display +* Fixed Act 2 Tutor sequence not displaying cards when you have less than 7 cards remaining in your deck +* Fixed Gemify reducing multiple card costs at once for multicost cards + * Now only affects 1 as intended +* Fixed emission textures appearing stretched on Giant cards +* Added Gems Cost support for ExtendedActivatedAbilityBehaviour class +* Added extension AbilityManager.FullAbility.FlipYIfOpponent +* Added config option to prevent Act 1 card emissions from rendering above the play costs # 2.23.3 -- Fixed custom deck exhaust sequence not performing the requisite checks -- Added 'CanAppearRandomly' bool and associated extension method for custom regions -- All custom regions added through the API are now included in AllRegionsCopy and NewRegions (if addToPool was false then it won't be encounterable in-game like normal) +* Fixed custom deck exhaust sequence not performing the requisite checks +* Added 'CanAppearRandomly' bool and associated extension method for custom regions +* All custom regions added through the API are now included in AllRegionsCopy and NewRegions (if addToPool was false then it won't be encounterable in-game like normal) # 2.23.2 -- Fixed error when trying to create cards that evolve/transform in 4 or more turns -- Fixed Fledgling and Transformer sigil appearing as black boxes when a card evolves/transform in 4 or more turns -- Fixed Part2VanillaCardCost event not being invoked -- Added 'UpdatePlayableCardCosts' event to community patch's Part1CardCostRender and Part2CardCostRender classes -- Added extension methods for PlayableCard and CardInfo: ProvidesBlueGem, ProvidesGreenGem, ProvidesOrangeGem -- Evolve and Transformer icons now support cards that evolve in 4 or more turns -- Wiki: added articles 'Other Features' and 'Triggers and the Order of Operations' -- Wiki: modified starting section of 'Custom Triggers' article -- Documentation: fixed description for IPostCardGettingAttacked stating it triggers before CardGettingAttacked +* Fixed error when trying to create cards that evolve/transform in 4 or more turns +* Fixed Fledgling and Transformer sigil appearing as black boxes when a card evolves/transform in 4 or more turns +* Fixed Part2VanillaCardCost event not being invoked +* Added 'UpdatePlayableCardCosts' event to community patch's Part1CardCostRender and Part2CardCostRender classes +* Added extension methods for PlayableCard and CardInfo: ProvidesBlueGem, ProvidesGreenGem, ProvidesOrangeGem +* Evolve and Transformer icons now support cards that evolve in 4 or more turns +* Wiki: added articles 'Other Features' and 'Triggers and the Order of Operations' +* Wiki: modified starting section of 'Custom Triggers' article +* Documentation: fixed description for IPostCardGettingAttacked stating it triggers before CardGettingAttacked # 2.23.1 -- Fixed non-CardModificationInfo shields not breaking -- Fixed ShieldGeneratorItem not correclty updating visuals -- Fixed DamageShieldBehaviours not initialising before being called -- Added CardInfo.GetAbilityStacks() -- Changed how DamageShieldBehaviour.ResetShield works to be more inline with how vanilla shields work -- Removed some shield-reset-related patches +* Fixed non-CardModificationInfo shields not breaking +* Fixed ShieldGeneratorItem not correclty updating visuals +* Fixed DamageShieldBehaviours not initialising before being called +* Added CardInfo.GetAbilityStacks() +* Changed how DamageShieldBehaviour.ResetShield works to be more inline with how vanilla shields work +* Removed some shield-reset-related patches # 2.23.0 -- Added 'GBC Vanilla Render' config to community patches (false by default) - makes GBC cards render with vanilla cost sprites -- Added 'Vanilla Stacking' config to community patches (false by default) - renders cards with only two (stacking) sigils as they appear in vanilla, eg Spore Mice and Sporedigger -- Added PostCardGettingAttacked custom trigger -- Added BoardManager.GetCards and BoardManager.GetOpenSlots overloads that retrieve from the entire board -- Fixed incorrect rulebook icon scaling in Act 3 -- Fixed rulebook-related null errors when playing during Magnificus' Act -- Fixed slot modification rulebook pages not appearing correctly during Magnificus' Act -- Fixed cards shield sigils not rendering correctly -- DamageShieldBehaviour class now has 'initialised' boolean field -- Highest displayable bone cost value in Act 1 raised from 13+ to 15+ -- Minor tweaks to blood and bone cost icons -- Rewrote SlotAttackSlotPatches transpilers to be cleaner +* Added 'GBC Vanilla Render' config to community patches (false by default) + * Makes GBC cards render with vanilla cost sprites +* Added 'Vanilla Stacking' config to community patches (false by default) + * Renders cards with only two (stacking) sigils as they appear in vanilla, eg Spore Mice and Sporedigger +* Added PostCardGettingAttacked custom trigger +* Added BoardManager.GetCards and BoardManager.GetOpenSlots overloads that retrieve from the entire board +* Fixed incorrect rulebook icon scaling in Act 3 +* Fixed rulebook-related null errors when playing during Magnificus' Act +* Fixed slot modification rulebook pages not appearing correctly during Magnificus' Act +* Fixed cards shield sigils not rendering correctly +* DamageShieldBehaviour class now has 'initialised' boolean field +* Highest displayable bone cost value in Act 1 raised from 13+ to 15+ +* Minor tweaks to blood and bone cost icons +* Rewrote SlotAttackSlotPatches transpilers to be cleaner # 2.22.3 -- Fixed pelt names when a user goes to the trader with modded cards, Examples shown below. +* Fixed pelt names when a user goes to the trader with modded cards, Examples shown below. -- Fixed index error when loading custom challenges -- Publicised ConsumableItemData.SetPrefabModelType +* Fixed index error when loading custom challenges +* Publicised ConsumableItemData.SetPrefabModelType # 2.22.2 -- Added GetEnergyConfig method to community patch's EnergyDrone class - retrieves the current Act's EnergyConfigInfo -- CommunityPatches: Added community config to move pelt price tags to the right of the card -- Experimental: Changed gemified to only reduce a single cost on a card, with priority of Energy > Bones > Gems > Blood -- Fixed positioning errors caused by having multiple custom boss challenge icons -- EnergyConfigInfo's fields can now be modified when initialising a new instance -- Updated installation guide on the ReadMe to match the wiki, added link to wiki. +* Added GetEnergyConfig method to community patch's EnergyDrone class + * Retrieves the current Act's EnergyConfigInfo +* CommunityPatches: Added community config to move pelt price tags to the right of the card +* Experimental: Changed gemified to only reduce a single cost on a card, with priority of Energy > Bones > Gems > Blood +* Fixed positioning errors caused by having multiple custom boss challenge icons +* EnergyConfigInfo's fields can now be modified when initialising a new instance +* Updated installation guide on the ReadMe to match the wiki, added link to wiki. # 2.22.1 -- Added IShieldPreventedDamage and IShieldPreventedDamageInHand ability triggers and interfaces -- Added TriggerBreakShield, wraps BreakShield in an IEnumerator for additional customisation by modders -- Added ICustomExhaustSequence trigger interface for modifying the draw pile exhaustion effect - use with Opponents -- Fixed board slots being uninteractable if a slot effect with a rulebook interactable was reset -- Removed debug logging related to rulebook redirect coordinates +* Added IShieldPreventedDamage and IShieldPreventedDamageInHand ability triggers and interfaces +* Added TriggerBreakShield, wraps BreakShield in an IEnumerator for additional customisation by modders +* Added ICustomExhaustSequence trigger interface for modifying the draw pile exhaustion effect + * Use with Opponents +* Fixed board slots being uninteractable if a slot effect with a rulebook interactable was reset +* Removed debug logging related to rulebook redirect coordinates # 2.22.0 -- Added FullBoon objects for each vanilla Boon -- Added 'AllFullBoons' list to BoonManager -- Added support for boons and items appearing in multiple acts' rulebooks -- Added RuleBookRedirectManager and support for rulebook text redirects/page links -- Added additional methods to RuleBookManager: ItemShouldBeAdded, BoonShouldBeAdded, SlotModShouldBeAdded, GetUnformattedPageId -- Added GetFullBoon and GetFullConsumableItemData extension methods -- Added extension methods for adding text redirects to abilities, stat icons, items, boons, slot modifications, and rulebook pages -- Added ModificationType.SetSharedRulebook - used for slot modifications that should share their rulebook entry with other slot modifications -- Added support for multiple rulebook sprites for slot modifications (SetRulebookP03Sprite, SetRulebookGrimoraSprite, SetRulebookMagnificusSprite) -- Added RuleBookController.Instance.OpenToCustomPage -- Added CustomDiskTalkingCard abstract class -- Added TalkingCardManager.NewDisk and TalkingCardManager.CreateDisk -- Fixed RuleBook construction patches having lower patch priority than intended -- Fixed slot modification interactable being enabled when no rulebook entry exists -- Fixed slot modification rulebook pages not working in Act 3 -- Fixed rulebook sprites being smaller than normal after flipping to a slot modification rulebook page -- Fixed DiskTalkingCards created through the API not correctly working under certain conditions -- Moved ConsumableItemManager patches to a separate ConsumableItemPatches class -- Modified implementation of rulebook fill page logic to let modders patch the API logic - - Patch 'RuleBookManagerPatches.FillPage' to do this -- Tweaked how custom rulebook pages are added and detected -- Wiki: Tweaked page for adding custom rulebook sections -- Wiki: Added section on adding text redirects +* Added FullBoon objects for each vanilla Boon +* Added 'AllFullBoons' list to BoonManager +* Added support for boons and items appearing in multiple acts' rulebooks +* Added RuleBookRedirectManager and support for rulebook text redirects/page links +* Added additional methods to RuleBookManager: ItemShouldBeAdded, BoonShouldBeAdded, SlotModShouldBeAdded, GetUnformattedPageId +* Added GetFullBoon and GetFullConsumableItemData extension methods +* Added extension methods for adding text redirects to abilities, stat icons, items, boons, slot modifications, and rulebook pages +* Added ModificationType.SetSharedRulebook + * Used for slot modifications that should share their rulebook entry with other slot modifications +* Added support for multiple rulebook sprites for slot modifications (SetRulebookP03Sprite, SetRulebookGrimoraSprite, SetRulebookMagnificusSprite) +* Added RuleBookController.Instance.OpenToCustomPage +* Added CustomDiskTalkingCard abstract class +* Added TalkingCardManager.NewDisk and TalkingCardManager.CreateDisk +* Fixed RuleBook construction patches having lower patch priority than intended +* Fixed slot modification interactable being enabled when no rulebook entry exists +* Fixed slot modification rulebook pages not working in Act 3 +* Fixed rulebook sprites being smaller than normal after flipping to a slot modification rulebook page +* Fixed DiskTalkingCards created through the API not correctly working under certain conditions +* Moved ConsumableItemManager patches to a separate ConsumableItemPatches class +* Modified implementation of rulebook fill page logic to let modders patch the API logic + * Patch 'RuleBookManagerPatches.FillPage' to do this +* Tweaked how custom rulebook pages are added and detected +* Wiki: Tweaked page for adding custom rulebook sections +* Wiki: Added section on adding text redirects # 2.21.1 -- Fixed RuleBookManager not syncing when playing with no custom rulebook sections +* Fixed RuleBookManager not syncing when playing with no custom rulebook sections # 2.21.0 -- Fixed ability stacks not rendering -- Fixed rendering error when displaying a card with tribes outside of Act 1 -- Fixed ResetShields not re-setting lostShield to false under certain conditions -- Fixed RemoveMaxEnergy not working as intended -- Fixed custom AudioClips not loading correctly on Mac OSX -- Added RuleBookManager for adding custom rulebook sections (see wiki for more info) -- Added AllModificationInfos, AllModificationTypes, and modification syncing to SlotModificationManager -- Added additional functionality to SlotModificationManager - Infos now store name and GUID -- Added rulebook entry support for slot modifications - use extension method .SetRulebook() when adding your slot modification -- Added more shield-related extensions -- Added some AbilityInfo-related extensions -- Added ShieldManager.AllShieldAbilities and ShieldManager.AllShieldInfos for easier tracking of custom shield abilities -- Added config to the community patches to add a forced red emission to Undead Cat -- Modified Obsolete warning for Helpers.CustomLine to point to Dialogue.CustomLine +* Fixed ability stacks not rendering +* Fixed rendering error when displaying a card with tribes outside of Act 1 +* Fixed ResetShields not re-setting lostShield to false under certain conditions +* Fixed RemoveMaxEnergy not working as intended +* Fixed custom AudioClips not loading correctly on Mac OSX +* Added RuleBookManager for adding custom rulebook sections (see wiki for more info) +* Added AllModificationInfos, AllModificationTypes, and modification syncing to SlotModificationManager +* Added additional functionality to SlotModificationManager + * Infos now store name and GUID +* Added rulebook entry support for slot modifications + * Use extension method .SetRulebook() when adding your slot modification +* Added more shield-related extensions +* Added some AbilityInfo-related extensions +* Added ShieldManager.AllShieldAbilities and ShieldManager.AllShieldInfos for easier tracking of custom shield abilities +* Added config to the community patches to add a forced red emission to Undead Cat +* Modified Obsolete warning for Helpers.CustomLine to point to Dialogue.CustomLine # 2.20.0 -- Updated wiki sections for Adding Map Nodes, and Conditional Map Nodes; moved Special Sequencers section to Opponents -- Fixed issues related to challlenge icon sorting when a boss icon is present -- Fixed TalkingCardManager not properly configuring talking cards in Part 3on the page -- Fixed extension properties for CardModificationInfos saved to the save file not consistently loading -- Fixed cards not shaking when losing a shield -- Fixed ShieldManager.BreakShield not being called when a shielded card takes damage -- Added SlotModificationManager for adding behaviour to card slots; see wiki for more info -- Added SaveFileExtensions class -- Added support for cards costing multiple of the same colour Mox -- Added debugging to GetCustomCardCosts method; please let the API folks know if you receive any warnings/errors marked by '[GetCustomCardCosts]' -- Added StatIconInfo.SetRulebookInfo and StatIconInfo.SetAppliesToStats -- Added NodeData.SelectionCondition's ChallengeIsActive and NumChallengesOfTypeActive -- Added PlayableCard.GetShieldCount<\T>() for getting a specific shield ability's NumShield value -- Added new config to the community patches to reduce the size of the price tags during the Buy Pelts sequence -- Added CardModificationInfo.AddNegateAbilities extension method -- Removed leftover debugging related to boss challenge icons and custom costs -- P03 Face Card Displayer can now show card costs other than energy -- Publiciser warnings from the API and Community Patches no longer appear in the console -- SaveFile.CurrentDeck now returns gbcData.deck in Act 2 -- DeathShieldLatch can longer target cards with an active shield -- Cards with a broken shield return to their default portrait when regaining their shield -- Shield abilities now use NumShields to determine visual sigil stacking -- CardModificationInfo.SetNameReplacement now accepts null value for the name replacement +* Updated wiki sections for Adding Map Nodes, and Conditional Map Nodes; moved Special Sequencers section to Opponents +* Fixed issues related to challlenge icon sorting when a boss icon is present +* Fixed TalkingCardManager not properly configuring talking cards in Part 3on the page +* Fixed extension properties for CardModificationInfos saved to the save file not consistently loading +* Fixed cards not shaking when losing a shield +* Fixed ShieldManager.BreakShield not being called when a shielded card takes damage +* Added SlotModificationManager for adding behaviour to card slots; see wiki for more info +* Added SaveFileExtensions class +* Added support for cards costing multiple of the same colour Mox +* Added debugging to GetCustomCardCosts method; please let the API folks know if you receive any warnings/errors marked by '[GetCustomCardCosts]' +* Added StatIconInfo.SetRulebookInfo and StatIconInfo.SetAppliesToStats +* Added NodeData.SelectionCondition's ChallengeIsActive and NumChallengesOfTypeActive +* Added PlayableCard.GetShieldCount<\T>() for getting a specific shield ability's NumShield value +* Added new config to the community patches to reduce the size of the price tags during the Buy Pelts sequence +* Added CardModificationInfo.AddNegateAbilities extension method +* Removed leftover debugging related to boss challenge icons and custom costs +* P03 Face Card Displayer can now show card costs other than energy +* Publiciser warnings from the API and Community Patches no longer appear in the console +* SaveFile.CurrentDeck now returns gbcData.deck in Act 2 +* DeathShieldLatch can longer target cards with an active shield +* Cards with a broken shield return to their default portrait when regaining their shield +* Shield abilities now use NumShields to determine visual sigil stacking +* CardModificationInfo.SetNameReplacement now accepts null value for the name replacement # 2.19.5 -- Fixed pixel Bones cost icons not appearing when the cost is greater than vanilla amounts -- Fixed interaction where a Gemified card that gives a blue gem doesn't spend the correct resource amount when played -- Fixed active challenges desyncing from the icons when returning to the select challenges screen from a custom screen -- Added pixel icon to Aquasquirrel (courtesy of Zepht) -- Added GetCustomCostAmount extension methods for automatically accounting for whether a custom cost can be negative -- Added support for making custom challenges that use the Final Boss challenge's icon format (occupying the whole column) -- AscensionChallengePaginator's leftArrow and rightArrow fields are now AscensionMenuInteractables -- Changed method name of GenBaseGameChallengs to GenBaseGameChallenges -- Changed Act 1 energy cost choice cardback to match the cost's icon colour -- Changed TestCost.OnPlayed to no longer trigger on negative values -- CustomCardCost.OnPlayed no longer triggers for custom costs with a value of 0 (negative values can still occur) -- Challenges no longer show dependencies/incompatibilies when viewed in the pause menu and end screen +* Fixed pixel Bones cost icons not appearing when the cost is greater than vanilla amounts +* Fixed interaction where a Gemified card that gives a blue gem doesn't spend the correct resource amount when played +* Fixed active challenges desyncing from the icons when returning to the select challenges screen from a custom screen +* Added pixel icon to Aquasquirrel (courtesy of Zepht) +* Added GetCustomCostAmount extension methods for automatically accounting for whether a custom cost can be negative +* Added support for making custom challenges that use the Final Boss challenge's icon format (occupying the whole column) +* AscensionChallengePaginator's leftArrow and rightArrow fields are now AscensionMenuInteractables +* Changed method name of GenBaseGameChallengs to GenBaseGameChallenges +* Changed Act 1 energy cost choice cardback to match the cost's icon colour +* Changed TestCost.OnPlayed to no longer trigger on negative values +* CustomCardCost.OnPlayed no longer triggers for custom costs with a value of 0 (negative values can still occur) +* Challenges no longer show dependencies/incompatibilies when viewed in the pause menu and end screen # 2.19.4 -- Fixed error when retrieving custom card costs from a card with no custom card costs -- Fixed cards with custom card costs using the pixel cost icons in some circumstances -- Fixed modifications to base Pelt choice amounts not being reflected in-game -- Fixed latched sigils not appearing in Act 3 -- Added config to randomise cost choice order -- Added additional functionality to FullCardCost - see wiki and documentation for more info -- Added TestCost class to community patches - can be added to the game by enabling "Test Mode" in the configs -- Added extension methods for setting and getting a custom card cost using the CustomCardCost class instance -- Custom costs now support cost tiers and checking CanBePlayedByTurn2WithHand -- Custom costs' textures now differentiate whether they're from Acts 1, 2, or 3 when storing them post-assemblage -- Card choices when trading Pelts are now positioned correctly for amounts non-divisible by 4 -- Modified Act 1 latch patch logic -- Publicised a number of TradePeltSequence patch methods -- Refactored some TradePeltSequence patches -- Reverted undocumented changes to some SniperFix parameter names in previous version +* Fixed error when retrieving custom card costs from a card with no custom card costs +* Fixed cards with custom card costs using the pixel cost icons in some circumstances +* Fixed modifications to base Pelt choice amounts not being reflected in-game +* Fixed latched sigils not appearing in Act 3 +* Added config to randomise cost choice order +* Added additional functionality to FullCardCost + * See wiki and documentation for more info +* Added TestCost class to community patches + * Can be added to the game by enabling "Test Mode" in the configs +* Added extension methods for setting and getting a custom card cost using the CustomCardCost class instance +* Custom costs now support cost tiers and checking CanBePlayedByTurn2WithHand +* Custom costs' textures now differentiate whether they're from Acts 1, 2, or 3 when storing them post-assemblage +* Card choices when trading Pelts are now positioned correctly for amounts non-divisible by 4 +* Modified Act 1 latch patch logic +* Publicised a number of TradePeltSequence patch methods +* Refactored some TradePeltSequence patches +* Reverted undocumented changes to some SniperFix parameter names in previous version # 2.19.3 -- Fixed index error related to Totem sigils -- Fixed index error related to opponent sniper targeting -- Fixed Shield Latch sigil not displaying the first latched sigil -- Added config to community patches to reset Leshy's eye colour after triggering the grizzly bear sequence during boss fights +* Fixed index error related to Totem sigils +* Fixed index error related to opponent sniper targeting +* Fixed Shield Latch sigil not displaying the first latched sigil +* Added config to community patches to reset Leshy's eye colour after triggering the grizzly bear sequence during boss fights # 2.19.2 -- Fixed activated abilities not being interactable in Act 3 -- Fixed cards with costs above vanilla defaults not displaying -- Added debug logs to AddCustomTribesToList (used to add custom Tribes to the list of obtainable Totem tops) +* Fixed activated abilities not being interactable in Act 3 +* Fixed cards with costs above vanilla defaults not displaying +* Added debug logs to AddCustomTribesToList (used to add custom Tribes to the list of obtainable Totem tops) # 2.19.1 -- Fixed API not retrieving pixel card costs above 5 +* Fixed API not retrieving pixel card costs above 5 # 2.19.0 -- Fixed decals added via temporary mods not being cleared from the base card -- Fixed merged and totem sigils being uninteractable if the icon has been flipped vertically -- Fixed pixel Shapeshifter patch not correctly patching DisguiseOutOfBattle -- Fixed temporary decal mods not being removed in Act 1 -- Fixed softlock in Part 1 during the boon-gaining sequence -- Fixed all copies of a custom challenge becoming activated/deactivated when the page is reloaded -- Fixed Sentry ability softlocking when the base card dies before all Sentry stacks are triggered -- Fixed softlock when talking card dialogue cannot be parsed in certain conditions -- Added public method GetIjiraqDisguises to pixel Shapeshifter patch for easier modification of Shapeshifter for modders -- Added variant of PeltManager.New -- Added variant of PlayableCard.AllAbilities that accounts for negated abilities in TemporaryMods -- Added support for creating custom card costs using new class CustomCardCost; see wiki for more information -- Added ability to remove gems costs from a card using CardModificationInfos -- Added a number of extension methods for CardModificationInfos (RemoveGemsCost, SetCustomCostId, etc) -- Added helpers for getting TextBox.Style from CardInfo.temple or the chosen ambition -- Rewrote CardModificationInfoManager's id system for setting persistent extended properties in a CardModificationInfo's singletonId -- Rewrote pixel Shapeshifter patch to RevealInBattle to hopefully prevent errors in Act 1 -- PeltManager.New now throws an error when getCardChoices is null -- Changed LogLevel of dialogue event insertion message from Info to Debug -- API death cards now use the clean singleton id when creating the death card info mod -- Temporary decal mods are now removed from Act 2 cards instead of being cleared -- Opponent snipers will now target a random slot if there are no opposing cards (previously only targeted the opposing slot) +* Fixed decals added via temporary mods not being cleared from the base card +* Fixed merged and totem sigils being uninteractable if the icon has been flipped vertically +* Fixed pixel Shapeshifter patch not correctly patching DisguiseOutOfBattle +* Fixed temporary decal mods not being removed in Act 1 +* Fixed softlock in Part 1 during the boon-gaining sequence +* Fixed all copies of a custom challenge becoming activated/deactivated when the page is reloaded +* Fixed Sentry ability softlocking when the base card dies before all Sentry stacks are triggered +* Fixed softlock when talking card dialogue cannot be parsed in certain conditions +* Added public method GetIjiraqDisguises to pixel Shapeshifter patch for easier modification of Shapeshifter for modders +* Added variant of PeltManager.New +* Added variant of PlayableCard.AllAbilities that accounts for negated abilities in TemporaryMods +* Added support for creating custom card costs using new class CustomCardCost; see wiki for more information +* Added ability to remove gems costs from a card using CardModificationInfos +* Added a number of extension methods for CardModificationInfos (RemoveGemsCost, SetCustomCostId, etc) +* Added helpers for getting TextBox.Style from CardInfo.temple or the chosen ambition +* Rewrote CardModificationInfoManager's id system for setting persistent extended properties in a CardModificationInfo's singletonId +* Rewrote pixel Shapeshifter patch to RevealInBattle to hopefully prevent errors in Act 1 +* PeltManager.New now throws an error when getCardChoices is null +* Changed LogLevel of dialogue event insertion message from Info to Debug +* API death cards now use the clean singleton id when creating the death card info mod +* Temporary decal mods are now removed from Act 2 cards instead of being cleared +* Opponent snipers will now target a random slot if there are no opposing cards (previously only targeted the opposing slot) # 2.18.7 -- Fixed softlock during Act 1's final boss cabin/boons sequence -- Fixed startup errors relating to ShieldManager transpilers -- Fixed resource drone not showing up outside of Act 3 -- Fixed latched sigils not visually disappearing when using RemoveTemporaryMod to remove a latch CardModInfo -- Fixed stack sigil icons not correctly replacing the '1' in stackable sigil icons with the appropriate stack number -- Fixed Act 2 Tutor sequence displaying the wrong number of cards above the max of 42 -- Fixed temporary mods not correctly updating a card's shield count above 1 -- Added extension methods PlayableCard.AllCardModificationInfos(), PlayableCard.RemoveCardModificationInfo() -- Added SpriteType 'PixelStandardButton' -- CustomTriggerFinder now caches the list of non-card triggers before iteration -- ActivatedDamageShieldBehaviour now inherits from DamageShieldBehaviour instead of ActivateAbilityBehaviour -- ActivatedDamageShieldBehaviour now implements the logic from ExtendedActivatedAbilityBehaviour -- Mud Turtle now has a broken shield portrait (identical to its alternate portrait, which is unchanged) -- CardTriggerHandler.RemoveAbility now only destroys the AbilityBehaviour if triggeredAbilities no longer contains the corresponding Ability -- Act 2 Tutor now supports multiple pages of cards +* Fixed softlock during Act 1's final boss cabin/boons sequence +* Fixed startup errors relating to ShieldManager transpilers +* Fixed resource drone not showing up outside of Act 3 +* Fixed latched sigils not visually disappearing when using RemoveTemporaryMod to remove a latch CardModInfo +* Fixed stack sigil icons not correctly replacing the '1' in stackable sigil icons with the appropriate stack number +* Fixed Act 2 Tutor sequence displaying the wrong number of cards above the max of 42 +* Fixed temporary mods not correctly updating a card's shield count above 1 +* Added extension methods PlayableCard.AllCardModificationInfos(), PlayableCard.RemoveCardModificationInfo() +* Added SpriteType 'PixelStandardButton' +* CustomTriggerFinder now caches the list of non-card triggers before iteration +* ActivatedDamageShieldBehaviour now inherits from DamageShieldBehaviour instead of ActivateAbilityBehaviour +* ActivatedDamageShieldBehaviour now implements the logic from ExtendedActivatedAbilityBehaviour +* Mud Turtle now has a broken shield portrait (identical to its alternate portrait, which is unchanged) +* CardTriggerHandler.RemoveAbility now only destroys the AbilityBehaviour if triggeredAbilities no longer contains the corresponding Ability +* Act 2 Tutor now supports multiple pages of cards # 2.18.6 -- Fixed Royal fight softlocking if config option 'Hide Act 1 Scenery' is set to true -- Fixed activated custom challenges not remaining activated when returning to the challenge screen -- Fixed TransformIntoCardInHand and TransformIntoCardAboveHand not checking for TriggersOncePerStack -- Added missing null checks to ResourceDrone patches -- Added pixel icon to Transformer -- Transformer sigil icon will now display the number of turns till evolution if it's greater than 1 -- Transformer and Fledgling sigils now correctly update their display when evolving into another card with the Fledgling/Transformer sigil -- Certain shield-giving effects no longer reset shields to prevent incorrect shield totals -- Improved the 'Custom Card Costs' section of the wiki +* Fixed Royal fight softlocking if config option 'Hide Act 1 Scenery' is set to true +* Fixed activated custom challenges not remaining activated when returning to the challenge screen +* Fixed TransformIntoCardInHand and TransformIntoCardAboveHand not checking for TriggersOncePerStack +* Added missing null checks to ResourceDrone patches +* Added pixel icon to Transformer +* Transformer sigil icon will now display the number of turns till evolution if it's greater than 1 +* Transformer and Fledgling sigils now correctly update their display when evolving into another card with the Fledgling/Transformer sigil +* Certain shield-giving effects no longer reset shields to prevent incorrect shield totals +* Improved the 'Custom Card Costs' section of the wiki # 2.18.5 -- Fixed DrawCopyOnDeath creating warnings in the console -- Fixed talking cards locking the camera view when obtained during the Trapper boss's final phase -- Fixed ResourceDrone softlocking during Leshy's goodbye sequence if ConfigDefaultDrone is false -- Added missing null checks -- Added PlayableCard.GetStatIconHealthBuffs() -- Added PlayableCard.TransformIntoCardAboveHand() - variant of TransformIntoCardInHand that incorporates MoveCardAboveHand -- Added FullAbility.SetExtendedProperty for setting an AbilityInfo's custom property during ability creation -- Reverted change to resource drone preventing it from being parented to the scale outside of Act 1 -- Improved visual fix for the full pack Pack Rat sequence +* Fixed DrawCopyOnDeath creating warnings in the console +* Fixed talking cards locking the camera view when obtained during the Trapper boss's final phase +* Fixed ResourceDrone softlocking during Leshy's goodbye sequence if ConfigDefaultDrone is false +* Added missing null checks +* Added PlayableCard.GetStatIconHealthBuffs() +* Added PlayableCard.TransformIntoCardAboveHand() + * Variant of TransformIntoCardInHand that incorporates MoveCardAboveHand +* Added FullAbility.SetExtendedProperty for setting an AbilityInfo's custom property during ability creation +* Reverted change to resource drone preventing it from being parented to the scale outside of Act 1 +* Improved visual fix for the full pack Pack Rat sequence # 2.18.4 -- Fixed Sniper sigil targeting the wrong side of the board -- Fixed placeholder tribe choice icons being placed incorrectly -- Auto-gen tribe choice texture is now only created if the tribe can be found in tribe choices +* Fixed Sniper sigil targeting the wrong side of the board +* Fixed placeholder tribe choice icons being placed incorrectly +* Auto-gen tribe choice texture is now only created if the tribe can be found in tribe choices # 2.18.3 -- Fixed resource drone behaving incorrectly outside of Act 1 -- Added null checks to various custom triggers -- Added more extension methods for CardInfo and AbilityInfo -- Added PlayableCard extension methods: AddShieldCount(Ability), AddShieldCount\() and AddShieldCount(Ability), RemoveShieldCount\() - - These affect the internal numShields field, and do NOT add or remove ability stacks -- Added alternate portrait 'SacrificablePortrait' for when a card can be sacrificed in Act 1 or Act 2 (part of the SetShaking method) -- Added methods for getting the emissive portraits for extra alt portraits (EmissiveSteelTrapPortrait(), EmissiveBrokenShieldPortrait(), etc.) -- Expanded SniperFix sniper logic with additional methods for easier patching and modification: - - DoSniperLogic() - controls whether to use player or opponent sniper logic - - DoAttackTargetSlotsLogic() - controls attack logic for each target slot - - GetValidTargets() - returns the list of card slot the player and opponent can target - - PlayerTargetSelectedCallback() - called when the player selects a valid target - - PlayerSlotCursorEnterCallback() - called when the player's cursor enters a slot - - OpponentSelectTarget() - returns a card slot for the opponent to target and attack -- Revamped the wiki to (hopefully) make it easier to navigate and read through +* Fixed resource drone behaving incorrectly outside of Act 1 +* Added null checks to various custom triggers +* Added more extension methods for CardInfo and AbilityInfo +* Added PlayableCard extension methods: AddShieldCount(Ability), AddShieldCount\() and AddShieldCount(Ability), RemoveShieldCount\() + * These affect the internal numShields field, and do NOT add or remove ability stacks +* Added alternate portrait 'SacrificablePortrait' for when a card can be sacrificed in Act 1 or Act 2 (part of the SetShaking method) +* Added methods for getting the emissive portraits for extra alt portraits (EmissiveSteelTrapPortrait(), EmissiveBrokenShieldPortrait(), etc.) +* Expanded SniperFix sniper logic with additional methods for easier patching and modification: + * DoSniperLogic() + * Controls whether to use player or opponent sniper logic + * DoAttackTargetSlotsLogic() + * Controls attack logic for each target slot + * GetValidTargets() + * Returns the list of card slot the player and opponent can target + * PlayerTargetSelectedCallback() + * Called when the player selects a valid target + * PlayerSlotCursorEnterCallback() + * Called when the player's cursor enters a slot + * OpponentSelectTarget() + * Returns a card slot for the opponent to target and attack +* Revamped the wiki to (hopefully) make it easier to navigate and read through # 2.18.2 -- Fixed abilities marked TriggersOncePerStack not actually triggering once per stack on evolution -- Fixed CardManager.Remove not actually removing cards -- Fixed mods on card clones being lost during card sync -- Added extension methods for setting the emissions for SteelTrap and BrokenShield alt portraits -- Added Config to disable boss scenery for optimization purposes -- Exposed EncounterManager.NewEncounters so JSONLoader may replace existing Encounters -- Refactored Act 1 energy drone movement logic, added support for 'immediate' bool (Default Drone must be true) -- Act 1 energy drone game object is now named 'Part1ResourceDrone' -- Act 1 energy drone is now correctly synced with the scale when Default Drone config is false +* Fixed abilities marked TriggersOncePerStack not actually triggering once per stack on evolution +* Fixed CardManager.Remove not actually removing cards +* Fixed mods on card clones being lost during card sync +* Added extension methods for setting the emissions for SteelTrap and BrokenShield alt portraits +* Added Config to disable boss scenery for optimization purposes +* Exposed EncounterManager.NewEncounters so JSONLoader may replace existing Encounters +* Refactored Act 1 energy drone movement logic, added support for 'immediate' bool (Default Drone must be true) +* Act 1 energy drone game object is now named 'Part1ResourceDrone' +* Act 1 energy drone is now correctly synced with the scale when Default Drone config is false # 2.18.1 -- Fixed BoxCollider null reference during Act 3 Build-A-Card-Sequencer -- Fixed Act 3 bone displayer screen changing to static whenever P03 changes their face -- Added TryGetGuidAndKeyEnumValue for getting the mod GUID and key from enum value -- Custom regions now store their mod GUID +* Fixed BoxCollider null reference during Act 3 Build-A-Card-Sequencer +* Fixed Act 3 bone displayer screen changing to static whenever P03 changes their face +* Added TryGetGuidAndKeyEnumValue for getting the mod GUID and key from enum value +* Custom regions now store their mod GUID # 2.18.0 -- Fixed SetPixelAbilityIcon() not accepting 22x10 textures for activated abilities -- Fixed IModifyDamageTaken priority sorting being reversed -- Fixed null errors in TakeDamage and custom trigger calls -- Added extension methods for getting emission portraits, setting animated portrait -- Added CustomFields helper for associating data with objects or classes -- Added IModifyDirectDamage, IOnTurnEndInQueue custom triggers -- Custom Tribes now store their name and GUID +* Fixed SetPixelAbilityIcon() not accepting 22x10 textures for activated abilities +* Fixed IModifyDamageTaken priority sorting being reversed +* Fixed null errors in TakeDamage and custom trigger calls +* Added extension methods for getting emission portraits, setting animated portrait +* Added CustomFields helper for associating data with objects or classes +* Added IModifyDirectDamage, IOnTurnEndInQueue custom triggers +* Custom Tribes now store their name and GUID # 2.17.0 -- Fixed card extension GetAbilityStacks() being able to return a negative value; minimum value is now capped at 0 -- Added ability interfaces IModifyDamageTaken, IPreTakeDamage, which trigger at the start of PlayableCard.TakeDamage -- Added PlayableCard extension method ResetShield(Ability) for only resetting shields belonging to a certain ability -- Added ShieldManager class and changed how shields are managed in the game's logic -- Added abstract classes DamageShieldBehaviour and ActivatedDamageShieldBehaviour -- Added support for adding alternate portraits for SteelTrap activation and broken shields -- Added portrait setters SetSteelTrapPortrait(), SetBrokenShieldPortrait(), SetPixelSteelTrapPortrait(), SetPixelBrokenShieldPortrait() -- Added support for adding new language translations -- Added AbilityInfo extension method SetHideSingleStacks(), affecting how stacking sigils are affected by being hidden (see wiki) -- DeathShield ability now has a custom AbilityBehaviour attached to it -- DeathShield ability is no longer passive, and can stack -- TakeDamage trigger now requires damage to be above 0 to activate -- Cards can no longer lose shields from attacks that deal 0 damage -- Damage dealt to cards can no longer go below 0 -- Updated the wiki with sections on the additions -- Zombie Parrot is now part of the Avian tribe +* Fixed card extension GetAbilityStacks() being able to return a negative value; minimum value is now capped at 0 +* Added ability interfaces IModifyDamageTaken, IPreTakeDamage, which trigger at the start of PlayableCard.TakeDamage +* Added PlayableCard extension method ResetShield(Ability) for only resetting shields belonging to a certain ability +* Added ShieldManager class and changed how shields are managed in the game's logic +* Added abstract classes DamageShieldBehaviour and ActivatedDamageShieldBehaviour +* Added support for adding alternate portraits for SteelTrap activation and broken shields +* Added portrait setters SetSteelTrapPortrait(), SetBrokenShieldPortrait(), SetPixelSteelTrapPortrait(), SetPixelBrokenShieldPortrait() +* Added support for adding new language translations +* Added AbilityInfo extension method SetHideSingleStacks(), affecting how stacking sigils are affected by being hidden (see wiki) +* DeathShield ability now has a custom AbilityBehaviour attached to it +* DeathShield ability is no longer passive, and can stack +* TakeDamage trigger now requires damage to be above 0 to activate +* Cards can no longer lose shields from attacks that deal 0 damage +* Damage dealt to cards can no longer go below 0 +* Updated the wiki with sections on the additions +* Zombie Parrot is now part of the Avian tribe # 2.16.1 -- Gem Shield sigil now visually applies the Armoured sigil to cards in Act 1 +* Gem Shield sigil now visually applies the Armoured sigil to cards in Act 1 # 2.16.0 -- Added interface IGetAttackingSlots for altering the order cards attack in, see the wiki for more information -- Added out-of-turn (cards attacking outside of their owner's turn) damage support -- Added PlayableCard extension method GetAbilityStacks() -- Added PlayableCard extension method TransformIntoCardInHand() -- Moved SlotAttackSlotFixes and SelfAttackDamagePatch from community patches to the API, renamed to SlotAttackSlotPatches and DoCombatPhasePatches respectively -- Made community patch method RandomAbilityPatches.GetRandomAbility public +* Added interface IGetAttackingSlots for altering the order cards attack in, see the wiki for more information +* Added out-of-turn (cards attacking outside of their owner's turn) damage support +* Added PlayableCard extension method GetAbilityStacks() +* Added PlayableCard extension method TransformIntoCardInHand() +* Moved SlotAttackSlotFixes and SelfAttackDamagePatch from community patches to the API, renamed to SlotAttackSlotPatches and DoCombatPhasePatches respectively +* Made community patch method RandomAbilityPatches.GetRandomAbility public # 2.15.2 -- Fixed cards not evolving correctly if the Fledgling sigil was obtained via card mods (card merge, totem, etc.) -- Moved the Squirrel Orbit community patch into the main API -- Added SetTransformCardId(), GetTransformerCardId() for controlling the Transformer evolution separate of the standard evolution -- Transformer sigil will now also check for a card's API-set TransformerCardId if no card mod is found -- Transformer sigil now also adjusts Blood and Bone costs when transforming -- Transformer sigil now correctly works for cards without a defined evolution/transformation +* Fixed cards not evolving correctly if the Fledgling sigil was obtained via card mods (card merge, totem, etc.) +* Moved the Squirrel Orbit community patch into the main API +* Added SetTransformCardId(), GetTransformerCardId() for controlling the Transformer evolution separate of the standard evolution +* Transformer sigil will now also check for a card's API-set TransformerCardId if no card mod is found +* Transformer sigil now also adjusts Blood and Bone costs when transforming +* Transformer sigil now correctly works for cards without a defined evolution/transformation # 2.15.1 -- Fixed Transformer sigil disappearing upon transformation in certain scenarios -- Fixed Act 3 Bone Display checking the wrong card cost, resulting in the display always appearing -- Fixed Act 3 Bone Display null error in certain Acts +* Fixed Transformer sigil disappearing upon transformation in certain scenarios +* Fixed Act 3 Bone Display checking the wrong card cost, resulting in the display always appearing +* Fixed Act 3 Bone Display null error in certain Acts # 2.15.0 -- Fixed friend cards created by G0LLY not having any mods -- Reverted previous change to cloned CardInfos -- Tweaked RandomAbilityPatches to hopefully prevent obtaining sigils already possessed by the card -- Added cost display support for Act 3 -- Added bone counter for Act 3 +* Fixed friend cards created by G0LLY not having any mods +* Reverted previous change to cloned CardInfos +* Tweaked RandomAbilityPatches to hopefully prevent obtaining sigils already possessed by the card +* Added cost display support for Act 3 +* Added bone counter for Act 3 # 2.14.5 -- Cloned CardInfos now only copy over Gemify mods, unless they possess BountyHunterInfo/DeathCardInfo/BuildACardInfo -- Fixed certain card mods duplicating when the card evolve -- Added ResourcesManager.RemoveMaxEnergy, ResourcesManager.ShowRemoveMaxEnergy extension methods +* Cloned CardInfos now only copy over Gemify mods, unless they possess BountyHunterInfo/DeathCardInfo/BuildACardInfo +* Fixed certain card mods duplicating when the card evolve +* Added ResourcesManager.RemoveMaxEnergy, ResourcesManager.ShowRemoveMaxEnergy extension methods # 2.14.4 -- Fixed the first energy cell remaining closed in Act 1 when battle starts -- Added new field to PeltManager.PeltData 'peltTierName' used when trading pelts -- Added extension method PeltData.SetTierName -- The Trader will now speak the correct name of custom pelts when trading with them -- Added DialogueManager.GenerateTraderPeltsEvent for creating custom dialogue events spoken by the Trader when trading a custom pelt -- Added DialogueManager.GenerateRegionIntroEvent for creating the dialogue event played upon entering a custom region +* Fixed the first energy cell remaining closed in Act 1 when battle starts +* Added new field to PeltManager.PeltData 'peltTierName' used when trading pelts +* Added extension method PeltData.SetTierName +* The Trader will now speak the correct name of custom pelts when trading with them +* Added DialogueManager.GenerateTraderPeltsEvent for creating custom dialogue events spoken by the Trader when trading a custom pelt +* Added DialogueManager.GenerateRegionIntroEvent for creating the dialogue event played upon entering a custom region # 2.14.3 -- Fixed Act 2 bug relating to stackable sigils and activated sigils in the deck display menu -- Fixed dynamic costs still not working in Act 2 -- Fixed dynamic gem costs checking ResourcesManager instead of OpponentGemsManager for opponent cards -- Fixed dynamic costs not checking for owned blue gems -- Fixed dynamic costs not updating energy display correctly -- Changed dynamic costs to patch SetInfo instead of Awake -- Re-added dynamic cost error messages for when the card or card info is null -- Added ResourcesManager.Instance.GemsOfType(GemType) to check for owned gems of the specified type +* Fixed Act 2 bug relating to stackable sigils and activated sigils in the deck display menu +* Fixed dynamic costs still not working in Act 2 +* Fixed dynamic gem costs checking ResourcesManager instead of OpponentGemsManager for opponent cards +* Fixed dynamic costs not checking for owned blue gems +* Fixed dynamic costs not updating energy display correctly +* Changed dynamic costs to patch SetInfo instead of Awake +* Re-added dynamic cost error messages for when the card or card info is null +* Added ResourcesManager.Instance.GemsOfType(GemType) to check for owned gems of the specified type # 2.14.2 -- Fixed Overclock patch not checking for the correct Acts -- Fixed appearance behaviour's Card field always returning null in Act 2 -- Added OverridePixelPortrait virtual method to PixelAppearanceBehaviour to allow for changing card portraits in Act 2 -- Added CardInfo.SetPixelAlternatePortrait() and Cardinfo.GetPixelAlternatePortrait() for storing alternate pixel portraits -- Re-added SetTerrain method without optional bool parameter -- SwitchToAlternatePortrait and SwitchToDefaultPortrait now work in Act 2 using the above system -- Removed cost-related error spam in Act 2 +* Fixed Overclock patch not checking for the correct Acts +* Fixed appearance behaviour's Card field always returning null in Act 2 +* Added OverridePixelPortrait virtual method to PixelAppearanceBehaviour to allow for changing card portraits in Act 2 +* Added CardInfo.SetPixelAlternatePortrait() and Cardinfo.GetPixelAlternatePortrait() for storing alternate pixel portraits +* Re-added SetTerrain method without optional bool parameter +* SwitchToAlternatePortrait and SwitchToDefaultPortrait now work in Act 2 using the above system +* Removed cost-related error spam in Act 2 # 2.14.1 -- Custom tribes are now given a placeholder reward cardback if one isn't provided -- Fixed visual error when flipping a custom tribe choice for a tribe without a custom cardback -- Fixed pixel stat icons not hiding the underlying stat number -- Fixed ChooseTarget null exception -- Fixed opponent cards with mods not being created properly (eg Bounty Hunters) -- Fixed being able to ring the bell in Part 2 during the Tutor sequence -- Fixed GBC packs not checking for onePerDeck when selecting possible cards -- Fixed decals added via temporary mods not clearing from cards in Act 2 -- Changed what vanilla abilities are marked as Act2Modular (see the Part2ModularAbilities file for the full list) -- Removed leftover debug info during start-up -- Added CardInfo.SetCardTemple() -- Added CardModInfo extension methods SetTemporaryDecal and IsTemporaryDecal (primarily for internal use, maybe you'll find a use for it) -- Added GBCPackManager.ModifyGBCPacks function for altering what cards can be found in GBC card packs +* Custom tribes are now given a placeholder reward cardback if one isn't provided +* Fixed visual error when flipping a custom tribe choice for a tribe without a custom cardback +* Fixed pixel stat icons not hiding the underlying stat number +* Fixed ChooseTarget null exception +* Fixed opponent cards with mods not being created properly (eg Bounty Hunters) +* Fixed being able to ring the bell in Part 2 during the Tutor sequence +* Fixed GBC packs not checking for onePerDeck when selecting possible cards +* Fixed decals added via temporary mods not clearing from cards in Act 2 +* Changed what vanilla abilities are marked as Act2Modular (see the Part2ModularAbilities file for the full list) +* Removed leftover debug info during start-up +* Added CardInfo.SetCardTemple() +* Added CardModInfo extension methods SetTemporaryDecal and IsTemporaryDecal (primarily for internal use, maybe you'll find a use for it) +* Added GBCPackManager.ModifyGBCPacks function for altering what cards can be found in GBC card packs # 2.14.0 -- Fixed Sniper duplicating attacks from sigils like Double Strike -- Fixed interaction between Waterborne and Fledgling in Act 2 -- Fixed Cuckoo sigil softlocking in Act 2 when making a Raven Egg -- Fixed sigils added via temporary mods not displaying in Act 2 -- Fixed hiddenAbilities not affecting sigil display in Act 2 -- Fixed Handy sigil visual bug outside of Act 2 -- Fixed Shapeshifter special ability in Act 2 -- Added pixel sprites for Raven Egg and Cuckoo/Broken Egg -- Added ResourceBankManager.AddDecal(), PlayableCard.AddTemporaryMods(), CardModificationInfo.AddDecalIds -- Added AbilityInfo.SetPixelIcon(string pathToArt), CardInfo.RemoveAppearances(), CardInfo.SetDefaultEvolutionName() -- Added DialogueManager.PlayDialogueEventSafe - combines TextDisplayer.PlayDialogueEvent and DialogueHandler.PlayDialogueHandler for multi-act support -- Added support for directly loading AudioClips via the GramophoneManager -- Added support for adding decals to pixel cards via DecalIds -- Added pixel portrait for Ijiraq -- Added support for changing costs midbattle using CardModificationInfos or a HarmonyPatch -- Changed TranspilerHelpers.LogCodeInscryptions to also function as an extension method for List -- FullSpecialTriggeredAbility now stores the ability name and mod GUID -- Temporary mods can now be used to add decals to a card -- CardRenderInfo.OverrideAbilityIcon now works for Act 2 sigils -- CardInfo.SetTerrain() now has optional parameter 'useTerrainLayout', defaulting to true -- Made method used to add stacks to pixel sigils public -- Updated the wiki +* Fixed Sniper duplicating attacks from sigils like Double Strike +* Fixed interaction between Waterborne and Fledgling in Act 2 +* Fixed Cuckoo sigil softlocking in Act 2 when making a Raven Egg +* Fixed sigils added via temporary mods not displaying in Act 2 +* Fixed hiddenAbilities not affecting sigil display in Act 2 +* Fixed Handy sigil visual bug outside of Act 2 +* Fixed Shapeshifter special ability in Act 2 +* Added pixel sprites for Raven Egg and Cuckoo/Broken Egg +* Added ResourceBankManager.AddDecal(), PlayableCard.AddTemporaryMods(), CardModificationInfo.AddDecalIds +* Added AbilityInfo.SetPixelIcon(string pathToArt), CardInfo.RemoveAppearances(), CardInfo.SetDefaultEvolutionName() +* Added DialogueManager.PlayDialogueEventSafe + * Combines TextDisplayer.PlayDialogueEvent and DialogueHandler.PlayDialogueHandler for multi-act support +* Added support for directly loading AudioClips via the GramophoneManager +* Added support for adding decals to pixel cards via DecalIds +* Added pixel portrait for Ijiraq +* Added support for changing costs midbattle using CardModificationInfos or a HarmonyPatch +* Changed TranspilerHelpers.LogCodeInscryptions to also function as an extension method for List +* FullSpecialTriggeredAbility now stores the ability name and mod GUID +* Temporary mods can now be used to add decals to a card +* CardRenderInfo.OverrideAbilityIcon now works for Act 2 sigils +* CardInfo.SetTerrain() now has optional parameter 'useTerrainLayout', defaulting to true +* Made method used to add stacks to pixel sigils public +* Updated the wiki # 2.13.3 -- Fixed null error when opening card packs in Act 2 -- Fixed pixel cards with activated sigils showing the activated sigil icon twice (does not fix the button obscuring sigils) -- Added new helper class GemsManagerHelpers with helper methods: OpponentHasGems, PlayerHasGems -- Changed how Act 2 descriptions are altered to prevent conflicts -- True Scholar now correctly requires a Blue Gem to be owned prior to use +* Fixed null error when opening card packs in Act 2 +* Fixed pixel cards with activated sigils showing the activated sigil icon twice (does not fix the button obscuring sigils) +* Added new helper class GemsManagerHelpers with helper methods: OpponentHasGems, PlayerHasGems +* Changed how Act 2 descriptions are altered to prevent conflicts +* True Scholar now correctly requires a Blue Gem to be owned prior to use # 2.13.2 -- Fixed Hoarder sigil breaking when used by opponents in Act 2 -- Fixed Hodag special ability not working in Act 2 -- Fixed cards marked as AffectedByTidalLock not being killed by Tidal Lock when it's on a giant card -- Added card extension methods SetAffectedByTidalLock and HasAlternatePortrait -- Added ability extension method SetPart2Ability -- Added AbilityCardMetaCategory AbilityManager.Part2Modular -- Added pixel portraits for Empty Vessel and its Gemified variants, Ant, Bee, Dam, Chime, and the Tail cards -- Amorphous sigil now works in Act 2 -- Vessel Printer sigil now works in Act 2 -- Trinket Bearer sigil is now disabled in Act 2 -- Hidden abilities are now properly hidden in Act 2 -- Fledgling sigil now properly shows the required (up to the number 3) in Act 2 -- Fledgling sigil's rulebook description now updates to show the selected card's actual number of required turns -- Squirrel, Aqua Squirrel, and Rabbit are now marked as AffectedByTidalLock -- SteelTrap sigil no longer changes a card's portrait to the closed trap; will now switch to an alternate portrait if it exists +* Fixed Hoarder sigil breaking when used by opponents in Act 2 +* Fixed Hodag special ability not working in Act 2 +* Fixed cards marked as AffectedByTidalLock not being killed by Tidal Lock when it's on a giant card +* Added card extension methods SetAffectedByTidalLock and HasAlternatePortrait +* Added ability extension method SetPart2Ability +* Added AbilityCardMetaCategory AbilityManager.Part2Modular +* Added pixel portraits for Empty Vessel and its Gemified variants, Ant, Bee, Dam, Chime, and the Tail cards +* Amorphous sigil now works in Act 2 +* Vessel Printer sigil now works in Act 2 +* Trinket Bearer sigil is now disabled in Act 2 +* Hidden abilities are now properly hidden in Act 2 +* Fledgling sigil now properly shows the required (up to the number 3) in Act 2 +* Fledgling sigil's rulebook description now updates to show the selected card's actual number of required turns +* Squirrel, Aqua Squirrel, and Rabbit are now marked as AffectedByTidalLock +* SteelTrap sigil no longer changes a card's portrait to the closed trap; will now switch to an alternate portrait if it exists # 2.13.1 -- Fixed custom items falling through reality -- Added card extension method IsAffectedByTidalLock -- Mental Gemnastics sigil now works in Act 1 -- Tidal Lock sigil now works for non-Moon cards +* Fixed custom items falling through reality +* Added card extension method IsAffectedByTidalLock +* Mental Gemnastics sigil now works in Act 1 +* Tidal Lock sigil now works for non-Moon cards # 2.13.0 -- Fixed DontDestroyOnLoad warnings when using custom items -- Fixed weird spacing for Mox cost textures in Act 1 -- Fixed player death cards not inheriting Energy, Mox, or custom costs -- Fixed the hint dialogue for insufficient Energy in Act 1 being the wrong colour -- Fixed ExtendedActivatedAbilityBehaviour discarding negative activation cost modifiers -- Fixed Sniper not accounting for custom sigils that modify attack slots -- Fixed Tutor not working in Act 2 -- Added more extension methods to BoardManager -- Added new card extensions SetGemify and SetGemsCost(params GemType[]) -- Added catch-all cost textures for when Blood or Bones go above 13 -- Added CardModificationInfoManager and DeathCardManager -- Added extended property support and extensions for CardModificationInfo -- Added Blood activation cost support to ExtendedActivatedAbilityBehaviour -- ExtendedActivatedAbilityBehaviour now calls PostActivate() if a card dies from paying the Health cost -- Leshy now recognises death cards with multiple costs in his dialogue -- Leshy will now let you create death cards with up to 8 sigils -- Minor adjustments to some cost textures -- Rearranged order of Mox cost textures to align with order of Mox on the Gem Module -- Removed empty cost textures for Blood, Bones, Energy, Mox from the community patches -- Sniper patch's methods are now public +* Fixed DontDestroyOnLoad warnings when using custom items +* Fixed weird spacing for Mox cost textures in Act 1 +* Fixed player death cards not inheriting Energy, Mox, or custom costs +* Fixed the hint dialogue for insufficient Energy in Act 1 being the wrong colour +* Fixed ExtendedActivatedAbilityBehaviour discarding negative activation cost modifiers +* Fixed Sniper not accounting for custom sigils that modify attack slots +* Fixed Tutor not working in Act 2 +* Added more extension methods to BoardManager +* Added new card extensions SetGemify and SetGemsCost(params GemType[]) +* Added catch-all cost textures for when Blood or Bones go above 13 +* Added CardModificationInfoManager and DeathCardManager +* Added extended property support and extensions for CardModificationInfo +* Added Blood activation cost support to ExtendedActivatedAbilityBehaviour +* ExtendedActivatedAbilityBehaviour now calls PostActivate() if a card dies from paying the Health cost +* Leshy now recognises death cards with multiple costs in his dialogue +* Leshy will now let you create death cards with up to 8 sigils +* Minor adjustments to some cost textures +* Rearranged order of Mox cost textures to align with order of Mox on the Gem Module +* Removed empty cost textures for Blood, Bones, Energy, Mox from the community patches +* Sniper patch's methods are now public # 2.12.0 -- Fixed ExtendedActivatedAbilityBehaviour's Health cost not subtracting Health correctly -- Fixed softlock in Act 1 during death card creation -- Fixed custom cards that start Gemified not working as intended when obtained in-game -- Potentially fixed softlock when making terrain for a region -- Added further checks to challenge icon-related patch to prevent softlocks -- Added decal, appearance behaviour, and Gemified card support for Act 2 cards -- Added Singleton for keeping track of opponent gems -- Added new helper method for creating Sprites from resource files in an assembly -- Added new SpriteType for creating pixel card decals -- Gemified visuals now work correctly for Act 3 opponents -- Cost choice node now offers each Mox colour individually -- Added new config "Default Drone" to change the model and position of the Energy Drone -- Amorphous sigil now activates when used by opponents or obtained via evolution/temp mod -- Owned Mox in Act 1 now updates when a card is hooked by the Angler or via the Hook item +* Fixed ExtendedActivatedAbilityBehaviour's Health cost not subtracting Health correctly +* Fixed softlock in Act 1 during death card creation +* Fixed custom cards that start Gemified not working as intended when obtained in-game +* Potentially fixed softlock when making terrain for a region +* Added further checks to challenge icon-related patch to prevent softlocks +* Added decal, appearance behaviour, and Gemified card support for Act 2 cards +* Added Singleton for keeping track of opponent gems +* Added new helper method for creating Sprites from resource files in an assembly +* Added new SpriteType for creating pixel card decals +* Gemified visuals now work correctly for Act 3 opponents +* Cost choice node now offers each Mox colour individually +* Added new config "Default Drone" to change the model and position of the Energy Drone +* Amorphous sigil now activates when used by opponents or obtained via evolution/temp mod +* Owned Mox in Act 1 now updates when a card is hooked by the Angler or via the Hook item # 2.11.2 -- Fixed starter deck custom unlocks not working -- Fixed card icons not being properly centred for starter decks with 4+ cards -- Cards in Acts 2 and 3 can now display up to 8 sigils -- Blood tokens in Act 3 now appear to the side of the board instead of on it -- Blood tokens now stack on each other when there are more than 4 +* Fixed starter deck custom unlocks not working +* Fixed card icons not being properly centred for starter decks with 4+ cards +* Cards in Acts 2 and 3 can now display up to 8 sigils +* Blood tokens in Act 3 now appear to the side of the board instead of on it +* Blood tokens now stack on each other when there are more than 4 # 2.11.1 -- Fixed regions in Act 1 being out of order -- Fixed the console message concerning custom dialogue events not giving the right amount +* Fixed regions in Act 1 being out of order +* Fixed the console message concerning custom dialogue events not giving the right amount # 2.11.0 -- Refactored how regions are handled by the API to prevent duplicate bosses -- Refactored how bosses are selected to prevent duplicates being encountered -- Changed when modded Ascension data is cleared to allow for editing it post-clear -- Added more descriptive error logs for some commonly encountered errors -- Added config option to reduce the amount of debug info shown in the console -- Added methods to aid in creating encounter turn plans -- Added more methods for interacting with lists, new debug method to aid in making transpilers -- Added ExtendedActivatedAbilityBehaviour class; allows for dynamic costs and Health costs -- Fixed SetOnePerDeck() and SetHideStats() being inaccessible -- Fixed AddCardBlueprint() not setting the replacement card correctly +* Refactored how regions are handled by the API to prevent duplicate bosses +* Refactored how bosses are selected to prevent duplicates being encountered +* Changed when modded Ascension data is cleared to allow for editing it post-clear +* Added more descriptive error logs for some commonly encountered errors +* Added config option to reduce the amount of debug info shown in the console +* Added methods to aid in creating encounter turn plans +* Added more methods for interacting with lists, new debug method to aid in making transpilers +* Added ExtendedActivatedAbilityBehaviour class; allows for dynamic costs and Health costs +* Fixed SetOnePerDeck() and SetHideStats() being inaccessible +* Fixed AddCardBlueprint() not setting the replacement card correctly # 2.10.0 -- Completely revamped PeltManager to be more user friendly (Mod breaking) -- Added LocalizationManager for more language support with mods -- Added helper method for custom pelts to change cards trader -- Pelts offered by Trapper capped at 8. -- Pelts offered by Trapper are now randomized if more than 8 -- Fixed soft lock at trader when having more pelts than cards to offer -- Fixed the campfire fix breaking the normal sequence -- Fixed HasCardMetaCategory returning the inverse of its intended value -- Fixed stackable sigils not showing numbers above 9 +* Completely revamped PeltManager to be more user friendly (Mod breaking) +* Added LocalizationManager for more language support with mods +* Added helper method for custom pelts to change cards trader +* Pelts offered by Trapper capped at 8. +* Pelts offered by Trapper are now randomized if more than 8 +* Fixed soft lock at trader when having more pelts than cards to offer +* Fixed the campfire fix breaking the normal sequence +* Fixed HasCardMetaCategory returning the inverse of its intended value +* Fixed stackable sigils not showing numbers above 9 # 2.9.1 -- Fixed the campfire fix breaking the normal sequence +* Fixed the campfire fix breaking the normal sequence # 2.9.0 -- Added talking card support! -- Moved the "CustomLine" struct outside of the Dialogue.Helpers class. -- Fixed tribe choice node being able to offer vanilla tribes with no cards -- Fixed totem choice node being able to offer tops for vanilla tribes with no cards -- Added fallbacks for tribal choice node if there are less than 3 chooseable tribes -- Added fallback to campfire node if you don't have any cards that can be buffed -- Fixed 'outdated plugins' warning showing up when it shouldn't, tweaked message slightly +* Added talking card support! +* Moved the "CustomLine" struct outside of the Dialogue.Helpers class. +* Fixed tribe choice node being able to offer vanilla tribes with no cards +* Fixed totem choice node being able to offer tops for vanilla tribes with no cards +* Added fallbacks for tribal choice node if there are less than 3 chooseable tribes +* Added fallback to campfire node if you don't have any cards that can be buffed +* Fixed 'outdated plugins' warning showing up when it shouldn't, tweaked message slightly # 2.8.1 -- Added CardInfo extensions for checking CardMetaCategories, cause why not -- Added DialogueManager for custom dialogue for regions and Custom Color support -- Added ResourceBankManager for custom resources. Avoids doing this for every mod -- Deprecated DialogueEventGenerator (Moved to Dialogue Manager) -- Fixed repeating bosses on regions that have multiple boss possibilities -- Fixed custom props not having a renderer on the top parent and breaking loading regions -- Fixed arrows on the challenges select screen being offscreen at certain resolutions -- Fixed tribe choice node being able to offer custom tribes with no cards -- Fixed being able to get custom totem tops for tribes with no cards +* Added CardInfo extensions for checking CardMetaCategories, cause why not +* Added DialogueManager for custom dialogue for regions and Custom Color support +* Added ResourceBankManager for custom resources. Avoids doing this for every mod +* Deprecated DialogueEventGenerator (Moved to Dialogue Manager) +* Fixed repeating bosses on regions that have multiple boss possibilities +* Fixed custom props not having a renderer on the top parent and breaking loading regions +* Fixed arrows on the challenges select screen being offscreen at certain resolutions +* Fixed tribe choice node being able to offer custom tribes with no cards +* Fixed being able to get custom totem tops for tribes with no cards # 2.8.0 -- Added support for custom masks -- Fixed sometimes items use the wrong behaviour -- Added more resource and asset bundle helpers +* Added support for custom masks +* Fixed sometimes items use the wrong behaviour +* Added more resource and asset bundle helpers # 2.7.4 -- Fixed latch fix modifying the base info -- Fixed stackable abilities activating twice when they shouldn't +* Fixed latch fix modifying the base info +* Fixed stackable abilities activating twice when they shouldn't # 2.7.3 -- Fixed sniper fix not accounting for cards with Repulsive ability -- Fixed latch abilities not working in Act 2 -- Added ExtendedProperties for abilities -- Added new ability setter SetTriggersOncePerStack for controlling the behaviour of stackable abilities after a card evolves -- Added new helper methods for creating cards: SetOnePerDeck, SetHideStats -- Added new helper methods for abilities: SetCanStack, SetTriggersOncePerStack, SetActivated, SetPassive, SetConduit, SetConduitCell -- Added new remover methods for cards: RemoveAbilities, RemoveAbilitiesSingle, RemoveTraits, RemoveTribes +* Fixed sniper fix not accounting for cards with Repulsive ability +* Fixed latch abilities not working in Act 2 +* Added ExtendedProperties for abilities +* Added new ability setter SetTriggersOncePerStack for controlling the behaviour of stackable abilities after a card evolves +* Added new helper methods for creating cards: SetOnePerDeck, SetHideStats +* Added new helper methods for abilities: SetCanStack, SetTriggersOncePerStack, SetActivated, SetPassive, SetConduit, SetConduitCell +* Added new remover methods for cards: RemoveAbilities, RemoveAbilitiesSingle, RemoveTraits, RemoveTribes # v2.7.2 -- Added `CanActivateOutsideBattles` extension method to ConsumableItemData so they can be used outside of battles. -- Added Missing Tribe Icon fallback texture for totem tops when a tribe has no icon -- Changed TotemManager to accept a `CompositeTotemPiece` type for custom behaviour other than always a custom icon -- Fixed lag when entering gain consumable item map node -- Fixed crash when using custom consumable items -- Fixed hard lock when getting totem top that doesn't have an icon -- Fixed Pack Rat card object not having the correct background during the item node sequence -- Fixed Latch abilities removing stat boosts when latching a card -- Fixed latched abilities not properly rendering in some acts +* Added `CanActivateOutsideBattles` extension method to ConsumableItemData so they can be used outside of battles. +* Added Missing Tribe Icon fallback texture for totem tops when a tribe has no icon +* Changed TotemManager to accept a `CompositeTotemPiece` type for custom behaviour other than always a custom icon +* Fixed lag when entering gain consumable item map node +* Fixed crash when using custom consumable items +* Fixed hard lock when getting totem top that doesn't have an icon +* Fixed Pack Rat card object not having the correct background during the item node sequence +* Fixed Latch abilities removing stat boosts when latching a card +* Fixed latched abilities not properly rendering in some acts # v2.7.1 -- Changed Pelt Manager to no longer have an interface for future safety! (NOTE This will break all mods with custom pelts!) -- Added Squirrel tribe art (Thanks Drift!) -- Fixed Green Gem stat icon showing as a black square in act 1 -- Fixed Green Gem stat icon not appearing in rulebook -- Fixed Squirrel totem top causing NMA when using custom totem tops -- Fixed being unable to play cards with a Blood cost above 4 via sacrifices +* Changed Pelt Manager to no longer have an interface for future safety! (NOTE This will break all mods with custom pelts!) +* Added Squirrel tribe art (Thanks Drift!) +* Fixed Green Gem stat icon showing as a black square in act 1 +* Fixed Green Gem stat icon not appearing in rulebook +* Fixed Squirrel totem top causing NMA when using custom totem tops +* Fixed being unable to play cards with a Blood cost above 4 via sacrifices # v2.7.0 -- Added support for custom pelts -- Added support for converting audio files to AudioClip objects -- Added support for adding custom tracks to the Gramophone -- Added support for adding custom audio files -- Warning message for outdated plugins now lists the outdated plugins -- Energy Drone now tweens with the scales, kinda -- Fixed visual bug where energy cells didn't start closed in successive battles +* Added support for custom pelts +* Added support for converting audio files to AudioClip objects +* Added support for adding custom tracks to the Gramophone +* Added support for adding custom audio files +* Warning message for outdated plugins now lists the outdated plugins +* Energy Drone now tweens with the scales, kinda +* Fixed visual bug where energy cells didn't start closed in successive battles # v2.6.0 -- Added support for custom consumable items using a choice of a few models -- Added support for custom consumable card in a bottle items -- Added support for custom consumable items with a custom model -- Added more helper extensions for checking abilities, traits, special abilities -- Fixed null instances in Act 2 spamming the console with warnings +* Added support for custom consumable items using a choice of a few models +* Added support for custom consumable card in a bottle items +* Added support for custom consumable items with a custom model +* Added more helper extensions for checking abilities, traits, special abilities +* Fixed null instances in Act 2 spamming the console with warnings # v2.5.3 -- Added support for custom card unlock requirements -- Fixed non-giant cards with Omni Strike not directly attacking their opposing slot when there are no opposing cards -- Fixed cards attacking their own side of the board during combat not adding damage to the correct side of the scale -- Fixed an issue where a challenge would go missing if you had more than 14 installed +* Added support for custom card unlock requirements +* Fixed non-giant cards with Omni Strike not directly attacking their opposing slot when there are no opposing cards +* Fixed cards attacking their own side of the board during combat not adding damage to the correct side of the scale +* Fixed an issue where a challenge would go missing if you had more than 14 installed # v2.5.2 -- Fixed the sentry fix overriding patches to SlotAttackSlot +* Fixed the sentry fix overriding patches to SlotAttackSlot # v2.5.1 -- Reverted part of the sentry fix that was causing problems -- Made it easier to override the default totem head +* Reverted part of the sentry fix that was causing problems +* Made it easier to override the default totem head # v2.5.0 -- Added support for custom totem heads -- Custom Tribes now appear as a totem in the Wood Carver nodes -- Fixes for Sentry ability in Act 1 relating to PackMule, Loose Tail, and enemy totems -- Fixed stacked ability icons causing issues when trying to render numbers on some sigil icons -- Fixed Latches not working in Act 1 +* Added support for custom totem heads +* Custom Tribes now appear as a totem in the Wood Carver nodes +* Fixes for Sentry ability in Act 1 relating to PackMule, Loose Tail, and enemy totems +* Fixed stacked ability icons causing issues when trying to render numbers on some sigil icons +* Fixed Latches not working in Act 1 # v2.4.2 -- Switched to debug version +* Switched to debug version # v2.4.1 -- Fixed Sentry ability not working properly in Act for players or opponents +* Fixed Sentry ability not working properly in Act for players or opponents # v2.4.0 -- Reworked challenges -- Fixed gemified opponent cards not working properly -- Fixed stat icons in Act 3 +* Reworked challenges +* Fixed gemified opponent cards not working properly +* Fixed stat icons in Act 3 # v2.3.0 -- Fixed orange gem not counting towards passive attack -- Fixed PackMule special ability not working on the player's side -- Fixed Mox cost choice node not working -- Fixed boon rulebook and removal -- Fixed tribe choice nodes -- Fixed error caused by passing null when assigning a custom tail portrait -- Improved activated ability fix -- Improved some extensions and attack buffs -- Fixes for starter decks -- Fixes for custom regions, more customisation when creating one -- Added more extensions -- Fixed stat icon rendering for Act 3 +* Fixed orange gem not counting towards passive attack +* Fixed PackMule special ability not working on the player's side +* Fixed Mox cost choice node not working +* Fixed boon rulebook and removal +* Fixed tribe choice nodes +* Fixed error caused by passing null when assigning a custom tail portrait +* Improved activated ability fix +* Improved some extensions and attack buffs +* Fixes for starter decks +* Fixes for custom regions, more customisation when creating one +* Added more extensions +* Fixed stat icon rendering for Act 3 # v2.2.0 -- Added an interface that triggers when cards are facedown -- Updated custom artwork for GBC numbers -- Fixed flipped icons spamming the log with warnings -- Fixed Tribe API breaking mods that use CardbackTexture -- Added custom combat triggers -- Added more custom extensions -- Fixed Latch abilities in Act 1 -- Fixed extension methods for setting custom flipped portrait affecting the wrong card -- Fixed optimisation issues caused by passive attack bufs -- Fixed activated sigils -- Added node manager for custom nodes -- Fixed cards getting buffs after the game ends +* Added an interface that triggers when cards are facedown +* Updated custom artwork for GBC numbers +* Fixed flipped icons spamming the log with warnings +* Fixed Tribe API breaking mods that use CardbackTexture +* Added custom combat triggers +* Added more custom extensions +* Fixed Latch abilities in Act 1 +* Fixed extension methods for setting custom flipped portrait affecting the wrong card +* Fixed optimisation issues caused by passive attack bufs +* Fixed activated sigils +* Added node manager for custom nodes +* Fixed cards getting buffs after the game ends # v2.1.0 -- Fixed blurry portraits when playing on low graphics settings +* Fixed blurry portraits when playing on low graphics settings # v2.0.3 -- Added support for custom tribes and boons -- Added config option to opt of custom cost renders for Act 2 cards -- Refactored and added documentation for CardExtensions +* Added support for custom tribes and boons +* Added config option to opt of custom cost renders for Act 2 cards +* Refactored and added documentation for CardExtensions # v2.0.2 -- Improved the process of creating stat icons to automatically register and add the corresponding special ability -- Added log warnings for improperly registered cards +* Improved the process of creating stat icons to automatically register and add the corresponding special ability +* Added log warnings for improperly registered cards # v2.0.1 -- Bugfix for SaveData +* Bugfix for SaveData # v2.0 -- Rewritten to use base game objects +* Rewritten to use base game objects # v1.13.0 -- Added support for custom card backgrounds, dialogs, encounters and talking cards -- Fixes to abilities loading and stackable custom abilities +* Added support for custom card backgrounds, dialogs, encounters and talking cards +* Fixes to abilities loading and stackable custom abilities # v1.12.1 -- Bugfix so CustomCard doesn't wipe ability information. +* Bugfix so CustomCard doesn't wipe ability information. # v1.12 -- Fixes params. -- Adds feature for special abilities and special stat icons. -- Added support for emissions. +* Fixes params. +* Adds feature for special abilities and special stat icons. +* Added support for emissions. # v1.11 -- Added support for more identifiers +* Added support for more identifiers # v1.10.1 -- Fix for abilities which do not have identifier. +* Fix for abilities which do not have identifier. # v1.10 -- Added ability identifiers. +* Added ability identifiers. # v1.9.1 -- Added support for mox. -- Forced ability texture to point filter. +* Added support for mox. +* Forced ability texture to point filter. # v1.9 -- Added config options for energy. +* Added config options for energy. # v1.8.2 -- Fixed appearanceBehaviour (again). +* Fixed appearanceBehaviour (again). # v1.8.1 -- Fix pixelTex dimensions. +* Fix pixelTex dimensions. # v1.8 ## Not compatible with v1.7.2 -- Changes to using TypeMapper. +* Changes to using TypeMapper. # v1.7.2 -- Fixed error when not adding any abilities. +* Fixed error when not adding any abilities. # v1.7.1 -- Fixed appearance behaviours not loading properly. +* Fixed appearance behaviours not loading properly. # v1.7 -- Added support for custom abilities! +* Added support for custom abilities! # v1.6 -- Changed textures to point filter to reduce blur. +* Changed textures to point filter to reduce blur. # v1.5.2 -- Enabled fix for evolveParams and some other disabled options. +* Enabled fix for evolveParams and some other disabled options. # v1.5.1 -- Fix to accessing private instance for regions. +* Fix to accessing private instance for regions. # v1.5 ## Not compatible with v1.4 -- Changed all references to API including guid. +* Changed all references to API including guid. # v1.4 -- Set up support for customising and adding regions. +* Set up support for customising and adding regions. # v1.3 -- Set up project to work as a library for other plugins to use. +* Set up project to work as a library for other plugins to use. # v1.2.1.1 -- Fixed previous patch. +* Fixed previous patch. # v1.2.1 -- Fixed cards not being inserted into the card pool on chapter select. +* Fixed cards not being inserted into the card pool on chapter select. # v1.2 ## Not compatible with v1.1 -- Added customising default cards through CustomCard. -- Custom cards are added via the **CustomCard** constructor rather than through the **AddCard** method. +* Added customising default cards through CustomCard. +* Custom cards are added via the **CustomCard** constructor rather than through the **AddCard** method. # v1.1 -- Hooked into a much more sensible method to load the cards into the card pool. \ No newline at end of file +* Hooked into a much more sensible method to load the cards into the card pool. diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_blood_1.png b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_1.png new file mode 100644 index 00000000..8ecf3a09 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_1.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_blood_2.png b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_2.png new file mode 100644 index 00000000..d0e83980 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_2.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_blood_3.png b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_3.png new file mode 100644 index 00000000..e172d394 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_3.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_blood_4.png b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_4.png new file mode 100644 index 00000000..16c4c2e5 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_blood_4.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_child.png b/InscryptionAPI/Assets/BaseGameDecals/decal_child.png new file mode 100644 index 00000000..1e5492ec Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_child.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_fungus.png b/InscryptionAPI/Assets/BaseGameDecals/decal_fungus.png new file mode 100644 index 00000000..257e6747 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_fungus.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_smoke.png b/InscryptionAPI/Assets/BaseGameDecals/decal_smoke.png new file mode 100644 index 00000000..6bd48df8 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_smoke.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_smoke_abilityhole.png b/InscryptionAPI/Assets/BaseGameDecals/decal_smoke_abilityhole.png new file mode 100644 index 00000000..79c96158 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_smoke_abilityhole.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_1.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_1.png new file mode 100644 index 00000000..6d5a76a0 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_1.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_2.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_2.png new file mode 100644 index 00000000..ff65c2cf Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_2.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_3.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_3.png new file mode 100644 index 00000000..86b02813 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_3.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_4.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_4.png new file mode 100644 index 00000000..f424a824 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_4.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_5.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_5.png new file mode 100644 index 00000000..93c2b621 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_5.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_6.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_6.png new file mode 100644 index 00000000..6a04dede Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_6.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_main.png b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_main.png new file mode 100644 index 00000000..eceba729 Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_snelk_main.png differ diff --git a/InscryptionAPI/Assets/BaseGameDecals/decal_stitches.png b/InscryptionAPI/Assets/BaseGameDecals/decal_stitches.png new file mode 100644 index 00000000..4127675d Binary files /dev/null and b/InscryptionAPI/Assets/BaseGameDecals/decal_stitches.png differ diff --git a/InscryptionAPI/Card/CardExtensions.cs b/InscryptionAPI/Card/CardExtensions.cs index bdbcf3f5..dd8dcebf 100644 --- a/InscryptionAPI/Card/CardExtensions.cs +++ b/InscryptionAPI/Card/CardExtensions.cs @@ -412,4 +412,5 @@ public static CardInfo RemoveCardMetaCategories(this CardInfo info, params CardM public static bool ModPrefixIs(this CardInfo info, string prefixToMatch) => info.GetExtendedProperty("ModPrefix") == prefixToMatch; #endregion + } diff --git a/InscryptionAPI/Card/CardExtensionsCosts.cs b/InscryptionAPI/Card/CardExtensionsCosts.cs index 3e452018..36ea9330 100644 --- a/InscryptionAPI/Card/CardExtensionsCosts.cs +++ b/InscryptionAPI/Card/CardExtensionsCosts.cs @@ -31,7 +31,7 @@ public static PlayableCard GetPlayableCard(this CardInfo cardInfo) /// public static int BloodCost(this PlayableCard card) { - //Debug.Log($"{card != null} {card?.Info != null} [{card?.GetType()}] {(card as DiskCardGame.Card)?.Info != null}"); + //InscryptionAPIPlugin.Logger.LogInfo($"{card != null} {card?.Info != null} [{card?.GetType()}] {(card as DiskCardGame.Card)?.Info != null}"); if (card != null && card.Info != null) { int originalBloodCost = CostProperties.CostProperties.OriginalBloodCost(card.Info); @@ -42,6 +42,7 @@ public static int BloodCost(this PlayableCard card) foreach (CardModificationInfo mod in card.TemporaryMods) originalBloodCost += mod.bloodCostAdjustment; + //InscryptionAPIPlugin.Logger.LogInfo(originalBloodCost); return originalBloodCost; } @@ -105,11 +106,21 @@ public static List GemsCost(this PlayableCard card) return gemsCost; } + /// + /// Checks if the given PlayableCard is gemified in either its CardInfo or TemporaryMods. + /// + /// True if the PlayableCard is gemified. public static bool IsGemified(this PlayableCard card) => card.Info.Gemified || card.TemporaryMods.Exists((CardModificationInfo x) => x.gemify); + /// + /// Determines if the given PlayableCard's owner possesses a blue gem. Works for the opponent and player. + /// public static bool OwnerHasBlueGem(this PlayableCard card) { return card.OpponentCard ? OpponentGemsManager.Instance.HasGem(GemType.Blue) : ResourcesManager.Instance.HasGem(GemType.Blue); } + /// + /// Whether or not the given PlayableCard is affected by a blue gem and should have its cost reduced. + /// public static bool IsUsingBlueGem(this PlayableCard card) => card.IsGemified() && card.OwnerHasBlueGem(); /// diff --git a/InscryptionAPI/Card/CardManager.cs b/InscryptionAPI/Card/CardManager.cs index b4de2a81..cad99a63 100644 --- a/InscryptionAPI/Card/CardManager.cs +++ b/InscryptionAPI/Card/CardManager.cs @@ -13,6 +13,9 @@ namespace InscryptionAPI.Card; +/// +/// Class for managing adding, retrieving, tracking custom cards added via the API. +/// [HarmonyPatch] public static class CardManager { @@ -21,14 +24,50 @@ private class CardExt // Needs to be defined first so the implicit static constr public readonly Dictionary TypeMap = new(); public readonly Dictionary StringMap = new(); } + /// + /// Class for storing the data for custom portrait Sprites added via the API. + /// + /// + /// Only tracks custom API portraits like sacrificable steel trap, etc. + /// public class CardAltPortraits { + /// + /// Portrait sprite used when calling GetAlternatePortrait in Act 2. + /// public Sprite PixelAlternatePortrait = null; + /// + /// Portrait sprite used when the Steel Trap sigil is triggered. + /// + /// + /// Example: Leaping Trap + /// public Sprite SteelTrapPortrait = null; + /// + /// Portrait sprite used when the Steel Trap sigil is triggered in Act 2. + /// public Sprite PixelSteelTrapPortrait = null; + /// + /// Portrait sprite used when a card's shield breaks. + /// + /// + /// Example: Mud Turtle + /// public Sprite BrokenShieldPortrait = null; + /// + /// Portrait sprite used when a card's shield breaks in Act 2. + /// public Sprite PixelBrokenShieldPortrait = null; + /// + /// Portrait sprite used when a card on the board can be chosen as a sacrifice. + /// + /// + /// Example: Squirrel + /// public Sprite SacrificablePortrait = null; + /// + /// Portrait sprite used when a card on the board can be chosen as a sacrifice in Act 2. + /// public Sprite PixelSacrificablePortrait = null; } private static readonly ConditionalWeakTable CardExtensionProperties = new(); @@ -55,14 +94,16 @@ private static IEnumerable GetBaseGameCards() foreach (CardInfo card in Resources.LoadAll("Data/Cards")) { card.SetBaseGameCard(true); - if (card.name == "Squirrel" || card.name == "AquaSquirrel" || card.name == "Rabbit") + if (card.name == "Squirrel" || card.name == "AquaSquirrel" || card.name == "Rabbit") { card.SetAffectedByTidalLock(); - else if (card.name == "SkeletonParrot") + } + else if (card.name == "SkeletonParrot") { card.AddTribes(Tribe.Bird); - else if (card.name == "MudTurtle") + } + else if (card.name == "MudTurtle") { card.SetBrokenShieldPortrait(card.alternatePortrait); - - yield return card; + } + yield return card; } } @@ -200,7 +241,6 @@ static CardManager() /// /// A copy of all cards in the card pool. /// - /// . public static List AllCardsCopy { get; private set; } = BaseGameCards.ToList(); /// @@ -292,47 +332,130 @@ public static CardInfo New(string modPrefix, string name, string displayName, in } } + /// + /// Retrieves the dictionary of card extended properties associated with the given CardInfo. + /// + /// The CardInfo whose extended properties we wish to retrieve. + /// The extension property dictionary for the given CardInfo. Creates and returns an empty dictionary if none exists. public static Dictionary GetCardExtensionTable(this CardInfo card) => CardExtensionProperties.GetOrCreateValue(card).StringMap; internal static CardAltPortraits GetAltPortraits(this CardInfo card) => CardAlternatePortraits.GetOrCreateValue(card); + /// + /// Retrieves the Sprite for the CardInfo's alternate portrait in Act 2 if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the pixel alternate portrait or null if it doesn't exist. + /// + /// Pixel alternate portraits are added through the API; they are not a vanilla feature. + /// public static Sprite PixelAlternatePortrait(this CardInfo card) { return card.GetAltPortraits().PixelAlternatePortrait; } + /// + /// Retrieves the Sprite for the CardInfo's portrait used when Steel Trap activates if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the Steel Trap portrait or null if it doesn't exist. + /// + /// Steel Trap portraits are added through the API; they are not a vanilla feature. + /// public static Sprite SteelTrapPortrait(this CardInfo card) { return card.GetAltPortraits().SteelTrapPortrait; } + /// + /// Retrieves the Sprite for the CardInfo's portrait emission used when Steel Trap activates if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the Steel Trap portrait emission or null if it doesn't exist. + /// + /// Steel Trap portraits are added through the API; they are not a vanilla feature. + /// public static Sprite EmissiveSteelTrapPortrait(this CardInfo card) { return card.GetAltPortraits().SteelTrapPortrait.GetEmissionSprite(); } + /// + /// Retrieves the Sprite for the CardInfo's Act 2 portrait used when Steel Trap activates if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the pixel Steel Trap portrait or null if it doesn't exist. + /// + /// Pixel Steel Trap portraits are added through the API; they are not a vanilla feature. + /// public static Sprite PixelSteelTrapPortrait(this CardInfo card) { return card.GetAltPortraits().PixelSteelTrapPortrait; } - + /// + /// Retrieves the Sprite for the CardInfo's portrait used when a card's shield breaks if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the broken shield portrait or null if it doesn't exist. + /// + /// Broken shield portraits are added through the API; they are not a vanilla feature. + /// public static Sprite BrokenShieldPortrait(this CardInfo card) { return card.GetAltPortraits().BrokenShieldPortrait; } + /// + /// Retrieves the Sprite for the CardInfo's portrait emission used when a card's shield breaks if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the broken shield portrait emission or null if it doesn't exist. + /// + /// Broken shield portraits are added through the API; they are not a vanilla feature. + /// public static Sprite EmissiveBrokenShieldPortrait(this CardInfo card) { return card.GetAltPortraits().BrokenShieldPortrait.GetEmissionSprite(); } + /// + /// Retrieves the Sprite for the CardInfo's Act 2 portrait used when a card's shield breaks if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the pixel broken shield portrait or null if it doesn't exist. + /// + /// Pixel broken shield portraits are added through the API; they are not a vanilla feature. + /// public static Sprite PixelBrokenShieldPortrait(this CardInfo card) { return card.GetAltPortraits().PixelBrokenShieldPortrait; } - + /// + /// Retrieves the Sprite for the CardInfo's portrait used when a card on the board can be sacrificed if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the sacrificable portrait or null if it doesn't exist. + /// + /// Sacrificable portraits are added through the API; they are not a vanilla feature. + /// public static Sprite SacrificablePortrait(this CardInfo card) { return card.GetAltPortraits().SacrificablePortrait; } + /// + /// Retrieves the Sprite for the CardInfo's portrait emission used when a card on the board can be sacrificed if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the sacrificable portrait emission or null if it doesn't exist. + /// + /// Sacrificable portraits are added through the API; they are not a vanilla feature. + /// public static Sprite EmissiveSacrificablePortrait(this CardInfo card) { return card.GetAltPortraits().SacrificablePortrait.GetEmissionSprite(); } + /// + /// Retrieves the Sprite for the CardInfo's Act 2 portrait used when a card on the board can be sacrificed if it exists. + /// + /// The CardInfo whose portrait we're retrieving. + /// The Sprite for the pixel sacrificable portrait or null if it doesn't exist. + /// + /// Pixel sacrificable portraits are added through the API; they are not a vanilla feature. + /// public static Sprite PixelSacrificablePortrait(this CardInfo card) { return card.GetAltPortraits().PixelSacrificablePortrait; diff --git a/InscryptionAPI/Card/CardModificationInfoManager.cs b/InscryptionAPI/Card/CardModificationInfoManager.cs index 765adb38..abcf0641 100644 --- a/InscryptionAPI/Card/CardModificationInfoManager.cs +++ b/InscryptionAPI/Card/CardModificationInfoManager.cs @@ -6,6 +6,10 @@ namespace InscryptionAPI.Card; +/// +/// Class for managing special CardModificationInfos. +/// These include persistent extended properties and custom costs. +/// [HarmonyPatch] public static class CardModificationInfoManager { @@ -69,6 +73,9 @@ internal static Dictionary GetCardModExtensionTable(this CardMod return exp.StringMap; } + /// + /// Re-executes events and rebuilds the special CardModificationInfo pool. + /// public static void SyncCardMods() { // Re-add persistent properties diff --git a/InscryptionAPI/Card/CostProperties.cs b/InscryptionAPI/Card/CostProperties.cs index d6f2d662..877d85e4 100644 --- a/InscryptionAPI/Card/CostProperties.cs +++ b/InscryptionAPI/Card/CostProperties.cs @@ -131,18 +131,58 @@ public static List ImprovedGemsCost(CardInfo instance) [HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.EnergyCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)] public static int OriginalEnergyCost(CardInfo __instance) { return 0; } + /// + /// Determines whether or not Gemified should reduce the blood cost on a multicost card. + /// + /// The gemified PlayableCard we're checking. + /// The PlayableCard's blood cost. Defaults to using the CardInfo's blood cost if null. + /// True if Gemified should reduce the blood cost by 1. + /// + /// Used for multicost cards to determine which cost Gemified should affect. + /// Priority from first choice to last: Energy, Bones, Mox, Blood + /// public static bool ReduceGemifiedBlood(PlayableCard card, int? bloodCost = null) { return (bloodCost ?? OriginalBloodCost(card.Info)) > 0 && !ReduceGemifiedEnergy(card) && !ReduceGemifiedBones(card) && !ReduceGemifiedMox(card); } + /// + /// Determines whether or not Gemified should reduce the gems cost on a multicost card. + /// + /// The gemified PlayableCard we're checking. + /// The PlayableCard's gems cost. Defaults to using the CardInfo's gems cost if null. + /// True if Gemified should reduce the gems cost by 1. + /// + /// Used for multicost cards to determine which cost Gemified should affect. + /// Priority from first choice to last: Energy, Bones, Mox, Blood + /// public static bool ReduceGemifiedMox(PlayableCard card, List gemsCost = null) { return (gemsCost?.Count ?? ImprovedGemsCost(card.Info).Count) > 0 && !ReduceGemifiedBones(card) && !ReduceGemifiedEnergy(card); } + /// + /// Determines whether or not Gemified should reduce the bone cost on a multicost card. + /// + /// The gemified PlayableCard we're checking. + /// The PlayableCard's bone cost. Defaults to using the CardInfo's bone cost if null. + /// True if Gemified should reduce the bone cost by 1. + /// + /// Used for multicost cards to determine which cost Gemified should affect. + /// Priority from first choice to last: Energy, Bones, Mox, Blood + /// public static bool ReduceGemifiedBones(PlayableCard card, int? bonesCost = null) { return (bonesCost ?? OriginalBonesCost(card.Info)) > 0 && !ReduceGemifiedEnergy(card); } + /// + /// Determines whether or not Gemified should reduce the energy cost on a multicost card. + /// + /// The gemified PlayableCard we're checking. + /// The PlayableCard's energy cost. Defaults to using the CardInfo's energy cost if null. + /// True if Gemified should reduce the energy cost by 1. + /// + /// Used for multicost cards to determine which cost Gemified should affect. + /// Priority from first choice to last: Energy, Bones, Mox, Blood + /// public static bool ReduceGemifiedEnergy(PlayableCard card, int? energyCost = null) { return (energyCost ?? OriginalEnergyCost(card.Info)) > 0; @@ -153,7 +193,7 @@ public static bool ReduceGemifiedEnergy(PlayableCard card, int? energyCost = nul internal static class ChangeCardCostGetter { [HarmonyPatch(typeof(CardInfo), nameof(CardInfo.BloodCost), MethodType.Getter), HarmonyPrefix] - public static bool BloodCost(CardInfo __instance, ref int __result) + private static bool BloodCost(CardInfo __instance, ref int __result) { PlayableCard card = __instance.GetPlayableCard(); //Debug.Log($"{card != null}"); @@ -162,7 +202,7 @@ public static bool BloodCost(CardInfo __instance, ref int __result) } [HarmonyPatch(typeof(CardInfo), nameof(CardInfo.BonesCost), MethodType.Getter), HarmonyPrefix] - public static bool BoneCost(CardInfo __instance, ref int __result) + private static bool BoneCost(CardInfo __instance, ref int __result) { PlayableCard card = __instance.GetPlayableCard(); if (card == null) @@ -173,7 +213,7 @@ public static bool BoneCost(CardInfo __instance, ref int __result) } [HarmonyPatch(typeof(CardInfo), nameof(CardInfo.GemsCost), MethodType.Getter), HarmonyPrefix] - public static bool GemsCost(CardInfo __instance, ref List __result) + private static bool GemsCost(CardInfo __instance, ref List __result) { PlayableCard card = __instance.GetPlayableCard(); __result = card?.GemsCost() ?? CostProperties.ImprovedGemsCost(__instance); @@ -181,7 +221,7 @@ public static bool GemsCost(CardInfo __instance, ref List __result) } [HarmonyPatch(typeof(CardInfo), nameof(CardInfo.EnergyCost), MethodType.Getter), HarmonyPrefix] - public static bool EnergyCost(CardInfo __instance, ref int __result) + private static bool EnergyCost(CardInfo __instance, ref int __result) { PlayableCard card = __instance.GetPlayableCard(); __result = card?.EnergyCost ?? CostProperties.OriginalEnergyCost(__instance); @@ -189,7 +229,7 @@ public static bool EnergyCost(CardInfo __instance, ref int __result) } [HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.EnergyCost), MethodType.Getter), HarmonyPrefix] - public static bool DisableVanillaEnergyCost(PlayableCard __instance, ref int __result) + private static bool DisableVanillaEnergyCost(PlayableCard __instance, ref int __result) { // patch this to follow the same pattern as the other cost methods int energyCost = CostProperties.OriginalEnergyCost(__instance.Info); diff --git a/InscryptionAPI/Card/DefaultBoneGainOnDeath.cs b/InscryptionAPI/Card/DefaultBoneGainOnDeath.cs new file mode 100644 index 00000000..fc40bb0b --- /dev/null +++ b/InscryptionAPI/Card/DefaultBoneGainOnDeath.cs @@ -0,0 +1,135 @@ +using DiskCardGame; +using HarmonyLib; +using System.Collections; +using System.Reflection; +using System.Reflection.Emit; + +namespace InscryptionAPI.Card; + +/// +/// Class for handling exposing the bone-on-death behaviour present in the vanilla PlayableCard.Die method. +/// Allows for modifying the default behaviour through Harmony patches. +/// +[HarmonyPatch] +public class DefaultBoneGainOnDeath { + // this method does not need XML documentation since it's purely internal to make the other two methods work. + // I also don't want to explain how transpilers work. + [HarmonyTranspiler] + [HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.Die), MethodType.Enumerator)] + private static IEnumerable InsertBoneMethodHook(IEnumerable instructions) + { + // === We want to turn this + + // if (!HasAbility(Ability.QuadrupleBones) && slotBeforeDeath.IsPlayerSlot) { + // yield return Singleton.Instance.AddBones(1, slotBeforeDeath); + // } + + // === Into this + + // if (ShouldDoDefaultBoneGain(base.Card, slotBeforeDeath) { + // yield return DoDefaultBoneGain(base.Card, slotBeforeDeath, 1); + // } + + // === + List codes = new(instructions); + + for (int i = 0; i < codes.Count; i++) { + // there are two instances where this is true, but we only care about the first instance + // the second instance will be ignored + if (codes[i].opcode == OpCodes.Ldc_I4_S && codes[i].operand.ToString() == "12") { + /* + * // if (!playableCard.HasAbility(Ability.QuadrupleBones) && 5__2.IsPlayerSlot) + * ldloc.1 + * ldc.i4.s 12 + * call instance bool DiskCardGame.PlayableCard::HasAbility(valuetype DiskCardGame.Ability) + * brtrue.s IL_022f + * + * ldarg.0 + * ldfld class DiskCardGame.CardSlot DiskCardGame.PlayableCard/'d__98'::'5__2' + * callvirt instance bool DiskCardGame.CardSlot::get_IsPlayerSlot() + * brfalse.s IL_022f + * + * = + * + * // if (ShouldDoDefaultBoneGain(playableCard, 5__2) + * ldloc.1 + * ldarg.0 + * ldfld class DiskCardGame.CardSlot DiskCardGame.PlayableCard/'d__98'::'5__2' + * callvirt ShouldDo... + * brfalse.s IL_022f + */ + MethodInfo validationMethod = AccessTools.Method( + typeof(DefaultBoneGainOnDeath), nameof(ShouldDoDefaultBoneGain), + new Type[] { typeof(PlayableCard), typeof(CardSlot) }); + + codes.RemoveAt(i); + codes.RemoveAt(i); + codes.RemoveAt(i); + i += 2; + codes[i] = new CodeInstruction(OpCodes.Callvirt, validationMethod); + + /* + * // <>2__current = Singleton.Instance.AddBones(1, 5__2); + * ldarg.0 + * call !0 class Singleton`1::get_Instance() + * ldc.i4.1 + * ldarg.0 + * ldfld class DiskCardGame.CardSlot DiskCardGame.PlayableCard/'d__98'::'5__2' + * callvirt instance class [netstandard]System.Collections.IEnumerator DiskCardGame.ResourcesManager::AddBones(int32, class DiskCardGame.CardSlot) + * stfld object DiskCardGame.PlayableCard/'d__98'::'<>2__current' + * + * = + * + * // <>2__current = DoDefaultBoneGain(playableCard, slotBeforeDeath, 1); + * ldarg.0 + * ldloc.1 + * ldarg.0 + * ldfld class DiskCardGame.CardSlot DiskCardGame.PlayableCard/'d__98'::'5__2' + * ldc.i4.1 + * callvirt DoDefaultBoneGain + * stfld object DiskCardGame.PlayableCard/'d__98'::'<>2__current' + */ + + MethodInfo executionMethod = AccessTools.Method( + typeof(DefaultBoneGainOnDeath), nameof(DoDefaultBoneGain), + new Type[] { typeof(PlayableCard), typeof(CardSlot), typeof(int) }); + + i += 3; + codes[i] = new CodeInstruction(OpCodes.Ldloc_1); + i++; + + // since codes are taken from the top of the stack, we need to move the ldc.i4.1 to be AFTER we call slotBeforeDeath + codes.RemoveAt(i); + + i += 2; + + codes.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_1)); + i++; + + codes[i] = new CodeInstruction(OpCodes.Callvirt, executionMethod); + break; + } + } + + return codes; + } + + /// + /// Simple boolean check that by default replicates the vanilla check for whether a card should award a Bone on death. + /// + /// The PlayableCard that has died. + /// The CardSlot of card. + /// True if card should give a Bone (calls DoDefaultBoneGain). + public static bool ShouldDoDefaultBoneGain(PlayableCard card, CardSlot slotBeforeDeath) { + return slotBeforeDeath.IsPlayerSlot && !card.HasAbility(Ability.QuadrupleBones); + } + /// + /// A simple call to ResourcesManager.AddBones, intended to give modders some more flexibility over the default death behaviour of player cards giving 1 Bone. + /// + /// The PlayableCard that has died. + /// The CardSlot of card. + /// How many Bones to drop whenever a player's card dies (default is 1). + public static IEnumerator DoDefaultBoneGain(PlayableCard card, CardSlot slotBeforeDeath, int amount) { + yield return Singleton.Instance.AddBones(amount, slotBeforeDeath); + } +} diff --git a/InscryptionAPI/Card/OpponentGemsPatches.cs b/InscryptionAPI/Card/OpponentGemsPatches.cs index c20af144..a65a3117 100644 --- a/InscryptionAPI/Card/OpponentGemsPatches.cs +++ b/InscryptionAPI/Card/OpponentGemsPatches.cs @@ -39,30 +39,34 @@ private static IEnumerator UpdateGemsOnHookGrab(IEnumerator enumerator) private static IEnumerator GainGemsForOpponents(IEnumerator enumerator, GainGem __instance) { yield return enumerator; - if (__instance.Card.OpponentCard && Singleton.Instance != null) - Singleton.Instance.AddGem(__instance.Gem); + if (__instance != null && __instance.Card != null) + if (__instance.Card.OpponentCard && Singleton.Instance != null) + Singleton.Instance.AddGem(__instance.Gem); } [HarmonyPostfix, HarmonyPatch(typeof(GainGem), nameof(GainGem.OnDie))] private static IEnumerator LoseGemsForOpponents(IEnumerator enumerator, GainGem __instance) { yield return enumerator; - if (__instance.Card.OpponentCard && Singleton.Instance != null) - Singleton.Instance.LoseGem(__instance.Gem); + if (__instance != null && __instance.Card != null) + if (__instance.Card.OpponentCard && Singleton.Instance != null) + Singleton.Instance.LoseGem(__instance.Gem); } [HarmonyPostfix, HarmonyPatch(typeof(GainGemTriple), nameof(GainGemTriple.OnResolveOnBoard))] private static IEnumerator GainTripleGemsForOpponents(IEnumerator enumerator, GainGemTriple __instance) { yield return enumerator; - if (__instance.Card.OpponentCard && Singleton.Instance) - Singleton.Instance.AddGems(GemType.Green, GemType.Orange, GemType.Blue); + if (__instance != null && __instance.Card != null) + if (__instance.Card.OpponentCard && Singleton.Instance) + Singleton.Instance.AddGems(GemType.Green, GemType.Orange, GemType.Blue); } [HarmonyPostfix, HarmonyPatch(typeof(GainGemTriple), nameof(GainGemTriple.OnDie))] private static IEnumerator LoseTripleGemsForOpponents(IEnumerator enumerator, GainGemTriple __instance) { yield return enumerator; - if (__instance.Card.OpponentCard && Singleton.Instance != null) - Singleton.Instance.LoseGems(GemType.Green, GemType.Orange, GemType.Blue); + if (__instance != null && __instance.Card != null) + if (__instance.Card.OpponentCard && Singleton.Instance != null) + Singleton.Instance.LoseGems(GemType.Green, GemType.Orange, GemType.Blue); } [HarmonyTranspiler, HarmonyPatch(typeof(DiskRenderStatsLayer), nameof(DiskRenderStatsLayer.RenderCard))] diff --git a/InscryptionAPI/Card/Patches/PatchGenerateTradeCardsWithCostTierWithOptionalDebugLogging.cs b/InscryptionAPI/Card/Patches/PatchGenerateTradeCardsWithCostTierWithOptionalDebugLogging.cs new file mode 100644 index 00000000..c26a2734 --- /dev/null +++ b/InscryptionAPI/Card/Patches/PatchGenerateTradeCardsWithCostTierWithOptionalDebugLogging.cs @@ -0,0 +1,206 @@ +using DiskCardGame; +using HarmonyLib; +using InscryptionAPI.Guid; +using UnityEngine; + +namespace InscryptionAPI.Card.Patches; + +/// +/// A Patch in which injects Loggers and Validation Check Logging into 'GenerateTradeCardsWithCostTier' before it runs to try and debug errors related to it. +/// +[HarmonyPatch(typeof(TradeCardsForPelts), "GenerateTradeCardsWithCostTier")] +internal static class PatchGenerateTradeCardsWithCostTierWithOptionalDebugLogging +{ + /// + /// Makes our system Log 'GenerateTradeCardsWithCostTier' related issues. + /// + /// The Number Of Cards to Generate. + /// The Tier of Cards that should be Generated. + /// The RandomSeed associated with the Generation. + [HarmonyPrefix] + private static void Prefix(int numCards, int tier, int randomSeed) + { + try + { + LogGenerateTradeCardsWithCostTierState(numCards, tier, randomSeed); + } + catch (Exception ex) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] Prefix logging failed. " + $"The original GenerateTradeCardsWithCostTier method will still run. " + $"Exception: {ex}"); + } + } + } + + /// + /// A function use to Log relevant info and checks for 'GenerateTradeCardsWithCostTier'. + /// + /// The Number Of Cards to Generate. + /// The Tier of Cards that should be Generated. + /// The RandomSeed associated with the Generation. + private static void LogGenerateTradeCardsWithCostTierState(int numCards, int requestedTier, int randomSeed) + { + bool flag = requestedTier > 0; + int effectiveTier = Mathf.Max(1, requestedTier); + + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug($"===== GenerateTradeCardsWithCostTier pre-run ===== " + $"numCards={numCards}, " + $"requestedTier={requestedTier}, " + $"effectiveTier={effectiveTier}, " + $"randomSeed={randomSeed}, " + $"flag={flag}"); + } + List learnedCards = CardLoader.LearnedCards; + + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug($"[TradeCardsForPelts Debug] LearnedCards count before vanilla filtering: {learnedCards.Count}"); + } + for (int index = 0; index < learnedCards.Count; index++) + { + CardInfo card = learnedCards[index]; + + if (card == null) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] NULL CardInfo in CardLoader.LearnedCards " + $"at index={index}."); + } + continue; + } + + CardTemple temple; + int costTier; + + try + { + temple = card.temple; + costTier = card.CostTier; + } + catch (Exception ex) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] Failed while evaluating vanilla outer predicate | " + $"index={index} | " + $"card={GetCardName(card)} | " + $"exception={ex}"); + } + continue; + } + + if (temple != CardTemple.Nature || costTier != effectiveTier) + continue; + + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug($"[TradeCardsForPelts Debug] Vanilla ability-filter candidate | " + $"index={index} | " + $"card={GetCardName(card)} | " + $"temple={temple} | " + $"costTier={costTier} | " + $"baseAbilities=[{FormatAbilities(card.abilities)}] | " + $"mods={card.mods?.Count ?? 0}"); + } + List effectiveAbilities; + + try + { + effectiveAbilities = card.Abilities; + } + catch (Exception ex) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] card.Abilities threw while evaluating the " + $"same property vanilla will use | " + $"index={index} | " + $"card={GetCardName(card)} | " + $"exception={ex}"); + } + continue; + } + + if (effectiveAbilities == null) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] NULL effective CardInfo.Abilities list | " + $"index={index} | " + $"card={GetCardName(card)} | " + $"tier={effectiveTier} | " + $"mods={card.mods?.Count ?? 0}"); + } + continue; + } + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug($"[TradeCardsForPelts Debug] Effective abilities | " + $"index={index} | " + $"card={GetCardName(card)} | " + $"abilities=[{FormatAbilities(effectiveAbilities)}]"); + } + for (int abilityIndex = 0; abilityIndex < effectiveAbilities.Count; abilityIndex++) + { + Ability ability = effectiveAbilities[abilityIndex]; + string abilityName = GetGuidAndKey(ability); + + AbilityInfo abilityInfo; + + try + { + abilityInfo = AbilitiesUtil.GetInfo(ability); + } + catch (Exception ex) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] AbilitiesUtil.GetInfo threw | " + $"card={GetCardName(card)} | " + $"tier={effectiveTier} | " + $"abilityIndex={abilityIndex} | " + $"ability={abilityName} | " + $"rawValue={(int)ability} | " + $"exception={ex}"); + } + continue; + } + + if (abilityInfo == null) + { + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogError($"[TradeCardsForPelts Debug] VANILLA NRE CANDIDATE: " + $"AbilitiesUtil.GetInfo returned null | " + $"card={GetCardName(card)} | " + $"tier={effectiveTier} | " + $"abilityIndex={abilityIndex} | " + $"ability={abilityName} | " + $"rawValue={(int)ability} | " + $"baseAbilities=[{FormatAbilities(card.abilities)}] | " + $"effectiveAbilities=[{FormatAbilities(effectiveAbilities)}] | " + $"mods={card.mods?.Count ?? 0} | " + $"vanillaExpression=!AbilitiesUtil.GetInfo(a).opponentUsable"); + } + continue; + } + + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug($"[TradeCardsForPelts Debug] Ability lookup OK | " + $"card={GetCardName(card)} | " + $"tier={effectiveTier} | " + + $"abilityIndex={abilityIndex} | " + $"ability={abilityName} | " + $"rawValue={(int)ability} | " + $"opponentUsable={abilityInfo.opponentUsable}"); + } + } + } + if (InscryptionAPI.InscryptionAPIPlugin.configEnableTraderCostTierBugDebugLogging.Value) + { + InscryptionAPI.InscryptionAPIPlugin.Logger.LogDebug("===== End GenerateTradeCardsWithCostTier pre-run ====="); + } + } + + /// + /// Formats the Passed Abilities as a String. + /// + /// The Abilities to cast into the String. + /// A Formatted Abilities String. + private static string FormatAbilities(IEnumerable abilities) + { + if (abilities == null) + return "null"; + + return string.Join(", ", abilities.Select(GetGuidAndKey)); + } + + /// + /// Gets a GUID and Key associated with a Ability from the passed in Ability Value. + /// + /// The Ability we want to get the String Name of. + /// A String representing the Ability either via the GUID system or the Enum System. + private static string GetGuidAndKey(Ability ability) + { + if (GuidManager.TryGetGuidAndKeyEnumValue(ability, out string guid, out string key)) + return $"{guid}_{key}"; + + return ability.ToString(); + } + + /// + /// Gets the Card Name and DisplayName of the passed in Card. + /// + /// The Card to get the Name of. + /// A string of the Card's Name and DisplayName. + private static string GetCardName(CardInfo card) + { + if (card == null) + return "null"; + + string internalName = string.IsNullOrEmpty(card.name) ? "null" : card.name; + string displayedName = string.IsNullOrEmpty(card.DisplayedNameEnglish) + ? "null" + : card.DisplayedNameEnglish; + + return $"{internalName} ({displayedName})"; + } +} \ No newline at end of file diff --git a/InscryptionAPI/Card/Patches/SteelTrapDeathPatch.cs b/InscryptionAPI/Card/Patches/SteelTrapDeathPatch.cs index db541bb5..0bdb1f1f 100644 --- a/InscryptionAPI/Card/Patches/SteelTrapDeathPatch.cs +++ b/InscryptionAPI/Card/Patches/SteelTrapDeathPatch.cs @@ -5,7 +5,7 @@ using MonoMod.Cil; using UnityEngine; -namespace InscryptionAPI.Card; +namespace InscryptionAPI.Card.Patches; /// /// Patches the Steal Trap Death system to drop a differed pelt on the case the opposing card has the "SteelTrapPelt" extended property. diff --git a/InscryptionAPI/Costs/CardCostManager.cs b/InscryptionAPI/Costs/CardCostManager.cs index 7af707a3..901ccf4b 100644 --- a/InscryptionAPI/Costs/CardCostManager.cs +++ b/InscryptionAPI/Costs/CardCostManager.cs @@ -2,8 +2,10 @@ using GBC; using HarmonyLib; using InscryptionAPI.Card; +using InscryptionAPI.Card.CostProperties; using InscryptionAPI.Dialogue; using InscryptionAPI.Guid; +using InscryptionAPI.Helpers; using Sirenix.Utilities; using System.Collections; using System.Collections.ObjectModel; @@ -13,6 +15,9 @@ namespace InscryptionAPI.CardCosts; +/// +/// Class for managing custom card costs. +/// [HarmonyPatch] public static class CardCostManager { @@ -91,6 +96,11 @@ public class FullCardCost /// public Func GetRewardBackTexture = null; + /// + /// Texture used if this card can show up in a card cost choice node. + /// + /// + /// public Texture RewardBackTexture(int amount) { if (GetRewardBackTexture == null) @@ -183,6 +193,10 @@ public FullCardCost(string modGUID, string costName, Type costBehaviour, TypeManager.Add(costName, costBehaviour); } + /// + /// Creates a deep clone of this FullCardCost. + /// + /// A new clone of this FullCardCost. public FullCardCost Clone() { FullCardCost retval = new( @@ -202,18 +216,29 @@ static CardCostManager() SyncCustomCostList(); }; } - + /// + /// A list of all card costs registered with the API. + /// public static List AllCustomCosts { get; private set; } = new(); internal readonly static ObservableCollection NewCosts = new(); + /// + /// This event runs every time the card card list is resynced. By adding listeners to this event, you can modify card costs that have been added to the list after your mod was loaded. + /// public static event Func, List> ModifyCustomCostList; // you don't have the [colour] gem for that. // no [colour] gem on the table? then you can't play it. // you need at least one [colour] gem on the board in order to play that [card] // play the required [colour] gem... then you can play that. + /// + /// The Hint used to tell the player when they cannot play a card that costs multiple gems of the same colour. + /// public static HintsHandler.Hint notEnoughSameColourGemsHint = new("Hint_NotEnoughSameColourGemsHint", 2); + /// + /// The DialogueEvent that is played when a player cannot play a card that costs multiple gems of the same colour. + /// public static DialogueEvent notEnoghSameColourGemsEvent = DialogueManager.GenerateEvent( InscryptionAPIPlugin.ModGUID, "Hint_NotEnoughSameColourGemsHint", new() { "You don't have enough [v:1] gems for that." }, @@ -223,16 +248,37 @@ static CardCostManager() new() { "You need more [v:1] gems on the board in order to play that [v:0]."}, new() { "Play the required [v:1] gems... then you can play that." } }); + /// + /// Re-executes events and rebuilds the card cost pool. + /// public static void SyncCustomCostList() { AllCustomCosts = NewCosts.Select(a => a.Clone()).ToList(); AllCustomCosts = ModifyCustomCostList?.Invoke(AllCustomCosts) ?? AllCustomCosts; } + /// + /// Retrieves the FullCardCost object associated with the given CustomCardCost class Type. + /// + /// Collection of FullCardCost objects to search through. + /// Type of the CustomCardCost to find the FUllCardCost object of. + /// The FullCardCost associated with the given Type, or null if it cannot be found. + /// + /// Intended to be used with the AllCustomCosts getter as a way of searching through all card costs added by the API. + /// public static FullCardCost CostByBehaviour(this IEnumerable customCosts, Type costBehaviour) { return customCosts.FirstOrDefault(x => x.CostBehaviour == costBehaviour); } + /// + /// Registers a new custom card cost with the API. + /// + /// The GUID of the mod adding this card cost. + /// The internal name of this card cost. + /// The type of the CustomCardCost class for this card cost. + /// The function used to determine what texture to display on cards with this cost. + /// The function used to determine what pixel texture to display on cards with this cost. + /// The FullCardCost object containing the new custom card cost's data. public static FullCardCost Register(string modGUID, string costName, Type costBehaviour, Func getCostTexture, Func getPixelCostTexture) { @@ -518,7 +564,19 @@ private static bool MultipleSameColourMoxSupport(PlayableCard card) private static IEnumerable FixDialogueSoftlock(IEnumerable instructions) { List codes = new(instructions); - //codes.LogCodeInscryptions(); + //codes.LogCodeInstructions(); + + // this part's for fixing blood cost nonsense I encountered when dealing with duplicate CardInfos + // it just changes the call from card.Info.BloodCost to card.BloodCost() + // and avoiding the janky dynamic cost find playablecard nonsenseseses + int bloodCostIdx = codes.FindIndex(x => x.opcode == OpCodes.Callvirt && x.operand.ToString() == "Int32 get_BloodCost()"); + if (bloodCostIdx > 0) { + bloodCostIdx--; + codes.RemoveRange(bloodCostIdx, 4); + MethodInfo playableCardBloodCost = AccessTools.Method(typeof(CardExtensions), nameof(CardExtensions.BloodCost), + new Type[] { typeof(PlayableCard) }); + codes.Insert(bloodCostIdx, new CodeInstruction(OpCodes.Callvirt, playableCardBloodCost)); + } int methodIndex = codes.FindIndex(x => x.opcode == OpCodes.Callvirt && x.operand.ToString() == "System.Collections.IEnumerator PlayCardOnSlot(DiskCardGame.PlayableCard, DiskCardGame.CardSlot)"); if (methodIndex > 0) @@ -663,7 +721,7 @@ private static void GenerateCustomCostChoices(ref List __result, int while (list.Count > 3) list.RemoveAt(SeededRandom.Range(0, list.Count, randomSeed++)); - if (InscryptionAPIPlugin.configRandomChoiceOrder.Value) + if (InscryptionAPIPlugin.configRandomCostChoiceOrder.Value) list = list.Randomize().ToList(); __result = list; @@ -820,4 +878,4 @@ public virtual IEnumerator OnPlayed(int cardCost, PlayableCard playableCard) { yield break; } -} \ No newline at end of file +} diff --git a/InscryptionAPI/Encounters/SpecialSequenceManager.cs b/InscryptionAPI/Encounters/SpecialSequenceManager.cs index e1396663..a42ba506 100644 --- a/InscryptionAPI/Encounters/SpecialSequenceManager.cs +++ b/InscryptionAPI/Encounters/SpecialSequenceManager.cs @@ -11,7 +11,6 @@ public class FullSpecialSequencer { public readonly string Id; - private Type _specialSequencer; public Type SpecialSequencer { get; private set; } public FullSpecialSequencer(string id, Type specialSequencer) diff --git a/InscryptionAPI/Guid/CustomTypePatches.cs b/InscryptionAPI/Guid/CustomTypePatches.cs index 8fb865f3..941bc97f 100644 --- a/InscryptionAPI/Guid/CustomTypePatches.cs +++ b/InscryptionAPI/Guid/CustomTypePatches.cs @@ -8,11 +8,22 @@ namespace InscryptionAPI.Guid; +/// +/// This is the Manager for Custom Type's related to our GUID System. +/// [HarmonyPatch] public static class TypeManager { + /// + /// This is an Internal Dictionary of Type Related Cache. + /// private static readonly Dictionary TypeCache = new(); + /// + /// Use this to add a custom type to the Cache, if another type is passed with the same key, the old value is overwritten. + /// + /// The Key associated with the Custom Type. + /// The Custom Type the Key should be associated with. internal static void Add(string key, Type value) { if (TypeCache.ContainsKey(key)) @@ -26,6 +37,11 @@ internal static void Add(string key, Type value) TypeCache.Add(key, value); } + /// + /// Use this exclusively for replacing a Custom Type that is in the Cache. + /// + /// The Key you want to replace the Custom Type of. + /// The New Type acting as the Custom Type's replacement. internal static void Replace(string key, Type value) { if (TypeCache.ContainsKey(key)) @@ -34,8 +50,16 @@ internal static void Replace(string key, Type value) Add(key, value); } + /// + /// This is a Internal Dictionary of ModId's passed in by other mods. + /// private static readonly Dictionary ModIds = new(); + /// + /// This is a function that gets the Mod ID of a Passed Assembly. + /// + /// The Assembly to get the Mod ID of. + /// The Mod ID of the requested Assembly. private static string GetModIdFromAssembly(Assembly assembly) { if (ModIds.ContainsKey(assembly.FullName)) @@ -57,6 +81,11 @@ private static string GetModIdFromAssembly(Assembly assembly) return default; } + /// + /// Gets the Mod ID from an Assembly Calling the API. + /// + /// The Assembly Calling the API. + /// The Mod ID of the Assembly Calling the API. public static string GetModIdFromCallstack(Assembly callingAssembly) { string cacheVal = GetModIdFromAssembly(callingAssembly); @@ -74,11 +103,25 @@ public static string GetModIdFromCallstack(Assembly callingAssembly) return default; } + /// + /// Used to get the Original Type from a Namespace and a known Type Name. + /// + /// The Namespace associated with the Type. + /// The Type's Name. + /// The Type that was originally used by the given Namespace with that Type's Name. + /// If this is thrown The Patch was unsuccessful. [HarmonyReversePatch(HarmonyReversePatchType.Original)] [HarmonyPatch(typeof(CustomType), nameof(CustomType.GetType), new Type[] { typeof(string), typeof(string) })] [MethodImpl(MethodImplOptions.NoInlining)] public static Type OriginalGetType(string nameSpace, string typeName) { throw new NotImplementedException(); } + /// + /// This Patch implements our custom version of , for Getting our Custom Types. + /// + /// The Namespace associated with the Type. + /// The Type's Name. + /// The Return Value of the Type. + /// The Custom Type associated with the Namespace and given Name for the Type. [HarmonyPatch(typeof(CustomType), nameof(CustomType.GetType), new Type[] { typeof(string), typeof(string) })] [HarmonyPrefix] private static bool GetCustomType(string nameSpace, string typeName, ref Type __result) diff --git a/InscryptionAPI/Guid/GuidManager.cs b/InscryptionAPI/Guid/GuidManager.cs index 199857ee..26053b65 100644 --- a/InscryptionAPI/Guid/GuidManager.cs +++ b/InscryptionAPI/Guid/GuidManager.cs @@ -2,21 +2,47 @@ namespace InscryptionAPI.Guid; +/// +/// This class is the GUID Manager used throughout the API. +/// public static class GuidManager { + /// + /// Gets the fully qualified name of GUID_Value. + /// + /// The GUID or Identifier associated with the given Mod. + /// The Value being paired with the GUID. + /// The Fully Qualified name in the form of GUID_Value public static string GetFullyQualifiedName(string guid, string value) { return $"{guid}_{value}"; } + /// + /// A mapper of Int to Type in the form of a Dictionary. + /// private static readonly Dictionary reverseMapper = new(); + /// + /// Serves as a Lock within + /// private static readonly object lockObject = new object(); + /// + /// The Start Index for our GUID's. + /// public const int START_INDEX = 1000; + /// + /// The Maximum Data Value for the API after all Enum's have been passed. + /// public const string MAX_DATA = "maximumStoredValueForEnum"; + /// + /// Gets the Enum Type associated with a passed Integer. + /// + /// The Specific Number associated with the Type we are after from the . + /// The Type associated with the passed Number. public static Type GetEnumType(int number) { reverseMapper.TryGetValue(number, out var res); @@ -48,6 +74,11 @@ unsafe public static List GetValues() where T : unmanaged, System.Enum return itemList; } + /// + /// Gets the Enum Value with the passed GUID and Value. + /// + /// If successful returns the Enum Value + /// Thrown when our GUID system does not support the associated Type. unsafe public static T GetEnumValue(string guid, string value) where T : unmanaged, System.Enum { if (sizeof(T) != sizeof(int)) @@ -75,6 +106,14 @@ unsafe public static T GetEnumValue(string guid, string value) where T : unma return *(T*)&enumValue; } + /// + /// Attempts to get the GUID and Key associated with an Enum Value's Name. + /// + /// The Value we want to get the GUID and Key from. + /// The GUID found to be associated with the Value. + /// The Key found to be associated with the Passed in Value. + /// The Type of the Enum. + /// If True the GUID and Key associated with the Value were found successfully and are valid for use. public static bool TryGetGuidAndKeyEnumValue(T value, out string guid, out string key) where T : System.Enum { string prefix = $"{typeof(T).Name}"; diff --git a/InscryptionAPI/Helpers/AssetBundleHelper.cs b/InscryptionAPI/Helpers/AssetBundleHelper.cs index 481daecd..b91a0ff2 100644 --- a/InscryptionAPI/Helpers/AssetBundleHelper.cs +++ b/InscryptionAPI/Helpers/AssetBundleHelper.cs @@ -2,8 +2,19 @@ namespace InscryptionAPI.Helpers; +/// +/// A Helper Set related to the . +/// public static class AssetBundleHelper { + /// + /// A function that attempts to get a Prefab of Type T from the given . + /// + /// The we want to get a Prefab out of. + /// The Name of the specific Prefab we are after. + /// The Fetched Prefab from the , if it fails we return Default(T), e.g. the Null associated with the given Type. + /// The Type in which is associated with the Prefab itself. + /// False if we fail, true if we successfully returned a Prefab associated with Type T. public static bool TryGet(AssetBundle bundle, string prefabName, out T prefab) where T : UnityObject { if (bundle == null) @@ -13,11 +24,8 @@ public static bool TryGet(AssetBundle bundle, string prefabName, out T prefab return false; } - // Get object from bundle prefab = bundle.LoadAsset(prefabName); - - // Unload bundle but don't unload the assets - bundle.Unload(false); + bundle.Unload(false); // Does not unload assets, just the Bundle. if (prefab == null) { @@ -28,6 +36,14 @@ public static bool TryGet(AssetBundle bundle, string prefabName, out T prefab return true; } + /// + /// A function that attempts to get a Prefab of Type T from the given path to the . + /// + /// The path to the + /// The Name of the specific Prefab we are after. + /// The Fetched Prefab from the , if it fails we return Default(T), e.g. the Null associated with the given Type. + /// The Type in which is associated with the Prefab itself. + /// False if we fail, true if we successfully returned a Prefab associated with Type T. public static bool TryGet(string pathToAssetBundle, string prefabName, out T prefab) where T : UnityObject { AssetBundle bundle = AssetBundle.LoadFromFile(pathToAssetBundle); @@ -38,11 +54,8 @@ public static bool TryGet(string pathToAssetBundle, string prefabName, out T return false; } - // Get object from bundle prefab = bundle.LoadAsset(prefabName); - - // Unload bundle but don't unload the assets - bundle.Unload(false); + bundle.Unload(false); // Does not unload assets, just the Bundle. if (prefab == null) { @@ -53,6 +66,14 @@ public static bool TryGet(string pathToAssetBundle, string prefabName, out T return true; } + /// + /// A function that attempts to get a Prefab of Type T from the given Memory associated with the . + /// + /// A array in the form of byte[] representing the Memory associated with a . + /// The Name of the specific Prefab we are after. + /// The Fetched Prefab from the , if it fails we return Default(T), e.g. the Null associated with the given Type. + /// The Type in which is associated with the Prefab itself. + /// False if we fail, true if we successfully returned a Prefab associated with Type T. public static bool TryGet(byte[] resources, string prefabName, out T prefab) where T : UnityObject { AssetBundle bundle = AssetBundle.LoadFromMemory(resources); @@ -63,11 +84,8 @@ public static bool TryGet(byte[] resources, string prefabName, out T prefab) return false; } - // Get object from bundle prefab = bundle.LoadAsset(prefabName); - - // Unload bundle but don't unload the assets - bundle.Unload(false); + bundle.Unload(false); // Does not unload assets, just the Bundle. if (prefab == null) { diff --git a/InscryptionAPI/Helpers/CustomFields.cs b/InscryptionAPI/Helpers/CustomFields.cs index 4091247e..71ac90d5 100644 --- a/InscryptionAPI/Helpers/CustomFields.cs +++ b/InscryptionAPI/Helpers/CustomFields.cs @@ -3,11 +3,15 @@ namespace InscryptionAPI.Helpers; /// -/// Allows for an easy way to add custom fields to an object, or to an entire class. +/// A Helper Object for Custom Fields. /// +/// Allows for an easy way to add custom fields to an object, or to an entire class. public static class CustomFields { - static ConditionalWeakTable> objectFields = new ConditionalWeakTable>(); + /// + /// A ConditionalWeakTable representing our CustomFields System. + /// + static readonly ConditionalWeakTable> ObjectFields = new ConditionalWeakTable>(); /// /// Returns a custom field. @@ -20,7 +24,7 @@ public static T Get(object obj, string field) { if (!HasField(obj, field)) Set(obj, field, default(T)); - objectFields.TryGetValue(obj, out Dictionary fields); + ObjectFields.TryGetValue(obj, out Dictionary fields); return (T)fields[field]; } @@ -31,8 +35,7 @@ public static T Get(object obj, string field) /// The class the static field is stored on. /// The name of the custom field. /// A custom field of type T. If the field is not found, default(T) is returned. - public static T GetStatic(string field) - => Get(typeof(C), field); + public static T GetStatic(string field) => Get(typeof(C), field); /// /// Returns a static custom field. @@ -41,8 +44,7 @@ public static T GetStatic(string field) /// The name of the custom field. /// The type of the class the static field is stored on. /// A custom field of type T. If the field is not found, default(T) is returned. - public static T GetStatic(string field, Type classType) - => Get(classType, field); + public static T GetStatic(string field, Type classType) => Get(classType, field); /// /// Set a custom field. @@ -52,10 +54,10 @@ public static T GetStatic(string field, Type classType) /// The value of the custom field. public static void Set(object obj, string field, object value) { - if (!objectFields.TryGetValue(obj, out Dictionary fields)) + if (!ObjectFields.TryGetValue(obj, out Dictionary fields)) { fields = new Dictionary(); - objectFields.Add(obj, fields); + ObjectFields.Add(obj, fields); } fields[field] = value; @@ -67,8 +69,7 @@ public static void Set(object obj, string field, object value) /// The class which you want to store the static field is stored on. /// The name of the custom field. /// The value of the custom field. - public static void SetStatic(string field, object value) - => Set(typeof(C), field, value); + public static void SetStatic(string field, object value) => Set(typeof(C), field, value); /// /// Set a static custom field. @@ -76,8 +77,7 @@ public static void SetStatic(string field, object value) /// The name of the custom field. /// The value of the custom field. /// The type of the class which you want to store the static field is stored on. - public static void SetStatic(string field, object value, Type classType) - => Set(classType, field, value); + public static void SetStatic(string field, object value, Type classType) => Set(classType, field, value); /// /// Check if an object currently stores a custom field. @@ -87,7 +87,7 @@ public static void SetStatic(string field, object value, Type classType) /// True if the object is storing the custom field. public static bool HasField(object obj, string field) { - if (!objectFields.TryGetValue(obj, out Dictionary fields)) return false; + if (!ObjectFields.TryGetValue(obj, out Dictionary fields)) return false; return fields.ContainsKey(field); } @@ -97,8 +97,7 @@ public static bool HasField(object obj, string field) /// The class which you want to check. /// The name of the static custom field to check for. /// True if the class is storing the static custom field. - public static bool HasStaticField(string field) - => HasField(typeof(C), field); + public static bool HasStaticField(string field) => HasField(typeof(C), field); /// /// Check if a class currently stores a static custom field. @@ -106,6 +105,5 @@ public static bool HasStaticField(string field) /// The name of the static custom field to check for. /// The type of the class which you want to check. /// True if the class is storing the static custom field. - public static bool HasStaticField(string field, Type classType) - => HasField(classType, field); + public static bool HasStaticField(string field, Type classType) => HasField(classType, field); } \ No newline at end of file diff --git a/InscryptionAPI/Helpers/Extensions/BoardManagerExtensions.cs b/InscryptionAPI/Helpers/Extensions/BoardManagerExtensions.cs index 19e94781..45d8ea4f 100644 --- a/InscryptionAPI/Helpers/Extensions/BoardManagerExtensions.cs +++ b/InscryptionAPI/Helpers/Extensions/BoardManagerExtensions.cs @@ -2,6 +2,9 @@ namespace InscryptionAPI.Helpers.Extensions; +/// +/// An extensions class for the Board Manager. +/// public static class BoardManagerExtensions { /// @@ -10,10 +13,7 @@ public static class BoardManagerExtensions /// Manager instance to access. /// The predicate to filter on each card. /// The list of player cards on the board. - public static List GetPlayerCards( - this BoardManager manager, - Predicate filterOnPredicate = null - ) => manager.PlayerSlotsCopy.SelectCards(filterOnPredicate).ToList(); + public static List GetPlayerCards(this BoardManager manager, Predicate filterOnPredicate = null) => manager.PlayerSlotsCopy.SelectCards(filterOnPredicate).ToList(); /// /// Retrieve all opponent cards on the board. @@ -21,10 +21,7 @@ public static List GetPlayerCards( /// Manager instance to access. /// The predicate to filter on each card. /// The list of opponent cards on the board. - public static List GetOpponentCards( - this BoardManager manager, - Predicate filterOnPredicate = null - ) => manager.OpponentSlotsCopy.SelectCards(filterOnPredicate).ToList(); + public static List GetOpponentCards(this BoardManager manager, Predicate filterOnPredicate = null) => manager.OpponentSlotsCopy.SelectCards(filterOnPredicate).ToList(); /// /// Retrieve all player or opponent cards on the board. @@ -33,11 +30,7 @@ public static List GetOpponentCards( /// Whether to retrieve player cards. /// The predicate to filter on each card. /// The list of relevant cards on the board. - public static List GetCards( - this BoardManager manager, - bool getPlayerCards, - Predicate filterOnPredicate = null - ) => manager.GetSlotsCopy(getPlayerCards).SelectCards(filterOnPredicate).ToList(); + public static List GetCards(this BoardManager manager, bool getPlayerCards, Predicate filterOnPredicate = null) => manager.GetSlotsCopy(getPlayerCards).SelectCards(filterOnPredicate).ToList(); /// /// Retrieve all cards on the board that match the predicate, if given. @@ -45,8 +38,7 @@ public static List GetCards( /// Manager instance to access. /// The predicate to filter on each card. /// The list of relevant cards on the board. - public static List GetCards(this BoardManager manager, Predicate filterOnPredicate = null) - => manager.AllSlotsCopy.SelectCards(filterOnPredicate).ToList(); + public static List GetCards(this BoardManager manager, Predicate filterOnPredicate = null) => manager.AllSlotsCopy.SelectCards(filterOnPredicate).ToList(); /// @@ -55,10 +47,7 @@ public static List GetCards(this BoardManager manager, Predicate

Manager instance to access. /// The predicate to filter on each slot. /// The list of player slots with no cards. - public static List GetPlayerOpenSlots( - this BoardManager manager, - Predicate filterOnPredicate = null - ) => manager.PlayerSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); + public static List GetPlayerOpenSlots(this BoardManager manager, Predicate filterOnPredicate = null) => manager.PlayerSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); ///

/// Retrieve all opponent slots that are not occupied by a card. @@ -66,10 +55,7 @@ public static List GetPlayerOpenSlots( /// Manager instance to access. /// The predicate to filter on each slot. /// The list of opponent slots with no cards. - public static List GetOpponentOpenSlots( - this BoardManager manager, - Predicate filterOnPredicate = null - ) => manager.OpponentSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); + public static List GetOpponentOpenSlots(this BoardManager manager, Predicate filterOnPredicate = null) => manager.OpponentSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); /// /// Retrieve all slots on the player or opponent's side of the board that are not occupied by a card. @@ -78,11 +64,7 @@ public static List GetOpponentOpenSlots( /// Whether to retrieve player slots. /// The predicate to filter on each slot. /// The list of relevant card slots with no cards. - public static List GetOpenSlots( - this BoardManager manager, - bool getPlayerSlots, - Predicate filterOnPredicate = null - ) => manager.GetSlotsCopy(getPlayerSlots).SelectOpenSlots(filterOnPredicate).ToList(); + public static List GetOpenSlots(this BoardManager manager, bool getPlayerSlots, Predicate filterOnPredicate = null) => manager.GetSlotsCopy(getPlayerSlots).SelectOpenSlots(filterOnPredicate).ToList(); /// /// Retrieve all slots on the board that are not occupied by a card. @@ -90,20 +72,15 @@ public static List GetOpenSlots( /// Manager instance to access. /// The predicate to filter on each slot. /// The list of relevant card slots with no cards. - public static List GetOpenSlots( - this BoardManager manager, - Predicate filterOnPredicate = null - ) => manager.AllSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); + public static List GetOpenSlots(this BoardManager manager, Predicate filterOnPredicate = null) => manager.AllSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList(); /// /// Retrieve a copy of the board slots for the player or opponent's side of the board. /// /// Manager instance to access. /// Whether to retrieve PlayerSlotsCopy or OpponentSlotsCopy. - /// The predicate to filter on each slot. /// The list corresponding to the player or opponent's side of the board. - public static List GetSlotsCopy(this BoardManager manager, bool getPlayerSlotsCopy) - => getPlayerSlotsCopy ? manager.PlayerSlotsCopy : manager.OpponentSlotsCopy; + public static List GetSlotsCopy(this BoardManager manager, bool getPlayerSlotsCopy) => getPlayerSlotsCopy ? manager.PlayerSlotsCopy : manager.OpponentSlotsCopy; /// /// Retrieve all player or opponent card slots on the board. @@ -112,9 +89,5 @@ public static List GetSlotsCopy(this BoardManager manager, bool getPla /// Whether to retrieve player card slots. /// The predicate to filter on each card slot. /// The list of relevant card slots on the board. - public static List GetCardSlots( - this BoardManager manager, - bool getPlayerCards, - Predicate filterOnPredicate = null - ) => manager.GetSlotsCopy(getPlayerCards).FindAll(filterOnPredicate); + public static List GetCardSlots(this BoardManager manager, bool getPlayerCards, Predicate filterOnPredicate = null) => manager.GetSlotsCopy(getPlayerCards).FindAll(filterOnPredicate); } \ No newline at end of file diff --git a/InscryptionAPI/Helpers/Extensions/CardSlotExtensions.cs b/InscryptionAPI/Helpers/Extensions/CardSlotExtensions.cs index 3f9996b9..832fb8ba 100644 --- a/InscryptionAPI/Helpers/Extensions/CardSlotExtensions.cs +++ b/InscryptionAPI/Helpers/Extensions/CardSlotExtensions.cs @@ -3,6 +3,9 @@ namespace InscryptionAPI.Helpers.Extensions; +/// +/// An extensions class for the Card Slot. +/// public static class CardSlotExtensions { /// @@ -35,12 +38,7 @@ public static bool HasCard(this CardSlot cardSlot, string cardName) /// Time to transition the card to the slot. The longer the time, the longer it will take to be placed at the slot. /// Whether or not to activate these triggers, in order: cards on board OtherCardAssignedToSlot, this card ResolveOnBoard, cards on board OtherCardResolve. /// The enumeration of the card being placed in the slot. - public static IEnumerator CreateCardInSlot( - this CardSlot slotToSpawnIn, - CardInfo cardInfo, - float transitionLength = 0.1f, - bool resolveTriggers = true - ) + public static IEnumerator CreateCardInSlot(this CardSlot slotToSpawnIn, CardInfo cardInfo, float transitionLength = 0.1f, bool resolveTriggers = true) { yield return BoardManager.Instance.CreateCardInSlot(cardInfo, slotToSpawnIn, transitionLength, resolveTriggers); } @@ -54,13 +52,7 @@ public static IEnumerator CreateCardInSlot( /// An action to do after the assignment has completed. /// Whether or not to activate the 'Trigger.OtherCardAssignedToSlot' for the cards on board. /// The enumeration of the card being placed in the slot. - public static IEnumerator AssignCardToSlot( - this CardSlot slotToSpawnIn, - PlayableCard playableCard, - float transitionDuration = 0.1f, - Action tweenCompleteCallback = null, - bool resolveTriggers = true - ) + public static IEnumerator AssignCardToSlot(this CardSlot slotToSpawnIn, PlayableCard playableCard, float transitionDuration = 0.1f, Action tweenCompleteCallback = null, bool resolveTriggers = true) { yield return BoardManager.Instance.AssignCardToSlot(playableCard, slotToSpawnIn, transitionDuration, tweenCompleteCallback, resolveTriggers); } @@ -74,13 +66,7 @@ public static IEnumerator AssignCardToSlot( /// An action to do after the assignment has completed, but before 'ResolveOnBoard' triggers. /// Whether or not to activate these triggers, in order: cards on board OtherCardAssignedToSlot, this card ResolveOnBoard, cards on board OtherCardResolve. /// The enumeration of the card being placed in the slot. - public static IEnumerator ResolveCardOnBoard( - this CardSlot slotToSpawnIn, - PlayableCard playableCard, - float tweenLength = 0.1f, - Action landOnBoardCallback = null, - bool resolveTriggers = true - ) + public static IEnumerator ResolveCardOnBoard(this CardSlot slotToSpawnIn, PlayableCard playableCard, float tweenLength = 0.1f, Action landOnBoardCallback = null, bool resolveTriggers = true) { yield return BoardManager.Instance.ResolveCardOnBoard(playableCard, slotToSpawnIn, tweenLength, landOnBoardCallback, resolveTriggers); } @@ -128,9 +114,7 @@ public static CardSlot GetAdjacent(this CardSlot cardSlot, bool adjacentOnLeft) /// An IEnumerable of PlayableCard from the CardSlots sequence. public static IEnumerable SelectCards(this IEnumerable slots, Predicate filterOnPredicate = null) { - return slots - .Where(slot => slot.Card && (filterOnPredicate == null || filterOnPredicate.Invoke(slot.Card))) - .Select(slot => slot.Card); + return slots.Where(slot => slot.Card && (filterOnPredicate == null || filterOnPredicate.Invoke(slot.Card))).Select(slot => slot.Card); } /// diff --git a/InscryptionAPI/Helpers/Extensions/GameObjectExtensions.cs b/InscryptionAPI/Helpers/Extensions/GameObjectExtensions.cs index be1629b4..af5eb9c6 100644 --- a/InscryptionAPI/Helpers/Extensions/GameObjectExtensions.cs +++ b/InscryptionAPI/Helpers/Extensions/GameObjectExtensions.cs @@ -2,8 +2,17 @@ namespace InscryptionAPI.Helpers.Extensions; +/// +/// An Extensions Class for the +/// public static class GameObjectExtensions { + /// + /// Finds the Children of a Given + /// + /// The we want to find the children of. + /// The name of the child we are looking for within the children. + /// A with the name being looked for. public static GameObject FindChild(this GameObject parent, string name) { if (parent.name == name) diff --git a/InscryptionAPI/Helpers/Extensions/ListExtensions.cs b/InscryptionAPI/Helpers/Extensions/ListExtensions.cs index f6195781..58810bf5 100644 --- a/InscryptionAPI/Helpers/Extensions/ListExtensions.cs +++ b/InscryptionAPI/Helpers/Extensions/ListExtensions.cs @@ -2,8 +2,17 @@ namespace InscryptionAPI.Helpers.Extensions; +/// +/// An Extensions Class for the . +/// public static class ListExtensions { + /// + /// Removes the First element of the passed . + /// + /// The in which we want to remove the First item of. + /// The type of we are operating on, for example where T is would result in the Type being . + /// Returns the First item of after removing it from the . public static T PopFirst(this List list) { T t = list[0]; @@ -11,6 +20,12 @@ public static T PopFirst(this List list) return t; } + /// + /// Removes the Last element of the passed . + /// + /// The in which we want to remove the Last item of. + /// The type of we are operating on, for example where T is would result in the Type being . + /// Returns the Last item of after removing it from the . public static T PopLast(this List list) { T t = list[list.Count - 1]; @@ -18,6 +33,13 @@ public static T PopLast(this List list) return t; } + /// + /// Repeatedly adds the specified item to a X times. + /// + /// The Item in which we want to repeat. + /// The amount of times we want to repeat it. + /// The type of we are operating on, for example where T is would result in the Type being . + /// A new of the item specified by repeated for the amount of times specified by the parameter. public static List Repeat(this T toRepeat, int times) { List repeated = new(); @@ -31,12 +53,24 @@ public static List Repeat(this T toRepeat, int times) return repeated; } + /// + /// A function used to get a Random item from the . + /// + /// The we are using to get a Random Item from. + /// The type of we are operating on, for example where T is would result in the Type being . + /// A Random element from the passed using public static T GetRandom(this List list) { int index = UnityEngine.Random.Range(0, list.Count); return list[index]; } + /// + /// A function used to get a Seeded Random item from the . + /// + /// The we are using to get a Seeded Random Item from. + /// The type of we are operating on, for example where T is would result in the Type being . + /// A Seeded Random element from the passed using public static T GetSeededRandom(this List list, int seed) { int index = SeededRandom.Range(0, list.Count, seed); diff --git a/InscryptionAPI/Helpers/MaterialOverride.cs b/InscryptionAPI/Helpers/MaterialOverride.cs index 4ad0696d..434984c9 100644 --- a/InscryptionAPI/Helpers/MaterialOverride.cs +++ b/InscryptionAPI/Helpers/MaterialOverride.cs @@ -2,79 +2,200 @@ namespace InscryptionAPI.Helpers; +/// +/// A Helper Object for Materials on an Object. +/// public class MaterialOverride { + /// + /// The Main Texture as a . + /// public Texture2D MainTexture = null; + /// + /// Whether the Main Texture should be Overwritten or not. + /// public bool OverrideMainTexture = false; - + /// + /// The Emission Texture as a . + /// public Texture2D Emission = null; + /// + /// Whether the Emission Texture should be Overwritten or not. + /// public bool OverrideEmission = false; - + /// + /// The Normal Map as a . + /// public Texture2D NormalMap = null; + /// + /// Whether the Normal Map should be Overwritten or not. + /// public bool OverrideNormalMap = false; - + /// + /// The Height Map as a . + /// public Texture2D HeightMap = null; + /// + /// Whether the Height Map should be Overwritten or not. + /// public bool OverrideHeightMap = false; - + /// + /// The Metallic Map as a . + /// public Texture2D MetallicMap = null; + /// + /// Whether the Metallic Map should be Overwritten or not. + /// public bool OverrideMetallicMap = false; - + /// + /// The Occlusion Map as a . + /// public Texture2D OcclusionMap = null; + /// + /// Whether the Occlusion Map should be Overwritten or not. + /// public bool OverrideOcclusionMap = false; - + /// + /// The Detail Mask as a . + /// public Texture2D DetailMask = null; + /// + /// Whether the Detail Mask should be Overwritten or not. + /// public bool OverrideDetailMask = false; - + /// + /// The Metallic Surface Property. How Metallic should the Material be? + /// public float? Metallic = null; + /// + /// Whether the Metallic Value should be Overwritten or not. + /// + public bool OverrideMetallic = false; + /// + /// The Surface Smoothness Property. How Smooth should the Material be? + /// public float? Smoothness = null; + /// + /// Whether the Smoothness Value should be Overwritten or not. + /// + public bool OverrideSmoothness = false; + /// + /// The Displacement Height Property. How displaced should the Material be compared to the Model it is applied to? + /// public float? Height = null; - + /// + /// Whether the Height Value should be Overwritten or not. + /// + public bool OverrideHeight = false; + + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeMainTexture(Texture2D tex) { MainTexture = tex; OverrideMainTexture = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeEmission(Texture2D tex) { Emission = tex; OverrideEmission = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeNormalMap(Texture2D tex) { NormalMap = tex; OverrideNormalMap = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeHeightMap(Texture2D tex) { HeightMap = tex; OverrideHeightMap = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeMetallicMap(Texture2D tex) { MetallicMap = tex; OverrideMetallicMap = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeOcclusionMap(Texture2D tex) { OcclusionMap = tex; OverrideOcclusionMap = true; return this; } - + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. public MaterialOverride ChangeDetailMask(Texture2D tex) { DetailMask = tex; OverrideMainTexture = true; return this; } + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. + public MaterialOverride ChangeMetallic(float metallic) + { + Metallic = metallic; + OverrideMetallic = true; + return this; + } + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. + public MaterialOverride ChangeSmoothness(float smoothness) + { + Smoothness = smoothness; + OverrideSmoothness = true; + return this; + } + /// + /// A function for changing the of a . + /// + /// The in which to use to replace . + /// An Overwritten and set to true. + public MaterialOverride ChangeHeight(float height) + { + Height = height; + OverrideHeight = true; + return this; + } } diff --git a/InscryptionAPI/Helpers/ResourceLookup.cs b/InscryptionAPI/Helpers/ResourceLookup.cs index d7422530..65da8c8d 100644 --- a/InscryptionAPI/Helpers/ResourceLookup.cs +++ b/InscryptionAPI/Helpers/ResourceLookup.cs @@ -1,17 +1,31 @@ -using InscryptionAPI.Helpers; -using UnityEngine; +using UnityEngine; -namespace InscryptionAPI.Items; +namespace InscryptionAPI.Helpers; /// -/// Define how an asset should be retrieved so we can fetch it at any time. +/// A Helper Object for ResourceLookup. /// +/// Define how an asset should be retrieved so we can fetch it at any time. public class ResourceLookup : ICloneable { + /// + /// The Path to the Resource. + /// public string ResourcePath { get; private set; } + /// + /// The Resources BankID. + /// public string ResourceBankID { get; private set; } + /// + /// The Prefab associated with the Lookup. + /// public GameObject Prefab { get; private set; } + /// + /// Gets a Prefab from the passed Path and Prefab Name. + /// + /// The Path to the in which to search for the Prefab. + /// The Name of the Prefab we are searching for in the . public void FromAssetBundle(string assetBundlePath, string assetBundlePrefabName) { if (AssetBundleHelper.TryGet(assetBundlePath, assetBundlePrefabName, out GameObject go)) @@ -19,7 +33,11 @@ public void FromAssetBundle(string assetBundlePath, string assetBundlePrefabName Prefab = go; } } - + /// + /// Gets a Prefab from the passed and Prefab Name. + /// + /// The in which to search for the Prefab. + /// The Name of the Prefab we are searching for in the . public void FromAssetBundle(AssetBundle assetBundle, string assetBundlePrefabName) { if (AssetBundleHelper.TryGet(assetBundle, assetBundlePrefabName, out GameObject go)) @@ -27,7 +45,12 @@ public void FromAssetBundle(AssetBundle assetBundle, string assetBundlePrefabNam Prefab = go; } } - + /// + /// Gets a Prefab from the passed DLL based Path and Prefab Name. + /// + /// The Path to the Asset Bundle within the DLL Assembly. + /// The Name of the Prefab we are searching for in the . + /// public void FromAssetBundleInAssembly(string assetBundlePath, string assetBundlePrefabName) { byte[] resourceBytes = TextureHelper.GetResourceBytes(assetBundlePath, typeof(T).Assembly); @@ -36,22 +59,37 @@ public void FromAssetBundleInAssembly(string assetBundlePath, string assetBun Prefab = go; } } - + + /// + /// Sets the to the ResourcePath passed in. + /// + /// The Path to the Resource. public void FromResources(string resourcePath) { this.ResourcePath = resourcePath; } - + /// + /// Sets the to the ResourceBankID passed in. + /// + /// The ResourceBankID. public void FromResourceBank(string resourceBankID) { this.ResourceBankID = resourceBankID; } - + /// + /// Sets the to the Prefab passed in. + /// + /// The Prefab itself. public void FromPrefab(GameObject prefab) { this.Prefab = prefab; } + /// + /// Gets the UnityObject Representative of the Prefab. + /// + /// A representative of the Prefab. + /// A if successful, a Null if we failed to get the Type from the Prefab, and a Default(T) if the ResourceLookup failed. public virtual T Get() where T : UnityObject { if (!string.IsNullOrEmpty(ResourcePath)) @@ -83,14 +121,22 @@ public virtual T Get() where T : UnityObject return default(T); } + /// + /// Turns the ResourceLookup Object into a String. + /// + /// A String of the ResourceLookup Object. public override string ToString() { return $"ResourceLookup(ResourcePath:{ResourcePath}, ResourceBankID:{ResourceBankID}, Prefab:{Prefab})"; } + /// + /// Clones the Object into a Shallow Copy of the current ResourceLookup. + /// + /// A Cloned Object representing the ResourceLookup. public object Clone() { - ResourceLookup cardInfo = (ResourceLookup)base.MemberwiseClone(); - return cardInfo; + ResourceLookup resourceLookup = (ResourceLookup)base.MemberwiseClone(); + return resourceLookup; } } \ No newline at end of file diff --git a/InscryptionAPI/Helpers/ResourcesManagerHelpers.cs b/InscryptionAPI/Helpers/ResourcesManagerHelpers.cs index c872e039..4a2be356 100644 --- a/InscryptionAPI/Helpers/ResourcesManagerHelpers.cs +++ b/InscryptionAPI/Helpers/ResourcesManagerHelpers.cs @@ -7,13 +7,16 @@ namespace InscryptionAPI.Helpers; +/// +/// A Helper Set related to the . +/// public static class ResourcesManagerHelpers { /// /// Removes a given amount of energy cells, which determines how much energy a player has available at the start of a turn. /// Affected by 'ResourcesManager.preventNextEnergyLoss'. /// - /// The ResourcesManager Instance. + /// The current . /// How many energy cells to close. Gets capped to the current number of open energy cells. public static IEnumerator RemoveMaxEnergy(this ResourcesManager instance, int amount) { @@ -24,7 +27,7 @@ public static IEnumerator RemoveMaxEnergy(this ResourcesManager instance, int am /// A variant of RemoveMaxEnergy that can bypass ResourcesManager.PreventNextEnergyLoss. /// Affected by 'ResourcesManager.preventNextEnergyLoss'. /// - /// The ResourcesManager Instance. + /// The current . /// How many energy cells to close. Gets capped to the current number of open energy cells. public static IEnumerator RemoveMaxEnergy(this ResourcesManager instance, int amount, bool preventable) { @@ -44,6 +47,12 @@ public static IEnumerator RemoveMaxEnergy(this ResourcesManager instance, int am yield return instance.ShowRemoveMaxEnergy(numToClose); } + /// + /// A used to show removal of Max Energy. + /// + /// The current . + /// The amount of lost Max Energy. + /// The Depleted Energy Counter from removing the specified amount of max energy. public static IEnumerator ShowRemoveMaxEnergy(this ResourcesManager instance, int amount) { PixelResourcesManager pixelManager = instance as PixelResourcesManager; @@ -64,6 +73,13 @@ public static IEnumerator ShowRemoveMaxEnergy(this ResourcesManager instance, in yield return new WaitForSeconds(0.05f); } } + + /// + /// Gets the Amount of Gems of the passed . + /// + /// The current . + /// The we want to get the count of. + /// The Count of Gems associated with the passed . public static int GemsOfType(this ResourcesManager instance, GemType gem) { return instance.gems.Count(x => x == gem); @@ -82,6 +98,13 @@ public static int GemCount(bool playerGems, GemType gemToCheck) else return OpponentGemsManager.Instance.GemsOfType(gemToCheck); } + + /// + /// A bool used to determine whether the Owner has Gems of the specified 's. + /// + /// Whether the Check should be based on the Opponent or Player. + /// The 's in which to check if the Opponent has. + /// The result of if the Check is for the Player, otherwise the result of . public static bool OwnerHasGems(bool playerGems, params GemType[] gems) { if (playerGems) @@ -89,6 +112,12 @@ public static bool OwnerHasGems(bool playerGems, params GemType[] gems) else return OpponentHasGems(gems); } + + /// + /// A bool used to determine whether the Opponent has Gems of the specified 's. + /// + /// The 's in which to check if the Opponent has. + /// A true if the Opponent has all specified 's, a false if not. public static bool OpponentHasGems(params GemType[] gems) { if (OpponentGemsManager.Instance == null) @@ -101,6 +130,12 @@ public static bool OpponentHasGems(params GemType[] gems) } return true; } + + /// + /// A bool used to determine whether the Player has Gems of the specified 's. + /// + /// The 's in which to check if the Player has. + /// A true if the Player has all specified 's, a false if not. public static bool PlayerHasGems(params GemType[] gems) { foreach (GemType gem in gems) @@ -112,11 +147,21 @@ public static bool PlayerHasGems(params GemType[] gems) } } +/// +/// A Patch Class used to Get the Empty Battery Sprite in the GBC section. +/// [HarmonyPatch(typeof(PixelResourcesManager), nameof(PixelResourcesManager.Start))] public static class GetEmptyBatterySprite { + /// + /// The Empty Battery Sprite. + /// public static Sprite emptyBatterySprite = null; + /// + /// A function used to Get and set the . + /// + /// The Instance of the Object, in this case . [HarmonyPostfix] private static void GetSprite(PixelResourcesManager __instance) { diff --git a/InscryptionAPI/Helpers/TextureHelper.cs b/InscryptionAPI/Helpers/TextureHelper.cs index 742e1e45..383bd1fc 100644 --- a/InscryptionAPI/Helpers/TextureHelper.cs +++ b/InscryptionAPI/Helpers/TextureHelper.cs @@ -1,3 +1,4 @@ +using System.Collections.ObjectModel; using BepInEx; using DiskCardGame; using HarmonyLib; @@ -7,13 +8,14 @@ namespace InscryptionAPI.Helpers; /// -/// This class contains a number of helper methods for managing textures. +/// A Helper Set related to the and . /// +/// This class contains a number of helper methods for managing textures. [HarmonyPatch] public static class TextureHelper { /// - /// Thie is used to indicate what type of sprite you wish to create so that the appropriate size and pivot point can be determined. + /// This is used to indicate what type of sprite you wish to create so that the appropriate size and pivot point can be determined. /// public enum SpriteType : int { @@ -21,76 +23,74 @@ public enum SpriteType : int /// A card's portrait art in Act 1 or Act 3. /// CardPortrait = 0, - /// /// A card's portrait art in Act 2. /// PixelPortrait = 1, - /// /// An ability icon (sigil) in Act 2. /// PixelAbilityIcon = 2, - /// /// A special stat icon in Act 2. /// PixelStatIcon = 3, - /// /// A challenge skull displayed on the challenge UI during the setup of a Kaycee's Mod run. /// ChallengeIcon = 4, - /// /// The texture that displays the card's cost in Act 1. /// CostDecal = 5, - /// /// The large decal used to display multiple/hybrid card costs in Act 1. /// OversizedCostDecal = 6, - /// /// The decal used to display card costs in Act 2, on the top-left of the card. /// Act2CostDecalLeft = 7, - /// /// The decal used to display card costs in Act 2, on the top-right of the card. /// Act2CostDecalRight = 8, - /// /// The starter deck icon displayed on the challenge UI during the setup on a Kaycee's Mod run. /// StarterDeckIcon = 9, - /// /// The decal used by the API in Act 2, comprising the entire card's dimensions. /// PixelDecal = 10, - /// /// An activated ability icon (sigil) in Act 2. /// PixelActivatedAbilityIcon = 11, - /// /// The texture for a button in Act 2 (same kind of button used for the hammer and activated sigils). /// PixelStandardButton = 12, - + /// + /// The texture for the Act 2 cost when it's on the Left. + /// Act2CostVanillaLeft = 13, - + /// + /// The texture for a Act 2 cost when it's on the right. + /// Act2CostVanillaRight = 14 }; - + /// + /// The Default Pivot to use across most Sprites. + /// private static Vector2 DEFAULT_PIVOT = new(0.5f, 0.5f); - + /// + /// A Dictionary of , representing an Emission Mapping. + /// private static readonly Dictionary emissionMap = new(); - + /// + /// A Dictionary of , used to define the Rectangular Area for a given Sprite Type. + /// private static readonly Dictionary SPRITE_RECTS = new() { { SpriteType.CardPortrait, new Rect(0f, 0f, 114f, 94f) }, @@ -106,10 +106,12 @@ public enum SpriteType : int { SpriteType.PixelDecal, new Rect(0f, 0f, 42f, 56f) }, { SpriteType.PixelActivatedAbilityIcon, new Rect(0f, 0f, 22f, 10f) }, { SpriteType.PixelStandardButton, new Rect(0f, 0f, 26f, 17f) }, - { SpriteType.Act2CostVanillaLeft, new Rect(0f, 0f, 48f, 28f) }, // vanilla costs should have a creme border on the left and right so we don't need padding + { SpriteType.Act2CostVanillaLeft, new Rect(0f, 0f, 48f, 28f) }, { SpriteType.Act2CostVanillaRight, new Rect(0f, 0f, 48f, 28f) } }; - + /// + /// A Dictionary of , used to define the Pivot Point for a given Sprite Type. + /// private static readonly Dictionary SPRITE_PIVOTS = new() { { SpriteType.CardPortrait, DEFAULT_PIVOT }, @@ -251,6 +253,11 @@ public static void RegisterEmissionForSprite(this Sprite regularSprite, Sprite e emissionMap[regularSprite] = emissionSprite; } + /// + /// A Function used to Get the Emission from the Card Portrait at first through the , and if that fails, from the . + /// + /// The Card Portrait . + /// An Emission associated with the passed Card Portrait public static Sprite GetEmissionSprite(this Sprite sprite) { if (sprite == null) @@ -259,7 +266,6 @@ public static Sprite GetEmissionSprite(this Sprite sprite) if (emissionMap.TryGetValue(sprite, out Sprite emission)) return emission; - string text = sprite.name + "_emission"; emission = ResourceBank.Get("Art/Cards/Portraits/" + text); if (emission != null) @@ -314,6 +320,12 @@ public static void TryReuseEmission(CardInfo info, Sprite alternatePortrait) emissionMap[alternatePortrait] = emissionMap[info.portraitTex]; } + /// + /// A patch to to allow for usage of Custom Emissions instead. + /// + /// The Card Portrait . + /// The returned result in this case the Emission associated with the Card Portrait within , if not found it lets vanilla handle it normally. + /// A false if the contains an Emission correlated with the Card Portrait , otherwise false to let the game handle it. [HarmonyPatch(typeof(CardDisplayer3D), nameof(CardDisplayer3D.GetEmissivePortrait))] [HarmonyPrefix] private static bool GetCustomEmission(Sprite mainPortrait, ref Sprite __result) @@ -329,9 +341,9 @@ private static bool GetCustomEmission(Sprite mainPortrait, ref Sprite __result) /// /// Reads the contents of an image file in an assembly and returns it as a byte array. /// - /// The name of the art file stored as a resource in the assembly. + /// The name of the art file stored as a resource in the assembly. /// The assembly to pull the art from. - /// The contents of the file in pathCardArt as a byte array. + /// The contents of the file in filename as a byte array. public static byte[] GetResourceBytes(string filename, Assembly target) { string lowerKey = $".{filename.ToLowerInvariant()}"; @@ -353,14 +365,6 @@ public static byte[] GetResourceBytes(string filename, Assembly target) /// /// Combines multiple textures into one, using a tiled approach. /// - /// - /// This helper has a very specific purpose. The pixels in baseTexture will be iteratively replaced with the pixels - /// in the pieces array. The X position for the i-th texture will be - /// xOffset + xStep * i. The Y position for the i-th texture will be - /// yOffset + yStep * (pieces.Count - i - 1). - /// - /// **Note**: baseTexture will be modified in-place! - /// /// The individual textures to combine into the base texture. /// The background texture for the combined texture. /// Used to set the position for individual textures. @@ -368,6 +372,14 @@ public static byte[] GetResourceBytes(string filename, Assembly target) /// Used to set the position for individual textures. /// Used to set the position for individual textures. /// The modified texture (the same Texture references as baseTexture). + /// + /// This helper has a very specific purpose. The pixels in will be iteratively replaced with the pixels + /// in the array. The X position for the i-th texture will be + /// + * i. The Y position for the i-th texture will be + /// + * (.Count - i - 1). + /// + /// Note: will be modified in-place! + /// public static Texture2D CombineTextures(List pieces, Texture2D baseTexture, int xStep = 0, int yStep = 0, int xOffset = 0, int yOffset = 0) { if (pieces != null) @@ -386,42 +398,118 @@ public static Texture2D CombineTextures(List pieces, Texture2D baseTe /// Creates an identical copy of a given texture /// /// The texture to copy. + /// This code originates from public static Texture2D DuplicateTexture(Texture2D texture) { - // https://support.unity.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures- - // Create a temporary RenderTexture of the same size as the texture - - RenderTexture tmp = RenderTexture.GetTemporary( - texture.width, - texture.height, - 0, - RenderTextureFormat.Default, - RenderTextureReadWrite.Linear); - - - // Blit the pixels on texture to the RenderTexture + RenderTexture tmp = RenderTexture.GetTemporary(texture.width, texture.height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear); Graphics.Blit(texture, tmp); - - // Backup the currently set RenderTexture RenderTexture previous = RenderTexture.active; - - // Set the current RenderTexture to the temporary one we created RenderTexture.active = tmp; - - // Create a new readable Texture2D to copy the pixels to it - Texture2D myTexture2D = new(texture.width, texture.height); - - // Copy the pixels from the RenderTexture to the new Texture myTexture2D.ReadPixels(new Rect(0, 0, tmp.width, tmp.height), 0, 0); myTexture2D.Apply(); - - // Reset the active RenderTexture RenderTexture.active = previous; - - // Release the temporary RenderTexture RenderTexture.ReleaseTemporary(tmp); - return myTexture2D; } -} + + #region CustomAppearences + + /// + /// All Base Game Custom Appearance Items, these are handled by mods themselves, not by us. + /// + internal static Dictionary BaseGameCustomAppearances = new Dictionary(); + /// + /// All Base Game Custom Appearance Items, these are handled by mods themselves, not by us. This version is exposed publicly. + /// + public static ReadOnlyCollection> BaseGameCustomAppearancesPublic => new ReadOnlyCollection>(BaseGameCustomAppearances.ToList()); + /// + /// All Modded Custom Appearance Items, these are handled by mods themselves, not by us. + /// + internal static Dictionary ModdedCustomAppearancesDictionary = new Dictionary(); + /// + /// All Modded Custom Appearance Items, these are handled by mods themselves, not by us. This version is exposed publicly. + /// + public static ReadOnlyCollection> ModdedCustomAppearancesDictionaryPublic => new ReadOnlyCollection>(ModdedCustomAppearancesDictionary.ToList()); + /// + /// All Custom Appearance Items, these are handled by mods themselves, not by us. This version is exposed publicly. + /// + public static ReadOnlyCollection> CombinedCustomAppearancesDictionaryPublic => new ReadOnlyCollection>(BaseGameCustomAppearancesPublic.Concat(ModdedCustomAppearancesDictionary).ToList()); + + /// + /// Initializes the Base Game Custom Appearances List + /// + internal static void InstantiateBaseGameCustomAppearances() + { + BaseGameCustomAppearances.Add("CardDecal_Blood1", GetImageAsTexture("decal_blood_1.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Blood2", GetImageAsTexture("decal_blood_2.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Blood3", GetImageAsTexture("decal_blood_3.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Blood4", GetImageAsTexture("decal_blood_4.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Child", GetImageAsTexture("decal_child.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Fungus", GetImageAsTexture("decal_fungus.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Smoke", GetImageAsTexture("decal_smoke.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_SmokeAbilityHole", GetImageAsTexture("decal_smoke_abilityhole.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk1", GetImageAsTexture("decal_snelk_1.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk2", GetImageAsTexture("decal_snelk_2.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk3", GetImageAsTexture("decal_snelk_3.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk4", GetImageAsTexture("decal_snelk_4.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk5", GetImageAsTexture("decal_snelk_5.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Snelk6", GetImageAsTexture("decal_snelk_6.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_SnelkMain", GetImageAsTexture("decal_snelk_main.png", InscryptionAPIPlugin.APIAssembly)); + BaseGameCustomAppearances.Add("CardDecal_Stitches", GetImageAsTexture("decal_stitches.png", InscryptionAPIPlugin.APIAssembly)); + } + + /// + /// Utilize this function to add your Custom Appearance Into the Public Dictionaries. + /// + /// + /// The GUID representing the mod in which the Appearance Came from. + /// A tuple representing the Appearence we want to add to the Dictionary. + /// We error if any of the passed in fields are Null, and for strings if they are Whitespace as well. + public static void AddCustomAppearanceToDictionary(string type, string GUID, (string name, Texture2D texture2D)[] appearancesToAdd) + { + foreach ((string name, Texture2D texture2D) in appearancesToAdd) + { + if (texture2D != null && (!name.IsNullOrWhiteSpace() && !type.IsNullOrWhiteSpace() && !GUID.IsNullOrWhiteSpace())) + { + ModdedCustomAppearancesDictionary.Add(type + "_" + GUID + "_" + name, texture2D); + } + else + { + InscryptionAPIPlugin.Logger.LogError($"Failed to add KVP {type + "_" + GUID + "_" + name} to dictionary."); + if (texture2D == null) + { + InscryptionAPIPlugin.Logger.LogError($"Texture2D associated with {type + "_" + GUID + "_" + name} was null."); + InscryptionAPIPlugin.Logger.LogError($"Ensure you are passing a non-null Texture2D."); + } + if (name.IsNullOrWhiteSpace()) + { + InscryptionAPIPlugin.Logger.LogError($"Name ({name}) associated with {type + "_" + GUID + "_" + name} was null."); + InscryptionAPIPlugin.Logger.LogError($"Ensure you are passing a non-null or empty name."); + } + if (type.IsNullOrWhiteSpace()) + { + InscryptionAPIPlugin.Logger.LogError($"Type ({type}) associated with {type + "_" + GUID + "_" + name} was null."); + InscryptionAPIPlugin.Logger.LogError($"Ensure you are passing a non-null or empty type."); + } + if (GUID.IsNullOrWhiteSpace()) + { + InscryptionAPIPlugin.Logger.LogError($"GUID ({GUID}) associated with {type + "_" + GUID + "_" + name} was null."); + InscryptionAPIPlugin.Logger.LogError($"Ensure you are passing a non-null or empty GUID."); + } + } + } + } + + /// + /// A function that gets a Dictionary of all Custom Appearances associated with the passed in Type. + /// + /// A unique identifier in which you want to get a list of textures that are instantiated with. For example CardDecal for a Card's Decal. + /// The results of with the check of x.Key.StartsWith(type). We return in the form of a new containing KVPs from . + public static Dictionary GetCustomAppearanceTypeFromDictionary(string type) + { + return CombinedCustomAppearancesDictionaryPublic.Where(x => x.Key.StartsWith(type)).ToDictionary(x => x.Key, x => x.Value); + } + + #endregion +} \ No newline at end of file diff --git a/InscryptionAPI/Helpers/TranspilerHelpers.cs b/InscryptionAPI/Helpers/TranspilerHelpers.cs index 10a1f563..cf0b1b05 100644 --- a/InscryptionAPI/Helpers/TranspilerHelpers.cs +++ b/InscryptionAPI/Helpers/TranspilerHelpers.cs @@ -2,9 +2,17 @@ namespace InscryptionAPI.Helpers; +/// +/// A Helper Set related to the Transpiler. +/// public static class TranspilerHelpers { - public static void LogCodeInscryptions(this List codes, string prefix = null) + /// + /// A function used to log OpCode Intructions. + /// + /// The List of OpCodes to Log. + /// An Optional Prefix to help indicate where the Logs Originate, or what the OpCodes relate to. + public static void LogCodeInstructions(this List codes, string prefix = null) { string p = prefix ?? ""; for (int i = 0; i < codes.Count; i++) diff --git a/InscryptionAPI/InscryptionAPI.csproj b/InscryptionAPI/InscryptionAPI.csproj index 27de0776..e543a49e 100644 --- a/InscryptionAPI/InscryptionAPI.csproj +++ b/InscryptionAPI/InscryptionAPI.csproj @@ -1,33 +1,68 @@ - - netframework4.7.2 + netframework4.7.2 + win-x64;win-x86;win-arm64;linux-x64;linux-arm;linux-arm64;linux-musl-x64;linux-musl-arm64;osx-x64;osx-arm64 + InscryptionAPI + The Core API for the game Inscryption. + 2.24.2 + Cyantist, IngoH, WhistleWind, Chaosyr and Contibutors + true + Latest + InscryptionAPI + full + $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 enable disable false - latest - true - full + true + false + false + true false true - 2.24.1 - - - - $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 - - - - - TalkingCardGenericPrefab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -40,4 +75,39 @@ + + + + + + + + + + + + + + + + + + + + + "../InscryptionCommunityPatch/InscryptionCommunityPatch.csproj" + + Thunderstore-Package-Elements + plugins + ..\CHANGELOG.md + ..\README.md + ..\LICENSE.md + Release + + API + 2.24.2 + https://github.com/InscryptionModding/InscryptionAPI/ + The de-facto standard core API for all Inscryption mods. This lets you create new cards, abilities, challenges, map nodes, starter decks, and more. + BepInEx-BepInExPack_Inscryption-5.4.2306;BepInEx-MonoMod_Loader_Inscryption-1.0.0 + diff --git a/InscryptionAPI/InscryptionAPIPlugin.cs b/InscryptionAPI/InscryptionAPIPlugin.cs index fc46d62d..cfb540b3 100644 --- a/InscryptionAPI/InscryptionAPIPlugin.cs +++ b/InscryptionAPI/InscryptionAPIPlugin.cs @@ -18,6 +18,9 @@ using InscryptionAPI.Totems; using System.Reflection; using System.Runtime.CompilerServices; +using InscryptionAPI.Guid; +using InscryptionAPI.Helpers; +using Sirenix.Utilities; [assembly: InternalsVisibleTo("Assembly-CSharp")] [assembly: InternalsVisibleTo("Assembly-CSharp.APIPatcher.mm")] @@ -25,29 +28,69 @@ namespace InscryptionAPI; +/// +/// The Entry Point to the Inscryption API. +/// [BepInPlugin(ModGUID, ModName, ModVer)] [HarmonyPatch] public class InscryptionAPIPlugin : BaseUnityPlugin { + /// + /// The GUID for the Inscryption API, if you depend on this API you'll want to load after it in Awake() or, anywhere before Start(). + /// public const string ModGUID = "cyantist.inscryption.api"; - public const string ModName = "InscryptionAPI"; - public const string ModVer = "2.24.1"; + /// + /// This is the Inscryption API's Internal Name, prefer identifying this API with the GUID. + /// + internal const string ModName = "InscryptionAPI"; + /// + /// This is the Version of the Inscryption API you are using. + /// + internal const string ModVer = "2.24.2"; + /// + /// The Inscryption API's Location as a Directory. + /// public static string Directory = ""; + /// + /// The API's Assembly for Internal Reference. + /// internal static Assembly APIAssembly { get; private set; } = null; + /// + /// The Configuration for Overriding the Arrows within Kaycee's Mod Menu's. + /// internal static ConfigEntry configOverrideArrows; - internal static ConfigEntry configRandomChoiceOrder; + /// + /// The Configuration for determining whether the Order of Costs in a Cost Choice Node should be Randomized. + /// + internal static ConfigEntry configRandomCostChoiceOrder; + /// + /// The Configuration for determining whether the Boss Scenery of Act 1/KCM should be hidden. + /// internal static ConfigEntry configHideAct1BossScenery; - internal static ConfigEntry configCustomTotemTopTypes; - internal static ConfigEntry configCustomItemTypes; + /// + /// This Configuration is used for determining what Totem Top Model should be used in game. + /// + internal static ConfigEntry configCustomTotemTopModelSelection; + /// + /// This Configuration is used for determining what Item Model should be used in game. + /// + internal static ConfigEntry configCustomItemModelSelection; + /// + /// This Configuration is used for determining whether we should Log Debugging for the TraderCostTier Bug. + /// + internal static ConfigEntry configEnableTraderCostTierBugDebugLogging; + /// + /// Prevents API 1.0.0 Versions from Loaing. + /// static InscryptionAPIPlugin() { AppDomain.CurrentDomain.AssemblyResolve += static (_, e) => { - if (e.Name.StartsWith("API, Version=1")) + if (e.Name.StartsWith("API, Version=1") || e.Name.StartsWith("Cardloader, Version=1")) { return APIAssembly ??= typeof(InscryptionAPIPlugin).Assembly; } @@ -55,29 +98,52 @@ static InscryptionAPIPlugin() }; } + /// + /// Our API's Internal Logger. + /// new internal static ManualLogSource Logger; - + /// + /// Our API's Internal Harmony Instance. + /// private readonly Harmony HarmonyInstance = new(ModGUID); + /// + /// An event of resembling the Scriptable Object Loader Load call. + /// public static event Action ScriptableObjectLoaderLoad; + /// + /// A simple internal function that invokes our previously typified Action for Loading the ScriptableObjectLoader. + /// + /// The Type in which to pass to the ScriptableObjectLoader. internal static void InvokeSOLEvent(Type type) { ScriptableObjectLoaderLoad?.Invoke(type); } + /// + /// The following runs when the API is enabled by Unity. + /// private void OnEnable() { Logger = base.Logger; Directory = Path.GetDirectoryName(Info.Location); + if (TextureHelper.BaseGameCustomAppearancesPublic.IsNullOrEmpty()) + TextureHelper.InstantiateBaseGameCustomAppearances(); HarmonyInstance.PatchAll(InscryptionAPIPlugin.APIAssembly); } + /// + /// The following runs when the API is diabled by Unity. + /// private void OnDisable() { HarmonyInstance.UnpatchSelf(); } + /// + /// The following is used to Resync the API's many lists, e.g. , , , , , , , + /// internal static void ResyncAll() { CardManager.SyncCardList(); @@ -90,6 +156,9 @@ internal static void ResyncAll() RuleBookManager.SyncRuleBookList(); } + /// + /// A function we use to check when a plugin is using an Outdated version of the API, if they do we log them with a Warning about it. + /// internal static void CheckForOutdatedPlugins() { string outdatedPlugins = ""; @@ -109,16 +178,23 @@ internal static void CheckForOutdatedPlugins() + outdatedPlugins + "\nThese mods may not work correctly. If problems arise, please update or disable them!"); } + /// + /// This is our API's Initializer, we primarily use it to set the internal APIAssembly and create the Configurations to the Configuration File. + /// private void Awake() { APIAssembly ??= typeof(InscryptionAPIPlugin).Assembly; - configCustomTotemTopTypes = Config.Bind("Totems", "Top Types", TotemManager.TotemTopState.CustomTribes, "If Vanilla, don't change totem tops; if CustomTribes, added custom tribes will use custom totem tops; if AllTribes then all totem tops will use a custom top."); - configCustomItemTypes = Config.Bind("Items", "Types", ConsumableItemManager.ConsumableState.Custom, "If Vanilla, only vanilla items will be used; if Custom, added custom items will use custom models; if All then all items will use a custom model."); + configCustomTotemTopModelSelection = Config.Bind("Totems", "Top Types", TotemManager.TotemTopState.CustomTribes, "If Vanilla, don't change totem tops; if CustomTribes, added custom tribes will use custom totem tops; if AllTribes then all totem tops will use a custom top."); + configCustomItemModelSelection = Config.Bind("Items", "Types", ConsumableItemManager.ConsumableState.Custom, "If Vanilla, only vanilla items will be used; if Custom, added custom items will use custom models; if All then all items will use a custom model."); configOverrideArrows = Config.Bind("Menus", "Override Arrows", false, "When true, forces the challenge screen arrows to appear at the top of the screen instead of the sides."); - configRandomChoiceOrder = Config.Bind("Miscellaneous", "Randomise Cost Choice Order", false, "When true, randomises the order card cost choices are presented in Act 1."); + configRandomCostChoiceOrder = Config.Bind("Miscellaneous", "Randomise Cost Choice Order", false, "When true, randomises the order card cost choices are presented in Act 1."); configHideAct1BossScenery = Config.Bind("Optimization", "Hide Act 1 Scenery", false, "When true bosses will not spawn their scenery. (eg: Prospector's trees) This can improve performance on low-end machines."); + configEnableTraderCostTierBugDebugLogging = Config.Bind("Zebugging", "Enable Logging for Info related to the GenerateTradeCardsWithCostTier method", false, "May be of use for debugging issues related to 'GenerateTradeCardsWithCostTier', by how much no clue. Set this to True to enable the Logging."); } + /// + /// This is the API's second phase of Initialization, ran after all Awake() calls complete. If you need something both after Awake() and before Start() refer to JSONLoader3's Phase System. + /// private void Start() { CheckForOutdatedPlugins(); @@ -129,13 +205,273 @@ private void Start() CardManager.AuditCardList(); PixelCardManager.Initialise(); PeltManager.CreateDialogueEvents(); - //if (!DialogueManager.CustomDialogue.Exists(x => x.DialogueEvent.id == "Hint_NotEnoughSameColourGemsHint")) - //{ - - //} Logger.LogDebug($"Inserted {DialogueManager.CustomDialogue.Count} dialogue event(s)!"); + DebugLoggingForGenerateTradeCardsWithCostTier(); + } + + /// + /// A Function in which Logs some Debug related to 'GenerateTradeCardsWithCostTier'. There is more related Logging, this is just the Start of it. + /// + private void DebugLoggingForGenerateTradeCardsWithCostTier() + { + foreach (CardInfo info in CardLoader.LearnedCards) + { + if (configEnableTraderCostTierBugDebugLogging.Value) + { + if (info == null) + { + Logger.LogError("CardLoader.LearnedCards contains a null CardInfo."); + continue; + } + + Logger.LogDebug($"===== CardInfo: {info.displayedName ?? info.name ?? "null"} ====="); + + Logger.LogDebug($"name: {info.name ?? "null"}"); + Logger.LogDebug($"displayedName: {info.displayedName ?? "null"}"); + Logger.LogDebug($"displayedNameLocId: {info.displayedNameLocId}"); + Logger.LogDebug($"description: {info.description ?? "null"}"); + + Logger.LogDebug($"baseAttack: {info.baseAttack}"); + Logger.LogDebug($"baseHealth: {info.baseHealth}"); + + Logger.LogDebug($"cost: {info.cost}"); + Logger.LogDebug($"bonesCost: {info.bonesCost}"); + Logger.LogDebug($"energyCost: {info.energyCost}"); + Logger.LogDebug($"gemsCost: {string.Join(", ", info.gemsCost?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + + Logger.LogDebug($"cardComplexity: {info.cardComplexity}"); + Logger.LogDebug($"temple: {info.temple}"); + Logger.LogDebug($"onePerDeck: {info.onePerDeck}"); + Logger.LogDebug($"hideAttackAndHealth: {info.hideAttackAndHealth}"); + + Logger.LogDebug($"metaCategories: {string.Join(", ", info.metaCategories?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + Logger.LogDebug($"tribes: {string.Join(", ", info.tribes?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + Logger.LogDebug($"traits: {string.Join(", ", info.traits?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + + Logger.LogDebug($"abilities: {string.Join(", ", info.abilities?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + Logger.LogDebug($"ascensionAbilities: {string.Join(", ", info.ascensionAbilities?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + Logger.LogDebug($"specialAbilities: {string.Join(", ", info.specialAbilities?.Select(x => GetGuidAndKey(x)) ?? Enumerable.Empty())}"); + + LogAbilityInfos(info, "abilities", info.abilities); + LogAbilityInfos(info, "ascensionAbilities", info.ascensionAbilities); + + Logger.LogDebug($"evolveParams: {GetEvolveParams(info.evolveParams)}"); + Logger.LogDebug($"defaultEvolutionName: {info.defaultEvolutionName ?? "null"}"); + + Logger.LogDebug($"tailParams: {GetTailParams(info.tailParams)}"); + Logger.LogDebug($"iceCubeParams: {GetIceCubeParams(info.iceCubeParams)}"); + + Logger.LogDebug($"flipPortraitForStrafe: {info.flipPortraitForStrafe}"); + + Logger.LogDebug($"specialStatIcon: {info.specialStatIcon}"); + Logger.LogDebug($"boon: {info.boon}"); + + Logger.LogDebug($"mods: {info.mods?.Count ?? 0}"); + Logger.LogDebug($"temporaryDecals: {info.temporaryDecals?.Count ?? 0}"); + Logger.LogDebug($"get_decals: {info.get_decals?.Count ?? 0}"); + + Logger.LogDebug($"Calculated Attack: {info.Attack}"); + Logger.LogDebug($"Calculated Health: {info.Health}"); + Logger.LogDebug($"Calculated BloodCost: {info.BloodCost}"); + Logger.LogDebug($"Calculated BonesCost: {info.BonesCost}"); + Logger.LogDebug($"Calculated EnergyCost: {info.EnergyCost}"); + Logger.LogDebug($"Calculated Gemified: {info.Gemified}"); + Logger.LogDebug($"Calculated CostTier: {info.CostTier}"); + Logger.LogDebug($"Calculated Sacrificable: {info.Sacrificable}"); + Logger.LogDebug($"Calculated PowerLevel: {info.PowerLevel}"); + Logger.LogDebug($"Calculated NumAbilities: {info.NumAbilities}"); + + Logger.LogDebug($"===== End CardInfo: {info.displayedName ?? info.name ?? "null"} ====="); + } + } + LogTradeCardAbilityInfoIssues(); + } + + /// + /// Gets a GUID and Key associated with a Type of Enum from the passed in Enum Value. + /// + /// The Enum we want to get the String Name of. + /// The Enum Type. + /// A String representing the Enum either via the GUID system or the Enum System. + private string GetGuidAndKey(T value) where T : System.Enum + { + if (GuidManager.TryGetGuidAndKeyEnumValue(value, out string guid, out string key)) + return $"{guid}_{key}"; + + return value.ToString(); + } + + /// + /// Gets the String Name and DisplayName from a CardInfo. + /// + /// The Card we want to get the DisplayName of. + /// The Card Name and DisplayName of the passed in Card as a String. + private string GetCardName(CardInfo card) + { + if (card == null) + return "null"; + + return $"{card.name} ({card.DisplayedNameEnglish})"; + } + + /// + /// Gets the String version of the . + /// + /// The we want to turn into a String. + /// The in the form of a String. + private string GetEvolveParams(EvolveParams evolveParams) + { + if (evolveParams == null) + return "null"; + + return $"turnsToEvolve={evolveParams.turnsToEvolve}, evolution={GetCardName(evolveParams.evolution)}"; + } + + /// + /// Gets the String version of the . + /// + /// The we want to turn into a String. + /// The in the form of a String. + private string GetTailParams(TailParams tailParams) + { + if (tailParams == null) + return "null"; + + return $"tail={GetCardName(tailParams.tail)}, tailLostPortrait={(tailParams.tailLostPortrait != null ? tailParams.tailLostPortrait.name : "null")}"; + } + + /// + /// Gets the String version of the . + /// + /// The we want to turn into a String. + /// The in the form of a String. + private string GetIceCubeParams(IceCubeParams iceCubeParams) + { + if (iceCubeParams == null) + return "null"; + + return $"creatureWithin={GetCardName(iceCubeParams.creatureWithin)}"; + } + + /// + /// A function that allows us to Log Ability Infos. + /// + /// The Card in which bears the AbilityInfos. + /// The Source of the AbilityInfos. + /// The List of Abilities in which we want to Log. + private void LogAbilityInfos(CardInfo card, string source, IEnumerable abilities) + { + if (abilities == null) + { + Logger.LogDebug($"{source} AbilityInfo validation: null"); + return; + } + + foreach (Ability ability in abilities) + { + AbilityInfo abilityInfo = AbilitiesUtil.GetInfo(ability); + string abilityId = GetGuidAndKey(ability); + + if (abilityInfo == null) + { + Logger.LogError($"MISSING AbilityInfo | " + $"card={GetCardName(card)} | " + $"source={source} | " + $"ability={abilityId} | " + $"rawValue={(int)ability}"); + continue; + } + + Logger.LogDebug($"AbilityInfo | " + $"card={GetCardName(card)} | " + $"source={source} | " + $"ability={abilityId} | " + $"rawValue={(int)ability} | " + $"opponentUsable={abilityInfo.opponentUsable} | " + $"passive={abilityInfo.passive} | " + $"activated={abilityInfo.activated} | " + $"powerLevel={abilityInfo.powerLevel} | " + $"canStack={abilityInfo.canStack} | " + $"conduit={abilityInfo.conduit} | " + $"conduitCell={abilityInfo.conduitCell} | " + $"keywordAbility={abilityInfo.keywordAbility} | " + $"rulebookName={abilityInfo.rulebookName ?? "null"}"); + } + } + + /// + /// A function we can run at Startup to try and Validate any Trade Issues that may arise from 'GenerateTradeCardsWithCostTier'. Logging is enabled via 'configEnableTraderCostTierBugDebugLogging'. + /// + private void LogTradeCardAbilityInfoIssues() + { + List learnedCards = CardLoader.LearnedCards; + + if (configEnableTraderCostTierBugDebugLogging.Value) + { + Logger.LogDebug($"Learned card count: {learnedCards.Count}"); + } + + foreach (CardInfo card in learnedCards) + { + if (card.temple != CardTemple.Nature) + continue; + + int costTier; + + try + { + costTier = card.CostTier; + } + catch (Exception ex) + { + if (configEnableTraderCostTierBugDebugLogging.Value) + { + Logger.LogError($"Could not calculate CostTier | " + $"card={GetCardName(card)} | " + $"exception={ex}"); + } + continue; + } + + if (configEnableTraderCostTierBugDebugLogging.Value) + { + Logger.LogDebug($"Trade candidate | " + $"card={GetCardName(card)} | " + $"tier={costTier} | " + $"bloodCost={card.BloodCost} | " + $"bonesCost={card.BonesCost} | " + $"energyCost={card.EnergyCost} | " + $"abilitiesNull={card.abilities == null}"); + } + + if (card.abilities == null) + { + if (configEnableTraderCostTierBugDebugLogging.Value) + { + Logger.LogError($"NULL abilities list | " + $"card={GetCardName(card)} | " + $"tier={costTier}"); + } + continue; + } + + if (card.abilities.Count == 0) + { + if (configEnableTraderCostTierBugDebugLogging.Value) + { + Logger.LogDebug($"Trade candidate has no abilities | " + $"card={GetCardName(card)} | " + $"tier={costTier}"); + } + continue; + } + + foreach (Ability ability in card.abilities) + { + if (configEnableTraderCostTierBugDebugLogging.Value) + { + string abilityId = GetGuidAndKey(ability); + AbilityInfo abilityInfo; + + try + { + abilityInfo = AbilitiesUtil.GetInfo(ability); + } + catch (Exception ex) + { + Logger.LogError($"AbilitiesUtil.GetInfo threw | " + $"card={GetCardName(card)} | " + $"tier={costTier} | " + $"ability={abilityId} | " + $"rawValue={(int)ability} | " + + $"exception={ex}"); + continue; + } + + if (abilityInfo == null) + { + Logger.LogError($"TRADE CRASH CANDIDATE: Missing AbilityInfo | " + $"card={GetCardName(card)} | " + $"tier={costTier} | " + $"ability={abilityId} | " + + $"rawValue={(int)ability} | " + $"reason=AbilitiesUtil.GetInfo returned null; " + $"vanilla code will dereference .opponentUsable"); + continue; + } + + Logger.LogDebug($"Trade ability OK | " + $"card={GetCardName(card)} | " + $"tier={costTier} | " + $"ability={abilityId} | " + $"rawValue={(int)ability} | " + + $"opponentUsable={abilityInfo.opponentUsable}"); + } + } + } } + /// + /// This patches the Kaycee's Mod Menu to resync all Cards and Abilities when entering the run itself before Kaycee's mod transitions you into the run itself.. + /// [HarmonyPatch(typeof(AscensionMenuScreens), nameof(AscensionMenuScreens.TransitionToGame))] [HarmonyPrefix] private static void SyncCardsAndAbilitiesWhenTransitioningToAscensionGame() @@ -143,6 +479,9 @@ private static void SyncCardsAndAbilitiesWhenTransitioningToAscensionGame() ResyncAll(); } + /// + /// This patches the Main Menu to resync all Cards and Abilities when entering any part of the base game, before the Menu handles the transition. + /// [HarmonyPatch(typeof(MenuController), nameof(MenuController.TransitionToGame))] [HarmonyPrefix] private static void SyncCardsAndAbilitiesWhenTransitioningToGame() diff --git a/InscryptionAPI/Items/ConsumableItemManager.cs b/InscryptionAPI/Items/ConsumableItemManager.cs index a54a17bb..83bd5b16 100644 --- a/InscryptionAPI/Items/ConsumableItemManager.cs +++ b/InscryptionAPI/Items/ConsumableItemManager.cs @@ -10,7 +10,6 @@ namespace InscryptionAPI.Items; - public static class ConsumableItemManager { public class FullConsumableItemData @@ -238,7 +237,7 @@ internal static void Initialize() if (!allFullItemDatas.Exists(x => x.itemData == itemData)) allFullItemDatas.Add(new(itemData)); } - if (InscryptionAPIPlugin.configCustomItemTypes.Value == ConsumableState.Vanilla) + if (InscryptionAPIPlugin.configCustomItemModelSelection.Value == ConsumableState.Vanilla) { // Don't change any items! return; @@ -258,7 +257,7 @@ internal static void Initialize() } // Override vanilla items - if (InscryptionAPIPlugin.configCustomItemTypes.Value == ConsumableState.All) + if (InscryptionAPIPlugin.configCustomItemModelSelection.Value == ConsumableState.All) { // Change all base items to use the fallback model! foreach (ConsumableItemData data in baseConsumableItemsDatas) diff --git a/InscryptionAPI/Items/ConsumableItemResource.cs b/InscryptionAPI/Items/ConsumableItemResource.cs index 56f58bfa..14489c10 100644 --- a/InscryptionAPI/Items/ConsumableItemResource.cs +++ b/InscryptionAPI/Items/ConsumableItemResource.cs @@ -1,4 +1,5 @@ using DiskCardGame; +using InscryptionAPI.Helpers; using UnityEngine; namespace InscryptionAPI.Items; diff --git a/InscryptionAPI/Localizing/LocalizationManager.cs b/InscryptionAPI/Localizing/LocalizationManager.cs index 269104ad..3e61d3c1 100644 --- a/InscryptionAPI/Localizing/LocalizationManager.cs +++ b/InscryptionAPI/Localizing/LocalizationManager.cs @@ -50,7 +50,6 @@ public enum FontReplacementType public static Action OnLanguageLoaded = null; private static List AlreadyLoadedLanguages = new(); - private static bool FontReplacementDataInitialized = false; private static List TemporaryFontReplacements = new(); static LocalizationManager() diff --git a/InscryptionAPI/Masks/MaskBehaviour.cs b/InscryptionAPI/Masks/MaskBehaviour.cs index ce8fe5db..38f9a072 100644 --- a/InscryptionAPI/Masks/MaskBehaviour.cs +++ b/InscryptionAPI/Masks/MaskBehaviour.cs @@ -101,7 +101,6 @@ protected virtual void OverrideSmoothnessValue(MaterialOverride materialOverride protected virtual void OverrideMetallic(MaterialOverride materialOverride, Material material) { - material.SetFloat("_Metallic", materialOverride.Metallic.Value); } diff --git a/InscryptionAPI/Masks/MaskManager.cs b/InscryptionAPI/Masks/MaskManager.cs index 285d344b..d9700b66 100644 --- a/InscryptionAPI/Masks/MaskManager.cs +++ b/InscryptionAPI/Masks/MaskManager.cs @@ -83,7 +83,7 @@ public static CustomMask Override(string guid, string name, LeshyAnimationContro /// /// GUID of your mod. /// Name of the mask. - /// The mask we want to add so we cna tell leshy to put on that specific mask. + /// The mask we want to add so we can tell leshy to put on that specific mask. /// The model the mask will use. /// . /// . diff --git a/InscryptionAPI/Masks/Patches.cs b/InscryptionAPI/Masks/Patches.cs index bb419dc1..82087a8f 100644 --- a/InscryptionAPI/Masks/Patches.cs +++ b/InscryptionAPI/Masks/Patches.cs @@ -1,5 +1,6 @@ using DiskCardGame; using HarmonyLib; +using InscryptionAPI.Helpers; using InscryptionAPI.Items; using UnityEngine; diff --git a/InscryptionAPI/PixelCard/PixelCardBehaviours.cs b/InscryptionAPI/PixelCard/PixelCardBehaviours.cs index ad8a5856..f09b6c4e 100644 --- a/InscryptionAPI/PixelCard/PixelCardBehaviours.cs +++ b/InscryptionAPI/PixelCard/PixelCardBehaviours.cs @@ -11,6 +11,7 @@ public override void ApplyAppearance() { } public virtual Sprite PixelAppearance() { return null; } public virtual Sprite OverridePixelPortrait() { return null; } public virtual Sprite OverrideBackground() { return null; } + public virtual Sprite OverrideQueuedBackground() { return null; } public virtual void OnAppearanceApplied() { } } diff --git a/InscryptionAPI/PixelCard/PixelCardManager.cs b/InscryptionAPI/PixelCard/PixelCardManager.cs index dc40ce00..e209745c 100644 --- a/InscryptionAPI/PixelCard/PixelCardManager.cs +++ b/InscryptionAPI/PixelCard/PixelCardManager.cs @@ -91,8 +91,9 @@ private static void DecalPatches(PixelCardDisplayer __instance, PlayableCard pla private static void AddDecalToCard(in PixelCardDisplayer instance, PlayableCard playableCard) { - Transform cardElements = instance?.gameObject?.transform?.Find("CardElements"); - if (cardElements == null) + Transform cardElements = instance?.cardElements?.transform; + Transform queuedCardElements = instance?.queuedCardElements?.transform; + if (cardElements == null || queuedCardElements == null) return; List existingDecals = new(); @@ -139,6 +140,15 @@ private static void AddDecalToCard(in PixelCardDisplayer instance, PlayableCard Sprite overridePortrait = pixelBehav.OverridePixelPortrait(); if (overridePortrait != null) instance.SetPortrait(overridePortrait); + // override queued background + Sprite overrideQueuedBackground = pixelBehav.OverrideQueuedBackground(); + if (overrideQueuedBackground != null) + { + Transform queuedBackground = queuedCardElements.Find("QueuedBackground"); + SpriteRenderer component = queuedBackground?.GetComponent(); + if (component != null) + component.sprite = overrideQueuedBackground; + } } UnityObject.Destroy(behav); } diff --git a/InscryptionAPI/TS-Build.bat b/InscryptionAPI/TS-Build.bat new file mode 100644 index 00000000..a4e1ba62 --- /dev/null +++ b/InscryptionAPI/TS-Build.bat @@ -0,0 +1,360 @@ +@echo off +SETLOCAL ENABLEDELAYEDEXPANSION + +REM ------------------------------- +REM THIS SCRIPT IS PROVIDED BY CHAOSYR +REM THIS IS LICENSED UNDER SML-1.0.0 +REM IT CAN BE FOUND HERE: https://stoatgames.icu/license-repository/licenses/sml-1-0-0/#content +REM IF YOU REUSE THIS FOR YOUR PROJECT, THIS COMMENT BLOCK MUST REMAIN IN TACT FOR LEGAL REASONS!! +REM ------------------------------- + +REM ------------------------------- +REM Config +REM ------------------------------- +set "PrimaryCSProj=%~dp0InscryptionAPI.CSProj" + +if not exist "%PrimaryCSProj%" ( + echo ERROR: Project file not found: "%PrimaryCSProj%" + exit /b 1 +) + +REM ------------------------------- +REM Read Secondary CSProj's +REM ------------------------------- +set "SCPRJs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "SCPRJs=!SCPRJs! %%B" +) +set "SCPRJs=!SCPRJs:~1!" + +REM ------------------------------- +REM Read TargetFrameworks +REM ------------------------------- +set "TFs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "TFs=!TFs! %%B" +) +set "TFs=!TFs:~1!" + +REM ------------------------------- +REM Read RuntimeIdentifiers +REM ------------------------------- +set "RIDs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "RIDs=!RIDs! %%B" +) +set "RIDs=!RIDs:~1!" + +REM ------------------------------- +REM Read Copy Locations +REM ------------------------------- +set "CLs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "CLs=!CLs! %%B" +) +set "CLs=!CLs:~1!" + +REM ------------------------------- +REM Read Dependency Locations +REM ------------------------------- +set "DPLs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "DPLs=!DPLs! %%B" +) +set "DPLs=!DPLs:~1!" + +REM ------------------------------- +REM Read Build Locations +REM ------------------------------- +set "BPLs=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "BPLs=!BPLs! %%B" +) +set "BPLs=!BPLs:~1!" + +REM ------------------------------- +REM Read Markdown File Locations +REM ------------------------------- +set "CHANGELOG=" +set "README=" +set "LICENSE=" + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "CHANGELOG=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "README=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "LICENSE=!line!" +) + +REM ------------------------------- +REM Read Release Mode +REM ------------------------------- + +set "RELEASEMODE=" +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "RELEASEMODE=!line!" +) + +if "!RELEASEMODE!"=="" set "RELEASEMODE=Debug" + +if /I "!RELEASEMODE!"=="Release" ( + set "OUTPUT_DIR=%~dp0GITHUB RELEASE" +) else ( + if /I "!RELEASEMODE!"=="Debug" ( + set "OUTPUT_DIR=%~dp0GITHUB PRERELEASE" + ) else ( + set "RELEASEMODE=Debug" + set "OUTPUT_DIR=%~dp0GITHUB PRERELEASE" + ) +) + +REM Normalize full path +for %%I in ("%OUTPUT_DIR%") do set "OUTPUT_DIR=%%~fI" + +REM ------------------------------- +REM Clean output root safely +REM ------------------------------- +if exist "%OUTPUT_DIR%" rd /s /q "%OUTPUT_DIR%" +mkdir "%OUTPUT_DIR%" + +mkdir "%OUTPUT_DIR%\NET" + +set "TMP_ROOT=%OUTPUT_DIR%\_tmp" +mkdir "%TMP_ROOT%" + +set "MANIFEST_ROOT=%OUTPUT_DIR%\_manifest" +mkdir "%MANIFEST_ROOT%" + +REM ------------------------------- +REM Tell User the Settings +REM ------------------------------- + +if "!TFs!"=="~1" set "TFs=net6.0" +if "!RIDs!"=="~1" set "RIDs=win-x64" +if "!CLs!"=="~1" set "CLs=Thunderstore-Package-Elements" +if "!DPLs!"=="~1" set "DPLs=exclude" +if "!BPLs!"=="~1" set "BPLs=root" + +echo CONFIGURATION +echo SecondaryCSProjs: !SCPRJs! +echo TargetFrameworks: !TFs! +echo RuntimeIdentifiers: !RIDs! +echo CopyLocations: !CLs! +echo DependencyLocations: !DPLs! +echo CHANGELOGCopyLocation: !CHANGELOG! +echo READMECopyLocation: !README! +echo LICENSECopyLocation: !LICENSE! +echo BuildOutputLocations: !BPLs! +echo ReleaseMode: !RELEASEMODE! + +REM ------------------------------- +REM Fetch Manifest Properties +REM ------------------------------- +set "NAME=" +set "VERSION=" +set "WEBSITEURL=" +set "DESCRIPTION=" +set "DEPENDENCIES=" + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "NAME=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "VERSION=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "WEBSITEURL=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "DESCRIPTION=!line!" +) + +for /f "usebackq tokens=*" %%A in (`type "%PrimaryCSProj%" ^| findstr ""`) do ( + set "line=%%A" + set "line=!line:=!" + set "line=!line:=!" + set "line=!line:;= !" + for %%B in (!line!) do set "DEPENDENCIES=!DEPENDENCIES! %%B" +) +set "DEPENDENCIES=!DEPENDENCIES:~1!" + +if "!DEPENDENCIES!"=="~1" set "DEPENDENCIES=" + +set "DEPENDENCYCOUNT=0" + +for %%D in (!DEPENDENCIES!) do ( + set /a DEPENDENCYCOUNT+=1 +) + +echo MANIFEST PROPERTIES +echo NAME: !NAME! +echo VERSION: !VERSION! +echo WEBSITEURL: !WEBSITEURL! +echo DESCRIPTION: !DESCRIPTION! +echo DEPENDENCIES: !DEPENDENCIES! +echo DEPENDENCYCOUNT: !DEPENDENCYCOUNT! + +REM ------------------------------- +REM Build Manifest File +REM ------------------------------- + +set "OUT=%MANIFEST_ROOT%\manifest.json" + +( + echo { + echo "name": "!NAME!", + echo "version_number": "!VERSION!", + echo "website_url": "!WEBSITEURL!", + echo "description": "!DESCRIPTION!", + echo "dependencies": [ +) > "!OUT!" + +if "!DEPENDENCYCOUNT!"=="0" ( + echo No Dependencies Skipping +) else ( + set "INDEX=0" + + for %%D in (!DEPENDENCIES!) do ( + set /a INDEX+=1 + + if "!INDEX!"=="!DEPENDENCYCOUNT!" ( + echo "%%D" + ) else ( + echo "%%D", + ) + ) >> "!OUT!" +) + +( + echo ] + echo } +) >> "!OUT!" + +REM ------------------------------- +REM Build Loop +REM ------------------------------- +for %%F in (!TFs!) do ( + for %%R in (!RIDs!) do ( + + set "TF_NAME=%%F" + set "RID_FLAT=%%R" + set "OUT=!TMP_ROOT!\!TF_NAME!-!RID_FLAT!" + + if exist "!OUT!" rd /s /q "!OUT!" + mkdir "!OUT!" + if "!BPLs!" == "root" ( + echo Told to Export to root Location we are not making any Directories. Skipping. + ) else ( + for %%B in (!BPLs!) do ( + mkdir "!OUT!\%%B" + ) + ) + + if "!BPLs!"=="root" ( + echo Publishing NET: %%F / %%R + dotnet publish "%PrimaryCSProj%" -c "!RELEASEMODE!" -f "%%F" -r "%%R" -o "!OUT!" || echo Failed %%F/%%R + for %%P in (!SCPRJs!) do ( + echo Publishing NET: %%P + dotnet publish %%P -c "!RELEASEMODE!" -f "%%F" -r "%%R" -o "!OUT!" || echo Failed %%F/%%R + ) + ) else ( + for %%B in (!BPLs!) do ( + echo Publishing NET: %%F / %%R + dotnet publish "%PrimaryCSProj%" -c "!RELEASEMODE!" -f "%%F" -r "%%R" -o "!OUT!\%%B" || echo Failed %%F/%%R + for %%P in (!SCPRJs!) do ( + echo Publishing NET: %%P + dotnet publish %%P -c "!RELEASEMODE!" -f "%%F" -r "%%R" -o "!OUT!\%%B" || echo Failed %%F/%%R + ) + ) + ) + copy /Y "%~dp0!CHANGELOG!" "!OUT!" + copy /Y "%~dp0!README!" "!OUT!" + copy /Y "%~dp0!LICENSE!" "!OUT!" + copy /Y "%MANIFEST_ROOT%\manifest.json" "!OUT!" + if "!DPLs!"=="exclude" ( + echo Told to Exclude on Dependency Locations as the field became a Empty field. Skipping. + ) else ( + mkdir "!OUT!\plugins" + mkdir "!OUT!\plugins\Dependencies" + for %%L in (!DPLs!) do ( + xcopy /E /I /Y "%%L" "!OUT!\plugins\Dependencies" + ) + ) + for %%L in (!CLs!) do ( + xcopy /E /I /Y "%%L" "!OUT!" + ) + set "ZIP_OUT=%OUTPUT_DIR%\NET\!TF_NAME!-!RID_FLAT!-!RELEASEMODE!.zip" + + powershell -NoProfile -Command ^ "Compress-Archive -Path '!OUT!\*' -DestinationPath '!ZIP_OUT!' -Force" + + rd /s /q "!OUT!" + ) +) + +REM ------------------------------- +REM Remove temp root completely +REM ------------------------------- +rd /s /q "%TMP_ROOT%" +rd /s /q "%MANIFEST_ROOT%" + +echo. +echo Build completed! Artifacts in: +echo %OUTPUT_DIR% + +ENDLOCAL \ No newline at end of file diff --git a/InscryptionAPI/Thunderstore-Package-Elements/!!INSTALLATION!!.md b/InscryptionAPI/Thunderstore-Package-Elements/!!INSTALLATION!!.md new file mode 100644 index 00000000..7e84e697 --- /dev/null +++ b/InscryptionAPI/Thunderstore-Package-Elements/!!INSTALLATION!!.md @@ -0,0 +1,92 @@ +## Getting Started: Installation +___ +To begin, we'll go over how to install BepInEx, the framework all Inscryption mods use. This is a necessary step to playing modded Inscryption, so be sure to follow this carefully. + +**FOR LINUX AND STEAMDECK:** Ensure that the game is set to run using `Proton` in he game settings on steam. Should be a setting like this: `Change launch behaviour` -> `Proton`. + +### Installing with a Mod Manager +1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). +2. Click the **Install with Mod Manager** button on the top of [BepInEx's](https://thunderstore.io/c/inscryption/p/BepInEx/BepInExPack_Inscryption/) page. +3. Run the game via the mod manager. + +If you have issues with Mod Managers head to one of these discords; + +* **Thunderstore Support Discord:** [Here](https://discord.gg/Fbz54kQAxg) +* **R2ModMan Support Discord:** [Here](https://discord.gg/R85wjqa4WN) +* **Gale Mod Manager Support Discord:** [Here](https://discord.gg/sfuWXRfeTt) + +### Installing Manually +1. Install [BepInEx](https://thunderstore.io/package/download/BepInEx/BepInExPack_Inscryption/5.4.2305/) by pressing `Manual Download` and extract the contents into a folder. **Do not extract into the game folder!** +2. Move the contents of the `BepInExPack_Inscryption` folder into the game folder (where the game executable is; usually found here: `C:\Program Files (x86)\Steam\steamapps\common\Inscryption`). +3. Run the game. If everything was done correctly, you will see the BepInEx console appear on your desktop. Close the game after it finishes loading. +4. Install [MonoModLoader](https://inscryption.thunderstore.io/package/BepInEx/MonoMod_Loader_Inscryption/) and extract the contents into a folder. +5. Move the contents of the `patchers` folder into `BepInEx/patchers` (If any of the mentioned BepInEx folders don't exist, just create them). +6. Install [Inscryption API](https://inscryption.thunderstore.io/package/API_dev/API/) and extract the contents into a folder. +7. Move the contents of the `plugins` folder into `BepInEx/plugins` and the contents of the `monomod` folder into the `BepInEx/monomod` folder. +8. Run the game again. If everything runs correctly, a message will appear in the console telling you that the API was loaded. +9. For any additional mods create a new subfolder, it can be called anything and extract the zips archive into it and if there is a `BepInEx` folder within the zip instead drop the contents of that folder into the `BepInEx` root for the modding instance. EX; + ``` + BepInEx // These go within the BepInEx root folder + |-- config + |-- patchers + |-- plugins + |-- monomod + |-- core + plugins // Files within go into the created plugin subfolder that was created for the mod + |-- Art + |-- Scripts + |-- MyMod.dll + manifest.json // Ignorable, but if kept, goes in plugin subfolder + README.md // Ignorable, but if kept, goes in plugin subfolder + CHANGELOG.md // Ignorable, but if kept, goes in plugin subfolder + icon.png // Ignorable, but if kept, goes in plugin subfolder + ``` +10. Run the game once more and everything should be correct and working. + +### Installing Manually (XBOX Game-Pass) +1. Install [BepInEx](https://thunderstore.io/package/download/BepInEx/BepInExPack_Inscryption/5.4.2305/) by pressing `Manual Download` and extract the contents into a folder. **Do not extract into the game folder!** +2. Move the contents of the `BepInExPack_Inscryption` folder into the game folder (where the game executable is; usually found here: `C:\XboxGames\Inscryption\Content`). +3. Install the following package: [XboxSilencio](https://thunderstore.io/c/inscryption/p/CORE_API_TEAM/GamepassSilencio/), this is a package which aims to solve frictions with XBOX Gamepass specific installations, such as HueyFS related errors. +4. Run the game. If everything was done correctly, you will see the BepInEx console appear on your desktop. Close the game after it finishes loading. +5. Install [MonoModLoader](https://inscryption.thunderstore.io/package/BepInEx/MonoMod_Loader_Inscryption/) and extract the contents into a folder. +6. Move the contents of the `patchers` folder into `BepInEx/patchers` (If any of the mentioned BepInEx folders don't exist, just create them). +7. Install [Inscryption API](https://inscryption.thunderstore.io/package/API_dev/API/) and extract the contents into a folder. +8. Move the contents of the `plugins` folder into `BepInEx/plugins` and the contents of the `monomod` folder into the `BepInEx/monomod` folder. +9. Run the game again. If everything runs correctly, a message will appear in the console telling you that the API was loaded. +10. For any additional mods create a new subfolder, it can be called anything and extract the zips archive into it and if there is a `BepInEx` folder within the zip instead drop the contents of that folder into the `BepInEx` root for the modding instance. EX; + ``` + BepInEx // These go within the BepInEx root folder + |-- config + |-- patchers + |-- plugins + |-- monomod + |-- core + plugins // Files within go into the created plugin subfolder that was created for the mod + |-- Art + |-- Scripts + |-- MyMod.dll + manifest.json // Ignorable, but if kept, goes in plugin subfolder + README.md // Ignorable, but if kept, goes in plugin subfolder + CHANGELOG.md // Ignorable, but if kept, goes in plugin subfolder + icon.png // Ignorable, but if kept, goes in plugin subfolder + ``` +11. Run the game once more and everything should be correct and working. + +### Installing on the Steam Deck +1. Download [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/) on the Steam Deck's Desktop Mode and open it from its download using its `AppImage` file. +2. Download the mods you plan on using and their dependencies. +3. Go to the setting of the profile you are using for the mods and click `Browse Profile Folder`. +4. Copy the BepInEx folder, then go to Steam and open Inscryption's Properties menu +5. Go to `Installed Files` click `Browse` to open the folder containing Inscryption's local files; paste the BepInEx folder there. +6. Enter Gaming Mode and check 'Force the use of a specific Steam Play compatibility tool' in the Properties menu under `Compatibility`. +7. Go to the launch parameters and enter `WINEDLLOVERRIDES="winhttp.dll=n,b" %command%`. +8. Open Inscryption. If everything was done correctly, you should see a console appear on your screen. + +### Mac & Linux +1. Follow the steps here first: +2. Next do steps 4-10 of the Manual Installation +3. Your game should be setup for inscryption modding now + +If you have any issues with Mac/Linux, Steam Deck, or Manual head over to the discord for this game: + +* **Inscryption Modding Discord:** [Here](https://discord.gg/ZQPvfKEpwM) \ No newline at end of file diff --git a/InscryptionAPI/Thunderstore-Package-Elements/icon.png b/InscryptionAPI/Thunderstore-Package-Elements/icon.png new file mode 100644 index 00000000..06e4d5ea Binary files /dev/null and b/InscryptionAPI/Thunderstore-Package-Elements/icon.png differ diff --git a/InscryptionAPI/Totems/TotemManager.cs b/InscryptionAPI/Totems/TotemManager.cs index 12693a05..9a2469c9 100644 --- a/InscryptionAPI/Totems/TotemManager.cs +++ b/InscryptionAPI/Totems/TotemManager.cs @@ -24,7 +24,7 @@ private class ItemsUtil_AllConsumables { public static IEnumerable Transpiler(IEnumerable instructions) { - if (InscryptionAPIPlugin.configCustomTotemTopTypes.Value == TotemTopState.Vanilla) + if (InscryptionAPIPlugin.configCustomTotemTopModelSelection.Value == TotemTopState.Vanilla) return instructions; // === We want to turn this @@ -114,7 +114,7 @@ private static bool Prefix(TotemTopData data, ref GameObject __result) __result = customTribeTotem?.Prefab ?? defaultTotemTop.Prefab; return false; } - else if (InscryptionAPIPlugin.configCustomTotemTopTypes.Value == TotemTopState.AllTribes) + else if (InscryptionAPIPlugin.configCustomTotemTopModelSelection.Value == TotemTopState.AllTribes) { __result = defaultTotemTop.Prefab; return false; @@ -148,7 +148,7 @@ private static bool Prefix(TotemTopData __instance, ref string __result) return false; } } - else if (InscryptionAPIPlugin.configCustomTotemTopTypes.Value == TotemTopState.AllTribes) + else if (InscryptionAPIPlugin.configCustomTotemTopModelSelection.Value == TotemTopState.AllTribes) { // All non-custom tribes will use the fallback model __result = CustomTotemTopID; @@ -308,7 +308,7 @@ private static void InitializeDefaultTotemTop() private static void Initialize() { // Don't change any totems! - if (InscryptionAPIPlugin.configCustomTotemTopTypes.Value == TotemTopState.Vanilla) + if (InscryptionAPIPlugin.configCustomTotemTopModelSelection.Value == TotemTopState.Vanilla) return; if (defaultTotemTop == null) diff --git a/InscryptionCommunityPatch/Card/ActivatedAbilityHandler3D.cs b/InscryptionCommunityPatch/Card/ActivatedAbilityHandler3D.cs index 71126799..8ba48712 100644 --- a/InscryptionCommunityPatch/Card/ActivatedAbilityHandler3D.cs +++ b/InscryptionCommunityPatch/Card/ActivatedAbilityHandler3D.cs @@ -3,17 +3,34 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Fixes the Activated Ability handler in 3D Environments. +/// public class ActivatedAbilityHandler3D : ManagedBehaviour { + /// + /// The current Icon Group of . + /// public List currentIconGroup; + /// + /// The current Interactable Group of . + /// public List interactables = new(); + /// + /// A function used to add an Interactable to . + /// + /// The Interactable that we want to add. public void AddInteractable(ActivatedAbilityIconInteractable interactable) { interactables.Add(interactable); } + /// + /// Updates the List of to the passed in List. + /// + /// The list of Interactable used to replace the current list. public void UpdateInteractableList(List controllerActiveIcons) { interactables.Clear(); @@ -40,7 +57,7 @@ public void UpdateInteractableList(List controllerActiv } }); - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"[Handler3D] Updated interactable list: [{interactables.Join(interactable => $"GO [{interactable.gameObject}] Ability [{interactable.Ability}]")}]"); } diff --git a/InscryptionCommunityPatch/Card/ActivatedAbilityIconFix.cs b/InscryptionCommunityPatch/Card/ActivatedAbilityIconFix.cs index c6289e4f..df4d2558 100644 --- a/InscryptionCommunityPatch/Card/ActivatedAbilityIconFix.cs +++ b/InscryptionCommunityPatch/Card/ActivatedAbilityIconFix.cs @@ -4,13 +4,20 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Fixes related to Activated Ability Icons. +/// [HarmonyPatch] public static class ActivatedAbilityIconFix { - public static bool HasActivatedAbility(this PlayableCard card) + /// + /// A bool determining whether or not a card has an Activated Ability. + /// + /// The in which we want to see if it has a Activated Ability or not. + /// True if the card has an Activated Ability, false otherwise. + private static bool HasActivatedAbility(this PlayableCard card) { - return card.Info.Abilities.Exists(elem => AbilitiesUtil.GetInfo(elem).activated) - || card.temporaryMods.Exists(elem => elem.abilities.Exists(elem2 => AbilitiesUtil.GetInfo(elem2).activated)); + return card.Info.Abilities.Exists(elem => AbilitiesUtil.GetInfo(elem).activated) || card.temporaryMods.Exists(elem => elem.abilities.Exists(elem2 => AbilitiesUtil.GetInfo(elem2).activated)); } @@ -30,7 +37,7 @@ private static void FixActivatedAbilitiesOnAnyChange(ref PlayableCard __instance if (abilityHandler3D.SafeIsUnityNull()) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"[PlayableCard.OnStatsChanged] Adding activated ability handler to card [{__instance.Info.displayedName}]"); abilityHandler3D = __instance.gameObject.AddComponent(); @@ -38,7 +45,7 @@ private static void FixActivatedAbilitiesOnAnyChange(ref PlayableCard __instance if (!abilityHandler3D.SafeIsUnityNull() && __instance.AbilityIcons.abilityIcons != null) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"[PlayableCard.OnStatsChanged] -> Resetting icon list for [{__instance.Info.displayedName}]"); abilityHandler3D.UpdateInteractableList(__instance.AbilityIcons.abilityIcons); diff --git a/InscryptionCommunityPatch/Card/ActivatedAbilityIconInteractable.cs b/InscryptionCommunityPatch/Card/ActivatedAbilityIconInteractable.cs index ae6961bd..c803add9 100644 --- a/InscryptionCommunityPatch/Card/ActivatedAbilityIconInteractable.cs +++ b/InscryptionCommunityPatch/Card/ActivatedAbilityIconInteractable.cs @@ -3,12 +3,24 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Fixes related to how Activated Ability Interactable's are rendered on cards. +/// public class ActivatedAbilityIconInteractable : MainInputInteractable { private Material _renderMaterial; - private Color _originalColor; - private readonly Color _enterColor = new(.7f, .7f, .7f, .7f); - private readonly Color _selectedColor = new(.4f, .4f, .4f, .4f); + /// + /// The Original Interactable Color. + /// + public Color _originalColor; + /// + /// The Color used when the region is entered: ARGB: 178, 178, 178, 178 + /// + public readonly Color _enterColor = new(.7f, .7f, .7f, .7f); + /// + /// The Color used when the region is selected: ARGB: 102, 102, 102, 102 + /// + public readonly Color _selectedColor = new(.4f, .4f, .4f, .4f); private PlayableCard _playableCard; @@ -27,13 +39,23 @@ private void Start() private bool IsValidPlayableCard => _playableCard && _playableCard.OnBoard && !_playableCard.OpponentCard; + /// + /// Whether or not an Ability has been assigned, this is done by checking if the Ability is greater than . + /// public bool AbilityAssigned => Ability > Ability.None; + /// + /// The Ability associated with the Activated Ability. + /// public Ability Ability { get; private set; } + /// + /// Assigns our new interactable to the passed in Ability. + /// + /// The ability we want to update the Interactable of. public void AssignAbility(Ability ability) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"Icon was previously {Ability} - asking to change to a {ability}"); Ability = ability; _renderMaterial = GetComponent().material; @@ -55,15 +77,30 @@ private void OnButtonPressed() } } + /// + /// Set's the color of the Rendering Material related to the Activated Ability. + /// + /// public void SetColor(Color color) => _renderMaterial.color = color; + /// + /// Set's the color to using when the cursor enters the region. + /// public override void OnCursorEnter() => SetColor(_enterColor); - + /// + /// Set's the color to using when the cursor exits the region. + /// public override void OnCursorExit() => SetColor(_originalColor); - + /// + /// Set's the color to using when the cursor selects the region. + /// public override void OnCursorSelectStart() => SetColor(_selectedColor); - + /// + /// Set's the color to using when the cursor unselects the region. + /// public override void OnCursorSelectEnd() => SetColor(_originalColor); - + /// + /// Set's the color to using when the cursor drags the region. + /// public override void OnCursorDrag() => SetColor(_originalColor); } \ No newline at end of file diff --git a/InscryptionCommunityPatch/Card/AdditionalIcons.cs b/InscryptionCommunityPatch/Card/AdditionalIcons.cs index a80c0507..e480e769 100644 --- a/InscryptionCommunityPatch/Card/AdditionalIcons.cs +++ b/InscryptionCommunityPatch/Card/AdditionalIcons.cs @@ -5,8 +5,11 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Modifies how cards are rendered so up to 8 sigils can be displayed on a card. +/// [HarmonyPatch] -internal class RenderAdditionalSigils // Modifies how cards are rendered so up to 8 sigils can be displayed on a card +internal class RenderAdditionalSigils { private static Vector3 LocalScaleBase3D => SaveManager.SaveFile.IsPart1 ? new(0.2175f, 0.145f, 1f) : new(0.3f, 0.3f, 0.75f); @@ -21,6 +24,7 @@ private static GameObject NewIconGroup(CardAbilityIcons controller, Transform pa return newIconGroup; } + private static List NewIcons(GameObject newIconGroup, int slotNum, float act1ScaleMult = 1f) { List icons = new(); @@ -75,6 +79,7 @@ private static void AddQuadrupleIconSlotToCard(CardAbilityIcons controller, Tran icons[2].localPosition = new Vector3(-0.12f, -0.077f, 0f); icons[3].localPosition = new Vector3(0.12f, -0.077f, 0f); } + private static void AddQuintupleIconSlotToCard(CardAbilityIcons controller, Transform abilityIconParent) { GameObject iconGroup5 = NewIconGroup(controller, abilityIconParent, 5); @@ -98,6 +103,7 @@ private static void AddQuintupleIconSlotToCard(CardAbilityIcons controller, Tran icons[4].localPosition = new Vector3(0f, -0.125f, 0f); } } + private static void AddSextupleIconSlotToCard(CardAbilityIcons controller, Transform abilityIconParent) { GameObject iconGroup6 = NewIconGroup(controller, abilityIconParent, 6); @@ -116,6 +122,7 @@ private static void AddSextupleIconSlotToCard(CardAbilityIcons controller, Trans icons[5].localPosition = new Vector3(0.14f, -0.125f, 0f); } } + private static void AddSeptupleIconSlotToCard(CardAbilityIcons controller, Transform abilityIconParent) { GameObject iconGroup7 = NewIconGroup(controller, abilityIconParent, 7); @@ -139,6 +146,7 @@ private static void AddSeptupleIconSlotToCard(CardAbilityIcons controller, Trans icons[6].localPosition = new Vector3(0.28f, -0.125f, 0f); } } + private static void AddOctupleIconSlotToCard(CardAbilityIcons controller, Transform abilityIconParent) { GameObject iconGroup8 = NewIconGroup(controller, abilityIconParent, 8); @@ -201,6 +209,7 @@ private static GameObject NewPixelIconGroup(PixelCardAbilityIcons controller, Tr return newIconGroup; } + private static List NewPixelIcons(GameObject newIconGroup, string newIconName, float scaleMult = 1f) { List icons = new(); @@ -235,6 +244,7 @@ private static void AddTriplePixelicon(PixelCardAbilityIcons controller, Transfo icons[1].localPosition = new Vector3(0f, 0f, 0f); icons[2].localPosition = new Vector3(0.12f, 0f, 0f); } + private static void AddQuadruplePixelIcon(PixelCardAbilityIcons controller, Transform pixelParent) { GameObject pixelIconGroup4 = NewPixelIconGroup(controller, pixelParent, 4); @@ -249,6 +259,7 @@ private static void AddQuadruplePixelIcon(PixelCardAbilityIcons controller, Tran icons[2].localPosition = new Vector3(-0.08f, -0.06f, 0f); icons[3].localPosition = new Vector3(0.07f, -0.06f, 0f); } + private static void AddQuintuplePixelIcon(PixelCardAbilityIcons controller, Transform pixelParent) { GameObject pixelIconGroup5 = NewPixelIconGroup(controller, pixelParent, 5); @@ -265,6 +276,7 @@ private static void AddQuintuplePixelIcon(PixelCardAbilityIcons controller, Tran icons[3].localPosition = new Vector3(-0.08f, -0.06f, 0f); icons[4].localPosition = new Vector3(0.07f, -0.06f, 0f); } + private static void AddSextuplePixelIcon(PixelCardAbilityIcons controller, Transform pixelParent) { GameObject pixelIconGroup6 = NewPixelIconGroup(controller, pixelParent, 6); @@ -277,6 +289,7 @@ private static void AddSextuplePixelIcon(PixelCardAbilityIcons controller, Trans icons[4].localPosition = new Vector3(0f, -0.04f, 0f); icons[5].localPosition = new Vector3(0.12f, -0.04f, 0f); } + private static void AddSeptuplePixelIcon(PixelCardAbilityIcons controller, Transform pixelParent) { GameObject pixelIconGroup7 = NewPixelIconGroup(controller, pixelParent, 7); @@ -297,6 +310,7 @@ private static void AddSeptuplePixelIcon(PixelCardAbilityIcons controller, Trans icons[5].localPosition = new Vector3(0f, -0.04f, 0f); icons[6].localPosition = new Vector3(0.08f, -0.04f, 0f); } + private static void AddOctuplePixelIcon(PixelCardAbilityIcons controller, Transform pixelParent) { GameObject pixelIconGroup8 = NewPixelIconGroup(controller, pixelParent, 8); diff --git a/InscryptionCommunityPatch/Card/ArtPatches.cs b/InscryptionCommunityPatch/Card/ArtPatches.cs index ec5a0482..d11e63b4 100644 --- a/InscryptionCommunityPatch/Card/ArtPatches.cs +++ b/InscryptionCommunityPatch/Card/ArtPatches.cs @@ -4,8 +4,14 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Patches in our custom Icons for Sigils, and Cards that are missing Icons. +/// internal static class CommunityArtPatches { + /// + /// The 3D Act Icons to Patch in. + /// internal static readonly List regularIconsToPatch = new() { Ability.ActivatedDealDamage, @@ -29,6 +35,9 @@ internal static class CommunityArtPatches Ability.SquirrelStrafe }; + /// + /// The 2D Act Art Icons to Patch in. + /// internal static readonly List gbcIconsToPatch = new() { Ability.ConduitSpawnGems, @@ -62,6 +71,10 @@ internal static class CommunityArtPatches Ability.SquirrelOrbit, Ability.DrawVesselOnHit }; + + /// + /// The 3D Act Card's to Patch the Artwork of. + /// internal static readonly List regularCardsToPatch = new() { "Ant", @@ -83,6 +96,9 @@ internal static class CommunityArtPatches "Tail_Insect", }; + /// + /// Handles Patching in the Community Patches artwork. + /// internal static void PatchCommunityArt() { System.Reflection.Assembly ass = typeof(CommunityArtPatches).Assembly; @@ -95,7 +111,7 @@ internal static void PatchCommunityArt() foreach (string name in regularCardsToPatch) CardManager.BaseGameCards.CardByName(name).SetPixelPortrait(TextureHelper.GetImageAsTexture($"{name}_pixel.png", ass)); - if (PatchPlugin.undeadCatEmission.Value) + if (PatchPlugin.configEnforceUndeadCatToHaveARedEmission.Value) { CardManager.BaseGameCards.CardByName("CatUndead") .SetEmissivePortrait(TextureHelper.GetImageAsTexture("CatUndead_emission.png", ass)) diff --git a/InscryptionCommunityPatch/Card/CardCostRender.cs b/InscryptionCommunityPatch/Card/CardCostRender.cs index 1537c96c..5085de31 100644 --- a/InscryptionCommunityPatch/Card/CardCostRender.cs +++ b/InscryptionCommunityPatch/Card/CardCostRender.cs @@ -8,6 +8,9 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Fixes the Rendering related to a Card's Cost. +/// [HarmonyPatch] public static class CardCostRender { @@ -32,10 +35,15 @@ public static Texture2D GetTextureByName(string key) AssembledTextures.Add(key, texture); return texture; } - + /// /// Creates a sprite that combines all of a card's play costs. /// + /// The in which to get the Card's Cost from. + /// The in which to get the Card's Cost from. + /// The type of Sprite we are trying to combine. + /// The amount of spacing to use when combing a Card's Cost in the Vertical. + /// A Combined Cost Sprite that is Vertically stacked. public static Sprite FinalCostSprite(CardInfo cardInfo, PlayableCard playableCard, TextureHelper.SpriteType spriteType, int yStep) { Texture2D baseTexture; @@ -78,16 +86,16 @@ private static void CreateFullCostSprite(CardDisplayer __instance, CardRenderInf { __instance.costRenderer.sprite = FinalCostSprite(renderInfo.baseInfo, playableCard, TextureHelper.SpriteType.OversizedCostDecal, 28); } - else if (__instance is PixelCardDisplayer pixelDisplay && PatchPlugin.act2CostRender.Value) + else if (__instance is PixelCardDisplayer pixelDisplay && PatchPlugin.configUseAPIAct2CostRender.Value) { - if (PatchPlugin.act2VanillaStyle.Value) + if (PatchPlugin.configDisplayVanillaStyleAct2CostIcons.Value) { - __instance.costRenderer.sprite = Part2CardCostRender.FinalVanillaCostSprite(pixelDisplay, renderInfo.baseInfo, playableCard, !PatchPlugin.rightAct2Cost.Value); + __instance.costRenderer.sprite = Part2CardCostRender.FinalVanillaCostSprite(pixelDisplay, renderInfo.baseInfo, playableCard, !PatchPlugin.configDisplayAct2CostInTheTopRightCorner.Value); } else { __instance.costRenderer.sprite = FinalCostSprite(renderInfo.baseInfo, playableCard, - PatchPlugin.rightAct2Cost.Value ? TextureHelper.SpriteType.Act2CostDecalRight : TextureHelper.SpriteType.Act2CostDecalLeft, 8); + PatchPlugin.configDisplayAct2CostInTheTopRightCorner.Value ? TextureHelper.SpriteType.Act2CostDecalRight : TextureHelper.SpriteType.Act2CostDecalLeft, 8); } } } @@ -100,7 +108,7 @@ private static bool Part1CardCostDisplayerPatch(CardDisplayer __instance, ref Sp { return false; } - if (__instance is PixelCardDisplayer && PatchPlugin.act2CostRender.Value) + if (__instance is PixelCardDisplayer && PatchPlugin.configUseAPIAct2CostRender.Value) { return false; } diff --git a/InscryptionCommunityPatch/Card/GiantCardEmissionAspectFix.cs b/InscryptionCommunityPatch/Card/GiantCardEmissionAspectFix.cs index eb41d873..f3f1da7c 100644 --- a/InscryptionCommunityPatch/Card/GiantCardEmissionAspectFix.cs +++ b/InscryptionCommunityPatch/Card/GiantCardEmissionAspectFix.cs @@ -9,7 +9,7 @@ namespace InscryptionCommunityPatch.Card; [HarmonyPatch] internal class GiantCardEmissionAspectFix { /// - /// Changes the emissioner render camera's aspect ratio for Giant cards so emission texture don't appear stretched. + /// Changes the emission render camera's aspect ratio for Giant cards so emission texture don't appear stretched. /// Aspect number taken from the base texture renderer's aspect ratio. /// [HarmonyPostfix, HarmonyPatch(typeof(CardRenderCamera), nameof(CardRenderCamera.TryCreateCameraForLiveRender))] diff --git a/InscryptionCommunityPatch/Card/MergedSigilOnBottom.cs b/InscryptionCommunityPatch/Card/MergedSigilOnBottom.cs index 31e30a69..23a44a2b 100644 --- a/InscryptionCommunityPatch/Card/MergedSigilOnBottom.cs +++ b/InscryptionCommunityPatch/Card/MergedSigilOnBottom.cs @@ -4,6 +4,9 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Makes it so that Merged Sigils are shown on the Bottom of the Card. +/// [HarmonyPatch] public class MergedSigilOnBottom { @@ -22,7 +25,7 @@ private static bool DontPlaceCardModIcons_IfShowOnBottom(CardAbilityIcons __inst { // If we are showing card modifications sigils on the bottom, we don't allow the // AppyAbilitiesToIcons method to do anything - if (PatchPlugin.configMergeOnBottom.Value && PatchPlugin.configRemovePatches.Value && iconMat == __instance.emissiveIconMat) + if (PatchPlugin.configMergeSigilsOnBottom.Value && PatchPlugin.configRemoveSigilPatchesFromCards.Value && iconMat == __instance.emissiveIconMat) { foreach (AbilityIconInteractable icon in icons) { icon.gameObject.SetActive(false); @@ -40,9 +43,9 @@ private static void MoveMergeIconsToDefaultGroup_IfShowOnBottom(List de // This is the first time that the default abilities list is used once it has been built // What we want to do is take all of the abilities from the merge group and move them to the default group // if the "show merged icons on bottom" setting is active. - if (PatchPlugin.configMergeOnBottom.Value) { + if (PatchPlugin.configMergeSigilsOnBottom.Value) { defaultAbilities.AddRange(mergeAbilities); - if (PatchPlugin.configRemovePatches.Value) { + if (PatchPlugin.configRemoveSigilPatchesFromCards.Value) { mergeAbilities.Clear(); } } @@ -53,14 +56,14 @@ private static void MoveMergeIconsToDefaultGroup_IfShowOnBottom(List de [HarmonyPostfix] private static void RepositionAndRetextureMergedIcons_IfShowOnBottom(ref CardInfo info, ref AbilityInfo ability, ref AbilityIconInteractable __instance) { - if (PatchPlugin.configMergeOnBottom.Value && info != null && info.Mods.Count > 0) { + if (PatchPlugin.configMergeSigilsOnBottom.Value && info != null && info.Mods.Count > 0) { List MergeSigils = info.Mods.FindAll(x => x.fromCardMerge); if (MergeSigils.Count > 0) { foreach (CardModificationInfo mod in MergeSigils) { // if ability whose icon we're loading came from a card merge mod if (mod.abilities.Contains(ability.ability) && (__instance.name == "AbilityIcon" || __instance.name == "DefaultIcons_1Ability")) { - if (PatchPlugin.configRemovePatches.Value) { + if (PatchPlugin.configRemoveSigilPatchesFromCards.Value) { __instance.SetMaterial(Singleton.Instance.totemIconMat); if (__instance.GetComponentInParent() != null) __instance.GetComponentInParent().enabled = true; diff --git a/InscryptionCommunityPatch/Card/MissingSquirrelTribeIconFix.cs b/InscryptionCommunityPatch/Card/MissingSquirrelTribeIconFix.cs index f267a6d6..b8df2eb3 100644 --- a/InscryptionCommunityPatch/Card/MissingSquirrelTribeIconFix.cs +++ b/InscryptionCommunityPatch/Card/MissingSquirrelTribeIconFix.cs @@ -7,6 +7,9 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Patches in the Missing Squirrel Tribe Icon. +/// [HarmonyPatch] public class MissingSquirrelTribeIconFix { @@ -80,7 +83,7 @@ private static bool ShowTribeOnCard(CardInfo info, Tribe tribe) } if (tribe == Tribe.Squirrel) { - return PatchPlugin.configShowSquirrelTribeOnCards.Value; + return PatchPlugin.configCustomSquirrelTribeIconToShowOnCards.Value; } return true; diff --git a/InscryptionCommunityPatch/Card/Part1CostEmissionMaskRender.cs b/InscryptionCommunityPatch/Card/Part1CostEmissionMaskRender.cs index a1e6d639..a1378ed4 100644 --- a/InscryptionCommunityPatch/Card/Part1CostEmissionMaskRender.cs +++ b/InscryptionCommunityPatch/Card/Part1CostEmissionMaskRender.cs @@ -29,7 +29,7 @@ public static SpriteRenderer Verify3DCostEmissionMaskRenderer(CardDisplayer3D ca } else { // disable if config is false ; otherwise toggle based on appearance of emissive portrait - result.gameObject.SetActive(PatchPlugin.configCostMask.Value && emissionEnabled); + result.gameObject.SetActive(PatchPlugin.configDisplayEmissionsUnderCostIcons.Value && emissionEnabled); } return result; diff --git a/InscryptionCommunityPatch/Card/Part2CardCostRender.cs b/InscryptionCommunityPatch/Card/Part2CardCostRender.cs index 5330d53e..403c2b81 100644 --- a/InscryptionCommunityPatch/Card/Part2CardCostRender.cs +++ b/InscryptionCommunityPatch/Card/Part2CardCostRender.cs @@ -27,7 +27,7 @@ public static class Part2CardCostRender public static event Action> UpdateVanillaPlayableCardCost; - public static bool RightAct2Cost => PatchPlugin.rightAct2Cost.Value; + public static bool RightAct2Cost => PatchPlugin.configDisplayAct2CostInTheTopRightCorner.Value; public static Sprite FinalVanillaCostSprite( PixelCardDisplayer display, diff --git a/InscryptionCommunityPatch/Card/SacrificeTokensFix.cs b/InscryptionCommunityPatch/Card/SacrificeTokensFix.cs index 409e5396..139dcdc5 100644 --- a/InscryptionCommunityPatch/Card/SacrificeTokensFix.cs +++ b/InscryptionCommunityPatch/Card/SacrificeTokensFix.cs @@ -4,9 +4,14 @@ namespace InscryptionCommunityPatch.Card; -public static class SacrificeTokensFix // Allows blood costs over 4 to work properly +/// +/// Allows blood costs over 4 to work properly +/// +public static class SacrificeTokensFix { - // modders can access this to change increase/decrease the amount of tokens added + /// + /// Modders can access this to change increase/decrease the amount of tokens added + /// public static int amountOfNewTokens = 20; [HarmonyPatch(typeof(BoardManager3D), nameof(BoardManager3D.Start))] diff --git a/InscryptionCommunityPatch/Card/StackAbilityIcons.cs b/InscryptionCommunityPatch/Card/StackAbilityIcons.cs index 684847d3..17650cde 100644 --- a/InscryptionCommunityPatch/Card/StackAbilityIcons.cs +++ b/InscryptionCommunityPatch/Card/StackAbilityIcons.cs @@ -7,6 +7,9 @@ namespace InscryptionCommunityPatch.Card; +/// +/// Adds Handling for Stacking Abilities of the same type. +/// [HarmonyPatch] public static class StackAbilityIcons { @@ -25,6 +28,7 @@ public static class StackAbilityIcons TextureHelper.GetImageAsTexture("Stack_8.png", typeof(StackAbilityIcons).Assembly), TextureHelper.GetImageAsTexture("Stack_9.png", typeof(StackAbilityIcons).Assembly) }; + private static readonly Texture2D[] MEDIUM_NUMBER_TEXTURES = new Texture2D[] { TextureHelper.GetImageAsTexture("Stack_0_med.png", typeof(StackAbilityIcons).Assembly), @@ -38,6 +42,7 @@ public static class StackAbilityIcons TextureHelper.GetImageAsTexture("Stack_8_med.png", typeof(StackAbilityIcons).Assembly), TextureHelper.GetImageAsTexture("Stack_9_med.png", typeof(StackAbilityIcons).Assembly) }; + private static readonly Sprite[] GBC_NUMBER_SPRITES = new Sprite[] { GetGBCNumberSprite(1), @@ -54,7 +59,7 @@ public static class StackAbilityIcons private static Sprite GetGBCNumberSprite(int number) { string stackGBC = "stack_gbc.png"; - if (!PatchPlugin.act2StackIconType.Value) + if (!PatchPlugin.configAct2StackIconNumberStyle.Value) stackGBC = "stack_gbc_alt.png"; Texture2D texture = TextureHelper.GetImageAsTexture(stackGBC, typeof(StackAbilityIcons).Assembly); @@ -297,7 +302,7 @@ private static void ClearStackableIcons(ref List __result, CardInfo inf { int preDistinctCount = __result.Count; __result = __result.Distinct().ToList(); - if (PatchPlugin.doubleStackSplit.Value && __result.Count == 1 && preDistinctCount == 2 && AbilitiesUtil.GetInfo(__result[0]).canStack) + if (PatchPlugin.configDisplayStackableSigilsSeparately.Value && __result.Count == 1 && preDistinctCount == 2 && AbilitiesUtil.GetInfo(__result[0]).canStack) { __result.Add(__result[0]); } @@ -340,7 +345,7 @@ private static void AddIconNumber(Ability ability, CardInfo info, PlayableCard c if (count > 1) // we have a stack and need to add an override { - if (PatchPlugin.doubleStackSplit.Value && count == 2 && count == baseAbilities.Count) + if (PatchPlugin.configDisplayStackableSigilsSeparately.Value && count == 2 && count == baseAbilities.Count) __instance.SetIcon(__instance.LoadIcon(info, ai, card != null && card.OpponentCard)); else __instance.SetIcon(PatchTexture(ability, (int)count)); @@ -374,7 +379,7 @@ public static bool RenderPixelAbilityStacks(PixelCardAbilityIcons __instance, Li if (grps.Count > 0 && grps.Count - 1 < abilityIconGroups.Count) // if there are displayable sigils and there are enough icon groups { // if there is only 1 ability and there are two stacks of it, render it twice - if (PatchPlugin.doubleStackSplit.Value && grps.Count == 1 && grps[0].Item2 == 2/* && AbilitiesUtil.GetInfo(grps[0].Item1).canStack*/) + if (PatchPlugin.configDisplayStackableSigilsSeparately.Value && grps.Count == 1 && grps[0].Item2 == 2/* && AbilitiesUtil.GetInfo(grps[0].Item1).canStack*/) { //PatchPlugin.Logger.LogDebug($"Displaying {grps[0].Item1} twice"); grps[0] = new Tuple(grps[0].Item1, 1); diff --git a/InscryptionCommunityPatch/Card/TempModDecalsFix.cs b/InscryptionCommunityPatch/Card/TempModDecalsFix.cs index 8fb0cc47..5f17ae5d 100644 --- a/InscryptionCommunityPatch/Card/TempModDecalsFix.cs +++ b/InscryptionCommunityPatch/Card/TempModDecalsFix.cs @@ -7,7 +7,9 @@ namespace InscryptionCommunityPatch.Card; -// Lets you add and remove decals via temporary mods +/// +/// Lets you add and remove decals via temporary mods +/// [HarmonyPatch] internal class TempModDecalsFix { @@ -22,6 +24,7 @@ private static void RemoveTemporaryModsWithDecals(PlayableCard __instance, CardM if (cardModificationInfo != null) __instance.Info.Mods.Remove(cardModificationInfo); } + [HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.AddTemporaryMod))] [HarmonyTranspiler] private static IEnumerable AddTemporaryDecalsWithDecals(IEnumerable instructions) @@ -50,6 +53,7 @@ private static IEnumerable AddTemporaryDecalsWithDecals(IEnumer return codes; } + private static void AddDecalIdsToMods(PlayableCard card, CardModificationInfo tempMod) { // only interested in adding decals, thank you very much diff --git a/InscryptionCommunityPatch/Card/TempModPixelSigilsFix.cs b/InscryptionCommunityPatch/Card/TempModPixelSigilsFix.cs index fe23143d..e66f7ea8 100644 --- a/InscryptionCommunityPatch/Card/TempModPixelSigilsFix.cs +++ b/InscryptionCommunityPatch/Card/TempModPixelSigilsFix.cs @@ -6,7 +6,9 @@ namespace InscryptionCommunityPatch.Card; -// Lets you add and remove decals via temporary mods +/// +/// Lets you add and remove decals via temporary mods +/// [HarmonyPatch] public class TempModPixelSigilsFix { @@ -30,6 +32,12 @@ private static IEnumerable AddTemporaryMods(IEnumerable + /// This is used to Handle the Render of Temporary Sigils to the Card. + /// + /// The of the Card we are trying to apply the temporary sigils to. + /// The in which we want to apply the temporary sigils to. + /// A list of Temporary Abilities after handling the rendering of them. public static List RenderTemporarySigils(CardInfo info, PlayableCard card) { if (card == null) diff --git a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act1LatchAbilityFix.cs b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act1LatchAbilityFix.cs index 625325b3..bad566ca 100644 --- a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act1LatchAbilityFix.cs +++ b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act1LatchAbilityFix.cs @@ -78,7 +78,7 @@ private static IEnumerator Postfix(IEnumerator enumerator, Latch __state, bool w List validTargets = BoardManager.Instance.AllSlotsCopy; validTargets.RemoveAll(slot => slot.Card == null || slot.Card.Dead || __state.CardHasLatchMod(slot.Card) || slot.Card == __state.Card); - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) { PatchPlugin.Logger.LogDebug($"[LatchFix] Started death, latch name: [{__state.name}]"); PatchPlugin.Logger.LogDebug("[LatchFix] Count of Valid Targets : " + validTargets.Count); @@ -174,7 +174,7 @@ private static IEnumerator Postfix(IEnumerator enumerator, Latch __state, bool w }; mod.SetExtendedProperty("LatchMod", true); - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"[LatchFix] Selected card name [{selectedSlot.Card.name}]"); selectedSlot.Card.AddTemporaryMod(mod); diff --git a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act2ShapeshifterPatches.cs b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act2ShapeshifterPatches.cs index 2d5cf5ab..8b797f7d 100644 --- a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act2ShapeshifterPatches.cs +++ b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/Act2ShapeshifterPatches.cs @@ -54,13 +54,13 @@ public static List GetIjiraqDisguises() { if (SaveManager.SaveFile.IsPart2) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"GetIjiraqDisguises: Act2:{SaveData.Data.collection.CardInfos.Count}"); return new(SaveData.Data.collection.CardInfos); } - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"GetIjiraqDisguises: DeckCount:{RunState.Run.playerDeck.Cards.Count}"); return new(RunState.Run.playerDeck.Cards); diff --git a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryInteractionFixes.cs b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryInteractionFixes.cs index 0c47c001..b7e80421 100644 --- a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryInteractionFixes.cs +++ b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryInteractionFixes.cs @@ -63,7 +63,7 @@ public static IEnumerator NewFireAtOpposingSlot(Sentry instance, PlayableCard ot // Check if the animation is paused then unpause it if (instance.Card.Anim.Anim.speed == 0f) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"{instance.Card} is frozen, unpausing animation."); midCombat = true; // indicates that we need to restart the attack animation at the end of the sequence diff --git a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryPackMuleFixes.cs b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryPackMuleFixes.cs index ce02a3c3..9658b7ab 100644 --- a/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryPackMuleFixes.cs +++ b/InscryptionCommunityPatch/Card/Vanilla Ability Patches/SentryPackMuleFixes.cs @@ -28,7 +28,7 @@ private static IEnumerator FixPackNotExisting(IEnumerator enumerator, PackMule _ { if (__instance.pack == null) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"{__instance.PlayableCard.name} died before fully resolving on board, instantiating pack."); // Instantiates the pack object if it's null @@ -44,7 +44,7 @@ private static IEnumerator FixPackNotExisting(IEnumerator enumerator, PackMule _ yield return new WaitUntil(() => !Tween.activeTweens.Exists((TweenBase t) => t.targetInstanceID == __instance.PlayableCard.transform.GetInstanceID())); __instance.pack.SetParent(__instance.PlayableCard.transform); - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"Pack has been instantiated. Reality has been saved."); } yield return enumerator; diff --git a/InscryptionCommunityPatch/InscryptionCommunityPatch.csproj b/InscryptionCommunityPatch/InscryptionCommunityPatch.csproj index 611bf61a..ba313073 100644 --- a/InscryptionCommunityPatch/InscryptionCommunityPatch.csproj +++ b/InscryptionCommunityPatch/InscryptionCommunityPatch.csproj @@ -1,38 +1,55 @@ - - netframework4.7.2 + netframework4.7.2 + win-x64;win-x86;win-arm64;linux-x64;linux-arm;linux-arm64;linux-musl-x64;linux-musl-arm64;osx-x64;osx-arm64 + InscryptionCommunityPatch + The Community Patches For Inscryption which fixes a ton of bugs with the underlying game and adds some new functionality to it. + 2.24.2 + Cyantist, IngoH, WhistleWind, Chaosyr and Contibutors + true + Latest + InscryptionCommunityPatch + full + $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 enable disable false - latest - true - full + true + false + false + true false - 2.24.0 + true - - $(NoWarn);AD0001;CS0612;CS8604;CS0252;CS0618;Harmony003;Publicizer001 - - - + - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + diff --git a/InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs b/InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs index 2ddf4520..60c134d0 100644 --- a/InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs +++ b/InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs @@ -14,55 +14,132 @@ namespace InscryptionCommunityPatch; +/// +/// The Entry Point for the Community Patch. +/// [BepInPlugin(ModGUID, ModName, ModVer)] [BepInDependency("cyantist.inscryption.api")] public class PatchPlugin : BaseUnityPlugin { + /// + /// The GUID for the Inscryption Community Patch, if you depend on this set of Patches and their associated code, you'll want to load after it in Awake(). + /// public const string ModGUID = "community.inscryption.patch"; + /// + /// This is the Inscryption Community Patch's Internal Name, prefer identifying the Community Patch with the GUID. + /// public const string ModName = "InscryptionCommunityPatch"; - public const string ModVer = "2.24.0"; - + /// + /// This is the Version of the Inscryption Community Patch you are using. + /// + public const string ModVer = "2.24.2"; + + /// + /// This is the Plugin Instance associated with the Inscryption Community Patch. + /// internal static PatchPlugin Instance; - internal static ConfigEntry configEnergy; - internal static ConfigEntry configDrone; - internal static ConfigEntry configMox; - internal static ConfigEntry configDroneMox; - internal static ConfigEntry configShowSquirrelTribeOnCards; + /// + /// Configure whether Energy should refresh or not. Refresh meaning the per-match removal of the Energy you have acquired. + /// + internal static ConfigEntry configEnergyPerMatchCleanUp; + /// + /// Configure whether the Energy Drone should be enabled or not. + /// + internal static ConfigEntry configEnergyDrone; + /// + /// Configure whether Mox should refresh or not. Refresh meaning the per-match removal of the Mox you have acquired. + /// + internal static ConfigEntry configMoxPerMatchCleanup; + /// + /// Configure whether the Mox Drone should be enabled or not. + /// + internal static ConfigEntry configMoxDrone; + /// + /// Configure whether the Act 3 Drone or Scale Drone should be used within Act 1. + /// + internal static ConfigEntry configUtilizeDefaultDrone; + /// + /// Configure whether the Bones Display is active in Act 3 or not. + /// internal static ConfigEntry configAct3Bones; - - internal static ConfigEntry configCostMask; - internal static ConfigEntry configResetEyes; - internal static ConfigEntry undeadCatEmission; - - internal static ConfigEntry rightAct2Cost; - internal static ConfigEntry act2CostRender; - internal static ConfigEntry act2VanillaStyle; - - internal static ConfigEntry doubleStackSplit; - - internal static ConfigEntry act2StackIconType; - - internal static ConfigEntry configMergeOnBottom; - - internal static ConfigEntry configRemovePatches; - - internal static ConfigEntry configSmallPricetags; - internal static ConfigEntry configMovePricetags; - - internal static ConfigEntry configTestState; - - internal static ConfigEntry configFullDebug; - - internal static ConfigEntry configDefaultDrone; - - internal static ConfigEntry act2TutorCenterRows; - - + /// + /// Configure whether the Custom Squirrel Tribe Icon should be shown on cards. + /// + internal static ConfigEntry configCustomSquirrelTribeIconToShowOnCards; + /// + /// Configure whether to use API's custom Act 2 Cost Rendering system or not for Custom and Hybrid Costs. + /// + internal static ConfigEntry configUseAPIAct2CostRender; + /// + /// Configure whether the Act 2 Cost should be in the Top Left or Top Right corner of the card. + /// + internal static ConfigEntry configDisplayAct2CostInTheTopRightCorner; + /// + /// Configure whether Cost Icons should use the Vanilla Style icons or the Custom Ones. + /// + internal static ConfigEntry configDisplayVanillaStyleAct2CostIcons; + /// + /// Configure the rendering of the Act 2 Stack Icon Number Renders, e.g. Black Outline or Cream Outline. + /// + internal static ConfigEntry configAct2StackIconNumberStyle; + /// + /// Configure whether sigils should be merged on the bottom of a card or not. + /// + internal static ConfigEntry configMergeSigilsOnBottom; + /// + /// Configure whether the actual patch the sigil is fused with is shown or not. If not the sigil icon shows up orange. Requires to be true. + /// + internal static ConfigEntry configRemoveSigilPatchesFromCards; + /// + /// Configure whether the Stackable Sigils should be displayed as seperate icons or not. + /// + internal static ConfigEntry configDisplayStackableSigilsSeparately; + /// + /// Configure whether the Price Tags should be smaller on the cards. + /// + internal static ConfigEntry configDisplaySmallerPriceTags; + /// + /// Configure whether the Price Tags should be displayed on the Right of a card. + /// + internal static ConfigEntry configDisplayPriceTagsOnTheRight; + /// + /// Configure whether card selection rows in the Act 2 Tutor Screen should be centered or not. + /// + internal static ConfigEntry configCenterAct2TutorSelectionRows; + /// + /// Configure whether Emissions should show over or under Cost Icons. + /// + internal static ConfigEntry configDisplayEmissionsUnderCostIcons; + /// + /// Configure whether Leshy's Eye Color should reset after the 8 Bears Fight. + /// + internal static ConfigEntry configResetEyesToNormalAfter8BearsFights; + /// + /// Configure whether Undead Cat's Emission should be forced Red or not. + /// + internal static ConfigEntry configEnforceUndeadCatToHaveARedEmission; + /// + /// Configure whether the Community Patch should display complete Debug Logs or not. + /// + internal static ConfigEntry configDisplayCompleteDebugLogsInConsole; + /// + /// Configure whether the Community Patch should be in Testing Mode or not. + /// + internal static ConfigEntry configCommunityPatchTestingMode; + + /// + /// Our Community Patch's Internal Logger. + /// new internal static ManualLogSource Logger; - + /// + /// Our Community Patch's Internal Harmony Instance. + /// private readonly Harmony HarmonyInstance = new(ModGUID); + /// + /// The following runs when the Community Patch is enabled by Unity. + /// private void OnEnable() { Logger = base.Logger; @@ -70,7 +147,7 @@ private void OnEnable() HarmonyInstance.PatchAll(typeof(PatchPlugin).Assembly); SceneManager.sceneLoaded += this.OnSceneLoaded; - if (configTestState.Value) + if (configCommunityPatchTestingMode.Value) { ExecuteCommunityPatchTests.PrepareForTests(); TestCost.Init(); @@ -80,39 +157,49 @@ private void OnEnable() CommunityArtPatches.PatchCommunityArt(); } + /// + /// The following runs when the Community Patch is diabled by Unity. + /// private void OnDisable() { HarmonyInstance.UnpatchSelf(); } + /// + /// This is our Community Patch's Initializer, we primarily use it to set the internal Instance of the Community Patcher and create the Configurations to the Configuration File. + /// private void Awake() { Instance = this; - configEnergy = Config.Bind("Energy", "Energy Refresh", true, "Max energy increases and energy refreshes at end of turn"); - configDrone = Config.Bind("Energy", "Energy Drone", false, "Drone is visible to display energy (requires Energy Refresh)"); - configDefaultDrone = Config.Bind("Energy", "Default Drone", false, "Drone uses the vanilla model instead of being attached to the scales (requires Energy Drone)"); - configMox = Config.Bind("Mox", "Mox Refresh", true, "Mox refreshes at end of battle"); - configDroneMox = Config.Bind("Mox", "Mox Drone", false, "Drone displays mox (requires Energy Drone and Mox Refresh)"); + configEnergyPerMatchCleanUp = Config.Bind("Energy", "Energy Refresh", true, "Max energy increases and energy refreshes at end of turn"); + configEnergyDrone = Config.Bind("Energy", "Energy Drone", false, "Drone is visible to display energy (requires Energy Refresh)"); + configUtilizeDefaultDrone = Config.Bind("Energy", "Default Drone", false, "Drone uses the vanilla model instead of being attached to the scales (requires Energy Drone)"); + configMoxPerMatchCleanup = Config.Bind("Mox", "Mox Refresh", true, "Mox refreshes at end of battle"); + configMoxDrone = Config.Bind("Mox", "Mox Drone", false, "Drone displays mox (requires Energy Drone and Mox Refresh)"); configAct3Bones = Config.Bind("Bones", "Act 3 Bones", false, "Force bones displayer to be active in Act 3"); - configShowSquirrelTribeOnCards = Config.Bind("Tribes", "Show Squirrel Tribe", false, "Shows the Squirrel tribe icon on cards"); - act2CostRender = Config.Bind("Card Costs", "GBC Cost render", true, "GBC Cards are able to display custom costs and hybrid costs through the API."); - rightAct2Cost = Config.Bind("Card Costs", "GBC Cost On Right", true, "GBC Cards display their costs on the top-right corner. If false, display on the top-left corner"); - act2VanillaStyle = Config.Bind("Card Costs", "GBC Vanilla Render", false, "GBC cards use vanilla sprites when rendering multiple and custom costs."); - configMergeOnBottom = Config.Bind("Sigil Display", "Merge_On_Botom", false, "Makes it so if enabled, merged sigils will display on the bottom of the card instead of on the artwork. In extreme cases, this can cause some visual bugs."); - configRemovePatches = Config.Bind("Sigil Display", "Remove_Patches", false, "Makes it so if enabled, merged sigils will not have a patch behind them anymore and will instead be glowing yellow (only works with Merge_On_Bottom)."); - doubleStackSplit = Config.Bind("Sigil Display", "Vanilla Stacking", false, "If enabled, cards with only two visible sigils will display each separately even if they can stack."); - - configSmallPricetags = Config.Bind("Act 1", "Smaller Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be scaled down."); - configMovePricetags = Config.Bind("Act 1", "Move Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be moved to the right."); - act2StackIconType = Config.Bind("Sigil Display", "Act 2 Sigil icon type", true, "If true, stacking icons are a cream outline with a black center. If false, stacking icons are a black outline with a cream center. Act 2"); - act2TutorCenterRows = Config.Bind("Act 2", "Centred Hoarder UI", true, "If true, centres displayed cards in each row during the Hoarder selection sequence."); - configFullDebug = Config.Bind("General", "Full Debug", true, "If true, displays all debug logs in the console."); - configTestState = Config.Bind("General", "Test Mode", false, "Puts the game into test mode. This will cause (among potentially other things) a new run to spawn a number of cards into your opening deck that will demonstrate card behaviors."); - configResetEyes = Config.Bind("Act 1", "Reset Red Eyes", false, "Resets Leshy's eyes to normal if they were turned red due to a boss fight's grizzly bear sequence."); - configCostMask = Config.Bind("Act 1", "Render Costs Above Emission", true, "Applies a mask to card emissions that prevents them from covering play costs when rendering in-game."); - undeadCatEmission = Config.Bind("General", "Undead Cat Emission", false, "If true, Undead Cat will have a forced red emission."); + configCustomSquirrelTribeIconToShowOnCards = Config.Bind("Tribes", "Show Squirrel Tribe", false, "Shows the Squirrel tribe icon on cards"); + configUseAPIAct2CostRender = Config.Bind("Card Costs", "GBC Cost render", true, "GBC Cards are able to display custom costs and hybrid costs through the API."); + configDisplayAct2CostInTheTopRightCorner = Config.Bind("Card Costs", "GBC Cost On Right", true, "GBC Cards display their costs on the top-right corner. If false, display on the top-left corner"); + configDisplayVanillaStyleAct2CostIcons = Config.Bind("Card Costs", "GBC Vanilla Render", false, "GBC cards use vanilla sprites when rendering multiple and custom costs."); + configAct2StackIconNumberStyle = Config.Bind("Sigil Display", "GBC Stack Icon Number Rendering", true, "If true, stacking icons are a cream outline with a black center. If false, stacking icons are a black outline with a cream center. Act 2"); + configMergeSigilsOnBottom = Config.Bind("Sigil Display", "Merge_On_Bottom", false, "Makes it so if enabled, merged sigils will display on the bottom of the card instead of on the artwork. In extreme cases, this can cause some visual bugs."); + configRemoveSigilPatchesFromCards = Config.Bind("Sigil Display", "Remove_Patches", false, "Makes it so if enabled, merged sigils will not have a patch behind them anymore and will instead be glowing yellow (only works with Merge_On_Bottom)."); + configDisplayStackableSigilsSeparately = Config.Bind("Sigil Display", "Vanilla Stacking", false, "If enabled, cards with only two visible sigils will display each separately even if they can stack."); + configDisplaySmallerPriceTags = Config.Bind("Act 1", "Smaller Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be scaled down."); + configDisplayPriceTagsOnTheRight = Config.Bind("Act 1", "Move Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be moved to the right."); + configCenterAct2TutorSelectionRows = Config.Bind("Act 2", "Centred Hoarder UI", true, "If true, centers displayed cards in each row during the Hoarder selection sequence."); + configResetEyesToNormalAfter8BearsFights = Config.Bind("Act 1", "Reset Red Eyes", false, "Resets Leshy's eyes to normal if they were turned red due to a boss fight's grizzly bear sequence."); + configDisplayEmissionsUnderCostIcons = Config.Bind("Act 1", "Render Costs Above Emission", true, "Applies a mask to card emissions that prevents them from covering play costs when rendering in-game."); + configEnforceUndeadCatToHaveARedEmission = Config.Bind("General", "Undead Cat Emission", false, "If true, Undead Cat will have a forced red emission."); + configDisplayCompleteDebugLogsInConsole = Config.Bind("General", "Full Debug", true, "If true, displays all debug logs in the console."); + configCommunityPatchTestingMode = Config.Bind("General", "Test Mode", false, "Puts the game into test mode. This will cause (among potentially other things) a new run to spawn a number of cards into your opening deck that will demonstrate card behaviors."); } + /// + /// A simple function that runs when a Scene has Loaded in Unity. + /// + /// The Scene in which we are trying to Load things during. + /// The Mode in which to Load the Scene with. private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { EnergyDrone.TryEnableEnergy(scene.name); diff --git a/InscryptionCommunityPatch/PixelTutor/Act2TutorFix.cs b/InscryptionCommunityPatch/PixelTutor/Act2TutorFix.cs index e7960847..28e5b4bc 100644 --- a/InscryptionCommunityPatch/PixelTutor/Act2TutorFix.cs +++ b/InscryptionCommunityPatch/PixelTutor/Act2TutorFix.cs @@ -7,7 +7,9 @@ namespace InscryptionCommunityPatch.PixelTutor; -// fixes Tutor to work in Act 2 +/// +/// Patches in our Act 2 related UI, that way it doesn't break when used in Act 2. +/// [HarmonyPatch] public static class Act2TutorFix { @@ -87,6 +89,12 @@ private static IEnumerator PixelTutorSequence(IEnumerator enumerator, Deck __ins yield return Singleton.Instance.SpawnCardToHand(selectedCard); } + /// + /// An called when selecting a card through the Ability in Act 2. + /// + /// The current instance of the . + /// The call back used when a Card is Selected. + /// The callback passed in triggered when a card is selected. public static IEnumerator ChoosePixelCard(Deck instance, Action cardSelectedCallback) { PixelPlayableCard selectedCard = null; diff --git a/InscryptionCommunityPatch/PixelTutor/PixelPlayableCardArray.cs b/InscryptionCommunityPatch/PixelTutor/PixelPlayableCardArray.cs index 9a3bc244..7441b81a 100644 --- a/InscryptionCommunityPatch/PixelTutor/PixelPlayableCardArray.cs +++ b/InscryptionCommunityPatch/PixelTutor/PixelPlayableCardArray.cs @@ -9,10 +9,19 @@ namespace InscryptionCommunityPatch.PixelTutor; +/// +/// Handles the UI related to the Act 2 patched in by . +/// public class PixelPlayableCardArray : ManagedBehaviour { + /// + /// The Selected Card, by default null. + /// public PixelPlayableCard selectedCard = null; + /// + /// The Cards to Display when is triggered in Act 2, by default an empty list. + /// public readonly List displayedCards = new(); private PixelPlayableCard gameObjectReference = null; @@ -34,8 +43,14 @@ public class PixelPlayableCardArray : ManagedBehaviour private GamepadGridControl gamepadGrid; - public IEnumerator DisplayUntilCancelled(List cards, - Func cancelCondition, Action cardsPlacedCallback = null) + /// + /// An used to make the Act 2 display show until it's cancelled, e.g. by a card being selected.. + /// + /// The cards available for selection. + /// The condition needed to cancel the screen showing when would be triggered. + /// The callback for when the card(s) has/have been placed. + /// The Act 2 screen shown in game. + public IEnumerator DisplayUntilCancelled(List cards, Func cancelCondition, Action cardsPlacedCallback = null) { //Debug.Log($"{cards.Exists(x => x == null)}"); cards.RemoveAll(x => x == null); @@ -58,9 +73,15 @@ public IEnumerator DisplayUntilCancelled(List cards, CleanUpButtons(); } - public IEnumerator SelectPixelCardFrom( - List cards, Action cardSelectedCallback, - Func cancelCondition = null, bool forPositiveEffect = true) + /// + /// An used to determine the selection for when the Act 2 is triggered. + /// + /// The cards we want to show. + /// The call back for when a Card has been selected. + /// The condition by which to cancel the Selection screen. + /// Whether the special ability should use a Positive Effect when the card is shown in selection. + /// A selection screen of cards to be selected from. + public IEnumerator SelectPixelCardFrom(List cards, Action cardSelectedCallback, Func cancelCondition = null, bool forPositiveEffect = true) { //Debug.Log($"{cards.Exists(x => x == null)}"); cards.RemoveAll(x => x == null); @@ -122,6 +143,7 @@ public IEnumerator SelectPixelCardFrom( cardSelectedCallback?.Invoke(selectedCard); } } + private void InitialiseButtons(List cards, bool deckReview, bool forPositiveEffect) { if (forwardButton == null) @@ -156,6 +178,7 @@ private void InitialiseButtons(List cards, bool deckReview, bool forPo backButton.gameObject.SetActive(false); EnableButtons(false); } + private void CleanUpButtons() { if (forwardButton.gameObject.activeSelf) @@ -164,17 +187,20 @@ private void CleanUpButtons() backButton.gameObject.SetActive(false); } } + private void EnableButtons(bool enable) { forwardButton.SetEnabled(enable); backButton.SetEnabled(enable); } + private void OnChangePage(bool forwards, List cards, bool deckReview, bool forPositiveEffect) { EnableButtons(false); SetCardsEnabled(enabled: false); base.StartCoroutine(ChangePage(forwards, cards, deckReview, forPositiveEffect)); } + private IEnumerator ChangePage(bool forwards, List cards, bool deckReview, bool forPositiveEffect) { yield return CleanUpCards(); @@ -188,6 +214,15 @@ private IEnumerator ChangePage(bool forwards, List cards, bool deckRev SetCardsEnabled(enabled: true); EnableButtons(true); } + + /// + /// A function used to get the card's position. + /// + /// The Index of the card we are after within the row of cards. + /// The amount of cards to place in the row of cards. + /// The number of rows on the screen. + /// The amount of cards placed in the row of cards. + /// protected Vector3 GetCardPosition(int cardIndex, int cardsToPlace, int numRows, int cardsPerRow) { int cardRowIndex = Mathf.FloorToInt(cardIndex / cardsPerRow); @@ -196,6 +231,7 @@ protected Vector3 GetCardPosition(int cardIndex, int cardsToPlace, int numRows, float zPos = 0f + 0.01f * cardRowIndex; return new Vector3(xPos, yPos, zPos); } + private float GetXPos(int cardIndex, int cardRowIndex, int cardsToPlace, int cardsPerRow) { float cardGap = 0.41f; @@ -205,7 +241,7 @@ private float GetXPos(int cardIndex, int cardRowIndex, int cardsToPlace, int car float multiplier = cardIndex - positionInRow; // when there are <7 cards, we need to centre them - if (PatchPlugin.act2TutorCenterRows.Value && cardsLeftToPlace > 0 && cardsLeftToPlace < cardsPerRow) + if (PatchPlugin.configCenterAct2TutorSelectionRows.Value && cardsLeftToPlace > 0 && cardsLeftToPlace < cardsPerRow) { anchor = centreAnchor; multiplier = cardIndex - positionInRow - (cardsLeftToPlace - 1) / 2f; @@ -213,6 +249,11 @@ private float GetXPos(int cardIndex, int cardRowIndex, int cardsToPlace, int car return anchor + cardGap * multiplier; } + + /// + /// An used to Clean Up the card's in the screen. + /// + /// The cleaned up menu and a switch back to the Board context. protected IEnumerator CleanUpCards() { List list = new(displayedCards); @@ -231,6 +272,15 @@ protected IEnumerator CleanUpCards() SetBoardEnabled(true); } + /// + /// An related to the spawning and placement of card's to the screen. + /// + /// The List of to place into the Menu. + /// The Number of Rows alloted to the Menu. + /// The Index of the current Selection Screen's pages. + /// Whether or not after this was triggered we should go to the Deck for review. + /// Whether the special ability should use a Positive Effect when the card is shown in selection. + /// The readied screen of cards to show in our selection. protected IEnumerator SpawnAndPlaceCards(List cards, int numRows, int pageIndex, bool isDeckReview = false, bool forPositiveEffect = true) { if (numRows < 1) { @@ -266,6 +316,11 @@ protected IEnumerator SpawnAndPlaceCards(List cards, int numRows, int } } + /// + /// Handles the tweening of a card to the specified position. + /// + /// The Card Transform we want to tween. + /// The Vector3 related to where the Card is located. protected void TweenInCard(Transform cardTransform, Vector3 cardPos) { cardTransform.localPosition = cardPos; diff --git a/InscryptionCommunityPatch/ResourceManagers/ActOneEnergyDrone.cs b/InscryptionCommunityPatch/ResourceManagers/ActOneEnergyDrone.cs index 0f7fe52f..1c6a45f3 100644 --- a/InscryptionCommunityPatch/ResourceManagers/ActOneEnergyDrone.cs +++ b/InscryptionCommunityPatch/ResourceManagers/ActOneEnergyDrone.cs @@ -8,6 +8,9 @@ namespace InscryptionCommunityPatch.ResourceManagers; +/// +/// This patch handles information related to the Drone Configuration for Act 1. +/// [HarmonyPatch] public static class EnergyDrone { @@ -16,11 +19,26 @@ public static class EnergyDrone /// public class EnergyConfigInfo { - public bool ConfigEnergy { get; set; } = PoolHasEnergy || PatchPlugin.configEnergy.Value; - public bool ConfigShowDrone { get; set; } = PoolHasEnergy || PatchPlugin.configDrone.Value; - public bool ConfigDroneMox { get; set; } = PoolHasGems || PatchPlugin.configDroneMox.Value; - public bool ConfigMox { get; set; } = PoolHasGems || PatchPlugin.configMox.Value; - public bool ConfigDefaultDrone { get; set; } = PatchPlugin.configDefaultDrone.Value; + /// + /// Whether or not the Energy Drone should be shown. + /// + public bool ConfigShowDrone { get; set; } = PoolHasEnergy || PatchPlugin.configEnergyDrone.Value; + /// + /// Whether or not the Energy Drone should be refreshed per match. + /// + public bool ConfigEnergy { get; set; } = PoolHasEnergy || PatchPlugin.configEnergyPerMatchCleanUp.Value; + /// + /// Whether or not the Mox Drone should be shown. + /// + public bool ConfigDroneMox { get; set; } = PoolHasGems || PatchPlugin.configMoxDrone.Value; + /// + /// Whether or not the Mox Drone should be refreshed per match. + /// + public bool ConfigMox { get; set; } = PoolHasGems || PatchPlugin.configMoxPerMatchCleanup.Value; + /// + /// Whether or not the Default Drone should be used. + /// + public bool ConfigDefaultDrone { get; set; } = PatchPlugin.configUtilizeDefaultDrone.Value; /// /// Controls whether or not the Drone will appear. By default, will appear if there are obtainable Energy or Mox cards in the card pool (or the corresponding config value has been set). @@ -38,7 +56,12 @@ public class EnergyConfigInfo { CardTemple.Tech, new() }, { CardTemple.Wizard, new() } }; - + + /// + /// Validator used to ensure a Scene can have the Drone or not. + /// + /// The scene we are checking. + /// True if the scene can have the drone, false otherwise. public static bool SceneCanHaveEnergyDrone(string sceneName) { string activeSceneName = sceneName.ToLowerInvariant(); @@ -48,6 +71,9 @@ public static bool SceneCanHaveEnergyDrone(string sceneName) return activeSceneName.Contains("magnificus") || activeSceneName.Contains("grimora"); } + /// + /// Determines whether the current Scene can have the Drone or not. Verified via . + /// public static bool CurrentSceneCanHaveEnergyDrone { get @@ -61,7 +87,7 @@ public static bool CurrentSceneCanHaveEnergyDrone } /// - /// Returns the EnergyConfigInfo object corresponding to the current Act. + /// Returns the object corresponding to the current Act. /// public static EnergyConfigInfo GetEnergyConfig() { @@ -78,14 +104,26 @@ public static EnergyConfigInfo GetEnergyConfig() } /// - /// The EnergyConfigInfo for the current Act. + /// The for the current Act. /// private static EnergyConfigInfo EnergyConfig => GetEnergyConfig(); + /// + /// Used to determine whether the current Card Pool has Energy or not. + /// public static bool PoolHasEnergy { get; private set; } + /// + /// Used to determine whether the current Card Pool has Mox or not. + /// public static bool PoolHasGems { get; private set; } - private static bool CardIsVisible(this CardInfo info, CardTemple targetTemple) + /// + /// Determines whether or not a card is a part of the targeted temple passed in through targetTemple, and if they have the meta categories needed in order for them to show up. + /// + /// The of the card we are checking. + /// The temple in which we are targetting. Options are Nature -> Act 1, Undead -> Grimora, Wizard -> Magnificus. + /// True if the Card is part of one of the temples we are after, and if the card has any of the meta categories needed to show up in the given act, otherwise false. + public static bool CardIsVisible(this CardInfo info, CardTemple targetTemple) { // if the CardInfo can't appear in this part of the game - Act 1 = Nature, Grimora = Undead, Magnificus = Wizard if (info.temple != targetTemple) @@ -119,7 +157,7 @@ internal static void TryEnableEnergy(string sceneName) private static IEnumerator AwakeDrone() { // pretty sure the drone can't be null in this method, but we'll check just in case - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug($"Awaking ResourceDrone, instance exists? {ResourceDrone.Instance != null}."); yield return new WaitForSeconds(1f); @@ -132,6 +170,7 @@ private static IEnumerator AwakeDrone() else AttachDroneToScale(); } + private static void AttachDroneToScale() { try @@ -189,6 +228,7 @@ private static bool Act1ResourceDrone_SetOnBoard(ResourceDrone __instance, bool return false; } + [HarmonyPrefix, HarmonyPatch(typeof(ResourceDrone), nameof(ResourceDrone.UpdateCellAndGemColors))] private static bool DisableUpdateWhenNull() { @@ -196,6 +236,7 @@ private static bool DisableUpdateWhenNull() return false; return true; } + [HarmonyPatch(typeof(Part1ResourcesManager), nameof(Part1ResourcesManager.CleanUp))] [HarmonyPrefix] private static void Part1ResourcesManager_CleanUp(Part1ResourcesManager __instance) diff --git a/InscryptionCommunityPatch/ResourceManagers/ActThreeBonesDisplayer.cs b/InscryptionCommunityPatch/ResourceManagers/ActThreeBonesDisplayer.cs index 0d962fb1..467ece78 100644 --- a/InscryptionCommunityPatch/ResourceManagers/ActThreeBonesDisplayer.cs +++ b/InscryptionCommunityPatch/ResourceManagers/ActThreeBonesDisplayer.cs @@ -10,13 +10,33 @@ namespace InscryptionCommunityPatch.ResourceManagers; +/// +/// This patch handles adding the Bones Displayer to the Drone. +/// [HarmonyPatch] public static class Act3BonesDisplayer { + /// + /// A bool determining whether the Bones Displayer should be forced to active. + /// public static bool ForceBonesDisplayActive { get; set; } = false; + /// + /// A bool determining whether the Bones Displayer is active, namely when any one of the following are true; + ///
+ /// - + ///
+ /// - + ///
+ /// - + ///
public static bool DisplayAct3Bones => ForceBonesDisplayActive || PoolHasBones || PatchPlugin.configAct3Bones.Value; + /// + /// Determines whether or not a card is a part of the Tech Temple, and whether it has a Meta Category that can show in Act 3. + /// + /// The of the card we are checking. + /// True if the card is a part of the Technology temple, and if the card has any of the meta categories needed to show up in the given act, otherwise false. private static bool CardIsVisible(this CardInfo info) { if (info.temple != CardTemple.Tech) @@ -24,12 +44,17 @@ private static bool CardIsVisible(this CardInfo info) // Now we check metacategories // If the card's metacategories are set such that it can't actually appear, don't count it - return info.metaCategories.Exists((CardMetaCategory x) => - x == CardMetaCategory.ChoiceNode || x == CardMetaCategory.Part3Random || x == CardMetaCategory.Rare); + return info.metaCategories.Exists((CardMetaCategory x) => x == CardMetaCategory.ChoiceNode || x == CardMetaCategory.Part3Random || x == CardMetaCategory.Rare); } + /// + /// Determines whether the Card Pool has any cards that cost Bones, verified with . + /// public static bool PoolHasBones => CardManager.AllCardsCopy.Any(ci => ci.BonesCost > 0 && ci.CardIsVisible()); + /// + /// Determines whether the current Scene can have the Bones Displayer or not. + /// public static bool SceneCanHaveBonesDisplayer { get diff --git a/InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs b/InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs index b74bab35..aa61fff4 100644 --- a/InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs +++ b/InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs @@ -4,23 +4,26 @@ namespace InscryptionCommunityPatch.Sequencers; +/// +/// Patches in Smaller Price tags and a moved Price tag when either the and are true respectively. +/// [HarmonyPatch] internal class BuyPeltsSmallTags { [HarmonyPostfix, HarmonyPatch(typeof(BuyPeltsSequencer), nameof(BuyPeltsSequencer.AddPricetagToCard))] private static void ReducePricetagSize(SelectableCard card) { - if (PatchPlugin.configSmallPricetags.Value || PatchPlugin.configMovePricetags.Value) + if (PatchPlugin.configDisplaySmallerPriceTags.Value || PatchPlugin.configDisplayPriceTagsOnTheRight.Value) { Transform t = card.transform.Find("pricetag"); if (t == null) return; - if (PatchPlugin.configSmallPricetags.Value) + if (PatchPlugin.configDisplaySmallerPriceTags.Value) { t.localScale = new(0.75f, 1f, 0.75f); } - if (PatchPlugin.configMovePricetags.Value) + if (PatchPlugin.configDisplayPriceTagsOnTheRight.Value) { t.localPosition = new(t.localPosition.x * -1, t.localPosition.y, t.localPosition.z); } diff --git a/InscryptionCommunityPatch/Sequencers/CardCostChoiceNodePatch.cs b/InscryptionCommunityPatch/Sequencers/CardCostChoiceNodePatch.cs index 2451696b..6eb2266e 100644 --- a/InscryptionCommunityPatch/Sequencers/CardCostChoiceNodePatch.cs +++ b/InscryptionCommunityPatch/Sequencers/CardCostChoiceNodePatch.cs @@ -5,6 +5,9 @@ namespace InscryptionCommunityPatch.Sequencers; +/// +/// Patches in Our Cost Card Backs into the function for Energy and Mox costs. +/// [HarmonyPatch] internal static class ChoiceNodePatch { @@ -21,5 +24,11 @@ private static void CardSingleChoicesSequencer_GetCardbackTexture(ref Texture __ break; } } - public static string MoxTextureName(int index) => "moxCost" + (index switch { 1 => "Green", 2 => "Orange", 3 => "Blue", _ => "" }) + ".png"; + + /// + /// Handles getting the correct Mox Texture Name for usage in the patch. + /// + /// 1 -> Green, 2 -> Orange, 3 -> Blue, otherwise -> Empty + /// A string texture name in the form of moxCost{Color}.png + private static string MoxTextureName(int index) => "moxCost" + (index switch { 1 => "Green", 2 => "Orange", 3 => "Blue", _ => "" }) + ".png"; } \ No newline at end of file diff --git a/InscryptionCommunityPatch/Sequencers/CardStatBoostSequencerPatch.cs b/InscryptionCommunityPatch/Sequencers/CardStatBoostSequencerPatch.cs index ce4eeae2..701f4736 100644 --- a/InscryptionCommunityPatch/Sequencers/CardStatBoostSequencerPatch.cs +++ b/InscryptionCommunityPatch/Sequencers/CardStatBoostSequencerPatch.cs @@ -7,6 +7,9 @@ namespace InscryptionCommunityPatch.Sequencers; +/// +/// This patches in a conditional check as to whether or not the card has Boostable Stats or not. +/// [HarmonyPatch] internal class CardStatBoostSequencerPatch { @@ -127,7 +130,7 @@ private static IEnumerator NewStatBoostSequence(CardStatBoostSequencer instance, // if there aren't any valid cards, exit the sequence if (instance.GetValidCards(forAttackMod: attackMod).Count == 0) { - if (PatchPlugin.configFullDebug.Value) + if (PatchPlugin.configDisplayCompleteDebugLogsInConsole.Value) PatchPlugin.Logger.LogDebug("Player has no cards that can be boosted at the campfire."); yield return new WaitForSeconds(0.5f); yield return Singleton.Instance.ShowUntilInput("You have no creatures to warm."); diff --git a/InscryptionCommunityPatch/Sequencers/LeshyResetRedEyes.cs b/InscryptionCommunityPatch/Sequencers/LeshyResetRedEyes.cs index 0e9f940b..14abbca9 100644 --- a/InscryptionCommunityPatch/Sequencers/LeshyResetRedEyes.cs +++ b/InscryptionCommunityPatch/Sequencers/LeshyResetRedEyes.cs @@ -4,13 +4,17 @@ namespace InscryptionCommunityPatch.Sequencers; +/// +/// This patch applies when is set to true. +/// When set to true after the boss has been beat, it resets their eyes back to normal rather than remaining red. +/// [HarmonyPatch] internal class LeshyResetRedEyes { [HarmonyPostfix, HarmonyPatch(typeof(TurnManager), nameof(TurnManager.CleanupPhase))] private static IEnumerator ResetLeshyEyes(IEnumerator enumerator, TurnManager __instance) { - if (!PatchPlugin.configResetEyes.Value || !SaveManager.SaveFile.IsPart1 || __instance.opponent == null) + if (!PatchPlugin.configResetEyesToNormalAfter8BearsFights.Value || !SaveManager.SaveFile.IsPart1 || __instance.opponent == null) { yield return enumerator; yield break; diff --git a/InscryptionCommunityPatch/Sequencers/PackRatNodeBackgroundFix.cs b/InscryptionCommunityPatch/Sequencers/PackRatNodeBackgroundFix.cs index 0cdd0a8f..d68724a8 100644 --- a/InscryptionCommunityPatch/Sequencers/PackRatNodeBackgroundFix.cs +++ b/InscryptionCommunityPatch/Sequencers/PackRatNodeBackgroundFix.cs @@ -4,7 +4,9 @@ namespace InscryptionCommunityPatch.Sequencers; -// 'fixes' the pack rat card not being rare +/// +/// Corrects the Pack Rat Card to be a Rare Card. +/// [HarmonyPatch] internal class PackRatNodeBackgroundFix { diff --git a/InscryptionCommunityPatch/Sequencers/TradeableTalkingCardFix.cs b/InscryptionCommunityPatch/Sequencers/TradeableTalkingCardFix.cs index 9dadc5ff..deaeb1db 100644 --- a/InscryptionCommunityPatch/Sequencers/TradeableTalkingCardFix.cs +++ b/InscryptionCommunityPatch/Sequencers/TradeableTalkingCardFix.cs @@ -6,9 +6,19 @@ namespace InscryptionCommunityPatch.Sequencers; +/// +/// This patch fixes Tradable Talking Card related Issues. +/// [HarmonyPatch] public class TradeableTalkingCardFix { + /// + /// Patches the to allow for better handling regarding the Trade of Talking Cards. + /// + /// The Class Instance associated with the function e.g. . + /// The slot the card was found in. + /// The card being traded for. + /// This only returns our patched variant if the card is a talking card, otherwise it uses vanilla handling. [HarmonyPrefix, HarmonyPatch(typeof(TradeCardsForPelts), nameof(TradeCardsForPelts.OnTradableSelected))] private static bool OnTalkingCardSelected(TradeCardsForPelts __instance, HighlightedInteractable slot, PlayableCard card) { @@ -42,6 +52,11 @@ private static bool OnTalkingCardSelected(TradeCardsForPelts __instance, Highlig return false; } + /// + /// Handles the View associated with a trade specific to Talking Cards. + /// + /// The card in which is being given to the player. + /// The card added to hand, then a switch back to the trading pool. public static IEnumerator TradeForTalkingCard(PlayableCard card) { yield return Singleton.Instance.AddCardToHand(CardSpawner.SpawnPlayableCard(card.Info), new Vector3(0f, 0.5f, -3f), 0f); diff --git a/InscryptionCommunityPatch/Tests/DebugCards.cs b/InscryptionCommunityPatch/Tests/DebugCards.cs index fa89916a..1df18b48 100644 --- a/InscryptionCommunityPatch/Tests/DebugCards.cs +++ b/InscryptionCommunityPatch/Tests/DebugCards.cs @@ -4,6 +4,9 @@ namespace InscryptionCommunityPatch.Tests; +/// +/// This class adds some Debug Cards for testing the Steel Trap Death Patch in the Main API's functionality. +/// public class DebugCards { /// diff --git a/InscryptionCommunityPatch/Tests/TestBoons.cs b/InscryptionCommunityPatch/Tests/TestBoons.cs index 3a41d4fc..55c2f216 100644 --- a/InscryptionCommunityPatch/Tests/TestBoons.cs +++ b/InscryptionCommunityPatch/Tests/TestBoons.cs @@ -4,13 +4,26 @@ namespace InscryptionCommunityPatch.Tests; +/// +/// This is a test related to Boons. +/// public class SacrificeSquirrels : BoonBehaviour { + /// + /// This makes the Boon respond specifically when resolving a card other than itself being a Squirrel. + /// + /// The being resolved. + /// True when the Card Being Resolved other than itself is a Squirrel. public override bool RespondsToOtherCardResolve(PlayableCard otherCard) { return otherCard.Info.name.ToLowerInvariant().Equals("squirrel"); } + /// + /// This triggers when returns True. When it triggers it gives the cards the Unkillable Sigil after playing the Boon's Animation, then Render's the card. + /// + /// The being resolved. + /// The updated and rerendered with the Unkillable Sigil. public override IEnumerator OnOtherCardResolve(PlayableCard otherCard) { yield return this.PlayBoonAnimation(); diff --git a/InscryptionCommunityPatch/Tests/TestCommunityPatches.cs b/InscryptionCommunityPatch/Tests/TestCommunityPatches.cs index 4745fadf..3703805d 100644 --- a/InscryptionCommunityPatch/Tests/TestCommunityPatches.cs +++ b/InscryptionCommunityPatch/Tests/TestCommunityPatches.cs @@ -6,11 +6,20 @@ namespace InscryptionCommunityPatch.Tests; +/// +/// The home of the Community Patch's Tests/ +/// [HarmonyPatch] public static class ExecuteCommunityPatchTests { + /// + /// The Boon associated with our Test Boon described in . + /// public static BoonData.Type TestBoon; + /// + /// This function prepares our Tests. + /// public static void PrepareForTests() { AbilityManager.BaseGameAbilities.AbilityByID(Ability.Sharp).Info.canStack = true; @@ -23,11 +32,15 @@ public static void PrepareForTests() Resources.Load("art/cards/boons/boonportraits/boon_startinggoat"), false, true, true); } + /// + /// This function patches in our Tests at the start of a New Ascension Run. + /// + /// [HarmonyPatch(typeof(AscensionSaveData), nameof(AscensionSaveData.NewRun))] [HarmonyPostfix] private static void StartRunInTestMode(ref AscensionSaveData __instance) { - if (PatchPlugin.configTestState.Value) + if (PatchPlugin.configCommunityPatchTestingMode.Value) { List testAbilityList = new() { Ability.Sharp, Ability.DebuffEnemy, Ability.CreateDams, Ability.DrawRabbits, Ability.Strafe, Ability.Deathtouch, Ability.DoubleStrike, Ability.Reach, Ability.BeesOnHit }; diff --git a/InscryptionCommunityPatch/Tests/TestCost.cs b/InscryptionCommunityPatch/Tests/TestCost.cs index c0b2b896..336197a8 100644 --- a/InscryptionCommunityPatch/Tests/TestCost.cs +++ b/InscryptionCommunityPatch/Tests/TestCost.cs @@ -8,9 +8,18 @@ namespace InscryptionCommunityPatch.Tests; +/// +/// This function defines our Testing Cost. +/// public class TestCost : CustomCardCost { + /// + /// The Name of the Custom Cost. + /// public override string CostName => "TestCost"; + /// + /// This function initializes our Test Cost. + /// public static void Init() { PatchPlugin.Logger.LogDebug("Adding TestCost"); @@ -21,24 +30,60 @@ public static void Init() .SetFoundAtChoiceNodes(true, TextureHelper.GetImageAsTexture("testCost.png", typeof(TestCost).Assembly)); } + /// + /// This defines the Cost Tier associated with the Amount of the Cost. + /// + /// The amount of the Test Cost. + /// A of amount/2. public static int CostTier(int amount) { return Mathf.FloorToInt(amount / 2f); } + + /// + /// A bool determining whether a can be played with the current amount of the cost. + /// + /// The Amount of a Cost the Player currently has. + /// The Card the Player is trying to play. + /// The Player's current Hand. + /// True if the Amount of the Cost is <= 2. public static bool CanBePlayed(int amount, CardInfo card, List hand) { return amount <= 2; } + + /// + /// A Function used to get the Cost's Texture within 3D Act's. + /// + /// The Cost Amount of the Card. + /// The of the Card. + /// The variant of the Card. + /// A application of the 3D Act Variant EnergyCost associated with the passed in Cost Amount. public static Texture2D Texture3D(int cardCost, CardInfo cardInfo, PlayableCard playableCard) { Texture2D tex = TextureHelper.GetImageAsTexture($"energy_cost_{Mathf.Min(7, cardCost)}.png", typeof(PatchPlugin).Assembly); return ReverseColours(tex); } + + /// + /// A Function used to get the Cost's Texture within 2D Act's. + /// + /// The Cost Amount of the Card. + /// The of the Card. + /// The variant of the Card. + /// A application of the 2D Act Variant EnergyCost associated with the passed in Cost Amount. + /// public static Texture2D TexturePixel(int cardCost, CardInfo info, PlayableCard playableCard) { Texture2D tex = Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture($"pixel_energy.png", typeof(PatchPlugin).Assembly)); return ReverseColours(tex); } + + /// + /// A function used to Reverse the Colours of a Sprite. + /// + /// The Texture in which to reverse the Colours of. + /// A Colour Reversed version of the Passed Texture. private static Texture2D ReverseColours(Texture2D texToReverse) { for (int x = 0; x < texToReverse.width; x++) @@ -57,16 +102,34 @@ private static Texture2D ReverseColours(Texture2D texToReverse) return texToReverse; } + /// + /// A Bool determining whether the Card's Cost was satisfied or not. + /// + /// The Card's Cost. + /// The Card in which is attempting to be played. + /// True if the Cost was satisified and false otherwise. public override bool CostSatisfied(int cardCost, PlayableCard card) { return cardCost <= (Singleton.Instance.PlayerEnergy - card.EnergyCost); } - + + /// + /// The Hint said when the Cost was not Satisfied. + /// + /// The Card's Cost. + /// The Card in which is attempting to be played. + /// The String of the Hint to be said when the Card's Cost is not Satisfied. public override string CostUnsatisfiedHint(int cardCost, PlayableCard card) { return "Eat your greens aby. " + card.Info.DisplayedNameLocalized; } + /// + /// Depletes the Card's Cost from our Custom Cost's Cost Pool. + /// + /// The Card's Cost + /// The Card in which is attempting to be played. + /// The Card's Cost depleted from the Custom Cost's pool. public override IEnumerator OnPlayed(int cardCost, PlayableCard card) { if (cardCost > 0) diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/README.md b/README.md index 2acf2604..c2ff42ff 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To begin, we'll go over how to install BepInEx, the framework all Inscryption mo **FOR LINUX AND STEAMDECK:** Ensure that the game is set to run using `Proton` in he game settings on steam. Should be a setting like this: `Change launch behaviour` -> `Proton`. ### Installing with a Mod Manager -1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). +1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/), [Pulsar](https://pulsarmods.com/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). 2. Click the **Install with Mod Manager** button on the top of [BepInEx's](https://thunderstore.io/c/inscryption/p/BepInEx/BepInExPack_Inscryption/) page. 3. Run the game via the mod manager. @@ -268,4 +268,4 @@ Contributors and builders of API 2.0: - Keks307 - Creator/Chaosyr/SaxbyMod/The Stoat Lord/ThinCreator3483 - stillrinny -- R3b00t3d-kawaii \ No newline at end of file +- R3b00t3d-kawaii diff --git a/docs/DiscordIcon.png b/docs/DiscordIcon.png new file mode 100644 index 00000000..957c20be Binary files /dev/null and b/docs/DiscordIcon.png differ diff --git a/docs/api/index.md b/docs/api/index.md index de6708af..0d4a8c88 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -1,4 +1,4 @@ -# API Documentation -Hello, and welcome to the documentation section of the Inscryption API! +# Inscryption API Documentation +Hello, and welcome to the documentation section for the Inscryption API! -This section documents the various classes and members of the API, providing information on what they do. \ No newline at end of file +This section documents the various classes and members of the Inscryption API, providing information on what they do. \ No newline at end of file diff --git a/docs/community/.gitignore b/docs/community/.gitignore new file mode 100644 index 00000000..e8079a3b --- /dev/null +++ b/docs/community/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/docs/community/index.md b/docs/community/index.md new file mode 100644 index 00000000..f79961e0 --- /dev/null +++ b/docs/community/index.md @@ -0,0 +1,4 @@ +# Inscryption Community Patch Documentation +Hello, and welcome to the documentation section for the Inscryption Community Patch! + +This section documents the various classes and members of the Inscryption Community Patch, providing information on what they do. \ No newline at end of file diff --git a/docs/docfx.json b/docs/docfx.json index 9e8a1497..eb3320a0 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -3,13 +3,22 @@ { "src": [ { - "files": ["**/*.csproj"], - "exclude": ["**/bin/**", "**/obj/**"], + "files": ["InscryptionAPI/InscryptionAPI.csproj"], "src": "../" } ], "dest": "api", "filter": "filter.yml" + }, + { + "src": [ + { + "files": ["InscryptionCommunityPatch/InscryptionCommunityPatch.csproj"], + "src": "../" + } + ], + "dest": "community", + "filter": "filter.yml" } ], "build": { @@ -18,17 +27,33 @@ "files": ["README.md"] }, { - "files": ["LICENSE"], + "files": ["LICENSE.md"], "src": "../" }, { "files": ["images/**", "logo.svg", "favicon.ico"] + }, + { + "files": ["**"], + "src": "../InscryptionAPI/Assets", + "dest": "resources/api/assets" + }, + { + "files": ["**"], + "src": "../InscryptionCommunityPatch/Assets", + "dest": "resources/community/assets" + }, + { + "files": ["DiscordIcon.png"] } ], "content": [ { "files": ["api/**.yml", "api/index.md"] }, + { + "files": ["community/**.yml", "community/index.md"] + }, { "files": ["wiki/toc.yml", "wiki/**.md"] }, @@ -43,7 +68,7 @@ ], "globalMetadata": { "_appTitle": "InscryptionAPI", - "_appName": "Inscryption Modding API", + "_appName": "Inscryption Modding Wiki", "_appLogoPath": "images/logo.svg", "_appFaviconPath": "images/favicon.ico", "_disableBreadcrumb": true, @@ -65,8 +90,7 @@ "template": [ "default", "modern", - "template/darkfx", - "template/no_inherited_members" + "template/api_wiki" ] } } diff --git a/docs/filter.yml b/docs/filter.yml index ec615f88..288010f9 100644 --- a/docs/filter.yml +++ b/docs/filter.yml @@ -4,12 +4,6 @@ apiRules: uid: System.ComponentModel.EditorBrowsableAttribute ctorArguments: - System.ComponentModel.EditorBrowsableState.Never - - exclude: - uidRegex: ^APIPatcher - - exclude: - uidRegex: ^APIPlugin - - exclude: - uidRegex: ^InscryptionCommunityPatch attributeRules: - exclude: uidRegex: ^System\.ComponentModel\.Design$ diff --git a/docs/index.md b/docs/index.md index 4795094f..bab34934 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,19 +1,275 @@ +# Inscryption API Wiki +--- +Hey there, and welcome to the Inscryption Modding and API Wiki. This is your one stop hub for all things related to the API. The following are some quick links: + +* [Inscryption API Documentation](api/index.md) +* [Inscryption Community Patch Documentation](community/index.md) +* [Inscryption Modding Wiki](wiki/index.md) + +Some other links you may find extremely valuable are as follows: +* [Inscryption Modding Discord](https://discord.gg/QrJEF5Denm) +* [Thunderstore Package](https://thunderstore.io/c/inscryption/p/API_dev/API/) +* [GitHub Repository](https://github.com/InscryptionModding/InscryptionAPI) + +How can you contribute to the wiki? Well for starters you can find the Wiki end of our setup [here](https://github.com/InscryptionModding/InscryptionAPI/tree/main/docs), the only relevant part of this setup you may need to interact with is `wiki` or any `index.md` files. The rest of it leave untouched unless you ***know*** what you are doing. Once you have a markdown file open its straight forward editing as long as you know how Markdown works. + +___ + ## Inscryption API + +This plugin is a BepInEx plugin made for Inscryption as an API. This is the de-facto standard API for Inscryption modders. + +It can currently create and modify: +- Cards +- Abilities +- Appearance behaviours +- Stat Icons +- Challenges +- Starter Decks +- Regions +- Encounters +- Totem Tops +- Consumable Items +- Gramophone Tracks +- Slot Modifications +- Talking Cards +- Custom Costs +- Custom Rulebook Pages +- Rulebook Redirects/Hyperlinks +- And much more! + +Additionally, a number of quality-of-life patches from the community are included with each release. + +___ + +## Getting Started: Installation +--- +To begin, we'll go over how to install BepInEx, the framework all Inscryption mods use. This is a necessary step to playing modded Inscryption, so be sure to follow this carefully. + +**FOR LINUX AND STEAMDECK:** Ensure that the game is set to run using `Proton` in he game settings on steam. Should be a setting like this: `Change launch behaviour` -> `Proton`. + +### Installing with a Mod Manager +1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/), [Pulsar](https://pulsarmods.com/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). +2. Click the **Install with Mod Manager** button on the top of [BepInEx's](https://thunderstore.io/c/inscryption/p/BepInEx/BepInExPack_Inscryption/) page. +3. Run the game via the mod manager. + +If you have issues with Mod Managers head to one of these discords; + +* **Thunderstore Support Discord:** [Here](https://discord.gg/Fbz54kQAxg) +* **R2ModMan Support Discord:** [Here](https://discord.gg/R85wjqa4WN) +* **Gale Mod Manager Support Discord:** [Here](https://discord.gg/sfuWXRfeTt) + +### Installing Manually +1. Install [BepInEx](https://thunderstore.io/package/download/BepInEx/BepInExPack_Inscryption/5.4.2305/) by pressing `Manual Download` and extract the contents into a folder. **Do not extract into the game folder!** +2. Move the contents of the `BepInExPack_Inscryption` folder into the game folder (where the game executable is; usually found here: `C:\Program Files (x86)\Steam\steamapps\common\Inscryption`). +3. Run the game. If everything was done correctly, you will see the BepInEx console appear on your desktop. Close the game after it finishes loading. +4. Install [MonoModLoader](https://inscryption.thunderstore.io/package/BepInEx/MonoMod_Loader_Inscryption/) and extract the contents into a folder. +5. Move the contents of the `patchers` folder into `BepInEx/patchers` (If any of the mentioned BepInEx folders don't exist, just create them). +6. Install [Inscryption API](https://inscryption.thunderstore.io/package/API_dev/API/) and extract the contents into a folder. +7. Move the contents of the `plugins` folder into `BepInEx/plugins` and the contents of the `monomod` folder into the `BepInEx/monomod` folder. +8. Run the game again. If everything runs correctly, a message will appear in the console telling you that the API was loaded. +9. For any additional mods create a new subfolder, it can be called anything and extract the zips archive into it and if there is a `BepInEx` folder within the zip instead drop the contents of that folder into the `BepInEx` root for the modding instance. EX; + ``` + BepInEx // These go within the BepInEx root folder + |-- config + |-- patchers + |-- plugins + |-- monomod + |-- core + plugins // Files within go into the created plugin subfolder that was created for the mod + |-- Art + |-- Scripts + |-- MyMod.dll + manifest.json // Ignorable, but if kept, goes in plugin subfolder + README.md // Ignorable, but if kept, goes in plugin subfolder + CHANGELOG.md // Ignorable, but if kept, goes in plugin subfolder + icon.png // Ignorable, but if kept, goes in plugin subfolder + ``` +10. Run the game once more and everything should be correct and working. + +### Installing Manually (XBOX Game-Pass) +1. Install [BepInEx](https://thunderstore.io/package/download/BepInEx/BepInExPack_Inscryption/5.4.2305/) by pressing `Manual Download` and extract the contents into a folder. **Do not extract into the game folder!** +2. Move the contents of the `BepInExPack_Inscryption` folder into the game folder (where the game executable is; usually found here: `C:\XboxGames\Inscryption\Content`). +3. Install the following package: [XboxSilencio](https://thunderstore.io/c/inscryption/p/CORE_API_TEAM/GamepassSilencio/), this is a package which aims to solve frictions with XBOX Gamepass specific installations, such as HueyFS related errors. +4. Run the game. If everything was done correctly, you will see the BepInEx console appear on your desktop. Close the game after it finishes loading. +5. Install [MonoModLoader](https://inscryption.thunderstore.io/package/BepInEx/MonoMod_Loader_Inscryption/) and extract the contents into a folder. +6. Move the contents of the `patchers` folder into `BepInEx/patchers` (If any of the mentioned BepInEx folders don't exist, just create them). +7. Install [Inscryption API](https://inscryption.thunderstore.io/package/API_dev/API/) and extract the contents into a folder. +8. Move the contents of the `plugins` folder into `BepInEx/plugins` and the contents of the `monomod` folder into the `BepInEx/monomod` folder. +9. Run the game again. If everything runs correctly, a message will appear in the console telling you that the API was loaded. +10. For any additional mods create a new subfolder, it can be called anything and extract the zips archive into it and if there is a `BepInEx` folder within the zip instead drop the contents of that folder into the `BepInEx` root for the modding instance. EX; + ``` + BepInEx // These go within the BepInEx root folder + |-- config + |-- patchers + |-- plugins + |-- monomod + |-- core + plugins // Files within go into the created plugin subfolder that was created for the mod + |-- Art + |-- Scripts + |-- MyMod.dll + manifest.json // Ignorable, but if kept, goes in plugin subfolder + README.md // Ignorable, but if kept, goes in plugin subfolder + CHANGELOG.md // Ignorable, but if kept, goes in plugin subfolder + icon.png // Ignorable, but if kept, goes in plugin subfolder + ``` +11. Run the game once more and everything should be correct and working. + +### Installing on the Steam Deck +1. Download [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/) on the Steam Deck's Desktop Mode and open it from its download using its `AppImage` file. +2. Download the mods you plan on using and their dependencies. +3. Go to the setting of the profile you are using for the mods and click `Browse Profile Folder`. +4. Copy the BepInEx folder, then go to Steam and open Inscryption's Properties menu +5. Go to `Installed Files` click `Browse` to open the folder containing Inscryption's local files; paste the BepInEx folder there. +6. Enter Gaming Mode and check 'Force the use of a specific Steam Play compatibility tool' in the Properties menu under `Compatibility`. +7. Go to the launch parameters and enter `WINEDLLOVERRIDES="winhttp.dll=n,b" %command%`. +8. Open Inscryption. If everything was done correctly, you should see a console appear on your screen. + +### Mac & Linux +1. Follow the steps here first: +2. Next do steps 4-10 of the Manual Installation +3. Your game should be setup for inscryption modding now + +If you have any issues with Mac/Linux, Steam Deck, or Manual head over to the discord for this game: + +* **Inscryption Modding Discord:** [Here](https://discord.gg/ZQPvfKEpwM) + +## Getting Started: Modding --- -Welcome to the site of the Inscryption Modding API! -You can find the wiki and API documentation here. +Modding Inscryption requires a knowledge of coding in C#, and in many cases an understanding of how to patch the game using HarmonyPatch. + +If you're unfamiliar with any of this, or just want to create cards and sigils, you can use [JSONLoader](https://inscryption.thunderstore.io/package/MADH95Mods/JSONCardLoader/). + +### Modding with JSONLoader +JSONLoader is a versatile mod that provides a more beginner-friendly way of creating new cards and abilities for Inscryption using JSON syntax, which is much simpler than C#. + +JSONLoader's documentation can be found [here](https://github.com/MADH95/JSONLoader). + +A video tutorial covering how to use JSONLoader in a basic form can be found [here](https://www.youtube.com/watch?v=grTSkpI4U7g). + +### Modding with C# +To begin modding with C#, you will need to create a new C# project using a code editor. +We recommend and assume you're using Microsoft's Visual Studio. + +Your project's target framework needs to be `netstandard2.0`. + +Once your project's created, go to `Project > Manage NuGet Packages`. +Click the dropdown menu for 'Package source' and check that 'BepInEx' and 'nuget' is there. + +If BepInEx or nuget aren't an available source, we need to add them. +To add a new package source, click on the gear icon next to the package source selector, then click the large green plus-sign. + +To add BepInEx, change the name to 'BepInEx' and the source link to 'https://nuget.bepinex.dev/v3/index.json'. +To add nuget, change the name to 'nuget' and the source link to 'https://nuget.windows10ce.com/nuget/v3/index.json'. -## Some Links +Change the package source to 'All' then click 'Browse'. +We want to install the following packages (**Make sure the version numbers match!**): +- BepInEx.Analyzers v1.0.8 +- BepInEx.Core v5.4.19 +- HarmonyX v2.9.0 +- Inscryption.GameLibs v1.9.0-r.0 +- UnityEngine.Modules v2019.4.24 + +You will also need to add the API as a reference. +There are a couple ways to do this, detailed below; whichever way you choose to do this, you'll also need to need to reference `InscryptionAPI.dll`, which should be in your BepInEx plugins folder; copy this path for future use. + +To do so, go to your 'BepInEx/plugins' folder and copy the folder path. +Then, navigate to `Project > Add Project Reference` and click 'Browse'. +Copy the folder path and add 'InscryptionAPI.dll' as a reference. +You can do this for other mods' .dll files if you want to reference them as a mod dependency (a separate mod that your mod relies on to work). + +An alternative method to adding the API (and other mods) as a reference is to use NuGet packages by adding 'https://nuget.bepinex.dev/v3/index.json' as a package source, and then adding 'API_dev-API' as a reference. + +With all this, you are now ready to begin creating your mod! +Some resources are provided below for you to use, including an example mod to look at for examples. +Otherwise, continue reading this wiki. + +### Modding Resources [Inscryption Modding Discord](https://discord.gg/QrJEF5Denm) -[Thunderstore Page](https://inscryption.thunderstore.io/package/API_dev/API/) +[BepInEx documentation](https://docs.bepinex.dev/) + +[Harmony patching article](https://harmony.pardeike.net/articles/patching.html) + +[Example Mod using C#](https://github.com/debugman18/InscryptionExampleMod) + +[Vanilla and Modded Enumerations](https://github.com/SaxbyMod/SabyModEnums) + +An example mod utilising this plugin can be found [here](https://github.com/debugman18/InscryptionExampleMod), +and the modding wiki and documentation can be found [here](https://inscryptionmodding.github.io/InscryptionAPI/wiki/index.html). + +___ + +## Modded Save File +With this API installed, an additional 'modded save file' will be created by the game. This file will be found in the 'BepInEx' subdirectory, and contains all save data created by mods that use this API. This file will not automatically be synced to the cloud by Steam. + +___ + +## Community Patches +The following patches from the Inscryption modding community have been included in this package to improve the overall quality-of-life for modding and compatibility. + +### SigilArtPatch by MADH95Mods +Fixes the art for abilities that previously only appeared in Act 2 so they appear correctly in Act 1 and Act 3 + +### Conduit Attack Fix by MADH95Mods +Fixes the behavior of conduits so they function correctly in Act 1. + +### Activated Sigil Fix by MADH95Mods +Allows activated sigils to work correctly in Act 1 and Act 3 by clicking the sigil icon on the card. + +### AnthonysLatchFix by AnthonyPython +Fixes latch sigils to work in Act 1 + +### Sigil Art Fix by Memez4Life +Allows up to 8 sigils to be displayed on cards and adds the option to display merged sigil stamps at the bottom of the card instead of over the artwork (see the config files for more information). + +### Visually Stackable Sigils by divisionbyz0rro +Combines multiple instances of the same sigil on a single card into a single sigil with a number to free up space on the card. + +### Cost Render Fix by Void Slime +Displays hybrid cost cards correctly and makes energy and mox show up on act 1 cards + +### Cost Choice Node fix by Void Slime +If energy/mox cards are in the Act 1 pool, energy and mox card choice nodes will be added to the cost choice node in Act 1. + +### Sniper Sigil Fix by SpecialAPI +Displays targets for attacks made with the sniper sigil in Act 1. + +### Act 1 Sentry Fixes by WhistleWind +Fixes a number of bugs caused by the Sentry ability being used in Act 1. + +### Multi-Act Sigil Compatibility Fixes by WhistleWind +Fixes a number of sigils to be usable in all Acts. Sigils include: Mental Gemnastics, Tidal Lock, Hoarder, Vessel Printer, Amorphous, Handy. + +### Fledgling Sigil Fixes by WhistleWind +Fixes Fledgling in Act 2 to show the correct number of turns until a card evolves, up to 3. Also changes its description to show the correct number of turns. + +### OverridePixelAbilityIcons by WhistleWind +Fixes the OverrideAbilityIcon method to work in Act 2. + +### Temporary Mod Fixes by WhistleWind +- Fixes issues related to using temporary mods in Act 2 or to add custom decals + +___ + +## Contribution + +### How can you help? +Use the plugin and report bugs you find! Ping us on the [Inscryption Modding Discord](https://discord.gg/QrJEF5Denm) server in the api channel with what you find. + +### But really, I want to help develop this mod! +Great! We're more than happy to accept help. Either make a pull request to the API's [GitHub page](https://github.com/InscryptionModding/InscryptionAPI) or come join us over in the [Inscryption Modding Discord](https://discord.gg/QrJEF5Denm). + +### Can I donate? +Donations are totally not needed, this is a passion project before anything else. -[GitHub Repository](https://github.com/InscryptionModding/InscryptionAPI) +___ -## Credits -Original version by cyantist. +## Contributors +Original version by cyantist -API 2.0 Contributors: +Contributors and builders of API 2.0: - BobbyShmurner - divisionbyz0rro - Eri @@ -25,4 +281,8 @@ API 2.0 Contributors: - SpecialAPI - Void Slime - WhistleWind -- Windows10CE \ No newline at end of file +- Windows10CE +- Keks307 +- Creator/Chaosyr/SaxbyMod/The Stoat Lord/ThinCreator3483 +- stillrinny +- R3b00t3d-kawaii \ No newline at end of file diff --git a/docs/template/api_wiki/layout/_master.tmpl b/docs/template/api_wiki/layout/_master.tmpl new file mode 100644 index 00000000..045682c3 --- /dev/null +++ b/docs/template/api_wiki/layout/_master.tmpl @@ -0,0 +1,175 @@ +{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} +{{!include(/^public/.*/)}} +{{!include(favicon.ico)}} +{{!include(logo.svg)}} + + + + + {{#redirect_url}} + + {{/redirect_url}} + {{^redirect_url}} + {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}} + + + {{#_description}}{{/_description}} + {{#description}}{{/description}} + + + + + + {{#_description}}{{/_description}} + {{^_description}}{{#description}}{{/description}}{{/_description}} + + + + + + {{#_description}}{{/_description}} + {{^_description}}{{#description}}{{/description}}{{/_description}} + + + + + + + + {{#_noindex}}{{/_noindex}} + {{#_enableSearch}}{{/_enableSearch}} + {{#_disableNewTab}}{{/_disableNewTab}} + {{#_disableTocFilter}}{{/_disableTocFilter}} + {{#docurl}}{{/docurl}} + + + + + + + + + + + + + + + + + + {{#_googleAnalyticsTagId}} + + + {{/_googleAnalyticsTagId}} + {{/redirect_url}} + + + {{^redirect_url}} + +
+ {{^_disableNavbar}} + + {{/_disableNavbar}} +
+ +
+ {{^_disableToc}} +
+
+
+
Table of Contents
+ +
+
+ +
+
+
+ {{/_disableToc}} + +
+
+ {{^_disableToc}} + + {{/_disableToc}} + + {{^_disableBreadcrumb}} + + {{/_disableBreadcrumb}} +
+ +
+ {{!body}} +
+ + {{^_disableContribution}} +
+ {{#sourceurl}} + {{__global.improveThisDoc}} + {{/sourceurl}} + {{^sourceurl}}{{#docurl}} + {{__global.improveThisDoc}} + {{/docurl}}{{/sourceurl}} +
+ {{/_disableContribution}} + + {{^_disableNextArticle}} + + {{/_disableNextArticle}} + +
+ + {{^_disableAffix}} +
+ +
+ {{/_disableAffix}} +
+ + {{#_enableSearch}} +
+ {{/_enableSearch}} + +
+
+
+ {{{_appFooter}}}{{^_appFooter}}Made with docfx{{/_appFooter}} +
+
+
+ + {{/redirect_url}} + \ No newline at end of file diff --git a/docs/template/api_wiki/partials/class.header.tmpl.partial b/docs/template/api_wiki/partials/class.header.tmpl.partial new file mode 100644 index 00000000..be8f4aed --- /dev/null +++ b/docs/template/api_wiki/partials/class.header.tmpl.partial @@ -0,0 +1,232 @@ +{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} + +

+ {{>partials/title}} + {{#sourceurl}}{{/sourceurl}} +

+ +
+
{{__global.namespace}}
{{{namespace.specName.0.value}}}
+ {{#assemblies.0}}
{{__global.assembly}}
{{assemblies.0}}.dll
{{/assemblies.0}} +
+ +
{{{summary}}}
+
{{{conceptual}}}
+ +{{#inClass}} +
+
{{__global.inheritance}}
+ +
+ {{#inheritance}} +
+ {{{specName.0.value}}} +
+ {{/inheritance}} + +
+ {{name.0.value}} +
+ + {{#derivedClasses}} +
+ {{{specName.0.value}}} +
+ {{/derivedClasses}} +
+
+{{/inClass}} + +{{#implements.0}} +
+
{{__global.implements}}
+{{/implements.0}} + +{{#implements}} +
+ {{{specName.0.value}}} +
+{{/implements}} + +{{#implements.0}} +
+{{/implements.0}} + +{{#syntax.content.0.value}} +
+ {{__global.syntax}} +
+ +
+
{{syntax.content.0.value}}
+
+{{/syntax.content.0.value}} + +{{#syntax.parameters.0}} +
+ {{__global.parameters}} +
+ + + + + + + + + + +{{/syntax.parameters.0}} + +{{#syntax.parameters}} + + + + +{{/syntax.parameters}} + +{{#syntax.parameters.0}} + +
{{__global.name}}{{__global.description}}
+
+ {{{type.specName.0.value}}} +
+
+ {{{id}}} +
+
{{{description}}}
+{{/syntax.parameters.0}} + +{{#syntax.return}} +
+ {{__global.returns}} +
+ + + + + + + + + + + + + + + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/syntax.return}} + +{{#syntax.typeParameters.0}} +
+ {{__global.typeParameters}} +
+ + + + + + + + + + +{{/syntax.typeParameters.0}} + +{{#syntax.typeParameters}} + + + + +{{/syntax.typeParameters}} + +{{#syntax.typeParameters.0}} + +
{{__global.name}}{{__global.description}}
+ {{{id}}} + {{{description}}}
+{{/syntax.typeParameters.0}} + +{{#inheritedMembers.0}} +
+
{{__global.inheritedMembers}}
+
+{{/inheritedMembers.0}} +{{#inheritedMembers}} +
+ {{#definition}} + + {{/definition}} + {{^definition}} + + {{/definition}} +
+{{/inheritedMembers}} +{{#inheritedMembers.0}} +
+
+{{/inheritedMembers.0}} + +{{#extensionMethods.0}} +
+
{{__global.extensionMethods}}
+
+{{/extensionMethods.0}} +{{#extensionMethods}} +
+ {{#definition}} + + {{/definition}} + {{^definition}} + + {{/definition}} +
+{{/extensionMethods}} +{{#extensionMethods.0}} +
+
+{{/extensionMethods.0}} + +{{#isEnum}} +{{#children}} +

{{>partials/classSubtitle}}

+ + + + + + + + + + + {{#children}} + + + + + {{/children}} + +
{{__global.name}}{{__global.description}}
+ {{syntax.content.0.value}} + + {{{summary}}} + {{#remarks}}{{{remarks}}}{{/remarks}} +
+ +{{/children}} +{{/isEnum}} + +{{#example.0}} +

{{__global.examples}}

+{{/example.0}} +{{#example}} +{{{.}}} +{{/example}} + +{{#remarks}} +

{{__global.remarks}}

+
{{{remarks}}}
+{{/remarks}} \ No newline at end of file diff --git a/docs/template/api_wiki/partials/class.tmpl.partial b/docs/template/api_wiki/partials/class.tmpl.partial new file mode 100644 index 00000000..723686d8 --- /dev/null +++ b/docs/template/api_wiki/partials/class.tmpl.partial @@ -0,0 +1,246 @@ +{{!Licensed to the .NET Foundation under one or more agreements by the .NET Foundation. The .NET Foundation licenses this file to you under the MIT license.}} + +{{>partials/class.header}} + +{{#children}} + +{{^_splitReference}} +

{{>partials/classSubtitle}}

+{{/_splitReference}} + +{{#children}} + +{{#overload}} + +{{/overload}} + +

+ {{name.0.value}} + {{#sourceurl}}{{/sourceurl}} +

+ +
{{{summary}}}
+
{{{conceptual}}}
+ +{{#syntax}} +
+
{{syntax.content.0.value}}
+
+ +{{#syntax.parameters.0}} +

{{__global.parameters}}

+ + + + + + + + + + +{{/syntax.parameters.0}} + +{{#syntax.parameters}} + + + + +{{/syntax.parameters}} + +{{#syntax.parameters.0}} + +
{{__global.name}}{{__global.description}}
+
+ {{{type.specName.0.value}}} +
+
+ {{{id}}} +
+
{{{description}}}
+{{/syntax.parameters.0}} + +{{#syntax.return}} +

{{__global.returns}}

+ + + + + + + + + + + + + + + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/syntax.return}} + +{{#syntax.typeParameters.0}} +

{{__global.typeParameters}}

+ + + + + + + + + + +{{/syntax.typeParameters.0}} + +{{#syntax.typeParameters}} + + + + +{{/syntax.typeParameters}} + +{{#syntax.typeParameters.0}} + +
{{__global.name}}{{__global.description}}
+ {{{id}}} + {{{description}}}
+{{/syntax.typeParameters.0}} + +{{#fieldValue}} +

{{__global.fieldValue}}

+ + + + + + + + + + + + + + + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/fieldValue}} + +{{#propertyValue}} +

{{__global.returns}}

+ + + + + + + + + + + + + + + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/propertyValue}} + +{{#eventType}} +

{{__global.eventType}}

+ + + + + + + + + + + + + + + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/eventType}} + +{{/syntax}} + +{{#example.0}} +

{{__global.examples}}

+{{/example.0}} +{{#example}} +{{{.}}} +{{/example}} + +{{#remarks}} +

{{__global.remarks}}

+
{{{remarks}}}
+{{/remarks}} + +{{#exceptions.0}} +

{{__global.exceptions}}

+ + + + + + + + + + +{{/exceptions.0}} + +{{#exceptions}} + + + + +{{/exceptions}} + +{{#exceptions.0}} + +
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
+{{/exceptions.0}} + +{{#seealso.0}} +
+
{{__global.seealso}}
+
+{{/seealso.0}} +{{#seealso}} + {{#isCref}} +
{{{type.specName.0.value}}}
+ {{/isCref}} + {{^isCref}} +
{{{url}}}
+ {{/isCref}} +{{/seealso}} +{{#seealso.0}} +
+
+{{/seealso.0}} + +{{/children}} +{{/children}} + +{{#seealso.0}} +

{{__global.seealso}}

+
+{{/seealso.0}} +{{#seealso}} + {{#isCref}} +
{{{type.specName.0.value}}}
+ {{/isCref}} + {{^isCref}} +
{{{url}}}
+ {{/isCref}} +{{/seealso}} +{{#seealso.0}} +
+{{/seealso.0}} \ No newline at end of file diff --git a/docs/template/api_wiki/partials/head.tmpl.partial b/docs/template/api_wiki/partials/head.tmpl.partial new file mode 100644 index 00000000..62d911c1 --- /dev/null +++ b/docs/template/api_wiki/partials/head.tmpl.partial @@ -0,0 +1,51 @@ + +{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} + + + + {{#_googleAnalyticsTagId}} + + + {{/_googleAnalyticsTagId}} + {{#redirect_url}} + + {{/redirect_url}} + {{^redirect_url}} + + {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}} + + + {{#_description}}{{/_description}} + {{#description}}{{/description}} + + + + + + {{#_description}}{{/_description}} + {{^_description}}{{#description}}{{/description}}{{/_description}} + + + + + + {{#_description}}{{/_description}} + {{^_description}}{{#description}}{{/description}}{{/_description}} + + + + + + + + + {{#_noindex}}{{/_noindex}} + {{#_enableSearch}}{{/_enableSearch}} + {{#_enableNewTab}}{{/_enableNewTab}} + {{/redirect_url}} + diff --git a/docs/template/api_wiki/public/fonts/dpcomic.ttf b/docs/template/api_wiki/public/fonts/dpcomic.ttf new file mode 100644 index 00000000..3707903d Binary files /dev/null and b/docs/template/api_wiki/public/fonts/dpcomic.ttf differ diff --git a/docs/template/api_wiki/public/main.css b/docs/template/api_wiki/public/main.css new file mode 100644 index 00000000..b31e1abb --- /dev/null +++ b/docs/template/api_wiki/public/main.css @@ -0,0 +1,137 @@ +@font-face { + font-family: 'DPComic'; + src: url('fonts/dpcomic.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +:root { + --bs-font-sans-serif: 'DPComic', system-ui, -apple-system, sans-serif; + --bs-body-font-family: var(--bs-font-sans-serif); + --bs-font-monospace: 'DPComic', system-ui, -apple-system, sans-serif; + --page-gutter: clamp(1rem, 4vw, 5rem); +} + +* { + border-width: 4px !important; +} + +b, strong { + font-weight: normal; +} + +code { + font-size: 18px !important; +} + +:not(pre) > code { + background-color: var(--bs-tertiary-bg, #e9ecef); + padding: 0.15em 0.35em; + border-radius: 4px; +} + +.container, .container-fluid, .container-xxl { + width: 100%; + max-width: 100%; + padding-right: var(--page-gutter); + padding-left: var(--page-gutter); + margin-right: auto; + margin-left: auto; +} + +.container { + max-width: 100%; +} + +body > header, body[data-layout="landing"] > header { + min-height: 90px; +} + +body > footer, body[data-layout="landing"] > footer { + min-height: 90px; + display: flex; + align-items: stretch; +} + +.navbar { + --bs-navbar-brand-margin-end: 2.5rem; + --bs-navbar-brand-font-size: 1.5rem; +} + +#logo { + padding-right: 1.5rem; +} + +.content { + font-size: 20px !important; +} + +.toc ul { + font-size: 20px !important; +} + +.affix { + font-size: 20px; +} + +body[data-yaml-mime="ManagedReference"] article h2.section, +body[data-yaml-mime="ApiPage"] article h2.section { + margin-top: 1rem; +} + +.inheritance { + margin-bottom: 1rem; +} + +.inheritance h5 { + margin-bottom: 0.35rem; +} + +.inheritance-tree { + border-top: 1px solid currentColor; + padding-top: 0.35rem; +} + +.inheritance-level { + line-height: 1.4; + padding-left: calc(var(--inheritance-level, 0) * 1.25rem); +} + +.inheritance-level::before { + content: "↳ "; + opacity: 0.75; +} + +.api-parameters, .api-returns, .api-type-parameters, .api-exceptions, .api-fields { + width: 100%; + border-collapse: collapse; + margin-bottom: 1rem; +} + +.api-parameters th, .api-returns th, .api-type-parameters th, .api-exceptions th, .api-fields th, +.api-parameters td, .api-returns td, .api-type-parameters td, .api-exceptions td, .api-fields td { + padding: 0.5rem 0.75rem; + border: 1px solid var(--bs-border-color, #444); + text-align: left; +} + +html.api-documentation h1, +html.api-documentation .h1, +html.community-documentation h1, +html.community-documentation .h1 { + border-bottom: 1px solid currentColor; + padding-bottom: 0.35rem; +} + +html.api-documentation h3, +html.api-documentation .h3, +html.community-documentation h3, +html.community-documentation .h3 { + border-bottom: 1px solid currentColor; + padding-bottom: 0.35rem; +} + +a.active { + font-style: italic; + text-decoration: underline; +} \ No newline at end of file diff --git a/docs/template/api_wiki/public/main.js b/docs/template/api_wiki/public/main.js new file mode 100644 index 00000000..688fe3ef --- /dev/null +++ b/docs/template/api_wiki/public/main.js @@ -0,0 +1,17 @@ +export default { + defaultTheme: 'dark' +} + +const docUrl = document.querySelector('meta[name="docfx:docurl"]')?.content || ''; + +if (docUrl.includes('/docs/api/')) { + document.documentElement.classList.add('api-documentation'); +} + +if (docUrl.includes('/docs/community/')) { + document.documentElement.classList.add('community-documentation'); +} + +if (docUrl.includes('/docs/wiki/')) { + document.documentElement.classList.add('wiki-documentation'); +} \ No newline at end of file diff --git a/docs/template/darkfx/partials/affix.tmpl.partial b/docs/template/darkfx/partials/affix.tmpl.partial deleted file mode 100644 index 11caeb3d..00000000 --- a/docs/template/darkfx/partials/affix.tmpl.partial +++ /dev/null @@ -1,40 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - - diff --git a/docs/template/darkfx/partials/footer.tmpl.partial b/docs/template/darkfx/partials/footer.tmpl.partial deleted file mode 100644 index a9da7c3b..00000000 --- a/docs/template/darkfx/partials/footer.tmpl.partial +++ /dev/null @@ -1,29 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - -
-
- - -
\ No newline at end of file diff --git a/docs/template/darkfx/partials/head.tmpl.partial b/docs/template/darkfx/partials/head.tmpl.partial deleted file mode 100644 index 83fc5f91..00000000 --- a/docs/template/darkfx/partials/head.tmpl.partial +++ /dev/null @@ -1,20 +0,0 @@ -{{!Copyright (c) Oscar Vasquez. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - - - - - {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}} - - - - {{#_description}}{{/_description}} - - - - - - - {{#_noindex}}{{/_noindex}} - {{#_enableSearch}}{{/_enableSearch}} - {{#_enableNewTab}}{{/_enableNewTab}} - \ No newline at end of file diff --git a/docs/template/darkfx/styles/main.css b/docs/template/darkfx/styles/main.css deleted file mode 100644 index 078adc77..00000000 --- a/docs/template/darkfx/styles/main.css +++ /dev/null @@ -1,470 +0,0 @@ -:root, body.dark-theme { - --color-foreground: #ccd5dc; - --color-navbar: #66666d; - --color-breadcrumb: #999; - --color-underline: #ddd; - --color-toc-hover: #fff; - --color-background: #2d2d30; - --color-background-subnav: #333337; - --color-background-dark: #1e1e1e; - --color-background-table-alt: #212123; - --color-background-quote: #69696e; -} - -body.light-theme { - --color-foreground: #171717; - --color-breadcrumb: #4a4a4a; - --color-toc-hover: #4c4c4c; - --color-background: #ffffff; - --color-background-subnav: #f5f5f5; - --color-background-dark: #ddd; - --color-background-table-alt: #f9f9f9; -} - -body { - color: var(--color-foreground); - line-height: 1.5; - font-size: 14px; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; - word-wrap: break-word; - background-color: var(--color-background); -} - -.btn.focus, .btn:focus, .btn:hover { - color: var(--color-foreground); -} - -h1 { - font-weight: 600; - font-size: 32px; -} - -h2 { - font-weight: 600; - font-size: 24px; - line-height: 1.8; -} - -h3 { - font-weight: 600; - font-size: 20px; - line-height: 1.8; -} - -h5 { - font-size: 14px; - padding: 10px 0px; -} - -article h1, article h2, article h3, article h4 { - margin-top: 35px; - margin-bottom: 15px; -} - -article h4 { - padding-bottom: 8px; - border-bottom: 2px solid var(--color-underline); -} - -.navbar-brand>img { - color: var(--color-background); -} - -.navbar { - border: none; -} - -.subnav { - border-top: 1px solid var(--color-underline); - background-color: var(--color-background-subnav); -} - -.sidenav, .fixed_header, .toc { - background-color: var(--color-background); -} - -.navbar-inverse { - background-color: var(--color-background-dark); - z-index: 100; -} - -.navbar-inverse .navbar-nav>li>a, .navbar-inverse .navbar-text { - color: var(--color-navbar); - background-color: var(--color-background-dark); - border-bottom: 3px solid transparent; - padding-bottom: 12px; -} - -.navbar-inverse .navbar-nav>li>a:focus, .navbar-inverse .navbar-nav>li>a:hover { - color: var(--color-foreground); - background-color: var(--color-background-dark); - border-bottom: 3px solid var(--color-background-subnav); - transition: all ease 0.25s; -} - -.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover { - color: var(--color-foreground); - background-color: var(--color-background-dark); - border-bottom: 3px solid var(--color-foreground); - transition: all ease 0.25s; -} - -.navbar-form .form-control { - border: none; - border-radius: 0; -} - -.light-theme .navbar-brand svg { - filter: brightness(20%); -} - -.toc .level1>li { - font-weight: 400; -} - -.toc .nav>li>a { - color: var(--color-foreground); -} - -.sidefilter { - background-color: var(--color-background); - border-left: none; - border-right: none; -} - -.sidefilter { - background-color: var(--color-background); - border-left: none; - border-right: none; -} - -.toc-filter { - padding: 10px; - margin: 0; - background-color: var(--color-background); -} - -.toc-filter>input { - border: none; - border-radius: unset; - background-color: var(--color-background-subnav); - padding: 5px 0 5px 20px; - font-size: 90% -} - -.toc-filter>.clear-icon { - position: absolute; - top: 17px; - right: 15px; -} - -.toc-filter>input:focus { - color: var(--color-foreground); - transition: all ease 0.25s; -} - -.toc-filter>.filter-icon { - display: none; -} - -.sidetoc>.toc { - background-color: var(--color-background); - overflow-x: hidden; -} - -.sidetoc { - background-color: var(--color-background); - border: none; -} - -.alert { - background-color: inherit; - border: none; - padding: 10px 0; - border-radius: 0; -} - -.alert>p { - margin-bottom: 0; - padding: 5px 10px; - border-bottom: 1px solid; - background-color: var(--color-background-dark); -} - -.alert>h5 { - padding: 10px 15px; - margin-top: 0; - margin-bottom: 0; - text-transform: uppercase; - font-weight: bold; - border-top: 2px solid; - background-color: var(--color-background-dark); - border-radius: none; -} - -.alert>ul { - margin-bottom: 0; - padding: 5px 40px; -} - -.alert-info { - color: #1976d2; -} - -.alert-warning { - color: #f57f17; -} - -.alert-danger { - color: #d32f2f; -} - -pre { - padding: 9.5px; - margin: 0 0 10px; - font-size: 13px; - word-break: break-all; - word-wrap: break-word; - background-color: var(--color-background-dark); - border-radius: 0; - border: none; -} - -code { - background: var(--color-background-dark) !important; - border-radius: 2px; -} - -.hljs { - color: var(--color-foreground); -} - -.toc .nav>li.active>.expand-stub::before, .toc .nav>li.in>.expand-stub::before, .toc .nav>li.in.active>.expand-stub::before, .toc .nav>li.filtered>.expand-stub::before { - content: "▾"; -} - -.toc .nav>li>.expand-stub::before, .toc .nav>li.active>.expand-stub::before { - content: "▸"; -} - -.affix ul ul>li>a:before { - content: "|"; -} - -.breadcrumb { - background-color: var(--color-background-subnav); -} - -.breadcrumb .label.label-primary { - background: #444; - border-radius: 0; - font-weight: normal; - font-size: 100%; -} - -#breadcrumb .breadcrumb>li a { - border-radius: 0; - font-weight: normal; - font-size: 85%; - display: inline; - padding: 0 .6em 0; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - color: var(--color-breadcrumb); -} - -#breadcrumb .breadcrumb>li a:hover { - color: var(--color-foreground); - transition: all ease 0.25s; -} - -.breadcrumb>li+li:before { - content: "⯈"; - font-size: 75%; - color: var(--color-background-dark); - padding: 0; -} - -.light-theme .breadcrumb>li+li:before { - color: var(--color-foreground) - } - -.toc .level1>li { - font-weight: 600; - font-size: 130%; - padding-left: 5px; -} - -.footer { - border-top: none; - background-color: var(--color-background-dark); - padding: 15px 0; - font-size: 90%; -} - -.toc .nav>li>a:hover, .toc .nav>li>a:focus { - color: var(--color-toc-hover); - transition: all ease 0.1s; -} - -.form-control { - background-color: var(--color-background-subnav); - border: none; - border-radius: 0; - -webkit-box-shadow: none; - box-shadow: none; -} - -.form-control:focus { - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: none; - box-shadow: none; -} - -input#search-query:focus { - color: var(--color-foreground); -} - -.table-bordered, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th { - border: 1px solid var(--color-background-dark); -} - -.table-striped>tbody>tr:nth-of-type(odd) { - background-color: var(--color-background-table-alt); -} - -blockquote { - padding: 10px 20px; - margin: 0 0 10px; - font-size: 110%; - border-left: 5px solid var(--color-background-quote); - color: var(--color-background-quote); -} - -.pagination>.disabled>a, .pagination>.disabled>a:focus, .pagination>.disabled>a:hover, .pagination>.disabled>span, .pagination>.disabled>span:focus, .pagination>.disabled>span:hover { - background-color: var(--color-background-subnav); - border-color: var(--color-background-subnav); -} - -.breadcrumb>li, .pagination { - display: inline; -} - -.tabGroup a[role="tab"] { - border-bottom: 2px solid var(--color-background-dark); -} - -.tabGroup a[role="tab"][aria-selected="true"] { - color: var(--color-foreground); -} - -.tabGroup section[role="tabpanel"] { - border: 1px solid var(--color-background-dark); -} - -.sideaffix > div.contribution > ul > li > a.contribution-link:hover { - background-color: var(--color-background); -} - -.switch { - position: relative; - display: inline-block; - width: 40px; - height: 20px; -} - -.switch input { - opacity: 0; - width: 0; - height: 0; -} - -.slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #ccc; - -webkit-transition: .4s; - transition: .4s; -} - -.slider:before { - position: absolute; - content: ""; - height: 14px; - width: 14px; - left: 4px; - bottom: 3px; - background-color: white; - -webkit-transition: .4s; - transition: .4s; -} - -input:checked + .slider { - background-color: #337ab7; -} - -input:focus + .slider { - box-shadow: 0 0 1px #337ab7; -} - -input:checked + .slider:before { - -webkit-transform: translateX(19px); - -ms-transform: translateX(19px); - transform: translateX(19px); -} - -/* Rounded sliders */ -.slider.round { - border-radius: 20px; -} - -.slider.round:before { - border-radius: 50%; -} -.toggle-mode .icon { - display: inline-block; -} - -.toggle-mode .icon i { - font-style: normal; - font-size: 17px; - display: inline-block; - padding-right: 7px; - padding-left: 7px; - vertical-align: middle; -} - -@media (min-width: 1600px) { - .container { - width: 100%; - } - .sidefilter { - width: 18%; - } - .sidetoc { - width: 18%; - } - .article.grid-right { - margin-left: 19%; - } - .sideaffix { - width: 11.5%; - } - .affix ul>li.active>a { - white-space: initial; - } - .affix ul>li>a { - width: 99%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } -} \ No newline at end of file diff --git a/docs/template/darkfx/styles/toggle-theme.js b/docs/template/darkfx/styles/toggle-theme.js deleted file mode 100644 index f2ea5f5f..00000000 --- a/docs/template/darkfx/styles/toggle-theme.js +++ /dev/null @@ -1,35 +0,0 @@ -const sw = document.getElementById("switch-style"), sw_mobile = document.getElementById("switch-style-m"), b = document.body; -if (b) { - function toggleTheme(target, dark) { - target.classList.toggle("dark-theme", dark) - target.classList.toggle("light-theme", !dark) - } - - function switchEventListener() { - toggleTheme(b, this.checked); - if (window.localStorage) { - this.checked ? localStorage.setItem("theme", "dark-theme") : localStorage.setItem("theme", "light-theme") - } - } - - var isDarkTheme = !window.localStorage || !window.localStorage.getItem("theme") || window.localStorage && localStorage.getItem("theme") === "dark-theme"; - - if(sw && sw_mobile){ - sw.checked = isDarkTheme; - sw_mobile.checked = isDarkTheme; - - sw.addEventListener("change", switchEventListener); - sw_mobile.addEventListener("change", switchEventListener); - - // sync state between switches - sw.addEventListener("change", function() { - sw_mobile.checked = this.checked; - }); - - sw_mobile.addEventListener("change", function() { - sw.checked = this.checked; - }); - } - - toggleTheme(b, isDarkTheme); -} \ No newline at end of file diff --git a/docs/template/no_inherited_members/partials/class.header.tmpl.partial b/docs/template/no_inherited_members/partials/class.header.tmpl.partial deleted file mode 100644 index 3ca2c8b3..00000000 --- a/docs/template/no_inherited_members/partials/class.header.tmpl.partial +++ /dev/null @@ -1,104 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - -

{{>partials/title}}

-
{{{summary}}}
-
{{{conceptual}}}
-{{#inClass}} -
-
{{__global.inheritance}}
- {{#inheritance}} -
{{{specName.0.value}}}
- {{/inheritance}} -
{{name.0.value}}
- {{#derivedClasses}} -
{{{specName.0.value}}}
- {{/derivedClasses}} -
-{{/inClass}} -{{#implements.0}} -
-
{{__global.implements}}
-{{/implements.0}} -{{#implements}} -
{{{specName.0.value}}}
-{{/implements}} -{{#implements.0}} -
-{{/implements.0}} -
{{__global.namespace}}: {{{namespace.specName.0.value}}}
-
{{__global.assembly}}: {{assemblies.0}}.dll
-
{{__global.syntax}}
-
-
{{syntax.content.0.value}}
-
-{{#syntax.parameters.0}} -
{{__global.parameters}}
- - - - - - - - - -{{/syntax.parameters.0}} -{{#syntax.parameters}} - - - - - -{{/syntax.parameters}} -{{#syntax.parameters.0}} - -
{{__global.type}}{{__global.name}}{{__global.description}}
{{{type.specName.0.value}}}{{{id}}}{{{description}}}
-{{/syntax.parameters.0}} -{{#syntax.return}} -
{{__global.returns}}
- - - - - - - - - - - - - -
{{__global.type}}{{__global.description}}
{{{type.specName.0.value}}}{{{description}}}
-{{/syntax.return}} -{{#syntax.typeParameters.0}} -
{{__global.typeParameters}}
- - - - - - - - -{{/syntax.typeParameters.0}} -{{#syntax.typeParameters}} - - - - -{{/syntax.typeParameters}} -{{#syntax.typeParameters.0}} - -
{{__global.name}}{{__global.description}}
{{{id}}}{{{description}}}
-{{/syntax.typeParameters.0}} -{{#remarks}} -
{{__global.remarks}}
-
{{{remarks}}}
-{{/remarks}} -{{#example.0}} -
{{__global.examples}}
-{{/example.0}} -{{#example}} -{{{.}}} -{{/example}} diff --git a/docs/toc.yml b/docs/toc.yml index baaba530..4d8c91dc 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -1,8 +1,11 @@ - name: Home href: index.md -- name: Wiki +- name: Modding Wiki href: wiki/ homepage: wiki/index.md -- name: API Documentation +- name: Inscryption API Documentation href: api/ - homepage: api/index.md \ No newline at end of file + homepage: api/index.md +- name: Inscryption Community Patch Documentation + href: community/ + homepage: community/index.md \ No newline at end of file diff --git a/docs/wiki/getting_started.md b/docs/wiki/getting_started.md index f647ae54..b6a02088 100644 --- a/docs/wiki/getting_started.md +++ b/docs/wiki/getting_started.md @@ -5,7 +5,7 @@ To begin, we'll go over how to install BepInEx, the framework all Inscryption mo **FOR LINUX AND STEAMDECK:** Ensure that the game is set to run using `Proton` in he game settings on steam. Should be a setting like this: `Change launch behaviour` -> `Proton`. ### Installing with a Mod Manager -1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). +1. Download and install [Thunderstore Mod Manager](https://www.overwolf.com/app/Thunderstore-Thunderstore_Mod_Manager), [Gale](https://thunderstore.io/c/inscryption/p/Kesomannen/GaleModManager/), [Pulsar](https://pulsarmods.com/) or [r2modman](https://thunderstore.io/c/inscryption/p/ebkr/r2modman/). 2. Click the **Install with Mod Manager** button on the top of [BepInEx's](https://thunderstore.io/c/inscryption/p/BepInEx/BepInExPack_Inscryption/) page. 3. Run the game via the mod manager. diff --git a/thunderstore.toml b/thunderstore.toml index 7daa74f9..186e2477 100644 --- a/thunderstore.toml +++ b/thunderstore.toml @@ -4,13 +4,13 @@ schemaVersion = "0.0.1" [package] namespace = "API_dev" name = "API" -versionNumber = "2.15.2" +versionNumber = "2.24.2" description = "The de-facto standard core API for all Inscryption mods. This lets you create new cards, abilities, challenges, map nodes, starter decks, and more." websiteUrl = "https://github.com/InscryptionModding/InscryptionAPI/" containsNsfwContent = false [package.dependencies] -BepInEx-BepInExPack_Inscryption = "5.4.1902" +BepInEx-BepInExPack_Inscryption = "5.4.2306" BepInEx-MonoMod_Loader_Inscryption = "1.0.0" [build] @@ -23,13 +23,45 @@ source = "InscryptionAPI/bin/Release/InscryptionAPI.dll" target = "plugins/InscryptionAPI.dll" [[build.copy]] -source = "APIPatcher/bin/Release/Assembly-CSharp.APIPatcher.mm.dll" +source = "InscryptionAPI/bin/Release/InscryptionAPI.pdb" +target = "plugins/InscryptionAPI.pdb" + +[[build.copy]] +source = "InscryptionAPI/bin/Release/InscryptionAPI.xml" +target = "plugins/InscryptionAPI.xml" + +[[build.copy]] +source = "InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.dll" target = "monomod/Assembly-CSharp.APIPatcher.mm.dll" +[[build.copy]] +source = "InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.pdb" +target = "monomod/Assembly-CSharp.APIPatcher.mm.pdb" + +[[build.copy]] +source = "InscryptionAPI/Thunderstore-Package-Elements/monomod/Assembly-CSharp.APIPatcher.mm.xml" +target = "monomod/Assembly-CSharp.APIPatcher.mm.xml" + [[build.copy]] source = "InscryptionCommunityPatch/bin/Release/InscryptionCommunityPatch.dll" target = "plugins/InscryptionCommunityPatch.dll" +[[build.copy]] +source = "InscryptionCommunityPatch/bin/Release/InscryptionCommunityPatch.pdb" +target = "plugins/InscryptionCommunityPatch.pdb" + +[[build.copy]] +source = "InscryptionCommunityPatch/bin/Release/InscryptionCommunityPatch.xml" +target = "plugins/InscryptionCommunityPatch.xml" + +[[build.copy]] +source = "CHANGELOG.md" +target = "CHANGELOG.md" + +[[build.copy]] +source = "LICENSE.md" +target = "LICENSE.md" + [publish] repository = "https://inscryption.thunderstore.io" communities = ["inscryption"]