Selaa lähdekoodia

Funbeemon Puroromon, DP change effects visible while in security

mbunch_kascope 1 vuosi sitten
vanhempi
sitoutus
cd22998264

+ 163 - 0
Assets/CardEffect/BT18/Green/FunBeemon_BT18_044.cs

@@ -0,0 +1,163 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace DCGO.CardEffects.BT18
+{
+    public class FunBeemon_BT18_044 : CEntity_Effect
+    {
+        public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
+        {
+            List<ICardEffect> cardEffects = new List<ICardEffect>();
+
+            #region Alternate Digivolution
+
+            if (timing == EffectTiming.None)
+            {
+                bool PermanentCondition(Permanent targetPermanent)
+                {
+                    return targetPermanent.TopCard.IsLevel2 &&
+                           targetPermanent.TopCard.EqualsTraits("Royal Base");
+                }
+
+                cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
+                    permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
+                    card: card, condition: null));
+            }
+
+            #endregion
+
+            #region On Play
+            if (timing == EffectTiming.OnEnterFieldAnyone)
+            {
+                ActivateClass activateClass = new ActivateClass();
+                activateClass.SetUpICardEffect("Place 1 [Royal Base] trait Digimon face up as bottom security, add top security to hand", CanUseCondition, card);
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                cardEffects.Add(activateClass);
+
+                string EffectDiscription()
+                {
+                    return "[On Play] By placing 1 Digimon card with the [Royal Base] trait in your hand face up as your bottom security card, add your top security card to the hand.";
+                }
+
+                bool IsRoyalBaseDigimon(CardSource card)
+                {
+                    return card.EqualsTraits("Royal Base");
+                }
+
+                bool CanUseCondition(Hashtable hashtable)
+                {
+                    return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
+                }
+
+                bool CanActivateCondition(Hashtable hashtable)
+                {
+                    if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
+                        return CardEffectCommons.HasMatchConditionOwnersHand(card, IsRoyalBaseDigimon);
+
+                    return false;
+                }
+
+                IEnumerator ActivateCoroutine(Hashtable hashtable)
+                {
+                    bool cardAdded = false;
+
+                    SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
+
+                    selectHandEffect.SetUp(
+                        selectPlayer: card.Owner,
+                        canTargetCondition: IsRoyalBaseDigimon,
+                        canTargetCondition_ByPreSelecetedList: null,
+                        canEndSelectCondition: null,
+                        maxCount: 1,
+                        canNoSelect: true,
+                        canEndNotMax: false,
+                        isShowOpponent: true,
+                        selectCardCoroutine: CardSelected,
+                        afterSelectCardCoroutine: null,
+                        mode: SelectHandEffect.Mode.PutSecurityBottom,
+                        cardEffect: activateClass);
+
+                    selectHandEffect.SetIsFaceup();
+
+                    yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator CardSelected(CardSource cardSource)
+                    {
+                        cardAdded = true;
+
+                        yield return null;
+                    }
+
+                    if (cardAdded)
+                    {
+                        CardSource topCard = card.Owner.SecurityCards[0];
+
+                        yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
+
+                        yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
+                            player: card.Owner,
+                            refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
+                    }
+                }
+            }
+            #endregion
+
+            #region All Turns - ESS
+            if (timing == EffectTiming.None)
+            {
+                bool Condition()
+                {
+                    if (CardEffectCommons.IsExistOnBattleArea(card))
+                    {
+                        return true;
+                    }
+
+                    return false;
+                }
+
+                cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
+            }
+            #endregion
+
+            #region All Turns - Security
+            if (timing == EffectTiming.None)
+            {
+                string EffectDiscription()
+                {
+                    return "(Security) [All Turns] All of your [Royal Base] trait Digimon get +1000 DP.";
+                }
+
+                bool Condition()
+                {
+                    UnityEngine.Debug.Log($"FUNBEEMON CONDITION: {CardEffectCommons.IsExistInSecurity(card, false)}");
+                    return CardEffectCommons.IsExistInSecurity(card, false);
+                }
+
+                bool PermanentCondition(Permanent permanent)
+                {
+                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
+                    {
+                        if (permanent.TopCard.EqualsTraits("Royal Base"))
+                        {
+                            return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
+                permanentCondition: PermanentCondition,
+                changeValue: 1000,
+                isInheritedEffect: false,
+                card: card,
+                condition: Condition,
+                effectName: EffectDiscription));
+            }
+            #endregion
+
+            return cardEffects;
+        }
+    }
+}

