ENH: Detailed now set item weight to 80
							parent
							
								
									ef160bc1de
								
							
						
					
					
						commit
						af792eeef8
					
				|  | @ -173,6 +173,7 @@ | ||||||
|   "OSE.Setting.EncumbranceDisabled": "Disabled", |   "OSE.Setting.EncumbranceDisabled": "Disabled", | ||||||
|   "OSE.Setting.EncumbranceBasic": "Basic", |   "OSE.Setting.EncumbranceBasic": "Basic", | ||||||
|   "OSE.Setting.EncumbranceDetailed": "Detailed", |   "OSE.Setting.EncumbranceDetailed": "Detailed", | ||||||
|  |   "OSE.Setting.EncumbranceComplete": "Complete", | ||||||
|   "OSE.Setting.MovementAuto": "Calculate Movement", |   "OSE.Setting.MovementAuto": "Calculate Movement", | ||||||
|   "OSE.Setting.SignificantTreasure": "Significant Treasure Weight", |   "OSE.Setting.SignificantTreasure": "Significant Treasure Weight", | ||||||
|   "OSE.Setting.SignificantTreasureHint": "Weight at which treasure will reduce the movement, only useful for basic encumbrance", |   "OSE.Setting.SignificantTreasureHint": "Weight at which treasure will reduce the movement, only useful for basic encumbrance", | ||||||
|  |  | ||||||
|  | @ -173,6 +173,7 @@ | ||||||
|   "OSE.Setting.EncumbranceDisabled": "Désactivé", |   "OSE.Setting.EncumbranceDisabled": "Désactivé", | ||||||
|   "OSE.Setting.EncumbranceBasic": "Basique", |   "OSE.Setting.EncumbranceBasic": "Basique", | ||||||
|   "OSE.Setting.EncumbranceDetailed": "Detaillé", |   "OSE.Setting.EncumbranceDetailed": "Detaillé", | ||||||
|  |   "OSE.Setting.EncumbranceComplete": "Complet", | ||||||
|   "OSE.Setting.MovementAuto": "Calculer Déplacement", |   "OSE.Setting.MovementAuto": "Calculer Déplacement", | ||||||
|   "OSE.Setting.SignificantTreasure": "Poids d'un Trésor Significatif", |   "OSE.Setting.SignificantTreasure": "Poids d'un Trésor Significatif", | ||||||
|   "OSE.Setting.SignificantTreasureHint": "Poids auquel le Trésor réduit le déplacement. Utilisé pour l'encombrement Basique", |   "OSE.Setting.SignificantTreasureHint": "Poids auquel le Trésor réduit le déplacement. Utilisé pour l'encombrement Basique", | ||||||
|  |  | ||||||
|  | @ -495,18 +495,19 @@ export class OseActor extends Actor { | ||||||
|     } |     } | ||||||
|     const data = this.data.data; |     const data = this.data.data; | ||||||
|     let option = game.settings.get("ose", "encumbranceOption"); |     let option = game.settings.get("ose", "encumbranceOption"); | ||||||
|     let basic = option == "basic"; |  | ||||||
| 
 | 
 | ||||||
|     // Compute encumbrance
 |     // Compute encumbrance
 | ||||||
|     let owned = ["weapon", "armor", "item"]; |  | ||||||
|     let totalWeight = 0; |     let totalWeight = 0; | ||||||
|  |     let hasItems = false; | ||||||
|     Object.values(this.data.items).forEach((item) => { |     Object.values(this.data.items).forEach((item) => { | ||||||
|       if (item.type == "item" && (!basic || item.data.treasure)) { |       if (item.type == "item" && (['complete', 'disabled'].includes(option) || item.data.treasure)) { | ||||||
|         totalWeight += item.data.quantity.value * item.data.weight; |         totalWeight += item.data.quantity.value * item.data.weight; | ||||||
|       } else if (!basic && owned.includes(item.type)) { |         hasItems = true; | ||||||
|  |       } else if (option != 'basic' && ['weapon', 'armor'].includes(item.type)) { | ||||||
|         totalWeight += item.data.weight; |         totalWeight += item.data.weight; | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|  |     if (option === 'detailed' && hasItems) totalWeight += 80; | ||||||
| 
 | 
 | ||||||
|     data.encumbrance = { |     data.encumbrance = { | ||||||
|       pct: Math.clamped( |       pct: Math.clamped( | ||||||
|  |  | ||||||
|  | @ -45,6 +45,7 @@ export const registerSettings = function () { | ||||||
|       disabled: "OSE.Setting.EncumbranceDisabled", |       disabled: "OSE.Setting.EncumbranceDisabled", | ||||||
|       basic: "OSE.Setting.EncumbranceBasic", |       basic: "OSE.Setting.EncumbranceBasic", | ||||||
|       detailed: "OSE.Setting.EncumbranceDetailed", |       detailed: "OSE.Setting.EncumbranceDetailed", | ||||||
|  |       complete: "OSE.Setting.EncumbranceComplete", | ||||||
|     }, |     }, | ||||||
|     onChange: _ => window.location.reload() |     onChange: _ => window.location.reload() | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue