BT12_056.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_056 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Dinobeemon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Suspend 1 Digimon and this Digimon can attack to opponent's 1 Digimon", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, you may attack your opponent's Digimon with this Digimon.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. return true;
  44. }
  45. if (card.PermanentOfThisCard().CanAttack(activateClass))
  46. {
  47. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && card.PermanentOfThisCard().CanAttackTargetDigimon(permanent, activateClass)))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: null,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Tap,
  72. cardEffect: activateClass);
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. }
  75. Permanent selectedPermanent = card.PermanentOfThisCard();
  76. if (selectedPermanent != null)
  77. {
  78. if (selectedPermanent.CanAttack(activateClass))
  79. {
  80. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  81. selectAttackEffect.SetUp(
  82. attacker: selectedPermanent,
  83. canAttackPlayerCondition: () => false,
  84. defenderCondition: (permanent) => true,
  85. cardEffect: activateClass);
  86. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  87. }
  88. }
  89. }
  90. }
  91. if (timing == EffectTiming.OnTappedAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  96. activateClass.SetHashString("Memory+1_BT12_056");
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[Your Turn][Once Per Turn] If an opponent's Digimon becomes suspended, gain 1 memory.";
  101. }
  102. bool PermanentCondition(Permanent permanent)
  103. {
  104. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.IsOwnerTurn(card))
  111. {
  112. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.IsExistOnBattleArea(card))
  123. {
  124. return true;
  125. }
  126. return false;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  131. }
  132. }
  133. return cardEffects;
  134. }
  135. }
  136. }