Update scripts

This commit is contained in:
LeRatierBretonnien 2024-10-08 20:52:09 +02:00
parent 1f1d871e53
commit fc4fa1deb5
178 changed files with 12247 additions and 10701 deletions

View File

@ -1,5 +1,6 @@
[Dolphin]
Timestamp=2023,2,28,20,42,35.428
HeaderColumnWidths=407,65,124,124
Timestamp=2024,10,8,20,19,27.19
Version=4
ViewMode=1
VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails

View File

@ -8,7 +8,7 @@
}
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "8.1.0",
"version": "8.1.1",
"esmodules": [
"modules/babele-register.js",
"modules/addon-register.js",
@ -117,7 +117,7 @@
}
],
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-8.1.0.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-8.1.1.zip",
"id": "wh4-fr-translation",
"compatibility": {
"minimum": "12",

7
scripts/.directory Normal file
View File

@ -0,0 +1,7 @@
[Dolphin]
SortOrder=1
SortRole=modificationtime
Timestamp=2024,10,8,20,1,53.617
Version=4
ViewMode=1
VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails

View File

@ -0,0 +1 @@
args.fields.slBonus += this.actor.system.characteristics.wp.bonus;

View File

@ -0,0 +1,4 @@
if (args.test.spell)
{
args.test.result.other.push(`<strong>${this.effect.name}</strong>: Automatic Failure`)
}

View File

@ -0,0 +1 @@
await args.actor.addCondition("ablaze");

View File

@ -30,7 +30,7 @@
}
else
{
ui.notifications.warn(`Could not find ${talent}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}

View File

@ -0,0 +1,89 @@
let characteristics = {
"ws" : 15,
"bs" : 10,
"s" : 10,
"t" : 15,
"i" : 10,
"ag" : 0,
"dex" : 0,
"int" : 10,
"wp" : 10,
"fel" : 10
}
let skills = ["Intimidate", "Commandement" , "Perception"]
let skillAdvancements = [10, 10, 10]
let talents = ["Combat Aware", "Drilled", "Menaçant", "Robust"]
let trappings = ["Arme simple", "Mail Coat", "Mail Chausses"]
let specialItems = [
]
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let item of specialItems) {
let newItem
if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
}
items.push(newItem.toObject())
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -0,0 +1,2 @@
const sl = this.effect.getFlag("wfrp4e-archives3", "sl");
args.item.system.damage.value += `+${sl}`;

View File

@ -1,8 +1,12 @@
if (isNaN(parseInt(this.item.system.specification.value)))
{
let value = await ValueDialog.create("Entrer la valeur d'Armure", this.effect.name);
let value = this.item.specifier;
if (!value)
{
value = await ValueDialog.create({text : "Enter Armour value", title : this.effect.name});
}
if (value)
{
this.item.updateSource({"system.specification.value" : value});
this.item.updateSource({"system.specification.value" : value, name : this.item.baseName});
}
}

View File

@ -1,11 +1,11 @@
let skill = `Métier (${this.item.parenthesesText})`
let skill = `${game.i18n.localize("NAME.Trade")} (${this.item.parenthesesText})`
let currentCareer = this.actor.system.currentCareer;
let existingSkill = this.actor.itemTypes.skill.find(i => i.name == skill);
if (!currentCareer) return
let inCurrentCareer = currentCareer.system.skills.includes(skill);
let inCurrentCareer = currentCareer.system.skills.concat(currentCareer.system.addedSkills).includes(skill);
let craftsmanAdded = this.actor.getFlag("wfrp4e", "craftsmanAdded") || {};
if (existingSkill && inCurrentCareer && !craftsmanAdded[existingSkill.name])
{
@ -14,6 +14,6 @@ if (existingSkill && inCurrentCareer && !craftsmanAdded[existingSkill.name])
else
{
craftsmanAdded[skill] = true;
currentCareer.system.skills.push(skill);
setProperty(this.actor, "flags.wfrp4e.craftsmanAdded", craftsmanAdded)
currentCareer.system.addedSkills.push(skill);
foundry.utils.setProperty(this.actor, "flags.wfrp4e.craftsmanAdded", craftsmanAdded)
}

View File

@ -1,4 +1,4 @@
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.locations, this.effect.img), 1, "Choose Location");
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.locations, this.effect.img), 1, "Choisissez Location");
if (choice[0])
{
this.effect.updateSource({name : `${this.effect.name} (${choice[0].name})`})

View File

@ -10,13 +10,10 @@ let characteristics = {
"wp" : 25,
"fel" : 10
}
//let skills = ["Cool", "Dodge", "Intimidate", "Intuition", "Leadership", "Lore (Warfare)", "Perception"]
let skills = ["Calme", "Equive", "Intimidation", "Intuition", "Commandement", "Savoir (Guerre)", "Perception"]
let skills = ["Calme", "Esquive", "Intimidate", "Intuition", "Commandement" , "Lore (Warfare)", "Perception"]
let skillAdvancements = [15, 15, 15, 15, 15, 10, 10]
let talents = ["Vigilance", "Combat Instinctif", "Feinte", "Exaltant", "Déterminé", "Seigneur de guerre"]
// TODO
let trappings = ["Arme simple", "Bouclier"]
let talents = ["Combat Aware", "Combat Reflexes", "Feint", "Inspiring", "Resolute", "War Leader"]
let trappings = ["Arme simple", "Shield"]
let items = [];
let updateObj = this.actor.toObject();
@ -62,7 +59,7 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
@ -76,13 +73,3 @@ updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -0,0 +1,6 @@
const target = args.actor;
if (target.has("Ethereal") || target.has("Corruption")) {
args.totalWoundLoss += 6;
args.modifiers.other.push({label: this.effect.name, value: 6})
}

View File

@ -0,0 +1 @@
return args.skill?.name !== game.i18n.localize("NAME.Endurance");

112
scripts/4ylzjgUdHY5D0yVh.js Normal file
View File

@ -0,0 +1,112 @@
let characteristics = {
"ws" : 25,
"bs" : 10,
"s" : 15,
"t" : 15,
"i" : 25,
"ag" : 20,
"dex" : 0,
"int" : 10,
"wp" : 25,
"fel" : 10
}
let skills = ["Calme", "Esquive", "Intimidate", "Intuition", "Langue (Battle)", "Commandement" , "Lore (Warfare)", "Perception"]
let skillAdvancements = [15, 15, 15, 15, 10, 15, 10, 10]
let talents = ["Combat Aware", "Combat Master", "Combat Reflexes", "Inspiring", "Resolute", "War Leader"]
let trappings = ["Arme simple", "Shield", "Plate Breastplate", "Plate Bracers", "Plate Helm", "Plate Leggings"]
let specialItems = []
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let item of specialItems) {
let newItem
if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
}
items.push(newItem.toObject())
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
let filters = [
{
property : "type",
value : "weapon"
},
{
property : "system.weaponGroup.value",
value : ["twohanded", "polearm"]
}
]
items = items.concat(await ItemDialog.createFromFilters(filters, 1, "Choisissez an appropriate Polearm or Two-Handed Weapon"))
let ride = await Dialog.confirm({title : "Skill", content : "Add Chaos Steed and +20 Ride (Horse)?"})
if (ride)
{
let skill = await game.wfrp4e.utility.findSkill("Ride (Horse)")
skill = skill.toObject();
skill.system.advances.value = 20;
items = items.concat({name : "Chaos Steed", type: "trapping", "system.trappingType.value" : "misc"}, skill)
}
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -13,7 +13,7 @@ let characteristics = {
let skills = ["Esquive", "Perception"]
let skillAdvancements = [10, 10]
let talents = ["Flee!", "Marksman"]
let trappings = ["Hand Weapon"]
let trappings = ["Arme simple"]
let items = [];
let updateObj = this.actor.toObject();
@ -48,7 +48,7 @@ for (let talent of talents)
}
else
{
ui.notifications.warn(`Could not find ${talent}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
@ -59,13 +59,13 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Could not find ${trapping}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
@ -73,13 +73,3 @@ updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -10,11 +10,10 @@ let characteristics = {
"wp" : 15,
"fel" : 0
}
//let skills = ["Cool", "Dodge", "Intimidate", "Leadership"]
let skills = ["Calme", "Esquive", "Intimidation", "Commandement"]
let skills = ["Calme", "Esquive", "Intimidate", "Commandement" ]
let skillAdvancements = [15, 15, 10, 5]
let talents = ["Vigilance", "Combat Instinctif", "Feinte", "Déterminé"]
let trappings = ["Cotte de Mailles", "Chausses de Mailles", "Coiffe de Mailles", "Arme simple", "Bouclier"]
let talents = ["Combat Aware", "Combat Reflexes", "Feint", "Resolute"]
let trappings = ["Mail Coat", "Mail Chausses", "Mail Coif", "Arme simple", "Shield"]
let items = [];
let updateObj = this.actor.toObject();
@ -60,7 +59,7 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
@ -74,13 +73,3 @@ updateObj.name = this.effect.name + " " + updateObj.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpenter)';
const difficulty = 'challenging';
const target = 40;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,6 @@
const visor = this.item.getFlag('wfrp4e', 'visor');
if (!visor)
args.fields.modifier -= 10;
else
args.fields.modifier -= 20;

View File

@ -10,10 +10,10 @@ let characteristics = {
"wp" : 35,
"fel" : 15
}
let skills = ["Cool", "Dodge", "Intimidate", "Intuition", "Leadership", "Lore (Warfare)", "Perception"]
let skills = ["Calme", "Esquive", "Intimidate", "Intuition", "Commandement" , "Lore (Warfare)", "Perception"]
let skillAdvancements = [25, 15, 25, 25, 30, 20, 20]
let talents = ["Combat Aware", "Combat Reflexes", "Feint", "Inspiring", "Luck", "Resolute", "Unshakable", "War Leader"]
let trappings = ["Hand Weapon", "Shield"]
let talents = ["Combat Aware", "Combat Reflexes", "Feint", "Inspiring", "Chance", "Resolute", "Unshakable", "War Leader"]
let trappings = ["Arme simple", "Shield"]
let items = [];
let updateObj = this.actor.toObject();
@ -48,7 +48,7 @@ for (let talent of talents)
}
else
{
ui.notifications.warn(`Could not find ${talent}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
@ -59,13 +59,13 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Could not find ${trapping}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
@ -73,13 +73,3 @@ updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -1,6 +1,6 @@
if (isNaN(parseInt(this.item.system.specification.value)))
{
let value = await ValueDialog.create("Saisir lde Savoir de lancer de sort", this.effect.name, "", Object.values(game.wfrp4e.config.magicLores));
let value = await ValueDialog.create({text : "Enter Spellcasting Lore", title : this.effect.name}, "", Object.values(game.wfrp4e.config.magicLores));
if (value)
{
this.item.updateSource({"system.specification.value" : value});

View File

@ -1,6 +1,6 @@
if (args.test.result.castOutcome == "failure")
{
ValueDialog.create("Sasir le nombre de Blessures perdues en échange de DR", this.effect.name, "0").then(async value => {
ValueDialog.create({text : "Enter Wounds Lost to gain SL", title : this.effect.name}, "0").then(async value => {
value = Math.clamped(value, 0, 3)
if (value == 0)
{
@ -8,11 +8,11 @@ if (args.test.result.castOutcome == "failure")
}
else if (Number.isNumeric(value))
{
this.script.scriptNotification(`Perte de ${value} Blessures`)
this.script.notification(`Lost ${value} Wounds`)
this.actor.modifyWounds(-1 * value)
await this.item.system.toggleEquip();
args.test.addSL(value);
args.test.preData.other.push(`<strong>${this.effect.name}</strong>: +${value} DR`)
args.test.preData.other.push(`<strong>${this.effect.name}</strong>: +${value} SL`)
}
})
}

View File

@ -0,0 +1,7 @@
const uuids = [
"Compendium.wfrp4e-core.items.Item.AcnFuDKRemLI9ey7", // Nose for Trouble
"Compendium.wfrp4e-core.items.Item.WoXShzaYkV5F6c48", // Master of Disguise
];
const items = await Promise.all(uuids.map(uuid => fromUuid(uuid)));
await this.actor.createEmbeddedDocuments("Item", items, {fromEffect: this.effect.id});

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Fini de passer <em>l'ancre</em>.</p>`;
const repaired_message = `<p>Finished raisint <em>the anchor</em>.</p>`;
const test = 'Strength';
const difficulty = 'vhard';
const target = 20;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -9,7 +9,7 @@ let filters = [
}
]
let petty = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 6, "Choisir 6 sorts de Magie Mineure")
let petty = await ItemDialog.createFromFilters(filters, 6, "Choisissez 6 Sorts de Magie Mineure")
filters = [
@ -23,7 +23,7 @@ filters = [
}
]
let arcane = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 9, "Choisir 9 Sorts d'Arcane")
let arcane = await ItemDialog.createFromFilters(filters, 9, "Choisissez 9 Sorts de Magie d'Arcane")
let items = petty.concat(arcane).map(i => i.toObject())

