BT8_067.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 BT8_067 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("De-Digivolve 1 to 1 Digimon and delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.) Then, delete 1 of your opponent's Digimon with 3000 DP or less.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanSelectPermanentCondition1(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  30. {
  31. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. return true;
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (isExistOnField(card))
  53. {
  54. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: CanEndSelectCondition,
  65. maxCount: maxCount,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: SelectPermanentCoroutine,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. bool CanEndSelectCondition(List<Permanent> permanents)
  75. {
  76. if (permanents.Count <= 0)
  77. {
  78. return false;
  79. }
  80. return true;
  81. }
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. Permanent selectedPermanent = permanent;
  85. if (selectedPermanent != null)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  88. }
  89. yield return null;
  90. }
  91. }
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectPermanentCondition1,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: null,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Destroy,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. }
  110. }
  111. }
  112. }
  113. }
  114. if (timing == EffectTiming.None)
  115. {
  116. CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
  117. canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon", CanUseCondition, card);
  118. canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(attackerCondition: AttackerCondition, defenderCondition: DefenderCondition, cardEffectCondition: CardEffectCondition);
  119. canAttackTargetDefendingPermanentClass.SetIsInheritedEffect(true);
  120. cardEffects.Add(canAttackTargetDefendingPermanentClass);
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. if (isExistOnField(card))
  124. {
  125. if (CardEffectCommons.IsOwnerTurn(card))
  126. {
  127. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Dragonkin"))
  128. {
  129. return true;
  130. }
  131. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Machine"))
  132. {
  133. return true;
  134. }
  135. }
  136. }
  137. return false;
  138. }
  139. bool AttackerCondition(Permanent permanent)
  140. {
  141. return permanent == card.PermanentOfThisCard();
  142. }
  143. bool DefenderCondition(Permanent permanent)
  144. {
  145. if (permanent != null)
  146. {
  147. if (permanent.TopCard != null)
  148. {
  149. if (permanent.TopCard.Owner == card.Owner.Enemy)
  150. {
  151. if (permanent.IsDigimon)
  152. {
  153. if (!permanent.IsSuspended)
  154. {
  155. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  156. {
  157. return true;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. return false;
  165. }
  166. bool CardEffectCondition(ICardEffect cardEffect)
  167. {
  168. return true;
  169. }
  170. }
  171. return cardEffects;
  172. }
  173. }