Skip to content

Commit

Permalink
Merge pull request #57 from Savantford/dev-branch
Browse files Browse the repository at this point in the history
0.10: Item Effects & Armor
  • Loading branch information
Savantford committed Aug 22, 2023
2 parents c50fbde + 82e84d3 commit 94a6bcd
Show file tree
Hide file tree
Showing 50 changed files with 438 additions and 292 deletions.
Binary file modified assets/ui/sotww-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 20 additions & 10 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"WW.Agility": "Agility",
"WW.Intellect": "Intellect",
"WW.Will": "Will",
"WW.StrengthScore": "Strength Score",
"WW.AgilityScore": "Agility Score",
"WW.IntellectScore": "Intellect Score",
"WW.WillScore": "Will Score",
"WW.Luck": "Luck",

"WW.Dont": "Don't Roll",

"WW.Stats": "Stats",
Expand All @@ -21,6 +26,7 @@
"WW.ImmunePH": "poisoned",
"WW.Size": "Size",
"WW.Speed": "Speed",
"WW.SpeedScore": "Speed Score",
"WW.SpeedPH": "fly",
"WW.SpeedTip": "special form of movement",
"WW.Damage": {
Expand All @@ -36,6 +42,7 @@

"WW.Health": {
"Title": "Health",
"Score": "Health Score",
"Total": "Health Total",
"Starting": "Starting Health",
"Per": "Health gained per each",
Expand All @@ -47,10 +54,20 @@
},
"WW.LevelAt": "At Level",

"WW.Defense": "Defense",
"WW.Defense": {
"Title": "Defense",
"Score": "Defense Score",
"Total": "Defense Total",
"Natural": "Natural Defense",
"Details": "(armor, if any, shield, if any)"
},

"WW.Armor": {
"Details": "Armor Details",
"Title": "Armor",
"Type": "Armor Type",
"Light": "Light",
"Medium": "Medium",
"Heavy": "Heavy",
"Unarmored": "Unarmored",
"Padded": "Padded Armor",
"Leather": "Leather Armor",
Expand All @@ -62,14 +79,7 @@
"Plate": "Plate Armor",
"FullPlate": "Full Plate Armor"
},
"WW.Light": "Light",
"WW.Medium": "Medium",
"WW.Heavy": "Heavy",
"WW.DefenseTotal": "Defense Total",
"WW.DefenseNatural": "Natural Defense",
"WW.DefenseDetails": "(armor, if any, shield, if any)",
"WW.DefenseBonus": "Natural Defense Bonus",
"WW.ModName": "Modifier Name",

"WW.Value": "Value",
"WW.New": "New",
"WW.Remove": "Remove",
Expand Down
26 changes: 13 additions & 13 deletions module/active-effects/afflictions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export class WWAfflictions {
const effectsDataList = [];

const baneAllAttributes = function(v) { return [
addEffect('system.attributes.str.boons.global', v, effectPriority),
addEffect('system.attributes.agi.boons.global', v, effectPriority),
addEffect('system.attributes.int.boons.global', v, effectPriority),
addEffect('system.attributes.wil.boons.global', v, effectPriority)
addEffect('system.boons.attributes.str.global', v, effectPriority),
addEffect('system.boons.attributes.agi.global', v, effectPriority),
addEffect('system.boons.attributes.int.global', v, effectPriority),
addEffect('system.boons.attributes.wil.global', v, effectPriority)
];}


Expand All @@ -87,8 +87,8 @@ export class WWAfflictions {
'Confused',
'icons/svg/stoned.svg',
[
addEffect('system.attributes.int.boons.global', -1, effectPriority),
addEffect('system.attributes.wil.boons.global', -1, effectPriority)
addEffect('system.boons.attributes.int.global', -1, effectPriority),
addEffect('system.boons.attributes.wil.global', -1, effectPriority)
// Cannot use reactions
]
));
Expand All @@ -104,7 +104,7 @@ export class WWAfflictions {
effectsDataList.push(_buildBaseAffliction(
'Cursed',
'icons/svg/ruins.svg',
[addEffect('system.attributes.luck.boons.global', -1, effectPriority)]
[addEffect('system.boons.attributes.luck.global', -1, effectPriority)]
));

// Deafened
Expand Down Expand Up @@ -132,7 +132,7 @@ export class WWAfflictions {
_buildBaseAffliction(
'ImpairedStr',
'icons/svg/bones.svg',
[addEffect('system.attributes.str.boons.global', -1, effectPriority)]
[addEffect('system.boons.attributes.str.global', -1, effectPriority)]
),
);

Expand All @@ -141,7 +141,7 @@ export class WWAfflictions {
_buildBaseAffliction(
'ImpairedAgi',
'icons/svg/anchor.svg',
[addEffect('system.attributes.agi.boons.global', -1, effectPriority)]
[addEffect('system.boons.attributes.agi.global', -1, effectPriority)]
),
);

Expand All @@ -150,7 +150,7 @@ export class WWAfflictions {
_buildBaseAffliction(
'ImpairedInt',
'icons/svg/light-off.svg',
[addEffect('system.attributes.int.boons.global', -1, effectPriority)]
[addEffect('system.boons.attributes.int.global', -1, effectPriority)]
),
);

Expand All @@ -159,7 +159,7 @@ export class WWAfflictions {
_buildBaseAffliction(
'ImpairedWil',
'icons/svg/invisible.svg',
[addEffect('system.attributes.wil.boons.global', -1, effectPriority)]
[addEffect('system.boons.attributes.wil.global', -1, effectPriority)]
),
);

Expand Down Expand Up @@ -249,8 +249,8 @@ export class WWAfflictions {
'Weakened',
'icons/svg/downgrade.svg',
[
addEffect('system.attributes.str.boons.global', -1, effectPriority),
addEffect('system.attributes.agi.boons.global', -1, effectPriority),
addEffect('system.boons.attributes.str.global', -1, effectPriority),
addEffect('system.boons.attributes.agi.global', -1, effectPriority),
multiplyEffect('system.stats.speed.value', 0.5, effectPriority)
]
));
Expand Down
136 changes: 136 additions & 0 deletions module/active-effects/effects-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { i18n } from '../helpers/utils.mjs'

export class WWActiveEffectConfig extends ActiveEffectConfig {

/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ['sheet', 'active-effect-sheet'],
template: 'systems/weirdwizard/templates/effects-config.hbs',
width: 580,
height: 'auto',
tabs: [{ navSelector: '.tabs', contentSelector: 'form', initial: 'details' }],
})
}

