Skip to content

Commit

Permalink
Merge pull request #445 from shadowfoundry/dev
Browse files Browse the repository at this point in the history
v11.0.9
  • Loading branch information
karmaroms committed Oct 29, 2023
2 parents f74c72d + 5ea9f3b commit e662696
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 56 deletions.
14 changes: 10 additions & 4 deletions scripts/entities/actors/baseSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ export class ActorSheetSR5 extends ActorSheet {
setProperty(item, "system.wirelessTurnedOn", false);

// Handle drug taken
SR5_SystemHelpers.srLog(1, "Handle drug taken: " + drugType);

let alreadyTaken = actorData.addictions.find((d) => item.name === d.name);
let addiction = [];

Expand All @@ -672,12 +674,16 @@ export class ActorSheetSR5 extends ActorSheet {
actorData.addictions = actorData.addictions.concat(addiction);
actorData.addictions = Object.values(actorData.addictions);
}
SR5_EntityHelpers.updateValue(actorData.addictions.shot);
SR5_EntityHelpers.updateValue(actorData.addictions.weekAddiction);

SR5_SystemHelpers.srLog(1, "actorData.addictions : " + JSON.stringify(actorData.addictions));
if (actorData.addictions.shot) SR5_EntityHelpers.updateValue(actorData.addictions.shot);
if (actorData.addictions.weekAddiction) SR5_EntityHelpers.updateValue(actorData.addictions.weekAddiction);

// Check if the drug is set on systemEffect
if (drugType) {

SR5_SystemHelpers.srLog(1, "Check drugType");

// Generate the drug stat
drug = await SR5_CharacterUtility.handleDrugShots(item, drugType, actorData);
itemData.handleShot = drug;
Expand Down Expand Up @@ -763,8 +769,8 @@ export class ActorSheetSR5 extends ActorSheet {
addiction = SR5_CharacterUtility.generateDrugAddiction(item);
actorData.addictions = actorData.addictions.concat(addiction);
}
SR5_EntityHelpers.updateValue(actorData.addictions.shot);
SR5_EntityHelpers.updateValue(actorData.addictions.weekAddiction);
if (actorData.addictions.shot) SR5_EntityHelpers.updateValue(actorData.addictions.shot);
if (actorData.addictions.weekAddiction) SR5_EntityHelpers.updateValue(actorData.addictions.weekAddiction);
}

} else {
Expand Down
3 changes: 3 additions & 0 deletions scripts/entities/actors/entityActor.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export class SR5Actor extends Actor {
"prototypeToken.actorLink": actorLink,
"prototypeToken.bar1": {attribute: "statusBars.physical",},
"prototypeToken.bar2": {attribute: "statusBars.stun",},
"prototypeToken.texture.src": this.img,
});
break;
case "actorDrone":
Expand All @@ -220,6 +221,7 @@ export class SR5Actor extends Actor {
"prototypeToken.actorLink": actorLink,
"prototypeToken.bar1": {attribute: "statusBars.condition",},
"prototypeToken.bar2": {attribute: "statusBars.matrix",},
"prototypeToken.texture.src": this.img,
});
break;
case "actorDevice":
Expand All @@ -229,6 +231,7 @@ export class SR5Actor extends Actor {
"prototypeToken.lockRotation": true,
"prototypeToken.actorLink": actorLink,
"prototypeToken.bar2": {attribute: "statusBars.matrix",},
"prototypeToken.texture.src": this.img,
});
break;
default :
Expand Down
2 changes: 2 additions & 0 deletions scripts/system/effectArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export class SR5_EffectArea {
let actor = SR5_EntityHelpers.getRealActorFromID(active.id);
let passiveActor = SR5_EntityHelpers.getRealActorFromID(passive.id);

if(!actor || !passiveActor) return

let actorJammedEffect = actor.items.find(i => i.system.type === "signalJammed");
let actorJamEffect = actor.items.find(i => i.system.type === "signalJam");
let passiveJammedEffect = passiveActor.items.find(i => i.system.type === "signalJammed");
Expand Down
96 changes: 48 additions & 48 deletions scripts/system/effectsList.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"flags": {}
}
],
"version": "11.0.8",
"version": "11.0.9",
"compatibility": {
"minimum": "11",
"maximum": "11",
Expand Down
3 changes: 2 additions & 1 deletion template.json
Original file line number Diff line number Diff line change
Expand Up @@ -4952,7 +4952,8 @@
"hobby": "",
"familySituation": "",
"background": ""
},
},
"addictions": [],
"activeSpecialAttribute": "magic",
"skills": {
"flight": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

</li>
{{#each actor.system.addictions as |a i|}}
{{#if_ge shot.value 1}}
{{#if (and (gt shot.value 0) (ne addiction.type '') )}}
<li class="subItemManagement grid" data-key="{{@key}}">
<div class="col-5">
<p>{{name}} ({{findTranslation 'addictionTypesShort' addiction.type}})</p>
Expand All @@ -37,7 +37,7 @@
<div class="col-1 SR-TextRight"><a class="subItem" data-title="{{localize 'SR5.Delete'}}" data-index="{{@key}}" data-binding="addictions" data-action="delete" data-helpTitle="{{localize 'SR5.HELP_DrugDelete' key=name}}"
data-helpMessage="{{localize 'SR5.HELP_DrugDeleteMsg'}}"><i class="fas fa-trash"></i></a></div>
</li>
{{/if_ge}}
{{/if}}
{{/each}}
</ul>
</div>
3 changes: 3 additions & 0 deletions templates/actors/grunt-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<div class="tab" data-group="gauche" data-tab="tab-traits">
{{> systems/sr5/templates/actors/_partials/left-tabs/qualities/qualities.html}}
{{> systems/sr5/templates/actors/_partials/left-tabs/qualities/visions.html}}
{{#if system.addictions}}
{{> systems/sr5/templates/actors/_partials/left-tabs/qualities/addictions.html}}
{{/if}}
</div>
</section>
</div>
Expand Down

0 comments on commit e662696

Please sign in to comment.