Пример #1
0
from core.Automata import Automata
# st
shiki = Automata("assets/event.png", "assets/sp2.png", (248, 0))
shiki.quick_start()
# t1
shiki.select_servant_skill(6)
shiki.select_cards([7])
# t2
shiki.select_master_skill(3)
shiki.change_servant(2, 1)
for i in [4, 6, 8, 9]:
    shiki.select_servant_skill(i)
shiki.select_cards([7])
# t3
shiki.select_master_skill(1)
for i in [1, 2, 5]:
    shiki.select_servant_skill(i)
shiki.select_servant_skill(7, 1)
shiki.select_cards([6])
# fin
shiki.finish_battle()
Пример #2
0
from core.Automata import Automata
# init
shiki = Automata("assets/checkpoint.png", "assets/qp2.png", (248, 0))
# start
shiki.quick_start()
# battle 1
shiki.select_servant_skill(4)
shiki.select_servant_skill(5)
shiki.select_cards([7])
# battle 2
shiki.select_servant_skill(9)
shiki.select_cards([8])
# battle 3
# shiki.toggle_master_skill()
shiki.select_master_skill(2, 1)
shiki.select_servant_skill(1)
shiki.select_servant_skill(2)
shiki.select_cards([6])
# finish
shiki.finish_battle()
Пример #3
0
from core.util import screenshot, split, get_crd, get_sh
from core.Automata import Automata

#screenshot()
# left 248 right 172
# split(screenshot(), (248, 0))

# x = get_crd(get_sh((248, 0)), "assets/qp2.png")
#print(x)

tester = Automata("", "", (248, 0))
# tester.set_apples(0, "assets/silver.png")
# tester.select_checkpoint()
# tester.select_cards([6])
#tester.show_master_skill()
#tester.select_master_skill(3, 3, 1)
print(tester.is_finished())
Пример #4
0
 def __init__(self):
     self.automata = Automata("", "")
     self.__help = \
     """
Пример #5
0
class Interpreter():
    def __init__(self):
        self.automata = Automata("", "")
        self.__help = \
        """
    Commands:

        help                -- show help
        show                -- show info
        shot                -- get screenshot

    Settings:

        sft=(,)             -- set shifts [eg: sft=(248,0)]
        ckp=""              -- set checkpoint [eg: ckp="assets/Qp4.png"]
        spt=""              -- set support [eg: spt="assets/eg-sp1.png"]

    Actions:

        start               -- start battle
        finish              -- finish battle
        s[1-9]              -- servant skill [eg: s1]
        s[1-9]t[1-3]        -- seravnt skill w/ target [eg: s5t3]
        m[1-3]              -- master skill [eg: m1]
        m[1-3]t[1-3]        -- master skill w/ target [eg: m2t1]
        m3o[1-3]t[1-3]      -- Order Change [eg: m3o1t2]
        c[1-8]+             -- select cards [eg: c1] [eg: c723] 
        """

    def evaluate(self, cmd: str):
        return self._eval(cmd)

    def _eval(self, cmd: str):
        if cmd == 'shot':
            s = self.automata.aquire_screenshot()
            return 'Get screenshot: ' + s

        if cmd == 'show':
            return self.automata

        if cmd == 'help':
            return self.__help

        if cmd == 'finish':
            self.automata.finish_battle()
            return 'Finish battle'

        if cmd == 'start':
            self.automata.quick_start()
            return 'Quick start'

        if re.match(r'sft=\([0-9]+,[0-9]+\)', cmd) != None:
            out0 = cmd.split('(')[1].split(',')
            out = [out0[0], out0[1].split(')')[0]]
            self.automata.reset_shifts((int(out[0]), int(out[1])))
            return ('Reset shifts to ' + str(out))

        if re.match(r'spt="[^\s]*"', cmd) != None:
            out = cmd.split('\"')[1]
            self.automata.reset_support(str(out))
            return ('Reset support to ' + out)

        if re.match(r'ckp="[^\s]*"', cmd) != None:
            out = cmd.split('\"')[1]
            self.automata.reset_checkpoint(out)
            return ('Reset checkpoint to ' + out)

        if re.match(r's[1-9]t[1-3]', cmd) != None:
            out = [cmd[1], cmd[3]]
            self.automata.select_servant_skill(int(out[0]), int(out[1]))

            return ('Servant skill: ' + out)
        if re.match(r'^s[1-9]$', cmd) != None:
            out = cmd[1]
            self.automata.select_servant_skill(int(out))
            return ('Servant skill: ' + out)

        if re.match(r'm3o[1-3]t[1-3]', cmd) != None:
            out = [cmd[3], cmd[5]]
            self.automata.select_master_skill(3, int(out[0]), int(out[1]))
            return ('Master skill: ' + out)

        if re.match(r'm[1-3]t[1-3]', cmd) != None:
            out = [cmd[1], cmd[3]]
            self.automata.select_master_skill(int(out[0]), int(out[1]))
            return ('Master skill: ' + str(out))

        if re.match(r'^m[1-3]$', cmd) != None:
            out = cmd[1]
            self.automata.select_master_skill(int(out))
            return ('Master skill: ' + out)

        if re.match(r'c[1-8]+', cmd) != None:
            out0 = cmd.split('c')[1]
            out = map(lambda x: int(x), out0)
            self.automata.select_cards(list(out))
            return ('Select cards: ', out0)

        return "ERROR: Invalid Input"
Пример #6
0
# This is only an example of a battle that I used to test.
from core.Automata import Automata
# init
shiki = Automata("assets/jp/Qp4.png", "assets/eg-sp1.png", (248, 0))
# start
shiki.quick_start()
# battle 1
shiki.select_servant_skill(5)
shiki.select_servant_skill(6)
shiki.select_servant_skill(7)
shiki.select_cards([7])
# battle 2
shiki.select_servant_skill(8)
shiki.select_cards([8])
# battle 3
# shiki.toggle_master_skill()
shiki.select_master_skill(2, 1)
shiki.select_servant_skill(1)
shiki.select_servant_skill(2)
shiki.select_cards([6])
# finish
shiki.finish_battle()