EX11_063.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Winr
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of turn set to 3
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #endregion
  17. #region On Play
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Add top face down security to hand. Place [Royal Base] face up to bottom of security.", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. => "[On Play] Add your top face-down security card to the hand. Then, you may place 1 [Royal Base] trait Digimon card from your hand face up as the bottom security card.";
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleArea(card)
  29. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  32. bool IsRoyalBaseDigimon(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon
  35. && cardSource.EqualsTraits("Royal Base");
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. foreach (CardSource source in card.Owner.SecurityCards)
  40. {
  41. if (!source.IsFlipped)
  42. continue;
  43. yield return ContinuousController.instance.StartCoroutine(
  44. CardObjectController.AddHandCards(new List<CardSource>() { source }, false, activateClass));
  45. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  46. player: card.Owner,
  47. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  48. activateClass).ReduceSecurity());
  49. break;
  50. }
  51. if(CardEffectCommons.HasMatchConditionOwnersHand(card, IsRoyalBaseDigimon))
  52. {
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: IsRoyalBaseDigimon,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: 1,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: null,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.PutSecurityBottom,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetIsFaceup();
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. }
  70. }
  71. }
  72. #endregion
  73. #region End of Your Turn
  74. if (timing == EffectTiming.OnEndTurn)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("By suspending this Tamer, 1 [Royal Base] Digimon gains <Collision> and <Piercing> and attacks.", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  79. cardEffects.Add(activateClass);
  80. string EffectDescription()
  81. => "[End of Your Turn] By suspending this Tamer, 1 of your [Royal Base] trait Digimon gains <Collision> and <Piercing> for the turn, and attacks.";
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.IsExistOnBattleArea(card)
  85. && CardEffectCommons.IsOwnerTurn(card);
  86. }
  87. bool CanActivateCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.IsExistOnBattleArea(card)
  90. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  91. }
  92. bool CanSelectPermanentCondition(Permanent permanent)
  93. {
  94. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  95. && permanent.TopCard.EqualsTraits("Royal Base");
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  100. new List<Permanent>() { card.PermanentOfThisCard() },
  101. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  102. Permanent selectedPermament = null;
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: 1,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to gain effects and attack.", "Opponent is selecting a Digimon to give effects and attack with.");
  117. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  118. {
  119. selectedPermament = permanent;
  120. yield return null;
  121. }
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  123. if (selectedPermament != null)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCollision(
  126. targetPermanent: selectedPermament,
  127. effectDuration: EffectDuration.UntilEachTurnEnd,
  128. activateClass: activateClass));
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  130. targetPermanent: selectedPermament,
  131. effectDuration: EffectDuration.UntilEachTurnEnd,
  132. activateClass: activateClass));
  133. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  134. selectAttackEffect.SetUp(
  135. attacker: selectedPermament,
  136. canAttackPlayerCondition: () => true,
  137. defenderCondition: (permanent) => true,
  138. cardEffect: activateClass);
  139. selectAttackEffect.SetCanNotSelectNotAttack();
  140. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  141. }
  142. }
  143. }
  144. #endregion
  145. #region Security
  146. if (timing == EffectTiming.SecuritySkill)
  147. {
  148. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  149. }
  150. #endregion
  151. return cardEffects;
  152. }
  153. }
  154. }