1+ using System . Collections . Generic ;
2+ using DiskCardGame ;
3+
14namespace APIPlugin
25{
36 public partial class Plugin
@@ -12,7 +15,8 @@ private void SetAbilityIdentifiers()
1215 if ( id . id != 0 )
1316 {
1417 // if the card already has the ability then no point and adding it
15- if ( ! newCard . abilities . Contains ( id . id ) ) newCard . abilities . Add ( id . id ) ;
18+ if ( AbilityDoesNotExistOrCanStack ( newCard . abilities , id ) )
19+ newCard . abilities . Add ( id . id ) ;
1620 }
1721 else
1822 {
@@ -28,8 +32,8 @@ private void SetAbilityIdentifiers()
2832 var customCard = CustomCard . cards [ item . Key ] ;
2933 if ( id . id != 0 )
3034 {
31- // if the card already has the ability then no point and adding it
32- if ( ! customCard . abilities . Contains ( id . id ) ) customCard . abilities . Add ( id . id ) ;
35+ if ( AbilityDoesNotExistOrCanStack ( customCard . abilities , id ) )
36+ customCard . abilities . Add ( id . id ) ;
3337 }
3438 else
3539 {
@@ -48,7 +52,7 @@ private void SetSpecialAbilityIdentifiers()
4852 var newCard = NewCard . cards [ item . Key ] ;
4953 if ( id . id != 0 )
5054 {
51- // if the card already has the ability then no point and adding it
55+ // Special Abilities do not stack, unlike regular Abilities
5256 if ( ! newCard . specialAbilities . Contains ( id . id ) ) newCard . specialAbilities . Add ( id . id ) ;
5357 }
5458 else
@@ -65,7 +69,7 @@ private void SetSpecialAbilityIdentifiers()
6569 var customCard = CustomCard . cards [ item . Key ] ;
6670 if ( id . id != 0 )
6771 {
68- // if the card already has the ability then no point and adding it
72+ // Special Abilities do not stack, unlike regular Abilities
6973 if ( ! customCard . specialAbilities . Contains ( id . id ) ) customCard . specialAbilities . Add ( id . id ) ;
7074 }
7175 else
@@ -75,6 +79,11 @@ private void SetSpecialAbilityIdentifiers()
7579 }
7680 }
7781 }
82+
83+ private static bool AbilityDoesNotExistOrCanStack ( List < Ability > abilities , AbilityIdentifier id )
84+ {
85+ return ! abilities . Contains ( id . id ) || AbilitiesUtil . GetInfo ( id . id ) . canStack ;
86+ }
7887
7988 private void SetEvolveIdentifiers ( )
8089 {
0 commit comments