| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- // LordKnightmon
- namespace DCGO.CardEffects.BT22
- {
- public class BT22_067 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Static Effects
- #region Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.IsLevel5
- && targetPermanent.TopCard.HasCSTraits;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 3,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region Rio Kishibe Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.EqualsCardName("Rie Kishibe");
- }
- bool Condition()
- {
- return card.Owner.SecurityCards.Count <= 3;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 5,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: Condition)
- );
- }
- #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
- #endregion
- #region OP/WD Shared
- bool SharedIsYourDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- }
- bool SharedAttackingDigimon(Permanent permanent, ActivateClass activateClass)
- {
- return SharedIsYourDigimon(permanent)
- && permanent.CanAttack(activateClass);
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedIsYourDigimon))
- {
- Permanent selectedYourPermanent = null;
- #region Select Gain DP Permanent
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, SharedIsYourDigimon));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: SharedIsYourDigimon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedYourPermanent = permanent;
- yield return null;
- }
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain 3K DP", "The opponent is selecting 1 Digimon to gain 3K DP");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- #endregion
- if (selectedYourPermanent != null) yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.ChangeDigimonDP(selectedYourPermanent, 3000, EffectDuration.UntilOpponentTurnEnd, activateClass));
- Permanent selectedAttackingPermament = null;
- #region Select Permanent To Attack
- int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, perm => SharedAttackingDigimon(perm, activateClass)));
- SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: perm => SharedAttackingDigimon(perm, activateClass),
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine1,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectPermanentCoroutine1(Permanent permanent)
- {
- selectedAttackingPermament = permanent;
- yield return null;
- }
- selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to attack", "The opponent is selecting 1 Digimon to attack");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
- #endregion
- if (selectedAttackingPermament != null && selectedAttackingPermament.CanAttack(activateClass))
- {
- #region Setup SelectAttackEffect
- SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
- selectAttackEffect.SetUp(
- attacker: selectedAttackingPermament,
- canAttackPlayerCondition: () => true,
- defenderCondition: (permanent) => false,
- cardEffect: activateClass);
- #endregion
- yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
- }
- }
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("+3K DP, then 1 digimon may attack", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] 1 of your Digimon gets +3000 DP until your opponent's turn ends. Then, 1 of your Digimon may attack a player.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return SharedActivateCoroutine(hashtable, activateClass);
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("+3K DP, then 1 digimon may attack", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] 1 of your Digimon gets +3000 DP until your opponent's turn ends. Then, 1 of your Digimon may attack a player.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return SharedActivateCoroutine(hashtable, activateClass);
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Reveal top 3, Play 1 4 cost or lower Black or Red card", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
- activateClass.SetHashString("BT22_067_PlayTamer");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[All Turns] [Once Per Turn] When Digimon attack players, reveal the top 3 cards of your deck. You may play 1 play cost 4 or lower black or red card among them without paying the cost. Trash the rest.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, IsAttackingPlayer);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- bool IsAttackingPlayer(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
- && GManager.instance.attackProcess.IsAttacking
- && GManager.instance.attackProcess.DefendingPermanent == null;
- }
- bool IsProperCard(CardSource cardSource)
- {
- return cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 4 &&
- (cardSource.HasCardColor(CardColor.Black) || cardSource.HasCardColor(CardColor.Red)) &&
- CardEffectCommons.CanPlayAsNewPermanent(cardSource,false,activateClass,SelectCardEffect.Root.Library);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- CardSource selectedCard = null;
- #region Select Card
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
- revealCount: 3,
- simplifiedSelectCardConditions:
- new SimplifiedSelectCardConditionClass[]
- {
- new SimplifiedSelectCardConditionClass(
- canTargetCondition:IsProperCard,
- message: "Select 1 4 or lower play cost Black/Red card",
- mode: SelectCardEffect.Mode.Custom,
- maxCount: 1,
- selectCardCoroutine: SelectCardCoroutine),
- },
- remainingCardsPlace: RemainingCardsPlace.Trash,
- activateClass: activateClass
- ));
- #endregion
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
- if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.PlayPermanentCards(new List<CardSource>() { selectedCard }, activateClass, false, false, SelectCardEffect.Root.Execution, true));
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|