BT23_088.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // K
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_088 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Your Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("By trashing 1 [Undead]/[Dark Animal]/[CS] card from hand, Gain 1 memory", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] By trashing 1 card with the [Undead], [Dark Animal] or [CS] trait from your hand, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleArea(card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleArea(card)
  30. && CardEffectCommons.IsOwnerTurn(card)
  31. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. return CardEffectCommons.IsExistOnHand(cardSource)
  36. && (cardSource.HasUndeadTraits
  37. || cardSource.HasDarkAnimalTraits
  38. || cardSource.HasCSTraits);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  43. {
  44. CardSource selectedHandCard = null;
  45. #region Select Hand card
  46. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  47. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  48. selectHandEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectCardCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: maxCount,
  54. canNoSelect: true,
  55. canEndNotMax: false,
  56. isShowOpponent: true,
  57. selectCardCoroutine: SelectCardCoroutine,
  58. afterSelectCardCoroutine: null,
  59. mode: SelectHandEffect.Mode.Discard,
  60. cardEffect: activateClass);
  61. IEnumerator SelectCardCoroutine(CardSource cardSource)
  62. {
  63. selectedHandCard = cardSource;
  64. yield return null;
  65. }
  66. selectHandEffect.SetUpCustomMessage("Select 1 card to discard", "The opponent is selecting 1 card to discard");
  67. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card");
  68. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  69. #endregion
  70. if (selectedHandCard != null)
  71. {
  72. if (card.Owner.CanAddMemory(activateClass))
  73. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  74. }
  75. }
  76. }
  77. }
  78. #endregion
  79. #region End of Your Turn
  80. if (timing == EffectTiming.OnEndTurn)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("By deleting this tamer, digivolve into a level 5 or lower [Undead]/[Dark Animal] in trash", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[End of Your Turn] By deleting this Tamer, 1 of your Digimon may digivolve into a level 5 or lower Digimon card with the [Undead] or [Dark Animal] trait in the trash without paying the cost.";
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.IsExistOnBattleArea(card);
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleArea(card)
  97. && CardEffectCommons.IsOwnerTurn(card);
  98. }
  99. IEnumerator ActivateCoroutine(Hashtable hashtable)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  102. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  103. activateClass: activateClass,
  104. successProcess: perms => SuccessProcess(perms),
  105. failureProcess: null));
  106. IEnumerator SuccessProcess(List<Permanent> permanents)
  107. {
  108. bool IsYourDigimon(Permanent permanent)
  109. {
  110. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  111. }
  112. Permanent selectedPermament = null;
  113. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsYourDigimon));
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: IsYourDigimon,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. selectedPermament = permanent;
  130. yield return null;
  131. }
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. if (selectedPermament != null)
  134. {
  135. bool CanDigivolveCondition(CardSource cardSource)
  136. {
  137. return cardSource.HasLevel && cardSource.Level <= 5
  138. && (cardSource.HasUndeadTraits || cardSource.HasDarkAnimalTraits);
  139. }
  140. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  141. targetPermanent: selectedPermament,
  142. cardCondition: CanDigivolveCondition,
  143. payCost: false,
  144. reduceCostTuple: null,
  145. fixedCostTuple: null,
  146. ignoreDigivolutionRequirementFixedCost: -1,
  147. isHand: false,
  148. activateClass: activateClass,
  149. successProcess: null));
  150. }
  151. }
  152. }
  153. }
  154. #endregion
  155. #region Security
  156. if (timing == EffectTiming.SecuritySkill)
  157. {
  158. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }