EX11_020.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Hanimon
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_020 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Cost
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Kyaromon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 0,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region On Deletion
  30. if (timing == EffectTiming.OnDestroyedAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Play 1 [Shoemon] from hand for free.", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Deletion] If delete other than in battle, you may play 1 [Shoemon] from your hand without paying the cost.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass)
  43. && !CardEffectCommons.IsByBattle(hashtable);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  48. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  49. }
  50. bool CanSelectCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.EqualsCardName("Shoemon");
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  57. List<CardSource> selectedCards = new List<CardSource>();
  58. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  59. selectHandEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectCardCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. selectCardCoroutine: SelectCardCoroutine,
  69. afterSelectCardCoroutine: null,
  70. mode: SelectHandEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  73. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  81. cardSources: selectedCards,
  82. activateClass: activateClass,
  83. payCost: false,
  84. isTapped: false,
  85. root: SelectCardEffect.Root.Hand,
  86. activateETB: true));
  87. }
  88. }
  89. #endregion
  90. #region Inherit
  91. if (timing == EffectTiming.OnAllyAttack)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("End the attack by deleting 1 of your Digimon", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  96. activateClass.SetHashString("StopAttack_EX11-020");
  97. activateClass.SetIsInheritedEffect(true);
  98. cardEffects.Add(activateClass);
  99. string EffectDiscription()
  100. {
  101. return "[Opponent's Turn][Once Per Turn] When one of your opponent's Digimon attacks, by deleting 1 of your other Digimon, end that attack.";
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleArea(card)
  106. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => true)
  107. && CardEffectCommons.IsOpponentTurn(card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleArea(card)
  112. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition);
  113. }
  114. bool CanSelectPermanentCondition(Permanent permanent)
  115. {
  116. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  117. && permanent != card.PermanentOfThisCard();
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable hashtable)
  120. {
  121. if (CardEffectCommons.IsExistOnBattleArea(card))
  122. {
  123. int maxCount = 1;
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectPermanentCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: SelectPermanentCoroutine,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  138. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  139. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  142. IEnumerator SuccessProcess()
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.EndAttack());
  145. }
  146. }
  147. }
  148. }
  149. }
  150. #endregion
  151. return cardEffects;
  152. }
  153. }
  154. }