EX10_066.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //Akihiro Kurata
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_066 : 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 Turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region End of Your Turn
  19. if (timing == EffectTiming.OnEndTurn)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Digivolve into [Belphemon] in name", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[End of Your Turn] If you have 6 or fewer cards in your hand, by placing this Tamer as the bottom digivolution card of any of your Digimon with [Belphemon] in their names, that Digimon may digivolve into a Digimon card with [Belphemon] in its name in its name in the trash without paying the cost.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card) &&
  32. CardEffectCommons.IsOwnerTurn(card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card) &&
  37. card.Owner.HandCards.Count <= 6;
  38. }
  39. bool CanSelectBelphemon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  42. permanent.TopCard.ContainsCardName("Belphemon");
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. Permanent digivolutionCardAdded = null;
  47. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectBelphemon))
  48. {
  49. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  50. selectPermanentEffect.SetUp(
  51. selectPlayer: card.Owner,
  52. canTargetCondition: CanSelectBelphemon,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. maxCount: 1,
  56. canNoSelect: true,
  57. canEndNotMax: false,
  58. selectPermanentCoroutine: SelectPermanentCoroutine,
  59. afterSelectPermanentCoroutine: null,
  60. mode: SelectPermanentEffect.Mode.Custom,
  61. cardEffect: activateClass);
  62. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get digivolution cards.", "The opponent is selecting 1 Digimon that will get digivolution cards.");
  63. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  64. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  65. {
  66. Permanent oldThisCardPermanent = card.PermanentOfThisCard();
  67. CardSource topCard = oldThisCardPermanent.TopCard;
  68. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { oldThisCardPermanent, permanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  69. if (oldThisCardPermanent.TopCard == null && CardEffectCommons.IsExistOnBattleArea(card))
  70. {
  71. if (permanent.DigivolutionCards.Contains(topCard))
  72. {
  73. digivolutionCardAdded = permanent;
  74. }
  75. }
  76. }
  77. }
  78. if(digivolutionCardAdded != null)
  79. {
  80. bool CanSelectEvoBelphemon(CardSource source)
  81. {
  82. return source.ContainsCardName("Belphemon") &&
  83. source.CanPlayCardTargetFrame(digivolutionCardAdded.PermanentFrame, false, activateClass, SelectCardEffect.Root.Trash);
  84. }
  85. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectEvoBelphemon))
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  88. targetPermanent: digivolutionCardAdded,
  89. cardCondition: CanSelectEvoBelphemon,
  90. payCost: false,
  91. reduceCostTuple: null,
  92. fixedCostTuple: null,
  93. ignoreDigivolutionRequirementFixedCost: -1,
  94. isHand: false,
  95. activateClass: activateClass,
  96. successProcess: null));
  97. }
  98. }
  99. yield return null;
  100. }
  101. }
  102. #endregion
  103. #region Security
  104. if (timing == EffectTiming.SecuritySkill)
  105. {
  106. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  107. }
  108. #endregion
  109. return cardEffects;
  110. }
  111. }
  112. }