**New and improved!** Made the random number a decimal between 1 and 100 rather than an integer, which should yield more accurate results, and added a comparison to the Xi'ri's Gift trinket

This is a quick script I wrote up to determine the effectiveness of the Wrath trinket from the Storms deck for casters (hint: if you're concerned about spell crit and you're already geared somewhat adequately, it's not much). Unfortunately I don't know enough about probability summation to make an effective formula to describe it generally, but what I do know is how to write a script to brute-force some simulations.

Enter your crit rate and hit "go". The script simulates 10,000 consecutive spellcasts, and counts the crits you would get naturally, without the trinket. Along the way it also tracks stacking Wrath buffs in different ways:

Constant casts: your effective crit rate if you cast direct damage spells constantly, only losing buffs when consumed by a crit. This is the maximum theoretical benefit you could get, since all buffs would be used, with the possible exception of a stack at the very end of 10,000 casts. Though it's not really a practical judge of the trinket's benefit, as it'd require casting constant direct damage spells for at least 5.7 hours.

Clearing every 16 casts: any existing buffs are cleared every 16 hits, to simulate losing stacked buffs due to stopping, death, not casting direct damage spells, etc. (This is a long set of casts, probably more likely in a raid or instance.)

Clearing every 4 to 12 casts: same as above, but picks a random number of casts in which to drop buffs (was thinking of my own experience with solo farming for this).

Xi'ri's Gift crits: For comparison, it also tracks what crits you would have gotten if you equipped Xi'ri's Gift instead of Wrath. I chose this trinket for its relatively high crit bonus (32 crit rating) and its relatively low cost (I'm assuming that a player with the time to farm/buy the Wrath trinket would probably have the time to get revered with Sha'tar). Of course, this only tracks what crits you would have gotten; you could use the trinket to increase your overall dps, but that's entirely too variable to take into account here.

Just in case I'm wrong about how I put the code together, here's my script for review:

$base = $_REQUEST['base']; $inc = .77; #$max = $base + ($inc * 20); $max = 100; $current = $base; $crits = 0; $natural_crits = 0; $xi_crits = 0; $xi_bonus = (32 / 22.1); $hits = 10000; $partial_current = $base; $partial_crits = 0; $partial_casts = 16; $vary_crits = 0; $vary_current = $base; $vary_clear_low = 4; $vary_clear_high = 12; $vary_clear_count = rand($vary_clear_low, $vary_clear_high); if ($_REQUEST['submit'] && is_numeric($_REQUEST['base'])) { for ($i=0; $i<$hits; $i++) { $random = rand(1,10000) / 100; if ($random <= $base) $natural_crits++; if ($random <= ($base + $xi_bonus)) $xi_crits++; if ($i % $partial_casts == 0) $partial_current = $base; if ($random <= $partial_current) { $partial_crits++; $partial_current = $base; } else { $partial_current += $inc; $partial_current = min($max, $partial_current); } if ($random <= $vary_current) { $vary_crits++; $vary_current = $base; $vary_clear_count = rand($vary_clear_low, $vary_clear_high); } else { $vary_clear_count--; if (!$vary_clear_count) { $vary_current = $base; $vary_clear_count = rand($vary_clear_low, $vary_clear_high); } else { $vary_current += $inc; $vary_current = min($max, $vary_current); } } if ($random <= $current) { $crits++; $current = $base; } else { $current += $inc; $current = min($max, $current); } } $crit_rate_with_wrath = $crits / $hits * 100; $crit_rate_without_wrath = $natural_crits / $hits * 100; $crit_rate_partial_with_wrath = $partial_crits / $hits * 100; $crit_rate_vary_with_wrath = $vary_crits / $hits * 100; $crit_rate_xi = $xi_crits / $hits * 100;