Esempio n. 1
0
        public SpellCastResult ValidateSpellCast(DefaultEntityActorStateContainer state, int spellId)
        {
            if (PendingSpellCastMappable.ContainsKey(state.EntityGuid))
            {
                PendingSpellCastData pendingCast = PendingSpellCastMappable.RetrieveEntity(state.EntityGuid);

                if (!pendingCast.IsSpellcastFinished(TimeService.CurrentLocalTime))
                {
                    return(SpellCastResult.SPELL_FAILED_SPELL_IN_PROGRESS);
                }
            }

            return(SpellCastResult.SPELL_FAILED_SUCCESS);
        }
Esempio n. 2
0
        protected override void HandleMessage(EntityActorMessageContext messageContext, DefaultEntityActorStateContainer state, PlayerMovementStateChangedMessage message)
        {
            //If we started moving then we should check the current spell cast.
            if (message.isMoving)
            {
                if (PendingSpellCastMappable.ContainsKey(state.EntityGuid))
                {
                    PendingSpellCastData castData = PendingSpellCastMappable.RetrieveEntity(state.EntityGuid);

                    if (castData.isInstantCast || castData.isCastCanceled || castData.IsSpellcastFinished(TimeService.CurrentLocalTime))
                    {
                        return;
                    }

                    //Ok, so we're casting and moving. Let's cancel the cast.
                    messageContext.Entity.TellSelf(new CancelSpellCastMessage());
                }
            }
        }