Releases: lotgd/core
Version 0.4.0 alpha
This version introduces several API changes to make module development easier:
- Viewpoints can now be more easily modified by using
$viewpoint->addDescriptionParagraph()
to add a single paragraph to the description. Internally, the viewpoint keeps an array of paragraphs and joins it together if$viewpoint->getDescription()
is called. - Viewpoints can now more easily manage actions.
$viewpoint->addActionGroup
can be used to add a single action group instead of replacing all.$viewpoint->findActionGroupById
can be used to return a selected action group. If not found, the method returns null.
- The dice bag supports now a integer based dice with uniform distribution additionally to the float based uniform distribution.
- Adds a few more pre-defined EventContextData containers.
- Certain models can now be extended (for now, this is just the characer class) by using the model extension api. For this, a module must include a list of all extending classes in their configuration (lotgd.yml), for example:
modelExtensions:
- "LotGD\\Module\\Res\\Fight\\Models\\CharacterResFightExtension
The corresponding class must be annoted with @extension which tells the API which class gets extended. It also must contain annotated, static methods that are annotated with @ExtensionMethod. The parameter "as" tells the API under which method name it can be called from the character model.
use LotGD\Core\Doctrine\Annotations\Extension;
use LotGD\Core\Doctrine\Annotations\ExtensionMethod;
/**
* @Extension(of="LotGD\Core\Models\Character")
*/
class CharacterResFightExtension
{
/**
* Levels up a given character.
* @param Character $character
* @ExtensionMethod(as="levelUp")
*/
public static function levelUpCharacter(Character $character): void
{
$character->setLevel($character->getLevel() + 1);
}
}
This method would, after loading, be available on the character model using $character->levelUp()
.
Version 0.3.1 alpha
Version 0.3.1 introduces custom action name parameters and changes the game constructor to the builder pattern with dependency injection to allow better testing methods.
0.3.0 alpha
Preview 0.3.0-alpha introduces a change in the event API to allow stricter control of context parameters:
public static function handleEvent(Game $g, EventContext $context): EventContext;
EventContext
gives access to the called event name via Event()
and to the matched pattern via getMatchingPattern
. Depending on the type of the EventContextData
, different fields are available and modifyable via getDataField($field)
and setDataField($field, $value)
.
0.2.0 alpha
0.1.0 alpha
Cutting this v0.1.0-alpha release to give module collaborators a fixed API to depend on when doing their work.