This repository was archived by the owner on Dec 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 44 <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Cdisasters/@EntryIndexedValue" >True</s : Boolean >
55 <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Ceffects/@EntryIndexedValue" >True</s : Boolean >
66 <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Citems/@EntryIndexedValue" >True</s : Boolean >
7- <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Cmutators/@EntryIndexedValue" >False </s : Boolean >
7+ <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Cmutators/@EntryIndexedValue" >True </s : Boolean >
88 <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Ctraits/@EntryIndexedValue" >True</s : Boolean >
99 <s : Boolean x : Key =" /Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tests_005Cweapons/@EntryIndexedValue" >True</s : Boolean ></wpf : ResourceDictionary >
Original file line number Diff line number Diff line change 1+ using System . Collections . Generic ;
2+
3+ namespace RogueLibsCore . Test
4+ {
5+ public class MaxTraits : MutatorUnlock
6+ {
7+ public MaxTraits ( ) : base ( nameof ( MaxTraits ) ) { UnlockCost = 3 ; }
8+
9+ [ RLSetup ]
10+ public static void Setup ( )
11+ {
12+ RogueLibs . CreateCustomUnlock ( new MaxTraits ( ) )
13+ . WithName ( new CustomNameInfo ( "Max Traits" ) )
14+ . WithDescription ( new CustomNameInfo ( "Everyone gets their traits upgraded!" ) ) ;
15+
16+ RoguePatcher patcher = new RoguePatcher ( TestPlugin . Instance ) { TypeWithPatches = typeof ( MaxTraits ) } ;
17+ patcher . Postfix ( typeof ( Agent ) , nameof ( Agent . SetupAgentStats ) ) ;
18+ }
19+
20+ public static void Agent_SetupAgentStats ( Agent __instance )
21+ {
22+ if ( ! gc . challenges . Contains ( nameof ( MaxTraits ) ) ) return ;
23+
24+ List < Trait > upgradeable = __instance . statusEffects . TraitList . FindAll ( static trait =>
25+ {
26+ UnlockWrapper ? unlock = RogueFramework . Unlocks . Find ( u => u . Type == UnlockTypes . Trait && u . Name == trait . traitName ) ;
27+ return ! string . IsNullOrEmpty ( unlock ? . Unlock . upgrade ) ;
28+ } ) ;
29+ if ( upgradeable . Count > 0 )
30+ {
31+ __instance . usingAugmentationBooth = true ;
32+ upgradeable . ForEach ( trait =>
33+ {
34+ UnlockWrapper unlock = RogueFramework . Unlocks . Find ( u => u . Type == UnlockTypes . Trait && u . Name == trait . traitName ) ;
35+ __instance . statusEffects . AddTrait ( unlock . Unlock . upgrade ) ;
36+ } ) ;
37+ __instance . usingAugmentationBooth = false ;
38+ }
39+ }
40+
41+
42+
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments