Skip to content

Commit

Permalink
修改耐力计算器的描述
Browse files Browse the repository at this point in the history
  • Loading branch information
azmiao committed Oct 11, 2023
1 parent ff8fa6e commit 8418bb7
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 73 deletions.
62 changes: 40 additions & 22 deletions uma_endurance/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import base64
import os

from hoshino import Service

from .caculate import *
from ..plugin_utils.base_util import get_img_cq

Expand All @@ -11,12 +12,14 @@
s = base64_data.decode()
sv.help = f'![](data:image/jpeg;base64,{s})'


# 帮助界面
@sv.on_fullmatch("马娘耐力帮助")
async def help(bot, ev):
async def sv_help(bot, ev):
img_path = os.path.join(os.path.dirname(__file__), f'{sv.name}_help.png')
sv_help = await get_img_cq(img_path)
await bot.send(ev, sv_help)
sv_help_ = await get_img_cq(img_path)
await bot.send(ev, sv_help_)


@sv.on_rex(r'''
算耐力\r?
Expand Down Expand Up @@ -75,30 +78,43 @@ async def get_endurance(bot, ev):
# 终盘体力消耗比
end_endurance_bonus = 1 + 200 / ((600 * determination_patch) ** 0.5)
# 序盘体力需求
endurance_begin, uniform_speed_begin = await cacul_begin_endurance(speed_standard_patch, run_type, intelligence_patch, power_patch,
site_adaptability, track_length, track_adaptability, site_type, situation)
endurance_begin, uniform_speed_begin = await calcu_begin_endurance(speed_standard_patch, run_type,
intelligence_patch, power_patch,
site_adaptability, track_length,
track_adaptability, site_type, situation)
# 中盘体力需求
endurance_middle, uniform_speed_middle = await cacul_middle_endurance(uniform_speed_begin, speed_standard_patch, run_type,
intelligence_patch, power_patch, site_adaptability, track_length, track_adaptability, site_type, situation)
endurance_middle, uniform_speed_middle = await calcu_middle_endurance(uniform_speed_begin, speed_standard_patch,
run_type,
intelligence_patch, power_patch,
site_adaptability, track_length,
track_adaptability, site_type, situation)
# 终盘体力需求
endurance_end = await cacul_end_endurance(speed_limit_patch, uniform_speed_middle, speed_standard_patch, run_type,
intelligence_patch, power_patch, site_adaptability, track_length, track_adaptability, site_type, situation, end_endurance_bonus)
endurance_end = await calcu_end_endurance(speed_limit_patch, uniform_speed_middle, speed_standard_patch, run_type,
intelligence_patch, power_patch, site_adaptability, track_length,
track_adaptability, site_type, situation, end_endurance_bonus)
# 理论总体力需求
hp = endurance_begin + endurance_middle + endurance_end
# 理论总耐力需求
endurance = await cacul_endurance(endurance_begin, endurance_middle, endurance_end, track_length, run_type)
endurance = await calcu_endurance(endurance_begin, endurance_middle, endurance_end, track_length, run_type)
# 理论
# 理论体力
theoretical_hp = await theoretical_endurance(track_length, endurance_tmp * feeling_bonus[feeling], run_type)
# 回体技能折算耐力
stable_recover_endu, common_recover_endu, upper_recover_endu = await cacul_skill_endu(stable_recover_level, theoretical_hp, run_type)
stable_recover_end, common_recover_end, upper_recover_end = await calcu_skill_end(stable_recover_level,
theoretical_hp, run_type)
# 回体技能折算体力
stable_recover, common_recover_single, common_recover, upper_recover_single, upper_recover = await cacul_skill(
stable_recover, common_recover_single, common_recover, upper_recover_single, upper_recover = await calcu_skill(
stable_recover_level, common_recover_num, upper_recover_num, theoretical_hp)
# 算上技能后的总体力
end_hp = theoretical_hp + stable_recover + common_recover + upper_recover
# 算上技能后的总耐力
end_endurance = await get_end_endurance(end_hp, track_length, run_type)
# 结论
if end_endurance > endurance:
conclusion = f'🎉恭喜您,您的马娘可以正常跑完!甚至富余了{round(end_endurance - endurance, 1)}耐力'
else:
conclusion = f'😱很抱歉,您的马娘无法正常跑完,还需要补充{round(endurance - end_endurance, 1)}耐力,请按照技能回耐量自行安排。'

msg = f'''
速度上限:{speed_limit}
耐力:{endurance_tmp}
Expand All @@ -121,23 +137,25 @@ async def get_endurance(bot, ev):
其中:
-每个普通回体回复{round(common_recover_single, 1)}体力
- 折合耐力:{round(common_recover_endu, 1)}
- 折合耐力:{round(common_recover_end, 1)}
-每个金回体回复{round(upper_recover_single, 1)}体力
- 折合耐力:{round(upper_recover_endu, 1)}
- 折合耐力:{round(upper_recover_end, 1)}
-固有体力回复{round(stable_recover, 1)}体力
- 折合耐力:{round(stable_recover_endu, 1)}
- 折合耐力:{round(stable_recover_end, 1)}
汇总:
无回体技能的体力需求:{round(hp, 1)}
算上技能后的本马体力:{round(end_hp, 1)}
正常跑完需要:{round(hp, 1)}体力
- 折合耐力:{round(endurance, 1)}
当前马娘实际:{round(end_hp, 1)}体力
- 折合耐力:{round(end_endurance, 1)}
其中技能回复了:{round(stable_recover + common_recover + upper_recover, 1)}体力
- 折合耐力:{round(end_endurance - endurance_tmp, 1)}
结论:
无回体技能的耐力需求:{round(endurance, 1)}
算上技能后的本马耐力:{round(end_endurance, 1)}
{conclusion}
注:此数据取自根性下坡改版前的数据
实际需求比计算器结果要高不少,尤其是大赛
本计算器仅为能刚好正常跑完的耐力最低下限
数值为非常理想的情况,没有加速技能,因此仅供参考
'''.strip()
await bot.send(ev, msg)
await bot.send(ev, msg)
120 changes: 75 additions & 45 deletions uma_endurance/caculate.py
Original file line number Diff line number Diff line change
@@ -1,147 +1,176 @@
from .config import *
import math

from .config import *


# 速度上限补正
async def judge_speed(speed_limit, site_type, feeling, situation):
speed_limit_patch = speed_limit * feeling_bonus[feeling] - site_type_bonus[site_type][situation]['speed_limit']
return speed_limit_patch


# 体力补正
async def judge_hp_bonus(run_type):
hp_bonus = run_type_bonus[run_type]['hp_bonus']
return hp_bonus


# 力量补正
async def judge_power(power, site_type, feeling, situation):
power_patch = power * feeling_bonus[feeling] - site_type_bonus[site_type][situation]['power']
return power_patch


# 根性补正
async def judge_determination(determination, feeling):
determination_patch = determination * feeling_bonus[feeling]
return determination_patch


# 智力补正
async def judge_intelligence(intelligence, feeling, run_adaptability):
intelligence_patch = intelligence * feeling_bonus[feeling] * run_adaptability_bonus[run_adaptability]
return intelligence_patch


# 基准速度
async def speed_standard(track_length):
speed_standard_patch = 20 - (track_length - 2000) / 1000
return speed_standard_patch


# 序盘体力消耗
async def cacul_begin_endurance(speed_standard_patch, run_type, intelligence_patch, power_patch, site_adaptability, \
track_length, track_adaptability, site_type, situation):
async def calcu_begin_endurance(speed_standard_patch, run_type, intelligence_patch, power_patch, site_adaptability,
track_length, track_adaptability, site_type, situation):
# 匀速速度
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_begin'] + \
intelligence_patch * math.log(intelligence_patch / 10, 10) / 550000 - 0.00325 )
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_begin'] +
intelligence_patch * math.log(intelligence_patch / 10,
10) / 550000 - 0.00325)
# 残差加速度
acceleration_difference = 0.0006 * ((500 * power_patch) ** 0.5) * run_type_bonus[run_type]['acceleration_begin'] \
* site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[track_adaptability]['acceleration']
acceleration_difference = 0.0006 * ((500 * power_patch) ** 0.5) * run_type_bonus[run_type][
'acceleration_begin'] * site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[
track_adaptability]['acceleration']
# 加速度
acceleration = 24 + acceleration_difference
# 加速耗时
accelerate_time = (speed_standard_patch * 0.85 - 3) / acceleration + (uniform_speed - speed_standard_patch * 0.85) \
/ acceleration_difference
accelerate_time = (speed_standard_patch * 0.85 - 3) / acceleration + \
(uniform_speed - speed_standard_patch * 0.85) / acceleration_difference
# 加速阶段总距离
acceleration_length = (uniform_speed + 3) / 2 * accelerate_time
# 匀速耗时
uniform_time = (track_length / 6 - acceleration_length) / uniform_speed
# 加速耗体
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * ((((acceleration * (speed_standard_patch * 0.85 - 3)\
/ acceleration + uniform_speed - speed_standard_patch + 12) ** 3) - ((uniform_speed - speed_standard_patch + \
12)** 3)) / (144 * 3 * acceleration) + (((acceleration_difference * (uniform_speed - speed_standard_patch * 0.85)\
/ acceleration_difference + uniform_speed - speed_standard_patch + 12) ** 3) - ((uniform_speed - speed_standard_patch + \
12)** 3)) / (144 * 3 * acceleration_difference))
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * (
(((acceleration * (
speed_standard_patch * 0.85 - 3) / acceleration + uniform_speed - speed_standard_patch + 12) ** 3) -
((uniform_speed - speed_standard_patch + 12) ** 3)) / (144 * 3 * acceleration) + (
((acceleration_difference * (uniform_speed - speed_standard_patch * 0.85)
/ acceleration_difference + uniform_speed - speed_standard_patch + 12) ** 3) - (
(uniform_speed - speed_standard_patch +
12) ** 3)) / (144 * 3 * acceleration_difference))
# 匀速耗体
uniform_endurance = 20 * hp_consume_bonus[site_type][situation] * ((uniform_speed - speed_standard_patch + 12) ** 2) \
/ 144 * uniform_time
uniform_endurance = 20 * hp_consume_bonus[site_type][situation] * (
(uniform_speed - speed_standard_patch + 12) ** 2) / 144 * uniform_time
# 总耗体
endurance = accelerate_endurance + uniform_endurance
return endurance, uniform_speed


# 中盘体力消耗
async def cacul_middle_endurance(uniform_speed_tmp, speed_standard_patch, run_type, intelligence_patch, power_patch, site_adaptability, \
track_length, track_adaptability, site_type, situation):
async def calcu_middle_endurance(uniform_speed_tmp, speed_standard_patch, run_type, intelligence_patch, power_patch,
site_adaptability,
track_length, track_adaptability, site_type, situation):
# 匀速速度
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_middle'] + \
intelligence_patch * math.log(intelligence_patch / 10, 10) / 550000 - 0.00325 )
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_middle'] +
intelligence_patch * math.log(intelligence_patch / 10,
10) / 550000 - 0.00325)
# 加速度
if uniform_speed_tmp > uniform_speed:
acceleration = -0.8
else:
acceleration = 0.0006 * ((500 * power_patch) ** 0.5) * run_type_bonus[run_type]['acceleration_middle'] \
* site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[track_adaptability]['acceleration']
* site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[track_adaptability][
'acceleration']
# 加速耗时
accelerate_time = (uniform_speed - uniform_speed_tmp) / acceleration
# 加速阶段总距离
acceleration_length = (uniform_speed + uniform_speed_tmp) / 2 * accelerate_time
# 匀速耗时
uniform_time = (track_length / 2 - acceleration_length) / uniform_speed
# 加速耗体
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * (((acceleration * accelerate_time + uniform_speed - \
speed_standard_patch + 12) ** 3) - ((uniform_speed - speed_standard_patch + 12)** 3)) / (144 * 3 * acceleration)
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * (
((acceleration * accelerate_time + uniform_speed -
speed_standard_patch + 12) ** 3) - ((uniform_speed - speed_standard_patch + 12) ** 3)) / (
144 * 3 * acceleration)
# 匀速耗体
uniform_endurance = 20 * hp_consume_bonus[site_type][situation] * ((uniform_speed - speed_standard_patch + 12) ** 2) \
/ 144 * uniform_time
uniform_endurance = 20 * hp_consume_bonus[site_type][
situation] * ((uniform_speed - speed_standard_patch + 12) ** 2) / 144 * uniform_time
# 总耗体
endurance = accelerate_endurance + uniform_endurance
return endurance, uniform_speed


# 终盘体力消耗
async def cacul_end_endurance(speed_limit_patch, uniform_speed_tmp, speed_standard_patch, run_type, intelligence_patch, power_patch, \
site_adaptability, track_length, track_adaptability, site_type, situation, end_endurance_bonus):
async def calcu_end_endurance(speed_limit_patch, uniform_speed_tmp, speed_standard_patch, run_type, intelligence_patch,
power_patch,
site_adaptability, track_length, track_adaptability, site_type, situation,
end_endurance_bonus):
# 冲刺速度
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_end'] + intelligence_patch * \
math.log(intelligence_patch / 10, 10) / 550000 - 0.00325 + 0.01) + ((speed_limit_patch / 500) ** 0.5) * \
track_adaptability_bonus[track_adaptability]['speed_limit'] * 2
uniform_speed = speed_standard_patch * (run_type_bonus[run_type]['speed_end'] + intelligence_patch *
math.log(intelligence_patch / 10, 10) / 550000 - 0.00325 + 0.01) + (
(speed_limit_patch / 500) ** 0.5) * \
track_adaptability_bonus[track_adaptability]['speed_limit'] * 2
# 加速度
acceleration = 0.0006 * ((500 * power_patch) ** 0.5) * run_type_bonus[run_type]['acceleration_end'] \
* site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[track_adaptability]['acceleration']
acceleration = 0.0006 * ((500 * power_patch) ** 0.5) * run_type_bonus[run_type][
'acceleration_end'] * site_adaptability_bonus[site_adaptability] * track_adaptability_bonus[
track_adaptability]['acceleration']
# 加速耗时
accelerate_time = (uniform_speed - uniform_speed_tmp) / acceleration
# 加速阶段总距离
acceleration_length = (uniform_speed + uniform_speed_tmp) / 2 * accelerate_time
# 冲刺耗时
uniform_time = (track_length / 3 - acceleration_length) / uniform_speed
# 加速耗体
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * (((acceleration * accelerate_time + uniform_speed - \
speed_standard_patch + 12) ** 3) - ((uniform_speed - speed_standard_patch + 12)** 3)) / (144 * 3 * acceleration) \
* end_endurance_bonus
accelerate_endurance = 20 * hp_consume_bonus[site_type][situation] * (
((acceleration * accelerate_time + uniform_speed - speed_standard_patch + 12) ** 3) -
((uniform_speed - speed_standard_patch + 12) ** 3)) / (144 * 3 * acceleration) * end_endurance_bonus
# 冲刺耗体
uniform_endurance = 20 * hp_consume_bonus[site_type][situation] * ((uniform_speed - speed_standard_patch + 12) ** 2) \
/ 144 * uniform_time * end_endurance_bonus
uniform_endurance = 20 * hp_consume_bonus[site_type][situation] * (
(uniform_speed - speed_standard_patch + 12) ** 2) / 144 * uniform_time * end_endurance_bonus
# 总耗体
endurance = accelerate_endurance + uniform_endurance
return endurance


# 总耐力需求
async def cacul_endurance(endurance_begin, endurance_middle, endurance_end, track_length, run_type):
async def calcu_endurance(endurance_begin, endurance_middle, endurance_end, track_length, run_type):
# 总体力需求
endurance_tmp = endurance_begin + endurance_middle + endurance_end
# 总耐力需求
endurance = (endurance_tmp - track_length) / (0.8 * run_type_bonus[run_type]['hp_bonus'])
return endurance


# 理论体力
async def theoretical_endurance(track_length, endurance_tmp, run_type):
theoretical_hp = track_length + endurance_tmp * 0.8 * run_type_bonus[run_type]['hp_bonus']
return theoretical_hp


# 回体技能折算耐力
async def cacul_skill_endu(stable_recover_level, hp, run_type):
async def calcu_skill_end(stable_recover_level, hp, run_type):
# 固有回耐量
stable_recover_endu = 0.055 * stable_recover_bonus[stable_recover_level] * hp / (0.8 * run_type_bonus[run_type]['hp_bonus'])
stable_recover_end = 0.055 * stable_recover_bonus[stable_recover_level] * hp / (
0.8 * run_type_bonus[run_type]['hp_bonus'])
# 单个普通回耐量
common_recover_endu = 0.015 * hp / (0.8 * run_type_bonus[run_type]['hp_bonus'])
common_recover_end = 0.015 * hp / (0.8 * run_type_bonus[run_type]['hp_bonus'])
# 单个金回耐量
upper_recover_endu = 0.055 * hp / (0.8 * run_type_bonus[run_type]['hp_bonus'])
return stable_recover_endu, common_recover_endu, upper_recover_endu
upper_recover_end = 0.055 * hp / (0.8 * run_type_bonus[run_type]['hp_bonus'])
return stable_recover_end, common_recover_end, upper_recover_end


# 回体技能折算体力
async def cacul_skill(stable_recover_level, common_recover_num, upper_recover_num, theoretical_hp):
async def calcu_skill(stable_recover_level, common_recover_num, upper_recover_num, theoretical_hp):
# 固有回体量
stable_recover = 0.055 * stable_recover_bonus[stable_recover_level] * theoretical_hp
# 单个普通回体量
Expand All @@ -154,7 +183,8 @@ async def cacul_skill(stable_recover_level, common_recover_num, upper_recover_nu
upper_recover = upper_recover_num * upper_recover_single
return stable_recover, common_recover_single, common_recover, upper_recover_single, upper_recover


# 算上技能后的总耐力
async def get_end_endurance(end_hp, track_length, run_type):
end_endurance = (end_hp - track_length) / (0.8 * run_type_bonus[run_type]['hp_bonus'])
return end_endurance
return end_endurance
Loading

0 comments on commit 8418bb7

Please sign in to comment.