BT20_075.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_075 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  17. {
  18. if (targetPermanent.TopCard.EqualsTraits("Dark Dragon") || targetPermanent.TopCard.EqualsTraits("Evil Dragon"))
  19. {
  20. return true;
  21. }
  22. }
  23. return false;
  24. }
  25. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Inherit
  29. if (timing == EffectTiming.None)
  30. {
  31. bool PermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  34. {
  35. if (permanent.TopCard.EqualsTraits("Dark Dragon") || permanent.TopCard.EqualsTraits("Evil Dragon"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition()
  43. {
  44. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  45. {
  46. if (CardEffectCommons.IsOwnerTurn(card))
  47. {
  48. if (card.Owner.HandCards.Count <= 4)
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. cardEffects.Add(CardEffectFactory.ChangeSAttackStaticEffect(PermanentCondition, 1, true, card, CanUseCondition));
  57. }
  58. #endregion
  59. #region On Play
  60. if (timing == EffectTiming.OnEnterFieldAnyone)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect("Trash 2 cards then, gain Raid, Piercing, and +4000 DP.", CanUseCondition, card);
  64. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[On Play] Trash 2 cards in your hand. Then, for the turn, 1 of your Digimon gains <Raid> and <Piercing> and +4000 DP.";
  69. }
  70. bool CanSelectPermanentCondition(Permanent permanent)
  71. {
  72. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsExistOnBattleArea(card))
  81. {
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  83. {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. if (card.Owner.HandCards.Count >= 1)
  92. {
  93. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  94. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  95. selectHandEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: (cardSource) => true,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: discardCount,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. isShowOpponent: true,
  104. selectCardCoroutine: null,
  105. afterSelectCardCoroutine: null,
  106. mode: SelectHandEffect.Mode.Discard,
  107. cardEffect: activateClass);
  108. yield return StartCoroutine(selectHandEffect.Activate());
  109. }
  110. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  111. {
  112. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  113. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  114. selectPermanentEffect.SetUp(
  115. selectPlayer: card.Owner,
  116. canTargetCondition: CanSelectPermanentCondition,
  117. canTargetCondition_ByPreSelecetedList: null,
  118. canEndSelectCondition: null,
  119. maxCount: maxCount,
  120. canNoSelect: false,
  121. canEndNotMax: false,
  122. selectPermanentCoroutine: SelectPermanentCoroutine,
  123. afterSelectPermanentCoroutine: null,
  124. mode: SelectPermanentEffect.Mode.Custom,
  125. cardEffect: activateClass);
  126. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain <Raid> and <Piercing> and +4000 DP.", "The opponent is selecting 1 Digimon that will gain <Raid> and <Piercing> and +4000 DP.");
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  131. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  133. }
  134. }
  135. }
  136. }
  137. #endregion
  138. #region When Digivolving
  139. if (timing == EffectTiming.OnEnterFieldAnyone)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect("Trash 2 cards then, gain Raid, Piercing, and +4000 DP.", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[On Play] Trash 2 cards in your hand. Then, for the turn, 1 of your Digimon gains <Raid> and <Piercing> and +4000 DP.";
  148. }
  149. bool CanSelectPermanentCondition(Permanent permanent)
  150. {
  151. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  162. {
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  169. {
  170. if (card.Owner.HandCards.Count >= 1)
  171. {
  172. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  173. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  174. selectHandEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: (cardSource) => true,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: discardCount,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. isShowOpponent: true,
  183. selectCardCoroutine: null,
  184. afterSelectCardCoroutine: null,
  185. mode: SelectHandEffect.Mode.Discard,
  186. cardEffect: activateClass);
  187. yield return StartCoroutine(selectHandEffect.Activate());
  188. }
  189. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  190. {
  191. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  192. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  193. selectPermanentEffect.SetUp(
  194. selectPlayer: card.Owner,
  195. canTargetCondition: CanSelectPermanentCondition,
  196. canTargetCondition_ByPreSelecetedList: null,
  197. canEndSelectCondition: null,
  198. maxCount: maxCount,
  199. canNoSelect: false,
  200. canEndNotMax: false,
  201. selectPermanentCoroutine: SelectPermanentCoroutine,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Custom,
  204. cardEffect: activateClass);
  205. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain <Raid> and <Piercing> and +4000 DP.", "The opponent is selecting 1 Digimon that will gain <Raid> and <Piercing> and +4000 DP.");
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  208. {
  209. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  210. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  211. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  212. }
  213. }
  214. }
  215. }
  216. #endregion
  217. return cardEffects;
  218. }
  219. }
  220. }