Reform .notable() by adding .weapon(). But now, where is the brandy?
Cat's Eye Technologies
11 years ago
181 | 181 | self.move_to(location) |
182 | 182 | |
183 | 183 | def notable(self): |
184 | return self.treasure() or self.weapon() or self.animate() or self.horror() | |
185 | ||
186 | def treasure(self): | |
184 | 187 | return False |
185 | ||
186 | def treasure(self): # impies notable usually | |
188 | ||
189 | def weapon(self): | |
187 | 190 | return False |
188 | 191 | |
189 | def horror(self): # impies notable usually | |
192 | def horror(self): | |
190 | 193 | return False |
191 | 194 | |
192 | 195 | def takeable(self): |
307 | 310 | self.memory = {} |
308 | 311 | |
309 | 312 | def animate(self): |
310 | return True | |
311 | ||
312 | def notable(self): | |
313 | 313 | return True |
314 | 314 | |
315 | 315 | def address(self, other, topic, phrase, participants=None): |
433 | 433 | return self.converse(self.topic) |
434 | 434 | |
435 | 435 | # otherwise, if there are valuable items here, you *must* pick them up. |
436 | # TODO: OR IF IT IS AN ITEM YOU ARE LOOKING FOR; SAY, A BOTTLE OF BRANDY | |
436 | 437 | for x in self.location.contents: |
437 | if x.notable() and x.takeable(): | |
438 | if x.treasure() or x.weapon(): | |
438 | 439 | self.emit("<1> picked up <2>", [self, x]) |
439 | 440 | x.move_to(self) |
440 | 441 | self.memory[x.name] = Memory(x, self) |
463 | 464 | return self.wander() |
464 | 465 | if choice == 20: |
465 | 466 | self.emit("<1> yawned", [self]) |
466 | if choice == 21: | |
467 | elif choice == 21: | |
467 | 468 | self.emit("<1> gazed thoughtfully into the distance", [self]) |
468 | if choice == 22: | |
469 | elif choice == 22: | |
469 | 470 | self.emit("<1> thought <he-1> heard something", [self]) |
470 | if choice == 23: | |
471 | elif choice == 23: | |
471 | 472 | self.emit("<1> scratched <his-1> head", [self]) |
472 | if choice == 24: | |
473 | elif choice == 24: | |
473 | 474 | self.emit("<1> immediately had a feeling something was amiss", [self]) |
474 | 475 | else: |
475 | 476 | return self.wander() |
528 | 529 | else: # no memories of this |
529 | 530 | self.emit("<1> searched <2>", [self, container]) |
530 | 531 | for thing in container.contents: |
531 | if thing.notable() and thing.takeable(): | |
532 | # TODO: OR IF IT IS AN ITEM YOU ARE LOOKING FOR; SAY, A BOTTLE OF BRANDY | |
533 | if thing.treasure() or thing.weapon(): | |
532 | 534 | self.emit("<1> found <2> hidden there, and took <him-2>", [self, thing]) |
533 | 535 | thing.move_to(self) |
534 | 536 | self.memory[thing.name] = Memory(thing, self) |
601 | 603 | "'Where is the brandy? I need a drink,' moaned <1>", |
602 | 604 | [self, other, self_memory.subject]) |
603 | 605 | return |
604 | # this needs to be not *all* the time | |
606 | # this need not be *all* the time | |
605 | 607 | for x in other.contents: |
606 | 608 | if x.notable(): |
607 | 609 | self.memory[x.name] = Memory(x, other) |
681 | 683 | def takeable(self): |
682 | 684 | return True |
683 | 685 | |
684 | def notable(self): | |
686 | ||
687 | class Weapon(Item): | |
688 | def weapon(self): | |
685 | 689 | return True |
686 | ||
687 | 690 | |
688 | 691 | |
689 | 692 | class Male(Animate): |
747 | 750 | |
748 | 751 | |
749 | 752 | class Horror(Actor): |
750 | def notable(self): | |
751 | return True | |
752 | ||
753 | 753 | def horror(self): |
754 | 754 | return True |
755 | 755 | |
793 | 793 | |
794 | 794 | cupboards = Container('cupboards', kitchen) |
795 | 795 | liquor_cabinet = Container('liquor cabinet', dining_room) |
796 | brandy = Item('bottle of brandy', liquor_cabinet) | |
797 | 796 | mailbox = Container('mailbox', driveway) |
798 | 797 | |
799 | 798 | bobs_bed = Container("bed", bobs_bedroom) |
800 | 799 | alices_bed = Container("bed", alices_bedroom) |
801 | 800 | |
802 | revolver = Item('revolver', pick([bobs_bed, alices_bed])) | |
801 | brandy = Item('bottle of brandy', liquor_cabinet) | |
802 | revolver = Weapon('revolver', pick([bobs_bed, alices_bed])) | |
803 | 803 | dead_body = Horror('dead body', bathroom) |
804 | 804 | |
805 | 805 | alice = Female('Alice', None) |