Esempio n. 1
0
        public List <short> GetSpellRange(short characterCellId, SpellLevels spellLevel)
        {
            List <short> range = new List <short>();

            foreach (var mp in SpellShapes.GetSpellRange(characterCellId, spellLevel, _account.Game.Character.Stats.Range.Total))
            {
                if (mp == null || range.Contains(mp.CellId))
                {
                    continue;
                }

                if (spellLevel.NeedFreeCell && OccupiedCells.Contains(mp.CellId))
                {
                    continue;
                }

                if ((_account.Game.Map.Data.Cells[mp.CellId].l & 7) == 3)
                {
                    range.Add(mp.CellId);
                }
            }

            if (spellLevel.CastTestLos)
            {
                for (int i = range.Count - 1; i >= 0; i--)
                {
                    if (Dofus1Line.IsLineObstructed(_account.Game.Map.Data, characterCellId, range[i], OccupiedCells, spellLevel.CastInDiagonal))
                    {
                        range.RemoveAt(i);
                    }
                }
            }

            return(range);
        }
Esempio n. 2
0
    private void Update()
    {
        if (Mock)
        {
            _pos    = new Vector2(1 - (Input.mousePosition.x / (float)Screen.width), 1 - (Input.mousePosition.y / (float)Screen.height));
            _newPos = true;
        }

        if (!_spellActive && Input.GetKeyDown(KeyCode.Space))
        {
            if (_lineState.Equals(LineState.Pointing))
            {
                _pointer.gameObject.SetActive(false);
                _magicPoint.enabled = false;
                _magicLine.enabled  = true;
                ResetLines();
                _lineState = LineState.Drawing;
            }
            else
            {
                _spellActive = true;
                _savePhoto   = true;
            }
        }

        if (_newPos)
        {
            _newPos            = false;
            _magicPos.position = ConvertPctToMagicSpace(_pos);
            if (!_spellActive)
            {
                if (_lineState.Equals(LineState.Pointing))
                {
                    _pointer.position = ConvertPctToCNNSpace(_pos);
                }
                else
                {
                    _lineRenderer.positionCount++;
                    _lineRenderer.SetPosition(_lineRenderer.positionCount - 1, ConvertPctToCNNSpace(_pos));
                    _magicLine.positionCount++;
                    _magicLine.SetPosition(_lineRenderer.positionCount - 1, ConvertPctToMagicSpace(_pos));
                }
            }
        }

        if (_tcpClient.newData)
        {
            Debug.Log("Shape is: " + _tcpClient.recievedData);
            _shape             = (SpellShapes)int.Parse(_tcpClient.recievedData);
            _tcpClient.newData = false;
            StartCoroutine(CastSpell());
        }
    }
Esempio n. 3
0
        public List <MapPoint> GetSpellZone(int spellId, short fromCellId, short targetCellId, SpellLevels spellLevel = null)
        {
            if (spellLevel == null)
            {
                var spellEntry = _account.Game.Character.GetSpell(spellId);

                if (spellEntry == null)
                {
                    return(null);
                }

                var spell = DataManager.Get <Spells>(spellId);

                if (spell == null)
                {
                    return(null);
                }

                spellLevel = DataManager.Get <SpellLevels>(spell.SpellLevels[spellEntry.Level - 1]);
            }

            return(SpellShapes.GetSpellEffectZone(_account.Game.Map.Data, spellLevel, fromCellId, targetCellId));
        }