更改阳光掉落机制

This commit is contained in:
星外之神 2022-04-08 19:04:55 +08:00
parent b7d1aabe0e
commit 56c7c10ae6
2 changed files with 8 additions and 3 deletions

View File

@ -121,7 +121,7 @@ WALLNUT_CRACKED1_HEALTH = 4000//3 * 2
WALLNUT_CRACKED2_HEALTH = 4000//3 WALLNUT_CRACKED2_HEALTH = 4000//3
WALLNUT_BOWLING_DAMAGE = 370 WALLNUT_BOWLING_DAMAGE = 370
PRODUCE_SUN_INTERVAL = 7000 PRODUCE_SUN_INTERVAL = 4250 # 基准
FLOWER_SUN_INTERVAL = 24000 FLOWER_SUN_INTERVAL = 24000
SUN_LIVE_TIME = 10000 SUN_LIVE_TIME = 10000
SUN_VALUE = 25 SUN_VALUE = 25

View File

@ -294,6 +294,10 @@ class Level(tool.State):
return False return False
def play(self, mouse_pos, mouse_click): def play(self, mouse_pos, mouse_click):
# 原版阳光掉落机制需要
# 已掉落的阳光
self.fallenSun = 0
# 如果暂停 # 如果暂停
if self.showLittleMenu: if self.showLittleMenu:
# 设置暂停状态 # 设置暂停状态
@ -384,13 +388,14 @@ class Level(tool.State):
if mouse_click[1]: if mouse_click[1]:
self.removeMouseImagePlus() self.removeMouseImagePlus()
if self.produce_sun: 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 self.sun_timer = self.current_time
map_x, map_y = self.map.getRandomMapIndex() map_x, map_y = self.map.getRandomMapIndex()
x, y = self.map.getMapGridPos(map_x, map_y) x, y = self.map.getMapGridPos(map_x, map_y)
self.sun_group.add(plant.Sun(x, 0, x, 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]: if not self.drag_plant and not self.drag_shovel and mouse_pos and mouse_click[0]: