using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT20 { public class BT20_087 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Treated As if (timing == EffectTiming.None) { ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass(); changeCardNamesClass.SetUpICardEffect("[Rule] Name: Also treated as [Kota Domoto]/[Yuji Musya].", CanUseCondition, card); changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames); cardEffects.Add(changeCardNamesClass); bool CanUseCondition(Hashtable hashtable) { return true; } List changeCardNames(CardSource cardSource, List CardNames) { if (cardSource == card) { CardNames.Add("Kota Domoto"); CardNames.Add("Yuji Musya"); } return CardNames; } } #endregion #region Start of Your Turn if (timing == EffectTiming.OnStartTurn) { cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card)); } #endregion #region Your Turn if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve 1 of your Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() { return "[Your Turn] When one of your [Chronicle] trait Digimon attacks by suspending this Tamer, 1 of your Digimon on the field may digivolve into a level 6 or lower [Chronicle] trait Digimon card in the hand with the digivolution cost reduced by 1."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, AttackingPermanent); } bool AttackingPermanent(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.EqualsTraits("Chronicle"); } bool DigivolveFromPermanentCondition(Permanent permanent) { if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { return card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource => cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass)); } if(CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card)) { return card.Owner.HandCards.Where(DigivolveToCardCondition).Any(cardSource => cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass, isBreedingArea: true)); } return false; } bool DigivolveToCardCondition(CardSource cardSource) { return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 6 && cardSource.EqualsTraits("Chronicle"); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanActivateSuspendCostEffect(card) && CardEffectCommons.HasMatchConditionPermanent(DigivolveFromPermanentCondition,true); } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine( new SuspendPermanentsClass(new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap()); Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: DigivolveFromPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: selectedPermanent, cardCondition: DigivolveToCardCondition, payCost: true, reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null), fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } } } #endregion #region Security Effect if (timing == EffectTiming.SecuritySkill) { cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card)); } #endregion return cardEffects; } } }