Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cast(level, actions) {
  2.  if(actions==="one"){
  3.    _roll(level.toString() + "d10", "Heal Level " + level.toString() + ", " + actions + " Action.")
  4.  }else if(actions==="two"){
  5.    let n = level*8
  6.    _roll(level.toString() + "d10+" + n.toString(), "Heal Level " + level.toString() + ", " + actions + " Actions.")
  7.  }else if(actions==="three"){
  8.    _roll(level.toString() + "d10", "Heal Level " + level.toString() + ", " + actions + " Actions.")
  9.  }
  10. }
  11.  
  12. function _roll(formula, flavor){
  13.  const rollMode = game.settings.get('core', 'rollMode');
  14.  let chatData = {
  15.    user: game.user._id,
  16.    speaker: ChatMessage.getSpeaker({actor}),
  17.    content: formula,
  18.    flavor: flavor,
  19.    type: CONST.CHAT_MESSAGE_TYPES.ROLL
  20.  };
  21.  let r = new Roll(formula).toMessage(chatData, rollMode, true)
  22. }
  23.  
  24. function actions(html){
  25.   let level = html.find('[name="spellLevel"]').val()
  26.   let d_actions = new Dialog({
  27.     title: "Cast Heal",
  28.     content: "<p>Actions:",
  29.     buttons: {
  30.       one: {
  31.         icon: '<img src="systems/pf2e/icons/actions/OneAction.png" height="30"> </img>',
  32.         callback: () => cast(level, "one")
  33.       },
  34.       two: {
  35.         icon: '<img src="systems/pf2e/icons/actions/TwoActions.png" height="30"> </img>',
  36.         callback: () => cast(level, "two")
  37.       },
  38.       three: {
  39.         icon: '<img src="systems/pf2e/icons/actions/ThreeActions.png" height="30"> </img>',
  40.         callback: () => cast(level, "three")
  41.       }
  42.     },
  43.     default: "one",
  44.   });
  45.   d_actions.render(true);
  46. }
  47.  
  48. function spell_level(){
  49.   const html = '<form><div class="form-group"><label>Spell Level:</label><select name="spellLevel"><option value="1">Level 1</option><option value="2">Level 2</option><option value="3">Level 3</option><option value="4">Level 4</option><option value="5">Level 5</option><option value="6">Level 6</option><option value="7">Level 7</option></select></div></form>'
  50.  
  51.   let d_level = new Dialog({
  52.     title: "Cast Heal",
  53.     content: html,
  54.     buttons: {
  55.       next: {
  56.         label: "Next",
  57.         callback: (html) => actions(html)
  58.       }
  59.     },
  60.     default: "next",
  61.   });
  62.   d_level.render(true);
  63. }
  64. spell_level()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement