Add icons for invulnerable and unhealable states (#7363)

This commit is contained in:
Elvish_Hunter 2023-02-13 10:01:35 +01:00 committed by GitHub
parent e522cf426c
commit 7cfd699e9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
images/misc/unhealable.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -353,6 +353,14 @@ static config unit_status(reports::context & rc, const unit* u)
add_status(res, "misc/petrified.png", N_("petrified: "),
N_("This unit has been petrified. It may not move or attack."));
}
if (u->get_state(unit::STATE_UNHEALABLE)) {
add_status(res, "misc/unhealable.png", N_("unhealable: "),
N_("This unit is unhealable. It cannot be healed by healers or villages and doesn't benefit from resting."));
}
if (u->get_state(unit::STATE_INVULNERABLE)) {
add_status(res, "misc/invulnerable.png", N_("invulnerable: "),
N_("This unit is invulnerable. It cannot be harmed by any attack."));
}
return res;
}
REPORT_GENERATOR(unit_status,rc)

View file

@ -632,7 +632,7 @@ void unit::init(const config& cfg, bool use_traits, const vconfig* vcfg)
}
if(const config::attribute_value* v = cfg.get("invulnerable")) {
set_state("invulnerable", v->to_bool());
set_state(STATE_INVULNERABLE, v->to_bool());
}
goto_.set_wml_x(cfg["goto_x"].to_int());
@ -1428,13 +1428,14 @@ unit::state_t unit::get_known_boolean_state_id(const std::string& state)
}
std::map<std::string, unit::state_t> unit::known_boolean_state_names_ {
{"slowed", STATE_SLOWED},
{"poisoned", STATE_POISONED},
{"petrified", STATE_PETRIFIED},
{"uncovered", STATE_UNCOVERED},
{"not_moved", STATE_NOT_MOVED},
{"unhealable", STATE_UNHEALABLE},
{"guardian", STATE_GUARDIAN},
{"slowed", STATE_SLOWED},
{"poisoned", STATE_POISONED},
{"petrified", STATE_PETRIFIED},
{"uncovered", STATE_UNCOVERED},
{"not_moved", STATE_NOT_MOVED},
{"unhealable", STATE_UNHEALABLE},
{"guardian", STATE_GUARDIAN},
{"invulnerable", STATE_INVULNERABLE},
};
void unit::set_state(const std::string& state, bool value)

View file

@ -860,14 +860,15 @@ public:
* Built-in status effects known to the engine
*/
enum state_t {
STATE_SLOWED = 0, /** The unit is slowed - it moves slower and does less damage */
STATE_POISONED, /** The unit is poisoned - it loses health each turn */
STATE_PETRIFIED, /** The unit is petrified - it cannot move or be attacked */
STATE_UNCOVERED, /** The unit is uncovered - it was hiding but has been spotted */
STATE_NOT_MOVED, /** The unit has not moved @todo Explain better */
STATE_UNHEALABLE, /** The unit cannot be healed */
STATE_GUARDIAN, /** The unit is a guardian - it won't move unless a target is sighted */
STATE_UNKNOWN = -1/** A status effect not known to the engine */
STATE_SLOWED = 0, /** The unit is slowed - it moves slower and does less damage */
STATE_POISONED, /** The unit is poisoned - it loses health each turn */
STATE_PETRIFIED, /** The unit is petrified - it cannot move or be attacked */
STATE_UNCOVERED, /** The unit is uncovered - it was hiding but has been spotted */
STATE_NOT_MOVED, /** The unit has not moved @todo Explain better */
STATE_UNHEALABLE, /** The unit cannot be healed */
STATE_GUARDIAN, /** The unit is a guardian - it won't move unless a target is sighted */
STATE_INVULNERABLE, /** The unit is invulnerable - it cannot be hit by any attack */
STATE_UNKNOWN = -1 /** A status effect not known to the engine */
};
/**