EX12_014.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Canoweissmon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_014 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasText("Gammamon")
  17. || targetPermanent.TopCard.EqualsTraits("VB");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null,
  25. level: 4)
  26. );
  27. }
  28. #endregion
  29. #region Decode
  30. if (timing == EffectTiming.WhenRemoveField)
  31. {
  32. bool SourceCondition(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon
  35. && cardSource.HasLevel
  36. && cardSource.Level <= 4
  37. && (cardSource.HasText("Gammamon")
  38. || cardSource.EqualsTraits("VB"));
  39. }
  40. string[] decodeStrings = { "(Lv.4 or lower w/[Gammamon] in text or w/[VB] trait)", "Level 4 or lower Digimon card with [Gammamon] in text or [VB] Trait" };
  41. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  42. }
  43. #endregion
  44. #region Shared OP/WD
  45. string SharedEffectName = "May place 1 lvl 5 or lower [Gammamon] in text or [VB] trait from hand or trash under, then 1 of your Digimon may attack";
  46. CardEffectFactory.ActivateClassesForSharedEffects
  47. (ref cardEffects, timing, card,
  48. SharedEffectName,
  49. SharedActivateCoroutine,
  50. SharedEffectDescription,
  51. optional: false,
  52. onPlay: true,
  53. whenDigivolving: true);
  54. string SharedEffectDescription(string tag)
  55. {
  56. return $"[{tag}] You may place 1 level 5 or lower Digimon card with [Gammamon] in its text or the [VB] trait from your hand or trash as this Digimon's bottom digivolution card. Then, 1 of your Digimon may attack.";
  57. }
  58. bool CanSelectCardCondition(CardSource cardSource)
  59. {
  60. return cardSource.IsDigimon
  61. && cardSource.HasLevel
  62. && cardSource.Level <= 5
  63. && (cardSource.HasText("Gammamon")
  64. || cardSource.EqualsTraits("VB"));
  65. }
  66. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  67. {
  68. #region May place under
  69. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  70. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  71. if (canSelectHand || canSelectTrash)
  72. {
  73. #region Setup Location Selection
  74. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  75. if (canSelectHand)
  76. {
  77. selectionElements.Add(new(message: $"From hand", value: 1, spriteIndex: 0));
  78. }
  79. if (canSelectTrash)
  80. {
  81. selectionElements.Add(new(message: $"From trash", value: 2, spriteIndex: 0));
  82. }
  83. selectionElements.Add(new(message: $"Do not select", value: 3, spriteIndex: 1));
  84. string selectPlayerMessage = "From which area do you select a card?";
  85. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  86. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  87. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  88. #endregion
  89. bool doSelect = GManager.instance.userSelectionManager.SelectedIntValue != 3;
  90. bool fromHand = GManager.instance.userSelectionManager.SelectedIntValue == 1;
  91. if (doSelect)
  92. {
  93. #region Hand/Trash Card Selection
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. if (fromHand)
  96. {
  97. SelectHandEffect selectHandEffect2 = GManager.instance.GetComponent<SelectHandEffect>();
  98. selectHandEffect2.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectCardCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: 1,
  104. canNoSelect: true,
  105. canEndNotMax: false,
  106. isShowOpponent: true,
  107. selectCardCoroutine: SelectCardCoroutine,
  108. afterSelectCardCoroutine: null,
  109. mode: SelectHandEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. yield return StartCoroutine(selectHandEffect2.Activate());
  112. }
  113. else
  114. {
  115. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  116. selectCardEffect.SetUp(
  117. canTargetCondition: CanSelectCardCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. canNoSelect: () => true,
  121. selectCardCoroutine: SelectCardCoroutine,
  122. afterSelectCardCoroutine: null,
  123. message: "Select 1 card to play.",
  124. maxCount: 1,
  125. canEndNotMax: false,
  126. isShowOpponent: true,
  127. mode: SelectCardEffect.Mode.Custom,
  128. root: SelectCardEffect.Root.Trash,
  129. customRootCardList: null,
  130. canLookReverseCard: true,
  131. selectPlayer: card.Owner,
  132. cardEffect: activateClass);
  133. yield return StartCoroutine(selectCardEffect.Activate());
  134. }
  135. IEnumerator SelectCardCoroutine(CardSource cardSource)
  136. {
  137. selectedCards.Add(cardSource);
  138. yield return null;
  139. }
  140. #endregion
  141. if (selectedCards.Count > 0)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(
  144. card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  145. }
  146. }
  147. }
  148. #endregion
  149. #region May Attack
  150. bool IsYourDigimon(Permanent permanent)
  151. {
  152. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  153. && permanent.CanAttack(activateClass);
  154. }
  155. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsYourDigimon))
  156. {
  157. SelectPermanentEffect selectPermanentEffect =
  158. GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectPermanentEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: IsYourDigimon,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: 1,
  165. canNoSelect: true,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: null,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.Attack,
  170. cardEffect: activateClass);
  171. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  172. "The opponent is selecting 1 Digimon that will attack.");
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. }
  175. #endregion
  176. }
  177. #endregion
  178. #region Inherited
  179. if (timing == EffectTiming.WhenRemoveField)
  180. {
  181. bool SourceCondition(CardSource cardSource)
  182. {
  183. return cardSource.IsDigimon
  184. && cardSource.HasLevel
  185. && cardSource.Level <= 4
  186. && (cardSource.HasText("Gammamon")
  187. || cardSource.EqualsTraits("VB"));
  188. }
  189. string[] decodeStrings = { "(Lv.4 or lower w/[Gammamon] in text or w/[VB] trait)", "Level 4 or lower Digimon card with [Gammamon] in text or [VB] Trait" };
  190. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: true, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  191. }
  192. #endregion
  193. return cardEffects;
  194. }
  195. }
  196. }