| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.ST18
- {
- public class ST18_14 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Start of Your Turn
- if (timing == EffectTiming.OnStartTurn)
- {
- cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
- }
- #endregion
- #region Your Turn
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Switch attack target of own Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[Your Turn] When one of your Digimon attacks your opponent's Digimon, by suspending this Tamer, you may change the attack target to another of your opponent's Digimon or the player.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.IsOwnerTurn(card) &&
- CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, AttackingPermanent) &&
- CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(
- GManager.instance.attackProcess.DefendingPermanent, card);
- }
- bool AttackingPermanent(Permanent permanent)
- {
- return CardEffectCommons.IsOwnerPermanent(permanent, card);
- }
- bool DefendingPermanent(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
- GManager.instance.attackProcess.DefendingPermanent != permanent;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.CanActivateSuspendCostEffect(card) &&
- GManager.instance.attackProcess.AttackingPermanent != null &&
- GManager.instance.attackProcess.AttackingPermanent.CanSwitchAttackTarget;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
- CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
- if (CardEffectCommons.HasMatchConditionPermanent(DefendingPermanent))
- {
- GManager.instance.userSelectionManager.SetBoolSelection(
- selectionElements: new List<SelectionElement<bool>>
- {
- new(message: "Attack Digimon", value: true, spriteIndex: 0),
- new(message: "Attack Player", value: false, spriteIndex: 1),
- },
- selectPlayer: card.Owner,
- selectPlayerMessage: "Choose a new target for the attack",
- notSelectPlayerMessage: "The opponent is choosing a new target for the attack.");
- }
- else
- {
- GManager.instance.userSelectionManager.SetBool(false);
- }
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
- .WaitForEndSelect());
- if (GManager.instance.userSelectionManager.SelectedBoolValue)
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: DefendingPermanent,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.",
- "The opponent is selecting 1 Digimon to attack.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
- activateClass,
- false,
- permanent));
- }
- }
- else
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
- activateClass,
- false,
- null));
- }
- }
- }
- #endregion
- #region Security Effect
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|