using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT16 { public class BT16_010 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); # region Alternate Digivolution Requirement if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard.ContainsTraits("SoC")) { if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4) return true; } return false; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Retaliation if (timing == EffectTiming.OnDestroyedAnyone) { cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region End of Opponent's Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Opponent's Turn] By deleting this Digimon, delete one of your opponent's Digimon with the lowest DP."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsOpponentTurn(card)) { return true; } return false; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy)) { if (permanent.IsDigimon) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass( new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); List deleteTargetPermanents = new List(); if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator AfterSelectPermanentCoroutine(List permanents) { foreach (Permanent permanent in permanents) { deleteTargetPermanents.Add(permanent); } yield return null; } } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess)); IEnumerator FailureProcess() { if (CardEffectCommons.IsExistOnBattleArea(card)) { Permanent selectedPermanent = card.PermanentOfThisCard(); yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List() { selectedPermanent }, activateClass).Unsuspend()); } } } } #endregion #region On Deletion if (timing == EffectTiming.OnDestroyedAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play Digimon or Tamer.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Deletion] You may play 1 [Loogamon] or [Eiji Nagasumi] from your trash without paying the cost"; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.CardNames.Contains("Loogamon") || cardSource.CardNames.Contains("Eiji Nagasumi") || cardSource.CardNames.Contains("EijiNagasumi")) { return true; } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.CanActivateOnDeletion(card, activateClass); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition)); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true)); } } } #endregion return cardEffects; } } }