View File

@ -0,0 +1 @@
this.actor.deleteEmbeddedDocuments("ActiveEffect", [this.effect.id]);

View File

@ -1,7 +1,7 @@
let choice1 = [
{
type : "skill",
name : "Corps à corps (Base)",
name : "Melee (Basic)",
diff : {
system : {
advances : {
@ -14,7 +14,7 @@ let choice1 = [
let choice2 = [
{
type : "skill",
name : "Corps à corps (Armes d'hast)",
name : "Melee (Polearm)",
diff : {
system : {
advances : {
@ -26,14 +26,14 @@ let choice2 = [
]
let choice = await Dialog.wait({
title : "Choix",
title : "Choice",
content :
`<p>
Choisissez une option
Select your choice
</p>
<ol>
<li>Corps à corps (Base)</li>
<li>Corps à corps (Armes d'hast)</li>
<li>Melee (Basic)</li>
<li>Melee (Polearm)</li>
</ol>
`,
buttons : {
@ -44,7 +44,7 @@ let choice = await Dialog.wait({
}
},
2 : {
label : "Armes d'hast",
label : "Polearm",
callback : () => {
return choice2;
}
@ -71,8 +71,12 @@ for (let c of choice)
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item)
{
let equip = item.system.tags.has("equippable");
item = item.toObject()
equip(item);
if (equip)
{
item.system.equipped.value = true;
}
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
@ -82,13 +86,3 @@ for (let c of choice)
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -0,0 +1,2 @@
args.abort = true;
this.script.notification(game.i18n.localize("SCRIPT.Sightstep"));

View File

@ -1,10 +1,10 @@
let actor = game.user.character ?? canvas.tokens.controlled[0]?.actor;
if (!actor || !(actor.system instanceof StandardActorModel))
return ui.notifications.warn("Vous devez contrôler un Acteur capable de réaliser un Test de Force");
return ui.notifications.warn("You must control an Actor capable of performing a Strength Test");
let test = await actor.setupCharacteristic("s", {
skipTargets: true,
appendTitle: " - Renflouement",
appendTitle: " - Bailing Out",
fields: {
difficulty: "challenging"
},
@ -22,7 +22,7 @@ if (test.succeeded) {
let rating = parseInt(this.effect.name.match(/\d+/)?.[0]);
if (rating <= 1) {
const scriptData = this.effect.flags.wfrp4e.scriptData;
const scriptData = this.effect.system.scriptData
scriptData[2].trigger = '';
await this.effect.update({disabled: true, "flags.wfrp4e.scriptData": scriptData});
await this.effect.update({disabled: true, "system.scriptData": scriptData});
}

View File

@ -0,0 +1 @@
return args.type !== "channelling" && !args.skill?.name.includes(game.i18n.localize("NAME.Channelling")) && args.skill?.name !== `${game.i18n.localize("NAME.Language")} (${game.i18n.localize("SPEC.Magick")})` && args.skill?.name !== game.i18n.localize("NAME.OutdoorSurvival");

View File

@ -0,0 +1,8 @@
const locations = [];
for (let [key, loc] of Object.entries(args.AP)) {
if (loc.layers?.some(i => !i.metal && i.source?.system.tags?.has("armour")))
locations.push(key);
}
this.actor.status.addArmour(1, {source: this.effect, magical: true, locations})

View File

@ -0,0 +1,18 @@
if (args.actor.has("Démoniaque")) {
args.totalWoundLoss += 3;
args.modifiers.other.push({label: this.effect.name, value: 3});
}
let test = await args.actor.setupSkill("Endurance", {
appendTitle: ` ${this.effect.name}`,
skipTargets: true,
characteristic: 't',
context: {
failure: "Received 1 Blinded Condition"
}
});
await test.roll();
if (test.failed) {
args.actor.addCondition("blinded");
}

View File

@ -0,0 +1 @@
return args.characteristic === "s" || args.characteristic === "t" || args.weapon?.system?.attackType === "melee";

View File

@ -1,9 +1,9 @@
let column = await ValueDialog.create("Selectionnez la colonne pour déterminer la Tête de Bête", "Sélectionner la colonne", "", ["Undivided", "Khorne", "Nurgle", "Slaanesh", "Tzeentch"]);
let column = await ValueDialog.create({text : "Select the column to roll on to determine Beast Head", title : "Select Column"}, "", ["Undivided", "Khorne", "Nurgle", "Slaanesh", "Tzeentch"]);
if (column)
{
let result = await game.wfrp4e.tables.rollTable("beasthead", {}, column);
this.script.scriptMessage(`<strong>${result.title}</strong><br>${result.result}`);
this.script.message(`<strong>${result.title}</strong><br>${result.result}`);
let uuid = `Compendium.${result.object.documentCollection}.${result.object.documentId}`;
let item = await fromUuid(uuid);
if (item)

View File

@ -1,3 +1,6 @@
let fatigued = args.actor.hasCondition("fatigued")
if (fatigued)
setProperty(fatigued, "flags.wfrp4e.scriptData", getProperty(fatigued, "flags.wfrp4e.scriptData").filter(s => s.trigger != "dialog"))
{
fatigued.system.scriptData = fatigued.system.scriptData.filter(s => s.trigger != "dialog")
fatigued.system._scripts = null;
}

View File

@ -0,0 +1,8 @@
const locations = [];
for (let [key, loc] of Object.entries(args.AP)) {
if (loc.layers?.some(i => i.metal))
locations.push(key);
}
this.actor.status.addArmour(1, {source: this.effect, magical: true, locations})

View File

@ -0,0 +1,5 @@
if (args.opposedTest?.attackerTest?.weapon?.name.toLowerCase().includes("unarmed")) {
const sl = this.effect.getFlag("wfrp4e-archives3", "sl");
args.totalWoundLoss += sl;
args.modifiers.other.push({label: this.effect.name, value: sl});
}

View File

@ -1,6 +1,6 @@
if (isNaN(parseInt(this.item.system.specification.value)))
{
let value = await ValueDialog.create("Saisir la valeur de Terreur", this.effect.name);
let value = await ValueDialog.create({text : "Enter Terror value", title : this.effect.name});
if (value)
{
this.item.updateSource({"system.specification.value" : value});

View File

@ -0,0 +1,7 @@
const uuids = [
"Compendium.wfrp4e-core.items.Item.bxbTiLzbaz4vdukT", // Hunter's Eye
"Compendium.wfrp4e-core.items.Item.XSb3QVB9ipPBFt56", // Shadow
];
const items = await Promise.all(uuids.map(uuid => fromUuid(uuid)));
await this.actor.createEmbeddedDocuments("Item", items, {fromEffect: this.effect.id});

View File

@ -0,0 +1,14 @@
const uuid = "Compendium.wfrp4e-core.items.Item.mCvZAj5F6hfUZhzR";
const item = await fromUuid(uuid);
const data = item.toObject();
data.name = this.effect.name;
data.type = 'trapping';
data.system.trappingType = {value: 'clothingAccessories'};
data.system.equipped = {value: true};
const effectData = this.effect.sourceItem.effects.find(e => e.disabled).toObject();
effectData.disabled = false;
effectData.system.transferData.equipTransfer = true;
data.effects = [effectData];
const dagger = await this.actor.createEmbeddedDocuments("Item", [data], {fromEffect: this.effect.id});

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpenter)';
const difficulty = 'difficult';
const target = 20;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpentry)';
const difficulty = 'easy';
const target = 20;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,2 @@
let amount = this.effect.sourceTest.result.baseSL;
args.fields.successBonus += amount;

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Réparation finie de<em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Voile';
const difficulty = 'easy';
const target = 10;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,37 @@
let lore = await ValueDialog.create({text : "Choisissez Lore", title : "Lore"}, "", {"fire" : "Feu", "death" : "Mort", "metal" : "Métal", "shadow" : "Ombres"});
let filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : "petty"
}
]
let petty = await ItemDialog.createFromFilters(filters, 3, "Choisissez 3 Sorts de Magie Mineure")
filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : [""]
}
]
let arcane = await ItemDialog.createFromFilters(filters, 6, "Choisissez 6 Sorts de Magie d'Arcane")
let items = petty.map(i => i.toObject()).concat(arcane.map(i => {
let spell = i.toObject();
spell.img = `modules/wfrp4e-core/icons/spells/${lore}.png`
spell.system.lore.value = lore;
return spell;
}));
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -1,19 +1,9 @@
let choices = await Promise.all([game.wfrp4e.utility.findItemId("PzimjNx9Ojq4g6mV"), game.wfrp4e.utility.findItemId("rOPmyLWa37e7s9v6")])
let items = await game.wfrp4e.apps.ItemDialog.create(choices, 1, "Choisir une compétence")
let choices = await Promise.all([warhammer.utility.findItemId("PzimjNx9Ojq4g6mV"), warhammer.utility.findItemId("rOPmyLWa37e7s9v6")])
let items = await game.wfrp4e.apps.ItemDialog.create(choices, 1, "Choisissez a Skill")
items = items.map(i => i.toObject())
items.forEach(i => i.system.advances.value = 20)
items.forEach(i => equip(i))
items.forEach(i => i.system.equipped.value = true;)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.data.worn.value = true
else if (item.type == "weapon")
item.data.equipped = true
else if (item.type == "trapping" && item.data.trappingType.value == "clothingAccessories")
item.data.worn = true
}

View File

@ -0,0 +1,12 @@
if (this.actor.system.details.experience.current < 100) {
return this.script.notification(game.i18n.localize("SCRIPT.NotEnoughXP"))
}
let item = await game.wfrp4e.utility.findItem("Animal Telepathy", "trait")
this.actor.createEmbeddedDocuments("Item", [item]);
let expLog = foundry.utils.duplicate(this.actor.details.experience.log || []);
expLog.push({amount : 100, reason: item.name, spent: this.actor.details.experience.spent + 100, total: this.actor.details.experience.total, type: "spent"});
this.actor.update({
"system.details.experience.spent": this.actor.details.experience.spent + 100,
"system.details.experience.log": expLog
});

View File

@ -0,0 +1,6 @@
if (!args.itemCreated) return;
if (args.itemCreated.type !== "critical") return;
if (args.itemCreated.system.location.value.toLowerCase() !== "head") return;
if (Number(args.itemCreated.system.wounds.value) > 0) {
this.script.message(game.i18n.format("SCRIPT.Sallet", {name: args.itemCreated.parent.name, wounds: args.itemCreated.system.wounds.value}))
}

View File

@ -1,11 +1,11 @@
let skill = `Divertissement (Chant)`
let skill = `${game.i18n.localize("NAME.Entertain")} (${game.i18n.localize("SPEC.Singing")})`;
let currentCareer = this.actor.system.currentCareer;
let existingSkill = this.actor.itemTypes.skill.find(i => i.name == skill);
if (!currentCareer) return
let inCurrentCareer = currentCareer.system.skills.includes(skill);
let inCurrentCareer = currentCareer.system.skills.concat(currentCareer.system.addedSkills).includes(skill);
let perfectPitchAdded = this.actor.getFlag("wfrp4e", "perfectPitchAdded") || {};
if (existingSkill && inCurrentCareer && !perfectPitchAdded[existingSkill.name])
{
@ -14,8 +14,8 @@ if (existingSkill && inCurrentCareer && !perfectPitchAdded[existingSkill.name])
else
{
perfectPitchAdded[skill] = true;
currentCareer.system.skills.push(skill);
setProperty(this.actor, "flags.wfrp4e.perfectPitchAdded", perfectPitchAdded)
currentCareer.system.addedSkills.push(skill);
foundry.utils.setProperty(this.actor, "flags.wfrp4e.perfectPitchAdded", perfectPitchAdded)
}

View File

@ -0,0 +1 @@
return args.characteristic !== "s" && args.characteristic !== "t" && args.weapon?.system?.attackType !== "melee";

View File

@ -3,21 +3,30 @@ if (this.actor.type != "character")
return;
}
let god = await ValueDialog.create("Saisir une Déité", "Béni")
let god = await ValueDialog.create({text : "Enter a Deity", title : "Blessed"})
if (god)
{
let prayers = await game.wfrp4e.utility.findAll("prayer", "Chargement des Prières")
let prayers = await warhammer.utility.findAllItems("prayer", "Loading Prayers")
let blessings = prayers.filter(p => p.system.god.value.split(",").map(i => i.trim().toLowerCase()).includes(god.toLowerCase()) && p.system.type.value == "blessing")
let godBlessings = game.wfrp4e.config.godBlessings[god.toLowerCase()] || [];
if (god == "Old Faith")
{
blessings = await ItemDialog.create(prayers.filter(i => i.system.type.value == "blessing"), 6, {text : "Select any 6 Blessings", title : "Blessed"})
}
if (godBlessings.length)
{
blessings = blessings.concat(await Promise.all(godBlessings.filter(bls => !(blessings.map(i => i.uuid).includes(bls.uuid))).map(fromUuid)));
}
if (blessings.length)
{
this.script.scriptNotification("Ajout de " + blessings.map(i => i.name).join(", "))
this.script.notification("Adding " + blessings.map(i => i.name).join(", "))
await this.actor.createEmbeddedDocuments("Item", blessings, {fromEffect : this.effect.id})
}
else
{
this.script.scriptNotification(`Impossible de trouver des Bénédictions associées avec ${god}.`)
this.script.notification(`Impossible de trouver any Blessings associated with ${god}.`)
}
this.item.updateSource({name : this.item.name.replace("Savoir divin", god)})
this.item.updateSource({name : this.item.name.replace("Any", god)})
await this.actor.update({"system.details.god.value": god})
}

View File

@ -1,11 +1,11 @@
let skill = `Langue (Magick)`
let skill = `Language (Magick)`
let currentCareer = this.actor.system.currentCareer;
let existingSkill = this.actor.itemTypes.skill.find(i => i.name == skill);
if (!currentCareer) return
let inCurrentCareer = currentCareer.system.skills.includes(skill);
let inCurrentCareer = currentCareer.system.skills.concat(currentCareer.system.addedSkills).includes(skill);
let witchAdded = actor.getFlag("wfrp4e", "witchAdded") || {};
if (existingSkill && inCurrentCareer && !witchAdded[existingSkill.name])
{
@ -14,6 +14,6 @@ if (existingSkill && inCurrentCareer && !witchAdded[existingSkill.name])
else
{
witchAdded[skill] = true;
currentCareer.system.skills.push(skill);
setProperty(this.actor, "flags.wfrp4e.witchAdded", witchAdded)
currentCareer.system.addedSkills.push(skill);
foundry.utils.setProperty(this.actor, "flags.wfrp4e.witchAdded", witchAdded)
}

View File

@ -0,0 +1,6 @@
let blinded = args.actor.hasCondition("blinded")
if (blinded)
{
blinded.system.scriptData = blinded.system.scriptData.filter(s => s.trigger != "dialog")
blinded.system._scripts = null;
}

View File

@ -0,0 +1 @@
return !this.actor.attacker || args.item?.system?.attackType !== "melee" || args.skill?.name !== game.i18n.localize("NAME.Dodge");

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpente)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpentry)';
const difficulty = 'hard';
const target = 30;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,3 @@
let amount = this.effect.sourceTest.result.overcast.usage.other.current ?? 0;
args.fields.successBonus += 2 + amount;

View File

@ -0,0 +1,7 @@
const uuids = [
"Compendium.wfrp4e-core.items.Item.Nj3tC8A5fZ3zEdMR", // Holy Visions
"Compendium.wfrp4e-core.items.Item.mNoCuaVbFBflfO6X", // Sixth Sense
];
const items = await Promise.all(uuids.map(uuid => fromUuid(uuid)));
await this.actor.createEmbeddedDocuments("Item", items, {fromEffect: this.effect.id});

View File

@ -0,0 +1,7 @@
const diff = foundry.utils.diffObject(this.item.toObject(), args.data);
if (args.data?.system?.APdamage?.head > this.item.system.APdamage.head) {
const result = await game.wfrp4e.tables.rollTable('armet-damage');
this.script.message(result.result);
if (result.total > 5)
delete args.data.system.APdamage.head;
}

View File

@ -13,7 +13,7 @@ let characteristics = {
let skills = ["Focalisation", "Calme", "Esquive", "Divertissement (Narration)", "Intuition", "Langue (Magick)", "Savoir (Magie)" , "Perception"]
let skillAdvancements = [5, 15, 10, 10, 15, 10, 10, 20]
let talents = ["Magie des Arcanes", "Magie Mineure", "Seconde Vue"]
let trappings = ["Arme simple", "(2M) Bâton de combat", "Robe de rituel incorporant des ingrédients et des fétiches"]
let trappings = ["Arme simple", "(2M) Bâton de combat", "Ritual Dress incorporating many ingredients and fetishes"]
let items = [];
let updateObj = this.actor.toObject();
@ -59,14 +59,14 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
items.push({name : trapping, type : "trapping", "system.trappingType.value" : "clothingAccessories"})
//ui.notifications.warn(`Could not find ${trapping}`, {permanent : true})
//ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
@ -74,13 +74,3 @@ updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -1,6 +1,6 @@
if (isNaN(parseInt(this.item.system.specification.value)))
{
let value = await ValueDialog.create("Saisir la valeur de Peur", this.item.name);
let value = await ValueDialog.create({text : "Enter Fear value", title : this.effect.name});
if (value)
{
this.item.updateSource({"system.specification.value" : value});

View File

@ -0,0 +1,3 @@
const message = game.messages.get(args.options.message);
const sl = message.system.sl;
this.effect.setFlag("wfrp4e-archives3", "sl", sl);

View File

@ -0,0 +1 @@
return args.skill?.name !== `${game.i18n.localize("NAME.Language")} (${game.i18n.localize("SPEC.Magick")})` && args.type !== "channelling";

View File

@ -9,7 +9,7 @@ let filters = [
}
]
let petty = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 3, "Choisir 3 sorts de Magie Mineure")
let petty = await ItemDialog.createFromFilters(filters, 3, "Choisissez 3 Sorts de Magie Mineure")
filters = [
@ -23,7 +23,7 @@ filters = [
}
]
let arcane = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 3, "Choisir 3 sorts d'Arcane")
let arcane = await ItemDialog.createFromFilters(filters, 3, "Choisissez 3 Sorts de Magie d'Arcane")
let items = petty.concat(arcane).map(i => i.toObject())

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Réparation finie de<em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Voile';
const difficulty = 'average';
const target = 30;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,7 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1 @@
return args.skill?.name === game.i18n.localize("NAME.Charm");

View File

@ -1,6 +1,6 @@
if (this.item.system.specification.value == "Size")
{
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.actorSizes, this.item.img), 1, "Choose Size");
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.actorSizes, this.item.img), 1, "Choisissez Size");
if (choice[0])
{
this.item.updateSource({"system.specification.value" : choice[0].name})

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Ingénieur)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Engineer)';
const difficulty = 'easy';
const target = 10;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,7 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpenter)';
const difficulty = 'difficult';
const target = 40;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,7 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,8 @@
args.actor.characteristics.ag.modifier -= 10;
if (args.actor.details.move.value > 3)
{
args.actor.details.move.value -= 1;
if (args.actor.details.move.value < 3)
args.actor.details.move.value = 3
}

View File

@ -10,7 +10,7 @@ let filters = [
}
]
let items = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 2, "Choisissez 2 Compétences pour y ajouter +20")
let items = await ItemDialog.createFromFilters(filters, 2, "Choisissez 2 Skills to add +20")
items = items.map(i => i.toObject())
items.forEach(i => i.system.advances.value = 20)

View File

@ -13,17 +13,17 @@
let personalityQuirk = (await game.wfrp4e.tables.rollTable("personality-quirks", {hideDSN: true})).text;
let templateItem = await game.wfrp4e.utility.findItemId(templateMap[template._id]);
let templateItem = await warhammer.utility.findItemId(templateMap[template._id]);
let bio =
`
<p><strong>Template</strong>: ${template.text}</p>
<p><strong>Bizarrerie Physique</strong>: ${physicalQuirk}</p>
<p><strong>Etique de travail</strong>: ${workEthic}</p>
<p><strong>Bizarrerie de personnalité</strong>: ${personalityQuirk}</p>
<p><strong>Trait physique</strong>: ${physicalQuirk}</p>
<p><strong>Ethique</strong>: ${workEthic}</p>
<p><strong>Trait de personnalité</strong>: ${personalityQuirk}</p>
`
this.script.scriptMessage(bio, {whisper : ChatMessage.getWhisperRecipients("GM")})
this.script.message(bio, {whisper : ChatMessage.getWhisperRecipients("GM")})
await this.actor.update({"system.details.gmnotes.value" : bio})

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Répération finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpenter)';
const difficulty = 'hard';
const target = 40;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,14 +37,14 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]
};

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Réparation finie de <em>${this.item.name}</em>.</p>`;
const test = 'Test de Maintenance Equipage';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Maintenance Crew Test';
const difficulty = 'hard';
const target = 80;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,6 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Finished repairing <em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Strength';
const difficulty = 'average';
const target = 10;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Repair the ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,13 +37,13 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]

View File

@ -59,7 +59,7 @@
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
@ -72,13 +72,3 @@
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -0,0 +1,12 @@
if (this.actor.system.details.experience.current < 100) {
return this.script.notification(game.i18n.localize("SCRIPT.NotEnoughXP"))
}
let item = await game.wfrp4e.utility.findItem("Messenger", "trait")
this.actor.createEmbeddedDocuments("Item", [item]);
let expLog = foundry.utils.duplicate(this.actor.details.experience.log || []);
expLog.push({amount : 100, reason: item.name, spent: this.actor.details.experience.spent + 100, total: this.actor.details.experience.total, type: "spent"});
this.actor.update({
"system.details.experience.spent": this.actor.details.experience.spent + 100,
"system.details.experience.log": expLog
});

View File

@ -0,0 +1,8 @@
const test = await this.actor.setupCharacteristic("int", {fields: {difficulty: "easy"}, skipTargets: true, appendTitle : ` - ${this.effect.name}`});
await test.roll();
if (test.failed) {
this.actor.addCondition('stunned');
}
this.script.scriptNotification(`${this.actor.name} failed the Intelligence Test and gained Stunned Condition!`);

View File

@ -0,0 +1,2 @@
let amount = this.effect.sourceActor.system.characteristics.fel.bonus;
args.actor.addCondition("blinded", amount);

View File

@ -0,0 +1,85 @@
let choice1 = [
{
type : "skill",
name : "Melee (Basic)",
diff : {
system : {
advances : {
value : 20
}
}
}
}
]
let choice2 = [
{
type : "skill",
name : "Melee (Two-Handed)",
diff : {
system : {
advances : {
value : 20
}
}
}
}
]
let choice = await new Promise((resolve, reject) => {
new Dialog({
title : "Choice",
content :
`<p>
Select your choice
</p>
<ol>
<li>Melee (Basic)</li>
<li>Melee (Two-Handed)</li>
</ol>
`,
buttons : {
1 : {
label : "Basic",
callback : () => {
resolve(choice1)
}
},
2 : {
label : "Two-Handed",
callback : () => {
resolve(choice2)
}
}
}
}).render(true)
})
let updateObj = this.actor.toObject();
let items = []
for (let c of choice)
{
let existing
if (c.type == "skill")
{
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type)
if (existing && c.diff?.system?.advances?.value)
{
existing.system.advances.value += c.diff.system.advances.value
}
}
if (!existing)
{
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item)
{
item = item.toObject()
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -1,90 +1,90 @@
let choice1 = [
{
type : "armour",
name: "Chausses de Mailles"
name : "Mail Chausses"
},
{
type : "armour",
name: "Cotte de Mailles"
name : "Mail Coat"
},
{
type : "armour",
name: "Coiffe de Mailles"
name : "Mail Coif"
},
]
let choice2 = [
{
type : "armour",
name: "Chausses de Mailles"
name : "Mail Chausses"
},
{
type : "armour",
name: "Cotte de Mailles"
name : "Mail Coat"
},
{
type : "armour",
name: "Coiffe de Mailles"
name : "Mail Coif"
},
{
type : "armour",
name: "Jambières de Cuir"
name : "Leather Leggings"
},
{
type : "armour",
name: "Calotte de Cuir"
name : "Leather Skullcap"
},
{
type : "armour",
name: "Veste de Cuir"
name : "Leather Jack"
},
]
let choice3 = [
{
type : "armour",
name: "Plastron d'acier"
name : "Plate Breastplate"
},
{
type : "armour",
name: "Brassards"
name : "Plate Bracers"
},
{
type : "armour",
name: "Heaume"
name : "Plate Helm"
},
{
type : "armour",
name: "Jambières d'acier"
name : "Plate Leggings"
},
]
let choice = await new Promise((resolve, reject) => {
new Dialog({
title: "Choix",
title : "Choice",
content :
`<p>
Selectionnez votre choix
Select your choice
</p>
<ol>
<li>Mailles</li>
<li>Mailles & Cuir</li>
<li>Plates</li>
<li>Mail</li>
<li>Mail & Leather</li>
<li>Plate</li>
</ol>
`,
buttons : {
1 : {
label: "Mailles",
label : "Mail",
callback : () => {
resolve(choice1)
}
},
2 : {
label: "Mailles & Cuir",
label : "Mail & Leather",
callback : () => {
resolve(choice2)
}
},
3 : {
label: "Plates",
label : "Plate",
callback : () => {
resolve(choice3)
}
@ -95,20 +95,29 @@ let choice = await new Promise((resolve, reject) => {
let updateObj = this.actor.toObject();
let items = []
for (let c of choice) {
for (let c of choice)
{
let existing
if (c.type == "skill") {
if (c.type == "skill")
{
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type)
if (existing && c.diff?.system?.advances?.value) {
if (existing && c.diff?.system?.advances?.value)
{
existing.system.advances.value += c.diff.system.advances.value
}
}
if (!existing) {
if (!existing)
{
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item) {
if (item)
{
let equip = item.system.tags.has("equippable");
item = item.toObject()
equip(item);
if (equip)
{
item.system.equipped.value = true;
}
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
@ -118,12 +127,3 @@ for (let c of choice) {
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item) {
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -0,0 +1,10 @@
const type = await ValueDialog.create({
title: game.i18n.localize("SCRIPT.FellstaveDialogTitle"),
text: game.i18n.localize("SCRIPT.FellstaveDialogText")
}, "");
await this.effect.item.update({name: `${this.effect.item.name} (${type})`});
const updates = this.effect.item.effects.map(e => {
return {_id: e.id, name: e.name + ` (${type})`}
});
this.effect.item.updateEmbeddedDocuments("ActiveEffect", updates);

143
scripts/UQtXuQmUlTyDKqhe.js Normal file
View File

@ -0,0 +1,143 @@
let characteristics = {
"ws" : 10,
"bs" : 20,
"s" : 0,
"t" : 10,
"i" : 15,
"ag" : 0,
"dex" : 0,
"int" : 40,
"wp" : 45,
"fel" : 10
}
let skills = ["Focalisation", "Calme", "Intimidate", "Langue (Magick)", "Langue (Nehekharan)", "Savoir (Magie)" , "Perception"]
let skillAdvancements = [10, 20, 15, 15, 10, 10, 10]
let talents = ["Magie des Arcanes", "Hardy", "Menaçant", "Magie Mineure", "Read/Write", "Seconde Vue"]
let trappings = ["Arme simple"]
let specialItems = [
{name: "Mouldering Robes", type: "trapping", trappingType: "clothingAccessories" },
{name: "Pouches containing ritual components", type: "trapping", trappingType: "clothingAccessories" },
{name: "Staff", type: "weapon", damage: "SB+2"},
{name: "Dark Magic (Necromancy)", type: "talent"},
]
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let item of specialItems) {
let newItem
if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
}
items.push(newItem.toObject())
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
let filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : "petty"
}
]
let petty = (await ItemDialog.createFromFilters(filters, 3, "Choisissez 3 Sorts de Magie Mineure")).map(i => i.toObject());
filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : ""
}
]
let arcane = (await ItemDialog.createFromFilters(filters, 2, "Choisissez 2 Sorts de Magie d'Arcane")).map(i => i.toObject());
filters = [
{
property : "type",
value : "spell"
},
{
property : "name",
value: /^((?!\().)*$/gm, // Remove all spells with parentheses (all arcane spells spells)
regex: true
},
{
property : "system.lore.value",
value : "necromancy"
}
]
let necromancy = (await ItemDialog.createFromFilters(filters, 1, "Choisissez 1 Necromancy Spell")).map(i => i.toObject());
arcane.forEach(i => {
i.img = "modules/wfrp4e-core/icons/spells/necromancy.png";
i.system.lore.value = "necromancy";
})
let spells = [...petty, ...necromancy, ...arcane];
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items.concat(spells));

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Finished repairing <em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpenter)';
const difficulty = 'challenging';
const target = 10;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Repair the ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,13 +37,13 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]

View File

@ -1,89 +1,89 @@
let choice1 = [
{
type : "armour",
name : "Chausses de Mailles"
name : "Mail Chausses"
},
{
type : "armour",
name : "Cotte de Mailles"
name : "Mail Coat"
},
{
type : "armour",
name : "Coiffe de Mailles"
name : "Mail Coif"
},
]
let choice2 = [
{
type : "armour",
name : "Chausses de Mailles"
name : "Mail Chausses"
},
{
type : "armour",
name : "Cotte de Mailles"
name : "Mail Coat"
},
{
type : "armour",
name : "Coiffe de Mailles"
name : "Mail Coif"
},
{
type : "armour",
name : "Jambières de Cuir"
name : "Leather Leggings"
},
{
type : "armour",
name : "Calotte de Cuir"
name : "Leather Skullcap"
},
{
type : "armour",
name : "Veste de Cuir"
name : "Leather Jack"
},
]
let choice3 = [
{
type : "armour",
name : "Plastron d'acier"
name : "Plate Breastplate"
},
{
type : "armour",
name : "Brassards"
name : "Plate Bracers"
},
{
type : "armour",
name : "Heaume"
name : "Plate Helm"
},
{
type : "armour",
name : "Jambières d'acier"
name : "Plate Leggings"
},
]
let choice = await Dialog.wait({
title : "Choix",
title : "Choice",
content :
`<p>
Sélectionnez votre choix
Select your choice
</p>
<ol>
<li>Mailles</li>
<li>Mailles & Cuir</li>
<li>Plates</li>
<li>Mail</li>
<li>Mail & Leather</li>
<li>Plate</li>
</ol>
`,
buttons : {
1 : {
label : "Mailles",
label : "Mail",
callback : () => {
return choice1
}
},
2 : {
label : "Mailles & Cuir",
label : "Mail & Leather",
callback : () => {
return choice2
}
},
3 : {
label : "Plates",
label : "Plate",
callback : () => {
return choice3
}
@ -110,8 +110,12 @@ for (let c of choice)
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item)
{
let equip = item.system.tags.has("equippable");
item = item.toObject()
equip(item);
if (equip)
{
item.system.equipped.value = true;
}
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
@ -121,13 +125,3 @@ for (let c of choice)
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -10,13 +10,13 @@ let characteristics = {
"wp" : 10,
"fel" : 10
}
let skills = ["Charme", "Focalisation", "Divertissement (Prophecie)", "Intuition"]
let skills = ["Charm", "Focalisation", "Entertain (Prophecy)", "Intuition"]
let skillAdvancements = [0, 0, 20, 10]
let talents = ["Détection dartefact", "Menaçant", "Sixième Sens"]
let traits = ["Destinée", "Lanceur de sorts (Domaine de la Vie)", "Protection"]
let talents = ["Detect Artefact", "Menaçant", "Sixième Sens"]
let traits = ["Dooming", "Spellcaster (Lore of Life)", "Ward"]
let trappings = []
let items = [];
let spells = ["Forêt d'épines"];
let spells = ["Forest of Thorns"];
let updateObj = this.actor.toObject();
@ -74,7 +74,7 @@ for (let trait of traits)
if (Number.isNumeric(traitVal))
{
traitItem.system.specification.value = traitName.includes('Arme','Cornes','Queue','Tentacules','Morsure') ? traitVal - parseInt(characteristicValues[3]/10) : traitVal;
traitItem.system.specification.value = traitName.includes('Weapon','Horns','Tail','Tentacles','Bite') ? traitVal - parseInt(characteristicValues[3]/10) : traitVal;
traitItem.name = (traitItem.name + ` ${traitSpec ? "("+ traitSpec + ")" : ""}`).trim()
}
else
@ -91,13 +91,13 @@ for (let trapping of trappings)
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Could not find ${trapping}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
@ -112,7 +112,7 @@ for (let spell of spells)
}
else
{
ui.notifications.warn(`Could not find ${spell}`, {permanent : true})
ui.notifications.warn(`Impossible de trouver ${spell}`, {permanent : true})
}
}
@ -120,14 +120,3 @@ updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.worn = true
else if (item.type == "weapon")
item.equipped = true
else if (item.type == "trapping" && item.trappingType?.value == "clothingAccessories")
item.worn = true
}

View File

@ -0,0 +1 @@
return args.skill?.name.includes(game.i18n.localize("NAME.Stealth"))

View File

@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Repair the ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,7 +37,7 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
@ -46,7 +45,7 @@ const extendedTestData = {
]
}
}
}
]
};

View File

@ -0,0 +1,7 @@
if (args.applyAP && args.modifiers.ap.metal)
{
args.modifiers.ap.ignored += args.modifiers.ap.metal
args.modifiers.other.push({value : args.modifiers.ap.metal, label : this.effect.name, details : "Add Metal AP to Damage" })
args.modifiers.ap.details.push("<strong>" + this.effect.name + "</strong>: Ignore Metal (" + args.modifiers.ap.metal + ")");
args.modifiers.ap.metal = 0
}

View File

@ -10,10 +10,10 @@
"wp" : 5,
"fel" : 5
}
let skills = ["Intuition", "Savoir (Local)", "Perception"]
let skills = ["Intuition", "Lore (Local)", "Perception"]
let skillAdvancements = [10, 10, 10]
let talents = []
let trappings = ["Cotte de Mailles", "Chausses de Mailles", "Coiffe de Mailles", "Arme simple"]
let trappings = ["Mail Coat", "Mail Chausses", "Mail Coif", "Arme simple"]
let items = []
let updateObj = this.actor.toObject();
@ -59,7 +59,7 @@
{
trappingItem = trappingItem.toObject()
equip(trappingItem)
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
@ -72,13 +72,3 @@
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Finished repairing <em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Tailor)';
const difficulty = 'difficult';
const target = 40;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Repair the ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,14 +37,14 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]
};

View File

@ -0,0 +1,12 @@
if (this.actor.system.details.experience.current < 100) {
return this.script.notification(game.i18n.localize("SCRIPT.NotEnoughXP"))
}
let item = await game.wfrp4e.utility.findItem("Sensory Sharing", "trait")
this.actor.createEmbeddedDocuments("Item", [item]);
let expLog = foundry.utils.duplicate(this.actor.details.experience.log || []);
expLog.push({amount : 100, reason: item.name, spent: this.actor.details.experience.spent + 100, total: this.actor.details.experience.total, type: "spent"});
this.actor.update({
"system.details.experience.spent": this.actor.details.experience.spent + 100,
"system.details.experience.log": expLog
});

View File

@ -0,0 +1,38 @@
let lore = await ValueDialog.create({text : "Choisissez un Domaine", title: "Savoir"}, "", {"fire" : "Feu", "death" : "Mort", "metal" : "Métal", "shadow" : "Ombres"});
let filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : "petty"
}
]
let petty = await ItemDialog.createFromFilters(filters, 6, "Choisissez 3 Sorts de Magie Mineure")
filters = [
{
property : "type",
value : "spell"
},
{
property : "system.lore.value",
value : [""]
}
]
let arcane = await ItemDialog.createFromFilters(filters, 12, "Choisissez 12 Sorts de Magie d'Arcane")
let items = petty.map(i => i.toObject()).concat(arcane.map(i => {
let spell = i.toObject();
spell.img = `modules/wfrp4e-core/icons/spells/${lore}.png`
spell.system.lore.value = lore;
return spell;
}));
this.actor.createEmbeddedDocuments("Item", items);

102
scripts/YN8719gme9AxYtyY.js Normal file
View File

@ -0,0 +1,102 @@
let characteristics = {
"ws" : 10,
"bs" : 0,
"s" : 5,
"t" : 15,
"i" : 20,
"ag" : 15,
"dex" : 20,
"int" : 35,
"wp" : 30,
"fel" : 10
}
let skills = ["Focalisation", "Calme", "Esquive", "Divertissement (Narration)", "Intuition", "Langue (Magick)", "Commandement" , "Savoir (Magie)" , "Savoir (Théologie)", "Perception"]
let skillAdvancements = [20, 25, 20, 25, 30, 25, 15, 20, 10, 30]
let talents = ["Harmonisation Aethyrique", "Diction Instinctive", "Diction Instinctive", "Chance", "Sens de la Magie", "Menaçant", "Magie des Arcanes", "Magie Mineure", "Seconde Vue", "Sixième Sens"]
let trappings = ["Arme simple", "Robes", "(2M) Bâton de combat"]
let specialItems = [
{name: "Objet magique", type: "trapping", trappingType: "misc" },
]
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let item of specialItems) {
let newItem
if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
}
items.push(newItem.toObject())
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
let ride = await Dialog.confirm({title : "Skill", content : "Add Chaos Steed and +20 Ride (Horse)?"})
if (ride)
{
let skill = await game.wfrp4e.utility.findSkill("Ride (Horse)")
skill = skill.toObject();
skill.system.advances.value = 20;
items = items.concat({name : "Chaos Steed", type: "trapping", "system.trappingType.value" : "misc"}, skill)
}
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -1,4 +1,4 @@
const repaired_message = `<p>Finished repairing <em>${this.item.name}</em>.</p>`;
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpentry)';
const difficulty = 'easy';
const target = 10;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Repair the ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,14 +37,14 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]
};

View File

@ -1,5 +1,5 @@
const repaired_message = `<p>Répération finie de <em>${this.item.name}</em>.</p>`;
const test = 'Métier (Charpentier)';
const repaired_message = `<p>Réparation finie <em>${this.item.name}</em>.</p>`;
const test = 'Trade (Carpentry)';
const difficulty = 'difficult';
const target = 30;
@ -24,11 +24,10 @@ const extendedTestData = {
},
effects: [
{
name: `Réparer le ${this.item.name}`,
icon: this.item.img,
flags: {
wfrp4e: {
applicationData: {
name: `Réparer ${this.item.name}`,
img: this.item.img,
system: {
transferData : {
type: "document",
documentType: "Item"
},
@ -38,14 +37,14 @@ const extendedTestData = {
script: `
let id = this.item.flags.wfrp4e.fromEffect;
let effect = this.actor.appliedEffects.find(e => e.id === id);
this.script.scriptMessage("${repaired_message}");
this.script.message("${repaired_message}");
await effect.item.delete();
`,
trigger: "deleteEffect"
}
]
}
}
}
]
};

View File

@ -0,0 +1 @@
return args.skill?.name !== game.i18n.localize("NAME.Charm");

View File

@ -0,0 +1,85 @@
let characteristics = {
"ws" : 10,
"bs" : 0,
"s" : 5,
"t" : 5,
"i" : 10,
"ag" : 0,
"dex" : 0,
"int" : 0,
"wp" : 0,
"fel" : 0
}
let skills = ["Calme", "Equive", "Langue (Bataile)"]
let skillAdvancements = [10, 10, 10]
let talents = ["Combat Instinctif", "Déterminé"]
let trappings = ["Plastron d'acier", "Brassards", "Heaume", "Jambières d'acier"]
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
let weapons = await warhammer.utility.findAllItems("weapon", "Chargement des armes");
items = items.concat((await game.wfrp4e.apps.ItemDialog.create([await fromUuid("Compendium.wfrp4e-core.items.Item.1zaqojk0Oq1m8vYv"), await fromUuid("Compendium.wfrp4e-core.items.Item.bBX8MP6QfcyU6Fy3")], 1, "Choisissez a Weapon")) || [])
let choices = weapons.filter(i => i.system.properties.qualities.shield || i.system.weaponGroup.value == "polearm" || i.system.weaponGroup.value == "twohanded");
items = items.concat(await game.wfrp4e.apps.ItemDialog.create(choices, 1, "Choisissez un bouclier ou une Arme d'Hast ou une Arme à deux-mains"));
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);

View File

@ -0,0 +1 @@
return args.characteristic === 'fel';

View File

@ -0,0 +1,90 @@
let characteristics = {
"ws" : 30,
"bs" : 20,
"s" : 20,
"t" : 25,
"i" : 20,
"ag" : 0,
"dex" : 0,
"int" : 30,
"wp" : 40,
"fel" : 30
}
let skills = ["Intimidate", "Langue (Classical)", "Commandement" , "Lore (Warfare)", "Lore (History)", "Perception"]
let skillAdvancements = [20, 30, 20, 30, 20, 20]
let talents = ["Combat Aware", "Combat Reflexes", "Drilled", "Menaçant", "Robust", "Strike Mighty Blow", "Strike Mighty Blow", "War Leader"]
let trappings = ["Arme simple", "Plate Breastplate", "Plate Helm", "Plate Leggings"]
let specialItems = [
]
let items = [];
let updateObj = this.actor.toObject();
for (let ch in characteristics)
{
updateObj.system.characteristics[ch].modifier += characteristics[ch];
}
for (let item of specialItems) {
let newItem
if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
}
items.push(newItem.toObject())
}
for (let index = 0; index < skills.length; index++)
{
let skill = skills[index]
let skillItem;
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem)
skillItem.system.advances.value += skillAdvancements[index]
else
{
skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject();
skillItem.system.advances.value = skillAdvancements[index];
items.push(skillItem);
}
}
for (let talent of talents)
{
let talentItem = await game.wfrp4e.utility.findTalent(talent)
if (talentItem)
{
items.push(talentItem.toObject());
}
else
{
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
}
}
for (let trapping of trappings)
{
let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem)
{
trappingItem = trappingItem.toObject()
trappingItem.system.equipped.value = true;
items.push(trappingItem);
}
else
{
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true})
}
}
updateObj.name = updateObj.name += " " + this.effect.name
await this.actor.update(updateObj)
console.log(">>>>>>><", items)
this.actor.createEmbeddedDocuments("Item", items);

Some files were not shown because too many files have changed in this diff Show More