| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- public class BT8_106 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.OptionSkill)
- {
- int maxCost = 15;
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Main] Reveal the top 3 cards of your deck. You may play any number of Digimon cards with [Mamemon] in their names whose play costs add up to 15 or less among them without paying their memory costs. Delete 1 of your opponent's Digimon with a memory cost of 6 or less for each Digimon played with this effect. Trash the remaining cards.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
- {
- if (cardSource.ContainsCardName("Mamemon"))
- {
- if (cardSource.GetCostItself <= maxCost)
- {
- if (cardSource.IsDigimon)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.GetCostItself <= 6)
- {
- if (permanent.CanSelectBySkill(activateClass))
- {
- if (permanent.TopCard.HasPlayCost)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- int maxCount = card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame());
- List<CardSource> selectedCards = new List<CardSource>();
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
- revealCount: 3,
- simplifiedSelectCardConditions:
- new SimplifiedSelectCardConditionClass[]
- {
- new SimplifiedSelectCardConditionClass(
- canTargetCondition:CanSelectCardCondition,
- message: "Select Digimon cards with [Mamemon] in their names whose play costs add up to 15 or less.",
- mode: SelectCardEffect.Mode.Custom,
- maxCount: maxCount,
- selectCardCoroutine: SelectCardCoroutine),
- },
- remainingCardsPlace: RemainingCardsPlace.Trash,
- activateClass: activateClass,
- canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
- canEndSelectCondition: CanEndSelectCondition,
- canNoSelect: true,
- canEndNotMax: true
- ));
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
- {
- int sumCost = 0;
- foreach (CardSource cardSource1 in cardSources)
- {
- sumCost += cardSource1.GetCostItself;
- }
- sumCost += cardSource.GetCostItself;
- if (sumCost > maxCost)
- {
- return false;
- }
- return true;
- }
- bool CanEndSelectCondition(List<CardSource> cardSources)
- {
- if (cardSources.Count <= 0)
- {
- return false;
- }
- int sumCost = 0;
- foreach (CardSource cardSource1 in cardSources)
- {
- sumCost += cardSource1.GetCostItself;
- }
- if (sumCost > maxCost)
- {
- return false;
- }
- return true;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: selectedCards,
- activateClass: activateClass,
- payCost: false,
- isTapped: false,
- root: SelectCardEffect.Root.Library,
- activateETB: true));
- int playedCount = selectedCards.Count(cardSource => CardEffectCommons.IsExistOnBattleArea(cardSource));
- maxCount = Math.Min(playedCount, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- if (timing == EffectTiming.SecuritySkill)
- {
- CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Reveal the top 3 cards of deck and delete Digimon");
- }
- return cardEffects;
- }
- }
|