EX4_070.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_070 : 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. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  14. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  15. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  16. cardEffects.Add(ignoreColorConditionClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Green) && (permanent.IsDigimon || permanent.IsTamer)))
  20. {
  21. return true;
  22. }
  23. return false;
  24. }
  25. bool CardCondition(CardSource cardSource)
  26. {
  27. if (cardSource == card)
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. }
  34. if (timing == EffectTiming.OptionSkill)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  38. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[Main] Delete one of your opponent's level 3 Digimon. Then place this card in your battle area.";
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  47. {
  48. if (permanent.Level == 3)
  49. {
  50. if (permanent.TopCard.HasLevel)
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: null,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Destroy,
  79. cardEffect: activateClass);
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. }
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  83. }
  84. }
  85. if (timing == EffectTiming.OnDeclaration)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Opponent trashes 1 option card from hand or you gain Memory +2", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[Main] <Delay> (After this card is placed, by trashing it the next turn or later, activate the effect below.) - Your opponent may trash 1 Option card in their hand. If they do not trash a card, gain 2 memory.";
  94. }
  95. bool CanSelectCardCondition(CardSource cardSource)
  96. {
  97. return cardSource.IsOption;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  102. }
  103. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  106. IEnumerator SuccessProcess()
  107. {
  108. bool discarded = false;
  109. if (card.Owner.Enemy.HandCards.Count >= 1)
  110. {
  111. int discardCount = 1;
  112. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  113. selectHandEffect.SetUp(
  114. selectPlayer: card.Owner.Enemy,
  115. canTargetCondition: CanSelectCardCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: discardCount,
  119. canNoSelect: true,
  120. canEndNotMax: false,
  121. isShowOpponent: true,
  122. selectCardCoroutine: null,
  123. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  124. mode: SelectHandEffect.Mode.Discard,
  125. cardEffect: activateClass);
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  128. {
  129. if (cardSources.Count >= 1)
  130. {
  131. discarded = true;
  132. yield return null;
  133. }
  134. }
  135. }
  136. if (!discarded)
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  139. }
  140. }
  141. }
  142. }
  143. if (timing == EffectTiming.SecuritySkill)
  144. {
  145. cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
  146. }
  147. return cardEffects;
  148. }
  149. }
  150. }