BT16_014.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_014 : 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. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Goldramon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Raid
  22. if (timing == EffectTiming.OnAllyAttack)
  23. {
  24. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region All Turns
  28. if (timing == EffectTiming.None)
  29. {
  30. AddSkillClass addSkillClass = new AddSkillClass();
  31. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Goldramon] in digivolution cards", CanUseCondition, card);
  32. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  33. cardEffects.Add(addSkillClass);
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card);
  37. }
  38. bool PermanentCondition(Permanent permanent)
  39. {
  40. return permanent == card.PermanentOfThisCard();
  41. }
  42. bool CardSourceCondition(CardSource cardSource)
  43. {
  44. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  45. {
  46. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  54. {
  55. if (CardSourceCondition(cardSource))
  56. {
  57. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  58. {
  59. if (cardSource1.CardNames.Contains("Goldramon"))
  60. {
  61. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  62. {
  63. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  64. {
  65. cardEffects.Add(cardEffect);
  66. }
  67. }
  68. }
  69. }
  70. }
  71. return cardEffects;
  72. }
  73. }
  74. #endregion
  75. #region When Digivolving || When Attacking
  76. if (timing == EffectTiming.OnEnterFieldAnyone || timing == EffectTiming.OnAllyAttack)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Play 1 [God Flame] or Option with the [Four Great Dragons] trait from hand", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[When Digivolving] [When Attacking] You may use 1 [God Flame] or 1 Option card with the [Four Great Dragons] trait from your hand without paying its memory cost.";
  85. }
  86. bool CanSelectCardCondition1(CardSource cardSource)
  87. {
  88. if (cardSource.IsOption)
  89. {
  90. if (cardSource.EqualsCardName("God Flame") || cardSource.EqualsTraits("Four Great Dragons"))
  91. {
  92. if (!cardSource.CanNotPlayThisOption)
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) || CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. return true;
  109. }
  110. return false;
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  113. {
  114. if (card.Owner.HandCards.Count(CanSelectCardCondition1) >= 1)
  115. {
  116. List<CardSource> selectedCards = new List<CardSource>();
  117. int maxCount = 1;
  118. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  119. selectHandEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectCardCondition1,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: true,
  126. canEndNotMax: false,
  127. isShowOpponent: true,
  128. selectCardCoroutine: SelectCardCoroutine,
  129. afterSelectCardCoroutine: null,
  130. mode: SelectHandEffect.Mode.Custom,
  131. cardEffect: activateClass);
  132. selectHandEffect.SetUpCustomMessage(
  133. "Select 1 option card to use.",
  134. "The opponent is selecting 1 option card to use.");
  135. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  136. yield return StartCoroutine(selectHandEffect.Activate());
  137. IEnumerator SelectCardCoroutine(CardSource cardSource)
  138. {
  139. selectedCards.Add(cardSource);
  140. yield return null;
  141. }
  142. yield return ContinuousController.instance.StartCoroutine(
  143. CardEffectCommons.PlayOptionCards(
  144. cardSources: selectedCards,
  145. activateClass: activateClass,
  146. payCost: false,
  147. root: SelectCardEffect.Root.Hand));
  148. }
  149. }
  150. }
  151. #endregion
  152. return cardEffects;
  153. }
  154. }
  155. }