diff --git a/img/cards/club.webp b/img/cards/club.webp new file mode 100644 index 0000000..528ec6d Binary files /dev/null and b/img/cards/club.webp differ diff --git a/img/cards/diamond.webp b/img/cards/diamond.webp new file mode 100644 index 0000000..b22f0a6 Binary files /dev/null and b/img/cards/diamond.webp differ diff --git a/img/cards/hearth.webp b/img/cards/hearth.webp new file mode 100644 index 0000000..46ece2d Binary files /dev/null and b/img/cards/hearth.webp differ diff --git a/img/cards/spade.webp b/img/cards/spade.webp new file mode 100644 index 0000000..5536297 Binary files /dev/null and b/img/cards/spade.webp differ diff --git a/img/ui/bolter-gun.svg b/img/ui/bolter-gun.svg new file mode 100644 index 0000000..52c0e60 --- /dev/null +++ b/img/ui/bolter-gun.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/cargo-crate.svg b/img/ui/cargo-crate.svg new file mode 100644 index 0000000..cd28392 --- /dev/null +++ b/img/ui/cargo-crate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/chat-bubble.svg b/img/ui/chat-bubble.svg new file mode 100644 index 0000000..ca5e02c --- /dev/null +++ b/img/ui/chat-bubble.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/cowled.svg b/img/ui/cowled.svg new file mode 100644 index 0000000..a48c495 --- /dev/null +++ b/img/ui/cowled.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/double-quaver.svg b/img/ui/double-quaver.svg new file mode 100644 index 0000000..e98d0bb --- /dev/null +++ b/img/ui/double-quaver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/earth-asia-oceania.svg b/img/ui/earth-asia-oceania.svg new file mode 100644 index 0000000..4b28037 --- /dev/null +++ b/img/ui/earth-asia-oceania.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/files.svg b/img/ui/files.svg new file mode 100644 index 0000000..cc8e9f4 --- /dev/null +++ b/img/ui/files.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/folded-paper.svg b/img/ui/folded-paper.svg new file mode 100644 index 0000000..6f06ed5 --- /dev/null +++ b/img/ui/folded-paper.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/lockers.svg b/img/ui/lockers.svg new file mode 100644 index 0000000..70abf36 --- /dev/null +++ b/img/ui/lockers.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/sidebar-bg.webp b/img/ui/sidebar-bg.webp new file mode 100644 index 0000000..41130e7 Binary files /dev/null and b/img/ui/sidebar-bg.webp differ diff --git a/img/ui/toggles.svg b/img/ui/toggles.svg new file mode 100644 index 0000000..295578c --- /dev/null +++ b/img/ui/toggles.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/ui/walkie-talkie.svg b/img/ui/walkie-talkie.svg new file mode 100644 index 0000000..046a471 --- /dev/null +++ b/img/ui/walkie-talkie.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 9f5d44a..e2651dd 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -67,15 +67,13 @@ export class SoSActorSheet extends ActorSheet { this.actor.rollStat(statName); }); html.find('.edge-draw').click((event) => { - this.actor.drawEdge(); + this.actor.resetDeck(); this.render(true); }); html.find('.lock-unlock-sheet').click((event) => { this.options.editStatSkill = !this.options.editStatSkill; this.render(true); - }); - - + }); } /* -------------------------------------------- */ diff --git a/module/actor.js b/module/actor.js index 5cffaab..f6b2db4 100644 --- a/module/actor.js +++ b/module/actor.js @@ -42,7 +42,7 @@ export class SoSActor extends Actor { if ( !this.cardDeck ) { this.cardDeck = new SoSCardDeck(); - this.cardDeck.initCardDeck( this ); + this.cardDeck.initCardDeck( this, this.data.data.internals.deck ); } this.controlScores(); } @@ -55,8 +55,19 @@ export class SoSActor extends Actor { return edgesCard; } /* -------------------------------------------- */ - drawEdge( ) { + resetDeck( ) { + this.cardDeck.shuffleDeck(); this.cardDeck.drawEdge(); + this.saveDeck(); + } + + /* -------------------------------------------- */ + saveDeck( ) { + let deck = { deck: duplicate(this.cardDeck.data.deck), + discard: duplicate(this.cardDeck.data.discard), + cardEdge: duplicate(this.cardDeck.data.cardEdge) + } + this.update( { 'data.internals.deck': deck }); } /* -------------------------------------------- */ @@ -79,7 +90,7 @@ export class SoSActor extends Actor { } /* -------------------------------------------- */ computeEdge( ) { - return Math.ceil( (this.data.data.stats.intelligence.value + this.data.data.stats.charisma.value) / 2); + return Math.ceil( (this.data.data.stats.intelligence.value + this.data.data.stats.charisma.value) / 2) + this.data.data.scores.edge.bonus; } /* -------------------------------------------- */ getShock( ) { diff --git a/module/sample-code.js b/module/sample-code.js new file mode 100644 index 0000000..29980c7 --- /dev/null +++ b/module/sample-code.js @@ -0,0 +1,24 @@ + html.find('.item .item-name h4').click(event => this._onItemSummary(event)); + + /** + * Handle toggling of an item from the Actor sheet + * @private + */ + _onItemSummary(event) { + event.preventDefault(); + let li = $(event.currentTarget).parents(".item"), + item = this.actor.getOwnedItem(li.data("item-id")); + + // Toggle summary + if (item.data.data.description !== undefined && item.data.data.description !== null){ + if ( li.hasClass("expanded") ) { + let summary = li.children(".item-summary"); + summary.slideUp(200, () => summary.remove()); + } else { + let div = $(`
${item.data.data.description}
`); + li.append(div.hide()); + div.slideDown(200); + } + li.toggleClass("expanded"); + } + } \ No newline at end of file diff --git a/module/sos-card-deck.js b/module/sos-card-deck.js index efe9ae5..f54998c 100644 --- a/module/sos-card-deck.js +++ b/module/sos-card-deck.js @@ -7,16 +7,26 @@ const IDX2CARDFAMILY = ['c', 'd', 'h', 's']; export class SoSCardDeck { /* -------------------------------------------- */ - initCardDeck(actor) { + initCardDeck(actor, savedDeck = undefined ) { this.data = {}; + this.data.deck = []; this.data.discard = []; this.data.cardState = []; this.data.cardEdge = []; - this.data.actor = actor; - - this.shuffleDeck(); + + if ( savedDeck.deck && savedDeck.deck.length > 0 ) {} + this.data.deck = duplicate(savedDeck.deck); + if ( savedDeck.discard && savedDeck.discard.length > 0 ) {} + this.data.discard = duplicate(savedDeck.discard); + if ( savedDeck.cardEdge && savedDeck.cardEdge.length > 0 ) {} + this.data.cardEdge = duplicate(savedDeck.cardEdge); + + this.data.actor = actor; + if ( this.data.deck.length == 0 && this.data.discard.length == 0) { + this.shuffleDeck(); + } } /* -------------------------------------------- */ diff --git a/module/sos-utility.js b/module/sos-utility.js index 71deede..417f8b2 100644 --- a/module/sos-utility.js +++ b/module/sos-utility.js @@ -8,7 +8,8 @@ export class SoSUtility { 'systems/foundryvtt-shadows-over-sol/templates/actor-sheet.html', 'systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html', 'systems/foundryvtt-shadows-over-sol/templates/stat-option-list.html', - 'systems/foundryvtt-shadows-over-sol/templates/item-sheet.html' + 'systems/foundryvtt-shadows-over-sol/templates/item-sheet.html', + 'systems/foundryvtt-shadows-over-sol/templates/stat-name-list.html' ] return loadTemplates(templatePaths); } diff --git a/styles/simple.css b/styles/simple.css index 9f564df..1d796d1 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -229,7 +229,12 @@ table {border: 1px solid #7a7971;} width: 90px; margin-right: 10px; } - +.cardsuit-img { + height: 32px; + width: 32px; + flex-grow: 0; + margin-right: 0.25rem; +} .button-img { vertical-align: baseline; width: 8%; @@ -451,6 +456,7 @@ section.sheet-body{padding: 0.25rem 0.5rem;} .sheet nav.sheet-tabs { font-size: 0.65rem; font-weight: bold; + font-family: Neuropol; height: 5rem; flex: 0 0 5rem; margin: 0; @@ -595,7 +601,9 @@ ul, li { } .stat-label { font-weight: bold; + flex-grow: 2; } + .list-item { margin: 0.125rem; box-shadow: inset 0px 0px 1px #00000096; @@ -822,7 +830,7 @@ ul, li { /* Sidebar CSS */ #sidebar { font-size: 1rem; - background: rgb(105,85,65) url("img/bg_sid_dark.jpg") no-repeat right bottom; + background: rgb(105,85,65) url("../img/ui/sidebar-bg.webp") no-repeat right bottom; background-position: 100%; color: rgba(220,220,220,0.75); } @@ -866,9 +874,9 @@ ul, li { } #sidebar-tabs > .item.active { - border: 1px solid rgba(114,98,72,1); - background: rgba(30, 25, 20, 0.75); - box-shadow: 0 0 6px inset rgba(114,98,72,1); + border: 1px solid rgb(36, 33, 35); + background: rgba(37, 36, 37, 0.75); + box-shadow: 0 0 6px inset rgb(66, 63, 66); } #sidebar #sidebar-tabs i{ @@ -882,16 +890,16 @@ ul, li { } #sidebar #sidebar-tabs i.fa-comments:before, #sidebar #sidebar-tabs i.fa-fist-raised:before, #sidebar #sidebar-tabs i.fa-users:before, #sidebar #sidebar-tabs i.fa-map:before, #sidebar #sidebar-tabs i.fa-suitcase:before, #sidebar #sidebar-tabs i.fa-book-open:before, #sidebar #sidebar-tabs i.fa-th-list:before, #sidebar #sidebar-tabs i.fa-music:before, #sidebar #sidebar-tabs i.fa-atlas:before, #sidebar #sidebar-tabs i.fa-cogs:before {content: "";} -#sidebar #sidebar-tabs i.fa-comments {background: url("img/ui/icon_sidebar_chat.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-fist-raised {background: url("img/ui/icon_sidebar_fight.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-users {background: url("img/ui/icon_sidebar_actor.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-map {background: url("img/ui/icon_sidebar_scene.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-suitcase {background: url("img/ui/icon_sidebar_item.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-book-open {background: url("img/ui/icon_sidebar_journal.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-th-list {background: url("img/ui/icon_sidebar_rolltable.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-music {background: url("img/ui/icon_sidebar_music.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-atlas {background: url("img/ui/icon_sidebar_compendium.svg") no-repeat;} -#sidebar #sidebar-tabs i.fa-cogs {background: url("img/ui/icon_sidebar_settings.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-comments {background: url("../img/ui/walkie-talkie.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-fist-raised {background: url("../img/ui/bolter-gun.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-users {background: url("../img/ui/cowled.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-map {background: url("../img/ui/earth-asia-oceania.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-suitcase {background: url("../img/ui/cargo-crate.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-book-open {background: url("../img/ui/files.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-th-list {background: url("../img/ui/folded-paper.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-music {background: url("../img/ui/double-quaver.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-atlas {background: url("../img/ui/lockers.svg") no-repeat;} +#sidebar #sidebar-tabs i.fa-cogs {background: url("../img/ui/toggles.svg") no-repeat;} #combat #combat-controls { box-shadow: inset 0 0 2rem rgba(0,0,0,0.5); diff --git a/template.json b/template.json index 6ee0bf3..a67cf00 100644 --- a/template.json +++ b/template.json @@ -69,12 +69,13 @@ } }, "internals": { - "deck": [] + "deck": {} }, "scores": { "edge": { "label": "SCORES.Edge", - "value": 0 + "value": 0, + "bonus": 0 }, "wealth": { "label": "SCORES.Wealth", @@ -132,37 +133,74 @@ } }, "Item": { - "types": ["object", "weapon", "armor", "container", "skills" ], - "skills": { - "stat":"", + "types": ["gear", "weapon", "armor", "container", "skill" ], + "templates": { + "commongear": { + "big": 0, + "computer": 0, + "conceal": 0, + "container": 0, + "implant": 0, + "neg": false, + "mil": false, + "software": 0, + "worn": false, + "description": "", + "quantity": 0, + "costrating": 0, + "defensive": 0 + } + }, + "skill": { "value": 0, "xp": 0, "description": "" }, "skillexperience": { - "skillname": "", + "skill": "", "description": "" }, - "object": { - "description": "", - "quantity": 1, - "enc": 0, - "price": 0 + "gear": { + "templates": [ "commongear" ] }, "container": { - "description": "", - "enc": 0, - "price": 0 + "templates": [ "commongear" ], + "container": 0 }, "weapon": { - "description": "", - "enc": 0, - "price": 0 + "templates": [ "commongear" ], + "area": 0, + "autofire": 0, + "damage": "", + "hands": 1, + "pierce": 0, + "range": 0, + "reload": 1, + "shots": 0, + "stun": false, + "thrown": false, + "reach": false, + "shallow": false, + "spread": false }, "armor": { - "description": "", - "enc": 0, - "price": 0 + "templates": [ "commongear" ], + "bulky": 0, + "dr": 0, + "gel": 0, + "reflect": 0, + "str": 0, + "vac": false + }, + "vehicle": { + "templates": [ "commongear" ], + "cruise": 0, + "defense": "", + "dr": 0, + "handling": 0, + "shock": 0, + "structure": 0 } + } } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index e2b8b8c..8e69968 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -48,6 +48,7 @@ {{/select}} + {{/each}} @@ -56,8 +57,14 @@ @@ -111,24 +118,24 @@
  • -
  • -
  • - -
  • -
  • - -