BT7_065.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 BT7_065 : 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. int count()
  16. {
  17. if (CardEffectCommons.IsExistOnBattleArea(card))
  18. {
  19. return card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasXAntibodyTraits);
  20. }
  21. return 0;
  22. }
  23. bool Condition()
  24. {
  25. if (CardEffectCommons.IsOwnerTurn(card))
  26. {
  27. if (count() >= 1)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 1000 * count(), isInheritedEffect: false, card: card, condition: Condition));
  35. }
  36. if (timing == EffectTiming.OnAllyAttack)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("Place a Card from hand to delete Digimon", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  41. activateClass.SetHashString("PlaceDigivolutionCards_BT7_065");
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[When Attacking][Once Per Turn] You may place 1 card with [X-Antibody] in its traits from your hand at the bottom of this Digimon's digivolution cards to delete up to 2 of your opponent's Digimon with play costs less than or equal to this Digimon's digivolution cards.";
  46. }
  47. bool CanSelectCardCondition(CardSource cardSource)
  48. {
  49. return cardSource.HasXAntibodyTraits;
  50. }
  51. bool CanSelectPermanentCondition(Permanent permanent)
  52. {
  53. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  54. {
  55. if (CardEffectCommons.IsOwnerTurn(card))
  56. {
  57. if (permanent.TopCard.GetCostItself <= card.PermanentOfThisCard().DigivolutionCards.Count)
  58. {
  59. if (permanent.TopCard.HasPlayCost)
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleArea(card))
  75. {
  76. if (card.Owner.HandCards.Count >= 1)
  77. {
  78. return true;
  79. }
  80. }
  81. return false;
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  84. {
  85. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  86. {
  87. List<CardSource> selectedCards = new List<CardSource>();
  88. int maxCount = 1;
  89. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  90. selectHandEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectCardCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: true,
  97. canEndNotMax: false,
  98. isShowOpponent: true,
  99. selectCardCoroutine: SelectCardCoroutine,
  100. afterSelectCardCoroutine: null,
  101. mode: SelectHandEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  104. yield return StartCoroutine(selectHandEffect.Activate());
  105. IEnumerator SelectCardCoroutine(CardSource cardSource)
  106. {
  107. selectedCards.Add(cardSource);
  108. yield return null;
  109. }
  110. if (selectedCards.Count >= 1)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  113. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  114. {
  115. maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  116. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  117. selectPermanentEffect.SetUp(
  118. selectPlayer: card.Owner,
  119. canTargetCondition: CanSelectPermanentCondition,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: CanEndSelectCondition,
  122. maxCount: maxCount,
  123. canNoSelect: false,
  124. canEndNotMax: true,
  125. selectPermanentCoroutine: null,
  126. afterSelectPermanentCoroutine: null,
  127. mode: SelectPermanentEffect.Mode.Destroy,
  128. cardEffect: activateClass);
  129. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  130. bool CanEndSelectCondition(List<Permanent> permanents)
  131. {
  132. if (CardEffectCommons.HasNoElement(permanents))
  133. {
  134. return false;
  135. }
  136. return true;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. return cardEffects;
  144. }
  145. }