+ 11 - 0
Assets/CardEffect/BT18/Green/FunBeemon_BT18_044.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 799d7c19bcf2ca14683a7da1b033033b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 25 - 4
Assets/CardEffect/BT18/Green/Puroromon_BT18_004.cs

@@ -1,7 +1,8 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics;
 
-namespace DCGO.CardEffects
+namespace DCGO.CardEffects.BT18
 {
     public class Puroromon_BT18_004 : CEntity_Effect
     {
@@ -14,6 +15,7 @@ namespace DCGO.CardEffects
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Place 1 [Royal Base] trait Digimon face up as bottom security, add top security to hand", CanUseCondition, card);
                 activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetIsInheritedEffect(true);
                 cardEffects.Add(activateClass);
 
                 string EffectDiscription()
@@ -29,8 +31,7 @@ namespace DCGO.CardEffects
                 bool CanUseCondition(Hashtable hashtable)
                 {
                     return CardEffectCommons.IsOwnerTurn(card) &&
-                           CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
-                           card.PermanentOfThisCard().DigivolutionCards.Contains(card);
+                           CardEffectCommons.IsExistOnBattleAreaDigimon(card);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
@@ -43,6 +44,8 @@ namespace DCGO.CardEffects
 
                 IEnumerator ActivateCoroutine(Hashtable hashtable)
                 {
+                    bool cardAdded = false;
+
                     SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
 
                     selectHandEffect.SetUp(
@@ -54,7 +57,7 @@ namespace DCGO.CardEffects
                         canNoSelect: true,
                         canEndNotMax: false,
                         isShowOpponent: true,
-                        selectCardCoroutine: null,
+                        selectCardCoroutine: CardSelected,
                         afterSelectCardCoroutine: null,
                         mode: SelectHandEffect.Mode.PutSecurityBottom,
                         cardEffect: activateClass);
@@ -62,6 +65,24 @@ namespace DCGO.CardEffects
                     selectHandEffect.SetIsFaceup();
 
                     yield return StartCoroutine(selectHandEffect.Activate());
+
+                    IEnumerator CardSelected(CardSource cardSource)
+                    {
+                        cardAdded = true;
+
+                        yield return null;
+                    }
+
+                    if (cardAdded)
+                    {
+                        CardSource topCard = card.Owner.SecurityCards[0];
+
+                        yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
+
+                        yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
+                            player: card.Owner,
+                            refSkillInfos: ref ContinuousController.instance.nullSkillInfos).ReduceSecurity());
+                    }
                 }
             }
 

+ 0 - 10
Assets/Scripts/CEntity_EffectController.cs

