add healthy and fearless [effect]s

so we don't have to these these traits specialy.
This commit is contained in:
gfgtdf 2014-07-19 02:19:26 +02:00
parent 7531089162
commit 3204e4eb56
2 changed files with 19 additions and 4 deletions

View file

@ -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
@ -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
@ -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

View file

@ -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();
}
@ -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, "");