BT21_028.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_028 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 &&
  18. (targetPermanent.TopCard.HasText("Gammamon") ||
  19. targetPermanent.TopCard.EqualsTraits("Hero"));
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 3,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null)
  27. );
  28. }
  29. #endregion
  30. #region Security A. +1/Raid
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  34. }
  35. if (timing == EffectTiming.OnAllyAttack)
  36. {
  37. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  38. }
  39. #endregion
  40. #region When Digivolving
  41. if (timing == EffectTiming.OnEnterFieldAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to Delete Digimon", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[When Digivolving] By placing 1 Digimon card with [Gammamon] in its text or the [Hero] trait from your hand as this Digimon's bottom digivolution card, delete 1 of your opponent's lowest DP Digimon.";
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. return cardSource.IsDigimon &&
  54. (cardSource.HasText("Gammamon") ||
  55. cardSource.EqualsTraits("Hero"));
  56. }
  57. bool CanSelectPermanentCondition(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  60. CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  61. CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  70. card.Owner.HandCards.Count >= 1;
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  75. {
  76. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  77. {
  78. List<CardSource> selectedCards = new List<CardSource>();
  79. int maxCount = 1;
  80. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  81. selectHandEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. selectCardCoroutine: SelectCardCoroutine,
  91. afterSelectCardCoroutine: null,
  92. mode: SelectHandEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  95. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  96. yield return StartCoroutine(selectHandEffect.Activate());
  97. IEnumerator SelectCardCoroutine(CardSource cardSource)
  98. {
  99. selectedCards.Add(cardSource);
  100. yield return null;
  101. }
  102. if (selectedCards.Count >= 1)
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  105. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectPermanentCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: null,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Destroy,
  118. cardEffect: activateClass);
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. }
  121. }
  122. }
  123. }
  124. }
  125. #endregion
  126. #region When Attacking
  127. if (timing == EffectTiming.OnAllyAttack)
  128. {
  129. ActivateClass activateClass = new ActivateClass();
  130. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to Delete Digimon", CanUseCondition, card);
  131. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  132. cardEffects.Add(activateClass);
  133. string EffectDiscription()
  134. {
  135. return "[When Attacking] By placing 1 Digimon card with [Gammamon] in its text or the [Hero] trait from your hand as this Digimon's bottom digivolution card, delete 1 of your opponent's lowest DP Digimon.";
  136. }
  137. bool CanSelectCardCondition(CardSource cardSource)
  138. {
  139. return cardSource.IsDigimon &&
  140. (cardSource.HasText("Gammamon") ||
  141. cardSource.EqualsTraits("Hero"));
  142. }
  143. bool CanSelectPermanentCondition(Permanent permanent)
  144. {
  145. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  146. CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  147. CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  148. }
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  152. }
  153. bool CanActivateCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  156. card.Owner.HandCards.Count >= 1;
  157. }
  158. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  161. {
  162. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  163. {
  164. List<CardSource> selectedCards = new List<CardSource>();
  165. int maxCount = 1;
  166. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  167. selectHandEffect.SetUp(
  168. selectPlayer: card.Owner,
  169. canTargetCondition: CanSelectCardCondition,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: null,
  172. maxCount: maxCount,
  173. canNoSelect: true,
  174. canEndNotMax: false,
  175. isShowOpponent: true,
  176. selectCardCoroutine: SelectCardCoroutine,
  177. afterSelectCardCoroutine: null,
  178. mode: SelectHandEffect.Mode.Custom,
  179. cardEffect: activateClass);
  180. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  181. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  182. yield return StartCoroutine(selectHandEffect.Activate());
  183. IEnumerator SelectCardCoroutine(CardSource cardSource)
  184. {
  185. selectedCards.Add(cardSource);
  186. yield return null;
  187. }
  188. if (selectedCards.Count >= 1)
  189. {
  190. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  191. 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: null,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Destroy,
  204. cardEffect: activateClass);
  205. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  206. }
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. return cardEffects;
  213. }
  214. }
  215. }