Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Dungeons & Dragons
The math of the GWF Fighting Style and why its as good as a +1 (and possibly better than defense)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Asisreo" data-source="post: 9452487" data-attributes="member: 7019027"><p>You're partially correct, good catch. Its actually having the enemy counter attack each time the fighter attacks and if the enemy succeeds, their attack interrupts the fighter's turn, which obviously isn't how normal combat works.</p><p></p><p>[CODE=c]</p><p>#include <stdio.h></p><p>#include <stdlib.h></p><p>#include <time.h></p><p></p><p>#define NUM_SIMULATIONS 10000</p><p>#define HP 224</p><p></p><p>// Function to simulate rolling two dice and adding the damage with a bonus</p><p>int roll_damage(int bonus) {</p><p> int roll1 = rand() % 6 + 1;</p><p> int roll2 = rand() % 6 + 1;</p><p> return roll1 + roll2 + bonus;</p><p>}</p><p></p><p>// Function to simulate the probability of getting hit</p><p>int is_hit(double probability) {</p><p> return (rand() % 100) < (probability * 100);</p><p>}</p><p></p><p>// Function to simulate a single fighter's attempt to reach the target damage threshold</p><p>int simulate_fighter(int target_damage, int damage_bonus, double hit_probability) {</p><p> int current_damage = 0;</p><p> int turns = 0;</p><p> int hp = HP;</p><p></p><p> while (current_damage < target_damage && hp > 0) {</p><p> // Fighter attacks 4 times before the enemy attempts to hit them</p><p> for (int i = 0; i < 4; i++) {</p><p> // Roll damage</p><p> int damage = roll_damage(damage_bonus);</p><p> current_damage += damage;</p><p> }</p><p></p><p> // After 4 attacks, the enemy tries to hit the fighter</p><p> if (is_hit(hit_probability)) {</p><p> int attack_damage = rand() % 41 + 30; // Attack damage from 30 to 70</p><p> hp -= attack_damage;</p><p> if (hp <= 0) {</p><p> return -1; // Fighter lost all HP before reaching the target</p><p> }</p><p> }</p><p></p><p> // Increment the turn count after 4 attacks and one retaliation attempt</p><p> turns++;</p><p> }</p><p></p><p> if (hp > 0) {</p><p> return turns; // Return the number of turns required if the fighter survived</p><p> } else {</p><p> return -1; // Return -1 if the fighter died</p><p> }</p><p>}</p><p></p><p>int main() {</p><p> srand(time(NULL)); // Seed the random number generator</p><p></p><p> int deaths_fighter1 = 0;</p><p> int deaths_fighter2 = 0;</p><p> double total_turns_fighter1 = 0;</p><p> double total_turns_fighter2 = 0;</p><p> int survivals_fighter1 = 0;</p><p> int survivals_fighter2 = 0;</p><p></p><p> for (int i = 0; i < NUM_SIMULATIONS; i++) {</p><p> int target_damage = rand() % 169 + 1; // Random target damage between 1 and 169</p><p></p><p> // Simulate Fighter 1</p><p> int result1 = simulate_fighter(target_damage, 6, 0.65); // Fighter 1 with 65% chance to be hit</p><p> if (result1 == -1) {</p><p> deaths_fighter1++;</p><p> } else {</p><p> total_turns_fighter1 += result1;</p><p> survivals_fighter1++;</p><p> }</p><p></p><p> // Simulate Fighter 2</p><p> int result2 = simulate_fighter(target_damage, 5, 0.60); // Fighter 2 with 60% chance to be hit</p><p> if (result2 == -1) {</p><p> deaths_fighter2++;</p><p> } else {</p><p> total_turns_fighter2 += result2;</p><p> survivals_fighter2++;</p><p> }</p><p> }</p><p></p><p> // Calculate average turns for each fighter</p><p> double avg_turns_fighter1 = survivals_fighter1 > 0 ? total_turns_fighter1 / survivals_fighter1 : 0;</p><p> double avg_turns_fighter2 = survivals_fighter2 > 0 ? total_turns_fighter2 / survivals_fighter2 : 0;</p><p></p><p> // Print the results</p><p> printf("Number of deaths for Fighter 1 (2d6+6 damage, 65%% hit probability): %d\n", deaths_fighter1);</p><p> printf("Number of deaths for Fighter 2 (2d6+5 damage, 60%% hit probability): %d\n", deaths_fighter2);</p><p> printf("Average turns for Fighter 1 (2d6+6 damage, 65%% hit probability): %.2f\n", avg_turns_fighter1);</p><p> printf("Average turns for Fighter 2 (2d6+5 damage, 60%% hit probability): %.2f\n", avg_turns_fighter2);</p><p></p><p> return 0;</p><p>}</p><p>[/CODE]</p><p></p><p>This is the updated code, the results I get are: </p><p>[CODE]</p><p>Number of deaths for Fighter 1 (2d6+6 damage, 65% hit probability): 23</p><p></p><p>Number of deaths for Fighter 2 (2d6+5 damage, 60% hit probability): 31</p><p>Average turns for Fighter 1 (2d6+6 damage, 65% hit probability): 2.15</p><p>Average turns for Fighter 2 (2d6+5 damage, 60% hit probability): 2.30</p><p></p><p>[/CODE]</p><p></p><p>Actually, with these adjustments, Fighter 1 is more likely to survive and they slightly need less turns to beat a number of combat encounter. </p><p></p><p>So GWF is purely in favor of defense. Its not by much, but its still saves a respectable 1 turn out of every 6 2/3 combats. </p><p></p><p>Edit: Accidentally kept the "Code Execution Successful" line on output in the normal comment area. BEEP BOOP. </p><p></p><p>Also, here is an online IDE for C that you can use to run the code if you're on mobile or don't have a way to execute the code natively: </p><p></p><p>[URL unfurl="true"]https://www.programiz.com/c-programming/online-compiler/[/URL]</p></blockquote><p></p>
[QUOTE="Asisreo, post: 9452487, member: 7019027"] You're partially correct, good catch. Its actually having the enemy counter attack each time the fighter attacks and if the enemy succeeds, their attack interrupts the fighter's turn, which obviously isn't how normal combat works. [CODE=c] #include <stdio.h> #include <stdlib.h> #include <time.h> #define NUM_SIMULATIONS 10000 #define HP 224 // Function to simulate rolling two dice and adding the damage with a bonus int roll_damage(int bonus) { int roll1 = rand() % 6 + 1; int roll2 = rand() % 6 + 1; return roll1 + roll2 + bonus; } // Function to simulate the probability of getting hit int is_hit(double probability) { return (rand() % 100) < (probability * 100); } // Function to simulate a single fighter's attempt to reach the target damage threshold int simulate_fighter(int target_damage, int damage_bonus, double hit_probability) { int current_damage = 0; int turns = 0; int hp = HP; while (current_damage < target_damage && hp > 0) { // Fighter attacks 4 times before the enemy attempts to hit them for (int i = 0; i < 4; i++) { // Roll damage int damage = roll_damage(damage_bonus); current_damage += damage; } // After 4 attacks, the enemy tries to hit the fighter if (is_hit(hit_probability)) { int attack_damage = rand() % 41 + 30; // Attack damage from 30 to 70 hp -= attack_damage; if (hp <= 0) { return -1; // Fighter lost all HP before reaching the target } } // Increment the turn count after 4 attacks and one retaliation attempt turns++; } if (hp > 0) { return turns; // Return the number of turns required if the fighter survived } else { return -1; // Return -1 if the fighter died } } int main() { srand(time(NULL)); // Seed the random number generator int deaths_fighter1 = 0; int deaths_fighter2 = 0; double total_turns_fighter1 = 0; double total_turns_fighter2 = 0; int survivals_fighter1 = 0; int survivals_fighter2 = 0; for (int i = 0; i < NUM_SIMULATIONS; i++) { int target_damage = rand() % 169 + 1; // Random target damage between 1 and 169 // Simulate Fighter 1 int result1 = simulate_fighter(target_damage, 6, 0.65); // Fighter 1 with 65% chance to be hit if (result1 == -1) { deaths_fighter1++; } else { total_turns_fighter1 += result1; survivals_fighter1++; } // Simulate Fighter 2 int result2 = simulate_fighter(target_damage, 5, 0.60); // Fighter 2 with 60% chance to be hit if (result2 == -1) { deaths_fighter2++; } else { total_turns_fighter2 += result2; survivals_fighter2++; } } // Calculate average turns for each fighter double avg_turns_fighter1 = survivals_fighter1 > 0 ? total_turns_fighter1 / survivals_fighter1 : 0; double avg_turns_fighter2 = survivals_fighter2 > 0 ? total_turns_fighter2 / survivals_fighter2 : 0; // Print the results printf("Number of deaths for Fighter 1 (2d6+6 damage, 65%% hit probability): %d\n", deaths_fighter1); printf("Number of deaths for Fighter 2 (2d6+5 damage, 60%% hit probability): %d\n", deaths_fighter2); printf("Average turns for Fighter 1 (2d6+6 damage, 65%% hit probability): %.2f\n", avg_turns_fighter1); printf("Average turns for Fighter 2 (2d6+5 damage, 60%% hit probability): %.2f\n", avg_turns_fighter2); return 0; } [/CODE] This is the updated code, the results I get are: [CODE] Number of deaths for Fighter 1 (2d6+6 damage, 65% hit probability): 23 Number of deaths for Fighter 2 (2d6+5 damage, 60% hit probability): 31 Average turns for Fighter 1 (2d6+6 damage, 65% hit probability): 2.15 Average turns for Fighter 2 (2d6+5 damage, 60% hit probability): 2.30 [/CODE] Actually, with these adjustments, Fighter 1 is more likely to survive and they slightly need less turns to beat a number of combat encounter. So GWF is purely in favor of defense. Its not by much, but its still saves a respectable 1 turn out of every 6 2/3 combats. Edit: Accidentally kept the "Code Execution Successful" line on output in the normal comment area. BEEP BOOP. Also, here is an online IDE for C that you can use to run the code if you're on mobile or don't have a way to execute the code natively: [URL unfurl="true"]https://www.programiz.com/c-programming/online-compiler/[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Dungeons & Dragons
The math of the GWF Fighting Style and why its as good as a +1 (and possibly better than defense)
Top