| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT18
- {
- public class GospeloftheFallenAngel_BT18_100 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Main Effect
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Your breeding area digimon may digivolve into [Lucemon]", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[Main] Your Digimon in the breeding area may digivolve into [Lucemon] from your trash without paying the cost. Then, place this card in the battle area.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- bool CanSelectBreedingAreaDigimon(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
- permanent.IsDigimon;
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.EqualsCardName("Lucemon");
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectBreedingAreaDigimon) >= 1)
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "Digivolve in the breeding area", value: true, spriteIndex: 0),
- new(message: "Do not digivolve", value: false, spriteIndex: 1),
- };
- string selectPlayerMessage = "Digivolve into Lucemon in the breeding area?";
- string notSelectPlayerMessage = "The opponent is choosing whether to digivolve in the breeding area or not.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
- selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
- notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
- .WaitForEndSelect());
- if (GManager.instance.userSelectionManager.SelectedBoolValue)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: card.Owner.GetBreedingAreaPermanents()[0],
- cardCondition: CanSelectCardCondition,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: false,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
- }
- }
- #endregion
- #region Delay Effect
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("1 of your Digimon digivolves to trash 1 Option card from the opponent's battle area",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[Main] <Delay> ・ By digivolving 1 of your Digimon with [Lucemon] in its name into a Digimon card with [Lucemon] in its namefrom your trash with the digivolution cost reduced by 3, trash 1 Option card in your opponent's battle area.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanDeclareOptionDelayEffect(card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
- permanent.TopCard.ContainsCardName("Lucemon") &&
- card.Owner.TrashCards.Where(CanSelectCardCondition).Any(cardSource =>
- cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
- }
- bool CanSelectOptionPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
- permanent.IsOption;
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.ContainsCardName("Lucemon");
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
- targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass,
- successProcess: _ => SuccessProcess(), failureProcess: null));
- IEnumerator SuccessProcess()
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
- "The opponent is selecting 1 Digimon that will digivolve.");
- 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.DigivolveIntoHandOrTrashCard(
- targetPermanent: selectedPermanent,
- cardCondition: CanSelectCardCondition,
- payCost: true,
- reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: false,
- activateClass: activateClass,
- successProcess: null));
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOptionPermanentCondition))
- {
- selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectOptionPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Option to delete.",
- "The opponent is selecting 1 Option to delete.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- }
- }
- }
- }
- #endregion
- #region Security Effect
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|