using System; using System.Collections; using System.Collections.Generic; // Big Bang Punch! namespace DCGO.CardEffects.BT23 { public class BT23_093 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Ignore Color Requirement if (timing == EffectTiming.None) { IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass(); ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card); ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition); cardEffects.Add(ignoreColorConditionClass); bool HasAppmonTrait(Permanent permanent) { if (CardEffectCommons.IsOwnerPermanent(permanent, card)) { if (permanent.TopCard.EqualsTraits("Appmon")) { if (permanent.IsDigimon || permanent.IsTamer) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true); } bool CardCondition(CardSource cardSource) { return cardSource == card; } } #endregion #region Main if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] (Draw 1 card from your deck.) Then, place this card in the battle area."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw()); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass)); } } #endregion #region All Turns if (timing == EffectTiming.OnTappedAnyone) { List suspendedPermaments = new List(); ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Link 1 [Appmon] trait digimon from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When any of your [Appmon] trait Digimon suspend , You may link 1 [Appmon] trait Digimon card from your hand to 1 of those Digimon without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsYourAppmon); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanDeclareOptionDelayEffect(card); } bool IsYourAppmon(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.HasAppmonTraits) { suspendedPermaments.Add(permanent); return true; } } return false; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && suspendedPermaments.Contains(permanent); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermament = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermament = permanent; yield return null; } selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain link", "The opponent is selecting 1 Digimon that will gain link"); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); bool CanSelectCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasAppmonTraits && cardSource.CanLinkToTargetPermanent(selectedPermament, false); } if (selectedPermament != null && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)) { CardSource selectedCard = null; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition)); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine1, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); IEnumerator SelectCardCoroutine1(CardSource cardSource) { selectedCard = cardSource; yield return null; } selectHandEffect.SetUpCustomMessage("Select 1 digimon to link.", "The opponent is selecting 1 digimon to link."); selectHandEffect.SetUpCustomMessage_ShowCard("Selected card"); yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate()); if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(selectedPermament.AddLinkCard( addedLinkCard: selectedCard, cardEffect: activateClass)); } } } } } #endregion #region Security if (timing == EffectTiming.SecuritySkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("place in battle area", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription()); activateClass.SetIsSecurityEffect(true); cardEffects.Add(activateClass); string EffectDescription() { return "[Security] place this card in the battle area."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass)); } } #endregion return cardEffects; } } }