Example #1
0
    protected override bool AddPowerSourceAndTargets(PowerTaskList taskList)
    {
        this.Reset();
        if (!this.HasSourceCard(taskList))
        {
            return(false);
        }
        Entity sourceEntity               = taskList.GetSourceEntity();
        Card   card                       = sourceEntity.GetCard();
        Spell  spell                      = this.DetermineTriggerSpell(card);
        bool   spellInitialized           = this.InitTriggerSpell(card, spell);
        List <CardSoundSpell> soundSpells = this.DetermineTriggerSounds(card);

        this.InitTriggerSounds(card, soundSpells);
        if (this.CanPlayActorTriggerSpell(sourceEntity, spell, spellInitialized))
        {
            this.m_actorTriggerSpell = this.GetActorTriggerSpell(sourceEntity);
        }
        if (((this.m_triggerSpell == null) && (this.m_triggerSoundSpells.Count == 0)) && (this.m_actorTriggerSpell == null))
        {
            return(TurnStartManager.Get().IsCardDrawHandled(card));
        }
        base.SetSource(card);
        return(true);
    }
Example #2
0
    public override void OnTagChanged(TagDelta change)
    {
        switch (((GAME_TAG)change.tag))
        {
        case GAME_TAG.STEP:
            if (change.newValue == 4)
            {
                MulliganManager.Get().BeginMulligan();
            }
            break;

        case GAME_TAG.NEXT_STEP:
            if (change.newValue == 6)
            {
                if (GameState.Get().IsMulliganManagerActive())
                {
                    GameState.Get().SetMulliganPowerBlocker(true);
                }
            }
            else if (((change.oldValue == 9) && (change.newValue == 10)) && GameState.Get().IsFriendlySidePlayerTurn())
            {
                TurnStartManager.Get().BeginPlayingTurnEvents();
            }
            break;
        }
        base.OnTagChanged(change);
    }
Example #3
0
 protected override void OnProcessTaskList()
 {
     if (!this.ActivateInitialSpell())
     {
         base.OnProcessTaskList();
     }
     else if (GameState.Get().IsTurnStartManagerActive())
     {
         TurnStartManager.Get().NotifyOfTriggerVisual();
     }
 }
    public Vector3 GetCardRotation(Card card, int overrideCardCount)
    {
        int num = card.GetZonePosition() - 1;

        if (card.IsDoNotSort())
        {
            num = base.GetCards().Count - 1;
        }
        float num2  = 0f;
        float num3  = 0f;
        int   count = base.m_cards.Count;

        if ((overrideCardCount >= 0) && (overrideCardCount < base.m_cards.Count))
        {
            count = overrideCardCount;
        }
        if (!this.enemyHand)
        {
            count -= TurnStartManager.Get().GetNumCardsToDraw();
        }
        if (this.IsHandScrunched())
        {
            float num5 = 40f;
            if (!this.enemyHand)
            {
                num5 += count * 2;
            }
            num2 = num5 / ((float)count);
            num3 = -num5 / 2f;
        }
        float y = 0f;

        if (this.enemyHand)
        {
            y = (0f - (num2 * (num + 0.5f))) - num3;
        }
        else
        {
            y += (num2 * num) + num3;
        }
        if (this.enemyHand && SpectatorManager.Get().IsSpectatingOpposingSide())
        {
            y += 180f;
        }
        return(new Vector3(0f, y, !this.m_flipHandCards ? 354.5f : 534.5f));
    }
    protected bool CanAnimateCard(Card card)
    {
        bool flag = this.enemyHand && (card.GetPrevZone() is ZonePlay);

        if (card.IsDoNotSort())
        {
            if (flag)
            {
                object[] args = new object[] { card };
                Log.FaceDownCard.Print("ZoneHand.CanAnimateCard() - card={0} FAILED card.IsDoNotSort()", args);
            }
            return(false);
        }
        if (!card.IsActorReady())
        {
            if (flag)
            {
                object[] objArray2 = new object[] { card };
                Log.FaceDownCard.Print("ZoneHand.CanAnimateCard() - card={0} FAILED !card.IsActorReady()", objArray2);
            }
            return(false);
        }
        if ((!base.m_controller.IsFriendlySide() || (TurnStartManager.Get() == null)) || !TurnStartManager.Get().IsCardDrawHandled(card))
        {
            if (this.IsCardNotInEnemyHandAnymore(card))
            {
                if (flag)
                {
                    object[] objArray3 = new object[] { card };
                    Log.FaceDownCard.Print("ZoneHand.CanAnimateCard() - card={0} FAILED IsCardNotInEnemyHandAnymore()", objArray3);
                }
                return(false);
            }
            if (!card.HasBeenGrabbedByEnemyActionHandler())
            {
                return(true);
            }
            if (flag)
            {
                object[] objArray4 = new object[] { card };
                Log.FaceDownCard.Print("ZoneHand.CanAnimateCard() - card={0} FAILED card.HasBeenGrabbedByEnemyActionHandler()", objArray4);
            }
        }
        return(false);
    }
    public bool IsHandScrunched()
    {
        int count = base.m_cards.Count;

        if (this.m_handEnlarged && (count > 3))
        {
            return(true);
        }
        float defaultCardSpacing = this.GetDefaultCardSpacing();

        if (!this.enemyHand)
        {
            count -= TurnStartManager.Get().GetNumCardsToDraw();
        }
        float num3 = defaultCardSpacing * count;

        return(num3 > this.MaxHandWidth());
    }
    private float GetCardSpacing()
    {
        float defaultCardSpacing = this.GetDefaultCardSpacing();
        int   count = base.m_cards.Count;

        if (!this.enemyHand)
        {
            count -= TurnStartManager.Get().GetNumCardsToDraw();
        }
        float num3 = defaultCardSpacing * count;
        float num4 = this.MaxHandWidth();

        if (num3 > num4)
        {
            defaultCardSpacing = num4 / ((float)count);
        }
        return(defaultCardSpacing);
    }
