-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.py
106 lines (99 loc) · 4.88 KB
/
target.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
from random import shuffle
def do_target(x, number):
if number == 1:
print("任务:工厂要求提供焦炭,酒精,煤油以提高产能"
"\n(请提供对应一次能源:1个煤,1个生物质能,1个石油)")
respon = input("请回答:Y(接任务)或 N(不接任务) ")
if respon.upper() == "Y":
x.input_energy()
if x.power.built_list.get("coal") and x.power.built_list.get("creature") and x.power.built_list.get("oil"):
for i in ["coal","creature","oil"]:
x.gold -= x.power.e_list[i][0]
x.pollution += x.power.e_list[i][2]
x.power.built_list[i] -= 1
x.energy += 30
else:
print("对不起,你没有足够的能源")
elif number == 2:
print("任务:气象学家预测今年冬天将比往常更寒冷,"
"城市将需要石油气和沼气\n(请提供对应一次能源:1个石油,2个生物质能")
respon = input("请回答:Y(接任务)或 N(不接任务) ")
if respon.upper() == "Y":
x.input_energy()
if x.power.built_list.get("creature") == 2 and x.power.built_list.get("oil"):
x.gold -= x.power.e_list["creature"][0]*2
x.gold -= x.power.e_list["oil"][0]
x.pollution += x.power.e_list["creature"][2]*2
x.pollution += x.power.e_list["oil"][2]
x.power.built_list["creature"] -= 2
x.power.built_list["oil"] -= 1
x.energy += 30
elif number == 3:
print("任务:今年,人们迫切需要:汽油,煤气"
"\n(请提供相应一次能源:1个石油,2个煤)")
respon = input("请回答:Y(接任务)或 N(不接任务) ")
if respon.upper() == "Y":
x.input_energy()
if x.power.built_list.get("oil") and x.power.built_list.get("coal") == 2:
x.gold -= x.power.e_list["oil"][0]
x.gold -= x.power.e_list["coal"][0]*2
x.pollution += x.power.e_list["oil"][2]
x.pollution += x.power.e_list["coal"][2]*2
x.power.built_list["oil"] -= 1
x.power.built_list["coal"] -= 2
x.energy += 30
else:
print("Function target.py/target error: selection is not correct.")
#def target_1(x):
# print("任务:工厂要求提供焦炭,酒精,煤油以提高产能"
#"\n(请提供对应一次能源:1个煤,1个生物质能,1个石油)")
#respon = input("请回答:Y(接任务)或 N(不接任务) ")
#if respon.upper() == "Y":
#x.input_energy()
#if x.power.built_list.get("coal") and x.power.built_list.get("creature") and x.power.built_list.get("oil"):
#for i in ["coal","creature","oil"]:
#x.gold -= x.power.e_list[i][0]
#x.pollution += x.power.e_list[i][2]
#x.power.built_list[i] -= 1
#x.energy += 30
#else:
#print("对不起,你没有足够的能源")
#def target_2(x):
#print("任务:气象学家预测今年冬天将比往常更寒冷,"
#"城市将需要石油气和沼气\n(请提供对应一次能源:1个石油,2个生物质能")
#respon = input("请回答:Y(接任务)或 N(不接任务) ")
#if respon.upper() == "Y":
#x.input_energy()
#if x.power.built_list.get("creature") == 2 and x.power.built_list.get("oil"):
#x.gold -= x.power.e_list["creature"][0]*2
#x.gold -= x.power.e_list["oil"][0]
#x.pollution += x.power.e_list["creature"][2]*2
#x.pollution += x.power.e_list["oil"][2]
#x.power.built_list["creature"] -= 2
#x.power.built_list["oil"] -= 1
#x.energy += 30
#def target_3(x):
#print("任务:今年,人们迫切需要:汽油,煤气"
#"\n(请提供相应一次能源:1个石油,2个煤)")
#respon = input("请回答:Y(接任务)或 N(不接任务) ")
#if respon.upper() == "Y":
#x.input_energy()
#if x.power.built_list.get("oil") and x.power.built_list.get("coal") == 2:
#x.gold -= x.power.e_list["oil"][0]
#x.gold -= x.power.e_list["coal"][0]*2
#x.pollution += x.power.e_list["oil"][2]
#x.pollution += x.power.e_list["coal"][2]*2
#x.power.built_list["oil"] -= 1
#x.power.built_list["coal"] -= 2
#x.energy += 30
def random_target(x):
target_lists = [1,2,3]
shuffle(target_lists)
target = target_lists[1]
do_target(x, target)
#if target == 1:
#target_1(x)
#elif target == 2:
#target_2(x)
#elif target == 3:
#target_3(x)