From 56c7c10ae6c864db661559df06353afe29281ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Fri, 8 Apr 2022 19:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=98=B3=E5=85=89=E6=8E=89?= =?UTF-8?q?=E8=90=BD=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/constants.py | 2 +- source/state/level.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/constants.py b/source/constants.py index 4bac890..396e162 100755 --- a/source/constants.py +++ b/source/constants.py @@ -121,7 +121,7 @@ WALLNUT_CRACKED1_HEALTH = 4000//3 * 2 WALLNUT_CRACKED2_HEALTH = 4000//3 WALLNUT_BOWLING_DAMAGE = 370 -PRODUCE_SUN_INTERVAL = 7000 +PRODUCE_SUN_INTERVAL = 4250 # 基准 FLOWER_SUN_INTERVAL = 24000 SUN_LIVE_TIME = 10000 SUN_VALUE = 25 diff --git a/source/state/level.py b/source/state/level.py index 85f4a83..98e380c 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -294,6 +294,10 @@ class Level(tool.State): return False def play(self, mouse_pos, mouse_click): + # 原版阳光掉落机制需要 + # 已掉落的阳光 + self.fallenSun = 0 + # 如果暂停 if self.showLittleMenu: # 设置暂停状态 @@ -384,13 +388,14 @@ class Level(tool.State): if mouse_click[1]: self.removeMouseImagePlus() - if self.produce_sun: - if(self.current_time - self.sun_timer) > c.PRODUCE_SUN_INTERVAL: + # 原版阳光掉落机制:(已掉落阳光数*100 ms + 4250 ms) 与 9500 ms的最小值,再加 0 ~ 2750 ms 之间的一个数 + if (self.current_time - self.sun_timer) > min(c.PRODUCE_SUN_INTERVAL + 100*self.fallenSun, 9500) + randint(0, 2750): self.sun_timer = self.current_time map_x, map_y = self.map.getRandomMapIndex() x, y = self.map.getMapGridPos(map_x, map_y) self.sun_group.add(plant.Sun(x, 0, x, y)) + self.fallenSun += 1 # 检查有没有捡到阳光 if not self.drag_plant and not self.drag_shovel and mouse_pos and mouse_click[0]: