EX2_056.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX2
  6. {
  7. public class EX2_056 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnDestroyedAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Your Turn] When an opponent's Digimon is deleted, you may suspend this Tamer to gain 1 memory.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.IsExistOnBattleArea(card))
  29. {
  30. if (CardEffectCommons.IsOwnerTurn(card))
  31. {
  32. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  54. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  55. }
  56. }
  57. if (timing == EffectTiming.BeforePayCost)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Your Digimon gets Blitz", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  62. activateClass.SetHashString("Digisorption-1_BT2_088");
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[Your Turn] When one of your Digimon would digivolve into a Digimon with [Gallantmon] or [Growlmon] in its name, that Digimon gains \"[When Digivolving] <Blitz> (This Digimon can attack when your opponent has 1 or more memory.)\" for the turn.";
  67. }
  68. bool DigivolvePermanentCondition(Permanent permanent)
  69. {
  70. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
  71. }
  72. bool CardCondition(CardSource cardSource)
  73. {
  74. if (cardSource.IsDigimon)
  75. {
  76. if (cardSource.ContainsCardName("Gallantmon") || cardSource.ContainsCardName("Growlmon"))
  77. {
  78. return true;
  79. }
  80. }
  81. return false;
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. if (CardEffectCommons.IsExistOnBattleArea(card))
  86. {
  87. if (CardEffectCommons.IsOwnerTurn(card))
  88. {
  89. if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, DigivolvePermanentCondition, CardCondition))
  90. {
  91. return true;
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. List<Permanent> Permanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable);
  102. if (Permanents != null)
  103. {
  104. if (Permanents.Count(CardEffectCommons.IsPermanentExistsOnBattleArea) >= 1)
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  113. {
  114. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  115. List<Permanent> Permanents = CardEffectCommons.GetPermanentsFromHashtable(_hashtable);
  116. bool PermanentCondition(Permanent permanent)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  119. {
  120. if (Permanents.Contains(permanent))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. if (Permanents != null)
  128. {
  129. if (Permanents.Count(PermanentCondition) >= 1)
  130. {
  131. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents().Filter(PermanentCondition))
  132. {
  133. AddSkillClass addSkillClass = new AddSkillClass();
  134. addSkillClass.SetUpICardEffect("Your Digimon get Blitz", CanUseCondition1, card);
  135. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  136. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: addSkillClass, timing: EffectTiming.None);
  137. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  138. bool CanUseCondition1(Hashtable hashtable)
  139. {
  140. return true;
  141. }
  142. bool CardSourceCondition(CardSource cardSource)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(cardSource))
  145. {
  146. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  147. {
  148. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  149. {
  150. return true;
  151. }
  152. }
  153. }
  154. return false;
  155. }
  156. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  157. {
  158. if (_timing == EffectTiming.OnEnterFieldAnyone)
  159. {
  160. bool Condition()
  161. {
  162. if (CardSourceCondition(cardSource))
  163. {
  164. return true;
  165. }
  166. return false;
  167. }
  168. cardEffects.Add(CardEffectFactory.BlitzSelfEffect(isInheritedEffect: false,
  169. card: cardSource,
  170. condition: Condition,
  171. isWhenDigivolving: true));
  172. }
  173. return cardEffects;
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. if (timing == EffectTiming.SecuritySkill)
  181. {
  182. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  183. }
  184. return cardEffects;
  185. }
  186. }
  187. }