Example #1
0
 def allowSkills(self, status: Status):
     remainCp = status.currentCp - cpReq
     ans = list()
     if remainCp < 0: return ans
     if remainCp >= SkillManager.getCp(
             _('精修'), status
     ) and status.target.maxDurability - status.currentDurability >= 30:
         ans.append([_('精修')])
     if status.currentCp > 200 and \
             not status.has_buff(_('掌握')) and \
             not status.has_buff(_('改革')) and \
             not status.has_buff(_('阔步')):
         ans.append([_('掌握')])
     if status.ball == BallManager.RedBall:
         ans.append([_('秘诀')])
     if not status.has_buff(_('观察')) or status.ball in [
             BallManager.PurpleBall
     ]:
         for buff in AllowBuffs:
             if not status.has_buff(
                     buff) and remainCp >= SkillManager.getCp(buff, status):
                 ans.append([buff])
     if status.has_buff(_('改革')) or remainCp < 50 or status.ball in [
             BallManager.RedBall, BallManager.BlueBall
     ]:
         for skill in AllowSkillSetObserve if status.has_buff(
                 _('观察')) else AllowSkillSet:
             if status.currentDurability > SkillManager.getDurability(skill, status) and remainCp >= SkillManager.getCp(skill, status) and \
                     SkillManager[skill].can_use(status):
                 ans.append([skill])
     return ans
Example #2
0
 def deal(self, status, prev_skill=None):
     if prev_skill.name == _('设计变动'):
         self.design_count += 1
     self.solver.cli_logger.hideTag('Math')
     if self.Prequeue[0] == _('比尔格的祝福') and self.use_change and self.design_count < 3 and self.need_changes(status):
         return _('设计变动')
     self.solver.cli_logger.showTag('Math')
     self.count += 1
     if self.count >= len(combo) and score_grade(status.currentQuality) < 1:
         return 'terminate'
     return self.Prequeue.pop(0)
Example #3
0
 def need_changes(self, status):
     if status.ball == BallManager.RedBall:
         self.log("red ball")
         return False
     current_score = status.use_skill(SkillManager[_('比尔格的祝福')]).currentQuality
     current_grade = score_grade(current_score)
     if current_grade >= 3:
         self.log('no need', current_score, current_grade)
         return False
     temp = status.clone()
     temp.ball = BallManager.RedBall
     new_score = temp.use_skill(SkillManager[_('比尔格的祝福')]).currentQuality
     new_grade = score_grade(new_score)
     self.log("score if use:", new_score, new_grade)
     return new_grade >= self.change_grade and new_grade > current_grade
Example #4
0
 def __call__(self, msg: str):
     self.log("Revive:", msg)
     data = msg.split(" ", 1)
     if data[0] == 'start':
         return self.start_round()
     elif data[0] == 'use':
         if len(data) < 2:
             self.log("command length incorrect")
         else:
             data = data[1].rsplit(" ", 1)
         if len(data) == 2:
             data[0] += "" if data[1] == _("Success") else ":fail"
         if data[0] in Manager.SkillManager:
             return self.use_skill(Manager.SkillManager[data[0]])
         else:
             return "unknown skill %s" % data[0]
     elif data[0] == 'end':
         return self.end_round()
     else:
         self.log("Unknown command:", data[0])
         return None
Example #5
0
# -*- coding=utf-8 -*-

from solver_v2.Solver import Solver
from core.Utils.HttpServer import Server
from core.Utils.Config import config
import traceback
import atexit
from core.Utils.i18n import system_to_client_text as _
print(_('Success'))
atexit.register(input, "<<press enter to exit>>")
try:
    Server(
        config['server']['hostName'],
        int(config['server']['port']),
        Solver()
    ).start()
except:
    traceback.print_exc()
Example #6
0
 def is_finished(self, status: Status, prev_skill=None):
     return not (status.has_buff(_('内静'))
                 and status.get_buff(_('内静')).data["lv"] < 8)
Example #7
0
 def deal(self, status, prev_skill=None):
     if prev_skill == SkillManager[_('专心加工') + ':fail']:
         self.count += 1
     if status.rounds >= 25 or status.currentCp < 300 or self.count >= 2:
         return 'terminate'
     if status.ball == BallManager.GreenBall:
         if not status.has_buff(_('掌握')):
             return _("掌握")
         if status.currentDurability < 20:
             return _("精修")
     if status.currentDurability <= 10:
         return _("精修")
     if status.ball == BallManager.RedBall:
         if status.get_buff(_('内静')).data["lv"] < 10:
             return _("集中加工")
         return _("秘诀")
     elif status.ball == BallManager.YellowBall:
         if 1 < status.get_buff(_('内静')).data["lv"] < 7:
             return _('专心加工')
         return _("仓促")
     if status.currentDurability - (status.ball.durability * 10) <= 10:
         return _("精修")
     if 1 < status.get_buff(_('内静')).data["lv"] < 6:
         return _('专心加工')
     if not status.has_buff(_('俭约')):
         return _("俭约加工")
     return _("仓促")
Example #8
0
import time

from core.Simulator.Manager import SkillManager, BallManager
from core.Simulator.Status import Status
from . import StageBase
from core.Utils.i18n import solver_to_client_text as _

durReq = 21
cpReq = 131
AllowBuffs = {
    _('阔步'): _('阔步'),
    _('改革'): _('改革'),
    _('俭约'): _('俭约'),
    _('观察'): _('观察'),
}
AllowSkillSet = {
    _('坯料加工'),
    _('集中加工'),
    _('俭约加工'),
}
AllowSkillSetObserve = {
    _('集中加工'),
    _('注视加工'),
}


class Stage3(StageBase):
    def __init__(self, solver):
        super().__init__(solver)
        self.Prequeue = []
Example #9
0
from core.Simulator.Manager import BallManager, SkillManager
from core.Utils.Config import config
from . import StageBase
from core.Utils.i18n import solver_to_client_text as _

combo = [_('阔步'), _('改革'), _('观察'), _('注视加工'), _('阔步'), _('比尔格的祝福'), _('制作')]

skyStage = config.get('SkybuilderStage', 'Stage', default='3')
if skyStage == '4':
    grade_line = [58000, 65000, 74000]
else:
    grade_line = [58000, 65000, 77000]


def score_grade(score: int):
    if score < grade_line[0]:
        return 0
    elif score < grade_line[1]:
        return 1
    elif score < grade_line[2]:
        return 2
    else:
        return 3


class Stage4(StageBase):
    def __init__(self, solver):
        super().__init__(solver)
        self.Prequeue = []
        self.count = 0
        self.use_change = self.solver.conf.get('DesignChange', 'open') == 'True'
Example #10
0
def InnerQuietLv(status: Status):
    return 0 if not status.has_buff(_('内静')) else status.get_buff(
        _('内静')).data["lv"]
Example #11
0
 def deal(self, status, prev_skill=None):
     if status.currentCp < 300:
         return 'terminate'
     if status.rounds == 1: return _('闲静')
     if status.ball == BallManager.GreenBall:
         if not status.has_buff(_('掌握')): return _('掌握')
         if status.currentDurability < 20: return _('精修')
     if status.ball == BallManager.RedBall:
         if InnerQuietLv(status) < 10 and status.currentDurability > 10:
             return _('集中加工')
         return _('秘诀')
     if status.ball == BallManager.PurpleBall:
         if not status.has_buff(_('掌握')): return _('掌握')
         if not status.has_buff(_('崇敬')): return _('崇敬')
         if not status.has_buff(_('俭约')): return _('长期俭约')
     if status.currentDurability - (status.ball.durability * 10) <= 0:
         return _('精修')
     if status.ball == BallManager.DeepBlueBall and not self.is_progress_finished(
             status):
         return self.process_skill(status)
     if status.has_buff(_('崇敬')) and not self.is_progress_finished(status):
         return self.process_skill(status)
     if InnerQuietLv(status) <= 8:
         return _('仓促')
     return _('崇敬')
Example #12
0
 def process_skill(self, status):
     if self.is_progress_finished(status.use_skill(
             SkillManager[_('模范制作')])):
         return self.careful_check(status, SkillManager[_('模范制作')])
     else:
         return self.careful_check(status, SkillManager[_('高速制作')])
Example #13
0
 def careful_check(self, status, skill):
     temp = status.use_skill(skill)
     if not status.has_buff(_('最终确认')) and temp.is_finish():
         return _('最终确认')
     else:
         return skill.name
Example #14
0
 def is_progress_finished(self, status, prev_skill=None):
     temp = Status(status.player, status.target,
                   BallManager.WhiteBall).use_skill(
                       SkillManager[_('制作')]).currentProgress
     return status.currentProgress + temp >= status.target.maxProgress
Example #15
0
 def deal(self, status, prev_skill=None):
     if prev_skill == SkillManager[_('高速制作')+':fail']:
         self.count += 1
     if status.rounds == 1:
         return _('闲静')
     if self.count>3 or InnerQuietLv(status) < 2 or status.rounds >= 20 or status.currentCp < 300:
         return 'terminate'
     if status.ball == BallManager.GreenBall:
         if not status.has_buff(_('掌握')): return _('掌握')
         if status.currentDurability < 20: return _('精修')
         # if status.has_buff(_('俭约')): return _('长期俭约')
     if status.ball == BallManager.RedBall:
         if InnerQuietLv(status) < 10 and status.currentDurability > 10:
             return _('集中加工')
         return _('秘诀')
     if status.ball == BallManager.YellowBall:
         if InnerQuietLv(status) < 6 and status.currentDurability > 10:
             return _('专心加工')
     if status.currentDurability - (status.ball.durability * 10) <= 0:
         return _('精修')
     if status.has_buff(_('崇敬')):
         temp=status.use_skill(SkillManager[_('高速制作')])
         if not status.has_buff(_('最终确认')) and temp.is_finish():
             return _('最终确认')
         else:
             return _('高速制作')
     else:
         return _('崇敬')