-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
145 lines (134 loc) · 4.83 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 20 23:54:12 2018
@author: X
"""
import random
from Map_ import *
from Player import *
from Item import *
from Assistant import *
from Weapon import *
from Bullet import *
from Enemy import *
from Bag import *
import time
import os
if __name__ == '__main__':
birthPoint = (0,0)
player = Player(birthPoint)
player.initalizeCharacterStatus()
player.getCharacterStatus()
cell =Cell()
map_ = Map()
#map_.mapStructure()
#map_.drawMap(cell,birthPoint)
itemList = itemList(map_.map,0.62)
itemList.generate()
weaponList = weaponList(map_.map,0.5)
weaponList.generate()
bulletPackList = bulletPackList(map_.map,0.52)
bulletPackList.generate()
enemyList = enemyList(map_.map,0.7)
enemyList.generate(birthPoint)
#print(itemList.getList())
cellCheck = cellCheck(itemList,weaponList,bulletPackList,enemyList)
bag = Bag()
weaponSlot = weaponSlot()
bulletBag =bulletBag()
#print(itemList.itemsDict,len(itemList.itemsDict))
while True:
print('-'*50)
map_.drawMap(cell,player.getLocation())
command = input('Please input command...')
os.system('CLS')
if command in ['w','s','a','d']:
direction = command
player.move(direction,map_)
#map_.drawMap(cell,player.getLocation())
player.locationInfo()
#print(direction)
#print(player.getLocation())
#elif command == 'search':
# print('Searching...')
# time.sleep(1)
hasBattle = cellCheck.enemyCheck(player)
while hasBattle==True:
test = input('press "a" to end the battle')
if test == 'a':
hasBattle=False
enemyList.removeEnemy(hasBattle,player)
cellCheck.assistantCheck(player)
cellCheck.weaponCheck(player)
cellCheck.bulletCheck(player)
#isDirRight = True
########################
elif command[:4] == 'take':
if command[4:] in ['medbot','epin','medkit','armer','nano','vsi']:
try:
anItem = itemList.getList()[player.getLocation()]
player.getItem(anItem,bag,itemList)
except:
print('No item in this room')
elif command[4:] in ['hg','smg','rf','ar','kn']:
try:
anWeapon = weaponList.getList()[player.getLocation()]
player.getItem(weaponSlot.multiWeaponCheck(anWeapon),weaponSlot,weaponList)
except:
print('No weapon in this room')
elif command[4:] in ['ub']:
try:
bP = bulletPackList.getList()[player.getLocation()]
player.getItem(bP,bulletBag,bulletPackList)
except:
print('No bullet pack in this room')
else:
print('Type "take+short name of item" to take item')
#print(itemList.itemsDict,len(itemList.itemsDict))
elif command == 'checkbag':
bag.info()
pass
elif command == 'checkweapon':
weaponSlot.info()
pass
elif command == 'checkbullet':
bulletBag.info()
pass
elif command == 'self':
player.getCharacterStatus()
elif command == 'useitem':
commandItem = input('what item do you want to use..')
player.useItem(commandItem,bag)
elif command == 'discarditem':
bag.info()
commandItem = input('what item do you want to discard..')
if commandItem == 'q':
continue
else:
player.discardItem(commandItem,bag)
elif command[:6] == 'weapon':
weaponSlot.info()
commandWeapon = input('which weapon do you want to use..')
player.useWeapon(commandWeapon,weaponSlot)
elif command == 'fist':
player.fist()
elif command == 'discardweapon':
weaponSlot.info()
commandItem = input('what item do you want to discard..')
if commandItem == 'q':
continue
else:
player.discardItem(commandItem,weaponSlot)
player.discardWeaponInHand(commandItem)
elif command == 'attack':
dV = player.attack()
print(dV)
elif command == 'reload':
player.reloadWeapon(bulletBag)
pass
############################
elif command=='q':
break
else:
#map_.drawMap(cell,player.getLocation())
print('Invaild command')