| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- public class P_074 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.BeforePayCost)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Trash your Security to reduce digivolution cost", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- activateClass.SetHashString("TrashSecurity_P_074");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Your Turn] When this Digimon would digivolve into a card with [Shaman] or [Wizard] in its traits, you may trash up to 3 of your security cards. For each security card trashed with this effect, reduce the digivolution cost by 1.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- bool CardCondition(CardSource cardSource)
- {
- return cardSource.CardTraits.Contains("Shaman") || cardSource.CardTraits.Contains("Wizard");
- }
- if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolveOfCard(hashtable, CardCondition, card))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.SecurityCards.Count >= 1)
- {
- if (card.Owner.CanReduceSecurity())
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- int trashCount = 0;
- if (card.Owner.SecurityCards.Count >= 1 && card.Owner.CanReduceSecurity())
- {
- int maxCount = Math.Min(3, card.Owner.SecurityCards.Count);
- SelectCountEffect selectCountEffect = GManager.instance.GetComponent<SelectCountEffect>();
- selectCountEffect.SetUp(
- SelectPlayer: card.Owner,
- targetPermanent: null,
- MaxCount: maxCount,
- CanNoSelect: true,
- Message: "How many security cards will you trash?",
- Message_Enemy: "The opponent is choosing how many security cards to trash.",
- SelectCountCoroutine: SelectCountCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectCountEffect.Activate());
- IEnumerator SelectCountCoroutine(int count)
- {
- trashCount = count;
- yield return null;
- }
- }
- if (trashCount >= 1 && card.Owner.SecurityCards.Count >= 1)
- {
- int reduceCost = 0;
- if (card.Owner.SecurityCards.Count < trashCount)
- {
- trashCount = card.Owner.SecurityCards.Count;
- }
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner,
- destroySecurityCount: trashCount,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
- reduceCost = trashCount;
- ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect($"Digivolution Cost -{reduceCost}", CanUseCondition1, card);
- changeCostClass.SetUpChangeCostClass(
- changeCostFunc: ChangeCost,
- cardSourceCondition: CardSourceCondition,
- rootCondition: RootCondition,
- isUpDown: isUpDown,
- isCheckAvailability: () => false,
- isChangePayingCost: () => true);
- card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass);
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(_hashtable));
- bool CanUseCondition1(Hashtable hashtable)
- {
- return true;
- }
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource))
- {
- if (RootCondition(root))
- {
- if (PermanentsCondition(targetPermanents))
- {
- Cost -= reduceCost;
- }
- }
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- if (targetPermanents != null)
- {
- if (targetPermanents.Count(PermanentCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- bool PermanentCondition(Permanent targetPermanent)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (targetPermanent == card.PermanentOfThisCard())
- {
- return true;
- }
- }
- return false;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- if (cardSource.Owner == card.Owner)
- {
- return true;
- }
- return false;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- }
- }
- }
- if (timing == EffectTiming.None)
- {
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect($"Digivolution Cost -", CanUseCondition, card);
- changeCostClass.SetUpChangeCostClass(
- changeCostFunc: ChangeCost,
- cardSourceCondition: CardSourceCondition,
- rootCondition: RootCondition,
- isUpDown: isUpDown,
- isCheckAvailability: () => true,
- isChangePayingCost: () => true);
- changeCostClass.SetNotShowUI(true);
- cardEffects.Add(changeCostClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource))
- {
- if (RootCondition(root))
- {
- if (PermanentsCondition(targetPermanents))
- {
- int reduceCost = 3;
- if (card.Owner.SecurityCards.Count < reduceCost)
- {
- reduceCost = card.Owner.SecurityCards.Count;
- }
- Cost -= reduceCost;
- }
- }
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- if (targetPermanents != null)
- {
- if (targetPermanents.Count(PermanentCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- bool PermanentCondition(Permanent targetPermanent)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (targetPermanent == card.PermanentOfThisCard())
- {
- return true;
- }
- }
- return false;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- if (cardSource.CardTraits.Contains("Shaman"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("Wizard"))
- {
- return true;
- }
- return false;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- }
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("Unsuspend_P_074");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Attacking][Once Per Turn] If you have exactly 3 security cards, unsuspend this Digimon.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.SecurityCards.Count == 3)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- Permanent selectedPermanent = card.PermanentOfThisCard();
- yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
- new List<Permanent>() { selectedPermanent },
- activateClass).Unsuspend());
- }
- }
- return cardEffects;
- }
- }
|