DragonDice

Check-in [7560d20b5b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Commands to edit professions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7560d20b5b966fb8c2d806ba8f1ab5df7afbef29c02c744566e1180effd11b93
User & Date: murphy 2020-04-28 22:55:11
Context
2020-04-28
23:03
Corrected computation of race without subrace check-in: 58a729d0be user: murphy tags: trunk
22:55
Commands to edit professions check-in: 7560d20b5b user: murphy tags: trunk
22:34
Renamed /addhp command to /bolster check-in: cd3a5dcd87 user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to DragonDice.Bot/Session.fs.

216
217
218
219
220
221
222


223
224
225
226
227
228
229
...
748
749
750
751
752
753
754





















































755
756
757
758
759
760
761
...
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
/open5e <i>QUERY</i> — Import a new character from Open5e and select it for the user who is asking.
/setname <i>NAME</i> — Change the name of the active character.
/setrace <i>RACE</i> — Change the race of the active character. This operation does not work on imported characters.
/set ac =|+=|-= <i>N</i> — Change the armor class of the active character.
/set hp =|+=|-= <i>N</i> — Change the maximum hit points of the active character.
/set <i>SPEED</i> =|+=|-= <i>N</i> — Change a movement speed of the active character.
/set <i>ABILITY</i> =|+=|-= <i>N</i> — Change an ability score of the active character.


/addproficiency <i>SKILL</i> [, <i>N</i>] — Add a proficiency in the given skill, optionally with a multiplier, to the active character. This operation does not work on imported characters.
/removeproficiency <i>SKILL</i> — Remove the proficiency in the given skill from the active character. This operation does not work on imported characters.
/set <i>SKILL</i> =|+=|-= <i>N</i> — Change a skill proficiency modifier of the active character.
/adddefense <i>DAMAGE</i>, <i>DEFENSE</i> — Add a defense against <i>DAMAGE</i> for the active character. <i>DEFENSE</i> may be a numerical factor or one of the adjectives <i>Normal</i>, <i>Immune</i>, <i>Invulnerable</i>, <i>Resistant</i>, <i>Vulnerable</i>.
/removedefense <i>DAMAGE</i> — Remove the defense against <i>DAMAGE</i> for the active character.
/set <i>SENSE</i> =|+=|-= <i>N</i> — Change a perception sense range of the active character.
/addlanguage <i>NAME</i> — Add a language proficiency to the active character.
................................................................................
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Defenses = ").Length
        for damage, f in chr.Defenses do
          if buffer.Length > pos then buffer.Append(", ") |> ignore
          buffer.Append(Defense.toString f).Append(" against ").Append(Damage.toString damage) |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)





















































      
      | ["/addproficiency" | "/removeproficiency"] ->
        return Markup (
          "<b>Note:</b> Select a skill proficiency",
          Skill.All
          |> Set.remove Skill.StrengthAttack
          |> Set.remove Skill.DexterityAttack
................................................................................
        let dup s = s, s
        return Markup (
          "<b>Note:</b> Select a language proficiency",
          [
            yield!
              Language.Standard
              |> Seq.chunkBySize 4
              |> Seq.map (Array.map dup >> List.ofArray)
            yield!
              Language.Exotic
              |> Seq.chunkBySize 4
              |> Seq.map (Array.map dup >> List.ofArray)
            yield
              Language.Secret
              |> Seq.map dup
              |> Seq.toList
          ]
        )
        







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|



|







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
...
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
/open5e <i>QUERY</i> — Import a new character from Open5e and select it for the user who is asking.
/setname <i>NAME</i> — Change the name of the active character.
/setrace <i>RACE</i> — Change the race of the active character. This operation does not work on imported characters.
/set ac =|+=|-= <i>N</i> — Change the armor class of the active character.
/set hp =|+=|-= <i>N</i> — Change the maximum hit points of the active character.
/set <i>SPEED</i> =|+=|-= <i>N</i> — Change a movement speed of the active character.
/set <i>ABILITY</i> =|+=|-= <i>N</i> — Change an ability score of the active character.
/addlevel <i>CLASS</i> [, <i>N</i>] — Add one or more levels in the given class to the active character. This operation does not work on imported characters.
/removelevel <i>CLASS</i> [, <i>N</i>] — Remove one or more levels in the given class to the active character. This operation does not work on imported characters.
/addproficiency <i>SKILL</i> [, <i>N</i>] — Add a proficiency in the given skill, optionally with a multiplier, to the active character. This operation does not work on imported characters.
/removeproficiency <i>SKILL</i> — Remove the proficiency in the given skill from the active character. This operation does not work on imported characters.
/set <i>SKILL</i> =|+=|-= <i>N</i> — Change a skill proficiency modifier of the active character.
/adddefense <i>DAMAGE</i>, <i>DEFENSE</i> — Add a defense against <i>DAMAGE</i> for the active character. <i>DEFENSE</i> may be a numerical factor or one of the adjectives <i>Normal</i>, <i>Immune</i>, <i>Invulnerable</i>, <i>Resistant</i>, <i>Vulnerable</i>.
/removedefense <i>DAMAGE</i> — Remove the defense against <i>DAMAGE</i> for the active character.
/set <i>SENSE</i> =|+=|-= <i>N</i> — Change a perception sense range of the active character.
/addlanguage <i>NAME</i> — Add a language proficiency to the active character.
................................................................................
        let buffer = Text.StringBuilder("<i>").Append(HttpUtility.HtmlEncode chr.Name).Append("</i> : ")
        let pos = buffer.Append("Defenses = ").Length
        for damage, f in chr.Defenses do
          if buffer.Length > pos then buffer.Append(", ") |> ignore
          buffer.Append(Defense.toString f).Append(" against ").Append(Damage.toString damage) |> ignore
        if buffer.Length = pos then buffer.Append("None") |> ignore
        return Markup (buffer.ToString(), List.empty)
        
      | ["/addlevel" | "/removelevel"] ->
        return Markup (
          "<b>Note:</b> Select a character class",
          Profession.All
          |> Seq.chunkBySize 2
          |> Seq.map (
            Seq.map (fun prof ->
              let s = Profession.toString prof
              (s, s)
            )
            >> Seq.toList
          )
          |> Seq.toList
        )
        
      | ["/addlevel"; prof] ->
        let chr = selectedCharacter user
        let prof = Profession.ofString prof
        chr.AddLevel(prof)
        return Markup (
          sprintf "<i>%s</i> : Profession = %s" (HttpUtility.HtmlEncode chr.Name) chr.Profession,
          List.empty
        )
        
      | ["/addlevel"; prof; count] ->
        let chr = selectedCharacter user
        let prof = Profession.ofString prof
        let count = int count
        chr.AddLevel(prof, count)
        return Markup (
          sprintf "<i>%s</i> : Profession = %s" (HttpUtility.HtmlEncode chr.Name) chr.Profession,
          List.empty
        )
        
      | ["/removelevel"; prof] ->
        let chr = selectedCharacter user
        let prof = Profession.ofString prof
        chr.RemoveLevel(prof)
        return Markup (
          sprintf "<i>%s</i> : Profession = %s" (HttpUtility.HtmlEncode chr.Name) chr.Profession,
          List.empty
        )
        
      | ["/removelevel"; prof; count] ->
        let chr = selectedCharacter user
        let prof = Profession.ofString prof
        let count = int count
        chr.RemoveLevel(prof, count)
        return Markup (
          sprintf "<i>%s</i> : Profession = %s" (HttpUtility.HtmlEncode chr.Name) chr.Profession,
          List.empty
        )
      
      | ["/addproficiency" | "/removeproficiency"] ->
        return Markup (
          "<b>Note:</b> Select a skill proficiency",
          Skill.All
          |> Set.remove Skill.StrengthAttack
          |> Set.remove Skill.DexterityAttack
................................................................................
        let dup s = s, s
        return Markup (
          "<b>Note:</b> Select a language proficiency",
          [
            yield!
              Language.Standard
              |> Seq.chunkBySize 4
              |> Seq.map (Seq.map dup >> Seq.toList)
            yield!
              Language.Exotic
              |> Seq.chunkBySize 4
              |> Seq.map (Seq.map dup >> Seq.toList)
            yield
              Language.Secret
              |> Seq.map dup
              |> Seq.toList
          ]
        )