Esempio n. 1
0
    private void DoFinishFatigue()
    {
        Spell spell = base.GetSource().GetActor().GetSpell(SpellType.FATIGUE_DEATH);

        spell.AddFinishedCallback(new Spell.FinishedCallback(this.OnFatigueDamageFinished));
        spell.ActivateState(SpellStateType.BIRTH);
    }
 private bool InitPowerSpell(Card card, Spell spell)
 {
     if (spell == null)
     {
         return(false);
     }
     if (!spell.HasUsableState(SpellStateType.ACTION))
     {
         object[] args = new object[] { base.name, spell, card, SpellStateType.ACTION };
         Log.Power.PrintWarning("{0}.InitPowerSpell() - spell {1} for Card {2} has no {3} state", args);
         return(false);
     }
     if (!spell.AttachPowerTaskList(base.m_taskList))
     {
         object[] objArray2 = new object[] { base.name, spell, card };
         Log.Power.Print("{0}.InitPowerSpell() - FAILED to attach task list to spell {1} for Card {2}", objArray2);
         return(false);
     }
     if (spell.GetActiveState() != SpellStateType.NONE)
     {
         spell.ActivateState(SpellStateType.NONE);
     }
     this.m_powerSpell = spell;
     this.m_cardEffectsBlockingFinish++;
     this.m_cardEffectsBlockingTaskListFinish++;
     return(true);
 }
Esempio n. 3
0
 protected override void OnRelease()
 {
     if (!this.IsTransactionPendingOnThisCard())
     {
         if (UniversalInputManager.Get().IsTouchMode() || ((CraftingTray.Get() != null) && CraftingTray.Get().IsShown()))
         {
             this.CheckCardSeen();
             this.m_actor.SetActorState(ActorStateType.CARD_IDLE);
             this.EnterCraftingMode();
         }
         else
         {
             Spell spell = this.m_actor.GetSpell(SpellType.DEATHREVERSE);
             if (!this.CanPickUpCard())
             {
                 SoundManager.Get().LoadAndPlay("collection_manager_card_move_invalid_or_click");
                 if (spell != null)
                 {
                     spell.ActivateState(SpellStateType.BIRTH);
                 }
                 EntityDef entityDef = this.m_actor.GetEntityDef();
                 bool      isHero    = (entityDef != null) && entityDef.IsHero();
                 CollectionManagerDisplay.Get().ShowInnkeeeprLClickHelp(isHero);
             }
             else if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS)
             {
                 EntityDef cardEntityDef = this.m_actor.GetEntityDef();
                 if (cardEntityDef != null)
                 {
                     if (spell != null)
                     {
                         spell.ActivateState(SpellStateType.BIRTH);
                     }
                     CollectionDeckTray.Get().AddCard(cardEntityDef, this.m_actor.GetCardFlair(), null, false, this.m_actor);
                 }
             }
             else if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS)
             {
                 CollectionDeckTray.Get().SetCardBack(this.m_actor);
             }
             else if (this.m_visualType == CollectionManagerDisplay.ViewMode.HERO_SKINS)
             {
                 CollectionDeckTray.Get().SetHeroSkin(this.m_actor);
             }
         }
     }
 }
    private void DisplaySkullOnActor(Actor actor)
    {
        Spell spell = actor.GetSpell(SpellType.SKULL);

        if (spell != null)
        {
            spell.ActivateState(SpellStateType.IDLE);
        }
    }
 public void OnSpellPowerEntityMousedOut()
 {
     foreach (Card card in base.m_cards)
     {
         Spell actorSpell = card.GetActorSpell(SpellType.SPELL_POWER_HINT_IDLE);
         if ((actorSpell != null) && actorSpell.IsActive())
         {
             actorSpell.ActivateState(SpellStateType.DEATH);
         }
     }
 }
Esempio n. 6
0
 public void WipeZzzs()
 {
     foreach (Card card in this.GetBattlefieldZone().GetCards())
     {
         Spell actorSpell = card.GetActorSpell(SpellType.Zzz);
         if (actorSpell != null)
         {
             actorSpell.ActivateState(SpellStateType.DEATH);
         }
     }
 }
Esempio n. 7
0
    public void UpdateVisual(bool isOverDeck)
    {
        Actor     activeActor = this.m_activeActor;
        SpellType nONE        = SpellType.NONE;

        if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS)
        {
            if ((isOverDeck && (this.m_entityDef != null)) && !this.m_entityDef.IsHero())
            {
                this.m_activeActor = this.m_deckTile;
                nONE = SpellType.SUMMON_IN;
            }
            else
            {
                this.m_activeActor = this.m_cardActor;
                nONE = SpellType.DEATHREVERSE;
            }
        }
        else
        {
            this.m_activeActor = this.m_cardActor;
            nONE = SpellType.DEATHREVERSE;
        }
        if (activeActor != this.m_activeActor)
        {
            if (activeActor != null)
            {
                activeActor.Hide();
                activeActor.gameObject.SetActive(false);
            }
            if (this.m_activeActor != null)
            {
                this.m_activeActor.gameObject.SetActive(true);
                this.m_activeActor.Show();
                if ((this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS) && (this.m_currentCardBack != null))
                {
                    CardBackManager.Get().UpdateCardBack(this.m_activeActor, this.m_currentCardBack);
                }
                Spell spell = this.m_activeActor.GetSpell(nONE);
                if (spell != null)
                {
                    spell.ActivateState(SpellStateType.BIRTH);
                }
                if ((this.m_entityDef != null) && this.m_entityDef.IsHero())
                {
                    CollectionHeroSkin component = this.m_activeActor.gameObject.GetComponent <CollectionHeroSkin>();
                    component.SetClass(this.m_entityDef.GetClass());
                    component.ShowSocketFX();
                }
            }
        }
    }
Esempio n. 8
0
    private void OnSourceAttackStateStarted(Spell spell, SpellStateType prevStateType, object userData)
    {
        switch (spell.GetActiveState())
        {
        case SpellStateType.IDLE:
            spell.ActivateState(SpellStateType.ACTION);
            break;

        case SpellStateType.ACTION:
            spell.RemoveStateStartedCallback(new Spell.StateStartedCallback(this.OnSourceAttackStateStarted));
            this.LaunchAttack();
            break;
        }
    }
Esempio n. 9
0
    private void AllDone()
    {
        Vector3 zero = Vector3.zero;

        for (int i = 0; i < this.m_RewardPackages.Count; i++)
        {
            RewardPackageData data = this.m_RewardPackages[i];
            zero += data.m_TargetBone.position;
        }
        this.m_DoneButton.transform.position = (Vector3)(zero / ((float)this.m_RewardPackages.Count));
        this.m_DoneButton.gameObject.SetActive(true);
        this.m_DoneButton.SetText(GameStrings.Get("GLOBAL_DONE"));
        Spell component = this.m_DoneButton.m_button.GetComponent <Spell>();

        component.AddFinishedCallback(new Spell.FinishedCallback(this.OnDoneButtonShown));
        component.ActivateState(SpellStateType.BIRTH);
    }
