MrBomb, MrIceBlock, and Snail now die on invincibility rather than just being kicked...
[supertux.git] / src / badguy / mriceblock.cpp
index f056d4a..4b8d6e3 100644 (file)
@@ -134,9 +134,6 @@ MrIceBlock::collision(GameObject& object, const CollisionHit& hit)
 HitResponse
 MrIceBlock::collision_player(Player& player, const CollisionHit& hit)
 {
-  if(ice_state == ICESTATE_GRABBED)
-    return FORCE_MOVE;
-
   if(dir == UP) {
     return FORCE_MOVE;
   }
@@ -180,6 +177,13 @@ MrIceBlock::collision_badguy(BadGuy& badguy, const CollisionHit& hit)
 bool
 MrIceBlock::collision_squished(GameObject& object)
 {
+  Player* player = dynamic_cast<Player*>(&object);
+  if(player && (player->does_buttjump || player->is_invincible())) {
+    player->bounce(*this);
+    kill_fall();
+    return true;
+  }
+
   switch(ice_state) {
     case ICESTATE_KICKED:
     {
@@ -193,9 +197,8 @@ MrIceBlock::collision_squished(GameObject& object)
     // fall through
     case ICESTATE_NORMAL:
     {
-      Player* player = dynamic_cast<Player*>(&object);
       squishcount++;
-      if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) {
+      if (squishcount >= MAXSQUISHES) {
         kill_fall();
         return true;
       }
@@ -220,7 +223,6 @@ MrIceBlock::collision_squished(GameObject& object)
       break;
   }
 
-  Player* player = dynamic_cast<Player*>(&object);
   if (player) player->bounce(*this);
   return true;
 }
@@ -289,6 +291,4 @@ MrIceBlock::is_portable() const
   return ice_state == ICESTATE_FLAT;
 }
 
-IMPLEMENT_FACTORY(MrIceBlock, "mriceblock");
-
 /* EOF */