diff --git a/resources/fillable-char-sheetstyle-1-2-spells.pdf b/resources/fillable-char-sheetstyle-1-2-spells.pdf index 1850a8f18..58992cdc4 100644 Binary files a/resources/fillable-char-sheetstyle-1-2-spells.pdf and b/resources/fillable-char-sheetstyle-1-2-spells.pdf differ diff --git a/resources/public/image/orcpub-card-logo.png b/resources/public/image/card-logo.png similarity index 100% rename from resources/public/image/orcpub-card-logo.png rename to resources/public/image/card-logo.png diff --git a/src/clj/orcpub/pdf.clj b/src/clj/orcpub/pdf.clj index 22363019b..50788de24 100644 --- a/src/clj/orcpub/pdf.clj +++ b/src/clj/orcpub/pdf.clj @@ -219,9 +219,10 @@ (+ margin-x total-width) y))) (.setStrokingColor cs 0 0 0))) + (defn spell-school-level [{:keys [level school]} class-nm] (if (zero? level) - (str class-nm " - "(s/capitalize school) " cantrip") + (str class-nm " Cantrip " (s/capitalize school)) (str class-nm " Level " level " " (str (s/capitalize school))))) (defn draw-spell-field [cs document title value x y] @@ -282,7 +283,7 @@ remaining-height (- 11.0 total-height) margin-y (/ remaining-height 2) fonts (load-fonts document)] - (with-open [img-stream (io/input-stream (io/resource "public/image/orcpub-card-logo.png")) + (with-open [img-stream (io/input-stream (io/resource "public/image/card-logo.png")) over-img-stream (io/input-stream (io/resource "public/image/clockwise-rotation.png"))] (let [img (LosslessFactory/createFromImage document (ImageIO/read img-stream)) over-img (LosslessFactory/createFromImage document (ImageIO/read over-img-stream))] @@ -326,7 +327,7 @@ (- box-width 0.3) (- box-height 0.2)))))))))) -(defn print-spells [cs document box-width box-height spells page-number] +(defn print-spells [cs document box-width box-height spells page-number print-spell-card-dc-mod?] (let [num-boxes-x (int (/ 8.5 box-width)) num-boxes-y (int (/ 11.0 box-height)) total-width (* num-boxes-x box-width) @@ -336,7 +337,7 @@ remaining-height (- 11.0 total-height) margin-y (/ remaining-height 2) fonts (load-fonts document)] - (with-open [card-logo-img-stream (io/input-stream (io/resource "public/image/orcpub-card-logo.png")) + (with-open [card-logo-img-stream (io/input-stream (io/resource "public/image/card-logo.png")) over-img-stream (io/input-stream (io/resource "public/image/clockwise-rotation.png"))] (let [card-logo-img (LosslessFactory/createFromImage document (ImageIO/read card-logo-img-stream)) over-img (LosslessFactory/createFromImage document (ImageIO/read over-img-stream))] @@ -417,7 +418,7 @@ 0.2) (draw-text-to-box cs (if (not= class-nm "Homebrew") - (str (spell-school-level spell class-nm) " " dc-str (str " Spell Mod " (common/bonus-str attack-bonus))) + (str (spell-school-level spell class-nm) (when print-spell-card-dc-mod? (str " " dc-str (str " Spell Mod " (common/bonus-str attack-bonus))))) (spell-school-level spell class-nm)) (:italic fonts) 8 diff --git a/src/clj/orcpub/routes.clj b/src/clj/orcpub/routes.clj index 6ad49d245..8196e92b9 100644 --- a/src/clj/orcpub/routes.clj +++ b/src/clj/orcpub/routes.clj @@ -410,7 +410,7 @@ :weapon-name-2 8 :weapon-name-3 8})) -(defn add-spell-cards! [doc spells-known spell-save-dcs spell-attack-mods custom-spells] (try +(defn add-spell-cards! [doc spells-known spell-save-dcs spell-attack-mods custom-spells print-spell-card-dc-mod?] (try (let [custom-spells-map (common/map-by-key custom-spells) spells-map (merge spells/spell-map custom-spells-map) flat-spells (-> spells-known vals flatten) @@ -421,7 +421,7 @@ class) key]) flat-spells) - parts (vec (partition-all 9 sorted-spells))] + parts (vec (partition-all 9 flat-spells))] (doseq [i (range (count parts)) :let [part (parts i)]] (let [page (PDPage.)] @@ -444,7 +444,8 @@ 2.5 3.5 spells - i)) + i + print-spell-card-dc-mod?)) back-page (PDPage.)] (with-open [back-page-cs (PDPageContentStream. doc back-page)] (.addPage doc back-page) @@ -453,7 +454,7 @@ (defn character-pdf-2 [req] (let [fields (-> req :form-params :body edn/read-string) - {:keys [image-url image-url-failed faction-image-url faction-image-url-failed spells-known custom-spells spell-save-dcs spell-attack-mods print-spell-cards? print-character-sheet-style?]} fields + {:keys [image-url image-url-failed faction-image-url faction-image-url-failed spells-known custom-spells spell-save-dcs spell-attack-mods print-spell-cards? print-character-sheet-style? print-spell-card-dc-mod?]} fields sheet6 (str "fillable-char-sheetstyle-" print-character-sheet-style? "-6-spells.pdf") sheet5 (str "fillable-char-sheetstyle-" print-character-sheet-style? "-5-spells.pdf") @@ -476,7 +477,7 @@ (with-open [doc (PDDocument/load input)] (pdf/write-fields! doc fields (not chrome?) font-sizes) (if (and print-spell-cards? (seq spells-known)) - (add-spell-cards! doc spells-known spell-save-dcs spell-attack-mods custom-spells)) + (add-spell-cards! doc spells-known spell-save-dcs spell-attack-mods custom-spells print-spell-card-dc-mod?)) (if (and image-url (re-matches #"^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" image-url) (not image-url-failed)) diff --git a/src/cljc/orcpub/dnd/e5/magic_items.cljc b/src/cljc/orcpub/dnd/e5/magic_items.cljc index c2553fcdb..3ad57a46b 100644 --- a/src/cljc/orcpub/dnd/e5/magic_items.cljc +++ b/src/cljc/orcpub/dnd/e5/magic_items.cljc @@ -215,7 +215,8 @@ ::subtypes ::rarity ::description - ::attunementb + ;::attunementb ;typo? + ::attunement ::magical-damage-bonus ::magical-attack-bonus ::magical-ac-bonus @@ -246,6 +247,11 @@ (defn axe? [w] (= :axe (::weapons5e/subtype w))) +(defn bow? [w] + (or (= :longbow (::weapons5e/subtype w)) + (= :shortbow (::weapons5e/subtype w))) + ) + (defn slashing-sword? [w] (and (= :slashing (::weapons5e/damage-type w)) (sword? w))) @@ -260,8 +266,8 @@ (def weapon-not-ammunition? (complement ammunition?)) -(defn heavy-metal-armor? [a] - (and (#{:medium :heavy} (:type a)) +(defn heavy-metal-armor? [a] + (and (#{:medium :heavy} (:type a)) (not= :hide (:key a)))) (defn not-shield? [a] (#{:light :medium :heavy} (:type a))) @@ -285,7 +291,7 @@ They return to Valhalla after 1 hour or when they drop to 0 hit points. Once you (str " You must have proficiency with all " requirement - ". If you blow the horn without meeting this requirement, the summoned berserkers attack you. If you meet the requirement, they are friendly to you and your companions and follow your commands."))) + ". If you blow the horn without meeting this requirement, the summoned berserkers attack you. If you meet the requirement, they are friendly to you and your companions and follow your commands."))) }) (defn potion-of-giant-strength [name strength rarity] @@ -308,7 +314,9 @@ The creature exists for a duration specific to each figurine. At the end of the " description)}) (defn belt-of-giant-strength-mod [value] - (mod/vec-mod ?ability-overrides {:ability :orcpub.dnd.e5.character/str :value (min 30 (+ value (if (and ?giants-bane-gauntlet ?giants-bane-hammer) 4 0)))})) + (mod/vec-mod ?ability-overrides + {:ability :orcpub.dnd.e5.character/str :value + (min 30 (+ value (if (and ?giants-bane-gauntlet ?giants-bane-hammer) 4 0)))})) (defn dragon-scale-mail [color-nm resistance-kw] {name-key (str "Dragon Scale Mail, " color-nm) @@ -333,6 +341,25 @@ Additionally, you can focus your senses as an action to magically discern the di direction to the closest dragon within 30 miles of you that is of the same type as the armor. This special action can’t be used again until the next dawn." )}) +(defn + ^{:doc "Generic function for creating magic items with + bonuses. + Use :sp-atk-mod for spell-attack-modifier bonuses. + Use :sp-dc-mod for spell DC bonuses" + ; :test (fn [] ()) + ; :arglists ([name ]) + :user/comment "This 'cleans' up item definitions... but could make them harder to read if it was applied all the way around."} + + caster-bonus-item [name bonus type rarity attunement modv description] + (let [full-name (str name " +" bonus)] + {name-key full-name + ::type type + ::rarity rarity + ::attunement (if (vector? attunement) attunement [attunement]) ;array should be passed not just one keyword + ::modifiers [(for [i modv] + (cond (= i :sp-atk-mod) (mod5e/spell-attack-modifier-bonus bonus) + (= i :sp-dc-mod) (mod5e/spell-save-dc-bonus bonus)))] + ::decription description})) + (defn rod-of-the-pact-keeper [bonus] {name-key (str "Rod of the Pact Keeper +" bonus) ::type :rod @@ -347,7 +374,8 @@ direction to the closest dragon within 30 miles of you that is of the same type :frequency units5e/long-rests-1 :summary "Regain a warlock spell slot"})] ::summary (str (common/bonus-str bonus) - " to spell attack rolls and saving throw DCs for your warlock spells")}) + " to spell attack rolls and saving throw DCs for your warlock spells") + }) (defn ioun-stone [name rarity description & modifiers] (let [full-name (str "Ioun Stone (" name ")")] @@ -425,7 +453,7 @@ Curse. This armor is cursed, a fact that is revealed only when an identify spell ::description (str "You have resistance to " (name damage-type) " damage.") }) damage-types5e/damage-types)) - + (def raw-magic-items (concat armors-of-resistance @@ -658,7 +686,7 @@ If you aren’t a dwarf, you gain the following additional benefits while wearin ::attunement [:any] ::modifiers [(belt-of-giant-strength-mod 23)] - + ::description "While wearing this belt, your Strength score changes to 23. If your Strength is already equal to or greater than 23, the item has no effect on you." } { @@ -770,6 +798,9 @@ The bowl is about 1 foot in diameter and half as deep. It weighs 3 pounds and ho ::rarity :uncommon ::attunement [:any] + ::modifiers [(mod5e/weapon-proficiency :longbow) + (mod5e/weapon-proficiency :shortbow) + (mod5e/weapon-damage-bonus-mod #{:longbow :shortbow} 2)] ::description "While wearing these bracers, you have proficiency with the longbow and shortbow, and you gain a +2 bonus to damage rolls on ranged attacks made with such weapons." }{ name-key "Bracers of Defense" @@ -825,7 +856,7 @@ Alternatively, when you light the candle for the first time, you can cast the ga name-key "Cape of the Mountebank" ::type :wondrous-item ::rarity :rare - ::modifiers [(mod5e/action + ::modifiers [(mod5e/action {:name "Cape of the Mountebank" :page 157 :source :dmg @@ -857,7 +888,7 @@ The chime can be used ten times. After the tenth time, it cracks and becomes use name-key "Circlet of Blasting" ::type :wondrous-item ::rarity :uncommon - ::modifiers [(mod5e/action + ::modifiers [(mod5e/action {:name "Circlet of Blasting" :page 158 :source :dmg @@ -872,7 +903,7 @@ The chime can be used ten times. After the tenth time, it cracks and becomes use ::attunement [:any] ::modifiers [(mod5e/damage-resistance :poison) - (mod5e/action + (mod5e/action {:name "Cloak of Arachnidia" :page 158 :source :dmg @@ -939,7 +970,7 @@ shifts to camouflage you. Pulling the hood up or down requires an action."} ::rarity :rare ::attunement [:any] - ::modifiers [(mod5e/action + ::modifiers [(mod5e/action {:name "Cloak of the Bat" :page 159 :source :dmg @@ -1519,7 +1550,6 @@ While focusing on a creature with detect thoughts, you can use an action to cast ::magical-attack-bonus 3 ::magical-damage-bonus 3 ::description "You gain a +3 bonus to attack and damage rolls made with this magic weapon. When you hit a fiend or an undead with it, that creature takes an extra 2d10 radiant damage. ->>>>>>> master While you hold the drawn sword, it creates an aura in a 10-foot radius around you. You and all creatures friendly to you in the aura have advantage on saving throws against spells and other magical effects. If you have 17 or more levels in the paladin class, the radius of the aura increases to 30 feet." }{ @@ -2107,7 +2137,7 @@ If you die while wearing the ring, your soul enters it, unless it already houses ::type :ring ::rarity :very-rare ::attunement [:any] - ::attunement-details "requires attunement outdoors at night" + ::attunement-details "requires attunement outdoors at night" ::description "While wearing this ring in dim light or darkness, you can cast dancing lights and light from the ring at will. Casting either spell from the ring requires an action. The ring has 6 charges for the following other properties. The ring regains 1d6 expended charges daily at dawn. Faerie Fire. You can expend 1 charge as an action to cast faerie fire from the ring. @@ -2497,20 +2527,20 @@ Retributive Strike. You can use an action to break the staff over your knee or a You have a 50 percent chance to instantly travel to a random plane of existence, avoiding the explosion. If you fail to avoid the effect, you take force damage equal to 16 × the number of charges in the staff. Every other creature in the area must make a DC 17 Dexterity saving throw. On a failed save, a creature takes an amount of damage based on how far away it is from the point of origin, as shown in the following table. On a successful save, a creature takes half as much damage." }{ name-key "Staff of Striking" - ::type :weapon - ::item-subtype :staff - ::rarity :very-rare + ::type :weapon + ::item-subtype :staff + ::rarity :very-rare - ::attunement [:any] - ::magical-attack-bonus 3 - ::magical-damage-bonus 3 - ::description "This staff can be wielded as a magic quarterstaff that grants a +3 bonus to attack and damage rolls made with it. + ::attunement [:any] + ::magical-attack-bonus 3 + ::magical-damage-bonus 3 + ::description "This staff can be wielded as a magic quarterstaff that grants a +3 bonus to attack and damage rolls made with it. The staff has 10 charges. When you hit with a melee attack using it, you can expend up to 3 of its charges. For each charge you expend, the target takes an extra 1d6 force damage. The staff regains 1d6 + 4 expended charges daily at dawn. If you expend the last charge, roll a d20. On a 1, the staff becomes a nonmagical quarterstaff." }{ name-key "Staff of Swarming Insects" ::type :weapon ::item-subtype :staff - ::rarity :rare + ::rarity :rare ::attunement [:bard, :cleric, :druid, :sorcerer, :warlock, :wizard] ::description "This staff has 10 charges and regains 1d6 + 4 expended charges daily at dawn. If you expend the last charge, roll a d20. On a 1, a swarm of insects consumes and destroys the staff, then disperses. @@ -2525,7 +2555,14 @@ Insect Cloud. While holding the staff, you can use an action and expend 1 charge ::attunement [:sorcerer, :warlock, :wizard] ::magical-attack-bonus 2 ::magical-damage-bonus 2 - ::modifiers [(mod5e/spell-attack-modifier-bonus 2)] + ::modifiers [(mod5e/spell-attack-modifier-bonus 2) + (mod5e/saving-throw-advantage ["spells"]) + (mod5e/reaction + {:name "Staff of the Magi" + :page 203 + :source :dmg + :frequency units5e/long-rests-1 + :summary "Absorb spell cast by another creature, targetting only you. Cancel its effect and gain charges equal to absorbed spell's level. Staff explodes, as per Retributive Strike, if brought over 50 charges."})] ::description "This staff can be wielded as a magic quarterstaff that grants a +2 bonus to attack and damage rolls made with it. While you hold it, you gain a +2 bonus to spell attack rolls. The staff has 50 charges for the following properties. It regains 4d6 + 2 expended charges daily at dawn. If you expend the last charge, roll a d20. On a 20, the staff regains 1d12 + 1 charges. Spell Absorption. While holding the staff, you have advantage on saving throws against spells. In addition, you can use your reaction when another creature casts a spell that targets only you. If you do, the staff absorbs the magic of the spell, canceling its effect and gaining a number of charges equal to the absorbed spell’s level. However, if doing so brings the staff’s total number of charges above 50, the staff explodes as if you activated its retributive strike (see below). @@ -2612,7 +2649,7 @@ The staff can be wielded as a magic quarterstaff. On a hit, it deals damage as a ::magical-damage-bonus 2 ::magical-damage-type :radiant ::magical-finesse? true - + ::description "This item appears to be a longsword hilt. While grasping the hilt, you can use a bonus action to cause a blade of pure radiance to spring into existence, or make the blade disappear. While the blade exists, this magic longsword has the finesse property. If you are proficient with shortswords or longswords, you are proficient with the sun blade. You gain a +2 bonus to attack and damage rolls made with this weapon, which deals radiant damage instead of slashing damage. When you hit an undead with it, that target takes an extra 1d8 radiant damage. The sword’s luminous blade emits bright light in a 15-foot radius and dim light for an additional 15 feet. The light is sunlight. While the blade persists, you can use an action to expand or reduce its radius of bright and dim light by 5 feet each, to a maximum of 30 feet each or a minimum of 10 feet each." @@ -2646,12 +2683,12 @@ foot radius and dim light for an additional 10 feet. Speaking the command word a Once per turn, when you hit a creature with an attack using this magic weapon, you can wound the target. At the start of each of the wounded creature’s turns, it takes 1d4 necrotic damage for each time you’ve wounded it, and it can then make a DC 15 Constitution saving throw, ending the effect of all such wounds on itself on a success. Alternatively, the wounded creature, or a creature within 5 feet of it, can use an action to make a DC 15 Wisdom (Medicine) check, ending the effect of such wounds on it on a success." }{ name-key "Talisman of Pure Good" - ::type :wondrous-item + ::type :wondrous-item - ::rarity :legendary + ::rarity :legendary - ::attunement [:good] - ::description "This talisman is a mighty symbol of goodness. A creature that is neither good nor evil in alignment takes 6d6 radiant damage upon touching the talisman. An evil creature takes 8d6 radiant damage upon touching the talisman. Either sort of creature takes the damage again each time it ends its turn holding or carrying the talisman. + ::attunement [:good] + ::description "This talisman is a mighty symbol of goodness. A creature that is neither good nor evil in alignment takes 6d6 radiant damage upon touching the talisman. An evil creature takes 8d6 radiant damage upon touching the talisman. Either sort of creature takes the damage again each time it ends its turn holding or carrying the talisman. If you are a good cleric or paladin, you can use the talisman as a holy symbol, and you gain a +2 bonus to spell attack rolls while you wear or hold it. The talisman has 7 charges. If you are wearing or holding it, you can use an action to expend 1 charge from it and choose one creature you can see on the ground within 120 feet of you. If the target is of evil alignment, a flaming fissure opens under it. The target must succeed on a DC 20 Dexterity saving throw or fall into the fissure and be destroyed, leaving no remains. The fissure then closes, leaving no trace of its existence. When you expend the last charge, the talisman disperses into motes of golden light and is destroyed." }{ @@ -2816,25 +2853,17 @@ The wand regains 1d6 + 1 expended charges daily at dawn. If you expend the wand ::type :wand ::rarity :uncommon ::description "The wand has 3 charges. While holding it, you can use an action to expend 1 of its charges, and if a secret door or trap is within 30 feet of you, the wand pulses and points at the one nearest to you. The wand regains 1d3 expended charges daily at dawn." - }{ - name-key "Wand of the War Mage, +1" - ::type :wand - ::rarity :uncommon - ::attunement [:spellcaster] - ::description "While holding this wand, you gain a +1 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack." - }{ - name-key "Wand of the War Mage, +2" - ::type :wand - ::rarity :rare - ::attunement [:spellcaster] - ::description "While holding this wand, you gain a +2 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack." - }{ - name-key "Wand of the War Mage, +3" - ::type :wand - ::rarity :very-rare - ::attunement [:spellcaster] - ::description "While holding this wand, you gain a +3 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack." - }{ + } + (caster-bonus-item "Wand of the War Mage" 1 :wand :rare [:spellcaster] + [:sp-atk-mod] + "While holding this wand, you gain a +1 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack.") + (caster-bonus-item "Wand of the War Mage" 2 :wand :rare [:spellcaster] + [:sp-atk-mod] + "While holding this wand, you gain a +2 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack.") + (caster-bonus-item "Wand of the War Mage" 3 :wand :rare [:spellcaster] + [:sp-atk-mod] + "While holding this wand, you gain a +3 bonus to spell attack rolls. In addition, you ignore half cover when making a spell attack.") + { name-key "Wand of Web" ::type :wand ::rarity :uncommon @@ -2966,7 +2995,7 @@ The boots regain 2 hours of flying capability for every 12 hours they aren’t i (throw (IllegalArgumentException. (str "No base types matched for weapon item!: " (::name item)))))) (map (fn [weapon] - (let [name (if name-fn + (let [name (if name-fn (name-fn weapon) (if (> (count of-type) 1) (str (name-key item) ", " (:name weapon)) @@ -3014,7 +3043,7 @@ The boots regain 2 hours of flying capability for every 12 hours they aren’t i (map (fn [armor] (let [name (if (> (count of-type) 1) - (if name-fn + (if name-fn (name-fn armor) (str (name-key item) ", " (:name armor))) (name-key item)) diff --git a/src/cljc/orcpub/dnd/e5/modifiers.cljc b/src/cljc/orcpub/dnd/e5/modifiers.cljc index 73a5fabf3..5854aa61c 100644 --- a/src/cljc/orcpub/dnd/e5/modifiers.cljc +++ b/src/cljc/orcpub/dnd/e5/modifiers.cljc @@ -545,6 +545,16 @@ (defn attack-modifier-fn [bonus-fn] (mods/vec-mod ?attack-modifier-fns bonus-fn)) +(defn + ^{:doc "For applying generic damage bonuses from various sources, to various sources. Controlled by functions to filter or specify conditions" + :user/comment "May be best to keep this and remove melee-damage-bonus-fn (and never add the ranged-damage-bonus-fn). Undecided."} + + damage-bonus-fn [bonus-fn] + (mods/vec-mod ?damage-bonus-fns bonus-fn)) + +(defn melee-damage-bonus-fn [bonus-fn] + (mods/vec-mod ?melee-damage-bonus-fns bonus-fn)) + (defn armored-ac-bonus [bonus] (mods/cum-sum-mod ?armored-ac-bonus bonus)) @@ -586,6 +596,28 @@ (let [flat-mappings (conj (vec (apply concat (sort-by first > (dissoc mappings :default)))) (:default mappings))] `(condp <= ~level ~@flat-mappings))) +(defn + ^{:doc "Function that allows application of attack modifiers to specific weapons." + :user/comment "Moved from a disused, soon to be trimmed, namespace."} + + weapon-attack-bonus-mod [weapons bonus] + (attack-modifier-fn + (fn [{kw :key base-kw :base-key}] + (if (weapons kw) + bonus + 0)))) + +(defn + ^{:doc "Function that allows application of damage bonuses to specific weapons." + :user/comment "Duplicated from weapon-attack-bonus-mod. May be better to combine the two with a third arg to differentiate"} + + weapon-damage-bonus-mod [weapons bonus] + (damage-bonus-fn + (fn [{kw :key base-kw :base-key}] + (if (weapons kw) + bonus + 0)))) + (def mods-map {:ability ability :ability-override ability-override diff --git a/src/cljc/orcpub/dnd/e5/options.cljc b/src/cljc/orcpub/dnd/e5/options.cljc index 527a7f716..cd4bcbe7f 100644 --- a/src/cljc/orcpub/dnd/e5/options.cljc +++ b/src/cljc/orcpub/dnd/e5/options.cljc @@ -1705,7 +1705,27 @@ :modifiers [(modifiers/trait-cfg {:name "Dueling Fighting Style" :page 72 - :description "When you are wielding a melee weapon in one hand and no other weapons, you gain a +2 bonus to damage rolls with that weapon."})]}) + :description "When you are wielding a melee weapon in one hand and no other weapons, you gain a +2 bonus to damage rolls with that weapon."}) + (mods/vec-mod ?damage-bonus-fns ;vec-mod prop + (fn [weapon _] (if (or (weapon ::weapons/two-handed?) + (weapon ::weapons/ranged?)) 0 2)) ;vec-mod val ... maybe? + nil ;vec-mod nm + nil ;vec-mod value ... maybe? + [(let [main-hand-weapon ?orcpub.dnd.e5.character/main-hand-weapon + off-hand-weapon ?orcpub.dnd.e5.character/off-hand-weapon + all-weapons-map @(subscribe [::mi/all-weapons-map])] + (and (and main-hand-weapon + (-> all-weapons-map + main-hand-weapon + ::weapons/melee?) + (not (-> all-weapons-map + main-hand-weapon + ::weapons/two-handed?))) + (and off-hand-weapon + (not (-> all-weapons-map ;ensure no weapons in off hand + off-hand-weapon + ::weapons/type)))))]) + ]}) (t/option-cfg {:name "Great Weapon Fighting" :modifiers [(modifiers/trait-cfg diff --git a/src/cljc/orcpub/dnd/e5/template_base.cljc b/src/cljc/orcpub/dnd/e5/template_base.cljc index e080ff2f3..362f6760e 100644 --- a/src/cljc/orcpub/dnd/e5/template_base.cljc +++ b/src/cljc/orcpub/dnd/e5/template_base.cljc @@ -224,8 +224,19 @@ (let [definitely-finesse? (and finesse? (::weapon5e/finesse? weapon)) melee? (::weapon5e/melee? weapon)] - (+ (or (::mi5e/magical-damage-bonus weapon) 0) - (?weapon-ability-damage-modifier weapon definitely-finesse? off-hand?)))) + (apply + + (+ (or (::mi5e/magical-damage-bonus weapon) 0) + (?weapon-ability-damage-modifier weapon definitely-finesse? off-hand?)) + ;(if melee? + ; (map + ; #(% weapon) + ; ?melee-damage-bonus-fns) + ; (map + ; #(% weapon) + ; ?ranged-damage-bonus-fns)) ;any non-melee is assumed to be ranged/finesse/dex + (map + #(% weapon) + ?damage-bonus-fns)))) ?best-weapon-damage-modifier (fn [weapon & [off-hand?]] (max (?weapon-damage-modifier weapon false off-hand?) (?weapon-damage-modifier weapon true off-hand?))) diff --git a/src/cljc/orcpub/dnd/e5/weapons.cljc b/src/cljc/orcpub/dnd/e5/weapons.cljc index c0006cd8e..55d953370 100644 --- a/src/cljc/orcpub/dnd/e5/weapons.cljc +++ b/src/cljc/orcpub/dnd/e5/weapons.cljc @@ -226,7 +226,7 @@ ::melee? true ::finesse? false :key :longsword - ::link "https://en.wikipedia.org/wiki/Sword"} + ::link "https://en.wikipedia.org/wiki/Sword"} {:name "Maul", ::damage-type :bludgeoning, ::damage-die 6, diff --git a/src/cljc/orcpub/pdf_spec.cljc b/src/cljc/orcpub/pdf_spec.cljc index 46ed91045..181282106 100644 --- a/src/cljc/orcpub/pdf_spec.cljc +++ b/src/cljc/orcpub/pdf_spec.cljc @@ -292,6 +292,7 @@ print-prepared-spells? prepares-spells prepared-spells-by-class] + (let [flat-spells (char5e/flat-spells spells-known) spells-map @(subscribe [::spells/spells-map]) plugin-spells-map @(subscribe [::spells/plugin-spells-map]) @@ -379,14 +380,17 @@ spell-pages))))) (defn spellcasting-fields [built-char print-prepared-spells?] - (let [spells-known (char5e/spells-known built-char) - spell-attack-modifier-fn (char5e/spell-attack-modifier-fn built-char) + (let [spell-attack-modifier-fn (char5e/spell-attack-modifier-fn built-char) spell-save-dc-fn (char5e/spell-save-dc-fn built-char) spell-slots (char5e/spell-slots built-char) prepares-spells (char5e/prepares-spells built-char) - prepared-spells-by-class (char5e/prepared-spells-by-class built-char)] + prepared-spells-by-class (char5e/prepared-spells-by-class built-char) + sorted-spells-known (into {} + (map (fn [[id datum]] + [id (into (sorted-map) datum)])) + (char5e/spells-known built-char))] - (spell-page-fields spells-known + (spell-page-fields sorted-spells-known spell-slots spell-save-dc-fn spell-attack-modifier-fn @@ -498,7 +502,8 @@ print-spell-cards? print-prepared-spells? print-large-abilities? - print-character-sheet-style?] :as options}] + print-character-sheet-style? + print-spell-card-dc-mod?] :as options}] (let [race (char5e/race built-char) subrace (char5e/subrace built-char) abilities (abilities-spec @@ -572,7 +577,9 @@ :faction-name (char5e/faction-name built-char) :print-character-sheet? print-character-sheet? :print-spell-cards? print-spell-cards? - :print-character-sheet-style? print-character-sheet-style?} + :print-character-sheet-style? print-character-sheet-style? + :print-spell-card-dc-mod? print-spell-card-dc-mod? + } (attacks-and-spellcasting-fields built-char) (skill-fields built-char) abilities diff --git a/src/cljs/orcpub/dnd/e5/events.cljs b/src/cljs/orcpub/dnd/e5/events.cljs index 2908cbcd7..58d48455a 100644 --- a/src/cljs/orcpub/dnd/e5/events.cljs +++ b/src/cljs/orcpub/dnd/e5/events.cljs @@ -3791,6 +3791,16 @@ (fn [db _] (update db ::char5e/exclude-spell-cards-print? not))) +(reg-event-db + ::char5e/toggle-spell-cards-by-level + (fn [db _] + (update db ::char5e/exclude-spell-cards-by-level? not))) + +(reg-event-db + ::char5e/toggle-spell-cards-by-dc-mod + (fn [db _] + (update db ::char5e/exclude-spell-cards-by-dc-mod? not))) + (reg-event-db ::char5e/toggle-large-abilities-print (fn [db _] diff --git a/src/cljs/orcpub/dnd/e5/subs.cljs b/src/cljs/orcpub/dnd/e5/subs.cljs index 0f7068658..daa40bf05 100644 --- a/src/cljs/orcpub/dnd/e5/subs.cljs +++ b/src/cljs/orcpub/dnd/e5/subs.cljs @@ -1196,6 +1196,12 @@ (fn [db _] (-> db ::char5e/exclude-spell-cards-print? not))) +(reg-sub + ::char5e/print-spell-card-dc-mod? + (fn [db _] + (-> db ::char5e/exclude-spell-cards-by-dc-mod? not))) + + (reg-sub ::char5e/print-character-sheet? (fn [db _] diff --git a/src/cljs/orcpub/dnd/e5/views.cljs b/src/cljs/orcpub/dnd/e5/views.cljs index 0dbd30d9d..4793c6d05 100644 --- a/src/cljs/orcpub/dnd/e5/views.cljs +++ b/src/cljs/orcpub/dnd/e5/views.cljs @@ -3476,14 +3476,16 @@ print-spell-cards? print-prepared-spells? print-large-abilities? - print-character-sheet-style?] + print-character-sheet-style? + print-spell-card-dc-mod?] #(let [export-fn (export-pdf built-char id {:print-character-sheet? print-character-sheet? :print-spell-cards? print-spell-cards? :print-prepared-spells? print-prepared-spells? :print-large-abilities? print-large-abilities? - :print-character-sheet-style? print-character-sheet-style?})] + :print-character-sheet-style? print-character-sheet-style? + :print-spell-card-dc-mod? print-spell-card-dc-mod?})] (export-fn) (dispatch [::char/hide-options]))) @@ -3508,6 +3510,7 @@ print-prepared-spells? @(subscribe [::char/print-prepared-spells?]) print-large-abilities? @(subscribe [::char/print-large-abilities?]) print-character-sheet-style? @(subscribe [::char/print-character-sheet-style?]) + print-spell-card-dc-mod? @(subscribe [::char/print-spell-card-dc-mod?]) has-spells? (seq (char/spells-known built-char)) print-button-enabled (if (or (= print-character-sheet-style? nil) (= (str print-character-sheet-style?) "NaN")) @@ -3539,6 +3542,14 @@ [labeled-checkbox "Print Spell Cards" print-spell-cards?]]]]) + (if print-spell-cards? + [:div.m-b-2 + [:div.flex + [:div + {:on-click (make-event-handler ::char/toggle-spell-cards-by-dc-mod)} + [labeled-checkbox + "Print Spell DC and MOD" + print-spell-card-dc-mod?]]]]) (if has-spells? [:div.m-b-10 [:div.m-b-10 @@ -3565,7 +3576,8 @@ print-spell-cards? print-prepared-spells? print-large-abilities? - print-character-sheet-style?)} + print-character-sheet-style? + print-spell-card-dc-mod?)} "Print"]]])) (defn make-print-handler [id built-char] @@ -7522,7 +7534,8 @@ {:print-character-sheet? true :print-spell-cards? true :print-prepared-spells? false - :print-character-sheet-style? 1})} + :print-character-sheet-style? 1 + :print-spell-card-dc-mod? true})} "print"] (if (= username owner) [:button.form-button.m-l-5 diff --git a/src/cljs/orcpub/ver.cljc b/src/cljs/orcpub/ver.cljc index 2df36b6ae..f02402555 100644 --- a/src/cljs/orcpub/ver.cljc +++ b/src/cljs/orcpub/ver.cljc @@ -1,5 +1,5 @@ (ns orcpub.ver) ; To be updated by build server -(defn version [] "v2.5.0.20") -(defn date [] "12-28-2020") +(defn version [] "v2.5.0.21") +(defn date [] "03-28-2021") (defn description [] "") \ No newline at end of file