| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT16
- {
- public class BT16_028 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.CardNames.Contains("Paildramon") || targetPermanent.TopCard.CardNames.Contains("Dinobeemon");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 3,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 of your opponent's Digimon/Tamer can't unsuspend.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] 1 of your opponent's Digimon or Tamer can't unsuspend until the end of their turn. Then, by suspending 1 of their Digimon or Tamers, unsuspend 1 of your Digimon.";
- }
- bool CanSelectOpponentsDigimon(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
- {
- return permanent.IsDigimon || permanent.IsTamer;
- }
- return false;
- }
- bool CanSelectOpponentsDigimonToSuspend(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
- {
- if (permanent.IsDigimon || permanent.IsTamer)
- {
- if (!permanent.IsSuspended)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectYourSuspendedDigimon(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.IsDigimon && permanent.IsSuspended)
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)
- && CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimon))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition_ByPreSelecetedList: null,
- canTargetCondition: CanSelectOpponentsDigimon,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer to not unsuspend.", "The opponent is selecting 1 Digimon/Tamer to not unsuspend.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
- targetPermanent: selectedPermanent,
- effectDuration: EffectDuration.UntilOpponentTurnEnd,
- activateClass: activateClass,
- condition: null,
- effectName: "Your Digimon can't unsuspend"));
- }
- }
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimonToSuspend))
- {
- Permanent suspendedPermanent = null;
- SelectPermanentEffect selectSuspendEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectSuspendEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition_ByPreSelecetedList: null,
- canTargetCondition: CanSelectOpponentsDigimonToSuspend,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectSuspendCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Tap,
- cardEffect: activateClass);
- selectSuspendEffect.SetUpCustomMessage("Select 1 Digimon/Tamer to suspend.", "The opponent is selecting 1 Digimon/Tamer to suspend.");
- yield return ContinuousController.instance.StartCoroutine(selectSuspendEffect.Activate());
- IEnumerator SelectSuspendCoroutine(Permanent permanent)
- {
- suspendedPermanent = permanent;
- yield return null;
- }
- if (suspendedPermanent != null)
- {
- SelectPermanentEffect selectUnsuspendEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectSuspendEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition_ByPreSelecetedList: null,
- canTargetCondition: CanSelectYourSuspendedDigimon,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectSuspendCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.UnTap,
- cardEffect: activateClass);
- selectSuspendEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend.");
- yield return ContinuousController.instance.StartCoroutine(selectSuspendEffect.Activate());
- }
- }
- }
- }
- }
- #endregion
- #region All Turns - When an effect plays/digivolves
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Digivolve into [Imperialdramon: Fighter Mode]", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] When an effect plays or digivolves an opponent's Digimon, if you have a Tamer, this Digimon may digivolve into [Imperialdramon: Fighter Mode] in your hand without paying the cost.";
- }
- bool IsOpponentDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool HasTamer(Permanent permanent)
- {
- if (permanent.IsTamer)
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card);
- return false;
- }
- bool HasFighterMode(CardSource cardSource)
- {
- return cardSource.CardNames.Contains("Imperialdramon: Fighter Mode") || cardSource.CardNames.Contains("Imperialdramon:FighterMode");
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsOpponentDigimon)
- || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsOpponentDigimon))
- && CardEffectCommons.IsByEffect(hashtable, null)
- && CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasTamer)
- && card.Owner.HandCards.Count(HasFighterMode) >= 1;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: card.PermanentOfThisCard(),
- cardCondition: HasFighterMode,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null,
- ignoreSelection: true));
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|