Latest modifications & changes
All checks were successful
Release Creation / build (release) Successful in 1m47s

This commit is contained in:
2025-08-31 11:28:52 +02:00
parent 527e33a805
commit e5653a4edc
29 changed files with 259 additions and 235 deletions

View File

@@ -44,63 +44,64 @@ export const MONEY = {
}
export const MORTAL_CHOICES = {
"mankind": {label: "Mankind", id: "mankind", defenseBonus: 0},
"elf": {label: "Elf", id: "elf", defenseBonus: 0},
"dwarf": {label: "Dwarf", id: "dwarf", defenseBonus: 0},
"halfelf": {label: "Half-Elf", id: "halfelf", defenseBonus: 0},
"halforc": {label: "Half-Orc", id: "halforc", defenseBonus: 0},
"gnome": {label: "Gnome", id: "gnome", defenseBonus: 2},
"halflings": {label: "Halflings", id: "halflings", defenseBonus: 2}
"mankind": { label: "Mankind", id: "mankind", defenseBonus: 0 },
"elf": { label: "Elf", id: "elf", defenseBonus: 0 },
"dwarf": { label: "Dwarf", id: "dwarf", defenseBonus: 0 },
"halfelf": { label: "Half-Elf", id: "halfelf", defenseBonus: 0 },
"halforc": { label: "Half-Orc", id: "halforc", defenseBonus: 0 },
"gnome": { label: "Gnome", id: "gnome", defenseBonus: 2 },
"halflings": { label: "Halflings", id: "halflings", defenseBonus: 2 }
}
export const FAVOR_CHOICES = {
"none": {label: "None", value: "none"},
"favor": {label: "Favor", value: "favor"},
"disfavor": {label: "Disfavor", value: "disfavor"}
"none": { label: "None", value: "none" },
"favor": { label: "Favor", value: "favor" },
"disfavor": { label: "Disfavor", value: "disfavor" }
}
export const MOVEMENT_CHOICES = {
"none": {label: "None (D20E Disfavor)", disfavor: true, value: "2D20kl"},
"walk": {label: "Walk (D20E Disfavor)", disfavor: true, value: "2D20kl"},
"run": {label: "Jog/Run/Sprint (D20E Favor)", favor: true, value: "2D20kh"},
"incombat": {label: "In Combat (D20E)", favor: false, value: "D20"}
"none": { label: "None (D20E Disfavor)", disfavor: true, value: "2D20kl" },
"walk": { label: "Walk (D20E)", disfavor: true, value: "D20" },
"incombat": { label: "In Combat (D20E)", favor: false, value: "D20" },
"run": { label: "Jog/Run/Sprint (D20E Favor)", favor: true, value: "2D20kh" }
}
export const MOVE_DIRECTION_CHOICES = {
"none": {label: "None (+0)", value: "0"},
"away": {label: "Away (+4)", value: "+4"},
"toward": {label: "Toward (-5)", value: "-5"},
"lateral": {label: "Lateral (+10)", value: "+10"}
"away": { label: "Away (+0)", value: "+0" },
"toward": { label: "Toward (0)", value: "0" },
"lateral": { label: "Lateral (Red +5)", value: "+5" },
"none": { label: "None (+0)", value: "0" },
}
export const SIZE_CHOICES = {
"tiny": {label: "Tiny (+10)", value: "+10"},
"small": {label: "Small (+5)", value: "+5"},
"medium": {label: "Medium (+0)", value: "0"},
"huge": {label: "Huge (-10)", value: "-10"}
"tiny": { label: "Tiny (Blue +11)", value: "+11" },
"small": { label: "Small (Purple +7)", value: "+7" },
"medium": { label: "Medium (Red +5)", value: "+5" },
"large": { label: "Large (Yellow +1)", value: "+1" },
"huge": { label: "Huge (0)", value: "0" }
}
export const RANGE_CHOICES = {
"pointblank": {label: "Point Blank (-5)", value: "-5"},
"short": {label: "Short (+0)", value: "0"},
"medium": {label: "Medium (+8)", value: "+8"},
"long": {label: "Long (+15)", value: "+15"},
"extreme": {label: "Extreme (+20)", value: "+20"},
"beyondskill": {label: "Beyond Skill (+25)", value: "+25"}
"pointblank": { label: "Point Blank (Special)", value: "pointblank" },
"short": { label: "Short (+0)", value: "0" },
"medium": { label: "Medium (Red +5)", value: "+5" },
"long": { label: "Long (Purle +7)", value: "+7" },
"extreme": { label: "Extreme (Grey +9)", value: "+9" },
"beyondskill": { label: "Beyond Skill (Blue +11)", value: "beyondskill" }
}
export const ATTACKER_AIM_CHOICES = {
"simple": {label: "Simple (+0)", value: "0"},
"careful": {label: "Careful (-4)", value: "-4"},
"focused": {label: "Focused (-8)", value: "-8"}
"simple": { label: "Simple (+0)", value: "0" },
"careful": { label: "Careful (Red -5)", value: "-4" },
"focused": { label: "Focused (Grey -9)", value: "-9" }
}
export const SPELL_LETHARGY_DICE = [
{dice: "D6", level: "1-5", value: "6", maxLevel: 5},
{dice: "D8", level: "6-10", value: "8", maxLevel: 10},
{dice: "D10", value: "10", level: "11-15", maxLevel: 15},
{dice: "D12", value: "12", level: "16-20", maxLevel: 20},
{dice: "D20", value: "20", level: "21-25", maxLevel: 25}
{ dice: "D6", level: "1-5", value: "6", maxLevel: 5 },
{ dice: "D8", level: "6-10", value: "8", maxLevel: 10 },
{ dice: "D10", value: "10", level: "11-15", maxLevel: 15 },
{ dice: "D12", value: "12", level: "16-20", maxLevel: 20 },
{ dice: "D20", value: "20", level: "21-25", maxLevel: 25 }
]
export const INITIATIVE_DICE_CHOICES_PER_CLASS = {
@@ -108,44 +109,44 @@ export const INITIATIVE_DICE_CHOICES_PER_CLASS = {
{ "name": "Asleep or totally distracted (2D12)", "value": "2D12" },
{ "name": "Awake but unsuspecting (2D8)", "value": "2D8" },
{ "name": "Declared Ready on Alert (2D6)", "value": "2D6" },
{ "name": "Aware of the enemy, can hear them but not see (2D4)", "value": "2D4" },
{ "name": "Aware and know exactly where the enemy is (2D3)", "value": "2D3" }
/*{ "name": "Aware of the enemy, can hear them but not see (2D4)", "value": "2D4" },
{ "name": "Aware and know exactly where the enemy is (2D3)", "value": "2D3" }*/
],
"fighter": [
{ "name": "Asleep or totally distracted (1D12)", "value": "1D12" },
{ "name": "Awake but unsuspecting (1D8)", "value": "1D8" },
{ "name": "Declared Ready on Alert (1D6)", "value": "1D6" },
{ "name": "Aware of the enemy, can hear them but not see (1D4)", "value": "1D4" },
{ "name": "Aware and know exactly where the enemy is (1D3)", "value": "1D3" }
{ "name": "Declared Ready on Alert (1)", "value": "1" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D4)", "value": "1D4" },
{ "name": "Aware and know exactly where the enemy is (1D3)", "value": "1D3" }*/
],
"rogue": [
{ "name": "Asleep or totally distracted (1D10)", "value": "1D10" },
{ "name": "Awake but unsuspecting (1D8)", "value": "1D8" },
{ "name": "Declared Ready on Alert (1D6)", "value": "1D6" },
{ "name": "Aware of the enemy, can hear them but not see (1D3)", "value": "1D3" },
{ "name": "Aware and know exactly where the enemy is (1D2)", "value": "1D2" }
{ "name": "Declared Ready on Alert (1)", "value": "1" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D3)", "value": "1D3" },
{ "name": "Aware and know exactly where the enemy is (1D2)", "value": "1D2" }*/
],
"ranger": [
{ "name": "Asleep or totally distracted (1D10)", "value": "1D10" },
{ "name": "Awake but unsuspecting (1D8)", "value": "1D8" },
{ "name": "Declared Ready on Alert (1D6)", "value": "1D6" },
{ "name": "Aware of the enemy, can hear them but not see (1D4)", "value": "1D4" },
{ "name": "Aware and know exactly where the enemy is (1D3)", "value": "1D3"}
{ "name": "Declared Ready on Alert (1)", "value": "1" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D4)", "value": "1D4" },
{ "name": "Aware and know exactly where the enemy is (1D3)", "value": "1D3" }*/
],
"cleric": [
{ "name": "Asleep or totally distracted (1D12)", "value": "1D12" },
{ "name": "Awake but unsuspecting (1D10)", "value": "1D10" },
{ "name": "Declared Ready on Alert (1D8)", "value": "1D8" },
{ "name": "Aware of the enemy, can hear them but not see (1D6)", "value": "1D6" },
{ "name": "Aware and know exactly where the enemy is (1D4)", "value": "1D4" }
{ "name": "Declared Ready on Alert (1D)", "value": "1D" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D6)", "value": "1D6" },
{ "name": "Aware and know exactly where the enemy is (1D4)", "value": "1D4" }*/
],
"magicuser": [
{ "name": "Sleeping to recover Aether Points (2D20)", "value": "2D20" },
{ "name": "Asleep or totally distracted (1D20)", "value": "1D20" },
{ "name": "Awake but unsuspecting (1D12)", "value": "1D12" },
{ "name": "Declared Ready on Alert (1D10)", "value": "1D10" },
{ "name": "Aware of the enemy, can hear them but not see (1D8)", "value": "1D8" },
{ "name": "Aware and know exactly where the enemy is (1D6)", "value": "1D6" }
{ "name": "Declared Ready on Alert (1)", "value": "1" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D8)", "value": "1D8" },
{ "name": "Aware and know exactly where the enemy is (1D6)", "value": "1D6" }*/
]
}
@@ -159,12 +160,12 @@ export const CHAR_CLASSES = {
}
export const CHAR_CLASSES_DEFINES = {
"untrained": {id: "untrained", label: "Untrained"},
"fighter": {id: "fighter", label: "Fighter"},
"rogue": {id: "rogue", label: "Rogue"},
"ranger": {id: "ranger", label: "Ranger"},
"cleric": {id: "cleric", label: "Cleric"},
"magicuser": {id: "magicuser", label: "Magic User"}
"untrained": { id: "untrained", label: "Untrained" },
"fighter": { id: "fighter", label: "Fighter" },
"rogue": { id: "rogue", label: "Rogue" },
"ranger": { id: "ranger", label: "Ranger" },
"cleric": { id: "cleric", label: "Cleric" },
"magicuser": { id: "magicuser", label: "Magic User" }
}
export const DICE_VALUES = {
@@ -177,10 +178,10 @@ export const DICE_VALUES = {
"d20": "D20"
}
export const CHARACTERISTIC_ATTACK = [ "str", "int", "wis", "dex"]
export const CHARACTERISTIC_RANGED_ATTACK = [ "int", "wis", "dex"]
export const CHARACTERISTIC_DEFENSE = [ "int", "wis", "dex" ]
export const CHARACTERISTIC_DAMAGE = [ "str" ]
export const CHARACTERISTIC_ATTACK = ["str", "int", "wis", "dex"]
export const CHARACTERISTIC_RANGED_ATTACK = ["int", "wis", "dex"]
export const CHARACTERISTIC_DEFENSE = ["int", "wis", "dex"]
export const CHARACTERISTIC_DAMAGE = ["str"]
export const DEFENSE_DICE_VALUES = {
"0": "0",
@@ -216,41 +217,41 @@ export const SPELL_CRITICAL = {
}
export const CHOICE_MODIFIERS = {
"-9": "-9",
"-8": "-8",
"-7": "-7",
"-6": "-6",
"-5": "-5",
"-4": "-4",
"-3": "-3",
"-2": "-2",
"-1": "-1",
"+0": "0",
"+1": "+1",
"+2": "+2",
"+3": "+3",
"+4": "+4",
"+5": "+5",
"+6": "+6",
"+7": "+7",
"+8": "+8",
"+9": "+9",
"+10": "+10",
"+11": "+11",
"+12": "+12",
"+13": "+13",
"+14": "+14",
"+15": "+15",
"+16": "+16",
"+17": "+17",
"+18": "+18",
"+19": "+19",
"+20": "+20",
"+21": "+21",
"+22": "+22",
"+23": "+23",
"+24": "+24",
"+25": "+25"
"-9": "-9",
"-8": "-8",
"-7": "-7",
"-6": "-6",
"-5": "-5",
"-4": "-4",
"-3": "-3",
"-2": "-2",
"-1": "-1",
"+0": "0",
"+1": "+1",
"+2": "+2",
"+3": "+3",
"+4": "+4",
"+5": "+5",
"+6": "+6",
"+7": "+7",
"+8": "+8",
"+9": "+9",
"+10": "+10",
"+11": "+11",
"+12": "+12",
"+13": "+13",
"+14": "+14",
"+15": "+15",
"+16": "+16",
"+17": "+17",
"+18": "+18",
"+19": "+19",
"+20": "+20",
"+21": "+21",
"+22": "+22",
"+23": "+23",
"+24": "+24",
"+25": "+25"
}
export const ASCII = `

View File

@@ -124,6 +124,8 @@ export default class LethalFantasyRoll extends Roll {
let hasFavor = false
let hasMaxValue = true
let hasGrantedDice = false
let pointBlank = false
let beyondSkill = false
let hasStaticModifier = false
let hasExplode = true
@@ -132,13 +134,11 @@ export default class LethalFantasyRoll extends Roll {
hasD30 = options.rollType === "save"
if (options.rollTarget.rollKey === "dying") {
dice = options.rollTarget.value
maxValue = Number(options.rollTarget.value.match(/\d+/)[0])
hasModifier = false
hasChangeDice = true
hasFavor = true
} else {
dice = "1D20"
maxValue = 20
hasFavor = true
}
@@ -148,7 +148,6 @@ export default class LethalFantasyRoll extends Roll {
dice = options.rollTarget.formula
baseFormula = options.rollTarget.formula
hasModifier = false
maxValue = 100
hasMaxValue = false
hasChangeDice = false
hasFavor = false
@@ -158,7 +157,6 @@ export default class LethalFantasyRoll extends Roll {
options.rollName = options.rollTarget.name
dice = "1D20"
baseFormula = "D20"
maxValue = 20
hasModifier = true
hasChangeDice = false
hasFavor = true
@@ -172,29 +170,26 @@ export default class LethalFantasyRoll extends Roll {
} else if (options.rollType === "monster-skill") {
options.rollName = game.i18n.localize(`LETHALFANTASY.Label.${options.rollTarget.rollKey}`)
dice = "1D100"
baseFormula = "D100"
maxValue = 100
dice = "1D20"
baseFormula = "D20"
hasModifier = true
hasFavor = true
hasChangeDice = false
} else if (options.rollType === "skill") {
options.rollName = options.rollTarget.name
dice = "1D100"
baseFormula = "D100"
maxValue = 100
dice = "1D20"
baseFormula = "D20"
hasModifier = true
hasFavor = true
hasChangeDice = false
options.rollTarget.value = options.rollTarget.system.skillTotal
options.rollTarget.value = Math.floor(options.rollTarget.system.skillTotal / 10)
} else if (options.rollType === "weapon-attack" || options.rollType === "weapon-defense") {
hasD30 = true
options.rollName = options.rollTarget.name
dice = "1D20"
baseFormula = "D20"
maxValue = 20
hasModifier = true
hasChangeDice = false
hasFavor = true
@@ -216,7 +211,6 @@ export default class LethalFantasyRoll extends Roll {
options.rollName = options.rollTarget.name
dice = "1D20"
baseFormula = "D20"
maxValue = 20
hasModifier = true
hasChangeDice = false
options.rollTarget.value = options.rollTarget.actorModifiers.levelSpellModifier + options.rollTarget.actorModifiers.intSpellModifier
@@ -234,7 +228,6 @@ export default class LethalFantasyRoll extends Roll {
options.rollName = options.rollTarget.name
dice = "1D20"
baseFormula = "D20"
maxValue = 20
hasChangeDice = false
options.rollTarget.value = options.rollTarget.actorModifiers.levelMiracleModifier + options.rollTarget.actorModifiers.chaMiracleModifier
options.rollTarget.charModifier = options.rollTarget.actorModifiers.chaMiracleModifier
@@ -271,7 +264,6 @@ export default class LethalFantasyRoll extends Roll {
}
dice = dice.replace("E", "")
baseFormula = dice
maxValue = 20
} else if (options.rollType.includes("monster-damage")) {
options.rollName = options.rollTarget.name
@@ -282,7 +274,6 @@ export default class LethalFantasyRoll extends Roll {
dice = options.rollTarget.damageDice
dice = dice.replace("E", "")
baseFormula = dice
maxValue = 20
}
@@ -317,6 +308,7 @@ export default class LethalFantasyRoll extends Roll {
hasModifier,
hasFavor,
hasChangeDice,
pointBlank,
baseValue: options.rollTarget.value,
changeDice: `${dice}`,
fieldRollMode,
@@ -359,7 +351,13 @@ export default class LethalFantasyRoll extends Roll {
"selectGranted": (event, button, dialog) => {
hasGrantedDice = true
},
"gotoToken" : (event, button, dialog) => {
"selectBeyondSkill": (event, button, dialog) => {
beyondSkill = button.checked
},
"selectPointBlank": (event, button, dialog) => {
pointBlank = button.checked
},
"gotoToken": (event, button, dialog) => {
let tokenId = $(button).data("tokenId")
let token = canvas.tokens?.get(tokenId)
if (token) {
@@ -387,12 +385,8 @@ export default class LethalFantasyRoll extends Roll {
if (fullModifier === 0) {
modifierFormula = "0"
} else {
if (options.rollType === "skill" || options.rollType === "monster-skill") {
modifierFormula = `${fullModifier}`
} else {
let modAbs = Math.abs(fullModifier)
modifierFormula = `D${modAbs + 1} - 1`
}
let modAbs = Math.abs(fullModifier)
modifierFormula = `D${modAbs + 1} - 1`
}
if (hasStaticModifier) {
modifierFormula += ` + ${options.rollTarget.staticModifier}`
@@ -415,6 +409,14 @@ export default class LethalFantasyRoll extends Roll {
}
}
// Latest addition : favor choice at point blank range
if (pointBlank) {
rollContext.favor = "favor"
}
if (beyondSkill) {
rollContext.favor = "disfavor"
}
// Specific pain case
if (options.rollType === "save" && options.rollTarget.rollKey === "pain" || options.rollTarget.rollKey === "paincourage") {
baseFormula = options.rollTarget.rollDice
@@ -935,7 +937,24 @@ export default class LethalFantasyRoll extends Roll {
rejectClose: false // Click on Close button will not launch an error
})
// If the user cancels the dialog, exit
if (rollContext === null) return
console.log("RollContext", rollContext)
// Add disfavor/favor option if point blank range
if (rollContext.range === "pointblank") {
rollContext.movement = rollContext.movement.replace("kh", "")
rollContext.movement = rollContext.movement.replace("kl", "")
rollContext.movement += "kl" // Add the kl to the movement (disfavor for point blank range)
rollContext.range = "0"
}
if (rollContext.range === "beyondskill") {
rollContext.movement = rollContext.movement.replace("kh", "")
rollContext.movement = rollContext.movement.replace("kl", "")
rollContext.movement += "kh" // Add the kl to the movement (disfavor for point blank range)
rollContext.range = "+11"
}
// Build the final modifier
let fullModifier = Number(rollContext.moveDirection) +
Number(rollContext.size) +
@@ -951,9 +970,6 @@ export default class LethalFantasyRoll extends Roll {
modifierFormula = `${modAbs}`
}
// If the user cancels the dialog, exit
if (rollContext === null) return
let rollData = { ...rollContext }
let options = { ...rollContext }
options.rollName = "Ranged Defense"
@@ -965,6 +981,7 @@ export default class LethalFantasyRoll extends Roll {
let rollD30 = await new Roll("1D30").evaluate()
options.D30result = rollD30.total
let dice = rollContext.movement
let maxValue = 20 // As per latest changes (was : Number(dice.match(/\d+$/)[0])
let rollTotal = -1