Skip to content

Commit

Permalink
Add a new overload to combat_modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jostephd committed Oct 27, 2018
1 parent 4d8862b commit 81b3c3f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/actions/attack.cpp
Expand Up @@ -1735,7 +1735,15 @@ int combat_modifier(const unit_map& units,
bool is_fearless)
{
const tod_manager& tod_m = *resources::tod_manager;
int lawful_bonus = tod_m.get_illuminated_time_of_day(units, map, loc).lawful_bonus;
const time_of_day& effective_tod = tod_m.get_illuminated_time_of_day(units, map, loc);
return combat_modifier(effective_tod, alignment, is_fearless);
}

int combat_modifier(const time_of_day& effective_tod,
unit_type::ALIGNMENT alignment,
bool is_fearless)
{
const int lawful_bonus = effective_tod.lawful_bonus;
return generic_combat_modifier(lawful_bonus, alignment, is_fearless);
}

Expand Down
9 changes: 9 additions & 0 deletions src/actions/attack.hpp
Expand Up @@ -29,6 +29,7 @@

struct map_location;
class team;
struct time_of_day;
class unit;
class unit_map;
class gamemap;
Expand Down Expand Up @@ -294,6 +295,14 @@ int combat_modifier(const unit_map& units,
unit_type::ALIGNMENT alignment,
bool is_fearless);

/**
* Returns the amount that a unit's damage should be multiplied by
* due to the current time of day.
*/
int combat_modifier(const time_of_day& effective_tod,
unit_type::ALIGNMENT alignment,
bool is_fearless);

/**
* Returns the amount that a unit's damage should be multiplied by
* due to a given lawful_bonus.
Expand Down

0 comments on commit 81b3c3f

Please sign in to comment.