From 06877ebaec7a7fddcc07514135f12d94bf98ae5b Mon Sep 17 00:00:00 2001 From: KuMiShi Date: Sun, 25 Jan 2026 16:07:28 +0100 Subject: [PATCH] Event & Dice corrections --- dice.py | 3 +-- event.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dice.py b/dice.py index e75eaa0..fd91518 100644 --- a/dice.py +++ b/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!") diff --git a/event.py b/event.py index 78816bc..60e2b00 100644 --- a/event.py +++ b/event.py @@ -1,5 +1,5 @@ from .serializable import Serializable -from .entity import Action, BonusAction +from .entity import Action, BonusAction, Entity import json @@ -15,4 +15,12 @@ class Event(Serializable): event_dict['text'] = event_text event_dict['action'] = action event_dict['bonus'] = bonus - self.description += json.dumps(event_dict) \ No newline at end of file + 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 \ No newline at end of file