Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
orome70 committed Feb 16, 2021
2 parents ba5a851 + 39a741a commit f2436cb
Show file tree
Hide file tree
Showing 32 changed files with 1,582 additions and 799 deletions.
25 changes: 19 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,32 @@ Foundry. THIS SYSTEM IS A WORK IN PROGRESS. While the system is fully playable i
state, we are stil lroning out some bugs and inconveniences, and multiple additional features
are planned for the near future.

For manual installation, use the provided manifest URL in the "*Install System*" popup window while managing game systems.
For manual installation, use the provided manifest URL in the "*Install System*" popup window
while managing game systems.

NOTES FOR v. 0.91.0
We have added support for active effects! These effects are available for each Storm Knight
and for any items attached to Storm Knights. Active effects allow you to modify the base
statistics for Storm Knights. They are most useful for adding armor and defenses, but
can also be used to modify skill values, attributes, and other related statistics. To apply
an active effect from an item (such as a piece of armor), create or edit the armor from
the items tab and add a passive effect that mirrors the abilities of the item. Then, drag
and drop it onto the chracter sheet (note that Foundry does not currently support editing
active effects within items once they are attached to a character, but you can still edit
the effect on the character's "Effects" tab). For a list of Storm Knight statistics
that can be modified, see https://github.com/gmmatt/torgeternity/wiki/Storm-Knight-Data-Elements.


## License

Copyright (c) 2020 Matt Ritchie
Copyright (c) 2021 Matt Ritchie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
in the Software without restriction for any non-commercial purpose,
including without limitation the rights to use, copy, modify, or merge,the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The copyright claim above extents only to original content and original
components of this software. No copyright claims are made with respect to
Expand Down
21 changes: 16 additions & 5 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"dn": "DN",
"range": "Range",
"duration": "Duration",
"damage": "Damage (if any)",
"damage": "Damage",
"description": "Description",
"good": "Good Result",
"outstanding": "Outstanding Result"
Expand All @@ -153,7 +153,7 @@
"nileEmpire": "Nile Empire",
"aysle": "Aysle",
"cyberpapacy": "Cyberpapacy",
"tharkhold": "Tharkold",
"tharkold": "Tharkold",
"panPacifica": "Pan Pacifica",
"orrorsh": "Orrorsh"
},
Expand Down Expand Up @@ -184,6 +184,7 @@
"perks": "Perks",
"gear": "Gear",
"powers": "Powers",
"effects": "Effects",
"background": "Background",
"enhancements": "Enhancements",
"generalGear": "General Gear",
Expand Down Expand Up @@ -240,7 +241,9 @@
"enhancement": "Enhancement",
"details": "Details",
"goodResult": "Good Result",
"outstandingResult": "Outstanding Result"
"outstandingResult": "Outstanding Result",
"effectCreate": "Create Effect",
"add": "Add"

},
"itemSheetDescriptions": {
Expand All @@ -259,7 +262,8 @@
"spell": "Spell",
"miracle": "Miracle",
"psionicpower": "Psionic Power",
"specialability": "Special Ability"
"specialability": "Special Ability",
"other": "General Gear"
},
"attackTypes": {
"unarmedCombat": "Unarmed Combat",
Expand Down Expand Up @@ -294,7 +298,9 @@
"human": "Human",
"dwarf": "Dwarf",
"edeinos": "Edeinos",
"elf": "Elf"
"elf": "Elf",
"aspirants": "Aspirants",
"theRace": "The Race"
},
"stymiedStates": {
"none": "Not Stymied",
Expand All @@ -316,6 +322,11 @@
"disconnected": "Disconnected",
"malfunction": "Malfunction",
"restrained": "Restrained"
},

"yesNo": {
"true": "Yes",
"false": "No"
}
}
}
18 changes: 12 additions & 6 deletions module/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function onPossibility(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

//Roll for Possibility
Expand Down Expand Up @@ -72,7 +73,8 @@ function onUp(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

//Roll for Up
Expand Down Expand Up @@ -108,7 +110,8 @@ function onHero(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

//Roll for Possibility
Expand Down Expand Up @@ -147,7 +150,8 @@ function onDrama(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

//Increase cards played by 1
Expand Down Expand Up @@ -186,7 +190,8 @@ function onPlus3(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

//Add 1 to cards played
Expand Down Expand Up @@ -219,7 +224,8 @@ function onBd(event) {
heroTotal: event.currentTarget.dataset.heroTotal,
dramaTotal: event.currentTarget.dataset.dramaTotal,
cardsPlayed: event.currentTarget.dataset.cardsPlayed,
damage: event.currentTarget.dataset.damage
damage: event.currentTarget.dataset.damage,
powerAttack: event.currentTarget.dataset.powerAttack
};

var finalValue = torgBD();
Expand Down
10 changes: 8 additions & 2 deletions module/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ torgeternity.cosmTypes = {
nileEmpire: "torgeternity.cosms.nileEmpire",
aysle: "torgeternity.cosms.aysle",
cyberpapacy: "torgeternity.cosms.cyberpapacy",
tharkhold: "torgeternity.cosms.tharkhold",
tharkold: "torgeternity.cosms.tharkold",
panPacifica: "torgeternity.cosms.panPacifica",
orrorsh: "torgeternity.cosms.orrorsh"
}
Expand Down Expand Up @@ -80,7 +80,9 @@ torgeternity.races = {
human: "torgeternity.races.human",
dwarf: "torgeternity.races.dwarf",
edeinos: "torgeternity.races.edeinos",
elf: "torgeternity.races.elf"
elf: "torgeternity.races.elf",
aspirants: "torgeternity.races.aspirants",
theRace: "torgeternity.races.theRace"
}

torgeternity.skills = {
Expand Down Expand Up @@ -198,3 +200,7 @@ torgeternity.statusEffects = [

]

torgeternity.yesNo = {
true: "torgeternity.yesNo.true",
false: "torgeternity.yesNo.false"
}
53 changes: 53 additions & 0 deletions module/effects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export function onManageActiveEffect(event, owner) {
event.preventDefault();
const a = event.currentTarget;
const li = a.closest("li");
const effect = li.dataset.effectId ? owner.effects.get(li.dataset.effectId) : null;
switch ( a.dataset.action ) {
case "create":
return ActiveEffect.create({
label: "New Effect",
icon: "icons/svg/aura.svg",
origin: owner.uuid,
"duration.rounds": li.dataset.effectType === "temporary" ? 1 : undefined,
disabled: li.dataset.effectType === "inactive"
}, owner).create();
case "edit":
return effect.sheet.render(true);
case "delete":
return effect.delete();
case "toggle":
return effect.update({disabled: !effect.data.disabled});
}
}


export function prepareActiveEffectCategories(effects) {
// Define effect header categories
const categories = {
temporary: {
type: "temporary",
label: "Temporary Effects",
effects: []
},
passive: {
type: "passive",
label: "Passive Effects",
effects: []
},
inactive: {
type: "inactive",
label: "Inactive Effects",
effects: []
}
};

// Iterate over active effects, classifying them into categories
for ( let e of effects ) {
e._getSourceName(); // Trigger a lookup for the source name
if ( e.data.disabled ) categories.inactive.effects.push(e);
else if ( e.isTemporary ) categories.temporary.effects.push(e);
else categories.passive.effects.push(e);
}
return categories;
}
48 changes: 45 additions & 3 deletions module/sheets/torgeternityActorSheet.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { torgeternity } from "../config.js";
import * as torgchecks from "../torgchecks.js";
import {onManageActiveEffect, prepareActiveEffectCategories} from "/systems/torgeternity/module/effects.js";

export default class torgeternityActorSheet extends ActorSheet {
constructor(...args) {
super(...args);

this._filters = {
effects: new Set()
}
}

static get defaultOptions () {
return mergeObject(super.defaultOptions, {
classes: ["torgeternity", "sheet", "actor"],
width: 600,
height: 600,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats"}],
scrollY: [".stats", ".perks", ".gear", ".powers", "background"],
scrollY: [".stats", ".perks", ".gear", ".powers", "effects", "background"],
dragdrop: [{dragSelector: ".item-list .item", dropSelector: null}]
});
}
Expand Down Expand Up @@ -44,6 +53,7 @@ export default class torgeternityActorSheet extends ActorSheet {
this.actor.data.data.editstate = "none";
};

data.effects= prepareActiveEffectCategories(this.entity.effects);

data.config = CONFIG.torgeternity;

Expand Down Expand Up @@ -91,6 +101,10 @@ export default class torgeternityActorSheet extends ActorSheet {
html.find(".up-roll").click(this._onUpRoll.bind(this));
}

if (this.actor.owner) {
html.find(".item-equip").click(this._onItemEquip.bind(this));
}

if (this.actor.owner) {
html.find(".item-create-sa").click(this._onCreateSa.bind(this));
}
Expand All @@ -107,6 +121,10 @@ export default class torgeternityActorSheet extends ActorSheet {
html.find(".activeDefense-roll").click(this._onActiveDefenseRoll.bind(this));
}

if (this.actor.owner) {
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.entity));
}

super.activateListeners(html);

// Everything below here is only needed if the sheet is editable
Expand Down Expand Up @@ -267,8 +285,19 @@ export default class torgeternityActorSheet extends ActorSheet {
_onPowerRoll(event) {
const itemID = event.currentTarget.closest(".item").dataset.itemId;
const item = this.actor.getOwnedItem(itemID);

item.power();
var powerData = item.data.data;
var skillData = this.actor.data.data.skills[powerData.skill];
torgchecks.powerRoll ({
actor: this.actor,
item: item,
actorPic: this.actor.data.img,
skillName: powerData.skill,
skillBaseAttribute: skillData.baseAttribute,
skillValue: skillData.value,
powerName: item.data.name,
powerAttack: powerData.isAttack,
powerDamage: powerData.damage
})
}

_onCreateSa(event) {
Expand Down Expand Up @@ -307,5 +336,18 @@ export default class torgeternityActorSheet extends ActorSheet {
this.actor.update({"data.editstate":"none"});
};
}

_onItemEquip(event) {
var actor = this.actor;
const itemID = event.currentTarget.closest(".item").dataset.itemId;
const item = this.actor.getOwnedItem(itemID);
if (item.data.equipped === false) {
item.data.equipped = true;
item.update({"data.equipped": true})
} else {
item.data.equipped = false;
item.update({"data.equipped": false})
}
}
}

19 changes: 17 additions & 2 deletions module/sheets/torgeternityItemSheet.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {onManageActiveEffect, prepareActiveEffectCategories} from "/systems/torgeternity/module/effects.js";

export default class torgeternityItemSheet extends ItemSheet {
constructor(...args) {
super(...args);
Expand All @@ -16,8 +18,11 @@ export default class torgeternityItemSheet extends ItemSheet {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
width: 530,
height: 500,
classes: ["torgeternity", "sheet", "item"]
height: 550,
classes: ["torgeternity", "sheet", "item"],
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats"}],
scrollY: [".stats", ".effects", ".background"],
dragdrop: [{dragSelector: ".item-list .item", dropSelector: null}]
});

}
Expand All @@ -31,9 +36,19 @@ export default class torgeternityItemSheet extends ItemSheet {
getData(){
const data = super.getData();

data.effects= prepareActiveEffectCategories(this.entity.effects);

data.config = CONFIG.torgeternity;

return data;
}

activateListeners(html) {
super.activateListeners(html);
html.find(".effect-control").click(ev => {
if ( this.item.isOwned ) return ui.notifications.warn("Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.")
onManageActiveEffect(ev, this.item)
});
}

}
Loading

0 comments on commit f2436cb

Please sign in to comment.