More regular enforcement of maximum hit points.
This impacts [transform_unit], [effect]apply_to=type, [effect]apply_to=variation, and wesnoth.transform_unit().
This commit is contained in:
parent
7b0a480254
commit
c4f81f2ebf
2 changed files with 11 additions and 3 deletions
|
@ -28,8 +28,8 @@ Version 1.11.1+svn:
|
|||
* Lua API:
|
||||
* new wesnoth.get_time_stamp() function
|
||||
* new helper.shuffle() function
|
||||
* The wesnoth.transform_unit() function no longer performs a full heal when
|
||||
the type has actually changed.
|
||||
* The wesnoth.transform_unit() function no longer performs a full heal. It
|
||||
will (still) enforce the resulting unit's maximum hit points, though.
|
||||
* Multiplayer:
|
||||
* Moved new lobby option in Preferences -> Multiplayer to Advanced
|
||||
Preferences and clarified description
|
||||
|
@ -45,6 +45,8 @@ Version 1.11.1+svn:
|
|||
* Split the 'not_living' unit status into 'unpoisonable', 'undrainable' and
|
||||
'unplagueable'. 'not_living' now acts on the whole group
|
||||
* The bugs with sighted events have been resolved.
|
||||
* A unit's maximum hit points are more regularly applied. This affects
|
||||
[transform_unit], [effect]apply_to=type, and [effect]apply_to=variation.
|
||||
* Miscellaneous and bug fixes:
|
||||
* The undo stack is preserved across a save-reload.
|
||||
* Removed several unused private member variables.
|
||||
|
|
|
@ -826,7 +826,8 @@ std::vector<std::string> unit::get_traits_list() const
|
|||
|
||||
/**
|
||||
* Advances this unit to the specified type.
|
||||
* Current hit points and experience are left unchanged.
|
||||
* Experience is left unchanged.
|
||||
* Current hit point total is left unchanged unless it would violate max HP.
|
||||
*/
|
||||
void unit::advance_to(const config &old_cfg, const unit_type *t,
|
||||
bool use_traits)
|
||||
|
@ -935,6 +936,11 @@ void unit::advance_to(const config &old_cfg, const unit_type *t,
|
|||
// that may result in different effects after the advancement.
|
||||
apply_modifications();
|
||||
|
||||
// Now that modifications are done modifying the maximum hit points,
|
||||
// enforce this maximum.
|
||||
if ( hit_points_ > max_hit_points_ )
|
||||
hit_points_ = max_hit_points_;
|
||||
|
||||
// In case the unit carries EventWML, apply it now
|
||||
game_events::add_events(cfg_.child_range("event"), type_);
|
||||
cfg_.clear_children("event");
|
||||
|
|
Loading…
Add table
Reference in a new issue