Skip to content

Instantly share code, notes, and snippets.

@aloisdg
Created April 26, 2018 21:20
Show Gist options
  • Save aloisdg/1bd5f3c6ccda928e4d292458ed2c82fe to your computer and use it in GitHub Desktop.
Save aloisdg/1bd5f3c6ccda928e4d292458ed2c82fe to your computer and use it in GitHub Desktop.
open System
let withCommandWord isThereACommandWord cost =
cost * (if isThereACommandWord then 1800 else 2000)
let withNumberOfCharges numberOfCharge cost =
cost / 5 * numberOfCharge
let addComponentCost componentCost cost =
componentCost + cost
let createAnItemWithCharge spellLevel creatorLevel componentCost charge isThereACommandWord =
spellLevel * creatorLevel
|> withCommandWord isThereACommandWord
|> withNumberOfCharges charge
|> addComponentCost componentCost
let createWand spellLevel creatorLevel componentCost =
let modifier = 750 / (if spellLevel = 0 then 2 else 1)
modifier * spellLevel * creatorLevel
|> addComponentCost componentCost
let brewPotion spellLevel creatorLevel componentCost =
let modifier = 50 / (if spellLevel = 0 then 2 else 1)
modifier * spellLevel * creatorLevel
|> addComponentCost componentCost
let writeScroll spellLevel creatorLevel componentCost =
let modifier = 25 / (if spellLevel = 0 then 2 else 1)
modifier * spellLevel * creatorLevel
|> addComponentCost componentCost
[<EntryPoint>]
let main args =
// http://www.pathfinder-fr.org/Wiki/Pathfinder-RPG.Cape%20de%20prestidigitateur.ashx
(* let spellLevel = 4
let creatorLevel = 7
let componentCost = 0
let charge = 1
let isThereACommandWord = true
*)
let spellLevel = 1
let creatorLevel = 1
let componentCost = 0
let charge = 3
let isThereACommandWord = false
createAnItemWithCharge spellLevel creatorLevel componentCost charge isThereACommandWord
|> printfn "%d"
createWand spellLevel creatorLevel componentCost
|> printfn "%d"
createWand 0 1 0
|> fun x -> x = 375
|> printfn "%b"
createWand 1 1 0
|> fun x -> x = 750
|> printfn "%b"
createWand 2 3 0
|> fun x -> x = 4500
|> printfn "%b"
createWand 3 5 0
|> fun x -> x = 11250
|> printfn "%b"
createWand 4 7 0
|> fun x -> x = 21000
|> printfn "%b"
brewPotion 0 1 0
|> fun x -> x = 25
|> printfn "%b"
brewPotion 1 1 0
|> fun x -> x = 50
|> printfn "%b"
brewPotion 2 3 0
|> fun x -> x = 300
|> printfn "%b"
brewPotion 3 5 0
|> fun x -> x = 750
|> printfn "%b"
(* writeScroll 0 1 0
|> fun x -> x = 12.5
|> printfn "%b"
*)
writeScroll 1 1 0
|> fun x -> x = 25
|> printfn "%b"
writeScroll 2 3 0
|> fun x -> x = 150
|> printfn "%b"
writeScroll 3 5 0
|> fun x -> x = 375
|> printfn "%b"
writeScroll 4 7 0
|> fun x -> x = 700
|> printfn "%b"
writeScroll 5 9 0
|> fun x -> x = 1125
|> printfn "%b"
writeScroll 6 11 0
|> fun x -> x = 1650
|> printfn "%b"
writeScroll 7 13 0
|> fun x -> x = 2275
|> printfn "%b"
writeScroll 8 15 0
|> fun x -> x = 3000
|> printfn "%b"
writeScroll 9 17 0
|> fun x -> x = 3825
|> printfn "%b"
// https://tio.run/##xZVRa9swEIDf/SuOQqHJSCw5cZOOJVDCGIOxhXWQh7EHJ5ZjMVsysjK3sP@eKVaayE3kaiujeTCxdP50950sJ2VvxQXZbnlBGNw9lJLknpcRCRWV6YznecTiBRcx0PJbSgS5NcdWvJQw8UD96r9duKLJ2UiZKjweIwQkKwkECKHOcZ3Pm3xJxJdklkZiTUpgjfuTZXwI1VLNIA2L4litWnBGmJztQldP7gyQOfGmntKMlSCRJLfso1Kx2EnQSZQFybJP5BfJdAQX@5vmCjr4nAK9roHpNkD17O@pi3cz9Kk6ncBjRLsPs96FYjvWqAvZPZrzmCaUCJjAKESqL7v2G5AJIN35QLcdd@pHD491n9fhUsFSkGrOJeXsJRW8YgGVoJLcrQTPspdUEISvUsH3d@@ZFA9zTpmc/qgLyiPKQG3EUiXq@5BKWbz1/aqq@kUk04SymIheIvpcrP0F/Un9@XH46/xDfxYV5DJA8e5SCFJKGtM1lWqfbkQ/KtN7D666ewGNYocHLw15an8eJ5oiAR1n9Ms7AXwYOvsigxQb4nU7h6hGCtiWAv6bFAbPpJBEqpuePsr@04H12P9CqMYmDC4u4wtzRfcjw4mEAO9FqMhkw@AeelN1US5G4SlheUrAVoI6nZwIAQwshGGI3BAD9XE6j8A4cExjCCMLI8DIlkc9ahyFdp9Bi04DYNfZVoYBsNscIDeCXaa1o/WoeaDaPeCg32LCZOB/cmkS7C5wm00TYZfR@oKYCPvGGiHHLEK4adnfboxrFWuDXLvqGAG2KQ0CVyFjpd@@Rx0zuQFs0zoYtzmpL2i7/QM
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment