Esempio n. 1
0
class Merchant:
    def __init__(self,player):
	    self.player = player
        self.itemList=[get_item('l'),get_item('m')]
        self.selItem=0
        self.numItem=[0,0]
        self.totalPrice=0
        self.selDigit=3
        self.enteredDigits=[0,0,0,0]
        self.buyScreen=False
        self.buyMode=True
        self.sellMode=False
        self.yes=True
        self.shopKeeperVariable=0
        self.message=[]
        
        if self.player.shopTutorial = False:
            self.message.append("WELCOME TO SHOP - TUTORIAL MESSAGE")
Esempio n. 2
0
    def __init__(self, doorN, doorNFlag, doorS, doorSFlag, doorE, doorEFlag,
                 doorW, doorWFlag, roomFlag, en1, en2, en3, en4, it1, it2, it3,
                 it4):
        self.doorN = doorN
        self.doorNFlag = doorNFlag
        self.doorS = doorS
        self.doorSFlag = doorSFlag
        self.doorE = doorE
        self.doorEFlag = doorEFlag
        self.doorW = doorW
        self.doorWFlag = doorWFlag
        self.roomFlag = roomFlag

        self.en1 = en1
        self.en2 = en2
        self.en3 = en3
        self.en4 = en4

        if it1 != '0':
            self.it1 = get_item(it1)
        else:
            self.it1 = None

        if it2 != '0':
            self.it2 = get_item(it2)
        else:
            self.it2 = None

        if it3 != '0':
            self.it3 = get_item(it3)
        else:
            self.it3 = None

        if it4 != '0':
            self.it4 = get_item(it4)
        else:
            self.it4 = None

        self.image = 0
        self.transport = False
Esempio n. 3
0
  def __init__(self,player):
    Actor.__init__(self)

    self.player=player
    self.weapon=None
    self.armor=None
    self.accessory=None
    self.eqItem=[]          #player can equip up to 4 usable items to use in battle
    self.inv_Ar     = []        #inventory
    self.attacks_Ar = []        #associated array for attack string names and attack power values
    self.currentInput=""
    self.currentProb1=0
    self.currentProb2=0
    self.currentAnswer=0
    self.fractionSum=0
    self.akhal=0

    amulet=get_item('1')
    calculator=get_item('s')
    emptyItem=None
    self.eqItem=[emptyItem,emptyItem,emptyItem,emptyItem]
    self.inv_Ar=[amulet,calculator]
Esempio n. 4
0
  def __init__(self,doorN,doorNFlag,doorS,doorSFlag,doorE,doorEFlag,doorW,doorWFlag,roomFlag,en1,en2,en3,en4,it1,it2,it3,it4):
    self.doorN=doorN
    self.doorNFlag=doorNFlag
    self.doorS=doorS
    self.doorSFlag=doorSFlag
    self.doorE=doorE
    self.doorEFlag=doorEFlag
    self.doorW=doorW
    self.doorWFlag=doorWFlag
    self.roomFlag=roomFlag

    self.en1=en1
    self.en2=en2
    self.en3=en3
    self.en4=en4

    if it1 != '0':
        self.it1=get_item(it1)
    else:
        self.it1=None

    if it2 != '0':
        self.it2=get_item(it2)
    else:
        self.it2=None

    if it3 != '0':
        self.it3=get_item(it3)
    else:
        self.it3=None

    if it4 != '0':
        self.it4=get_item(it4)
    else:
        self.it4=None

    self.image=0
    self.transport=False
Esempio n. 5
0
 def __init__(self,player):
   self.player=player
   self.itemList=[get_item('l'),get_item('m')]
   self.selItem=0
   self.numItem=[0,0]
   self.totalPrice=0
   self.selDigit=3
   self.enteredDigits=[0,0,0,0]
   self.buyScreen=False
   self.buyMode=True
   self.sellMode=False
   self.yes=True
   self.shopKeeperVariable=0
   self.message=[]
   if self.player.shopTutorial==False:
     self.message.append("Welcome.  You can view my")
     self.message.append("wares by using the arrow keys")
     self.message.append("If you want to switch between")
     self.message.append("buying and selling, just press")
     self.message.append("   (B) or    (S)")
   else:
     self.message.append("Got some rare things")
     self.message.append("on sale stranger")
Esempio n. 6
0
 def __init__(self, player):
     self.player = player
     self.itemList = [get_item('l'), get_item('m')]
     self.selItem = 0
     self.numItem = [0, 0]
     self.totalPrice = 0
     self.selDigit = 3
     self.enteredDigits = [0, 0, 0, 0]
     self.buyScreen = False
     self.buyMode = True
     self.sellMode = False
     self.yes = True
     self.shopKeeperVariable = 0
     self.message = []
     if self.player.shopTutorial == False:
         self.message.append("Welcome.  You can view my")
         self.message.append("wares by using the arrow keys")
         self.message.append("If you want to switch between")
         self.message.append("buying and selling, just press")
         self.message.append("   (B) or    (S)")
     else:
         self.message.append("Got some rare things")
         self.message.append("on sale stranger")
Esempio n. 7
0
    def __init__(self, player):
        Actor.__init__(self)

        self.player = player
        self.weapon = None
        self.armor = None
        self.accessory = None
        self.eqItem = [
        ]  #player can equip up to 4 usable items to use in battle
        self.inv_Ar = []  #inventory
        self.attacks_Ar = [
        ]  #associated array for attack string names and attack power values
        self.currentInput = ""
        self.currentProb1 = 0
        self.currentProb2 = 0
        self.currentAnswer = 0
        self.fractionSum = 0
        self.akhal = 0

        amulet = get_item('1')
        calculator = get_item('s')
        emptyItem = None
        self.eqItem = [emptyItem, emptyItem, emptyItem, emptyItem]
        self.inv_Ar = [amulet, calculator]
