コード例 #1
0
 def testCanNotAddIfFull(self):
     t1 = mc2.MudObject()
     t2 = mc2.MudObject()
     self.ml.append(t1)
     assert self.ml.append(t2) == False
コード例 #2
0
ファイル: mud-mc3.py プロジェクト: bitcraft/mud
w_fist = mc.Weapon("main hand")
w_fist.shortDescription = "your two fists"
w_fist.name = "unarmed"
w_fist.dp = 2
w_fist.keywords = ['Unarmed']
w_fist.verb = english.Verb("punch")

cretin = mc.Mobile()
cretin.name = "Cretin"
cretin.hp = 10
cretin.shortDescription = "ugly man"
cretin.keywords = ['self', 'me']
cretin.addGearSlot(mc.ItemSlot("main hand", "all", w_fist))

desk = mc.MudObject("Wooden Desk", "shabby wooden desk")
desk.keywords = ['desk']

backpack = mc.Bag("Backpack", "small orange backpack")
backpack.maxSize = 2
backpack.keywords = ['orange backpack', 'bag', 'backpack']

fang = mc.Weapon("main hand", "Fang", 4)
fang.shortDescription = "small knife with a faint glow"
fang.keywords = ['knife', 'dagger']
fang.verb = english.Verb("stab")

r_bedroom = mc.Room("Bedroom")
r_bedroom.longDescription = "Your bedroom."
r_apartment = mc.Room("An apartment")
r_apartment.longDescription = "Your room, a desk sits in the corner."
コード例 #3
0
 def testCanTestIsIn(self):
     t = mc2.MudObject()
     self.ml.append(t)
     assert (t in self.ml) == True
コード例 #4
0
 def testCanTestIsNotIn(self):
     t = mc2.MudObject()
     assert (t in self.ml) == False
コード例 #5
0
 def testCanNotRemoveIfNotIn(self):
     t = mc2.MudObject()
     assert self.ml.remove(t) == False
コード例 #6
0
 def testCanRemoveIfIn(self):
     t = mc2.MudObject()
     self.ml.append(t)
     assert self.ml.remove(t) == True
コード例 #7
0
 def testCanAdd(self):
     t = mc2.MudObject()
     assert self.ml.append(t) == True
コード例 #8
0
 def setUp(self):
     self.root = mc2.PermissionHandler()
     self.t = mc2.MudObject(owner=self.root)
コード例 #9
0
 def testCanNotAddIfFull(self):
     t1 = mc2.MudObject()
     t2 = mc2.MudObject()
     self.r.append(t1)
     r = self.r.append(t2)
     assert r == False