Initiative from PHASE OK
This commit is contained in:
@ -4,12 +4,14 @@ import { SoSUtility } from "./sos-utility.js";
|
||||
export class SoSDialogCombatActions extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create( combatId, round ) {
|
||||
static async create( combatId, combatantId, round, uniqId ) {
|
||||
|
||||
let combatActions = {
|
||||
actionsList: await SoSUtility.loadCompendium( 'foundryvtt-shadows-over-sol.combat-actions' ),
|
||||
actionPoints: SoSUtility.fillRange(0, 6),
|
||||
combatId: combatId,
|
||||
combatantId: combatantId,
|
||||
uniqId: uniqId,
|
||||
round: round
|
||||
}
|
||||
for ( let i=0; i<combatActions.actionsList.length; i++) {
|
||||
@ -54,13 +56,26 @@ export class SoSDialogCombatActions extends Dialog {
|
||||
let action2 = duplicate(this.combatActions.actionsList[action2Index]._id);
|
||||
let action1Index = $('#action1').val();
|
||||
let action1 = duplicate(this.combatActions.actionsList[action1Index]._id);
|
||||
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
name: "msg_declare_actions", data: {
|
||||
userId: game.userId,
|
||||
phaseArray: [ action1, action2, action3],
|
||||
remainingAP: ap
|
||||
} } );
|
||||
|
||||
let msgdata = {
|
||||
combatId: this.combatActions.combatId,
|
||||
combatantId: this.combatActions.combatantId,
|
||||
uniqId: this.combatActions.uniqId,
|
||||
userId: game.userId,
|
||||
phaseArray: [ action1, action2, action3],
|
||||
remainingAP: ap
|
||||
}
|
||||
|
||||
if ( game.user.isGM ) {
|
||||
let combat = game.combats.get( this.combatActions.combatId ); // Get the associated combat
|
||||
combat.setupActorActions( msgdata );
|
||||
} else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
name: "msg_declare_actions", data: msgdata } );
|
||||
}
|
||||
// Delete message !
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes( this.combatActions.uniqId ));
|
||||
toDelete.forEach(it => it.delete());
|
||||
} else {
|
||||
ui.notifications.warn("Action Points are below 0 ! Please check your phases !");
|
||||
}
|
||||
@ -68,6 +83,7 @@ export class SoSDialogCombatActions extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
validateActions( html ) {
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user