| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- public class P_124 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.OnStartMainPhase)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Start of Your Main Phase] If you have a Digimon with the [Free] trait, gain 1 memory.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardTraits.Contains("Free")))
- {
- if (card.Owner.CanAddMemory(activateClass))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
- }
- }
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play 1 [Veemon] or your 1 Digimon digivolves into [ExVeemon]", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] Activate 1 of the effects below: - You may play 1 [Veemon] from your hand without paying the cost. - 1 of your Digimon may digivolve into [ExVeemon] in the hand without paying the cost.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.CardNames.Contains("Veemon"))
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
- {
- return true;
- }
- }
- return false;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
- {
- foreach (CardSource cardSource in card.Owner.HandCards)
- {
- if (CanSelectCardCondition1(cardSource))
- {
- if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanSelectCardCondition1(CardSource cardSource)
- {
- return cardSource.CardNames.Contains("ExVeemon");
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.HandCards.Count >= 1)
- {
- return true;
- }
- if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new SelectionElement<bool>(message: $"Play [Veemon]", value : true, spriteIndex: 0),
- new SelectionElement<bool>(message: $"Digivolve into [ExVeemon]", value : false, spriteIndex: 1),
- };
- string selectPlayerMessage = "Which effect do you choose?";
- string notSelectPlayerMessage = "The opponent is choosing the effect.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
- bool isPlayVeemon = GManager.instance.userSelectionManager.SelectedBoolValue;
- if (isPlayVeemon)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 [Veemon] to play.", "The opponent is selecting 1 [Veemon] to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
- }
- else
- {
- Permanent selectedPermanent = null;
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- 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);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve into [ExVeemon].", "The opponent is selecting 1 Digimon to digivolve into [ExVeemon].");
- 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: CanSelectCardCondition1,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- return cardEffects;
- }
- }
|