#4 : Weakness management, including bonus/malus field for scores and reminder in the flip dialog
This commit is contained in:
@ -25,6 +25,8 @@ export class SoSActorSheet extends ActorSheet {
|
||||
getData() {
|
||||
let data = super.getData();
|
||||
|
||||
this.actor.checkDeck();
|
||||
|
||||
data.data.edgecard = this.actor.getEdgesCard();
|
||||
data.data.deckSize = this.actor.getDeckSize();
|
||||
|
||||
|
@ -53,17 +53,22 @@ export class SoSActor extends Actor {
|
||||
async prepareData() {
|
||||
super.prepareData();
|
||||
|
||||
if ( !this.cardDeck ) {
|
||||
if ( this.hasPlayerOwner) {
|
||||
this.cardDeck = new SoSCardDeck();
|
||||
this.cardDeck.initCardDeck( this, this.data.data.internals.deck );
|
||||
} else {
|
||||
this.cardDeck = game.system.sos.gmDeck;
|
||||
}
|
||||
}
|
||||
this.checkDeck();
|
||||
this.controlScores();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
checkDeck() {
|
||||
if ( !this.cardDeck && this.hasPlayerOwner ) {
|
||||
this.cardDeck = new SoSCardDeck();
|
||||
this.cardDeck.initCardDeck( this, this.data.data.internals.deck );
|
||||
}
|
||||
if ( !this.hasPlayerOwner ) {
|
||||
this.cardDeck = game.system.sos.gmDeck.GMdeck;
|
||||
console.log("DECK : ", this.cardDeck);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDeckSize() {
|
||||
return this.cardDeck.getDeckSize();
|
||||
@ -120,8 +125,8 @@ export class SoSActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
computeDefense() {
|
||||
return { value: Math.ceil((this.data.data.stats.speed.value + this.data.data.stats.perception.value + this.data.data.stats.dexterity.value) / 2),
|
||||
critical: this.data.data.stats.speed.value + this.data.data.stats.perception.value + this.data.data.stats.dexterity.value
|
||||
return { value: Math.ceil((this.data.data.stats.speed.value + this.data.data.stats.perception.value + this.data.data.stats.dexterity.value) / 2) + this.data.data.scores.defense.bonusmalus,
|
||||
critical: this.data.data.stats.speed.value + this.data.data.stats.perception.value + this.data.data.stats.dexterity.value + this.data.data.scores.defense.bonusmalus
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
@ -132,23 +137,27 @@ export class SoSActor extends Actor {
|
||||
getEncumbrance( ) {
|
||||
return this.data.data.scores.encumbrance.value;
|
||||
}
|
||||
computeEncumbrance( ) {
|
||||
return this.data.data.stats.strength.value + this.data.data.scores.encumbrance.bonusmalus;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeEdge( ) {
|
||||
return Math.ceil( (this.data.data.stats.intelligence.value + this.data.data.stats.charisma.value) / 2) + this.data.data.scores.edge.bonus;
|
||||
return Math.ceil( (this.data.data.stats.intelligence.value + this.data.data.stats.charisma.value) / 2) + this.data.data.scores.edge.bonusmalus;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getShock( ) {
|
||||
return this.data.data.scores.shock.value;
|
||||
}
|
||||
computeShock() {
|
||||
return Math.ceil( this.data.data.stats.endurance.value + this.data.data.stats.determination.value + this.data.data.scores.dr.value);
|
||||
return Math.ceil( this.data.data.stats.endurance.value + this.data.data.stats.determination.value + this.data.data.scores.dr.value) + this.data.data.scores.shock.bonusmalus;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getWound( ) {
|
||||
return this.data.data.scores.wound.value;
|
||||
}
|
||||
computeWound() {
|
||||
return Math.ceil( (this.data.data.stats.strength.value + this.data.data.stats.endurance.value) / 2);
|
||||
return Math.ceil( (this.data.data.stats.strength.value + this.data.data.stats.endurance.value) / 2) + this.data.data.scores.wounds.bonusmalus;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -183,7 +192,7 @@ export class SoSActor extends Actor {
|
||||
}
|
||||
// Encumbrance
|
||||
if ( this.getEncumbrance() != this.data.data.stats.strength.value ) {
|
||||
await this.update( {'data.scores.encumbrance.value': this.data.data.stats.strength.value });
|
||||
await this.update( {'data.scores.encumbrance.value': this.computeEncumbrance() });
|
||||
}
|
||||
// Shock
|
||||
if ( this.getShock() != this.computeShock() ) {
|
||||
@ -235,6 +244,7 @@ export class SoSActor extends Actor {
|
||||
modifierList: SoSUtility.fillRange(-10, +10),
|
||||
tnList: SoSUtility.fillRange(6, 20),
|
||||
consequencesList: duplicate( this.getApplicableConsequences() ),
|
||||
weaknessList: this.data.items.filter( item => item.type == 'weakness' ),
|
||||
wounds: duplicate( this.data.data.wounds),
|
||||
malusConsequence: 0,
|
||||
bonusConsequence: 0,
|
||||
|
Reference in New Issue
Block a user