BT16_053.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_053 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Armadillomon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Barrier
  22. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  23. {
  24. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(false, card, null));
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't attack players", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[On Play] 1 of your opponent's Digimon can't attack players until the end of your opponent's turn.";
  37. }
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  51. return true;
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage(
  72. "Select Digimon that will get effects.",
  73. "The opponent is selecting Digimon that will get effects.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  76. {
  77. bool DefenderCondition(Permanent defender)
  78. {
  79. return defender == null;
  80. }
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  82. targetPermanent: permanent,
  83. defenderCondition: DefenderCondition,
  84. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  85. activateClass: activateClass,
  86. effectName: "Can't Attack to player"));
  87. }
  88. }
  89. }
  90. #endregion
  91. #region When Digivolving
  92. if (timing == EffectTiming.OnEnterFieldAnyone)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't attack players", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[When Digivolving] 1 of your opponent's Digimon can't attack players until the end of your opponent's turn.";
  101. }
  102. bool CanSelectPermanentCondition(Permanent permanent)
  103. {
  104. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  115. return true;
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable hashtable)
  120. {
  121. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: maxCount,
  129. canNoSelect: false,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: SelectPermanentCoroutine,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Custom,
  134. cardEffect: activateClass);
  135. selectPermanentEffect.SetUpCustomMessage(
  136. "Select Digimon that will get effects.",
  137. "The opponent is selecting Digimon that will get effects.");
  138. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  139. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  140. {
  141. bool DefenderCondition(Permanent defender)
  142. {
  143. return defender == null;
  144. }
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  146. targetPermanent: permanent,
  147. defenderCondition: DefenderCondition,
  148. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  149. activateClass: activateClass,
  150. effectName: "Can't Attack to player"));
  151. }
  152. }
  153. }
  154. #endregion
  155. #region Inherited Effect
  156. if (timing == EffectTiming.None)
  157. {
  158. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  159. changeValue: () => 1000,
  160. isInheritedEffect: true,
  161. card: card,
  162. condition: null));
  163. }
  164. #endregion
  165. return cardEffects;
  166. }
  167. }
  168. }