-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok, my previous mail seems to have disapeared, so I try again

after a little more discussion with Sirp and co on the IRC channel, I've
prepared the folowing patch (attached, not on savannah yet)

- - slowed units emit no ZOC
- - slowed units have their movement halved
- - slow doesn't affect the number of attacks anymore
- - slow doesn't disapear at the end of turn, but when resting or healing
on a village

this patch replaces the previous one, it's not on top of it

ok, it's tested and good to go...


Boucman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDaarrSBeC9Fa95UURAnyxAKCXfJh0+cnqjpClTzw4V4ata2vToACeOk6x
1cQ++GMyUj5UJn6ZCNDufgU=
=N7IR
-----END PGP SIGNATURE-----
Index: reports.cpp
===================================================================
--- reports.cpp (révision 8705)
+++ reports.cpp (copie de travail)
@@ -126,7 +126,7 @@
                }
                if(u->second.has_flag("slowed")) {
                        unit_status << "misc/slowed.png";
-                       tooltip << _("slowed: ") << _("This unit has been 
slowed. It moves at half normal speed and receives one less attack than normal 
in combat.");
+                       tooltip << _("slowed: ") << _("This unit has been 
slowed. It moves at half normal speed and does not emit a zone of control.");
                        res.add_image(unit_status,tooltip);
                }
                if(u->second.has_flag("poisoned")) {
Index: actions.cpp
===================================================================
--- actions.cpp (révision 8705)
+++ actions.cpp (copie de travail)
@@ -642,13 +642,6 @@
                res.amount_attacker_drains = res.damage_defender_takes/2;
        }
 
-       static const std::string slowed_string("slowed");
-       if(a->second.has_flag(slowed_string) && res.nattacks > 1)
-               --res.nattacks;
-
-       if(d->second.has_flag(slowed_string) && res.ndefends > 1)
-               --res.ndefends;
-
        // FIXME: doesn't take into account berserk+slow or drain
        if (strings && res.amount_attacker_drains == 0 &&
                res.amount_defender_drains == 0 &&
@@ -1219,6 +1212,7 @@
                                           const std::vector<team>& teams)
 {
        std::map<gamemap::location,int> healed_units, max_healing;
+       std::map<gamemap::location,bool> unslowed_units;
 
        //a map of healed units to their healers
        std::multimap<gamemap::location,gamemap::location> healers;
@@ -1319,8 +1313,23 @@
                }
        }
 
+       // last, add units that need unslowing
        for(i = units.begin(); i != units.end(); ++i) {
+               //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) {
+                       if( i->second.has_flag("slowed") && 
+                                       (map.gives_healing(i->first) || 
i->second.is_resting()) ){
+                               i->second.remove_flag("slowed");
+                               
unslowed_units.insert(std::pair<gamemap::location,int>( i->first, true));
+                               // add it to healed_units so it gets applied
+                               // note that insert won't add anything if it's 
already there
+                               
healed_units.insert(std::pair<gamemap::location,int>( i->first, 0));
+                       }
+               }
+       }
+       for(i = units.begin(); i != units.end(); ++i) {
+               if(i->second.side() == side) {
                        if(i->second.hitpoints() < i->second.max_hitpoints() ||
                                        i->second.poisoned()){
                                if(i->second.is_resting()) {
@@ -1392,6 +1401,17 @@
 
                const int DelayAmount = 50;
 
+               // take care of unslowed units
+               if(unslowed_units[h->first]) {
+                       if(show_healing) {
+                               events::pump();
+
+                               sound::play_sound("heal.wav");
+                               SDL_Delay(DelayAmount);
+                               disp.invalidate_unit();
+                               disp.update_display();
+                       }
+               }
                LOG_NG << "unit is poisoned? " << (u.has_flag("poisoned") ? 
"yes" : "no") << ","
                        << h->second << "," << max_healing[h->first] << "\n";
 
Index: unit.cpp
===================================================================
--- unit.cpp    (révision 8705)
+++ unit.cpp    (copie de travail)
@@ -338,7 +338,6 @@
 
 void unit::end_turn()
 {
-       remove_flag("slowed");
        if((moves_ != total_movement()) && (moves_ != NOT_MOVED)){
                resting_ = false;
        }
@@ -499,7 +498,7 @@
 
 bool unit::emits_zoc() const
 {
-       return type().has_zoc() && stone() == false;
+       return type().has_zoc() && stone() == false && !has_flag("slowed");
 }
 
 bool unit::matches_filter(const config& cfg) const

Reply via email to