BT15_020.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_020 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Tsunomon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnStartMainPhase)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Your 1 Digimon gains Blocker and Draw 1", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Start of Your Main Phase] 1 of your Digimon gains <Blocker> until the end of your opponent's turn. Then, if you have a Tamer with [Matt Ishida] in its name, <Draw 1>.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  32. }
  33. bool PermanentCondition(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  36. {
  37. if (permanent.IsTamer)
  38. {
  39. if (permanent.TopCard.ContainsCardName("Matt Ishida"))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.IsOwnerTurn(card))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  67. {
  68. if (card.Owner.LibraryCards.Count >= 1)
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  79. {
  80. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectPermanentCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: maxCount,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  99. targetPermanent: selectedPermanent,
  100. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  101. activateClass: activateClass));
  102. }
  103. }
  104. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  107. }
  108. }
  109. }
  110. if (timing == EffectTiming.OnAllyAttack)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  115. activateClass.SetIsInheritedEffect(true);
  116. activateClass.SetHashString("Draw1_BT15_020");
  117. cardEffects.Add(activateClass);
  118. string EffectDiscription()
  119. {
  120. return "[When Attacking][Once Per Turn] <Draw 1>. (Draw 1 card from your deck.)";
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. return true;
  131. }
  132. return false;
  133. }
  134. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  137. }
  138. }
  139. return cardEffects;
  140. }
  141. }
  142. }