public static int Flee(Character ch, int cur, int from, bool[] pass, bool[] visible) { if (ch.Flying) { BArray.or(pass, Level.avoid, Passable); } else { Array.Copy(pass, 0, Passable, 0, Level.Length); } foreach (var pos in Actor.All.OfType <Character>().Select(c => c.pos).Where(pos => visible[pos])) { Passable[pos] = false; } Passable[cur] = true; return(PathFinder.GetStepBack(cur, from, Passable)); }
public static int FindPath(Character ch, int from, int to, bool[] pass, bool[] visible) { if (Level.Adjacent(from, to)) { return(Actor.FindChar(to) == null && (pass[to] || Level.avoid[to]) ? to : -1); } if (ch.Flying || ch.Buff <Amok>() != null) { BArray.or(pass, Level.avoid, Passable); } else { Array.Copy(pass, 0, Passable, 0, Level.Length); } foreach (int pos in Actor.All.OfType <Character>().Select(actor => (actor).pos).Where(pos => visible[pos])) { Passable[pos] = false; } return(PathFinder.GetStep(from, to, Passable)); }