forked from public/fvtt-cthulhu-eternal
		
	Fix #44 - Auto use damage bonus for melee/unarmed
This commit is contained in:
		| @@ -290,6 +290,24 @@ i.fvtt-cthulhu-eternal { | ||||
|   width: auto; | ||||
|   border: none; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-hp { | ||||
|   gap: 2px; | ||||
|   align-items: center; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-hp input { | ||||
|   flex: none; | ||||
|   width: 2rem; | ||||
|   margin-left: 4px; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-hp .damage-bonus { | ||||
|   font-size: calc(var(--font-size-standard) * 0.8); | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-hp .hp-separator { | ||||
|   font-size: calc(var(--font-size-standard) * 1.2); | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-dv .form-fields, | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-left .protagonist-dmax .form-fields { | ||||
|   flex: none; | ||||
| @@ -395,44 +413,9 @@ i.fvtt-cthulhu-eternal { | ||||
|   min-width: 1rem; | ||||
|   max-width: 1rem; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos { | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
|   gap: 4px; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos label { | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right label { | ||||
|   min-width: 120px; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos .protagonist-hp { | ||||
|   display: flex; | ||||
|   gap: 2px; | ||||
|   align-items: center; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos .protagonist-hp .protagonist-hp-value .form-fields input { | ||||
|   flex: none; | ||||
|   width: 50px; | ||||
|   margin-left: 4px; | ||||
|   font-size: calc(var(--font-size-standard) * 1.4); | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos .protagonist-hp .protagonist-hp-max { | ||||
|   clear: both; | ||||
|   display: flex; | ||||
|   flex-direction: row; | ||||
|   flex-wrap: wrap; | ||||
|   margin: 3px 0; | ||||
|   align-items: center; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos .protagonist-hp .protagonist-hp-max input { | ||||
|   width: 50px; | ||||
|   text-align: center; | ||||
|   font-size: calc(var(--font-size-standard) * 1.4); | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .protagonist-infos .protagonist-hp .hp-separator { | ||||
|   font-size: calc(var(--font-size-standard) * 1.2); | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
| } | ||||
| .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc-play { | ||||
|   min-width: 500px; | ||||
| } | ||||
|   | ||||
| @@ -37,6 +37,9 @@ | ||||
|     }, | ||||
|     "Protagonist": { | ||||
|       "FIELDS": { | ||||
|         "damageBonus": { | ||||
|           "label": "Dmg.Bonus" | ||||
|         }, | ||||
|         "resources": { | ||||
|           "permanentRating": { | ||||
|             "label": "Permanent Rating" | ||||
|   | ||||
| @@ -210,6 +210,7 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS | ||||
|       case "damage": | ||||
|         li = $(event.currentTarget).parents(".item"); | ||||
|         item = this.actor.items.get(li.data("item-id")); | ||||
|         item.damageBonus = this.actor.system.damageBonus | ||||
|         break | ||||
|       case "san":  | ||||
|         item = foundry.utils.duplicate(this.actor.system.san) | ||||
|   | ||||
| @@ -113,6 +113,8 @@ export const RESOURCE_BREAKDOWN = [ | ||||
|   { value: 20, hand: 6, stowed: 6, storage: 8, checks: 3} | ||||
| ] | ||||
|  | ||||
| export const DAMAGE_BONUS = [ -2, -2, -2, -2, -2, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2] | ||||
|  | ||||
| export const VEHICLE_SPEED = { | ||||
|   "none": "CTHULHUETERNAL.Label.None", | ||||
|   "slow": "CTHULHUETERNAL.Label.Slow", | ||||
| @@ -258,5 +260,6 @@ export const SYSTEM = { | ||||
|   VEHICLE_SPEED, | ||||
|   MODIFIER_CHOICES, | ||||
|   MULTIPLIER_CHOICES, | ||||
|   ASCII | ||||
|   ASCII, | ||||
|   DAMAGE_BONUS | ||||
| } | ||||
|   | ||||
| @@ -147,6 +147,9 @@ export default class CthulhuEternalRoll extends Roll { | ||||
|         break | ||||
|       case "damage": | ||||
|         let formula = options.rollItem.system.damage | ||||
|         if ( options.rollItem.system.weaponType === "melee" || options.rollItem.system.weaponType === "unarmed") { | ||||
|           formula += ` + ${options.rollItem.damageBonus}` | ||||
|         } | ||||
|         let damageRoll = new Roll(formula) | ||||
|         await damageRoll.evaluate() | ||||
|         await damageRoll.toMessage({ | ||||
|   | ||||
| @@ -34,6 +34,25 @@ | ||||
|         } | ||||
|       } | ||||
|  | ||||
|       .protagonist-hp { | ||||
|         gap: 2px; | ||||
|         align-items: center; | ||||
|         input { | ||||
|           flex: none; | ||||
|           width: 2rem; | ||||
|           margin-left: 4px; | ||||
|         } | ||||
|         .damage-bonus { | ||||
|           font-size: calc(var(--font-size-standard) * 0.8); | ||||
|         } | ||||
|         .hp-separator { | ||||
|           font-size: calc(var(--font-size-standard) * 1.2); | ||||
|           display: flex; | ||||
|           align-items: center; | ||||
|           justify-content: center; | ||||
|         } | ||||
|       } | ||||
|  | ||||
|       .protagonist-dv, | ||||
|       .protagonist-dmax { | ||||
|         .form-fields { | ||||
| @@ -82,7 +101,7 @@ | ||||
|           text-shadow: 0 0 8px var(--color-shadow-primary); | ||||
|           cursor: pointer; | ||||
|           font-size: 0.9rem; | ||||
|         }   | ||||
|         } | ||||
|         .button { | ||||
|           min-width: 4rem; | ||||
|           max-width: 4rem; | ||||
| @@ -141,54 +160,14 @@ | ||||
|           min-width: 5rem; | ||||
|           font-size: 0.9rem; | ||||
|         } | ||||
|         .checkbox {        | ||||
|         .checkbox { | ||||
|           flex-grow: 0; | ||||
|           min-width: 1rem; | ||||
|           max-width: 1rem; | ||||
|         } | ||||
|  | ||||
|       } | ||||
|       .protagonist-infos { | ||||
|         display: flex; | ||||
|         flex-direction: column; | ||||
|         gap: 4px; | ||||
|  | ||||
|         label { | ||||
|           min-width: 120px; | ||||
|         } | ||||
|  | ||||
|         .protagonist-hp { | ||||
|           display: flex; | ||||
|           gap: 2px; | ||||
|           align-items: center; | ||||
|           .protagonist-hp-value { | ||||
|             .form-fields input { | ||||
|               flex: none; | ||||
|               width: 50px; | ||||
|               margin-left: 4px; | ||||
|               font-size: calc(var(--font-size-standard) * 1.4); | ||||
|             } | ||||
|           } | ||||
|           .protagonist-hp-max { | ||||
|             clear: both; | ||||
|             display: flex; | ||||
|             flex-direction: row; | ||||
|             flex-wrap: wrap; | ||||
|             margin: 3px 0; | ||||
|             align-items: center; | ||||
|             input { | ||||
|               width: 50px; | ||||
|               text-align: center; | ||||
|               font-size: calc(var(--font-size-standard) * 1.4); | ||||
|             } | ||||
|           } | ||||
|           .hp-separator { | ||||
|             font-size: calc(var(--font-size-standard) * 1.2); | ||||
|             display: flex; | ||||
|             align-items: center; | ||||
|             justify-content: center; | ||||
|           } | ||||
|         } | ||||
|       label { | ||||
|         min-width: 120px; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| @@ -259,7 +238,7 @@ | ||||
|   .field-label { | ||||
|     margin-left: 8px; | ||||
|   } | ||||
|    | ||||
|  | ||||
|   .adapted { | ||||
|     display: grid; | ||||
|     grid-template-columns: repeat(2, 1fr); | ||||
| @@ -268,7 +247,7 @@ | ||||
|       min-width: 20rem; | ||||
|     } | ||||
|   } | ||||
|    | ||||
|  | ||||
|   .resources { | ||||
|     display: grid; | ||||
|     grid-template-columns: repeat(3, 1fr); | ||||
| @@ -284,14 +263,14 @@ | ||||
|     grid-template-columns: repeat(2, 1fr); | ||||
|     gap: 8px; | ||||
|     label { | ||||
|       min-width: 3.0rem; | ||||
|       min-width: 3rem; | ||||
|     } | ||||
|     .feature { | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         gap: 4px; | ||||
|         min-width: 18rem; | ||||
|         max-width: 18rem;   | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       gap: 4px; | ||||
|       min-width: 18rem; | ||||
|       max-width: 18rem; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -409,7 +388,7 @@ | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|    | ||||
|  | ||||
|   .mentaldisorders { | ||||
|     display: grid; | ||||
|     grid-template-columns: repeat(2, 1fr); | ||||
|   | ||||
| @@ -9,13 +9,16 @@ | ||||
|           <img class="protagonist-img" src="{{actor.img}}" data-edit="img" data-action="editImage" | ||||
|             data-tooltip="{{actor.name}}" /> | ||||
|         </div> | ||||
|         <fieldset> | ||||
|         <fieldset class="protagonist-hp">  | ||||
|           <legend>{{localize "CTHULHUETERNAL.Label.HP"}}</legend> | ||||
|           <div class="flexrow"> | ||||
|             {{formField systemFields.hp.fields.value value=system.hp.value}} | ||||
|             / | ||||
|             <span class="hp-separator">/</span> | ||||
|             {{formField systemFields.hp.fields.max value=system.hp.max rootId=partId disabled=true}} | ||||
|           </div> | ||||
|           <div class="flexrow "> | ||||
|             {{formField systemFields.damageBonus value=system.damageBonus classes="damage-bonus"}} | ||||
|           </div> | ||||
|         </fieldset> | ||||
|  | ||||
|       </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user