Set not_living based on the undead and mechanical traits...

...in a manner consistant with other trait definititions. Get rid of
not_living key from race. Still need to put back a way for AI to tell
if a unit_type is going to be not_living.
This commit is contained in:
Bruno Wolff III 2007-08-15 15:03:56 +00:00
parent 53c9dd8653
commit a1da27a34f
8 changed files with 14 additions and 23 deletions

View file

@ -23,6 +23,10 @@
male_name= _ "undead"
female_name= _ "female^undead"
description= _ "Immune to drain, poison and plague"
[effect]
apply_to=status
add=not_living
[/effect]
[/trait]
#enddef
@ -34,6 +38,10 @@
male_name= _ "mechanical"
female_name= _ "female^mechanical"
description= _ "Immune to drain, poison and plague"
[effect]
apply_to=status
add=not_living
[/effect]
[/trait]
#enddef

View file

@ -77,7 +77,6 @@
[race]
name=undead
not_living=yes
num_traits=1
ignore_global_traits=yes
{TRAIT_UNDEAD}
@ -131,7 +130,6 @@
[race]
name=mechanical
not_living=yes
num_traits=1
undead_variation=null
ignore_global_traits=yes

View file

@ -1574,7 +1574,9 @@ int ai::average_resistance_against(const unit_type& a, const unit_type& b) const
int sum = 0, weight_sum = 0;
bool steadfast = a.has_ability_by_id("steadfast");
bool living = !a.not_living();
// Currently not_living is by unit, not unit_type, so this isn't
// easy to check.
bool living = true;
const std::vector<attack_type>& attacks = b.attacks();
for (std::vector<attack_type>::const_iterator i = attacks.begin(),
i_end = attacks.end(); i != i_end; ++i)

View file

@ -92,7 +92,7 @@ ut_get_ability( skirmisher )
ut_get_ability( teleport )
ut_get_ability_by_id( curing )
ut_get_ability_by_id( steadfast )
ut_get( not_living )
// ut_get( not_living )
ut_get( can_advance )
ut_get( has_zoc )
ut_get( level )
@ -118,7 +118,7 @@ static PyGetSetDef unittype_getseters[] = {
ut_gs( skirmisher, "If type has skirmisher ability." )
ut_gs( teleport, "If type has teleport ability." )
ut_gs( steadfast, "If type has steadfast ability." )
ut_gs( not_living, "If type has not-living ability." )
// ut_gs( not_living, "If type has not-living ability." )
ut_gs( can_advance, "If type can advance." )
ut_gs( has_zoc, "If type has a ZOC." )
ut_gs( level, "Level of the type." )

View file

@ -126,12 +126,11 @@ static wide_string markov_generate_name(const markov_prefix_map& prefixes, size_
return originalRes;
}
unit_race::unit_race() : ntraits_(0), chain_size_(0), not_living_(false), traits_(&empty_traits), global_traits_(true)
unit_race::unit_race() : ntraits_(0), chain_size_(0), traits_(&empty_traits), global_traits_(true)
{
}
unit_race::unit_race(const config& cfg) : name_(cfg["name"]), ntraits_(atoi(cfg["num_traits"].c_str())),
not_living_(utils::string_bool(cfg["not_living"])),
traits_(&cfg.get_children("trait")), global_traits_(!utils::string_bool(cfg["ignore_global_traits"]))
{
names_[MALE] = utils::split(cfg["male_names"]);
@ -164,8 +163,6 @@ const config::child_list& unit_race::additional_traits() const
unsigned int unit_race::num_traits() const { return ntraits_; }
bool unit_race::not_living() const { return not_living_; }
std::string const& gender_string(unit_race::GENDER gender) {
static const std::string female_string = "female";
static const std::string male_string = "male";

View file

@ -41,8 +41,6 @@ public:
const config::child_list& additional_traits() const;
unsigned int num_traits() const;
bool not_living() const;
private:
t_string name_;
unsigned int ntraits_;
@ -50,8 +48,6 @@ private:
markov_prefix_map next_[NUM_GENDERS];
int chain_size_;
bool not_living_;
const config::child_list* traits_;
bool global_traits_;
};

View file

@ -202,9 +202,6 @@ unit::unit(const game_data* gamedata, unit_map* unitmap, const gamemap* map,
refreshing_ = false;
hidden_ = false;
offset_ = 0;
if(race_->not_living()) {
set_state("not_living","yes");
}
game_config::add_color_info(cfg);
}
@ -221,9 +218,6 @@ unit::unit(const game_data& gamedata,const config& cfg) : movement_(0),
refreshing_ = false;
hidden_ = false;
offset_ = 0;
if(race_->not_living()) {
set_state("not_living","yes");
}
}
void unit::clear_status_caches()
@ -549,9 +543,6 @@ void unit::advance_to(const unit_type* t)
set_state("poisoned","");
set_state("slowed","");
set_state("stoned","");
if(race_->not_living()) {
set_state("not_living","yes");
}
end_turn_ = false;
refreshing_ = false;
hidden_ = false;

View file

@ -216,7 +216,6 @@ public:
const std::vector<std::string>& abilities() const { return abilities_; }
const std::vector<std::string>& ability_tooltips() const { return ability_tooltips_; }
bool not_living() const { return race_->not_living(); }
bool can_advance() const { return !advances_to_.empty(); }
bool has_zoc() const { return zoc_; }