···11# Examples
2233-| Example | Description |
44-|-----------------------|-----------------------------------|
55-| [`poison`](poison.rs) | A simple damage-over-time effect. |
33+| Example | Description |
44+|---------------------------------------|--------------------------------------------------------------------------------|
55+| [`poison`](poison.rs) | A simple damage-over-time effect. |
66+| [`poison_falloff`](poison_falloff.rs) | A damage-over-time effect where the damage falls off as more stacks are added. |
6778## Immediate Stats
89Examples in the `immediate_stats` subdirectory utilize the [`immediate_stats`](https://github.com/AlephCubed/immediate_stats) crate, which I also created.
99-Some of these examples include a copy that utilizes [`bevy_auto_plugin`](https://github.com/StrikeForceZero/bevy_auto_plugin), which should behave exactly the same.
1010+Some of these examples include a version that utilizes [`bevy_auto_plugin`](https://github.com/StrikeForceZero/bevy_auto_plugin), which should behave exactly the same.
10111112| Example | Description |
1213|--------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
+1-1
examples/poison_falloff.rs
···8080 // Each subsequent stack has a decreasing effect, the first deals 5 damage, the next 4, then 3, and so on.
8181 let stacks = poison.damage.min(stacks.0 as i32); // Clamp stacks to prevent negative damage.
8282 let sub = (stacks * (stacks - 1)) / 2;
8383- let damage = (poison.damage * stacks - sub).max(0);
8383+ let damage = poison.damage * stacks - sub;
84848585 info!("Dealt {damage} damage!");
8686