RB1_015.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class RB1_015 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.ContainsCardName("Gammamon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Trash digivolution cards and opponent's 1 Digimon can't attack", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Trash the top 3 digivolution cards of 1 of your opponent's Digimon with DP less than or equal to this Digimon's DP. Then, 1 of your opponent's Digimon with no digivolution cards can't attack until the end of their turn.";
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (permanent.DP <= card.PermanentOfThisCard().DP)
  38. {
  39. if (permanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanSelectPermanentCondition1(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (permanent.HasNoDigivolutionCards)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. return true;
  70. }
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  81. {
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. Permanent selectedPermanent = permanent;
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  102. }
  103. }
  104. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  105. {
  106. int maxCount = 1;
  107. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  108. selectPermanentEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: CanSelectPermanentCondition1,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: false,
  115. canEndNotMax: false,
  116. selectPermanentCoroutine: SelectPermanentCoroutine,
  117. afterSelectPermanentCoroutine: null,
  118. mode: SelectPermanentEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  123. {
  124. Permanent selectedPermanent = permanent;
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  126. }
  127. }
  128. }
  129. }
  130. if (timing == EffectTiming.None)
  131. {
  132. AddSkillClass addSkillClass = new AddSkillClass();
  133. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Gammamon] in digivolution cards", CanUseCondition, card);
  134. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  135. cardEffects.Add(addSkillClass);
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleArea(card);
  139. }
  140. bool PermanentCondition(Permanent permanent)
  141. {
  142. return permanent == card.PermanentOfThisCard();
  143. }
  144. bool CardSourceCondition(CardSource cardSource)
  145. {
  146. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  147. {
  148. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  156. {
  157. if (CardSourceCondition(cardSource))
  158. {
  159. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  160. {
  161. if (cardSource1.ContainsCardName("Gammamon"))
  162. {
  163. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  164. {
  165. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  166. {
  167. cardEffects.Add(cardEffect);
  168. }
  169. }
  170. }
  171. }
  172. }
  173. return cardEffects;
  174. }
  175. }
  176. if (timing == EffectTiming.None)
  177. {
  178. AddSkillClass addSkillClass = new AddSkillClass();
  179. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Gammamon] in digivolution cards", CanUseCondition, card);
  180. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  181. addSkillClass.SetIsInheritedEffect(true);
  182. cardEffects.Add(addSkillClass);
  183. bool CanUseCondition(Hashtable hashtable)
  184. {
  185. return CardEffectCommons.IsExistOnBattleArea(card);
  186. }
  187. bool PermanentCondition(Permanent permanent)
  188. {
  189. return permanent == card.PermanentOfThisCard();
  190. }
  191. bool CardSourceCondition(CardSource cardSource)
  192. {
  193. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  194. {
  195. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  203. {
  204. if (CardSourceCondition(cardSource))
  205. {
  206. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  207. {
  208. if (cardSource1.ContainsCardName("Gammamon"))
  209. {
  210. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  211. {
  212. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  213. {
  214. cardEffects.Add(cardEffect);
  215. }
  216. }
  217. }
  218. }
  219. }
  220. return cardEffects;
  221. }
  222. }
  223. return cardEffects;
  224. }
  225. }