public void set_melee_attack_aura(Floor fl) { for (int x = my_grid_coord.x - 1; x <= my_grid_coord.x + 1; x++) for (int y = my_grid_coord.y - 1; y <= my_grid_coord.y + 1; y++) { gridCoordinate target_coord = new gridCoordinate(x, y); if (!(x == my_grid_coord.x && y == my_grid_coord.y) && !fl.is_tile_opaque(target_coord)) fl.set_tile_aura(target_coord, Tile.Aura.Attack); } }
public void set_ranged_attack_aura(Floor fl, gridCoordinate pl_gc, Scroll s, RACursor r1) { int bow_range = 0; if (s == null) { if (main_hand != null && (main_hand.get_my_weapon_type() == Weapon.Type.Bow || main_hand.get_my_weapon_type() == Weapon.Type.Crossbow)) bow_range = main_hand.get_my_range(); else bow_range = off_hand.get_my_range(); } else bow_range = s.get_range(); List<gridCoordinate> endpoints = new List<gridCoordinate>(); if ((is_bow_equipped() && !is_cbow_equipped()) || s != null) { endpoints = calculate_endpoints(pl_gc, bow_range); } else { endpoints.Add(new gridCoordinate(pl_gc.x, pl_gc.y + bow_range)); endpoints.Add(new gridCoordinate(pl_gc.x, pl_gc.y - bow_range)); endpoints.Add(new gridCoordinate(pl_gc.x + bow_range, pl_gc.y)); endpoints.Add(new gridCoordinate(pl_gc.x - bow_range, pl_gc.y)); } List<VisionRay> range_rays = new List<VisionRay>(); for (int i = 0; i < endpoints.Count; i++) { range_rays.Add(new VisionRay(pl_gc, endpoints[i])); } endpoints.Clear(); int monsterID = -1; while (range_rays.Count > 0) { for (int i = 0; i < range_rays.Count; i++) { bool remove = false; int whoCares = -1; range_rays[i].update(); gridCoordinate current_ray_position = new gridCoordinate((int)range_rays[i].my_current_position.X / 32, (int)range_rays[i].my_current_position.Y / 32); int x_difference = positive_difference(pl_gc.x, current_ray_position.x); int y_difference = positive_difference(pl_gc.y, current_ray_position.y); if (!fl.is_tile_opaque(current_ray_position) && (x_difference > 1 || y_difference > 1)) fl.set_tile_aura(current_ray_position, Tile.Aura.Attack); if (fl.is_tile_opaque(current_ray_position) || fl.is_los_blocking_Doodad_here(current_ray_position)) { remove = true; if(s != null && s.spell_destroys_walls()) fl.set_tile_aura(current_ray_position, Tile.Aura.Attack); } if ((main_hand != null && main_hand.get_my_weapon_type() == Weapon.Type.Crossbow) || (off_hand != null && off_hand.get_my_weapon_type() == Weapon.Type.Crossbow)) if (fl.is_monster_here(current_ray_position, out monsterID) || fl.is_destroyable_Doodad_here(current_ray_position, out whoCares)) remove = true; if (range_rays[i].is_at_end() || remove) range_rays.RemoveAt(i); } } range_rays.Clear(); if (s != null && s.get_aoe_size() > 1) { int aoe_range = s.get_aoe_size() / 2; endpoints = calculate_endpoints(r1.my_grid_coord, aoe_range); bool destroys_walls = s.spell_destroys_walls(); for (int i = 0; i < endpoints.Count; i++) { range_rays.Add(new VisionRay(r1.my_grid_coord, endpoints[i])); } while (range_rays.Count > 0) { for (int i = 0; i < range_rays.Count; i++) { bool remove = false; range_rays[i].update(); gridCoordinate current_ray_position = new gridCoordinate((int)range_rays[i].my_current_position.X / 32, (int)range_rays[i].my_current_position.Y / 32); if (!fl.is_tile_opaque(current_ray_position)) if (fl.aura_of_specific_tile(current_ray_position) == Tile.Aura.Attack) fl.set_tile_aura(current_ray_position, Tile.Aura.AtkAndAOE); else if(fl.aura_of_specific_tile(current_ray_position) != Tile.Aura.AtkAndAOE && fl.aura_of_specific_tile(current_ray_position) != Tile.Aura.Attack) fl.set_tile_aura(current_ray_position, Tile.Aura.AOE_Range); if (fl.is_tile_opaque(current_ray_position) && !destroys_walls) remove = true; if (range_rays[i].is_at_end() || remove) range_rays.RemoveAt(i); } } } }
public void set_charge_attack_aura(Floor fl, int lanceID, gridCoordinate pl_gc) { Weapon c_lance = null; for (int i = 0; i < inventory.Count; i++) { if (inventory[i].get_my_IDno() == lanceID) c_lance = (Weapon)inventory[i]; } int lance_range = c_lance.get_my_range(); List<gridCoordinate> endPoints = calculate_endpoints(pl_gc, lance_range); List<VisionRay> charge_rays = new List<VisionRay>(); for (int i = 0; i < endPoints.Count; i++) { charge_rays.Add(new VisionRay(pl_gc, endPoints[i])); } int monsterID = -1; while (charge_rays.Count > 0) { for (int i = 0; i < charge_rays.Count; i++) { bool remove = false; int whoCares = -1; charge_rays[i].update(); gridCoordinate current_ray_position = new gridCoordinate((int)charge_rays[i].my_current_position.X / 32, (int)charge_rays[i].my_current_position.Y / 32); int x_difference = positive_difference(pl_gc.x, current_ray_position.x); int y_difference = positive_difference(pl_gc.y, current_ray_position.y); if (fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1)) fl.set_tile_aura(current_ray_position, Tile.Aura.Attack); if (!fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1) && fl.is_destroyable_Doodad_here(current_ray_position, out whoCares)) fl.set_tile_aura(current_ray_position, Tile.Aura.Attack); if (!fl.isWalkable(current_ray_position) || fl.is_monster_here(current_ray_position, out monsterID)) remove = true; if (charge_rays[i].is_at_end() || remove) charge_rays.RemoveAt(i); } } }