Add new automations
This commit is contained in:
@@ -324,6 +324,7 @@ export class MournbladeUtility {
|
||||
rollData.isSuccess = (rollData.finalResult >= rollData.difficulte)
|
||||
rollData.isHeroique = ((rollData.finalResult - rollData.difficulte) >= 10)
|
||||
rollData.isDramatique = ((rollData.finalResult - rollData.difficulte) <= -10)
|
||||
rollData.isPureSuccess = (rollData.isSuccess && !rollData.isHeroique)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,6 +367,20 @@ export class MournbladeUtility {
|
||||
rollData.diceFormula += `+${modifier.system.value}`
|
||||
}
|
||||
}
|
||||
// Apply desavantages
|
||||
let desavantagesBonus = 0
|
||||
for (let desavantage in rollData.desavantages) {
|
||||
if (rollData.desavantages[desavantage]) {
|
||||
desavantagesBonus += 5
|
||||
}
|
||||
}
|
||||
desavantagesBonus = Math.min(15, desavantagesBonus)
|
||||
rollData.diceFormula += `+${desavantagesBonus}`
|
||||
|
||||
// Monté ?
|
||||
if (rollData.isMonte) {
|
||||
rollData.diceFormula += "+5"
|
||||
}
|
||||
|
||||
// Specific modifier for distance
|
||||
if (rollData.arme?.system?.isDistance) {
|
||||
@@ -383,7 +398,7 @@ export class MournbladeUtility {
|
||||
}
|
||||
}
|
||||
if (rollData.typeCouvert != "aucun") {
|
||||
rollData.diceFormula += `-${rollData.config.couverts[rollData.typeCouvert].value}`
|
||||
rollData.diceFormula += `+${rollData.config.couverts[rollData.typeCouvert].value}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,6 +421,7 @@ export class MournbladeUtility {
|
||||
rollData.finalResult = myRoll.total
|
||||
this.computeResult(rollData)
|
||||
|
||||
// Application immédiate selon type de jet
|
||||
if (rollData.rune) {
|
||||
let subAme = rollData.runeame
|
||||
if (rollData.isEchec && !rollData.isDramatique) {
|
||||
@@ -413,7 +429,19 @@ export class MournbladeUtility {
|
||||
}
|
||||
actor.subPointsAme(rollData.runemode, subAme)
|
||||
}
|
||||
|
||||
if (rollData.typeAttaque == "assomer" && rollData.defenderTokenId && rollData.isPureSuccess) {
|
||||
let defender = game.canvas.tokens.get(rollData?.defenderTokenId)?.actor
|
||||
defender.setModifier("Assomer : Prochaine action", "roll", -5)
|
||||
}
|
||||
if (rollData.typeAttaque == "fuir" && rollData.difficulte > 0 && !rollData.isSuccess) {
|
||||
actor.setModifier("Fuite échouée : -5 en défense ce round et suivant", "defense", -5)
|
||||
}
|
||||
if (rollData.typeAttaque == "immobiliser" && rollData.difficulte > 0 && rollData.isPureSuccess) {
|
||||
actor.setModifier("Immobilisation en cours : -5 pour prochaine action", "roll", -5)
|
||||
}
|
||||
if ( rollData.typeAttaque == "chargecavalerie" ) {
|
||||
actor.setModifier("Charge de Cavalerie : -5 défense pour le tour", "defense", -5)
|
||||
}
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-mournblade/templates/chat-generic-result.html`, rollData)
|
||||
}, rollData)
|
||||
@@ -426,17 +454,22 @@ export class MournbladeUtility {
|
||||
let degatsMessage = "Degats normaux"
|
||||
|
||||
if (rollData.arme?.system?.isMelee) {
|
||||
if (rollData.typeAttaque == "assaut") {
|
||||
rollData.degatsFormula = rollData.arme.system.totalDegats
|
||||
if (rollData.isHeroique) { // Deux fois les dés de dégats
|
||||
rollData.degatsFormula += " + " + rollData.arme.system.totalDegats
|
||||
degatsMessage = "Dégats doublés"
|
||||
}
|
||||
rollData.degatsFormula = rollData.arme.system.totalDegats
|
||||
if (rollData.isHeroique) { // Deux fois les dés de dégats
|
||||
degatsMessage = "Dégats doublés"
|
||||
}
|
||||
|
||||
if (rollData.typeAttaque == "assomer") {
|
||||
rollData.degatsFormula = false
|
||||
}
|
||||
|
||||
if (rollData.typeAttaque == "charger") {
|
||||
rollData.degatsFormula += "+2"
|
||||
}
|
||||
|
||||
if ( rollData.typeAttaque == "chargecavalerie" ) {
|
||||
rollData.degatsFormula += "+5"
|
||||
}
|
||||
|
||||
if (rollData.typeAttaque == "precise") {
|
||||
degatsMessage = "Degats normaux"
|
||||
if (rollData.isHeroique) { // Degats max
|
||||
@@ -457,9 +490,9 @@ export class MournbladeUtility {
|
||||
if (rollData.typeAttaque == "coupbas") {
|
||||
degatsMessage = "Pas de dégats, mais malus pour prochaine action complexe du défenseur"
|
||||
rollData.degatsFormula = false
|
||||
rollData.nextMalus = -5
|
||||
rollData.nextMalus = 5
|
||||
if (rollData.isHeroique) { // Malus pour prochaine action
|
||||
rollData.nextMalus = -15
|
||||
rollData.nextMalus = 15
|
||||
}
|
||||
}
|
||||
if (rollData.typeAttaque == "contenir") {
|
||||
@@ -480,21 +513,23 @@ export class MournbladeUtility {
|
||||
}
|
||||
} else { // Armes à distance
|
||||
rollData.degatsFormula = rollData.arme.system.totalDegats
|
||||
if (rollData.isHeroique) { // Deux fois les dés de dégats
|
||||
rollData.degatsFormula += " + " + rollData.arme.system.totalDegats
|
||||
}
|
||||
}
|
||||
|
||||
for(let mod of rollData.modifiers) {
|
||||
if (mod.system.modifiertype == "degats") {
|
||||
rollData.degatsFormula += `+${mod.system.value}`
|
||||
}
|
||||
}
|
||||
|
||||
// Perform the roll, show the dice
|
||||
rollData.finalResult = 0
|
||||
rollData.degatsMessage = degatsMessage
|
||||
if (rollData.degatsFormula) {
|
||||
console.log("Degats formula", rollData.degatsFormula)
|
||||
// Twice!maximize
|
||||
if (rollData.isHeroique && !maximize) {
|
||||
rollData.degatsFormula += "+" + rollData.degatsFormula
|
||||
}
|
||||
// Latest modifiers
|
||||
for(let mod of rollData.modifiers) {
|
||||
if (mod.system.modifiertype == "degats") {
|
||||
rollData.degatsFormula += `+${mod.system.value}`
|
||||
}
|
||||
}
|
||||
let degatsRoll = new Roll(rollData.degatsFormula).roll({ async: false, maximize: maximize })
|
||||
await this.showDiceSoNice(degatsRoll, game.settings.get("core", "rollMode"))
|
||||
rollData.degatsRoll = duplicate(degatsRoll)
|
||||
@@ -650,7 +685,7 @@ export class MournbladeUtility {
|
||||
pointAmeOptions: this.getPointAmeOptions(),
|
||||
difficulte: 0,
|
||||
modificateur: 0,
|
||||
config: game.system.mournblade.config,
|
||||
config: duplicate(game.system.mournblade.config),
|
||||
}
|
||||
MournbladeUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
@@ -662,7 +697,9 @@ export class MournbladeUtility {
|
||||
if (target) {
|
||||
rollData.defenderTokenId = target.id
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
rollData.defenderCombatValues = defender.getCombatValues()
|
||||
rollData.defender = defender.toObject() // Simpler
|
||||
rollData.defenderDefense = defender.getBestDefenseValue()
|
||||
rollData.armeDefense = defender.getBestDefenseValue()
|
||||
if (rollData.armeDefense) {
|
||||
rollData.difficulte = rollData.armeDefense.system.totalDefensif
|
||||
|
Reference in New Issue
Block a user