-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleMathTank.py
32 lines (28 loc) · 1.23 KB
/
ModuleMathTank.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
from ModuleMath import Math
from random import*
class MathTank(Math):
def __init__(self, nom="Le Fléau", pv=115, pa=15, pd=5):
super(MathTank, self).__init__(nom=nom, pv=pv, pa=pa)
self.pd = pd
self.modeAttaque[11] = ["Charge", self.charge]
self.modeAttaque[12] = ["Demonstration", self.demonstration]
def charge(self, ennemi):
if super().peutattaquer(ennemi):
if self.pd >= 1:
ennemi.blesse(3*self.PA)
self.pd = self.pd-1 # l'attaque l'epuise#
print("Touché")
else:
print("Echec")
def demonstration(self, ennemi): # enchainement de coups au corps-à-corps#
if super().peutattaquer(ennemi):
for i in range(4):
n = random()
if n < (0.6):
# j'utilise equerre comme point d'attaque car equerre=20 et(1/4)*equerre est un entier (ps:c'est mieux que les pv soient des nombres entiers)
ennemi.blesse((1/4)*self.equerre)
print("Touché")
else:
print("Echec")
def information(self):
return super().information() + " <Tank>"