From ab8fd7bdf7f01eb36a607600ce30ad0b57d5b8b7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 22 Sep 2020 21:00:49 +0200 Subject: [PATCH] Make more progress --- royalpack/halloween2020/check.py | 28 +++++++++++++++++++++++++- royalpack/halloween2020/trionfilist.py | 15 +++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/royalpack/halloween2020/check.py b/royalpack/halloween2020/check.py index 11830f96..f7472291 100644 --- a/royalpack/halloween2020/check.py +++ b/royalpack/halloween2020/check.py @@ -18,6 +18,12 @@ class Check(metaclass=abc.ABCMeta): async def check(self, status: "TrionfiStatus") -> bool: raise NotImplementedError() + def __or__(self, other: "Check"): + return CheckOr(self, other) + + def __and__(self, other): + return CheckAnd(self, other) + class CheckPlayedSteamGame(Check): def __init__(self, appid: int, *args, **kwargs): @@ -44,7 +50,7 @@ class CheckPlayedSteamGame(Check): for game in games: if game["appid"] != self.appid: continue - if game["playtime_forever"] >= 1: + if game["playtime_forever"] >= 30: return True return False @@ -74,3 +80,23 @@ class CheckAchievementSteamGame(Check): continue return ach["achieved"] == 1 return False + + +class CheckOr(Check): + def __init__(self, first: Check, second: Check, *args, **kwargs): + super().__init__(*args, **kwargs) + self.first: Check = first + self.second: Check = second + + async def check(self, status: "TrionfiStatus") -> bool: + return (await self.first.check(status)) or (await self.second.check(status)) + + +class CheckAnd(Check): + def __init__(self, first: Check, second: Check, *args, **kwargs): + super().__init__(*args, **kwargs) + self.first: Check = first + self.second: Check = second + + async def check(self, status: "TrionfiStatus") -> bool: + return (await self.first.check(status)) and (await self.second.check(status)) diff --git a/royalpack/halloween2020/trionfilist.py b/royalpack/halloween2020/trionfilist.py index 851b2a62..74623cab 100644 --- a/royalpack/halloween2020/trionfilist.py +++ b/royalpack/halloween2020/trionfilist.py @@ -26,7 +26,7 @@ trionfilist = ( roman="II", name="La Sacerdotessa", puzzle="DEL DECIMO MESE", - objective="Gioca almeno un'ora a [url=https://store.steampowered.com/app/881100]Noita[/url].", + objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/881100]Noita[/url].", check=CheckPlayedSteamGame(881100), ), TrionfoInfo( @@ -35,7 +35,7 @@ trionfilist = ( roman="III", name="L'Imperatrice", puzzle="NON IMPEGNARTI", - objective="Gioca a [url=https://store.steampowered.com/app/245170]Skullgirls[/url].", + objective="Gioca almeno mezz'ora [url=https://store.steampowered.com/app/245170]Skullgirls[/url].", check=CheckPlayedSteamGame(245170), ), TrionfoInfo( @@ -59,7 +59,7 @@ trionfilist = ( title="vi", roman="VI", name="Gli Amanti", - puzzle="ANCORA DIECI MINUTI", + puzzle="PIÙ DIECI MINUTI", objective="Finisci l'Atto 3 di [url=https://store.steampowered.com/app/698780]Doki Doki Literature Club[" "/url].", check=CheckPlayedSteamGame(698780), @@ -76,6 +76,7 @@ trionfilist = ( title="viii", roman="VIII", name="La Giustizia", + puzzle="RAGGIUNGI", objective="Porta la giustizia dalla tua parte su [url=https://store.steampowered.com/app/1289310]Helltaker[" "/url].", check=CheckAchievementSteamGame(1289310, "achiev_05"), @@ -92,6 +93,7 @@ trionfilist = ( title="x", roman="X", name="La Fortuna", + puzzle="LA CASA DEI GIOCHI" ), TrionfoInfo( variable="xi", @@ -104,6 +106,9 @@ trionfilist = ( title="xii", roman="XII", name="L'Appeso", + objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/381210]Dead by " + "Daylight.[/url]", + check=CheckPlayedSteamGame(381210), ), TrionfoInfo( variable="xiii", @@ -131,6 +136,10 @@ trionfilist = ( title="xvi", roman="XVI", name="La Torre", + objective="Sconfiggi un boss del secondo piano su [url=https://store.steampowered.com/app/646570/]" + "Slay the Spire[/url].", + check=CheckAchievementSteamGame(646570, "AUTOMATON") or CheckAchievementSteamGame(646570, "COLLECTOR") or + CheckAchievementSteamGame(646570, "CHAMP") ), TrionfoInfo( variable="xvii",