protected List <int> get_targets() { Game_Unit unit = get_unit(); List <int> temp_targets = new List <int>(); switch (Mode) { // Looking for people to rescue case 0: List <int> rescue_targets = unit.allies_in_range(1); foreach (int id in rescue_targets) { if (unit.can_rescue(Global.game_map.units[id])) { temp_targets.Add(id); } } break; // Looking for drop locations case 1: foreach (Vector2 loc in unit.drop_locs()) { temp_targets.Add((int)(loc.X + loc.Y * Global.game_map.width)); } /*foreach (Vector2 loc in new Vector2[] { new Vector2(0, 1), new Vector2(0, -1), new Vector2(1, 0), new Vector2(-1, 0) }) //Debug * if (!Global.game_map.is_off_map(loc + unit.loc)) * if (!Global.game_map.is_blocked(loc + unit.loc, unit.rescuing)) * if (Pathfinding.passable(Global.game_map.units[unit.rescuing], loc + unit.loc)) * temp_targets.Add((int)((loc + unit.loc).X + (loc + unit.loc).Y * Global.game_map.width));*/ break; // Looking for people to take case 2: List <int> take_targets = unit.allies_in_range(1); foreach (int id in take_targets) { if (Global.game_map.units[id].different_team(unit)) { continue; } if (!Global.game_map.units[id].is_rescuing) { continue; } if (unit.can_rescue(Global.game_map.units[Global.game_map.units[id].rescuing])) { temp_targets.Add(id); } } break; // Looking for people to give to case 3: List <int> give_targets = unit.allies_in_range(1); foreach (int id in give_targets) { if (Global.game_map.units[id].different_team(unit)) { continue; } if (Global.game_map.units[id].is_rescuing) { continue; } if (!Global.game_map.units[id].is_rescue_blocked() && Global.game_map.units[id].can_rescue(Global.game_map.units[unit.rescuing])) { temp_targets.Add(id); } } break; // Skills: Savior // Looking for people to cover case 4: List <int> cover_targets = unit.allies_in_range(1); foreach (int id in cover_targets) { if (unit.can_rescue(Global.game_map.units[id])) { if (Pathfind.passable(unit, Global.game_map.units[id].loc)) { temp_targets.Add(id); } } } break; // Looking for people to take refuge under case 5: List <int> refuge_targets = unit.allies_in_range(1); foreach (int id in refuge_targets) { Game_Unit target = Global.game_map.units[id]; if (target.has_refuge() && target.can_rescue(unit)) { temp_targets.Add(id); } } break; } return(temp_targets); }