|
|
@@ -7,14 +7,24 @@ using UnityEngine;
|
|
|
public class PartitionCondition
|
|
|
{
|
|
|
public int Level;
|
|
|
- public List<CardColor> Color;
|
|
|
+ public CardColor Color;
|
|
|
+ public CardColor Color2;
|
|
|
+ public bool hasTwoColor = false;
|
|
|
|
|
|
- public PartitionCondition(int level, List<CardColor> color)
|
|
|
+ public PartitionCondition(int level, CardColor color)
|
|
|
{
|
|
|
Level = level;
|
|
|
Color = color;
|
|
|
}
|
|
|
|
|
|
+ public PartitionCondition(int level, CardColor color, CardColor color2)
|
|
|
+ {
|
|
|
+ Level = level;
|
|
|
+ Color = color;
|
|
|
+ Color2 = color2;
|
|
|
+ hasTwoColor = true;
|
|
|
+ }
|
|
|
+ /*
|
|
|
public bool ContainsAll(List<CardColor> sourceColors)
|
|
|
{
|
|
|
foreach(CardColor cardColor in Color)
|
|
|
@@ -25,6 +35,7 @@ public class PartitionCondition
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
public partial class CardEffectFactory
|
|
|
@@ -55,70 +66,141 @@ public partial class CardEffectFactory
|
|
|
if (targetPermanent.TopCard == null) return null;
|
|
|
if (card == null) return null;
|
|
|
|
|
|
- List<CardSource> sourceOneCard = targetPermanent.cardSources
|
|
|
- .Clone()
|
|
|
- .Filter(source =>
|
|
|
- partitionConditions[0].ContainsAll(source.CardColors)
|
|
|
- && (source.HasLevel && source.Level == partitionConditions[0].Level));
|
|
|
-
|
|
|
- List<CardSource> sourceTwoCard = targetPermanent.cardSources
|
|
|
- .Clone()
|
|
|
- .Filter(source =>
|
|
|
- partitionConditions[1].ContainsAll(source.CardColors)
|
|
|
- && (source.HasLevel && source.Level == partitionConditions[1].Level));
|
|
|
-
|
|
|
- ActivateClass activateClass = new ActivateClass();
|
|
|
- activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
|
|
|
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
- activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
|
|
|
- activateClass.SetIsInheritedEffect(isInheritedEffect);
|
|
|
-
|
|
|
- string EffectDiscription()
|
|
|
- {
|
|
|
- return DataBase.PartitionEffectDiscription();
|
|
|
- }
|
|
|
|
|
|
- bool CanUseCondition(Hashtable hashtable)
|
|
|
+ if (partitionConditions[0].hasTwoColor == false || partitionConditions[1].hasTwoColor == false)
|
|
|
{
|
|
|
- if (CardEffectCommons.CanTriggerPartition(hashtable, card))
|
|
|
+ List<CardSource> sourceOneCard = targetPermanent.cardSources
|
|
|
+ .Clone()
|
|
|
+ .Filter(source =>
|
|
|
+ source.CardColors.Contains(partitionConditions[0].Color)
|
|
|
+ && (source.HasLevel && source.Level == partitionConditions[0].Level));
|
|
|
+
|
|
|
+ List<CardSource> sourceTwoCard = targetPermanent.cardSources
|
|
|
+ .Clone()
|
|
|
+ .Filter(source =>
|
|
|
+ source.CardColors.Contains(partitionConditions[1].Color)
|
|
|
+ && (source.HasLevel && source.Level == partitionConditions[1].Level));
|
|
|
+
|
|
|
+
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
+ activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
|
|
|
+ activateClass.SetIsInheritedEffect(isInheritedEffect);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
{
|
|
|
- if (condition == null || condition())
|
|
|
+ return DataBase.PartitionEffectDiscription();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanTriggerPartition(hashtable, card))
|
|
|
{
|
|
|
- return true;
|
|
|
+ if (condition == null || condition())
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
- }
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanActivatePartition(targetPermanent))
|
|
|
+ {
|
|
|
+ if (sourceOneCard == null || sourceOneCard.Count > 0)
|
|
|
+ {
|
|
|
+ if (sourceTwoCard == null || sourceTwoCard.Count > 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ if (sourceOneCard.Count == 1)
|
|
|
+ sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
|
|
|
+
|
|
|
+ if (sourceTwoCard.Count == 1)
|
|
|
+ sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
|
|
|
+
|
|
|
+ return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
|
|
|
+ }
|
|
|
+
|
|
|
+ return activateClass;
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- if (CardEffectCommons.CanActivatePartition(targetPermanent))
|
|
|
+ List<CardSource> sourceOneCard = targetPermanent.cardSources
|
|
|
+ .Clone()
|
|
|
+ .Filter(source =>
|
|
|
+ source.CardColors.Contains(partitionConditions[0].Color) || source.CardColors.Contains(partitionConditions[0].Color2)
|
|
|
+ && (source.HasLevel && source.Level == partitionConditions[0].Level));
|
|
|
+
|
|
|
+ List<CardSource> sourceTwoCard = targetPermanent.cardSources
|
|
|
+ .Clone()
|
|
|
+ .Filter(source =>
|
|
|
+ source.CardColors.Contains(partitionConditions[1].Color) || source.CardColors.Contains(partitionConditions[1].Color2)
|
|
|
+ && (source.HasLevel && source.Level == partitionConditions[1].Level));
|
|
|
+
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Partition", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
+ activateClass.SetHashString($"Partition_{card.CardID}" + (isInheritedEffect ? "_inherited" : ""));
|
|
|
+ activateClass.SetIsInheritedEffect(isInheritedEffect);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return DataBase.PartitionEffectDiscription();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- if (sourceOneCard == null || sourceOneCard.Count > 0)
|
|
|
+ if (CardEffectCommons.CanTriggerPartition(hashtable, card))
|
|
|
{
|
|
|
- if (sourceTwoCard == null || sourceTwoCard.Count > 0)
|
|
|
+ if (condition == null || condition())
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
- }
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.CanActivatePartition(targetPermanent))
|
|
|
+ {
|
|
|
+ if (sourceOneCard == null || sourceOneCard.Count > 0)
|
|
|
+ {
|
|
|
+ if (sourceTwoCard == null || sourceTwoCard.Count > 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
- {
|
|
|
- if (sourceOneCard.Count == 1)
|
|
|
- sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ if (sourceOneCard.Count == 1)
|
|
|
+ sourceTwoCard = sourceTwoCard.Except(sourceOneCard).ToList();
|
|
|
|
|
|
- if (sourceTwoCard.Count == 1)
|
|
|
- sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
|
|
|
+ if (sourceTwoCard.Count == 1)
|
|
|
+ sourceOneCard = sourceOneCard.Except(sourceTwoCard).ToList();
|
|
|
|
|
|
- return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
|
|
|
+ return CardEffectCommons.PartitionProcess(activateClass, targetPermanent, sourceOneCard, sourceTwoCard);
|
|
|
+ }
|
|
|
+ return activateClass;
|
|
|
}
|
|
|
-
|
|
|
- return activateClass;
|
|
|
}
|
|
|
#endregion
|
|
|
}
|