| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- // Release of the Sealed Knight!
- namespace DCGO.CardEffects.P
- {
- public class P_204 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Trash 1 [X Antibody]/[Chronicle] from hand, draw 2", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Main] By trashing 1 card with the [X Antibody] or [Chronicle] trait from your hand, <Draw 2> (Draw 2 cards from your deck). Then, place this card in the battle area.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- bool CanSelectHandCondition(CardSource cardSource)
- {
- return cardSource.HasXAntibodyTraits || cardSource.HasChronicleTraits;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCondition))
- {
- bool discarded = false;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- int discardCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectHandCondition));
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectHandCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: discardCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: afterSelectCardCoroutine,
- mode: SelectHandEffect.Mode.Discard,
- cardEffect: activateClass);
- IEnumerator afterSelectCardCoroutine(List<CardSource> selectedCards)
- {
- if (selectedCards.Count > 0) discarded = true;
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- if (discarded)
- {
- yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
- }
- }
- }
- }
- #endregion
- #region All Turns - Delay
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 [Grademon]/[Chronicle] digimon digivoles into [Alphamon]/ level 6 or lower [Chronicle] digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] When Digimon attack players, <Delay>. 1 of your [Grademon] or Digimon with the [Chronicle] trait may digivolve into [Alphamon] or a level 6 or lower Digimon card with the [Chronicle] trait in the hand without paying the cost.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanDeclareOptionDelayEffect(card)
- && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, AttackingPermanentCondition);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnField(card);
- }
- bool AttackingPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && GManager.instance.attackProcess.AttackingPermanent == permanent
- // if DefendingPermanent is null, it means the attack is a player attack
- && GManager.instance.attackProcess.DefendingPermanent == null;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
- && (permanent.TopCard.EqualsCardName("Grademon") || permanent.TopCard.HasChronicleTraits);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
- IEnumerator SuccessProcess()
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- if (selectedPermanent != null)
- {
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon
- && (cardSource.EqualsCardName("Alphamon") || (cardSource.Level <= 6 && cardSource.HasChronicleTraits))
- && cardSource.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, false, activateClass);
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: selectedPermanent,
- cardCondition: CanSelectCardCondition,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- }
- #endregion
- #region Security Effect
- if (timing == EffectTiming.SecuritySkill)
- {
- CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: "Trash 1 [X Antibody]/[Chronicle] from hand, draw 2");
- }
- #endregion
- return cardEffects;
- }
- }
- }
|