Skip to content

Commit

Permalink
Merge pull request #67 from CarterDC/daily
Browse files Browse the repository at this point in the history
Daily Update
  • Loading branch information
CarterDC authored Oct 21, 2021
2 parents fdd52fe + d4695ae commit 30683f1
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 21 deletions.
Binary file modified README.md
Binary file not shown.
1 change: 1 addition & 0 deletions assets/icons/kevlar-vest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/prime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 14 additions & 9 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ITEM.TypeAbility": "Ability",
"ITEM.TypeActiveeffect": "Active Effect",
"ITEM.TypeActiveeffectAlt": "Active<br>Effect",
"ITEM.TypeArmor": "Armor",
"ITEM.TypeBackground": "Background",
"ITEM.TypeContact": "Contact",
"ITEM.TypeEvent": "Chronicle Event",
Expand Down Expand Up @@ -41,7 +42,7 @@
"demeanor": "Demeanor",
"awakeningAge": "Awakening<br>age",
"birthday": "Birthday",
"cabale": "Cabala",
"cabale": "Cabal",
"essence": "Essence",
"faction": "Faction",
"gender": "Gender",
Expand All @@ -68,6 +69,7 @@
},
"category": {
"abilities": "Ability",
"armors": "Armors",
"aeffects": "Active Effect",
"attributes": "Attribute",
"backgrounds": "Background",
Expand All @@ -87,7 +89,7 @@
"addXP": "Add some XP.",
"castEffect": "Cast Effect.",
"editAliases" : "Edit list of Aliases.",
"editHealthMalus": "Edit Health Maluses.",
"editHealthMalus": "Edit Health Penalty.",
"editHealthMax": "Edit Max Health.",
"editParadigm": "Edit Paradigm.",
"editTrait": "Edit this Trait.",
Expand Down Expand Up @@ -299,7 +301,7 @@
"book": "MTA-20e.",
"page": "p 279",
"title": "Skills",
"content": "<p>Skills are the result of rigorous training, diligent practice, and the application of proven techniques.</p><p>🛈 'Untrained' Skill rolls usually have Difficulty malus of 1.</p>",
"content": "<p>Skills are the result of rigorous training, diligent practice, and the application of proven techniques.</p><p>🛈 'Untrained' Skill rolls usually have Difficulty penalty of 1.</p>",
"levels": {
"level0": {
"bullets": "🞫",
Expand Down Expand Up @@ -430,7 +432,7 @@
"switch": "Switch",
"systemDescription": "Should be edited in HTML mode in order to see the tags",
"systemName": "Used as a reference, only editable by a GM",
"difficulty": "Bonuses and maluses shouldn't exceed -3/+3, otherwise one should adjust the success threshold",
"difficulty": "Bonuses and Penalties shouldn't exceed -3/+3, otherwise one should adjust the success threshold",
"difficultyCue": {
"coincidental": "Coincidental effect",
"vulgar": "Vulgar effect",
Expand Down Expand Up @@ -461,6 +463,7 @@
}
},
"labels": {
"absorbtion": "Absorption",
"aeDisabled": "Disabled",
"aeEnabled": "Enabled",
"carriedStuff": "Carried Stuff",
Expand All @@ -474,6 +477,7 @@
"damage": "Damage",
"date": "Date",
"descSuffix": "Description suffix",
"dextPenalty": "Dexterity Penalty",
"dicePool": "Dice Pool",
"dicePoolMod": "Pool modifier",
"diff": "Diff.",
Expand Down Expand Up @@ -618,6 +622,7 @@
"packNotFound": "Compendium '{packName}' wasn't found!",
"restrictedItem": "{actorName} cannot use {itemType}-type Items!",
"statLocked": "You cannot change Traits for this throw!",
"unequipped": "This item is not equipped",
"unrollableRote": "{actorName} doesn't have the necessary sphere level in order to throw {itemName} !"
},
"placeholders": {
Expand Down Expand Up @@ -752,9 +757,9 @@
"SETTINGS.specialtyRule": "Specialty Throws.",
"SETTINGS.specialtyRuleHint": "Rolling a 10 grants an extra success when throwing a Specialty.",
"SETTINGS.untrainedMalus": "Untrained abilities Penalty.",
"SETTINGS.untrainedMalusHint": "Malus to the Difficulty : First digit for Talents, second for Skills and last one for Knowledges. ('X' indicates an unfeasible throw)",
"SETTINGS.useHealthMalus": "Health Malus to the Dice Pool.",
"SETTINGS.useHealthMalusHint": "Automatically applies the health malus tothe Dice Pool (see : editable list of health maluses in context menu).",
"SETTINGS.useHealthMalusForMagic": "Health Malus to Magick.",
"SETTINGS.useHealthMalusForMagicHint": "Also applies the health malus to the dice pool when throwing magick effects."
"SETTINGS.untrainedMalusHint": "Penalty to the Difficulty : First digit for Talents, second for Skills and last one for Knowledges. ('X' indicates an unfeasible throw)",
"SETTINGS.useHealthMalus": "Health Penalty to the Dice Pool.",
"SETTINGS.useHealthMalusHint": "Automatically applies the health penalty to the Dice Pool (see : editable list of health penalty in context menu).",
"SETTINGS.useHealthMalusForMagic": "Health Penalty to Magick.",
"SETTINGS.useHealthMalusForMagicHint": "Also applies the health penalty to the dice pool when throwing magick effects."
}
5 changes: 5 additions & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ITEM.TypeAbility": "Capacité",
"ITEM.TypeActiveeffect": "Active Effect",
"ITEM.TypeActiveeffectAlt": "Active<br>Effect",
"ITEM.TypeArmor": "Armure",
"ITEM.TypeBackground": "Historique",
"ITEM.TypeContact": "Contact",
"ITEM.TypeEvent": "Évènement de Chronique",
Expand Down Expand Up @@ -67,6 +68,7 @@
},
"category": {
"abilities": "Capacité",
"armors": "Armures",
"aeffects": "Active Effect",
"attributes": "Attribut",
"backgrounds": "Historique",
Expand Down Expand Up @@ -460,6 +462,7 @@
}
},
"labels": {
"absorbtion": "Absorption",
"aeDisabled": "Désactivé",
"aeEnabled": "Actif",
"carriedStuff": "Équipement porté",
Expand All @@ -473,6 +476,7 @@
"damage": "Dégâts",
"date": "Date",
"descSuffix": "Suffixe de description",
"dextPenalty": "Malus à la Dext",
"dicePool": "Grpt. de Dés",
"dicePoolMod": "Modificateur au Grpt.",
"diff": "Diff.",
Expand Down Expand Up @@ -617,6 +621,7 @@
"packNotFound": "Le compendium '{packName}' n'est pas trouvable !",
"restrictedItem": "{actorName} ne peut as utiliser les items de type {itemType} !",
"statLocked": "Vous ne pouvez pas changer les Traits de ce jet !",
"unequipped": "Cet item n'est pas équipé",
"unrollableRote": "{actorName} n'a pas le(s) niveau(x) de sphère nécessaire(s) pour lancer la routine {itemName} !"
},
"placeholders": {
Expand Down
3 changes: 2 additions & 1 deletion m20e.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Hooks.once('init', async function () {
game.m20e = { //store some things here for later access
config: M20E,
mageMacro: DiceThrower.fromMacro,
sysDesc: utils.getSystemDescription,
socketCallbacks: {
sacrificeWillpower: (messageId) => chat.sacrificeWillpower(messageId)
}
Expand Down Expand Up @@ -88,7 +89,7 @@ Hooks.once('init', async function () {
//Item Sheets overrides
Items.unregisterSheet('core', ItemSheet);
Items.registerSheet('m20e', M20eItemSheet, {
types: ["ability", "background", "meritflaw", "event", "misc", "contact"], //todo , add all the other base item types
types: ["ability", "background", "meritflaw", "event", "misc", "contact", "armor"],
makeDefault: true
});
Items.registerSheet("m20e", M20eParadigmSheet, {
Expand Down
2 changes: 1 addition & 1 deletion module/apps/paradox-dlg.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class ParadoxDialog extends Application {
this.data.magickType = MAGICK_TYPE_COINCIDENTAL;
this.data.termResult = this.data.termTotal === 0 ? 'fail' :
(this.data.termTotal > 0 ? 'succ' :
(this.roll.options.data.throwMode & M20E.THROWMODE.RESULT_CRITICAL ? 'crit' : 'fail'));
(this.roll.isCritFailure() ? 'crit' : 'fail'));
this.calculateParadoxGain();
}

Expand Down
38 changes: 37 additions & 1 deletion module/apps/sheets/m20e-item-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ export default class M20eItemSheet extends ItemSheet {
this._protectElements(html);
}
}

//actions for everyone

//editable only (roughly equals 'isOwner')
if ( this.options.editable ) {
html.find('.mini-button').click(this._onMiniButtonClick.bind(this));
html.find('#dextPenalty').change(this._onDextPenaltyChange.bind(this));
html.find('select.inline-edit').change(this._onSubtypeChange.bind(this));
}
if ( game.user.isGM ) {
Expand Down Expand Up @@ -224,4 +224,40 @@ export default class M20eItemSheet extends ItemSheet {
updateObj['data.subType'] = newSubType;
return this.item.update(updateObj);
}

async _onDextPenaltyChange(event) {
const inputElem = event.currentTarget;
if ( ! utils.isValidUpdate(inputElem) ) {
event.preventDefault();
return this.render();
}
const newPenaltyValue = parseInt(inputElem.value);

const effectId = Array.from(this.item.effects.keys())[0];
if ( newPenaltyValue ) {
let armorEffect;
if ( effectId ) {
//already an effet => update it
armorEffect = this.item.effects.get(effectId);
const changes = duplicate(armorEffect.data.changes);
changes[0].value = -1 * newPenaltyValue;
return await armorEffect.update({'changes': changes});
} else {
const effectData = {
label: game.i18n.format('M20E.effectName', {name: this.item.data.name}),
icon: CONFIG.M20E.defaultImg['ActiveEffect'],
origin: 'added-manually',
tint: '#000000',
changes: [{
key: "stats.attributes.dext.value",
mode: CONST.ACTIVE_EFFECT_MODES.ADD,
value: -1 * newPenaltyValue
}]
};
this.item.createEmbeddedDocuments('ActiveEffect', [effectData]);
}
} else {
this.item.deleteEmbeddedDocuments('ActiveEffect', [effectId]);
}
}
}
2 changes: 2 additions & 0 deletions module/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const M20E = {
},
defaultImg: {
ability: "systems/mage-fr/assets/icons/auto-repair.svg",
armor: "systems/mage-fr/assets/icons/kevlar-vest.svg",
paradigm: "systems/mage-fr/assets/icons/abstract-013.svg",
merit: "icons/svg/upgrade.svg",
flaw: "icons/svg/downgrade.svg",
Expand Down Expand Up @@ -195,6 +196,7 @@ export const M20E = {
},
traitToCat: {
ability: "abilities",
armor: "armors",
background: "backgrounds",
contact: "contacts",
talent: "talents",
Expand Down
6 changes: 5 additions & 1 deletion module/dice-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ export class M20eRoll extends Roll {
this.options?.data.throwMode & CONFIG.M20E.THROWMODE.RESULT_CRITICAL : true;

//determine if crit failure based on diceTotal and not roll total !
return isCritAble && diceTotal < 0;
return isCritAble && diceTotal < 0 && !this.hasAnySuccess;
}

get hasAnySuccess() {
return this.dice.some( die => (die.results.some( result => result.success )));
}

/**
Expand Down
41 changes: 35 additions & 6 deletions module/documents/m20e-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,43 @@ export default class M20eItem extends Item {
/** @override */
prepareData() {
super.prepareData();
this.data.data.path = this.getPath();
const itemData = this.data;

itemData.data.path = this.getPath();

//check if item type is amongst protected types
const protectedTypes = CONFIG.M20E.protectedCategories.reduce((acc, cur) => {
const itemType = CONFIG.M20E.categoryToType[cur]
return itemType ? [...acc, itemType] : acc;
}, []);
this.data.isProtectedType = protectedTypes.includes(this.type);
itemData.isProtectedType = protectedTypes.includes(itemData.type);
//create restricted array from string
if ( this.data.data.restrictions ) {
this.data.data.restricted = this.data.data.restrictions.split(',').map( entry => entry.trim());
if ( itemData.data.restrictions ) {
itemData.data.restricted = itemData.data.restrictions.split(',').map(entry => entry.trim());
}

//deal with armor types
if ( itemData.type === 'armor' ) {
//check for effect
const armorEffect = this.effects.get(Array.from(this.effects.keys())[0]);
if ( armorEffect ) {
itemData.data.dextPenalty = -1* armorEffect.data.changes[0].value;
} else {
itemData.data.dextPenalty = 0;
}
}

}

/* -------------------------------------------- */

//get that's displayed on the actorsheet
getMiniFlavor() {
const itemData = this.data;
let miniFlavor = '';
if ( itemData.type === 'armor' ) {//todo maybe make armor types their own class ?
miniFlavor = `${game.i18n.localize("M20E.labels.absorbtion")} : ${itemData.data.value}D`;
return miniFlavor;
}
}

Expand Down Expand Up @@ -184,6 +211,7 @@ export default class M20eItem extends Item {
*/
getExtendedTraitData(path) {
const itemData = this.data;
if ( this.isUnequipped ) { throw {msg: 'unequipped'}}
return {
name: itemData.name,
displayName: itemData.data.displayName ?? null,
Expand All @@ -210,7 +238,8 @@ export default class M20eItem extends Item {
* Implemented in subClasses
*/
_prepareOwnedItem() {
//to be overridden
//to be overridde
this.data.data.miniFlavor = this.getMiniFlavor();
}

/* -------------------------------------------- */
Expand All @@ -224,7 +253,7 @@ export default class M20eItem extends Item {
linkInChat() {
const itemData = this.data;

if ( !this.isStat ) {
if (!this.isStat) {
ui.notifications.warn(game.i18n.localize('M20E.notifications.notImplemented'));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"discord": "Carter_DC#1097"
}
],
"version": "0.22.62",
"version": "0.23.63",
"templateVersion": "1",
"minimumCoreVersion": "0.8.3",
"compatibleCoreVersion": "0.8.9",
Expand Down
10 changes: 10 additions & 0 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@
"Item": {
"types": [
"ability",
"armor",
"background",
"contact",
"event",
Expand Down Expand Up @@ -434,6 +435,15 @@
"displayDescription":"",
"extra": ""
},
"armor": {
"templates":[
"stat",
"restrictions",
"active",
"equipable"
],
"displayDescription":""
},
"background":{
"templates":[
"stat",
Expand Down
8 changes: 7 additions & 1 deletion templates/actor/parts/gear-cat.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p>⚠ Under Heavy Construction ⚠</p>
<div class="grid one-col">
{{#each items.equipables as |equipable key|}}
<div class="trait equipable item" data-item-id="{{equipable._id}}" data-rollable="{{equipable.data.isRollable}}">
<div class="trait equipable item" data-path="{{equipable.data.path}}" data-item-id="{{equipable._id}}" data-rollable="{{equipable.data.isRollable}}" data-highlighted= "{{equipable.data.isHighlighted}}">
<div class="item-img"
style="background-image: url({{equipable.img}}), radial-gradient(rgba(130,81,20,0.4), rgba(0,0,0,0));">
{{#if equipable.data.hasThrows}}
Expand All @@ -14,9 +14,15 @@
</div>
<div class="vertical-wrapper" data-rollable="{{equipable.data.isRollable}}">
<div class="horizontal-wrapper">
{{#if equipable.data.isStat}}
<a class="stat-label" data-item-id="{{equipable._id}}">
{{equipable.name}}
</a>
{{else}}
<label class="trait-label" data-item-id="{{equipable._id}}">
{{equipable.name}}
</label>
{{/if}}
<div class="ligne"></div>
<div class="edit-bar" data-locked="{{../locks.equipables}}">
<a class="mini-button" data-action="edit"><i class="fas fa-pencil-alt"></i></a>
Expand Down
Loading

0 comments on commit 30683f1

Please sign in to comment.