public bool is_blocked(Vector2 loc, int id, bool fow) { if (is_off_map(loc)) { #if DEBUG Print.message("immoissubke location[" + loc.X.ToString() + ", " + loc.Y.ToString() + "]"); #endif return(true); } Game_Unit unit = get_unit(loc); // Falsely returns that no unit is at this tile if the unit can't see it if (unit != null) { if (fow && !unit.visible_by(this.units[id].team)) { unit = null; } } // If there is a unit here and it's not the tested one if (unit != null && unit.id != id) { return(true); } // Block moving onto light runes if (get_light_rune(loc) != null) { return(true); } return(false); }
protected void add_enemy_ranges(int id, Dictionary <Vector2, int> attack, Dictionary <Vector2, int> staff) { Game_Unit enemy = this.units[id]; if (!enemy.visible_by()) { return; } foreach (Vector2 loc in enemy.attack_range) { if (!attack.ContainsKey(loc)) { attack.Add(loc, 0); } } foreach (Vector2 loc in enemy.staff_range) { if (!staff.ContainsKey(loc)) { staff.Add(loc, 0); } } }