EX11_024.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. // Cendrillmon
  7. public class EX11_024 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alliance
  13. if (timing == EffectTiming.OnAllyAttack)
  14. {
  15. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  16. }
  17. #endregion
  18. #region Overclock
  19. if (timing == EffectTiming.OnEndTurn)
  20. {
  21. cardEffects.Add(CardEffectFactory.OverclockSelfEffect(trait: "Puppet", isInheritedEffect: false, card: card,
  22. condition: null));
  23. }
  24. #endregion
  25. #region Shared Functions
  26. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  27. bool IsOpponentDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. #endregion
  29. #region Shared OP / WD - Play Digimon
  30. string PlayDigimonEffectName = "May Play level 4 or lower [Puppet] Digimon. May play familiar token per Opponent's Digimon.";
  31. string PlayDigimonEffectDescription(string tag) => $"[{tag}] You may play 1 level 4 or lower [Puppet] trait Digimon card from your hand without paying the cost. Then, you may play 1 [Familiar] Token for each of your opponent's Digimon. (Digimon/Yellow/3000 DP/[On Deletion] 1 of your opponent's Digimon gets -3000 DP for the turn.)";
  32. bool PlayDigimonCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon
  35. && cardSource.EqualsTraits("Puppet")
  36. && cardSource.HasLevel
  37. && cardSource.Level <= 4;
  38. }
  39. IEnumerator PlayDigimonActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOwnersHand(card, PlayDigimonCardCondition))
  42. {
  43. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  44. selectHandEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: PlayDigimonCardCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: 1,
  50. canNoSelect: true,
  51. canEndNotMax: false,
  52. isShowOpponent: true,
  53. selectCardCoroutine: SelectCardCoroutine,
  54. afterSelectCardCoroutine: null,
  55. mode: SelectHandEffect.Mode.Custom,
  56. cardEffect: activateClass);
  57. selectHandEffect.SetUpCustomMessage("Select 1 digimon to play", "The opponent is selecting 1 digimon to play");
  58. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  59. IEnumerator SelectCardCoroutine(CardSource selectedCard)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  62. new List<CardSource>() { selectedCard },
  63. activateClass: activateClass,
  64. payCost: false,
  65. isTapped: false,
  66. root: SelectCardEffect.Root.Hand,
  67. activateETB: true));
  68. }
  69. }
  70. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  71. {
  72. new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
  73. new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
  74. };
  75. string selectPlayerMessage1 = "Will you play Familiar Tokens?";
  76. string notSelectPlayerMessage1 = "The opponent is choosing if they will you play Familiar Tokens.";
  77. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  78. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  79. if(GManager.instance.userSelectionManager.SelectedBoolValue)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayFamiliarToken(
  82. activateClass,
  83. CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimonCondition)
  84. ));
  85. }
  86. }
  87. #endregion
  88. #region On Play - Play Digimon
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect(PlayDigimonEffectName, CanUseCondition, card);
  93. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => PlayDigimonActivateCoroutine(hash, activateClass), -1, false, PlayDigimonEffectDescription("On Play"));
  94. cardEffects.Add(activateClass);
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnPlay(hashtable, card) &&
  98. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  99. }
  100. }
  101. #endregion
  102. #region When Digivolving - Play Digimon
  103. if (timing == EffectTiming.OnEnterFieldAnyone)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect(PlayDigimonEffectName, CanUseCondition, card);
  107. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => PlayDigimonActivateCoroutine(hash, activateClass), -1, false, PlayDigimonEffectDescription("When Digivolving"));
  108. cardEffects.Add(activateClass);
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  112. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  113. }
  114. }
  115. #endregion
  116. #region Shared WD / WA - Minus DP
  117. string MinusDPEffectName = "Give 1 opponent's digimon -3k DP for each of your digimon.";
  118. string MinusDPEffectDescription(string tag) => $"[{tag}] To 1 of your opponent's Digimon, give -3000 DP for the turn for each of your Digimon.";
  119. IEnumerator MinusDPActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  120. {
  121. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimonCondition))
  122. {
  123. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: IsOpponentDigimonCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: 1,
  130. canNoSelect: false,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: SelectPermanentCoroutine,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Custom,
  135. cardEffect: activateClass);
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. int minusDP = -3000 * card.Owner.GetBattleAreaDigimons().Count;
  140. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  141. targetPermanent: permanent,
  142. changeValue: minusDP,
  143. effectDuration: EffectDuration.UntilEachTurnEnd,
  144. activateClass: activateClass));
  145. }
  146. }
  147. }
  148. #endregion
  149. #region When Digivolving - Minus DP
  150. if (timing == EffectTiming.OnEnterFieldAnyone)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect(MinusDPEffectName, CanUseCondition, card);
  154. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => MinusDPActivateCoroutine(hash, activateClass), -1, false, MinusDPEffectDescription("When Digivolving"));
  155. cardEffects.Add(activateClass);
  156. bool CanUseCondition(Hashtable hashtable)
  157. {
  158. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  159. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  160. }
  161. }
  162. #endregion
  163. #region When Attacking - Minus DP
  164. if (timing == EffectTiming.OnAllyAttack)
  165. {
  166. ActivateClass activateClass = new ActivateClass();
  167. activateClass.SetUpICardEffect(MinusDPEffectName, CanUseCondition, card);
  168. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => MinusDPActivateCoroutine(hash, activateClass), -1, false, MinusDPEffectDescription("When Attacking"));
  169. cardEffects.Add(activateClass);
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  173. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  174. }
  175. }
  176. #endregion
  177. return cardEffects;
  178. }
  179. }
  180. }