BT21_081.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT21_081 Owen
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_081 : 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 Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleArea(card))
  25. {
  26. if (CardEffectCommons.IsOwnerTurn(card))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  38. {
  39. if (card.Owner.CanAddMemory(activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  50. }
  51. }
  52. #endregion
  53. #region End of your turn
  54. if (timing == EffectTiming.OnEndTurn)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Give piercing and attack", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  59. cardEffects.Add(activateClass);
  60. string EffectDescription()
  61. {
  62. return "[End of Your Turn] By suspending this Tamer, 1 of your Digimon with the [Reptile] or [Dragonkin] trait gains <Piercing> for the turn. Then, that Digimon attacks.";
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.IsOwnerTurn(card) &&
  67. CardEffectCommons.IsExistOnBattleArea(card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return isExistOnField(card) && CardEffectCommons.CanActivateSuspendCostEffect(card);
  72. }
  73. bool CanSelectCondition(Permanent permanent)
  74. {
  75. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.EqualsTraits("Reptile") || permanent.TopCard.EqualsTraits("Dragonkin"));
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable hashtable)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  80. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  81. Permanent selectedPermanent = null;
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectCondition))
  83. {
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: 1,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: SelectPermanentCoroutine,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Custom,
  96. cardEffect: activateClass);
  97. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain piercing and attack.",
  98. "The opponent is selecting 1 Digimon that will gain piercing and attack.");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(selectedPermanent, EffectDuration.UntilEachTurnEnd, activateClass));
  108. if (selectedPermanent.CanAttack(activateClass))
  109. {
  110. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  111. selectAttackEffect.SetUp(
  112. attacker: selectedPermanent,
  113. canAttackPlayerCondition: () => true,
  114. defenderCondition: (permanent) => true,
  115. cardEffect: activateClass);
  116. selectAttackEffect.SetCanNotSelectNotAttack();
  117. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  118. }
  119. }
  120. }
  121. }
  122. }
  123. #endregion
  124. #region Security
  125. if (timing == EffectTiming.SecuritySkill)
  126. {
  127. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  128. }
  129. #endregion
  130. return cardEffects;
  131. }
  132. }
  133. }