@@ -112,16 +112,6 @@ public class CEntity_EffectController : MonoBehaviour
                     {
                         foreach (CardSource cardSource in thisPermanent.cardSources)
                         {
-                            /*
-                            if (cardSource != thisPermanent.TopCard)
-                            {
-                                if (!thisPermanent.IsDigimon)
-                                {
-                                    continue;
-                                }
-                            }
-                            */
-
                             foreach (ICardEffect cardEffect in cardSource.cEntity_EffectController.cEntity_Effect.GetCardEffects(EffectTiming.None, thisPermanent.TopCard))
                             {
                                 if (cardEffect is IAddSkillEffect)

+ 10 - 0
Assets/Scripts/CardEffectCommons/GameContextDeterminarion.cs

@@ -120,6 +120,16 @@ public partial class CardEffectCommons
     }
     #endregion
 
+    #region Whether the card is in Security Area
+    public static bool IsExistInSecurity(CardSource card, bool isFlipped = false)
+    {
+        if (card.Owner.SecurityCards.Contains(card))
+            return card.IsFlipped == isFlipped;
+
+        return false;
+    }
+    #endregion
+
     #region Whether the card Can be played as a new permanent
     public static bool CanPlayAsNewPermanent(
         CardSource cardSource,

+ 3 - 1
Assets/Scripts/CardObjectController.cs

@@ -964,8 +964,10 @@ public class CardObjectController : MonoBehaviour
 
             if (!cardSource.IsToken)
             {
-                if(!faceUp)
+                if (!faceUp)
                     cardSource.SetReverse();
+                else
+                    cardSource.SetFace();
 
                 cardSource.Owner.SecurityCards.Insert(0, cardSource);
 

+ 38 - 3
Assets/Scripts/Permanent.cs

@@ -323,9 +323,9 @@ public class Permanent
 
                 foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
                 {
+                    #region Effects of permanents in play
                     foreach (Permanent permanent in player.GetFieldPermanents())
                     {
-                        #region 場のパーマネントの効果
                         foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
                         {
                             if (cardEffect is IChangeDPEffect)
@@ -350,10 +350,45 @@ public class Permanent
                                 }
                             }
                         }
-                        #endregion
                     }
+                    #endregion
 
-                    #region プレイヤーの効果
+                    #region Effects of face up security
+                    foreach (CardSource cardSource in player.SecurityCards)
+                    {
+                        //if (!cardSource.IsFlipped)
+                        //    continue;
+
+                        foreach (ICardEffect cardEffect in cardSource.EffectList(EffectTiming.None))
+                        {
+                            if (cardEffect is IChangeDPEffect)
+                            {
+                                Debug.Log($"{cardSource.BaseENGCardNameFromEntity} - {cardEffect.EffectName} - {cardEffect.CanUse(null)}");
+                                if (cardEffect.CanUse(null))
+                                {
+                                    Debug.Log($"{cardSource.BaseENGCardNameFromEntity} - {((IChangeDPEffect)cardEffect).PermanentCondition(this)}");
+                                    if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
+                                    {
+                                        if (((IChangeDPEffect)cardEffect).IsMinusDP())
+                                        {
+                                            if (this.ImmuneFromDPMinus(cardEffect))
+                                            {
+                                                continue;
+                                            }
+                                        }
+
+                                        if (!TopCard.CanNotBeAffected(cardEffect))
+                                        {
+                                            cardEffects_ChangeDP.Add(cardEffect);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    #endregion
+
+                    #region Player effect
                     foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
                     {
                         if (cardEffect is IChangeDPEffect)

+ 4 - 6
Assets/Scripts/TurnStateMachine.cs

@@ -33,7 +33,6 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
 
     #region Initialization
 
-
     public IEnumerator Init()
     {
         yield return StartCoroutine(GManager.instance.LoadingObject.StartLoading("Now Loading"));
@@ -252,7 +251,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
             yield return StartCoroutine(player.brainStormObject.Init());
         }
 
-        #region 先攻後攻の決定
+        #region Deciding whether to attack first or last
         gameContext.TurnPlayer = gameContext.PlayerFromID(UnityEngine.Random.Range(0, 2));
 
         #region get first player from room custom property
@@ -930,7 +929,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
 
             StartCoroutine(SetMainPhase());
 
-            #region 選択終了まで待機
+            #region Wait until selection is complete
             while (PlayCard == null && UseCardEffect == null && AttackingPermanent == null)
             {
                 yield return null;
@@ -1160,7 +1159,6 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
                         }
 
                         // yield return StartCoroutine(((ActivateICardEffect)UseCardEffect).Activate_Optional_Effect_Execute(null));
-                        UnityEngine.Debug.Log($"MainPhase: UseCardEffect - {UseCardEffect.EffectSourceCard.BaseENGCardNameFromEntity}, {UseCardEffect.MaxCountPerTurn}");
                         yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.ActivateEffectProcess(
                                 UseCardEffect,
                                 null));
@@ -1169,7 +1167,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
             }
             #endregion
 
-            #region カードをプレイ
+            #region play cards
             else if (PlayCard != null)
             {
                 isSync = true;
@@ -1216,7 +1214,7 @@ public class TurnStateMachine : MonoBehaviourPunCallbacks
             }
             #endregion
 
-            #region アタック
+            #region attack
             else if (AttackingPermanent != null)
             {
                 yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.Attack(AttackingPermanent, DefendingPermanent, null));