From 275481d7de652f18a6a252e2ab64a1432b7f25ff Mon Sep 17 00:00:00 2001 From: jeremy Date: Sun, 26 Apr 2020 15:13:47 +0200 Subject: [PATCH] scenario into tricks && random message more realistic && all your bas are belong to us --- data/scenario_resource.py | 19 ++++++++------ main.py | 5 ++-- scenario.py | 8 ------ trick.py | 4 ++- tricks/otis_notification.py | 3 +-- tricks/random_message.py | 2 ++ tricks/scenario.py | 49 +++++++++++++++++++++++++++++++++++++ 7 files changed, 68 insertions(+), 22 deletions(-) delete mode 100644 scenario.py create mode 100644 tricks/scenario.py diff --git a/data/scenario_resource.py b/data/scenario_resource.py index 210f7b9..1702cfc 100644 --- a/data/scenario_resource.py +++ b/data/scenario_resource.py @@ -2,13 +2,16 @@ intro_text = "\n>$ You have been hacked\n>$ try to escape from the bad virus\n>$ " +event1_text = "try to ESCAPE" + random_text = [ - "\n>$ All your base are belong to us\n>$ ", - "\n>$ The Answer to the Ultimate Question of Life, the Universe, and Everything is 42\n>$ ", - "\n>$ May the force be with you\n>$ ", - "\n>$ YOU SHALL NOT PASS!\n>$ ", - "\n>$ It's a trap!\n>$ ", - "\n>$ rm -rf /\n>$ ", - "\n>$ poweroff\n>$ ", - "\n>$ userdel $LOGNAME\n>$ " + "All your base are belong to us", + "The Answer to the Ultimate Question of Life, the Universe, and Everything is 42", + "May the force be with you", + "YOU SHALL NOT PASS!", + "It's a trap!", + "rm -rf /", + "poweroff", + "userdel $LOGNAME", + "RIP kim" ] diff --git a/main.py b/main.py index 475e6c7..040705a 100755 --- a/main.py +++ b/main.py @@ -6,8 +6,7 @@ import sys from term_utils import Term from command_helper import CommandHelper from trick import Trick -from scenario import intro - +from tricks.scenario import Scenario class AnonymousGoose: def __init__(self): @@ -56,7 +55,7 @@ class AnonymousGoose: if __name__ == "__main__": disable_x = len(sys.argv) == 2 and sys.argv[1] == '-x' - intro() + Scenario().run() goose = AnonymousGoose() goose.run(disable_x) goose.stop() diff --git a/scenario.py b/scenario.py deleted file mode 100644 index bded24e..0000000 --- a/scenario.py +++ /dev/null @@ -1,8 +0,0 @@ -from data.scenario_resource import intro_text -from term_utils import Term -import time - -def intro(): - intro_terminal = Term() - intro_terminal.print_creepy(intro_text) - time.sleep(2) diff --git a/trick.py b/trick.py index be06715..d0acfd9 100644 --- a/trick.py +++ b/trick.py @@ -36,13 +36,15 @@ class Trick(ABC): from tricks.rotation import RotationTrick from tricks.random_message import RandomMessage from tricks.otis_notification import Otis + from tricks.scenario import Scenario tricks = [ GlorifyGooseTrick, AnimAsciiTrick, LaughingGooseTrick, RandomMessage, - Otis + Otis, + Scenario ] x_tricks = [ ReflectionTrick, diff --git a/tricks/otis_notification.py b/tricks/otis_notification.py index 5dc4faf..4231fc2 100644 --- a/tricks/otis_notification.py +++ b/tricks/otis_notification.py @@ -1,5 +1,4 @@ from trick import Trick -from command_helper import CommandHelper import time import threading import os @@ -7,7 +6,7 @@ import os -class Otis: +class Otis(Trick): is_started = False diff --git a/tricks/random_message.py b/tricks/random_message.py index d036b7c..96bb912 100644 --- a/tricks/random_message.py +++ b/tricks/random_message.py @@ -21,4 +21,6 @@ class RandomMessage(Trick): def run(self): randtext_term = Term() + randtext_term.print("\n>$ ") randtext_term.print_creepy(random.choice(random_text)) + randtext_term.print("\n>$ ") diff --git a/tricks/scenario.py b/tricks/scenario.py new file mode 100644 index 0000000..809bd18 --- /dev/null +++ b/tricks/scenario.py @@ -0,0 +1,49 @@ +from trick import Trick +from data.scenario_resource import intro_text +from data.scenario_resource import event1_text +from term_utils import Term +import time + + +class Scenario(Trick): + + @staticmethod + def intro(): + intro_terminal = Term() + intro_terminal.print_creepy(intro_text) + time.sleep(2) + + @staticmethod + def event1(): + Term() + Term.print_all(event1_text) + time.sleep(2) + + id_scenario = 1 + nb_of_scenario = 2 + @property + def name(self): + return "Scenario" + + @property + def delay(self): + return 5 + + @property + def is_reversible(self): + return False + + def revert(self): + pass + + def run(self): + if not Scenario.id_scenario == -1: + if Scenario.id_scenario == 1: + Scenario.intro() + if Scenario.id_scenario == 2: + Scenario.event1() + Scenario.id_scenario += 1 + if Scenario.id_scenario > Scenario.nb_of_scenario: + Scenario.id = -1 + +