BT20_065.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class WormmonBT20_065 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Give effects to your opponent's Digimon", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] By trashing 1 card in your hand, give 1 of your opponent's Digimon '[On Deletion] Lose 1 memory.' until the end of their turn.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  25. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  26. return false;
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  31. }
  32. bool CanSelectPermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. if (card.Owner.HandCards.Count >= 1){
  39. bool discarded = false;
  40. int discardCount = 1;
  41. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  42. selectHandEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: cardSource => true,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: discardCount,
  48. canNoSelect: true,
  49. canEndNotMax: false,
  50. isShowOpponent: true,
  51. selectCardCoroutine: null,
  52. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  53. mode: SelectHandEffect.Mode.Discard,
  54. cardEffect: activateClass);
  55. yield return StartCoroutine(selectHandEffect.Activate());
  56. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  57. {
  58. if (cardSources.Count == 1)
  59. {
  60. discarded = true;
  61. yield return null;
  62. }
  63. }
  64. if (discarded)
  65. {
  66. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  67. {
  68. int maxCount = Math.Min(1,
  69. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect =
  71. GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage(
  85. "Select 1 Digimon that will gain effect.",
  86. "The opponent is selecting 1 Digimon that will gain effect.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  89. {
  90. if (permanent != null)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  93. ActivateClass activateClass1 = new ActivateClass();
  94. activateClass1.SetUpICardEffect("Lose 1 Memory.", GivenEffectCanUseCondition,permanent.TopCard);
  95. activateClass1.SetUpActivateClass(GivenEffectCanActivateCondition,GivenEffectActivateCoroutine,-1,false, GivenEffectDescription());
  96. activateClass1.SetEffectSourcePermanent(permanent);
  97. permanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  98. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  101. }
  102. string GivenEffectDescription()
  103. {
  104. return "[On Deletion] Lose 1 Memory.";
  105. }
  106. bool GivenEffectCanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerOnDeletion(hashtable, permanent.TopCard);
  109. }
  110. bool GivenEffectCanActivateCondition(Hashtable hashtable1)
  111. {
  112. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  113. {
  114. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  115. {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121. IEnumerator GivenEffectActivateCoroutine(Hashtable _hashtable)
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(permanent.TopCard.Owner.AddMemory(-1, activateClass));
  124. }
  125. ICardEffect GetCardEffect(EffectTiming _timing)
  126. {
  127. if (_timing == EffectTiming.OnDestroyedAnyone)
  128. {
  129. return activateClass1;
  130. }
  131. return null;
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. if (timing == EffectTiming.OnDestroyedAnyone)
  142. {
  143. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  144. }
  145. return cardEffects;
  146. }
  147. }
  148. }