-- The Stooge must collect the hearts before he can claim
-- the treasure.

deferred class HEART

inherit

  SESSILE
  redefine
    will_accept_stooge, react, restart,
    build_record, customized_init
  end


feature{NONE}

  react_to_stooge is
  -- I'm his forever, so I vanish.
  do
    vacate
    vanished := True
    room.decrement_hearts
  ensure
    vanished
  end

feature -- save/restore

  build_record is
--  1,2,3 from GAME_PIECE
--  4 vanished
  do
    precursor
    if vanished then
      record.extend( 0 )
    else
      record.extend( 1 )
    end
  ensure then
    proper_num_rec: record.count > 3
  end

feature{NONE} -- save/restore

  customized_init( r : like room ; pr : like record ) is
  do
    precursor( r, pr )
    pr.forth 
    if pr.item = 0 then
      vanished := True
      display_vacate
    else 
      vanished := False
      occupy( northwest )
    end
  end

feature

  blocks_glare : BOOLEAN is True
  blocks_shots : BOOLEAN is True

  restart is
  do
    precursor
    vanished := False
  ensure then
    not vanished
  end

  vanished : BOOLEAN
  -- Have I been claimed by the Stooge.

  will_accept_stooge : BOOLEAN is
  -- Yup!
  do
    Result := True
  ensure then
    Result
  end

  react is
  -- Vanish if the Stooge has covered me.
  do
    if stooge.northwest = northwest and then not vanished then
      react_to_stooge
    end
  end

end 
