fightpy 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fightpy-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: fightpy
3
+ Version: 0.1.0
4
+ Summary: A tiny command-line fighting game for Python.
5
+ License: MIT
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # FightPy
10
+ Use `fight [enemy]` to fight!
11
+ You can use
12
+ ```python
13
+ from fightpy import Fight
14
+
15
+ battle = Fight("[player]", "[enemy]")
16
+
17
+ battle.start()
18
+ ```
@@ -0,0 +1,10 @@
1
+ # FightPy
2
+ Use `fight [enemy]` to fight!
3
+ You can use
4
+ ```python
5
+ from fightpy import Fight
6
+
7
+ battle = Fight("[player]", "[enemy]")
8
+
9
+ battle.start()
10
+ ```
@@ -0,0 +1,3 @@
1
+ from .battle import Fight
2
+
3
+ __all__ = ["Fight"]
@@ -0,0 +1,44 @@
1
+ import sys
2
+ import random
3
+
4
+ from .battle import Fight
5
+
6
+
7
+ enemies = [
8
+ "goblin",
9
+ "dragon",
10
+ "goose",
11
+ "potato",
12
+ "toaster",
13
+ "angry programmer",
14
+ ]
15
+
16
+
17
+ def main():
18
+ args = sys.argv[1:]
19
+
20
+ if not args:
21
+ print("āš”ļø fightpy")
22
+ print()
23
+ print("Usage:")
24
+ print(" fight <enemy>")
25
+ print(" fight --random")
26
+ print(" fight --list")
27
+ return
28
+
29
+ if args[0] == "--list":
30
+ print("Enemies:")
31
+ for enemy in enemies:
32
+ print(f" - {enemy}")
33
+ return
34
+
35
+ if args[0] == "--random":
36
+ enemy = random.choice(enemies)
37
+ else:
38
+ enemy = " ".join(args)
39
+
40
+ Fight("You", enemy).start()
41
+
42
+
43
+ if __name__ == "__main__":
44
+ main()
@@ -0,0 +1,45 @@
1
+ import random
2
+
3
+
4
+ class Fight:
5
+ def __init__(self, player, enemy):
6
+ self.player = player
7
+ self.enemy = enemy
8
+
9
+ self.playerHp = 100
10
+ self.enemyHp = 100
11
+
12
+ def start(self):
13
+ print(f"āš”ļø {self.player} VS {self.enemy}")
14
+ print()
15
+
16
+ while self.playerHp > 0 and self.enemyHp > 0:
17
+ self.playerTurn()
18
+
19
+ if self.enemyHp <= 0:
20
+ break
21
+
22
+ self.enemyTurn()
23
+
24
+ if self.playerHp > 0:
25
+ print(f"\nšŸ† {self.player} won!")
26
+ else:
27
+ print(f"\nšŸ’€ {self.enemy} won!")
28
+
29
+ def playerTurn(self):
30
+ damage = random.randint(10, 30)
31
+ self.enemyHp -= damage
32
+
33
+ print(f"āš”ļø {self.player} attacks {self.enemy}!")
34
+ print(f"šŸ’„ {damage} damage!")
35
+ print(f"ā¤ļø {self.enemy}: {max(0, self.enemyHp)} HP")
36
+ print()
37
+
38
+ def enemyTurn(self):
39
+ damage = random.randint(5, 25)
40
+ self.playerHp -= damage
41
+
42
+ print(f"šŸ‘Š {self.enemy} attacks {self.player}!")
43
+ print(f"šŸ’„ {damage} damage!")
44
+ print(f"ā¤ļø {self.player}: {max(0, self.playerHp)} HP")
45
+ print()
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: fightpy
3
+ Version: 0.1.0
4
+ Summary: A tiny command-line fighting game for Python.
5
+ License: MIT
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # FightPy
10
+ Use `fight [enemy]` to fight!
11
+ You can use
12
+ ```python
13
+ from fightpy import Fight
14
+
15
+ battle = Fight("[player]", "[enemy]")
16
+
17
+ battle.start()
18
+ ```
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ fightpy/__init__.py
4
+ fightpy/__main__.py
5
+ fightpy/battle.py
6
+ fightpy.egg-info/PKG-INFO
7
+ fightpy.egg-info/SOURCES.txt
8
+ fightpy.egg-info/dependency_links.txt
9
+ fightpy.egg-info/entry_points.txt
10
+ fightpy.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fight = fightpy.__main__:main
@@ -0,0 +1 @@
1
+ fightpy
@@ -0,0 +1,17 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fightpy"
7
+ version = "0.1.0"
8
+ description = "A tiny command-line fighting game for Python."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+
13
+ [project.scripts]
14
+ fight = "fightpy.__main__:main"
15
+
16
+ [tool.setuptools.packages.find]
17
+ include = ["fightpy*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+