| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- namespace DCGO.CardEffects.EX6
- {
- public class EX6_011 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
-
- #region Ace - Blast DNA Digivolve
-
- if (timing == EffectTiming.OnCounterTiming)
- {
- List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>
- {
- new("Durandamon"),
- new("BryweLudramon")
- };
- cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card,
- blastDNAConditions: blastDNAConditions, condition: null));
- }
-
- #endregion
-
- #region DNA Digivolution
-
- if (timing == EffectTiming.None)
- {
- AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
- addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
- addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
- addJogressConditionClass.SetNotShowUI(true);
- cardEffects.Add(addJogressConditionClass);
-
- bool CanUseCondition(Hashtable hashtable)
- {
- return true;
- }
-
- JogressCondition GetJogress(CardSource cardSource)
- {
- if (cardSource == card)
- {
- bool PermanentCondition1(Permanent permanent)
- {
- if (permanent != null)
- {
- if (permanent.TopCard != null)
- {
- if (permanent.TopCard.Owner == card.Owner)
- {
- if (permanent.IsDigimon)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
- card))
- {
- if (permanent.TopCard.CardColors.Contains(CardColor.Red))
- {
- if (permanent.Levels_ForJogress(card).Contains(6))
- {
- return true;
- }
- }
- }
- }
- }
- }
- }
-
- return false;
- }
-
- bool PermanentCondition2(Permanent permanent)
- {
- if (permanent != null)
- {
- if (permanent.TopCard != null)
- {
- if (permanent.TopCard.Owner == card.Owner)
- {
- if (permanent.IsDigimon)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
- card))
- {
- if (permanent.TopCard.CardColors.Contains(CardColor.Black))
- {
- if (permanent.Levels_ForJogress(card).Contains(6))
- {
- return true;
- }
- }
- }
- }
- }
- }
- }
-
- return false;
- }
-
- JogressConditionElement[] elements =
- {
- new(PermanentCondition1, "a level 6 Red Digimon"),
- new(PermanentCondition2, "a level 6 Black Digimon")
- };
-
- JogressCondition jogressCondition = new JogressCondition(elements, 0);
-
- return jogressCondition;
- }
-
- return null;
- }
- }
-
- #endregion
-
- #region Raid
-
- if (timing == EffectTiming.OnAllyAttack)
- {
- cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card,
- condition: null));
- }
-
- #endregion
-
- #region Reboot
-
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(
- isInheritedEffect: false,
- card: card,
- condition: null));
- }
-
- #endregion
-
- #region Shared On Play / When Digivolving
-
- bool CanActivateSharedCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
-
- bool CanUseImmunitySharedCondition(Hashtable hashtableI)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleArea(card.PermanentOfThisCard());
- }
-
- bool CardImmunitySharedCondition(CardSource cardSource)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (cardSource == card.PermanentOfThisCard().TopCard)
- {
- return true;
- }
- }
-
- return false;
- }
-
- bool SkillImmunitySharedCondition(ICardEffect cardEffect)
- {
- if (cardEffect != null)
- {
- if (cardEffect.EffectSourceCard)
- {
- if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- bool IsEnemyPermanentShared(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
-
- #endregion
-
- #region On Play
-
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(
- "Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn.",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
- EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[On Play] Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn. Then, if DNA digivolving, all of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards) and delete 1 of their Digimon.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
-
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- // Trash Top of Opponent's Security Stack
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
-
- // This Digimon isn't affected by your opponent's effects until the end of their turn.
- CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
- canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects",
- CanUseImmunitySharedCondition, card);
- canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardImmunitySharedCondition,
- SkillCondition: SkillImmunitySharedCondition);
- card.PermanentOfThisCard().UntilOpponentTurnEndEffects.Add(_ => canNotAffectedClass);
-
-
- // if DNA Digivolving
- if (CardEffectCommons.IsJogress(hashtable))
- {
- // De-Digivolve all Opponent's Digimon
- List<Permanent> enemyPermanents = card.Owner.Enemy.GetBattleAreaDigimons();
-
- foreach (Permanent permanent in enemyPermanents)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new IDegeneration(permanent, 1, activateClass).Degeneration());
- }
-
- // Delete 1 Opponent's Digimon
- if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyPermanentShared))
- {
- int enemyCount = Math.Min(1,
- CardEffectCommons.MatchConditionPermanentCount(IsEnemyPermanentShared));
-
- SelectPermanentEffect selectEnemyEffect =
- GManager.instance.GetComponent<SelectPermanentEffect>();
-
- selectEnemyEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsEnemyPermanentShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: enemyCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectEnemyEffect.Activate());
- }
- }
- }
- }
-
- #endregion
-
- #region When Digivolving
-
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(
- "Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn.",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false,
- EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Digivolving] Trash the top card of your opponent's security stack and this Digimon isn't affected by your opponent's effects until the end of their turn. Then, if DNA digivolving, all of your opponent's Digimon (Trash the top card. You can't trash past level 3 cards) and delete 1 of their Digimon.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
-
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- // Trash Top of Opponent's Security Stack
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
-
- // This Digimon isn't affected by your opponent's effects until the end of their turn.
- CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
- canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effects",
- CanUseImmunitySharedCondition, card);
- canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardImmunitySharedCondition,
- SkillCondition: SkillImmunitySharedCondition);
- card.PermanentOfThisCard().UntilOpponentTurnEndEffects.Add(_ => canNotAffectedClass);
- // if DNA Digivolving
- if (CardEffectCommons.IsJogress(hashtable))
- {
- // De-Digivolve all Opponent's Digimon
- List<Permanent> enemyPermanents = card.Owner.Enemy.GetBattleAreaDigimons().ToList();
-
- foreach (Permanent permanent in enemyPermanents)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new IDegeneration(permanent, 1, activateClass).Degeneration());
- }
-
- // Delete 1 Opponent's Digimon
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsEnemyPermanentShared))
- {
- SelectPermanentEffect selectEnemyEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
- selectEnemyEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsEnemyPermanentShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectEnemyEffect.Activate());
- }
- }
- }
- }
-
- #endregion
-
- return cardEffects;
- }
- }
- }
|