Example #8
0
        public void DoMulligan()
        {
            //TODO toggle holding as needed
            //var cs = myPlayer.GetHandZone().GetCards();
            //Log.say("Mulligan with " + cs.Count + " cards ");
            //MulliganManager.Get().ToggleHoldState(cs[0]);
            //MulliganManager.Get().SetAllMulliganCardsToHold();

            // End mulligan
            Log.log("Handling mulligan");
            Thread.Sleep(1000 * 5);
            //MulliganManager.Get().SetAllMulliganCardsToHold();
            InputManager.Get().DoEndTurnButton();
            TurnStartManager.Get().BeginListeningForTurnEvents();
            MulliganManager.Get().EndMulliganEarly();
            Thread.Sleep(1000 * 5);
            Log.log("Done handling mulligan");
        }
    protected bool IsCardBusy(Card card)
    {
        Entity entity = card.GetEntity();

        if (this.WillEntityLoadCard(entity))
        {
            return(false);
        }
        if (entity.IsLoadingAssets())
        {
            return(true);
        }
        if ((TurnStartManager.Get() != null) && TurnStartManager.Get().IsCardDrawHandled(card))
        {
            return(false);
        }
        return(!card.IsActorReady());
    }
    public Vector3 GetCardPosition(Card card, int overrideCardCount)
    {
        int num = card.GetZonePosition() - 1;

        if (card.IsDoNotSort())
        {
            num = base.GetCards().Count - 1;
        }
        float num2  = 0f;
        float num3  = 0f;
        float num4  = 0f;
        int   count = base.m_cards.Count;

        if ((overrideCardCount >= 0) && (overrideCardCount < base.m_cards.Count))
        {
            count = overrideCardCount;
        }
        if (!this.enemyHand)
        {
            count -= TurnStartManager.Get().GetNumCardsToDraw();
        }
        if (this.IsHandScrunched())
        {
            num4 = 1f;
            float num6 = 40f;
            if (!this.enemyHand)
            {
                num6 += count * 2;
            }
            num2 = num6 / ((float)count);
            num3 = -num6 / 2f;
        }
        float f = 0f;

        if (this.enemyHand)
        {
            f = (0f - (num2 * (num + 0.5f))) - num3;
        }
        else
        {
            f += (num2 * num) + num3;
        }
        float num8 = 0f;

        if ((this.enemyHand && (f < 0f)) || (!this.enemyHand && (f > 0f)))
        {
            num8 = (Mathf.Sin((Mathf.Abs(f) * 3.141593f) / 180f) * this.GetCardSpacing()) / 2f;
        }
        float x = this.centerOfHand.x - ((this.GetCardSpacing() / 2f) * ((count - 1) - (num * 2)));

        if (this.m_handEnlarged && this.m_targetingMode)
        {
            if ((count % 2) > 0)
            {
                if (num < ((count + 1) / 2))
                {
                    x -= this.m_heroWidthInHand;
                }
            }
            else if (num < (count / 2))
            {
                x -= this.m_heroWidthInHand / 2f;
            }
            else
            {
                x += this.m_heroWidthInHand / 2f;
            }
        }
        float y = this.centerOfHand.y;
        float z = this.centerOfHand.z;

        if (count > 1)
        {
            if (this.enemyHand)
            {
                z += ((Mathf.Pow((float)Mathf.Abs((int)(num - (count / 2))), 2f) / ((float)(4 * count))) * num4) + num8;
            }
            else
            {
                z = (this.centerOfHand.z - ((Mathf.Pow((float)Mathf.Abs((int)(num - (count / 2))), 2f) / ((float)(4 * count))) * num4)) - num8;
            }
        }
        if (this.enemyHand && SpectatorManager.Get().IsSpectatingOpposingSide())
        {
            z -= 0.2f;
        }
        return(new Vector3(x, y, z));
    }
 private bool CheckCriticalAssetLoads()
 {
     if (!this.m_criticalAssetsLoaded)
     {
         if (Board.Get() == null)
         {
             return(false);
         }
         if (BoardCameras.Get() == null)
         {
             return(false);
         }
         if (BoardStandardGame.Get() == null)
         {
             return(false);
         }
         if (GameMgr.Get().IsTutorial() && (BoardTutorial.Get() == null))
         {
             return(false);
         }
         if (MulliganManager.Get() == null)
         {
             return(false);
         }
         if (TurnStartManager.Get() == null)
         {
             return(false);
         }
         if (TargetReticleManager.Get() == null)
         {
             return(false);
         }
         if (GameplayErrorManager.Get() == null)
         {
             return(false);
         }
         if (EndTurnButton.Get() == null)
         {
             return(false);
         }
         if (BigCard.Get() == null)
         {
             return(false);
         }
         if (CardTypeBanner.Get() == null)
         {
             return(false);
         }
         if (TurnTimer.Get() == null)
         {
             return(false);
         }
         if (CardColorSwitcher.Get() == null)
         {
             return(false);
         }
         if (RemoteActionHandler.Get() == null)
         {
             return(false);
         }
         if (ChoiceCardMgr.Get() == null)
         {
             return(false);
         }
         if (InputManager.Get() == null)
         {
             return(false);
         }
         this.m_criticalAssetsLoaded = true;
         this.ProcessQueuedPowerHistory();
     }
     return(true);
 }
