MatsudaTakato_EX2_056.cs 8.8 KB

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