mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 10:21:48 +00:00
Fix bug #14540...
..."debug-generated units with HP-modifying traits don't have full HP". Probably also fix an old similar bug with unit created by "plague". Unify these creation calls and give full MP to unit spawned by ":create".
This commit is contained in:
parent
e66c2152cf
commit
69884081ea
@ -1263,6 +1263,7 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context &stats)
|
||||
unit newunit(&units_, &reanimitor->second,
|
||||
attacker.get_unit().side(), true, unit_race::MALE);
|
||||
newunit.set_attacks(0);
|
||||
newunit.set_movement(0);
|
||||
// Apply variation
|
||||
if (undead_variation != "null")
|
||||
{
|
||||
|
@ -1404,13 +1404,12 @@ void menu_handler::create_unit_2(mouse_handler& mousehandler)
|
||||
}
|
||||
|
||||
unit chosen(&units_, &ut, 1, true, gender, "");
|
||||
chosen.new_turn();
|
||||
|
||||
//FIXME: the generate name option seems useless now, remove it
|
||||
if(!generate_name)
|
||||
chosen.set_name("");
|
||||
|
||||
chosen.new_turn();
|
||||
|
||||
const map_location& loc = mousehandler.get_last_hex();
|
||||
units_.replace(loc, chosen);
|
||||
|
||||
@ -3264,8 +3263,11 @@ void console_handler::do_create() {
|
||||
}
|
||||
|
||||
menu_handler_.units_.erase(loc);
|
||||
menu_handler_.units_.add(loc,
|
||||
unit(&menu_handler_.units_, &i->second, 1, true));
|
||||
|
||||
unit created(&menu_handler_.units_, &i->second, 1, true);
|
||||
created.new_turn();
|
||||
|
||||
menu_handler_.units_.add(loc, created);
|
||||
menu_handler_.gui_->invalidate(loc);
|
||||
menu_handler_.gui_->invalidate_unit();
|
||||
} else {
|
||||
|
@ -437,6 +437,11 @@ unit::unit(unit_map *unitmap, const unit_type *t, int side,
|
||||
apply_modifications();
|
||||
set_underlying_id();
|
||||
|
||||
// fill those after traits and modifs to have correct max
|
||||
movement_ = max_movement_;
|
||||
hit_points_ = max_hit_points_;
|
||||
attacks_left_ = max_attacks_;
|
||||
|
||||
/**
|
||||
* @todo Test whether the calls above modify these values if not they can
|
||||
* removed, since already set in the initialization list.
|
||||
|
Loading…
x
Reference in New Issue
Block a user