Made stoned units un-healable.

This commit is contained in:
Philippe Plantier 2005-11-07 23:13:42 +00:00
parent 4b7d8eef12
commit 5c5ffd4488
5 changed files with 28 additions and 3 deletions

View file

@ -137,6 +137,7 @@ SVN trunk:
* Added brief description of the Shroud and the Fog of War.
* Changed recall to allow you to see your recall list even if you have too
little gold to recall any units.
* prevented stoned units from being healed
* various bug fixes and code cleanups
Version 1.0rc1:

View file

@ -99,6 +99,15 @@ name=moveto
gold=2000
enemy=2
shroud=yes
[unit]
x,y=4,8
type="Elvish Avenger"
generate_description=yes
hitpoints=4
[status]
stone=on
[/status]
[/unit]
[/side]
[side]

View file

@ -1183,6 +1183,10 @@ bool will_heal(const gamemap::location& loc, int side, const std::vector<team>&
for(int n = 0; n != 6; ++n) {
const unit_map::const_iterator u = units.find(adjacent[n]);
if(u != units.end() && (u->second.hitpoints() < u->second.max_hitpoints() || u->second.poisoned())) {
//ignore stoned units
if(!u->second.healable())
continue;
const int unit_side = u->second.side();
//the healer won't heal an ally if there is a wounded unit on the same
@ -1216,6 +1220,9 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
for(i = units.begin(); i != units.end(); ++i) {
amount_healed = 0;
if (!i->second.healable())
continue;
//the unit heals if it's on this side, and it's on a village or
//it has regeneration, and it is wounded
if(i->second.side() == side) {
@ -1265,7 +1272,8 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
if(adj != units.end() &&
adj->second.hitpoints() < adj->second.max_hitpoints() &&
adj->second.side() == side &&
healed_units[adj->first] < max_healing[adj->first]) {
healed_units[adj->first] < max_healing[adj->first] &&
adj->second.healable()) {
++nhealed;
gets_healed[j] = true;
} else {
@ -1297,7 +1305,7 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
//are no longer poisoned
for(i = units.begin(); i != units.end(); ++i) {
if(i->second.side() == side && i->second.poisoned()) {
if(i->second.side() == side && i->second.poisoned() && i->second.healable()) {
const int damage = minimum<int>(game_config::cure_amount,
i->second.hitpoints()-1);
@ -1308,7 +1316,7 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
}
for(i = units.begin(); i != units.end(); ++i) {
if(i->second.side() == side) {
if(i->second.side() == side && i->second.healable()) {
if(i->second.hitpoints() < i->second.max_hitpoints() ||
i->second.poisoned()){
if(i->second.is_resting()) {

View file

@ -487,6 +487,11 @@ bool unit::incapacitated() const
return stone();
}
bool unit::healable() const
{
return !incapacitated();
}
bool unit::has_moved() const
{
return this->movement_left() != this->total_movement();

View file

@ -90,6 +90,8 @@ public:
bool stone() const;
bool incapacitated() const;
bool healable() const;
bool has_moved() const;
bool has_goto() const;