Manage wounds in fight

This commit is contained in:
2021-02-15 23:21:53 +01:00
parent de104fb386
commit de4bdb2403
10 changed files with 120 additions and 7 deletions

View File

@ -39,6 +39,7 @@ export class SoSCombat extends Combat {
gotoNextTurn() {
this.phaseNumber -= 1;
if ( this.phaseNumber <= 0) {
this.applyConsequences();
this.nextRound(); // Auto-switch to next round
} else {
this.nextTurn();
@ -91,6 +92,16 @@ export class SoSCombat extends Combat {
this.currentActions = actionList;
}
/* -------------------------------------------- */
applyConsequences( ) {
if (game.user.isGM ) {
for( let combatant of this.combatants) {
let bleeding = combatant.actor.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding');
combatant.actor.applyConsequenceWound( bleeding.severity, "bleeding" );
}
}
}
/* -------------------------------------------- */
closeAction( uniqId) {
let action = this.currentActions.find( _action => _action.uniqId == uniqId );
@ -146,7 +157,7 @@ export class SoSCombat extends Combat {
}
if ( actionsDone ) {
this.actionsRequested = false;
ChatMessage.create( { content: `Action phase has been completed ! Now proceeding with actions.`,
ChatMessage.create( { content: `Action declaration phase has been completed ! Now proceeding with actions.`,
whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
this.phaseNumber = 3;
this.nextTurn();