-
Notifications
You must be signed in to change notification settings - Fork 0
/
evenement.py
28 lines (22 loc) · 898 Bytes
/
evenement.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
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 17:42:08 2021
@author: josse
"""
from psclib.coeuraction import CoeurAction
from psclib.action import Action
from psclib.objet import Objet
import random
class Evenement:
def __init__(self, action, liste_cods = None):
self.action = action
if type(self.action) == str: self.action = Action(name=self.action)
self.liste_cods = liste_cods
if type(self.liste_cods) == str: self.liste_cods = [self.liste_cods]
def getCoeur(self, perso):
if self.liste_cods is None or len(self.liste_cods) == 0:
return CoeurAction(sujet=perso, action=self.action)
else:
cod = random.choice(self.liste_cods)
if type(cod) == str: cod = Objet(dico={"lib": cod}, addDeterminant=False)
return CoeurAction(sujet=perso, action=self.action, cod=cod)