Files
2025-03-13 23:17:46 -04:00

38 lines
1.2 KiB
Python

import random
import action
import ztime
# Parent Class for all Action Agents
# This class is used to create an Action Agent that can be used to perform actions on a target agent.
class ActionAgent:
def __init__(self, sourceAgent, STATS):
self.target = sourceAgent
self.stats = STATS
self.name = sourceAgent.get_name()
# Abstract Method to Update Target Agent On Each Run
def update(self, curtime):
pass
# Abstract Method to Initialize Stats of Target Agent
# This method is set by the child class as some agents might have
# logic behind instantiating starting stats
def stat_init(self):
pass
class ActionAgent_Action:
def __init__(self, name, effects, duration):
self.name = name
self.effects = effects
self.duration = duration
# Performs Bulk Actions on the Target Agent
def act(self, targetAgent, cur_time):
for stat in self.effects:
targetAgent.change_stat(stat, self.effects[stat])
actionTime = ztime.Time(cur_time.minute + self.duration)
targetAgent.set_action(action.Action(self.name, 0, actionTime))