BT10_109.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_109 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.None)
  16. {
  17. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  18. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  19. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  20. cardEffects.Add(ignoreColorConditionClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. if (card.Owner.GetBattleAreaPermanents().Count((permanet) => permanet.IsTamer) >= 1)
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. bool CardCondition(CardSource cardSource)
  30. {
  31. if (cardSource == card)
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. }
  38. if (timing == EffectTiming.OptionSkill)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  42. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[Main] 1 of your Digimon gets +3000 DP until the end of your opponent's turn.";
  47. }
  48. bool CanSelectPermanentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +3000.", "The opponent is selecting 1 Digimon that will get DP +3000.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  79. }
  80. }
  81. }
  82. }
  83. if (timing == EffectTiming.SecuritySkill)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect($"Memory +1 and add this card to hand", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  88. activateClass.SetIsSecurityEffect(true);
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[Security] Gain 1 memory and add this card to its owner's hand.";
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. if (card.Owner.CanAddMemory(activateClass))
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  103. }
  104. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  105. }
  106. }
  107. return cardEffects;
  108. }
  109. }
  110. }