P_097.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 P_097 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place this Digimon under your Digimon's digivolution cards to reveal deck tops and to gain Memory +2", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] By placing this card under 1 of your other Digimon in play as its bottom digivolution card, reveal the top 3 cards of your deck. Place those cards at either the top or bottom of your deck in any order. Then, if you have a Digimon with the [Legend-Arms] trait in play, gain 2 memory.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent != card.PermanentOfThisCard())
  28. {
  29. if (!permanent.IsToken)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. bool added = false;
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. Permanent selectedPermanent = permanent;
  76. if (selectedPermanent != null)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), selectedPermanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. if (selectedPermanent.DigivolutionCards.Contains(card))
  82. {
  83. added = true;
  84. }
  85. }
  86. }
  87. }
  88. if (added)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  91. revealCount: 3,
  92. simplifiedSelectCardCondition:
  93. new SimplifiedSelectCardConditionClass(
  94. canTargetCondition: (cardSource) => false,
  95. message: "",
  96. mode: SelectCardEffect.Mode.Custom,
  97. maxCount: -1,
  98. selectCardCoroutine: null),
  99. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  100. activateClass: activateClass
  101. ));
  102. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardTraits.Contains("Legend-Arms")))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  105. }
  106. }
  107. }
  108. }
  109. }
  110. if (timing == EffectTiming.OnAllyAttack)
  111. {
  112. bool Condition()
  113. {
  114. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Black) || permanent.TopCard.CardTraits.Contains("Legend-Arms")))
  115. {
  116. return true;
  117. }
  118. return false;
  119. }
  120. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: true, card: card, condition: Condition));
  121. }
  122. return cardEffects;
  123. }
  124. }