Example #12
0
    private void OnFriendlyPlayerTagChanged(TagDelta change)
    {
        GAME_TAG tag = (GAME_TAG)change.tag;

        switch (tag)
        {
        case GAME_TAG.CURRENT_SPELLPOWER:
            break;

        case GAME_TAG.TEMP_RESOURCES:
        {
            int num  = change.oldValue - this.m_usedTempMana;
            int num2 = change.newValue - change.oldValue;
            if (num2 < 0)
            {
                this.m_usedTempMana += num2;
            }
            if (this.m_usedTempMana < 0)
            {
                this.m_usedTempMana = 0;
            }
            if (num < 0)
            {
                num = 0;
            }
            int numCrystals = (change.newValue - num) - this.m_usedTempMana;
            if (numCrystals > 0)
            {
                this.AddTempManaCrystal(numCrystals);
            }
            else
            {
                this.DestroyTempManaCrystal(-numCrystals);
            }
            return;
        }

        case GAME_TAG.OVERLOAD_OWED:
            this.HandleSameTurnOverloadChanged(change.newValue - change.oldValue);
            return;

        case GAME_TAG.CURRENT_PLAYER:
            if (change.newValue == 1)
            {
                ManaCrystalMgr.Get().OnCurrentPlayerChanged();
                this.m_queuedSpentMana = 0;
                if (GameState.Get().IsMainPhase())
                {
                    TurnStartManager.Get().BeginListeningForTurnEvents();
                }
            }
            return;

        case GAME_TAG.RESOURCES_USED:
        {
            int num4 = change.oldValue + this.m_queuedSpentMana;
            int num5 = change.newValue - change.oldValue;
            if (num5 > 0)
            {
                this.m_queuedSpentMana -= num5;
            }
            if (this.m_queuedSpentMana < 0)
            {
                this.m_queuedSpentMana = 0;
            }
            int shownChangeAmount = (change.newValue - num4) + this.m_queuedSpentMana;
            ManaCrystalMgr.Get().UpdateSpentMana(shownChangeAmount);
            return;
        }

        case GAME_TAG.RESOURCES:
            if (change.newValue <= change.oldValue)
            {
                this.DestroyManaCrystal(change.oldValue - change.newValue);
                return;
            }
            if (!GameState.Get().IsTurnStartManagerActive() || !this.IsFriendlySide())
            {
                this.AddManaCrystal(change.newValue - change.oldValue);
                return;
            }
            TurnStartManager.Get().NotifyOfManaCrystalGained(change.newValue - change.oldValue);
            return;

        default:
            switch (tag)
            {
            case GAME_TAG.SPELLPOWER_DOUBLE:
            case GAME_TAG.HEALING_DOUBLE:
                break;

            case GAME_TAG.MULLIGAN_STATE:
                if ((change.newValue == 4) && (MulliganManager.Get() == null))
                {
                    foreach (Card card in this.GetHandZone().GetCards())
                    {
                        card.GetActor().TurnOnCollider();
                    }
                }
                return;

            default:
                if ((tag == GAME_TAG.OVERLOAD_LOCKED) && (change.newValue < change.oldValue))
                {
                    this.UnlockCrystals(change.oldValue - change.newValue);
                }
                return;
            }
            break;
        }
        List <Card> cards = this.GetHandZone().GetCards();

        for (int i = 0; i < cards.Count; i++)
        {
            if (cards[i].GetEntity().IsSpell())
            {
                cards[i].GetActor().UpdatePowersText();
            }
        }
    }
