Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_program
帝国:崛起
提交
98e70893
帝
帝国:崛起
项目概览
Python_program
/
帝国:崛起
与 Fork 源项目一致
Fork自
inscode / Python
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
帝
帝国:崛起
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
98e70893
编写于
8月 06, 2025
作者:
P
python_program
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wed Aug 6 22:48:00 CST 2025 inscode
上级
1164cdc5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
20 addition
and
4 deletion
+20
-4
main.py
main.py
+20
-4
未找到文件。
main.py
浏览文件 @
98e70893
...
...
@@ -21,6 +21,24 @@ class kingdom:
self
.
rate
=
rate
return
def
trainArmy
(
self
,
skill
=
0
,
weapons
=
self
.
army
.
weapons
,
morale
=
0
):
cost
=
skill
*
10
+
morale
*
200
if
weapons
==
"戟"
and
self
.
army
.
weapons
!=
weapons
:
cost
+=
5
*
self
.
army
.
number
elif
weapons
==
"长枪"
and
self
.
army
.
weapons
!=
weapons
:
cost
+=
7
*
self
.
army
.
number
elif
weapons
==
"火铳"
and
self
.
army
.
weapons
!=
weapons
:
cost
+=
10
*
self
.
army
.
number
if
input
(
"此次训练将花费{}黄金,剩余{}黄金,您同意吗?(Y or N)"
.
format
(
cost
,
self
.
gold
-
cost
)).
upper
()
==
"Y"
:
if
self
.
gold
-
cost
>
0
:
self
.
gold
-=
cost
print
(
"训练完成!"
)
elif
self
.
gold
-
cost
<=
0
:
print
(
"没钱了,训啥练啊!!!"
)
else
:
print
(
"退出......"
)
return
class
soil
:
area
=
0
...
...
@@ -50,7 +68,7 @@ class army:
def
__init__
(
self
,
number
,
morale
):
self
.
number
=
number
self
.
morale
=
morale
self
.
skill
=
0.2
self
.
skill
=
1
self
.
weapons
=
"腰刀"
return
...
...
@@ -77,6 +95,7 @@ class army:
def
kill
(
kingdom1
,
kingdom2
):
print
(
"{}灭亡!{}占领全境,获得{}黄金,获得{}人口,获得{}土地!"
.
format
(
defauendert
,
attacker
,
defauendert
.
gold
,
defauendert
.
pollution
,
defauenderter
.
soil
.
area
))
kingdom1
.
gold
+=
kingdom2
.
gold
kingdom1
.
pollution
+=
kingdom2
.
pollution
kingdom1
.
soil
.
area
+=
kingdom2
.
soil
.
area
...
...
@@ -92,7 +111,6 @@ def attack(attacker, defauendert, area):
defauendert
.
area
.
remove
(
area
)
attacker
.
area
.
append
(
area
)
if
not
defauendert
.
area
:
print
(
"{}灭亡!{}占领全境,获得{}黄金,获得{}人口,获得{}土地!"
.
format
(
defauendert
,
attacker
,
defauendert
.
gold
,
defauendert
.
pollution
,
defauenderter
.
soil
.
area
))
kill
(
attacker
,
defauendert
)
defauendert
.
army
.
number
=
0
defauendert
.
army
.
morale
-=
0.5
...
...
@@ -104,5 +122,3 @@ def attack(attacker, defauendert, area):
else
:
print
(
"NUMBER ERROR!"
)
return
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录