-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll glancing blow in range instead of static modifier.
Low end: 1.3 - 0.05 * (t_defense - w_skill) capped at 0.91 max and 0.55 low. High end: 1.2 - 0.03 * (t_defense - w_skill) capped at 0.99 max and 0.75 low. Based on discussion in magey/classic-warrior#5 Note that low end cap (0.55 and 0.75) is *not* discussed but is an implementation detail.
- Loading branch information
Showing
13 changed files
with
147 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "TestCombatRoll.h" | ||
|
||
#include <QDebug> | ||
|
||
#include "CombatRoll.h" | ||
#include "Target.h" | ||
#include "Orc.h" | ||
#include "Warrior.h" | ||
|
||
TestCombatRoll::TestCombatRoll(EquipmentDb* equipment_db) : | ||
equipment_db(equipment_db) | ||
{} | ||
|
||
void TestCombatRoll::test_all() { | ||
qDebug() << "TestCombatRoll"; | ||
test_glancing_penalties(); | ||
} | ||
|
||
void TestCombatRoll::test_glancing_penalties() { | ||
auto* race = new Orc(); | ||
auto* pchar = new Warrior(race, equipment_db, nullptr); | ||
auto* roll = pchar->get_combat_roll(); | ||
|
||
for (int i = 0; i < 1000; ++i) { | ||
const double glance_penalty = roll->get_glancing_blow_dmg_penalty(300); | ||
assert(glance_penalty > 0.54999 && glance_penalty < 0.75001); | ||
} | ||
|
||
for (int i = 0; i < 1000; ++i) { | ||
const double glance_penalty = roll->get_glancing_blow_dmg_penalty(305); | ||
assert(glance_penalty > 0.7999 && glance_penalty < 0.9001); | ||
} | ||
|
||
for (int i = 0; i < 1000; ++i) { | ||
const double glance_penalty = roll->get_glancing_blow_dmg_penalty(310); | ||
assert(glance_penalty > 0.90999 && glance_penalty < 0.99001); | ||
} | ||
|
||
for (int i = 0; i < 1000; ++i) { | ||
const double glance_penalty = roll->get_glancing_blow_dmg_penalty(315); | ||
assert(glance_penalty > 0.90999 && glance_penalty < 0.99001); | ||
} | ||
|
||
delete pchar; | ||
delete race; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include "TestUtils.h" | ||
|
||
class EquipmentDb; | ||
|
||
class TestCombatRoll : public TestUtils { | ||
public: | ||
TestCombatRoll(EquipmentDb* equipment_db); | ||
|
||
void test_all(); | ||
|
||
private: | ||
EquipmentDb* equipment_db; | ||
|
||
void test_glancing_penalties(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.