using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.EX4 { public class EX4_030 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass(); changeCardNamesClass.SetUpICardEffect("Also treated as having [Sakuyamon] in its name", 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("Sakuyamon_EX4_030"); } return CardNames; } } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 Option from hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] You may use an Option card with a cost of 5 or less in your hand without paying the cost."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsOption) { if (cardSource.HasUseCost) { if (cardSource.GetCostItself <= 5) { if (!cardSource.CanNotPlayThisOption) { return true; } } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.HandCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { List selectedCards = new List(); if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1) { int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage( "Select 1 option card to use.", "The opponent is selecting 1 option card to use."); selectHandEffect.SetUpCustomMessage_ShowCard("Used Card"); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } } yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.PlayOptionCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, root: SelectCardEffect.Root.Hand ) ); } } if (timing == EffectTiming.OnUseOption) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 digivolution card", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("PlayDigivolutionCard_EX4_030"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn][Once Per Turn] When you use an Option card with a cost of 2 or more, you may play 1 [Taomon] or 1 level 4 or lower yellow or blue Digimon card from this Digimon's digivolution cards without paying the cost."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { if (cardSource.CardNames.Contains("Taomon")) { return true; } if (cardSource.HasLevel && cardSource.Level <= 4) { if (cardSource.HasCardColor(CardColor.Blue)) { return true; } if (cardSource.HasCardColor(CardColor.Yellow)) { return true; } } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { Permanent selectedPermanent = card.PermanentOfThisCard(); if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1) { int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.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 digivolution card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: selectedPermanent.DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play."); 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.DigivolutionCards, activateETB: true)); } } } return cardEffects; } } }