ENH: Armor class
							parent
							
								
									0c9282b8a5
								
							
						
					
					
						commit
						ded5e00aa5
					
				|  | @ -75,6 +75,29 @@ export class OseActorSheetCharacter extends OseActorSheet { | |||
|       encumbered: totalWeight > data.data.encumbrance.max, | ||||
|       value: totalWeight | ||||
|     }; | ||||
| 
 | ||||
|     // Compute AC
 | ||||
|     if (data.config.ascendingAC) { | ||||
|       let baseAc = 10; | ||||
|       data.owned.armors.forEach(a => { | ||||
|         if (a.data.equipped) { | ||||
|           baseAc += a.data.aac.value;  | ||||
|         } | ||||
|       }) | ||||
|       data.data.aac.value = baseAc + data.data.scores.dex.mod; | ||||
| 
 | ||||
|     } else { | ||||
|       let baseAc = 9; | ||||
|       let shield = 0; | ||||
|       data.owned.armors.forEach(a => { | ||||
|         if (a.data.equipped && a.data.type != 'shield') { | ||||
|           baseAc = a.data.ac.value; | ||||
|         } else if (a.data.equipped && a.data.type == 'shield') { | ||||
|           shield = a.data.ac.value;  | ||||
|         } | ||||
|       }) | ||||
|       data.data.ac.value = baseAc - data.data.scores.dex.mod - shield; | ||||
|     } | ||||
|     return data; | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,6 @@ export class OseActor extends Actor { | |||
| 
 | ||||
|     // Compute modifiers from actor scores
 | ||||
|     this.computeModifiers(); | ||||
|     this.computeAttack(); | ||||
| 
 | ||||
|     // Determine Initiative
 | ||||
|     if (game.settings.get("ose", "individualInit")) { | ||||
|  | @ -375,21 +374,4 @@ export class OseActor extends Actor { | |||
|     data.scores.dex.init = OseActor._cappedMod(this.data.data.scores.dex.value); | ||||
|     data.scores.cha.npc = OseActor._cappedMod(this.data.data.scores.cha.value); | ||||
|   } | ||||
| 
 | ||||
|   computeAttack() { | ||||
|     const data = this.data.data; | ||||
|     let ascending = game.settings.get("ose", "ascendingAC"); | ||||
|     data.thac0.missile = ascending ? data.thac0.bba : data.thac0.value; | ||||
|     data.thac0.melee = ascending ? data.thac0.bba : data.thac0.value; | ||||
|     if (this.data.type != "character") { | ||||
|       return; | ||||
|     } | ||||
|     if (ascending) { | ||||
|       data.thac0.missile += data.scores.dex.mod + data.thac0.mod.missile; | ||||
|       data.thac0.melee += data.scores.str.mod + data.thac0.mod.melee; | ||||
|     } else { | ||||
|       data.thac0.missile -= data.scores.dex.mod - data.thac0.mod.missile; | ||||
|       data.thac0.melee -= data.scores.str.mod - data.thac0.mod.melee; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -113,12 +113,12 @@ | |||
|             <div class="health armor-class"> | ||||
|                 {{#if config.ascendingAC}} | ||||
|                 <input class="health-top" name="data.aac.value" type="text" value="{{data.aac.value}}" | ||||
|                     data-dtype="Number" placeholder="0" title="{{localize 'OSE.ArmorClass'}}" /> | ||||
|                     data-dtype="Number" placeholder="0" title="{{localize 'OSE.ArmorClass'}}" disabled/> | ||||
|                 <input class="health-bottom" type="text" value="{{add 10 data.scores.dex.mod}}" | ||||
|                     title="{{localize 'OSE.ArmorClassNaked'}}" disabled /> | ||||
|                 {{else}} | ||||
|                 <input class="health-top" name="data.ac.value" type="text" value="{{data.ac.value}}" data-dtype="Number" | ||||
|                     placeholder="0" title="{{localize 'OSE.ArmorClass'}}" /> | ||||
|                     placeholder="0" title="{{localize 'OSE.ArmorClass'}}" disabled/> | ||||
|                 <input class="health-bottom" type="text" value="{{subtract data.scores.dex.mod 9}}" | ||||
|                     title="{{localize 'OSE.ArmorClass'}}" disabled /> | ||||
|                 {{/if}} | ||||
|  | @ -153,17 +153,10 @@ | |||
|                     <h4 class="attribute-name box-title" title="{{localize 'OSE.Melee'}}"> | ||||
|                         <a>{{localize 'OSE.MeleeShort'}}</a></h4> | ||||
|                     <div class="flexrow"> | ||||
|                         {{#if config.ascendingAC}} | ||||
|                         <div class="attribute-value" | ||||
|                             title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})"> | ||||
|                             {{data.thac0.melee}} | ||||
|                         </div> | ||||
|                         {{else}} | ||||
|                         <div class="attribute-value" | ||||
|                             title="{{localize 'OSE.scores.str.long'}}({{data.scores.str.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.melee}})"> | ||||
|                             {{add data.scores.str.mod data.thac0.mod.melee}} | ||||
|                         </div> | ||||
|                         {{/if}} | ||||
|                     </div> | ||||
|                 </li> | ||||
|                 {{#if config.ascendingAC}} | ||||
|  | @ -193,17 +186,10 @@ | |||
|                     <h4 class="attribute-name box-title" title="{{localize 'OSE.Missile'}}"> | ||||
|                         <a>{{localize 'OSE.MissileShort'}}</a></h4> | ||||
|                     <div class="flexrow"> | ||||
|                         {{#if config.ascendingAC}} | ||||
|                         <div class="attribute-value" | ||||
|                             title="{{localize 'OSE.AB'}}({{data.thac0.bba}}) + {{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})"> | ||||
|                             {{data.thac0.missile}} | ||||
|                         </div> | ||||
|                         {{else}} | ||||
|                         <div class="attribute-value" | ||||
|                             title="{{localize 'OSE.scores.dex.long'}}({{data.scores.dex.mod}}) + {{localize 'OSE.Modifier'}}({{data.thac0.mod.missile}})"> | ||||
|                             {{add data.scores.dex.mod data.thac0.mod.missile}} | ||||
|                         </div> | ||||
|                         {{/if}} | ||||
|                     </div> | ||||
|                 </li> | ||||
|             </ul> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue