made units that 'die' get injuries in Wesbowl

This commit is contained in:
Dave White 2004-05-11 21:44:19 +00:00
parent 14f5af167f
commit 34c32276d6
2 changed files with 34 additions and 13 deletions

View file

@ -695,6 +695,22 @@ Defeat:
[event]
name=die
first_time_only=no
#give the unit an injury
[object]
silent=yes
[filter]
x,y=$x1,$y1
[/filter]
[effect]
apply_to=movement
increase=-25%
[/effect]
[effect]
apply_to=hitpoints
increase_total=-25%
[/effect]
[/object]
[store_unit]
variable=unit
[filter]

View file

@ -703,10 +703,12 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
}
else if(cmd == "object") {
const config* filter = cfg.child("filter");
const std::string& id = cfg["id"];
//if this item has already been used
if(used_items.count(id))
if(id != "" && used_items.count(id))
return rval;
const std::string image = cfg["image"];
@ -718,8 +720,6 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
std::string text;
const config* filter = cfg.child("filter");
gamemap::location loc;
if(filter != NULL) {
loc = gamemap::location(*filter);
@ -742,7 +742,11 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
text = cfg["description"];
u->second.add_modification("object",cfg);
screen->remove_overlay(event_info.loc1);
if(!loc.valid()) {
screen->remove_overlay(event_info.loc1);
}
screen->select_hex(event_info.loc1);
screen->invalidate_unit();
@ -756,17 +760,18 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
text = cfg["cannot_use_message"];
}
scoped_sdl_surface surface(NULL);
if(cfg["silent"] != "yes") {
scoped_sdl_surface surface(NULL);
if(image.empty() == false) {
surface.assign(image::get_image(image,image::UNSCALED));
if(image.empty() == false) {
surface.assign(image::get_image(image,image::UNSCALED));
}
//this will redraw the unit, with its new stats
screen->draw();
gui::show_dialog(*screen,surface,caption,text);
}
//this will redraw the unit, with its new stats
screen->draw();
gui::show_dialog(*screen,surface,caption,text);
}
//displaying a message on-screen