EX10_008.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // MetalGreymon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_008 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.HasGreymonName;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Reboot
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region OP/WD Shared
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. }
  33. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  34. {
  35. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  36. {
  37. Permanent selectedPermanment = null;
  38. #region Select Permanent
  39. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  40. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  41. selectPermanentEffect.SetUp(
  42. selectPlayer: card.Owner,
  43. canTargetCondition: CanSelectPermanentCondition,
  44. canTargetCondition_ByPreSelecetedList: null,
  45. canEndSelectCondition: null,
  46. maxCount: maxCount,
  47. canNoSelect: false,
  48. canEndNotMax: false,
  49. selectPermanentCoroutine: SelectPermanentCoroutine,
  50. afterSelectPermanentCoroutine: null,
  51. mode: SelectPermanentEffect.Mode.Custom,
  52. cardEffect: activateClass);
  53. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  54. {
  55. selectedPermanment = permanent;
  56. yield return null;
  57. }
  58. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Collision & [Start of Your Main Phase] This Digimon attacks", "The opponent is selecting 1 Digimon to gain Collision & [Start of Your Main Phase] This Digimon attacks");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. #endregion
  61. if (selectedPermanment != null)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCollision(
  64. targetPermanent: selectedPermanment,
  65. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  66. activateClass: activateClass));
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.StartOfMainAttack(
  68. targetPermanent: selectedPermanment,
  69. cardEffect: activateClass));
  70. }
  71. }
  72. }
  73. #endregion
  74. #region On Play
  75. if (timing == EffectTiming.OnEnterFieldAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Give 1 opponent digimon <Collision> and [Start of Your Main Phase] This Digimon attacks", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  80. cardEffects.Add(activateClass);
  81. string EffectDiscription()
  82. {
  83. return "[On Play] Give 1 of your opponent's Digimon <Collision> (During this Digimon's attack, all of your opponent's Digimon gain <Blocker>, and must block if possible.) and '[Start of Your Main Phase] This Digimon attacks.' until their turn ends.";
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  88. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  89. }
  90. bool CanActivateCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  93. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Give 1 opponent digimon <Collision> and [Start of Your Main Phase] This Digimon attacks", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[When Digivolving] Give 1 of your opponent's Digimon <Collision> (During this Digimon's attack, all of your opponent's Digimon gain <Blocker>, and must block if possible.) and '[Start of Your Main Phase] This Digimon attacks.' until their turn ends.";
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  111. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  116. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  117. }
  118. }
  119. #endregion
  120. #region ESS - Opponent's Turn Once Per Turn
  121. if (timing == EffectTiming.OnAttackTargetChanged)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Trash opponent top security", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  126. activateClass.SetHashString("EX10_008_AttackTargetChanged");
  127. activateClass.SetIsInheritedEffect(true);
  128. cardEffects.Add(activateClass);
  129. string EffectDiscription()
  130. {
  131. return "[Opponent's Turn] [Once Per Turn] When attack targets change, if this Digimon has [Greymon] in its name, trash your opponent's top security card.";
  132. }
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  136. && CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, PermanentCondition);
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  141. && CardEffectCommons.IsOpponentTurn(card)
  142. && card.PermanentOfThisCard().TopCard.HasGreymonName;
  143. }
  144. bool PermanentCondition(Permanent permanent)
  145. {
  146. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) || CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable hashtable)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  151. player: card.Owner.Enemy,
  152. destroySecurityCount: 1,
  153. cardEffect: activateClass,
  154. fromTop: true).DestroySecurity());
  155. }
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }