Пример #1
0
 public void onEquipEvent(NPC n)
 {
     if (onEquip != null)
     {
         onEquip.Activate(n);
     }
 }
    private void SpawnImpactSpell(GameObject targetObject)
    {
        Spell component = ((GameObject)UnityEngine.Object.Instantiate(this.m_ImpactSpellPrefab.gameObject, targetObject.transform.position, Quaternion.identity)).GetComponent <Spell>();

        component.AddStateFinishedCallback(new Spell.StateFinishedCallback(this.OnImpactSpellStateFinished));
        component.Activate();
    }
Пример #3
0
 public void onHitEvent(NPC n)
 {
     if (onHit != null)
     {
         onHit.Activate(n);
     }
 }
Пример #4
0
 public void onEatenEvent(NPC n)
 {
     if (onEaten != null)
     {
         onEaten.Activate(n, this);
     }
     n.removeFromInventory(this);
 }
Пример #5
0
 public void onUseEvent(NPC n)
 {
     if (onUse != null)
     {
         onUse.Activate(n);
     }
     //if usage needs restricted, change that here
 }
Пример #6
0
    private void ChangeMode_Tutorial()
    {
        Enum[] args = new Enum[] { PresenceStatus.TUTORIAL_PREGAME };
        PresenceMgr.Get().SetStatus(args);
        Box.Get().SetLightState(BoxLightStateType.TUTORIAL);
        Spell eventSpell = Box.Get().GetEventSpell(BoxEventType.STARTUP_TUTORIAL);

        eventSpell.AddFinishedCallback(new Spell.FinishedCallback(this.OnStartupTutorialSpellFinished));
        eventSpell.Activate();
    }
Пример #7
0
    void OnMouseUp()
    {
        slot.GetComponent <Image>().sprite = slot_sprite;

        if (!_combatManager.isPaused && _gameManager.current_screen.name == "Combat_screen_UI" && spell_id != 0)
        {
            GameObject.Find("Spell_preview").GetComponent <Spell_preview_script>().closeSpellPreview();

            if (_combatManager.getRound() == battleRound.Player)
            {
                slot.GetComponent <Image>().sprite = slot_sprite_activated;
                if ((spell.resource_cost <= _characterStats.Player_resource))
                {
                    if (spell.type == spell_types.damage && _spellScript.target != null)
                    {
                        spell.Activate(_spellScript.target);
                        _combatManager.changeRound();
                    }
                    else if (spell.type == spell_types.heal || spell.type == spell_types.support)
                    {
                        spell.Activate(_spellScript.target);
                        _combatManager.changeRound();
                    }
                    else
                    {
                        _notification.message("You need a <b>target</b> first!", 3, "red");
                    }

                    //
                    //GameObject.Find("Health_bar").GetComponent<Bar_script>().updateHealth();
                    //GameObject.Find("Resource_bar").GetComponent<Bar_script>().updateResource();
                }
                else
                {
                    _notification.message("You don't have enough energy to use <b>that!", 3, "red");
                }
            }
            else
            {
                _notification.message("it's not your turn!", 3, "red");
            }
        }
    }
Пример #8
0
 public void Activate()
 {
     // if( rootMagicCircle != null )
     // {
     //     rootMagicCircle.Activate();
     // }
     if (spell != null)
     {
         spell.Activate();
     }
 }
    protected override void OnAction(SpellStateType prevStateType)
    {
        base.m_effectsPendingFinish++;
        base.OnAction(prevStateType);
        Card  sourceCard = base.GetSourceCard();
        Spell prefab     = this.DetermineRangePrefab(sourceCard.GetEntity().GetATK());
        Spell spell2     = base.CloneSpell(prefab);

        spell2.SetSource(sourceCard.gameObject);
        spell2.Activate();
        base.m_effectsPendingFinish--;
        base.FinishIfPossible();
    }
    private void OnPullLeverSpellFinished(Spell spell, object userData)
    {
        Spell impactSpell = this.GetAngleDef().m_ImpactSpell;

        if (impactSpell == null)
        {
            this.m_leverEffectsActive = false;
        }
        else
        {
            impactSpell.AddFinishedCallback(new Spell.FinishedCallback(this.OnImpactSpellFinished));
            impactSpell.Activate();
        }
    }
