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

@ -44,6 +44,10 @@ export class SoSUtility {
if (game.user.isGM) {
game.combat.closeAction( msg.data.uniqId );
}
} else if (msg.name == 'msg_request_defense') {
if (game.user.isGM) {
SoSUtility.applyDamage( msg.data );
}
}
}
@ -140,6 +144,15 @@ export class SoSUtility {
return undefined;
}
/* -------------------------------------------- */
static increaseConsequenceSeverity( severity ) {
if ( severity == 'none') return 'light';
if ( severity == 'light') return 'moderate';
if ( severity == 'moderate') return 'severe';
if ( severity == 'severe') return 'critical';
return 'critical';
}
/* -------------------------------------------- */
static increaseSeverity( severity ) {
if ( severity == 'L') return 'M';
@ -225,7 +238,16 @@ export class SoSUtility {
flipData.defenderMelee = melee.data.value;
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-request-dodge.html', flipData );
ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(flipData.target.actor.name), ChatMessage.getWhisperRecipients("GM") ] } );
return; // Wait message response
}
}
this.takeWounds( flipData);
}
/* -------------------------------------------- */
static takeWounds( flipData ) {
let defender = game.actors.get( flipData.target.actor._id);
defender.applyWounds( flipData );
}
}