From 7971925f7accdd2c21256ebeb6f69968ed14177d Mon Sep 17 00:00:00 2001 From: jj Date: Fri, 29 Jun 2012 11:51:54 +0200 Subject: [PATCH] slayrace: ignore caged units --- scripts/slayrace.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/slayrace.rb b/scripts/slayrace.rb index bf8ccb939..27b1ba3cc 100644 --- a/scripts/slayrace.rb +++ b/scripts/slayrace.rb @@ -2,8 +2,15 @@ race = $script_args[0] +checkunit = lambda { |u| + u.body.blood_count != 0 and + not u.flags1.dead and + not u.flags1.caged and + not df.map_designation_at(u).hidden +} + all_races = df.world.units.active.map { |u| - u.race_tg.creature_id if not u.flags1.dead and not df.map_designation_at(u).hidden + u.race_tg.creature_id if checkunit[u] }.compact.uniq.sort if !race @@ -13,10 +20,10 @@ else raise 'invalid race' if not raw_race race_nr = df.world.raws.creatures.all.index { |cr| cr.creature_id == raw_race } - count = 0 + count = 0 df.world.units.active.each { |u| - if u.race == race_nr and u.body.blood_count != 0 and not u.flags1.dead + if u.race == race_nr and checkunit[u] u.body.blood_count = 0 count += 1 end