using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT4_074 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return cards from trash to deck and Memory +2 for the returned cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Return up to 5 Digimon cards with [D-Brigade] in their types from your trash to the top of your deck in any order, and for each card you return this way, gain 2 memory."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.IsDigimon) { if (cardSource.Owner == card.Owner) { if (cardSource.CardTraits.Contains("D-Brigade")) { return true; } } } } return false; } 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(5, card.Owner.TrashCards.Count(CanSelectCardCondition)); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: CanEndSelectCondition, canNoSelect: () => true, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine1, message: "Select cards to add to the top your deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).", maxCount: maxCount, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotAddLog(); selectCardEffect.SetUpCustomMessage_ShowCard("Deck Top Cards"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); bool CanEndSelectCondition(List cardSources) { if (CardEffectCommons.HasNoElement(cardSources)) { return false; } return true; } IEnumerator AfterSelectCardCoroutine1(List cardSources) { selectedCards = cardSources.Clone(); yield return null; } if (selectedCards.Count >= 1) { selectedCards.Reverse(); yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(selectedCards)); yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2 * selectedCards.Count, activateClass)); } } } } return cardEffects; } }