BT23_078.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Goro Matayoshi
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_078 : 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 Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  16. }
  17. #endregion
  18. #region Your Turn
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("By returning tamer to hand, 1 digimon gains +3K DP. then 1 digimon may attack", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Your Turn] When your Digimon are played or digivolve, if any of them have [Avian], [Bird], [Beast], [Animal] or [Sovereign] in any of their traits (other than [Sea Animal]) or the [CS] trait, by returning this Tamer to the hand, 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  32. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsValidDigimon) || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsValidDigimon);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  37. && CardEffectCommons.IsOwnerTurn(card);
  38. }
  39. bool IsValidDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  42. && (permanent.TopCard.HasBeastTraits || permanent.TopCard.HasBirdTraits || permanent.TopCard.HasCSTraits);
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanSelectPermanentCondition1(Permanent permanent)
  49. {
  50. return permanent.CanAttack(activateClass) && CanSelectPermanentCondition(permanent);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  55. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  56. activateClass: activateClass,
  57. successProcess: SuccessProcess(),
  58. failureProcess: null)
  59. );
  60. IEnumerator SuccessProcess()
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. Permanent selectedPermament = null;
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain 3k DP.", "The opponent is selecting 1 Digimon to gain 3k DP.");
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  82. {
  83. selectedPermament = permanent;
  84. yield return null;
  85. }
  86. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  87. targetPermanent: selectedPermament,
  88. changeValue: 3000,
  89. effectDuration: EffectDuration.UntilEachTurnEnd,
  90. activateClass: activateClass));
  91. }
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  93. {
  94. Permanent selectedPermament = null;
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectPermanentCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: true,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: SelectPermanentCoroutine,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Custom,
  108. cardEffect: activateClass);
  109. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that may attack", "The opponent is selecting 1 Digimon that may attack");
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  112. {
  113. selectedPermament = permanent;
  114. yield return null;
  115. }
  116. if (selectedPermament != null)
  117. {
  118. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  119. selectAttackEffect.SetUp(
  120. attacker: selectedPermament,
  121. canAttackPlayerCondition: () => true,
  122. defenderCondition: (permanent) => true,
  123. cardEffect: activateClass);
  124. selectAttackEffect.SetCanNotSelectNotAttack();
  125. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  126. }
  127. }
  128. }
  129. }
  130. }
  131. #endregion
  132. #region Security
  133. if (timing == EffectTiming.SecuritySkill)
  134. {
  135. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  136. }
  137. #endregion
  138. return cardEffects;
  139. }
  140. }
  141. }