Пример #11
0
    private void CastSpellIfPossible()
    {
        if (!Game.instance.InDungeon())
        {
            return;
        }

        Spell spell = GetComponentInChildren <Spell>();

        if (spell != null && spell.canActivate)
        {
            spell.Activate(gameObject);
        }

        if (HasFollower())
        {
            spell = follower.GetComponentInChildren <Spell>();
            if (spell != null && spell.canActivate)
            {
                spell.Activate(gameObject);
            }
        }
    }
Пример #12
0
    private void PlayReminders(List <Card> cards)
    {
        int  num;
        Card card;

        do
        {
            num  = UnityEngine.Random.Range(0, cards.Count);
            card = cards[num];
        }while (this.m_cardsWaitingToRemind.Contains(card));
        for (int i = 0; i < cards.Count; i++)
        {
            Card  item       = cards[i];
            Spell actorSpell = item.GetActorSpell(SpellType.WIGGLE);
            if (((actorSpell != null) && (actorSpell.GetActiveState() == SpellStateType.NONE)) && !this.m_cardsWaitingToRemind.Contains(item))
            {
                if (i == num)
                {
                    actorSpell.Activate();
                }
                else
                {
                    float objA = UnityEngine.Random.Range(0f, this.m_MaxDelaySec);
                    if (object.Equals(objA, 0f))
                    {
                        actorSpell.Activate();
                    }
                    else
                    {
                        this.m_cardsWaitingToRemind.Add(item);
                        base.StartCoroutine(this.WaitAndPlayReminder(item, actorSpell, objA));
                    }
                }
            }
        }
    }
Пример #13
0
    private void ActivateImpactEffects(Card sourceCard, Card targetCard)
    {
        Spell original = this.DetermineImpactSpellPrefab(sourceCard);

        if (original != null)
        {
            Spell spell2 = UnityEngine.Object.Instantiate <Spell>(original);
            spell2.SetSource(sourceCard.gameObject);
            spell2.AddTarget(targetCard.gameObject);
            Vector3 position = targetCard.transform.position;
            spell2.SetPosition(position);
            Quaternion orientation = Quaternion.LookRotation(this.m_sourceToTarget);
            spell2.SetOrientation(orientation);
            spell2.AddStateFinishedCallback(new Spell.StateFinishedCallback(this.OnImpactSpellStateFinished));
            spell2.Activate();
        }
    }
Пример #14
0
 private void ChangeMode_Hub()
 {
     if (Options.Get().GetBool(Option.HAS_SEEN_HUB, false))
     {
         SoundManager.Get().LoadAndPlay("VO_INNKEEPER_INTRO_01");
     }
     if (this.ShouldDoIntro())
     {
         Spell eventSpell = Box.Get().GetEventSpell(BoxEventType.STARTUP_HUB);
         eventSpell.AddFinishedCallback(new Spell.FinishedCallback(this.OnStartupHubSpellFinished));
         eventSpell.Activate();
     }
     else
     {
         this.DoSkippedBoxIntro();
         base.StartCoroutine(this.ShowUnAckedRewardsAndQuests());
     }
 }
Пример #15
0
 public bool ActivateSpell(Spell spell, params object[] targets)
 {
     if (spell.CanActivate())
     {
         if (spell.Activate(targets))
         {
             _game.TurnPlayer.Hand.Cards.Remove(spell);
             spell.Location = CardLocation.SpellTrapZone;
             spell.Position = CardPosition.FaceUp;
             return(spell.Resolve(targets));
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #16
0
 private void OnFatigueDamageFinished(Spell spell, object userData)
 {
     spell.RemoveFinishedCallback(new Spell.FinishedCallback(this.OnFatigueDamageFinished));
     if (this.m_fatigueActor == null)
     {
         base.OnFinishedTaskList();
     }
     else
     {
         Spell spell2 = this.m_fatigueActor.GetSpell(SpellType.DEATH);
         if (spell2 == null)
         {
             base.OnFinishedTaskList();
         }
         else
         {
             Actor fatigueActor = this.m_fatigueActor;
             this.m_fatigueActor = null;
             spell2.AddStateFinishedCallback(new Spell.StateFinishedCallback(this.OnFatigueDeathSpellFinished), fatigueActor);
             spell2.Activate();
             base.OnFinishedTaskList();
         }
     }
 }
Пример #17
0
 public virtual void CastSpell(Spell spell, params IAffectable[] targets)
 {
     spell.Activate(this, targets);
     AdjustPower(-spell.cost);
 }