b3yond 2016-12-21 14:36:44 +01:00
commit 16d4050c9b
13 changed files with 1152 additions and 637 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
code/augmentations.pyc Normal file

Binary file not shown.

View File

@ -43,9 +43,14 @@ class RoomEditor(object):
and can give certain fields other values, which go into Room.fielddata
or it does when its ready >.<
weird bug: Save&Quit doesnt close the window, but still returns a room object.
:todo übergebe room, nicht fields
"""
def __init__(self):
def __init__(self, fields=0):
"""
:param fields: lists of lists 30x52
"""
self.chosen = "W"
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
@ -55,12 +60,14 @@ class RoomEditor(object):
self.box2 = gtk.HBox(False, 0)
self.menubox = gtk.VBox(False, 0)
# initialise list of lists: fields, later argument to Room()
self.fields = []
for i in range(30):
self.fields.append([])
for j in range(52):
self.fields[i].append("O")
if fields != 0:
self.fields = fields
# if no fields given, initialise list of lists: fields, later argument to Room()
else:
for i in range(30):
self.fields.append([])
for j in range(52):
self.fields[i].append("O")
# initialize dictionary: fielddata, later argument to Room()
self.fielddata = {}
self.show_fields()
@ -690,12 +697,15 @@ def erase_fielddata_entry(room):
def choose_target_enemy(room):
print "0: Abort"
for i in room.fielddata:
print i, room.fielddata[i]
print i + ":", room.fielddata[i]
choice = 0
while choice == 0:
try:
choice = int(raw_input("Which enemy is to be killed? "))
if choice == 0:
return
except ValueError:
print("ERROR: Enter a number.")
choice = 0

BIN
code/editor.pyc Normal file

Binary file not shown.

BIN
code/enemies.pyc Normal file

Binary file not shown.

View File

@ -203,6 +203,10 @@ class Mission(object):
if a == False:
return False
print current
player.bitcoins += self.rewardmoney
player.experience += self.rewardxp
for i in self.rewarditems:
player.inventory.add(i)
return True
def item_owned(self, player):
@ -249,11 +253,18 @@ class Panel(sdl2.ext.Entity):
class TextSprite(sdl2.ext.TextureSprite):
"""
font_cache: Dictionary { (font, fontsize) : TTF_OpenFont(font, fontsize) }
"""
font_cache = {}
def __init__(self, renderer, font=None, text="", fontsize=24,
textcolor=sdl2.pixels.SDL_Color(255, 255, 255),
background=sdl2.pixels.SDL_Color(30, 30, 30), depth=20):
self.renderer = renderer.renderer
self.font = TTF_OpenFont(font, fontsize)
if (font, fontsize) not in self.font_cache:
self.font_cache[(font, fontsize)] = TTF_OpenFont(font, fontsize)
self.font = self.font_cache.get((font, fontsize))
self._text = text
self.fontsize = fontsize
self.fontcolor = textcolor
@ -557,7 +568,7 @@ def create_text(world, renderer, text, x, y, fontsize=24, depth=20,
:param text: string
:param x: integer, position
:param y: integer, position
:return:
:return: Panel object
"""
font = "/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf"
sprite = TextSprite(renderer, font, text, fontsize=fontsize, background=background,
@ -934,6 +945,9 @@ def profile_sdl(m, player):
widgetlist, m = build_profile_sdl(m, player)
m.charwin.process()
break
with open("../saves/" + player.name, mode='w') as file:
pickle.dump(player, file)
m.console.push("Game Saved.")
running = False
break
m.charwin.process()
@ -1200,8 +1214,10 @@ def run_mission(m, player, mission):
:param mission: Mission object
:return: player
"""
print mission.description # debug
while not mission.success_func(player):
player, mission = run_room(m, player, mission)
print player.bitcoins # debug
return player
@ -1216,7 +1232,8 @@ def run_room(m, player, mission):
running = True
while running:
widgetlist = display_fields(m, player, mission)
print "running"
# print "running" # debug
# print mission.current_room.fielddata # debug
events = sdl2.ext.get_events()
for event in events:
m.uiprocessor.dispatch(m.world, event)

BIN
code/game.pyc Normal file

Binary file not shown.

BIN
code/items.pyc Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
# # # # #
# TO-DO #
# # # # #
create new mission for testing
realise game in pySDL2
enemy list system: import data from pickle file.
document how enemy, mission, item, player data is packed.
@ -8,7 +9,7 @@ change player.bitcoins back to 50
# Misc
why the fuck is fielddata in Missions test, Sewers empty? old editor version?
# Function flow

127
saves/asdf Normal file
View File

@ -0,0 +1,127 @@
ccopy_reg
_reconstructor
p0
(c__main__
Vampire
p1
c__builtin__
object
p2
Ntp3
Rp4
(dp5
S'name'
p6
S'asdf'
p7
sS'agi'
p8
I5
sS'level'
p9
I1
sS'int'
p10
I5
sS'augmentations'
p11
(lp12
sS'hp'
p13
I98
sS'gun'
p14
g0
(citems
Gun
p15
g2
Ntp16
Rp17
(dp18
g6
S'No gun'
p19
sS'price'
p20
I0
sS'damage'
p21
I0
sS'grange'
p22
I0
sS'ap'
p23
I0
sS'type'
p24
g14
sS'image'
p25
S''
p26
sbsS'experience'
p27
I0
sS'race'
p28
S'Vampire'
p29
sS'sword'
p30
g0
(citems
Sword
p31
g2
Ntp32
Rp33
(dp34
g6
S'Fist'
p35
sS'silverdamage'
p36
I00
sg24
g30
sg20
I0
sg21
I0
sg23
I50
sS'critical'
p37
F0.0
sS'stun'
p38
F0.3
sg25
g26
sbsS'inventory'
p39
(lp40
sS'str'
p41
I8
sS'max_hp'
p42
I98
sS'bitcoins'
p43
I150
sS'mob'
p44
I5
sS'ic'
p45
I0
sS'id'
p46
I1
sS'con'
p47
I6
sb.

183
saves/b3yond Normal file
View File

@ -0,0 +1,183 @@
ccopy_reg
_reconstructor
p0
(c__main__
Vampire
p1
c__builtin__
object
p2
Ntp3
Rp4
(dp5
S'str'
p6
I8
sS'name'
p7
S'b3yond'
p8
sS'agi'
p9
I5
sS'level'
p10
I1
sS'int'
p11
I5
sS'augmentations'
p12
(lp13
S'wallhack'
p14
aS'cosmetic surgery'
p15
asS'hp'
p16
I98
sS'gun'
p17
g0
(citems
Gun
p18
g2
Ntp19
Rp20
(dp21
g7
S'No gun'
p22
sS'price'
p23
I0
sS'damage'
p24
I0
sS'grange'
p25
I0
sS'ap'
p26
I0
sS'type'
p27
S'gun'
p28
sS'image'
p29
S''
p30
sbsS'experience'
p31
I300
sS'race'
p32
S'Vampire'
p33
sS'inventory'
p34
(lp35
g0
(g18
g2
Ntp36
Rp37
(dp38
g7
S'Kalaschnikow'
p39
sg23
I80
sg24
I30
sg25
I10
sg26
I100
sg27
S'gun'
p40
sg29
S'guns/kalaschnikow.gif'
p41
sbag0
(citems
Sword
p42
g2
Ntp43
Rp44
(dp45
g7
S'Mace'
p46
sS'silverdamage'
p47
I00
sg27
S'sword'
p48
sg23
I70
sg24
I70
sg26
I100
sS'critical'
p49
F0.1
sS'stun'
p50
F0.5
sg29
S'swords/mace.gif'
p51
sbasS'sword'
p52
g0
(g42
g2
Ntp53
Rp54
(dp55
g7
S'Fist'
p56
sg47
I00
sg27
S'sword'
p57
sg23
I0
sg24
I0
sg26
I50
sg49
F0.0
sg50
F0.3
sg29
g30
sbsS'max_hp'
p58
I98
sS'mob'
p59
I5
sS'ic'
p60
I0
sS'con'
p61
I6
sS'id'
p62
I1
sS'bitcoins'
p63
I100
sb.

179
saves/test Normal file
View File

@ -0,0 +1,179 @@
ccopy_reg
_reconstructor
p0
(c__main__
Golem
p1
c__builtin__
object
p2
Ntp3
Rp4
(dp5
S'str'
p6
I8
sS'name'
p7
S'test'
p8
sS'agi'
p9
I4
sS'level'
p10
I1
sS'int'
p11
I3
sS'augmentations'
p12
(lp13
sS'hp'
p14
I106
sS'gun'
p15
g0
(citems
Gun
p16
g2
Ntp17
Rp18
(dp19
g7
S'No gun'
p20
sS'price'
p21
I0
sS'damage'
p22
I0
sS'grange'
p23
I0
sS'ap'
p24
I0
sS'type'
p25
S'gun'
p26
sS'image'
p27
S''
p28
sbsS'experience'
p29
I0
sS'race'
p30
S'Golem'
p31
sS'inventory'
p32
(lp33
g0
(citems
Sword
p34
g2
Ntp35
Rp36
(dp37
g7
S'Short sword'
p38
sS'silverdamage'
p39
I00
sg25
S'sword'
p40
sg21
I40
sg22
I50
sg24
I90
sS'critical'
p41
F0.3
sS'stun'
p42
F0.0
sg27
S'swords/shortsword.gif'
p43
sbag0
(g16
g2
Ntp44
Rp45
(dp46
g7
S'Kalaschnikow'
p47
sg21
I80
sg22
I30
sg23
I10
sg24
I100
sg25
S'gun'
p48
sg27
S'guns/kalaschnikow.gif'
p49
sbasS'sword'
p50
g0
(g34
g2
Ntp51
Rp52
(dp53
g7
S'Fist'
p54
sg39
I00
sg25
S'sword'
p55
sg21
I0
sg22
I0
sg24
I50
sg41
F0.0
sg42
F0.3
sg27
g28
sbsS'max_hp'
p56
I106
sS'mob'
p57
I4
sS'ic'
p58
I0
sS'con'
p59
I7
sS'id'
p60
I1
sS'bitcoins'
p61
I30
sb.