Esempio n. 8
0
    def item_pickup(self):
        profile = self.game_engine.get_object('profile')
        current_room = self.rooms[profile.position]

        for i in range( 0, 4 ):
            item_key = current_room.get_item( i )

            # If visible, remove from room and place in players inventory
            if item_key[0] != '0' and item_key[1] == 'v':
                item = get_item( item_key[0] )
                profile.give_item( item )
                current_room.remove_item( i )
                self.game_engine.get_object('mesg').add_line(_("%s discovered!")% item.name)
                return
        self.game_engine.get_object('mesg').add_line(_("No items found."))
Esempio n. 9
0
    def item_pickup(self):
        profile = self.game_engine.get_object('profile')
        current_room = self.rooms[profile.position]

        for i in range(0, 4):
            item_key = current_room.get_item(i)

            # If visible, remove from room and place in players inventory
            if item_key[0] != '0' and item_key[1] == 'v':
                item = get_item(item_key[0])
                profile.give_item(item)
                current_room.remove_item(i)
                self.game_engine.get_object('mesg').add_line(
                    _("%s discovered!") % item.name)
                return
        self.game_engine.get_object('mesg').add_line(_("No items found."))
Esempio n. 10
0
    def draw(self):
        profile = self.game_engine.get_object('profile')
        dir = profile.playerFacing
        current_room = self.rooms[profile.position]

        # Draw Room Doors
        left, front, right = self.normalize_dir()
        if current_room.get_door(left) != '0':
            self.doorsList[0].makeTransparent(False)
        else:
            self.doorsList[0].makeTransparent(True)

        if current_room.get_door(front) != '0':
            self.doorsList[1].makeTransparent(False)
        else:
            self.doorsList[1].makeTransparent(True)

        if current_room.get_door(right) != '0':
            self.doorsList[2].makeTransparent(False)
        else:
            self.doorsList[2].makeTransparent(True)

        # Draw Items
        img_list = []

        cnt = 0
        for i in range(dir, (dir + 4)):
            #imod for room rotation
            imod = i % 4

            item_key = current_room.get_item(imod)

            if item_key[0] == '0' or item_key[1] != 'v':
                self.itemsList[cnt].makeTransparent(True)
            else:
                self.itemsList[cnt].repopulateImages([
                    pygame.image.load(ITEM_PATH + get_item(item_key[0]).path)
                ])
                self.itemsList[cnt].makeTransparent(False)

            cnt += 1
Esempio n. 11
0
    def __end_battle(self, menu):
        # Give items if any
        room = self.game_engine.get_object("dungeon").get_current_room()

        for i in range(0, 4):
            item_key = room.get_item(i)
            # If visible, remove from room and place in players inventory
            if item_key[0] != "0" and item_key[1] == "b":
                item = get_item(item_key[0])
                self.game_engine.get_object("profile").give_item(item)
                room.remove_item(i)
                self.game_engine.get_object("mesg").add_line(_("%s dropped!") % item.name)
        room.has_enemy = False

        # self terminate
        # print 'end battle called'
        self.remove_from_engine()

        self.game_engine.get_object("battlemenu").remove_from_engine()
        self.game_engine.remove_object("battlemenu")
        self.game_engine.remove_object("battle")
Esempio n. 12
0
    def __end_battle(self, menu):
        #Give items if any
        room = self.game_engine.get_object('dungeon').get_current_room()

        for i in range(0, 4):
            item_key = room.get_item(i)
            # If visible, remove from room and place in players inventory
            if item_key[0] != '0' and item_key[1] == 'b':
                item = get_item(item_key[0])
                self.game_engine.get_object('profile').give_item(item)
                room.remove_item(i)
                self.game_engine.get_object('mesg').add_line(
                    _("%s dropped!") % item.name)
        room.has_enemy = False

        #self terminate
        #print 'end battle called'
        self.remove_from_engine()

        self.game_engine.get_object('battlemenu').remove_from_engine()
        self.game_engine.remove_object('battlemenu')
        self.game_engine.remove_object('battle')
Esempio n. 13
0
    def draw(self):
        profile = self.game_engine.get_object('profile')
        dir = profile.playerFacing
        current_room = self.rooms[profile.position]

        # Draw Room Doors
        left, front, right = self.normalize_dir()
        if current_room.get_door( left ) != '0':
            self.doorsList[0].makeTransparent(False)
        else:
            self.doorsList[0].makeTransparent(True)

        if current_room.get_door( front ) != '0':
            self.doorsList[1].makeTransparent(False)
        else:
            self.doorsList[1].makeTransparent(True)

        if current_room.get_door( right ) != '0':
            self.doorsList[2].makeTransparent(False)
        else:
            self.doorsList[2].makeTransparent(True)

        # Draw Items
        img_list = []

        cnt = 0
        for i in range( dir, (dir + 4) ):
            #imod for room rotation
            imod = i % 4

            item_key = current_room.get_item( imod )

            if item_key[0] == '0' or item_key[1] != 'v':
                self.itemsList[cnt].makeTransparent(True)
            else:
                self.itemsList[cnt].repopulateImages([pygame.image.load(ITEM_PATH + get_item( item_key[0] ).path)])
                self.itemsList[cnt].makeTransparent(False)
                
            cnt += 1