using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT4_095 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return a Digi-egg card from trash to the bottom of Digi-Egg deck ", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Return 1 Digi-Egg card from your trash to the bottom of your Digi-Egg deck."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigiEgg; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition)); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to return to the bottom of your Digi-Egg deck.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotAddLog(); selectCardEffect.SetUpCustomMessage_ShowCard("Digiegg Deck Bottom Card"); selectCardEffect.SetUpCustomMessage( "Select 1 card to put on bottom of the deck.", "The opponent is selecting 1 card to put on bottom of the deck."); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards( new List() { cardSource })); } } } } if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolution Cost -1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetHashString("Digisorption-1_BT4_095"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn] When digivolving one of your Digimon into a Digimon card in your hand with , you may suspend this Tamer to reduce the digivolution cost by 1."; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card); } bool CardCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasDigiBurst) { if (CardEffectCommons.IsExistOnHand(cardSource)) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolve(hashtable, PermanentCondition, CardCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.CanActivateSuspendCostEffect(card)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass( new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Digivolution Cost -1", 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 targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { Cost -= 1; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents != null) { if (targetPermanents.Count(PermanentCondition) >= 1) { return true; } } return false; } bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard != null) { if (targetPermanent.TopCard.Owner == card.Owner) { if (targetPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(targetPermanent)) { return true; } } } return false; } bool CardSourceCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.HasDigiBurst) { return true; } } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } } if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } return cardEffects; } }