| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- // Lamiamon
- namespace DCGO.CardEffects.BT24
- {
- public class BT24_016 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Hand Main
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 [Dimetromon] from trash under 1 [Elizamon], to digivolve for 3", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Hand] [Main] If you have [Owen Dreadnought], by placing 1 [Dimetromon] from your trash as any of your [Elizamon]'s bottom digivolution card, it digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnHand(card)
- && CardEffectCommons.IsOwnerTurn(card)
- && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwen)
- && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsElizamon)
- && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsDimetromon);
- }
- bool IsOwen(Permanent permanent)
- {
- return permanent.IsTamer && permanent.TopCard.EqualsCardName("Owen Dreadnought");
- }
- bool IsElizamon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
- permanent.TopCard.EqualsCardName("Elizamon");
- }
- bool IsDimetromon(CardSource source)
- {
- return source.IsDigimon && source.EqualsCardName("Dimetromon");
- }
- bool IsLamiamon(CardSource cardSource)
- {
- return CardEffectCommons.IsExistOnHand(cardSource) && cardSource == card;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwen))
- {
- Permanent Elizamon = null;
- CardSource Dimetromon = null;
- #region Select Dimetromon From Trash
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsDimetromon));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsDimetromon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 [Dimetromon] to add as digivolution source",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- Dimetromon = cardSource;
- yield return null;
- }
- selectCardEffect.SetUpCustomMessage("Select 1 [Dimetromon] to add as digivolution source.", "The opponent is selecting 1 [Dimetromon] to add as digivolution source.");
- yield return StartCoroutine(selectCardEffect.Activate());
- #endregion
- if (Dimetromon != null)
- {
- #region Select Elizamon Permanent
- int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsElizamon));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsElizamon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- Elizamon = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 [Elizamon] to add digivolution sources.", "The opponent is selecting 1 [Elizamon] to add digivolution sources.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (Elizamon != null)
- {
- yield return ContinuousController.instance.StartCoroutine(Elizamon.AddDigivolutionCardsBottom(new List<CardSource>() { Dimetromon }, activateClass));
- if (Elizamon.DigivolutionCards.Contains(Dimetromon))
- {
- #region Digivolve into Lamiamon
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- Elizamon,
- IsLamiamon,
- payCost: true,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: 3,
- isHand: true,
- activateClass: activateClass,
- successProcess: null,
- ignoreSelection: true,
- failedProcess: FailureProcess()));
- #endregion
- }
- IEnumerator FailureProcess()
- {
- List<IDiscardHand> discardHands = new List<IDiscardHand>() { new IDiscardHand(card, null) };
- yield return ContinuousController.instance.StartCoroutine(new IDiscardHands(discardHands, null).DiscardHands());
- }
- }
- }
- }
- }
- }
- #endregion
- #region Shared WD/WA
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return true;
- }
- CardSource selectedCard = null;
- if (card.Owner.Enemy.HandCards.Count() >= 1 && card.Owner.CanAddSecurity(activateClass))
- {
- int maxCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner.Enemy,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- isShowOpponent: false,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage(
- "Select 1 card to place at the bottom of security.",
- "The opponent is selecting 1 card to place at the bottom of security.");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- }
- if (selectedCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard, toTop: false));
- }
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
- }
-
- string SharedEffectDescription(string tag)
- {
- return $"[{tag}] [Once Per Turn] Your opponent places 1 card from their hand as the bottom security card. Then, trash their top security card.";
- }
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- #endregion
- #region When Attacking
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Opponent places 1 card from hand in security bottom. Trash their security top", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Attacking"));
- activateClass.SetHashString("WAWD_BT24-016");
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Opponent places 1 card from hand in security bottom. Trash their security top", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Digivolving"));
- activateClass.SetHashString("WAWD_BT24-016");
- cardEffects.Add(activateClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- }
- #endregion
- #region All Turns - ESS
- if (timing == EffectTiming.OnLoseSecurity)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play 1 [Reptile] or [Dragonkin] from hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("PlayDigimon_BT24_016");
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[All Turns] [Once Per Turn] When your opponent's security stack is removed from, you may play 1 5000 DP or lower [Reptile] or [Dragonkin] trait Digimon card from your hand without paying the cost.";
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
- {
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- return true;
- }
- return false;
- }
- bool PlayerCondition(Player player)
- {
- if (player == card.Owner.Enemy)
- {
- return true;
- }
- return false;
- }
- bool CanSelectCardCondition(CardSource source)
- {
- if (source.IsDigimon)
- {
- if (source.EqualsTraits("Reptile") || source.EqualsTraits("Dragonkin"))
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: source, payCost: false, cardEffect: activateClass))
- {
- if (source.CardDP <= 5000)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- CardSource selectedCard = null;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- 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 play.", "The opponent is selecting 1 card to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (selectedCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|