public void execute_bite(Floor fl, Player pl) { int pl_x_dir = 0; int pl_y_dir = 0; gridCoordinate top_left = my_grid_coords[0]; gridCoordinate bottom_right = my_grid_coords[3]; int pl_x_c = pl.get_my_grid_C().x; int pl_y_c = pl.get_my_grid_C().y; //Determine X direction if (pl_x_c > top_left.x && pl_x_c > bottom_right.x) pl_x_dir = 1; else if (pl_x_c < top_left.x && pl_x_c < bottom_right.x) pl_x_dir = -1; //Determine Y direction if (pl_y_c > top_left.y && pl_y_c > bottom_right.y) pl_y_dir = 1; else if (pl_y_c < top_left.y && pl_y_c < bottom_right.y) pl_y_dir = -1; int target_index = -1; for (int i = 0; i < movement_indexes.Count; i++) { if (movement_indexes[i][0] == pl_x_dir && movement_indexes[i][1] == pl_y_dir) target_index = i; } List<gridCoordinate> biting_coords = new List<gridCoordinate>(); for (int i = 0; i < my_grid_coords.Count; i++) biting_coords.Add(new gridCoordinate(my_grid_coords[i].x + (pl_x_dir*2), my_grid_coords[i].y + (pl_y_dir*2))); fl.add_specific_effect(Floor.specific_effect.Big_Bite, biting_coords[0]); for(int i = 0; i < my_grid_coords.Count; i++) if (biting_coords[i].x == pl.get_my_grid_C().x && biting_coords[i].y == pl.get_my_grid_C().y) { List<string> bparts = new List<string>(); if (rGen.Next(2) == 0) { bparts.Add("RLeg"); bparts.Add("RArm"); } else { bparts.Add("LArm"); bparts.Add("LLeg"); } fl.addmsg("The boneyard's jaws snap shut, and your bones snap with it!"); pl.take_damage(new Attack(Attack.Damage.Crushing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[0]); pl.take_damage(new Attack(Attack.Damage.Slashing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[0]); pl.take_damage(new Attack(Attack.Damage.Crushing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[1]); pl.take_damage(new Attack(Attack.Damage.Slashing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[1]); fl.addmsg("You start bleeding profusely from the attack!"); pl.add_single_statusEffect(new StatusEffect(Scroll.Status_Type.Hemorrhage, 5, true, 0, 0, false)); } }
public override void Update_Monster(Player pl, Floor fl) { heal_near_altar(fl); detect_player(pl, fl); has_moved = false; if (!stunned) { if (can_see_player) { last_seen_player_loc = pl.get_my_grid_C(); if (sequence_cooldown == 0) { if (!bite_available && !volley_available) { bite_available = true; volley_available = true; bite_stage = 0; volley_stage = 0; } if (bite_available && volley_available) { if (rGen.Next(2) == 0) { current_sequence = attack_sequence.Biting; bite_available = false; } else { current_sequence = attack_sequence.Volley; volley_available = false; } sequence_cooldown = 4; } else { if (!bite_available) { current_sequence = attack_sequence.Volley; volley_available = false; } else { current_sequence = attack_sequence.Biting; bite_available = false; } sequence_cooldown = 4; } } switch (current_sequence) { case attack_sequence.None: if(is_player_within(pl, 1)) { fl.addmsg("The Boneyard slashes at you!"); Attack dmg = dealDamage(); fl.add_effect(dmg_type, pl.get_my_grid_C()); pl.take_damage(dmg, fl, ""); sequence_cooldown--; } else { advance_towards_single_point(pl.get_my_grid_C(), pl, fl, 1, corporeal); if (!has_moved) fire_singletarget_bonespear(fl, pl.get_my_grid_C()); else sequence_cooldown--; } break; case attack_sequence.Biting: switch (bite_stage) { case 0: my_Texture = bitey_texture; fl.add_new_popup("Roars!", Popup.popup_msg_type.Alert, my_center_coordinate(), false, false); bloodspray(fl, pl); bite_stage++; break; case 1: bite_alert(fl); bite_stage++; break; case 2: //Bite goes off execute_bite(fl, pl); bite_stage = 0; my_Texture = normal_texture; current_sequence = attack_sequence.None; break; } break; case attack_sequence.Volley: switch (volley_stage) { case 0: //target player target_bonespear(fl, pl.get_my_grid_C(), true); fl.add_specific_effect(Floor.specific_effect.Warning_Bracket, pl.get_my_grid_C()); volley_stage++; break; case 1: //shoot spear fire_bonespear(fl, true); //target player target_bonespear(fl, pl.get_my_grid_C(), true); volley_stage++; break; case 2: //shoot spear fire_bonespear(fl, true); //target player target_bonespear(fl, pl.get_my_grid_C(), true); volley_stage++; break; case 3: //shoot spear fire_bonespear(fl, true); volley_stage = 0; current_sequence = attack_sequence.None; break; } break; } } else if (!can_see_player && have_i_seen_player) { advance_towards_single_point(last_seen_player_loc, pl, fl, 0, corporeal); if (occupies_tile(last_seen_player_loc)) { last_seen_player_loc = my_grid_coords[0]; have_i_seen_player = false; } } else if (!can_see_player && !have_i_seen_player && heard_something) { //If the boneyard has LOS to the sound's origin, fire bone spears at it repeatedly - the AOE kind. //Otherwise, simply move to the sound. if(last_path_to_sound.Count > 0 && can_i_see_point(fl, last_path_to_sound[0])) { switch(blind_volley_stage) { case 0: break; case 1: break; } } else { follow_path_to_sound(fl, pl); } } } base.Update_Monster(pl, fl); }
public void bloodspray(Floor fl, Player pl) { int pl_x_dir = 0; int pl_y_dir = 0; gridCoordinate top_left = my_grid_coords[0]; gridCoordinate bottom_right = my_grid_coords[3]; int pl_x_c = pl.get_my_grid_C().x; int pl_y_c = pl.get_my_grid_C().y; //Determine X direction if (pl_x_c > top_left.x && pl_x_c > bottom_right.x) pl_x_dir = 1; else if (pl_x_c < top_left.x && pl_x_c < bottom_right.x) pl_x_dir = -1; //Determine Y direction if (pl_y_c > top_left.y && pl_y_c > bottom_right.y) pl_y_dir = 1; else if (pl_y_c < top_left.y && pl_y_c < bottom_right.y) pl_y_dir = -1; List<gridCoordinate> potential_spray_targets = new List<gridCoordinate>(); List<gridCoordinate> blood_spray_targets = new List<gridCoordinate>(); if (pl_x_dir == 0) { int y_coord = top_left.y; if (pl_y_dir > 0) y_coord = bottom_right.y; for (int x = top_left.x - 1; x <= bottom_right.x + 1; x++) for (int y = y_coord + (pl_y_dir * 2); y != y_coord + (pl_y_dir * 4); y += pl_y_dir) potential_spray_targets.Add(new gridCoordinate(x, y)); } else if (pl_y_dir == 0) { int x_coord = top_left.x; if (pl_x_dir > 0) x_coord = bottom_right.x; for (int x = x_coord + (pl_x_dir * 2); x != x_coord + (pl_x_dir * 4); x += pl_x_dir) for (int y = top_left.y - 1; y <= bottom_right.y + 1; y++) potential_spray_targets.Add(new gridCoordinate(x, y)); } else { for(int i = 0; i < my_grid_coords.Count; i++) potential_spray_targets.Add(new gridCoordinate(my_grid_coords[i].x + (pl_x_dir*3), my_grid_coords[i].y + (pl_y_dir*3))); int upper_x = 0; int lower_x = 0; if (pl_x_dir == 1) { upper_x = 0; lower_x = 2; } else if (pl_x_dir == -1) { upper_x = 1; lower_x = 3; } int left_y = 0; int right_y = 0; if (pl_y_dir == 1) { left_y = 0; right_y = 1; } else if (pl_y_dir == -1) { left_y = 2; right_y = 3; } //The above code gives us a 2x2 zone. For this, we want to extend the zone by one //x tile and y tile in the opposite direction of where the player is relative to the boneyard //That's why the above code picks out the 2 coordinates from the x axis and y axis, because potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[upper_x].x + (pl_x_dir*-1), potential_spray_targets[upper_x].y)); potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[lower_x].x + (pl_x_dir*-1), potential_spray_targets[lower_x].y)); potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[left_y].x, potential_spray_targets[left_y].y + (pl_y_dir*-1))); potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[right_y].x, potential_spray_targets[right_y].y + (pl_y_dir*-1))); } int potential_targets = 3; //for (int i = 0; i < potential_spray_targets.Count; i++) //fl.set_tile_aura(potential_spray_targets[i], Tile.Aura.SmellTarget); for (int i = 0; i < potential_targets; i++) { bool found_valid_target = false; while (!found_valid_target && potential_spray_targets.Count > 0) { int chosen_coord = rGen.Next(potential_spray_targets.Count); if (can_i_see_point(fl, potential_spray_targets[chosen_coord])) { blood_spray_targets.Add(potential_spray_targets[chosen_coord]); found_valid_target = true; } potential_spray_targets.RemoveAt(chosen_coord); } } for (int i = 0; i < blood_spray_targets.Count; i++) { Projectile bspray = new Projectile(randomly_chosen_personal_coord(), blood_spray_targets[i], Projectile.projectile_type.Bloody_AcidCloud, ref cont, true, Scroll.Atk_Area_Type.cloudAOE, true); bspray.set_damage_type(blood_spray_dmgtyp); bspray.set_damage_range(blood_spray_mindmg, blood_spray_maxdmg); bspray.set_special_anim(Projectile.special_anim.BloodAcid); bspray.set_AOE_size(1); fl.create_new_projectile(bspray); } }