Event & Dice corrections
This commit is contained in:
3
dice.py
3
dice.py
@@ -1,7 +1,6 @@
|
||||
import random as rd
|
||||
from . import serializable
|
||||
|
||||
class Dice(serializable.Serializable):
|
||||
class Dice():
|
||||
def __init__(self):
|
||||
raise TypeError("Un dé ne peut pas être instanciée!")
|
||||
|
||||
|
||||
10
event.py
10
event.py
@@ -1,5 +1,5 @@
|
||||
from .serializable import Serializable
|
||||
from .entity import Action, BonusAction
|
||||
from .entity import Action, BonusAction, Entity
|
||||
|
||||
import json
|
||||
|
||||
@@ -16,3 +16,11 @@ class Event(Serializable):
|
||||
event_dict['action'] = action
|
||||
event_dict['bonus'] = bonus
|
||||
self.description += json.dumps(event_dict)
|
||||
|
||||
def update_objectives(self, entities:list[Entity], objectives:list[str]):
|
||||
assert len(entities) == len(objectives), f"Number of entities & objectives are different: {len(entities)} (entities) and {len(objectives)} (objectives) !"
|
||||
n = len(entities)
|
||||
for i in range(n):
|
||||
entity_name = entities[i].name
|
||||
objective = objectives[i]
|
||||
self.entities_objectives[entity_name] = objective
|
||||
Reference in New Issue
Block a user