Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update combat system to handle start turn, end turn; improve effect management #215

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

Azurelol
Copy link
Collaborator

@Azurelol Azurelol commented Feb 2, 2025

Combat System, Tracker

Refactors the combat system and tracker to handle two discrete steps between starting a turn and ending it.
Adds hooks for the common events during a combat encounter run by the system:

  • Combat Start
  • End of Turn
  • End of Round
  • Combat End

fu_combat_tracker

Effects Pipeline

Moves the effects class on with the other pipelines.. as it acts like one. It now hooks by default into the combat system in order to manage active effects. When these events are emitted chat messages can be displayed to update users and provide easy buttons to remove effects that have expired.

Fixes

  • Status effects are now cleared properly when temporary effects are cleared.
  • Cleans up the deprecated properties used for status effect rendering (Handlebars)

@Azurelol Azurelol changed the title Refactor effects pipeline, add end of turn / round / combat hooks Add combat events, improve effects pipeline Feb 3, 2025
@Azurelol Azurelol linked an issue Feb 3, 2025 that may be closed by this pull request
@Azurelol Azurelol changed the title Add combat events, improve effects pipeline Update combat system to handle start turn, end turn; improve effect management Feb 5, 2025
@Azurelol Azurelol force-pushed the update/combat_turn_events branch 2 times, most recently from 19e9243 to e9adc78 Compare February 8, 2025 17:41
@Azurelol Azurelol marked this pull request as ready for review February 8, 2025 17:41
@@ -4,7 +4,9 @@
* @example actor.getFlag(Flags.Scope, Flags.CurrentTurn)
*/
export const Flags = Object.freeze({
CombatantsTurnStarted: 'combatantsTurnStarted',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well align case with other flags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, will do.

async _doTakeTurn(event) {
await ui.combat.handleTakeTurn(event);
// TODO: Why was this?
// if (!game.user.isGM) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting for explicit review

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Will remove the comment now that it's been sorted out and the missing functionality (players can start/end turns) implemented.

@@ -397,7 +408,8 @@ export class CombatHUD extends Application {
Hooks.on('preUpdateScene', this._preUpdateScene.bind(this));

if (!game.user.isGM) return;
game.settings.set(SYSTEM, SETTINGS.optionCombatHudActorOrdering, this._backupOrdering ?? []);
// TODO: Enable back?
//game.settings.set(SYSTEM, SETTINGS.optionCombatHudActorOrdering, this._backupOrdering ?? []);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting for explicit review

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back without issue that I saw.

@@ -52,7 +92,8 @@ export class FUCombat extends Combat {
*/
constructor(data, context) {
super(data, context);

//this._combatant = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Yes it was.

@Azurelol Azurelol force-pushed the update/combat_turn_events branch from e9adc78 to 4e0118e Compare February 10, 2025 15:10
- Add a distinct event for starting combatant turn
- Add hooks for all combat events
- Move in effects with the other pipelines
- Clean up the img warnings from status effects and effects in HBS templates

# Conflicts:
#	styles/css/projectfu.css
@Azurelol Azurelol requested a review from KSops February 10, 2025 15:11
@Azurelol Azurelol force-pushed the update/combat_turn_events branch from 4e0118e to 6c67925 Compare February 10, 2025 15:11
@Azurelol Azurelol merged commit e1a6adf into dev Feb 13, 2025
@Azurelol Azurelol deleted the update/combat_turn_events branch February 13, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turn/round/scene events and active effect durations
2 participants