P_076.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class P_076 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool Condition()
  16. {
  17. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  18. }
  19. bool PermanentCondition(Permanent targetPermanent)
  20. {
  21. return targetPermanent == card.PermanentOfThisCard();
  22. }
  23. bool CardSourceCondition(CardSource cardSource)
  24. {
  25. if (cardSource.CardTraits.Contains("Composite"))
  26. {
  27. return true;
  28. }
  29. if (cardSource.CardColors.Count == 2)
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool RootCondition(SelectCardEffect.Root root)
  36. {
  37. return true;
  38. }
  39. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  40. changeValue: -2,
  41. permanentCondition: PermanentCondition,
  42. cardCondition: CardSourceCondition,
  43. rootCondition: RootCondition,
  44. isInheritedEffect: false,
  45. card: card,
  46. condition: Condition,
  47. setFixedCost: false));
  48. }
  49. if (timing == EffectTiming.OnAllyAttack)
  50. {
  51. ActivateClass activateClass = new ActivateClass();
  52. activateClass.SetUpICardEffect("Delete Digimon with 3000 DP or less", CanUseCondition, card);
  53. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  54. activateClass.SetIsInheritedEffect(true);
  55. cardEffects.Add(activateClass);
  56. string EffectDiscription()
  57. {
  58. return "[When Attacking] For each of this Digimon's colors, delete 1 of your opponent's Digimon with 3000 DP or less.";
  59. }
  60. bool CanSelectPermanentCondition(Permanent permanent)
  61. {
  62. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  63. {
  64. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. if (CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  80. {
  81. if (card.PermanentOfThisCard().TopCard.CardColors.Count >= 1)
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. if (isExistOnField(card))
  92. {
  93. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. int maxCount = Math.Min(card.PermanentOfThisCard().TopCard.CardColors.Count, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: null,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Destroy,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. }
  114. }
  115. }
  116. }
  117. return cardEffects;
  118. }
  119. }