BT12_072.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_072 : 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("Machinedramon") || targetPermanent.TopCard.CardNames.Contains("Chaosdramon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnStartMainPhase)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Place 1 card from trash under this Digimon's digivolution cards", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Start of Your Main Phase] Place 1 Digimon card with a [Cyborg] or [Machine] trait from your trash under this Digimon as its bottom digivolution card.";
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. if (cardSource.CardTraits.Contains("Cyborg") || cardSource.CardTraits.Contains("Machine"))
  32. {
  33. if (cardSource.IsDigimon)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.IsOwnerTurn(card))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (!card.PermanentOfThisCard().IsToken)
  56. {
  57. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleArea(card))
  68. {
  69. if (!card.PermanentOfThisCard().IsToken)
  70. {
  71. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  72. {
  73. List<CardSource> selectedCards = new List<CardSource>();
  74. int maxCount = 1;
  75. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  76. selectCardEffect.SetUp(
  77. canTargetCondition: CanSelectCardCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. canNoSelect: () => false,
  81. selectCardCoroutine: SelectCardCoroutine,
  82. afterSelectCardCoroutine: null,
  83. message: "Select 1 card to place at the bottom of digivolution cards.",
  84. maxCount: maxCount,
  85. canEndNotMax: false,
  86. isShowOpponent: true,
  87. mode: SelectCardEffect.Mode.Custom,
  88. root: SelectCardEffect.Root.Trash,
  89. customRootCardList: null,
  90. canLookReverseCard: true,
  91. selectPlayer: card.Owner,
  92. cardEffect: activateClass);
  93. selectCardEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  94. yield return StartCoroutine(selectCardEffect.Activate());
  95. IEnumerator SelectCardCoroutine(CardSource cardSource)
  96. {
  97. selectedCards.Add(cardSource);
  98. yield return null;
  99. }
  100. if (selectedCards.Count >= 1)
  101. {
  102. Permanent selectedPermanent = card.PermanentOfThisCard();
  103. if (selectedPermanent != null)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.None)
  114. {
  115. AddSkillClass addSkillClass = new AddSkillClass();
  116. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Machinedramon] and [Chaosdramon] in digivolution cards", CanUseCondition, card);
  117. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  118. cardEffects.Add(addSkillClass);
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleArea(card);
  122. }
  123. bool PermanentCondition(Permanent permanent)
  124. {
  125. return permanent == card.PermanentOfThisCard();
  126. }
  127. bool CardSourceCondition(CardSource cardSource)
  128. {
  129. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  130. {
  131. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  139. {
  140. if (CardSourceCondition(cardSource))
  141. {
  142. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  143. {
  144. if (!cardSource1.IsFlipped)
  145. {
  146. if (cardSource1.EqualsCardName("Machinedramon") || cardSource1.EqualsCardName("Chaosdramon"))
  147. {
  148. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  149. {
  150. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  151. {
  152. cardEffects.Add(cardEffect);
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. return cardEffects;
  160. }
  161. }
  162. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  163. {
  164. ActivateClass activateClass = new ActivateClass();
  165. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  166. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  167. activateClass.SetHashString("TrashSecuritu_BT12_072");
  168. cardEffects.Add(activateClass);
  169. string EffectDiscription()
  170. {
  171. return "[All Turns][Once Per Turn] If this Digimon is deleted, trash the top card of your opponent's security stack.";
  172. }
  173. bool CanUseCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.IsExistOnBattleArea(card))
  176. {
  177. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.IsExistOnBattleArea(card))
  187. {
  188. return true;
  189. }
  190. return false;
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  193. {
  194. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  195. player: card.Owner.Enemy,
  196. destroySecurityCount: 1,
  197. cardEffect: activateClass,
  198. fromTop: true).DestroySecurity());
  199. }
  200. }
  201. return cardEffects;
  202. }
  203. }
  204. }