Ignore:
Timestamp:
Sep 4, 2009, 7:51:19 PM (11 years ago)
Author:
Adrianna Pińska <adrianna.pinska@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@201
Message:

selected chickens are selected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gamelib/animal.py

    r199 r200  
    6666
    6767    def equip(self, item):
    68         self.equipment.append(item)
     68        if equipment.is_equipment(item):
     69            self.equipment.append(item)
     70        elif equipment.is_accoutrement(item):
     71            self.accoutrements.append(item)
    6972        self.redraw()
    7073
    7174    def unequip(self, item):
    72         self.equipment = [e for e in self.equipment if e != item]
     75        if equipment.is_equipment(item):
     76            self.equipment = [e for e in self.equipment if e != item]
     77        elif equipment.is_accoutrement(item):
     78            self.accoutrements = [e for e in self.accoutrements if e != item]
    7379        self.redraw()
     80
     81    def unequip_by_name(self, item_name):
     82        # only remove first match
     83        matches = [item for item in self.equipment + self.accoutrements if item.NAME == item_name]
     84        if matches:
     85            self.unequip(matches[0])
    7486
    7587    def redraw(self):
Note: See TracChangeset for help on using the changeset viewer.