Esempio n. 1
0
 public void Cancel(bool force, ushort messageCode = 0)
 {
     if (_abilityProcessor != null && _abilityProcessor.HasInfo())
     {
         _abilityProcessor.CancelCast(messageCode, force);
     }
 }
Esempio n. 2
0
        public void Update(long tick)
        {
            // Target is dead.
            if (_target.IsDead)
            {
                SendChannelEnd();
                _channelInfo = null;
                _channelBuff = null;
                _parent.NotifyChannelEnded();
            }

            // Cast finishes
            if (_channelInfo != null)
            {
                if (TCPManager.GetTimeStampMS() >= _channelStartTime + _channelInfo.CastTime)
                {
                    SendChannelEnd();
                    _parent.NotifyChannelEnded();
                    _channelInfo = null;
                    _channelBuff = null;
                }

                else if (TCPManager.GetTimeStampMS() >= _nextTickTime)
                {
                    if (_channelInfo.ApCost > 0 && !_host.ConsumeActionPoints(_channelInfo.ApCost))
                    {
                        _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_AP);
                    }
                    else if (_playerHost != null && _channelInfo.SpecialCost > 3 && !_playerHost.CrrInterface.ConsumeResource((byte)_channelInfo.SpecialCost, true))
                    {
                        _parent.CancelCast(1);
                    }
                    else if (_target != _host && !_host.IsInCastRange(_target, Math.Max((uint)25, _channelInfo.Range)))
                    {
                        _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_OUTOFRANGE);
                    }
                    else if (_checkVisibility && !_host.LOSHit(_target))
                    {
                        _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_NOT_VISIBLE);
                    }
                    else
                    {
                        _nextTickTime += 1000;
                    }
                }
            }
        }