justinross / foundry-bitd-alternate-sheets

MIT License
5 stars 12 forks source link

Mule ability does not correctly update load maximums #76

Open zxaos opened 1 year ago

zxaos commented 1 year ago

A character that takes the cutter's "Mule" ability should have increased values for light/normal/heavy loadouts, but that changes is not reflected in the sheet

This does work in the base system sheet.

JohanFalt commented 10 months ago

If you replace code after row 433 in blades-alternatie-actor-sheet.js if works.

let mule_present=0;

    //look for Mule ability
    // @todo - fix translation.
    data.items.forEach(i => {
      if (i.type === "ability" && i.name === "(C) Mule") {
        mule_present = 1;
      }
    });

    //set encumbrance level
    if (mule_present) {
      switch (data.data.selected_load_level){
        case "BITD.Light":
          data.max_load = data.data.base_max_load + 5;
          break;
        case "BITD.Normal":
          data.max_load = data.data.base_max_load + 7;
          break;
        case "BITD.Heavy":
          data.max_load = data.data.base_max_load + 8;
          break;
        default:
          data.data.selected_load_level = "BITD.Normal";
          data.max_load = data.data.base_max_load + 7;
          break;
      }
    }
    else {
      switch (data.data.selected_load_level){
        case "BITD.Light":
          data.max_load = data.data.base_max_load + 3;
          break;
        case "BITD.Normal":
          data.max_load = data.data.base_max_load + 5;
          break;
        case "BITD.Heavy":
          data.max_load = data.data.base_max_load + 6;
          break;
        default:
          data.data.selected_load_level = "BITD.Normal";
          data.max_load = data.data.base_max_load + 5;
          break;
      }
    }