Skip to content

Commit

Permalink
add healthy and fearless [effect]s
Browse files Browse the repository at this point in the history
so we don't have to these these traits specialy.
  • Loading branch information
gfgtdf committed Jul 19, 2014
1 parent 7531089 commit 3204e4e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions data/core/macros/traits.cfg
Expand Up @@ -170,6 +170,9 @@
male_name= _ "healthy"
female_name= _ "female^healthy"
description= _ "Always rest heals"
[effect]
apply_to = "healthy"
[/effect]
[effect]
apply_to=hitpoints
increase_total=1
Expand All @@ -189,6 +192,9 @@
male_name= _ "fearless"
female_name= _ "female^fearless"
description= _ "Fights normally during unfavorable times of day/night"
[effect]
apply_to = "fearless"
[/effect]
[/trait]
#enddef

Expand All @@ -202,6 +208,9 @@
male_name= _ "fearless"
female_name= _ "female^fearless"
description= _ "Fights normally during unfavorable times of day/night"
[effect]
apply_to = "fearless"
[/effect]
[/trait]
#enddef

Expand Down
14 changes: 10 additions & 4 deletions src/unit.cpp
Expand Up @@ -1560,9 +1560,6 @@ void unit::add_modification(const std::string& mod_type, const config& mod, bool

//some trait activate specific flags
if ( mod_type == "trait" ) {
const std::string& id = mod["id"];
is_fearless_ = is_fearless_ || id == "fearless";
is_healthy_ = is_healthy_ || id == "healthy";
if (!mod["generate_description"].empty()) {
generate_description = mod["generate_description"].to_bool();
}
Expand Down Expand Up @@ -1596,7 +1593,16 @@ void unit::add_modification(const std::string& mod_type, const config& mod, bool
if ((apply_to == "variation" || apply_to == "type") && no_add == false) {
set_poisoned = false;
last_effect = effect;
} else if(apply_to == "profile") {
}
else if(apply_to == "fearless")
{
is_fearless_ = effect["set"].to_bool(true);
}
else if(apply_to == "healthy")
{
is_healthy_ = effect["set"].to_bool(true);
}
else if(apply_to == "profile") {
if (const config::attribute_value *v = effect.get("portrait")) {
std::string big = *v, small = effect["small_portrait"];
adjust_profile(small, big, "");
Expand Down

0 comments on commit 3204e4e

Please sign in to comment.