NOTE: Actual death occurs when countUntilDeath >= 60.
| 199 | |
| 200 | // NOTE: Actual death occurs when countUntilDeath >= 60. |
| 201 | void ExplodeBoss(ItemInfo& item, int countUntilDeath, const Vector4& color, const Vector4& explosionColor1, const Vector4& explosionColor2, bool allowExplosion) |
| 202 | { |
| 203 | // Disable shield. |
| 204 | item.SetFlagField((int)BossItemFlags::ShieldIsEnabled, 0); |
| 205 | item.HitPoints = NOT_TARGETABLE; |
| 206 | |
| 207 | // Start explosion (entity will keep duration count). |
| 208 | int counter = item.ItemFlags[(int)BossItemFlags::ExplodeCount]; |
| 209 | if (counter == 1) |
| 210 | { |
| 211 | SpawnShockwaveExplosion(item, color); |
| 212 | |
| 213 | auto sphere = BoundingSphere(item.Pose.Position.ToVector3() + Vector3(0.0f, -CLICK(3), 0.0f), BLOCK(0.5f)); |
| 214 | for (int i = 0; i < 3; i++) |
| 215 | { |
| 216 | auto pos = Random::GeneratePointInSphere(sphere); |
| 217 | SpawnExplosionSmoke(pos); |
| 218 | |
| 219 | TriggerExplosionSparks( |
| 220 | item.Pose.Position.x + (Random::GenerateInt(0, 127) - 64 * 2), |
| 221 | (item.Pose.Position.y - CLICK(2)) + (Random::GenerateInt(0, 127) - 64 * 2), |
| 222 | item.Pose.Position.z + (Random::GenerateInt(0, 127) - 64 * 2), |
| 223 | 2, -3, 0, item.RoomNumber, Vector3(explosionColor1.x, explosionColor1.y, explosionColor1.z), |
| 224 | Vector3(explosionColor2.x, explosionColor2.y, explosionColor2.z)); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | if (counter > 0 && !(counter % 10)) |
| 229 | { |
| 230 | auto sphere = BoundingSphere(item.Pose.Position.ToVector3() + Vector3(0.0f, -CLICK(3), 0.0f), BLOCK(0.5f)); |
| 231 | for (int i = 0; i < 3; i++) |
| 232 | { |
| 233 | auto pos = Random::GeneratePointInSphere(sphere); |
| 234 | SpawnExplosionSmoke(pos); |
| 235 | |
| 236 | TriggerExplosionSparks( |
| 237 | item.Pose.Position.x + (Random::GenerateInt(0, 127) - 64 * 2), |
| 238 | (item.Pose.Position.y - CLICK(2)) + (Random::GenerateInt(0, 127) - 64 * 2), |
| 239 | item.Pose.Position.z + (Random::GenerateInt(0, 127) - 64 * 2), |
| 240 | 2, -3, 0, item.RoomNumber, Vector3(explosionColor1.x, explosionColor1.y, explosionColor1.z), |
| 241 | Vector3(explosionColor2.x, explosionColor2.y, explosionColor2.z)); |
| 242 | } |
| 243 | |
| 244 | sphere = BoundingSphere(item.Pose.Position.ToVector3() + Vector3(0.0f, -CLICK(2), 0.0f), BLOCK(1 / 16.0f)); |
| 245 | auto shockwavePos = Pose(Random::GeneratePointInSphere(sphere), item.Pose.Orientation); |
| 246 | |
| 247 | int speed = Random::GenerateInt(BLOCK(0.5f), BLOCK(1.6f)); |
| 248 | auto orient2D = Random::GenerateAngle(ANGLE(-24.0f), ANGLE(24.0f)); |
| 249 | |
| 250 | TriggerShockwave( |
| 251 | &shockwavePos, 300, BLOCK(0.5f), speed, |
| 252 | color.x * UCHAR_MAX, color.y * UCHAR_MAX, color.z * UCHAR_MAX, |
| 253 | 36, EulerAngles(orient2D, 0.0f, 0.0f), 0, true, false, false, (int)ShockwaveStyle::Normal); |
| 254 | |
| 255 | TriggerExplosionSparks( |
| 256 | item.Pose.Position.x + (Random::GenerateInt(0, 127) - 64 * 2), |
| 257 | (item.Pose.Position.y - CLICK(2)) + (Random::GenerateInt(0, 127) - 64 * 2), |
| 258 | item.Pose.Position.z + (Random::GenerateInt(0, 127) - 64 * 2), |
no test coverage detected