BT11_017.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_017 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. cardEffects.Add(CardEffectFactory.BlitzSelfEffect(isInheritedEffect: false, card: card, condition: null, isWhenDigivolving: true));
  18. }
  19. if (timing == EffectTiming.OnAttackTargetChanged)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Unsuspend this Digimon and gain Memory", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  24. activateClass.SetHashString("Unsuspend_BT11_017");
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[Your Turn][Once Per Turn] When one of your Digimon's attack targets is switched, unsuspend this Digimon, and gain 1 memory for each red Tamer you have in play.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)))
  35. {
  36. if (CardEffectCommons.IsOwnerTurn(card))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. Permanent selectedPermanent = card.PermanentOfThisCard();
  55. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  56. int plusMemory = card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer);
  57. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(plusMemory, activateClass));
  58. }
  59. }
  60. return cardEffects;
  61. }
  62. }
  63. }