BT15_043.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_043 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Suspend 1 Digimon so that your 1 Digimon gains DP +3000", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] By suspending 1 Digimon, 1 of your Digimon with the [Insectoid] trait gets +3000 DP until the end of your opponent's turn.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  25. {
  26. if (permanent.IsDigimon)
  27. {
  28. if (CardEffectCommons.CanActivateSuspendCostEffect(permanent.TopCard))
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectPermanentCondition1(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. if (permanent.TopCard.CardTraits.Contains("Insectoid"))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.IsOwnerTurn(card))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. Permanent selectedPermanent = null;
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: true,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: SelectPermanentCoroutine,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  91. {
  92. selectedPermanent = permanent;
  93. yield return null;
  94. }
  95. }
  96. if (selectedPermanent != null)
  97. {
  98. if (selectedPermanent.TopCard != null)
  99. {
  100. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  101. {
  102. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  103. {
  104. Permanent suspendTargetPermanent = selectedPermanent;
  105. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { suspendTargetPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  106. if (suspendTargetPermanent.TopCard != null)
  107. {
  108. if (suspendTargetPermanent.IsSuspended)
  109. {
  110. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  111. {
  112. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  113. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  114. selectPermanentEffect.SetUp(
  115. selectPlayer: card.Owner,
  116. canTargetCondition: CanSelectPermanentCondition1,
  117. canTargetCondition_ByPreSelecetedList: null,
  118. canEndSelectCondition: null,
  119. maxCount: maxCount,
  120. canNoSelect: false,
  121. canEndNotMax: false,
  122. selectPermanentCoroutine: SelectPermanentCoroutine,
  123. afterSelectPermanentCoroutine: null,
  124. mode: SelectPermanentEffect.Mode.Custom,
  125. cardEffect: activateClass);
  126. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: 3000, maxCount: maxCount));
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  131. targetPermanent: permanent,
  132. changeValue: 3000,
  133. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  134. activateClass: activateClass));
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. #region Inherited Effect
  147. if (timing == EffectTiming.OnEndBattle)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  152. activateClass.SetIsInheritedEffect(true);
  153. activateClass.SetHashString("Memory+1_BT15_043");
  154. cardEffects.Add(activateClass);
  155. string EffectDiscription()
  156. {
  157. return "[All Turns] [Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, gain 1 memory.";
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. if (CardEffectCommons.IsExistOnBattleArea(card))
  162. {
  163. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  164. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  165. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. bool CanActivateCondition(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.IsExistOnBattleArea(card))
  175. {
  176. return true;
  177. }
  178. return false;
  179. }
  180. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  181. {
  182. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  183. }
  184. }
  185. #endregion
  186. return cardEffects;
  187. }
  188. }
  189. }