using System.Collections; using System.Collections.Generic; namespace DCGO.CardEffects.BT20 { public class BT20_032 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alt Digivolve Cost if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Pulsemon") || (targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasSeekersTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Add top security to hand, Recovery +1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] If you have 3 or more security cards, you may add your top security card to the hand. Then, if you have 2 or fewer security cards, ."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if(card.Owner.SecurityCards.Count >= 3) { List> selectionElements = new List>() { new SelectionElement(message: $"Yes", value : true, spriteIndex: 0), new SelectionElement(message: $"No", value : false, spriteIndex: 1), }; string selectPlayerMessage = "Will you add your top security card to hand?"; string notSelectPlayerMessage = "The opponent is choosing whether or not to add their top security card to hand."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool willAdd = GManager.instance.userSelectionManager.SelectedBoolValue; if (willAdd) { CardSource topCard = card.Owner.SecurityCards[0]; yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List() { topCard }, false, activateClass)); yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity( player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity()); } } if(card.Owner.SecurityCards.Count <= 2) { yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery()); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Add top security to hand, Recovery +1", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] If you have 3 or more security cards, you may add your top security card to the hand. Then, if you have 2 or fewer security cards, ."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (card.Owner.SecurityCards.Count >= 3) { List> selectionElements = new List>() { new SelectionElement(message: $"Yes", value : true, spriteIndex: 0), new SelectionElement(message: $"No", value : false, spriteIndex: 1), }; string selectPlayerMessage = "Will you add your top security card to hand?"; string notSelectPlayerMessage = "The opponent is choosing whether or not to add their top security card to hand."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool willAdd = GManager.instance.userSelectionManager.SelectedBoolValue; if (willAdd) { CardSource topCard = card.Owner.SecurityCards[0]; yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List() { topCard }, false, activateClass)); yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity( player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity()); } } if (card.Owner.SecurityCards.Count <= 2) { yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery()); } } } #endregion #region ESS if (timing == EffectTiming.OnEndBattle) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Gain 1 memory", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription()); activateClass.SetHashString("Gain1_BT20-032"); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] [Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, gain 1 memory."; } bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card); bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card); bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return true; } return false; } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass)); } } #endregion return cardEffects; } } }