using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace DCGO.CardEffects.BT13 { public class BT13_007 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { bool Condition() { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { return true; } return false; } cardEffects.Add(CardEffectFactory.CanNotDigivolveStaticEffect( permanentCondition: PermanentCondition, cardCondition: null, isInheritedEffect: false, card: card, condition: Condition, effectName: "Your Digimon can't digivolve") ); } ActivateClass activateClass2 = new ActivateClass(); activateClass2.SetUpICardEffect("Reduce play cost", CanUseCondition2, card); activateClass2.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine2, 1, true, EffectDiscription2()); activateClass2.SetHashString("Reduce_BT13_007"); string EffectDiscription2() { return "[Breeding][Your Turn][Once Per Turn] When a [Royal Knight] trait Digimon card would be played, you may reduce the play cost by 4. Further reduce it by 1 for each of this Digimon's digivolution cards."; } bool CardCondition(CardSource cardSource) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.HasRoyalKnightTraits) { return true; } } } return false; } bool CanUseCondition2(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition)) { return true; } } } return false; } bool CanActivateCondition2(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { int reduceCount = card.PermanentOfThisCard().DigivolutionCards.Count + 4; if (reduceCount >= 1) { PlayCardClass playCardClass = CardEffectCommons.GetPlayCardClassFromHashtable(hashtable); if (playCardClass != null) { if (playCardClass.PayCost) { return true; } } } } return false; } IEnumerator ActivateCoroutine2(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { int reduceCount = card.PermanentOfThisCard().DigivolutionCards.Count + 4; if (reduceCount >= 1) { ContinuousController.instance.PlaySE(GManager.instance.GetComponent().BuffSE); ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect($"Play Cost -{reduceCount}", CanUseCondition1, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true); card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => changeCostClass); yield return new WaitForSeconds(0.4f); 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 -= reduceCount; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents == null) { return true; } else { if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0) { return true; } } return false; } bool CardSourceCondition(CardSource cardSource) { CardSource Card = CardEffectCommons.GetCardFromHashtable(_hashtable); if (Card != null) { if (cardSource == Card) { return true; } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } } } if (timing == EffectTiming.BeforePayCost) { cardEffects.Add(activateClass2); } if (timing == EffectTiming.None) { ChangeCostClass changeCostClass = new ChangeCostClass(); changeCostClass.SetUpICardEffect("Play Cost -", CanUseCondition, card); changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => true, isChangePayingCost: () => true); changeCostClass.SetNotShowUI(true); cardEffects.Add(changeCostClass); bool CanUseCondition(Hashtable hashtable) { if (!card.Owner.isYou && GManager.instance.IsAI) { return false; } if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { int reduceCount = card.PermanentOfThisCard().DigivolutionCards.Count + 4; if (reduceCount >= 1) { if (activateClass2 != null) { if (!card.cEntity_EffectController.isOverMaxCountPerTurn(activateClass2, activateClass2.MaxCountPerTurn)) { return true; } } } } } return false; } int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List targetPermanents) { if (CardSourceCondition(cardSource)) { if (RootCondition(root)) { if (PermanentsCondition(targetPermanents)) { int reduceCount = card.PermanentOfThisCard().DigivolutionCards.Count + 4; Cost -= reduceCount; } } } return Cost; } bool PermanentsCondition(List targetPermanents) { if (targetPermanents == null) { return true; } else { if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0) { return true; } } return false; } bool CardSourceCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasRoyalKnightTraits) { return true; } } return false; } bool RootCondition(SelectCardEffect.Root root) { return true; } bool isUpDown() { return true; } } if (timing == EffectTiming.OnStartMainPhase) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal the top card of your Digi - Egg deck and place your Digimon under this Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Breeding][Start of Your Main Phase] Reveal the top card of your Digi-Egg deck, then place that card and all of your [Royal Knight] trait Digimon as this Digimon as its bottom digivolution cards."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.HasRoyalKnightTraits) { if (!permanent.TopCard.CanNotBeAffected(activateClass)) { if (!permanent.IsToken) { return true; } } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (card.Owner.DigitamaLibraryCards.Count >= 1) { return true; } if (!card.PermanentOfThisCard().IsToken) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { CardSource topCard = null; if (card.Owner.DigitamaLibraryCards.Count >= 1) { topCard = card.Owner.DigitamaLibraryCards[0]; yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect(new List() { topCard }, "Revealed Card", true, true)); } if (!card.PermanentOfThisCard().IsToken) { List selectedCards = new List(); if (topCard != null) { selectedCards.Add(topCard); } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons()) { if (CanSelectPermanentCondition(permanent)) { selectedCards.Add(permanent.TopCard); } } } if (selectedCards.Count >= 1) { List digivolutionCards = new List(); if (selectedCards.Count == 1) { foreach (CardSource cardSource in selectedCards) { digivolutionCards.Add(cardSource); } } else { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); List skillInfos = new List(); foreach (CardSource cardSource in selectedCards) { ICardEffect cardEffect = new ChangeBaseDPClass(); cardEffect.SetUpICardEffect(" ", null, cardSource); skillInfos.Add(new SkillInfo(cardEffect, null, EffectTiming.None)); } selectCardEffect.SetUp( canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine1, message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).", maxCount: selectedCards.Count, canEndNotMax: false, isShowOpponent: false, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: selectedCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards"); selectCardEffect.SetUpSkillInfos(skillInfos); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine1(List cardSources) { foreach (CardSource cardSource in cardSources) { digivolutionCards.Add(cardSource); } yield return null; } } if (CardEffectCommons.IsExistOnBreedingArea(card)) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(digivolutionCards, activateClass)); } } } } } } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetIsInheritedEffect(true); activateClass.SetHashString("Memory+1_BT13_007"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Breeding][Your Turn][Once Per Turn] When an Option card with the [Royal Knight] trait is placed in the battle area, gain 1 memory."; } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (permanent.TopCard.IsOption) { if (permanent.TopCard.HasRoyalKnightTraits) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBreedingArea(card)) { if (card.Owner.CanAddMemory(activateClass)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); } } return cardEffects; } } }