-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add skill to advanced defense #265
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,20 @@ | |
|
||
|
||
#include "disc_defense.h" | ||
#include "being.h" | ||
|
||
|
||
CDDefense::CDDefense() : | ||
CDiscipline(), | ||
skAdvancedDefense() | ||
skAdvancedDefense(), | ||
skFocusedAvoidance() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chances are that these constructors, destructors, operator= don't do anything useful and should be deleted. |
||
{ | ||
} | ||
|
||
CDDefense::CDDefense(const CDDefense &a) : | ||
CDiscipline(a), | ||
skAdvancedDefense(a.skAdvancedDefense) | ||
skAdvancedDefense(a.skAdvancedDefense), | ||
skFocusedAvoidance(a.skFocusedAvoidance) | ||
{ | ||
} | ||
|
||
|
@@ -24,9 +28,36 @@ CDDefense & CDDefense::operator=(const CDDefense &a) | |
if (this == &a) return *this; | ||
CDiscipline::operator=(a); | ||
skAdvancedDefense = a.skAdvancedDefense; | ||
skFocusedAvoidance = a.skFocusedAvoidance; | ||
return *this; | ||
} | ||
|
||
CDDefense::~CDDefense() | ||
{ | ||
} | ||
|
||
// The larger perc is passed in the harder it is to avoid | ||
bool TBeing::canFocusedAvoidance(int perc) { | ||
|
||
if (!doesKnowSkill(SKILL_FOCUSED_AVOIDANCE)) | ||
return FALSE; | ||
|
||
if (!awake() || getPosition() < POSITION_CRAWLING) | ||
return FALSE; | ||
|
||
int skill = getSkillValue(SKILL_FOCUSED_AVOIDANCE); | ||
|
||
// Agi seems to be the defense stat so this makes sense | ||
skill *= getAgiMod(); | ||
|
||
if (eitherLegHurt()) | ||
skill = (skill * 0.75); | ||
|
||
skill -= perc; | ||
|
||
// bSuccess is modified by focus | ||
if (!bSuccess(skill, SKILL_FOCUSED_AVOIDANCE)) | ||
return FALSE; | ||
|
||
return TRUE; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1405,6 +1405,7 @@ class TBeing : public TThing { | |
bool checkSmashed(TBeing *, wearSlotT, spellNumT, TThing *, int, const char * = NULL); | ||
int hit(TBeing *, int pulse = -1); | ||
bool canCounterMove(int); | ||
bool canFocusedAvoidance(int); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why these skills live in TBeing? This causes horrible recompilation times for everything, as well as leaking inner workings of disciplines into generic code of beings. As most things in TBeing are public, maybe it makes more sense to have that code in disciplines? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like all the combat type code is dealing with two objects that are subclasses of TBeing of some sort. So it kind of makes sense to be able to write
I guess the other option would just be
Just not object oriented. It seems a little easier to reason about in the first instance but if the performance impact is huge the other way it's not a big deal to change it all. I feel like "Disciplines" or "Abilities" maybe should be a class that is instantiated per being. |
||
int trySpringleap(TBeing *); | ||
int damageLimb(TBeing *, wearSlotT, TThing *, int *); | ||
int damageHand(TBeing *, wearSlotT); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Focused avoidance allows one who is a seasoned combatant to anticipate a foe's | ||
attempt to perform a special attack and avoid it completely. Those with higher | ||
agility and focus will have better success avoiding attacks. | ||
|
||
Focused avoidance is passive and attempted at all times. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
()
aren't necessary, but they don't hurt either.