Esempio n. 10
0
    private bool OnNavigateBack()
    {
        UnityEngine.Debug.Log("navigating back!");
        if (!this.m_DoneButton.m_button.activeSelf)
        {
            return(false);
        }
        foreach (GameObject obj2 in this.m_RewardObjects)
        {
            if (obj2 != null)
            {
                PlayMakerFSM rfsm = obj2.GetComponent <PlayMakerFSM>();
                if (rfsm != null)
                {
                    rfsm.SendEvent("Death");
                }
                foreach (UberText text in obj2.GetComponentsInChildren <UberText>())
                {
                    object[] args = new object[] { "alpha", 0f, "time", 0.8f, "includechildren", true, "easetype", iTween.EaseType.easeInOutCubic };
                    iTween.FadeTo(text.gameObject, iTween.Hash(args));
                }
                RewardCard componentInChildren = obj2.GetComponentInChildren <RewardCard>();
                if (componentInChildren != null)
                {
                    componentInChildren.Death();
                }
            }
        }
        SceneUtils.EnableColliders(this.m_DoneButton.gameObject, false);
        this.m_DoneButton.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnDoneButtonPressed));
        Spell component = this.m_DoneButton.m_button.GetComponent <Spell>();

        component.AddFinishedCallback(new Spell.FinishedCallback(this.OnDoneButtonHidden));
        component.ActivateState(SpellStateType.DEATH);
        CollectionManager.Get().RemoveAchievesCompletedListener(new CollectionManager.DelOnAchievesCompleted(this.OnCollectionAchievesCompleted));
        if (this.m_addRewardsToCacheValues)
        {
            this.AddRewardsToCacheValues();
        }
        return(true);
    }
 public void CancelSubOptions()
 {
     if (this.HasSubOption())
     {
         Spell playSpell = this.m_subOptionState.m_parentCard.GetPlaySpell(true);
         if (playSpell != null)
         {
             SpellStateType activeState = playSpell.GetActiveState();
             if ((activeState != SpellStateType.NONE) && (activeState != SpellStateType.CANCEL))
             {
                 playSpell.ActivateState(SpellStateType.CANCEL);
             }
         }
         Entity entity = this.m_subOptionState.m_parentCard.GetEntity();
         if (entity.IsHeroPower())
         {
             entity.SetTagAndHandleChange <int>(GAME_TAG.EXHAUSTED, 0);
         }
         this.HideSubOptions(null);
     }
 }
Esempio n. 12
0
    private void CancelSpellsForEarlyConcede(PowerTaskList taskList)
    {
        Entity sourceEntity = taskList.GetSourceEntity();

        if (sourceEntity != null)
        {
            Card card = sourceEntity.GetCard();
            if ((card != null) && (taskList.GetSourceAction().BlockType == HistoryBlock.Type.POWER))
            {
                Spell playSpell = card.GetPlaySpell(true);
                if (playSpell != null)
                {
                    SpellStateType activeState = playSpell.GetActiveState();
                    if ((activeState != SpellStateType.NONE) && (activeState != SpellStateType.CANCEL))
                    {
                        playSpell.ActivateState(SpellStateType.CANCEL);
                    }
                }
            }
        }
    }
 public void OnSpellPowerEntityMousedOver()
 {
     if (!TargetReticleManager.Get().IsActive())
     {
         foreach (Card card in base.m_cards)
         {
             if (this.CanPlaySpellPowerHint(card))
             {
                 Spell actorSpell = card.GetActorSpell(SpellType.SPELL_POWER_HINT_BURST);
                 if (actorSpell != null)
                 {
                     actorSpell.Reactivate();
                 }
                 Spell spell2 = card.GetActorSpell(SpellType.SPELL_POWER_HINT_IDLE);
                 if (spell2 != null)
                 {
                     spell2.ActivateState(SpellStateType.BIRTH);
                 }
             }
         }
     }
 }
Esempio n. 14
0
    private void SetCardBack(GameObject go, bool overriden, bool assigning)
    {
        GameUtils.SetParent(go, this.m_cardBackContainer, true);
        Actor component = go.GetComponent <Actor>();

        if (component == null)
        {
            UnityEngine.Object.Destroy(go);
        }
        else
        {
            if (assigning)
            {
                Spell spell = component.GetSpell(SpellType.DEATHREVERSE);
                if (spell != null)
                {
                    spell.ActivateState(SpellStateType.BIRTH);
                }
            }
            if (this.m_currentCardBack != null)
            {
                UnityEngine.Object.Destroy(this.m_currentCardBack);
            }
            this.m_currentCardBack = go;
            GameObject cardMesh = component.m_cardMesh;
            component.SetCardbackUpdateIgnore(true);
            component.SetUnlit();
            this.UpdateMissingEffect(component, overriden);
            if (cardMesh != null)
            {
                Material material = cardMesh.GetComponent <Renderer>().material;
                if (material.HasProperty("_SpecularIntensity"))
                {
                    material.SetFloat("_SpecularIntensity", 0f);
                }
            }
        }
    }