Releases: Trisfald/weasel
v0.11.0
Features
Introduced Team Powers
Powers function similar to statistics and to abilities, with the only difference that they can be activated only by teams.
New methods and associated types have been added to TeamRules
. New events (AlterPowers
, RegeneratePowers
and InvokePower``) can be fired to manipulate powers.
v0.10.0
Fixes
Improved the ergonomics of handling errors from EventProcessor
. ProcessOutput
has a new method result()
to get a WeaselResult
.
For example, the following function is now valid:
fn fire_event<R, P>(processor: &mut P) -> WeaselResult<(), R>
where
R: BattleRules + 'static,
P: EventProcessor<R>,
{
DummyEvent::trigger(processor).fire().result()?;
Ok(())
}
v0.9.0
Changes
Rounds and turns now reflect the most used definition (a round is made of multiple turns).
This change swaps around the concept of round
and turn
in weasel, making it consistent with the popular definition in turn based games.
Now every actor acts during a turn. A round can contain one or more of these turns.
v0.8.1
Features
Event trigger RemoveEntityTrigger
.
This new event trigger makes it easier to delete an entity when you have an EntityId
instead of a CreatureId
or an ObjectId
.
Re-exported names.
Re-exported the most useful names at the root of the crate.
Bug fixes
- Fixed the incorrect name
ConcludeMissionTrigger
. It is nowConcludeObjectivesTrigger
.
v0.8.0
Features
Improvements to CharacterRules
.
The new methods on_character_added
and on_character_transmuted
can be used to define specific behaviors when an entity is added or removed from the battle.
Client
and Server
are now Send
.
This change should help integrate weasel into multithreaded game. Both client and server can now be sent between threads.
Notice: there are additional Send
requirements on some traits.
Added accessors to flat event structures.
FlatVersionedEvent
and FlatClientEvent
now have methods to access their internal fields.
Added counters for rounds and turns in Rounds
and an EndTurn
event.
Added counters for rounds and turns in Rounds
. These can be accessed with completed_rounds
and completed_turns
.
The rounds counter is automatically increased by the library. The turns counter, instead, must be manually increased by firing an event of type EndTurn
.
The metric ROUNDS_STARTED
was removed as its functionality is now covered by completed_rounds
.
Multiplayer example.
The new example 'King of the hill' is a card game with multiplayer over network for three players.
Introduced BattleController
trait.
This new trait allows the user to write generic code around structure that have ownership of a Battle
object.
The trait is implemented by Client
and Server
.
Bug fixes
- Fixed a bug for which
CREATURES_CREATED
andOBJECTS_CREATED
had the same internal id.
v0.7.0
Features
Methods to obtain a mutable access to all rules and models.
Introduced new methods in Battle
and in some other components to let the player modify the rules and the models in the context of custom events.
Rounds can now be initiated by multiple actors.
A round can be started by multiple actors with the new function StartRound::trigger_with_actors
. All actors can use their abilities, in no particular order.
EndRound
automatically ends the round for everyone.
v0.6.0
Features
Long lasting status effects.
It's now possible to implement status effects with weasel. A status effect can be inflicted with the event InflictStatus
and removed with the event ClearStatus
.
You can specify your own status effects' definition with the new associated types Potency
, Status
and StatusesAlteration
.
The new methods generate_status
and alter_statuses
in CharacterRules
let you define how statuses are created and modified.
The new methods apply_status
, update_status
and delete_status
in FightRules
let you define what are the side effects of a status.
Added the event EnvironmentRound
to simulate a round for all inanimate objects, to trigger their status updates.
Improvements to trait method names.
Renamed ActorRules
's alter
into alter_abilities
and CharacterRules
's alter
into alter_statistics
for consistency with the new alter_statuses
.
New examples.
New example, status
, to demonstrate how to define and use status effects.
Bug fixes
Event's origin is not overridden anymore by the server while processing events put into an EventQueue
.
v0.5.0
Features
Improvements to ActorRules
.
The method activable
now take BattleState
as argument. This allows to decide whether an ability is activable depending on the entire state of the battle, not only the state of the actor.
The methods on_round_start
and on_round_end
now take BattleState
as argument as well. This let the user implement passive skills such as gain x health for each adjacent enemy at the end of every round.
Improvements to verify methods.
Some trait methods are used to verify if an operation is allowed.
allow_new_entity
, activable
, check_move
now return a WeaselResult
instead of a bool. In this way the user can specify the reason for which the operation has been rejected.
Added WeaselError::GenericError
.
Added a new variant of WeaselError
to represent generic errors that don't have additional information.
New examples.
New example, undo
, to demonstrate how to undo/redo events.
The example passive
shows instead how to define simple passive abilities.
v.0.4.1
Changes
Replaced HashMap
with IndexMap
.
Rust's HashMap with default Hasher doesn't guarantee a consistent order while iterating over its elements.
This can be an issue in few corner cases. For instance, iterating over entities and generating side effects might cause a desync if the server and the client iteration order are different.
IndexMap
, instead, provides a consistent iteration order across different executions.
v0.4.0
Features
Inanimate objects.
Introduced a new struct to represent inanimate entities: Object
.
The new associated type ObjectId
in CharacterRules
let you customize the objects' id type.
Objects can be placed on the battlefield and possess statistics. However, they don't know any ability and they can't take any action.
Two new events, CreateObject
and RemoveObject
, can be used to add and remove objects from the battle.
Improvements to Battle
API.
Added more methods to modify the state of Battle
and of its submodules (Rounds
, Entropy
, Space
, Entities
). This's done to increase the power of user defined events.
Event's origin.
It's now possible to manually set the origin of an event. The Originated
decorator let you do this on an EventTrigger
.
Doc tests
Added doc tests with a simple example for all events in weasel.