/** @override */
async getData(options={}) {

let context = await super.getData(options);

const legacyTransfer = CONFIG.ActiveEffect.legacyTransferral;

const labels = {
transfer: {
name: game.i18n.localize(`EFFECT.Transfer${legacyTransfer ? "Legacy" : ""}`),
hint: game.i18n.localize(`EFFECT.TransferHint${legacyTransfer ? "Legacy" : ""}`)
}
};

const data = {
labels,
effect: this.object, // Backwards compatibility
data: this.object,
isActorEffect: this.object.parent.documentName === "Actor",
isItemEffect: this.object.parent.documentName === "Item",
submitText: "EFFECT.Submit",
modes: Object.entries(CONST.ACTIVE_EFFECT_MODES).reduce((obj, e) => {
obj[e[1]] = game.i18n.localize(`EFFECT.MODE_${e[0]}`);
return obj;
}, {})

};

context = foundry.utils.mergeObject(context, data);

context.descriptionHTML = await TextEditor.enrichHTML(this.object.description, {async: true, secrets: this.object.isOwner});
context.availableChangeKeys = await WWActiveEffectConfig._availableChangeKeys;

return context;
}

activateListeners(html) {
super.activateListeners(html)
// Change the duration in rounds based on seconds and vice-versa
// const inputSeconds = html.find('input[name="duration.seconds"]')
// const inputRounds = html.find('input[name="duration.rounds"]')
// inputSeconds.change(_ => inputRounds.val(Math.floor(inputSeconds.val() / 10)))
// inputRounds.change(_ => inputSeconds.val(inputRounds.val() * 10))
}