Example #13
0
    private bool DoTaskListWithSpellController(GameState state, PowerTaskList taskList, Entity sourceEntity)
    {
        Network.HistActionStart sourceAction = taskList.GetSourceAction();
        switch (sourceAction.BlockType)
        {
        case HistoryBlock.Type.ATTACK:
        {
            AttackSpellController spellController = this.CreateAttackSpellController(taskList);
            if (!this.DoTaskListUsingController(spellController, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(spellController);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.POWER:
        {
            PowerSpellController controller2 = this.CreatePowerSpellController(taskList);
            if (!this.DoTaskListUsingController(controller2, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller2);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.TRIGGER:
            if (sourceEntity.IsSecret())
            {
                SecretSpellController controller3 = this.CreateSecretSpellController(taskList);
                if (!this.DoTaskListUsingController(controller3, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
                {
                    this.DestroySpellController(controller3);
                    return(false);
                }
            }
            else
            {
                TriggerSpellController controller4 = this.CreateTriggerSpellController(taskList);
                Card card = sourceEntity.GetCard();
                if (TurnStartManager.Get().IsCardDrawHandled(card))
                {
                    if (!controller4.AttachPowerTaskList(taskList))
                    {
                        this.DestroySpellController(controller4);
                        return(false);
                    }
                    controller4.AddFinishedTaskListCallback(new SpellController.FinishedTaskListCallback(this.OnSpellControllerFinishedTaskList));
                    controller4.AddFinishedCallback(new SpellController.FinishedCallback(this.OnSpellControllerFinished));
                    TurnStartManager.Get().NotifyOfSpellController(controller4);
                }
                else if (!this.DoTaskListUsingController(controller4, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
                {
                    this.DestroySpellController(controller4);
                    return(false);
                }
            }
            return(true);

        case HistoryBlock.Type.DEATHS:
        {
            DeathSpellController controller5 = this.CreateDeathSpellController(taskList);
            if (!this.DoTaskListUsingController(controller5, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller5);
                return(false);
            }
            return(true);
        }

        case HistoryBlock.Type.FATIGUE:
        {
            FatigueSpellController controller6 = this.CreateFatigueSpellController(taskList);
            if (!controller6.AttachPowerTaskList(taskList))
            {
                this.DestroySpellController(controller6);
                return(false);
            }
            controller6.AddFinishedTaskListCallback(new SpellController.FinishedTaskListCallback(this.OnSpellControllerFinishedTaskList));
            controller6.AddFinishedCallback(new SpellController.FinishedCallback(this.OnSpellControllerFinished));
            if (state.IsTurnStartManagerActive())
            {
                TurnStartManager.Get().NotifyOfSpellController(controller6);
            }
            else
            {
                controller6.DoPowerTaskList();
            }
            return(true);
        }

        case HistoryBlock.Type.JOUST:
        {
            JoustSpellController controller7 = this.CreateJoustSpellController(taskList);
            if (!this.DoTaskListUsingController(controller7, taskList, new SpellController.FinishedCallback(this.OnSpellControllerFinished)))
            {
                this.DestroySpellController(controller7);
                return(false);
            }
            return(true);
        }
        }
        object[] args = new object[] { sourceAction.BlockType, sourceEntity };
        Log.Power.Print("PowerProcessor.DoTaskListForCard() - actionStart has unhandled BlockType {0} for sourceEntity {1}", args);
        return(false);
    }