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 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)); } }