|
|
@@ -1,5 +1,6 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace DCGO.CardEffects.BT21
|
|
|
{
|
|
|
@@ -9,34 +10,193 @@ namespace DCGO.CardEffects.BT21
|
|
|
{
|
|
|
List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
|
|
|
+ #region Ignore Color Requirement
|
|
|
+
|
|
|
if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
|
|
|
+ ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
|
|
|
+ ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
|
|
|
+ cardEffects.Add(ignoreColorConditionClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped) == 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return cardSource == card;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region All Turns - Security
|
|
|
+
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ bool PermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
|
|
|
+ permanent.TopCard.EqualsTraits("WG");
|
|
|
+ }
|
|
|
+
|
|
|
+ AddSkillClass addSkillClass = new AddSkillClass();
|
|
|
+ addSkillClass.SetUpICardEffect("Your Digimon gain <Vortex>", CanUseCondition, card);
|
|
|
+ addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
|
|
|
+ cardEffects.Add(addSkillClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistInSecurity(card, false) &&
|
|
|
+ CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardSourceCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource) &&
|
|
|
+ cardSource.Owner == card.Owner &&
|
|
|
+ cardSource == cardSource.PermanentOfThisCard().TopCard &&
|
|
|
+ PermanentCondition(cardSource.PermanentOfThisCard());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> effects, EffectTiming effectTiming)
|
|
|
+ {
|
|
|
+ if (effectTiming == EffectTiming.OnAllyAttack)
|
|
|
+ {
|
|
|
+ bool Condition()
|
|
|
+ {
|
|
|
+ return CardSourceCondition(cardSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ effects.Add(CardEffectFactory.VortexSelfEffect(false, cardSource, Condition));
|
|
|
+ }
|
|
|
+
|
|
|
+ return effects;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Main Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.OptionSkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Replace your bottom security card with this face-up card", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return "[Main] Add your bottom security card to the hand. Then, place this card face up as the bottom security card.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (card.Owner.SecurityCards.Count >= 1)
|
|
|
+ {
|
|
|
+ // Add your bottom security card to the hand
|
|
|
+ CardSource bottomCard = card.Owner.SecurityCards[^1];
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
+ CardObjectController.AddHandCards(new List<CardSource>() { bottomCard }, false, activateClass));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
|
|
|
+ player: card.Owner,
|
|
|
+ refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
|
|
|
+ }
|
|
|
+
|
|
|
+ // Place this card face up as the bottom security card
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(
|
|
|
+ card, toTop: false, faceUp: true));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
|
|
|
+ .CreateRecoveryEffect(card.Owner));
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(new IAddSecurity(card.Owner).AddSecurity());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Security Effect
|
|
|
+
|
|
|
+ if (timing == EffectTiming.SecuritySkill)
|
|
|
{
|
|
|
ActivateClass activateClass = new ActivateClass();
|
|
|
- activateClass.SetUpICardEffect("", CanUseCondition, card);
|
|
|
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
|
|
|
+ activateClass.SetUpICardEffect($"Play 1 [WG] Digimon card from hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ activateClass.SetIsSecurityEffect(true);
|
|
|
cardEffects.Add(activateClass);
|
|
|
|
|
|
- string EffectDiscription()
|
|
|
+ string EffectDescription()
|
|
|
{
|
|
|
- return "";
|
|
|
+ return
|
|
|
+ "[Security] You may play 1 level 5 or lower Digimon with the [WG] trait from your hand without paying the cost.";
|
|
|
}
|
|
|
|
|
|
bool CanUseCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
|
|
|
}
|
|
|
|
|
|
- bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
|
|
|
+ cardSource.EqualsTraits("WG") &&
|
|
|
+ CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
|
|
|
}
|
|
|
|
|
|
IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
{
|
|
|
- yield return null;
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
|
|
|
+ {
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
|
|
|
+
|
|
|
+ selectHandEffect.SetUp(
|
|
|
+ selectPlayer: card.Owner,
|
|
|
+ canTargetCondition: CanSelectCardCondition,
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
+ canEndSelectCondition: null,
|
|
|
+ maxCount: 1,
|
|
|
+ canNoSelect: true,
|
|
|
+ canEndNotMax: false,
|
|
|
+ isShowOpponent: true,
|
|
|
+ selectCardCoroutine: SelectCardCoroutine,
|
|
|
+ afterSelectCardCoroutine: null,
|
|
|
+ mode: SelectHandEffect.Mode.Custom,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card 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));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
return cardEffects;
|
|
|
}
|
|
|
}
|