EX2_022.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX2
  4. {
  5. public class EX2_022 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.None)
  11. {
  12. bool Condition()
  13. {
  14. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardNames.Contains("Shu-Chong Wong") || permanent.TopCard.CardNames.Contains("Shu-ChongWong")) && card.Owner.HandCards.Contains(card);
  15. }
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. if (CardEffectCommons.IsPermanentExistsOnBattleArea(targetPermanent))
  19. {
  20. if (targetPermanent.TopCard.CardNames.Contains("Lopmon"))
  21. {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: true, card: card, condition: Condition));
  28. }
  29. if (timing == EffectTiming.OnAllyAttack)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Trash the top card of your security to unsuspend this Digimon", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  34. activateClass.SetHashString("Unsuspend_EX2_022");
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[When Attacking][Once Per Turn] You may trash the top card of your security stack to unsuspend this Digimon.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.SecurityCards.Count >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  58. player: card.Owner,
  59. destroySecurityCount: 1,
  60. cardEffect: activateClass,
  61. fromTop: true).DestroySecurity());
  62. Permanent selectedPermanent = card.PermanentOfThisCard();
  63. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  64. }
  65. }
  66. return cardEffects;
  67. }
  68. }
  69. }