| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- using DG.Tweening.Core.Easing;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine.TextCore.Text;
- namespace DCGO.CardEffects.BT20
- {
- public class BT20_013 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Main Once Per Turn
- if (timing == EffectTiming.OnDeclaration)
- {
-
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play a Digimon with the cost reduced by 2", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
- activateClass.SetHashString("PlayCost_BT20_013");
- cardEffects.Add(activateClass);
- string EffectDiscription ()
- {
- return "[Main] [Once Per Turn] You may play 1 Digimon card with [Sistermon] or [Gankoomon] in its name from you hand with the play cost reduced by 2.";
- }
- bool CanUseCondition (Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
- {
- return true;
- }
- }
- return false;
- }
- bool CanSelectCardCondition (CardSource cardSource)
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
- {
- if (cardSource.ContainsCardName("Sistermon") || cardSource.ContainsCardName("Gankoomon"))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine (Hashtable _hashtable)
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new SelectionElement<bool>(message: $"Play Card", value : true, spriteIndex: 0),
- new SelectionElement<bool>(message: $"Not Play Card", value : false, spriteIndex: 1),
- };
- string selectPlayerMessage = "Will you play a card from your hand?";
- string notSelectPlayerMessage = "The opponent is deciding to play a card from their hand.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
- bool isPlaying = GManager.instance.userSelectionManager.SelectedBoolValue;
- if (isPlaying)
- {
- #region reduce play cost
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition1, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
- Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
- card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
- ICardEffect GetCardEffect(EffectTiming _timing)
- {
- if (_timing == EffectTiming.None)
- {
- return changeCostClass;
- }
- return null;
- }
- 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 -= 2;
- }
- }
- }
- return Cost;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- if (targetPermanents == null)
- {
- return true;
- }
- else
- {
- if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
- {
- return true;
- }
- }
- return false;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- if (CanSelectCardCondition(cardSource))
- {
- return true;
- }
- return false;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool isUpDown()
- {
- return true;
- }
- #endregion
- if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: selectedCards,
- activateClass: activateClass,
- payCost: true,
- isTapped: false,
- root: SelectCardEffect.Root.Hand,
- activateETB: true));
- }
- #region Remove Cost effect after use
- card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
- #endregion
- }
- }
- }
- #endregion
- #region ESS
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- return true;
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
- permanentCondition: PermanentCondition,
- changeValue: 1000,
- isInheritedEffect: true,
- card: card,
- condition: Condition,
- effectName: () => "Your Digimon gain DP +1000"));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|