using System; using System.Collections; using System.Collections.Generic; //Agunimon namespace DCGO.CardEffects.BT21 { public class BT21_013 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition - Tamer if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard.IsTamer) { return targetPermanent.TopCard.CardColors.Contains(CardColor.Red); } return false; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region Alternative Digivolution Condition - BurningGreymon if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { if (targetPermanent.TopCard.EqualsCardName("BurningGreymon")) { return true; } return false; } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place 1 [Hybrid] or [Hero] digimon under this or a red tamer", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() => "[When Digivolving] You may place 1 [Hybrid]/[Hero] trait Digimon card from your hand or trash as this Digimon's bottom digivolution card or under any of your red Tamers with inherited effects."; bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanent)) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectSourceCard) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectSourceCard)) { return true; } } } return false; } bool CanSelectSourceCard(CardSource source) { if (source.IsDigimon) { if (source.EqualsTraits("Hybrid") || source.EqualsTraits("Hero")) { return true; } } return false; } bool CanSelectPermanent(Permanent permanent) { if(CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent == card.PermanentOfThisCard()) { return true; } if (permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer && permanent.TopCard.HasInheritedEffect) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { Permanent selectedPermanent = null; CardSource selectedCard = null; int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanent)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanent, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectSourceCard); bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectSourceCard); if (canSelectHand || canSelectTrash) { if (canSelectHand && canSelectTrash) { List> selectionElements = new List>() { new SelectionElement(message: $"From hand", value : true, spriteIndex: 0), new SelectionElement(message: $"From trash", value : false, spriteIndex: 1), }; string selectPlayerMessage = "From which area do you select a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to select a card."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); } else { GManager.instance.userSelectionManager.SetBool(canSelectHand); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue; if (fromHand) { SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectSourceCard, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage( "Select 1 card to add as source.", "The opponent is selecting 1 card to add as source."); selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card"); yield return StartCoroutine(selectHandEffect.Activate()); } else { SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectSourceCard, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to add as source.", maxCount: 1, 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 add as source.", "The opponent is selecting 1 card to add as source."); selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); } IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCard = cardSource; yield return null; } yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List() { selectedCard }, activateClass)); } } } } #endregion #region When Attacking if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve into a [Hybrid]/[Hero] digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() => "[When Attacking] This Digimon may digivolve into a red [Hybrid]/[Hero] trait Digimon card in the hand with the digivolution cost reduced by 1."; bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.CanTriggerOnAttack(hashtable, card)) { return true; } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCard)) { return true; } } return false; } bool CanSelectCard(CardSource source) { if (source.IsDigimon) { if (source.EqualsTraits("Hybrid") || source.EqualsTraits("Hero")) { if (source.HasCardColor(CardColor.Red)) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: CanSelectCard, payCost: true, reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null), fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: true, activateClass: activateClass, successProcess: null)); } } #endregion #region ESS if (timing == EffectTiming.None) { bool Condition() { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } return false; } cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition)); } #endregion return cardEffects; } } }