-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecial.py
103 lines (88 loc) · 3.28 KB
/
special.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from player import Player
import time, random
# Defines child classes for special players with unique movesets.
# Spiderman class
class Spiderman(Player):
def __init__(self):
Player.__init__(self, "Spiderman")
self.moves["web shooter"] = self.web_shooter
self.image = "images/spideycartoon.gif"
def web_shooter(self, enemy):
self.attack(enemy, 40)
# Voldemort class
class Voldemort(Player):
def __init__(self):
Player.__init__(self, "Voldemort")
self.image = "images/voldemort_small.gif"
self.moves.pop("attack")
self.moves["killing curse"] = self.avadakedavra
self.moves["regeneration"] = self.heal
def avadakedavra(self, enemy):
print("AVADA KEDAVRA!")
time.sleep(1)
if random.randint(0, 3):
self.attack(enemy, 50)
else:
print("Voldemort's curse rebounded!")
self.attack(self, 50)
# Thanos class
class Thanos(Player):
def __init__(self):
Player.__init__(self, "Thanos")
self.image = "images/thanos.gif"
self.moves["smash"] = self.attack
self.moves["Thanos Snap"] = self.finger_snap
self.moves.pop("attack")
self.moves.pop("heal")
def finger_snap(self, enemy):
damage = round(enemy.health / 2)
self.attack(enemy, damage)
n = random.uniform(0, self.health/2)
self.attack(self, round(n))
# Jedi class
class Jedi(Player):
def __init__(self):
Player.__init__(self, "Jedi")
self.moves.pop("attack")
self.moves["lightsaber slash"] = self.attack
self.moves["force whirlwind"] = self.force_attack
self.moves["battlemind"] = self.force_mind
self.image = "images/rey.gif"
self.specialmove = 2
self.energy += 0.1
def lightsaber(self, enemy):
self.attack(enemy, 40)
def force_mind(self, enemy):
self.energy += 0.2
print("Meditation increases the concentration and willpower of " + self.name)
print(self.name + " has increased energy.")
if self.energy >= 1.8:
self.moves.pop("battlemind")
def force_attack(self, enemy):
self.attack(enemy, 60)
self.specialmove -= 1
if self.specialmove > 0:
print(str(self.specialmove) + " time left to use this move.")
else:
self.moves.pop("force whirlwind")
# Pikachu class
class Pikachu(Player):
def __init__(self):
Player.__init__(self, "Pikachu")
self.image = "images/pikachu_small.gif"
self.moves["thunder shock"] = self.thunder_shock
self.moves.pop("attack")
self.moves["quick attack"] = self.attack
def thunder_shock(self, enemy):
damage = random.randint(40, 50) # strong attack
self.attack(enemy, damage)
if random.randint(0, 1): # 50% chance
self.health -= 10 # lowers his own health
def evolve(self): # option to evolve into next level.
print("Pikachu evolves into Raichu!")
self.name = "Raichu"
self.health += 20
self.energy += 1
self.moves["electro ball"] = self.electro_ball
def electro_ball(self, enemy):
self.attack(enemy, 80)