Add items

This commit is contained in:
sladecraven 2021-02-17 22:38:12 +01:00
parent f57e5030c5
commit 64ef6e3c67
4 changed files with 23 additions and 16 deletions

View File

@ -229,7 +229,8 @@ export class SoSActor extends Actor {
consequencesList: duplicate( this.getApplicableConsequences() ),
wounds: duplicate( this.data.data.wounds),
malusConsequence: 0,
bonusConsequence: 0
bonusConsequence: 0,
woundMalus: 0
}
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData);
new SoSFlipDialog(flipData, html).render(true);
@ -248,7 +249,8 @@ export class SoSActor extends Actor {
modifierList: SoSUtility.fillRange(-10, +10),
tnList: SoSUtility.fillRange(6, 20),
malusConsequence: 0,
bonusConsequence: 0
bonusConsequence: 0,
woundMalus: 0
}
flipData.statList['nostat'] = { label: "No stat (ie defaulting skills)", value: 0, cardsuit: "none" }
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/dialog-flip.html', flipData);
@ -282,7 +284,9 @@ export class SoSActor extends Actor {
actor: this,
modifierList: SoSUtility.fillRange(-10, +10),
tnList: SoSUtility.fillRange(6, 20),
malusConsequence: 0
malusConsequence: 0,
bonusConsequence: 0,
woundMalus: 0
}
console.log(flipData);
@ -336,7 +340,7 @@ export class SoSActor extends Actor {
totalWounds: this.data.data.scores.wound.value
}
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-consequence.html', woundData );
ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } );
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } );
this.checkDeath();
}

View File

@ -97,13 +97,17 @@ export class SoSCombat extends Combat {
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" );
combatant.actor.applyConsequenceWound( bleeding.data.severity, "bleeding" );
}
}
}
/* -------------------------------------------- */
closeAction( uniqId) {
// Delete message !
const toDelete = game.messages.filter(it => it.data.content.includes( uniqId ));
toDelete.forEach(it => it.delete());
let action = this.currentActions.find( _action => _action.uniqId == uniqId );
if (action) {
action.isDone = true;
@ -153,7 +157,12 @@ export class SoSCombat extends Combat {
/* -------------------------------------------- */
async setupActorActions(actionConf) {
console.log("Setting combat for phase : ", actionConf);
console.log("Setting combat for phase : ", actionConf, actionConf.uniqId);
// Delete message !
const toDelete = game.messages.filter(it => it.data.content.includes( actionConf.uniqId ));
console.log("MESSAGE : ", toDelete);
toDelete.forEach(it => it.delete());
if ( !this.phaseSetup) this.phaseSetup = {}; // Opportunistic init

View File

@ -77,12 +77,9 @@ export class SoSDialogCombatActions extends Dialog {
let combat = game.combats.get( this.combatActions.combatId ); // Get the associated combat
combat.setupActorActions( msgdata );
} else {
game.socket.emit("system.foundryvtt-reve-de-dragon", {
game.socket.emit("system.foundryvtt-shadows-over-sol", {
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 !");
}

View File

@ -36,7 +36,7 @@ export class SoSUtility extends Entity {
}
/* -------------------------------------------- */
onSocketMesssage( msg ) {
static onSocketMesssage( msg ) {
if( !game.user.isGM ) return; // Only GM
if (msg.name == 'msg_declare_actions' ) {
@ -120,10 +120,7 @@ export class SoSUtility extends Entity {
/* -------------------------------------------- */
static closeAction(event) {
let uniqId = event.currentTarget.attributes['data-uniq-id'].value;
// Delete message !
const toDelete = game.messages.filter(it => it.data.content.includes( uniqId ));
toDelete.forEach(it => it.delete());
if ( game.user.isGM ) {
game.combat.closeAction( uniqId );
} else {
@ -294,7 +291,7 @@ export class SoSUtility extends Entity {
flipData.uniqId = randomID(16);
this.registry[flipData.uniqId] = flipData;
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") ] } );
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(flipData.target.actor.name).concat(ChatMessage.getWhisperRecipients("GM")) } );
return; // Wait message response
}
}