在python中我该怎么说

  • 本文关键字:怎么说 python python
  • 更新时间 :
  • 英文 :


我正试图在我的科学俱乐部为一个游戏打造一个法师,我想说"如果没有火或土法师(以"火"one_answers"土"表示(,也没有人可以从中获取生命值(以absorpt_target_index表示(来攻击第一个敌人。"在python中我该怎么说?谢谢你的帮助!编辑:我正试图做一个"如果"的陈述。对不起,我对编码还很陌生,所以我真的不知道该包括什么细节才能提出正确的问题。为了攻击,我使用了一种名为"喷水"的咒语。absorpt_target_index在代码检查敌人时获得其值,如果他们低于某个健康值,而我高于某个健康度,则将他们添加到索引中。

假设您是这样做的。。。

Fire = []
Earth = []
absorb_target_index = []
#you have another function which populates these lists with the names of Earth and Fire mages, you would then do
if len(Fire) == 0 and len(Earth) == 0 and len(absorb_target_index) == 0:
Attack()

就像评论所说的那样,你的问题太模糊了。你的游戏如何定义"攻击"敌人?其他法师是如何识别的?"absorpt_target_index"的值从哪里得到?

我想。。。根据你所说的,你可以做…

if ((Fire != True) or (Earth != True)) and absorb_target_index != True:
DoSomething()

但在不知道自己想要什么的情况下,这对我来说是最有帮助的吗?

最新更新