static initializeChangeKeys() {
WWActiveEffectConfig._availableChangeKeys = {
// <key> : <name>
// No change
'': '-',

// Boons and Banes
'system.boons.attributes.str.global': i18n('WW.Strength') + ': ' + i18n('WW.Boons.Or'),
'system.boons.attributes.agi.global': i18n('WW.Agility') + ': ' + i18n('WW.Boons.Or'),
'system.boons.attributes.int.global': i18n('WW.Intellect') + ': ' + i18n('WW.Boons.Or'),
'system.boons.attributes.wil.global': i18n('WW.Will') + ': ' + i18n('WW.Boons.Or'),
'system.boons.attributes.luck.global': i18n('WW.Luck') + ': ' + i18n('WW.Boons.Or'),
'system.boons.attacks.global': i18n('WW.Attacks') + ': ' + i18n('WW.Boons.Or'),

// Defense
'system.stats.defense.total': i18n('WW.Defense.Score'),
'system.stats.defense.natural': i18n('WW.Defense.Natural'),
/*'stats.defense.armor': i18n('WW.'),
'system.stats.defense.bonuses': i18n('WW.Defense.Bonus'),*/

// Health
'system.stats.health.total': i18n('WW.Health.Score'),
/*'stats.health.starting': i18n('WW.'),
'stats.health.novice': i18n('WW.'),
'stats.health.expert': i18n('WW.'),
'stats.health.master': i18n('WW.'),
'stats.health.bonus': i18n('WW.'),
'stats.health.lost': i18n('WW.'),*/

// Damage
/*'stats.damage.value': i18n('WW.Damage'),
'stats.damage.max': i18n('WW.'),*/

// Stats
/*'stats.level': i18n('WW.'),
'stats.size': i18n('WW.'),*/
'system.stats.speed.value': i18n('WW.SpeedScore'),
/*'stats.speed.special': i18n('WW.'),
'stats.bonusdamage': i18n('WW.'),*/

// Attributes
'system.attributes.str.value': i18n('WW.StrengthScore'),
'system.attributes.agi.value': i18n('WW.AgilityScore'),
'system.attributes.int.value': i18n('WW.IntellectScore'),
'system.attributes.wil.value': i18n('WW.WillScore'),

// Details
/*'details.type': i18n('WW.'),
'details.senses': i18n('WW.'),
'details.languages': i18n('WW.'),
'details.immune': i18n('WW.'),
'details.ancestry': i18n('WW.'),
'details.novice': i18n('WW.'),
'details.expert': i18n('WW.'),
'details.master': i18n('WW.'),
'details.features.value': i18n('WW.'),
'details.personality.value': i18n('WW.'),
'details.belief.value': i18n('WW.'),
'details.professions': i18n('WW.'),
'details.information.value': i18n('WW.'),
'details.bg_ancestry.value': i18n('WW.'),
'details.deeds.value': i18n('WW.'),
'details.reputation': i18n('WW.'),
'details.traditions': i18n('WW.'),
'description.value': i18n('WW.'),*/

// Currency
/*'currency.gp': i18n('WW.'),
'currency.sp': i18n('WW.'),
'currency.cp': i18n('WW.'*/
}

// Save the keys-labels object in the CONFIG constant
CONFIG.WW.effectChangeKeys = WWActiveEffectConfig._availableChangeKeys;
}
}
1 change: 0 additions & 1 deletion module/active-effects/effects.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export function prepareActiveEffectCategories(effects, showCreateButtons = false
e.dlRemaining = e.duration.label
}*/


if (e.disabled) categories.inactive.effects.push(e)
else if (e.isTemporary) categories.temporary.effects.push(e)
else categories.passive.effects.push(e)
Expand Down
8 changes: 5 additions & 3 deletions module/config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//import { i18n } from './helpers/utils.mjs';

export const WW = {}

// Define Constants
Expand Down Expand Up @@ -103,9 +105,9 @@ WW.dropdownGrip = {
};

WW.armorTypes = {
"light": "WW.Light",
"medium": "WW.Medium",
"heavy": "WW.Heavy"
"light": "WW.Armor.Light",
"medium": "WW.Armor.Medium",
"heavy": "WW.Armor.Heavy"
}

WW.armor = {
Expand Down
Loading

0 comments on commit 94a6bcd

Please sign in to comment.