예제 #1
0
        public bool CanReach(TargetCell target, Spell spell, out Cell castCell)
        {
            bool nearFirst     = true;
            var  targetPoint   = new MapPoint(target.Cell);
            var  spellRange    = Fighter.GetSpellRange(spell.CurrentSpellLevel);
            var  minSpellRange = spell.CurrentSpellLevel.MinRange;
            var  dist          = targetPoint.ManhattanDistanceTo(Fighter.Position.Point);
            var  diff          = spellRange - dist;

            if (diff >= 0 && dist >= minSpellRange &&
                (target.Direction == DirectionFlagEnum.ALL_DIRECTIONS || target.Direction == DirectionFlagEnum.NONE ||
                 (Fighter.Position.Point.OrientationTo(targetPoint).GetFlag() & target.Direction) != 0) &&
                Fighter.IsInCastZone(spell.CurrentSpellLevel, Fighter.Position.Point, target.Cell))
            {
                castCell = Fighter.Cell;
                return(true);
            }

            // reachable
            if (-diff <= Fighter.MP)
            {
                castCell = m_environment.GetCellToCastSpell(target, spell, spell.CurrentSpellLevel.CastTestLos, nearFirst);
                return(castCell != null);
            }


            castCell = null;
            return(false);
        }
예제 #2
0
 protected bool Equals(TargetCell other)
 {
     return(Equals(Cell, other.Cell) && Direction == other.Direction);
 }