Skip to content

Instantly share code, notes, and snippets.

@Koasing
Last active September 22, 2016 19:32
Show Gist options
  • Save Koasing/b1d267016b5add424705266b453f7acb to your computer and use it in GitHub Desktop.
Save Koasing/b1d267016b5add424705266b453f7acb to your computer and use it in GitHub Desktop.
デレステ イベントポイント シミュレーター
from datetime import datetime, timedelta
from datetime import time
from copy import deepcopy
# settings
start_date = datetime(2016, 9, 20, 15, 00, 00)
boost_date = datetime(2016, 9, 23, 15, 00, 00)
end_date = datetime(2016, 9, 26, 21, 00, 00)
now_date = deepcopy(start_date)
# set true to get ideal maximum point (no rest = crazy)
no_rest = False
# rest time (sleep, meal, etc). cannot cross over midnight
rest = [(time(hour= 8, minute= 0), time(hour= 9, minute= 0)),
(time(hour=21, minute=30), time(hour=23, minute=30)),
(time(hour=13, minute=40), time(hour=14, minute= 0))]
# per play time
play_time = timedelta(minutes = 2, seconds = 50)
# determined by your PLv
stamina_max = 96
# how many items will be kept in stack before boost (4x) period
stack_max = 9800
# default values
stamina_per_play = 19
getitem_per_play = 53
useitem_per_play = 150
getpoint_per_play = 320
stamina = stamina_max
last_recovery = deepcopy(start_date)
# counter
item = 0
point = 0
jewel_count = 0
# log
print("now_date |st|je|it|po|ev")
def logprint(event):
global now_date
global stamina, item, point, jewel_count
m = {}
m['st'] = stamina
m['it'] = item
m['po'] = point
m['je'] = jewel_count
m['ev'] = event
print(now_date, "|{st}|{je}|{it}|{po}|{ev}".format_map(m))
def check_cond():
global no_rest, rest
global now_date
if no_rest:
return True
now_time = now_date.time()
for (s, e) in rest:
if s < now_time < e:
return False
return True
def increase_stamina():
global stamina, stamina_max
global now_date, last_recovery
if stamina >= stamina_max:
last_recovery = deepcopy(now_date)
return
while (now_date - last_recovery).seconds >= 5 * 60:
if stamina >= stamina_max:
last_recovery = deepcopy(now_date)
return
last_recovery += timedelta(minutes = 5)
stamina += 1
logprint("EVENT START")
while now_date < boost_date:
increase_stamina()
now_date += play_time
# sleep or meal
if check_cond() == False:
continue
# play event song
if item > stack_max:
item -= useitem_per_play
point += getpoint_per_play
logprint("Play event song")
continue
# stamina check
if stamina < 2 * stamina_per_play:
stamina += stamina_max
last_recovery = deepcopy(now_date)
jewel_count += 50
logprint("Use jewel")
stamina -= 2 * stamina_per_play
item += 2 * getitem_per_play
point += getitem_per_play
logprint("Play normal song")
logprint("BOOST START")
while now_date < end_date:
increase_stamina()
now_date += play_time
# sleep or meal
if check_cond() == False:
continue
# play event song
if stamina < stamina_max and item > 4 * useitem_per_play:
item -= useitem_per_play
point += getpoint_per_play
logprint("Play event song")
continue
# stamina check
if stamina < 2 * stamina_per_play:
logprint("Use jewel")
stamina += stamina_max
last_recovery = deepcopy(now_date)
jewel_count += 50
stamina -= 2 * stamina_per_play
item += 2 * getitem_per_play
point += getitem_per_play
logprint("Play normal song")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment