From f8fd7cd269bcc762e55d94f7a25f494ced5603ba Mon Sep 17 00:00:00 2001 From: ChrisTalbo850 <114689821+ChrisTalbo850@users.noreply.github.com> Date: Tue, 11 Oct 2022 11:21:30 -0600 Subject: [PATCH] Dice Roller 1.0 rolls any number of any existing dice with any modifier --- .../java/com/builder/DiceRoller/build.xml | 73 + .../DiceRoller/build/built-jar.properties | 4 + .../build/classes/diceroller/DiceRoller.class | Bin 0 -> 3184 bytes .../builder/DiceRoller/dist/DiceRoller.jar | Bin 0 -> 3254 bytes .../com/builder/DiceRoller/dist/README.TXT | 32 + .../java/com/builder/DiceRoller/manifest.mf | 3 + .../DiceRoller/nbproject/build-impl.xml | 1771 +++++++++++++++++ .../DiceRoller/nbproject/genfiles.properties | 8 + .../nbproject/private/private.properties | 2 + .../DiceRoller/nbproject/private/private.xml | 9 + .../DiceRoller/nbproject/project.properties | 95 + .../builder/DiceRoller/nbproject/project.xml | 15 + .../DiceRoller/src/diceroller/DiceRoller.java | 72 + 13 files changed, 2084 insertions(+) create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build.xml create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/built-jar.properties create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/classes/diceroller/DiceRoller.class create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/DiceRoller.jar create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/README.TXT create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/manifest.mf create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/build-impl.xml create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/genfiles.properties create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.properties create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.xml create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.properties create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.xml create mode 100644 dndcharacterbuilder/src/main/java/com/builder/DiceRoller/src/diceroller/DiceRoller.java diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build.xml b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build.xml new file mode 100644 index 0000000..7c16bdf --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project DiceRoller. + + + diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/built-jar.properties b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/built-jar.properties new file mode 100644 index 0000000..57eb5f2 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/built-jar.properties @@ -0,0 +1,4 @@ +#Thu, 06 Oct 2022 17:08:15 -0600 + + +C\:\\Users\\Christopher\\Documents\\NetBeansProjects\\DiceRoller= diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/classes/diceroller/DiceRoller.class b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/build/classes/diceroller/DiceRoller.class new file mode 100644 index 0000000000000000000000000000000000000000..51975ded16d08a2826f9d2665224485fad1701b0 GIT binary patch literal 3184 zcmb_e-E$k&75`mH)~?nIwl|R-DRvMLg1-_aDRqdQ1QHt;fgA_qIu$N$*4A3ySlV@0 z>(~ix`EDps`rQJhl%~uu)9FL|l6b<$AHXwDOy9~wXZqCFPAUD}-4(WDO`ker@4b8O z`S{)QJLhOW{?E;i0G!0T8e)hmNa$!oQlRsqdCAPzOsATkp1)`<_yWljwqyIJ1mgVz zvkFv!ZmG1MZ>-r=dt}C1_a|+uR?(nHSMA%plzfj`DsB@H_o?XMGNPi3%l#^L3B-;Z zR*{zLQ58L0kMcdkU`GxgR;+53T>|>dAdaacg9TE0xP!0!Hmo!T0X;wuX7)A3b|5XxpU3XX48Esr-`F};SxS0*$< z6_6aoli{+sU&nEb3Un}B$*Pfkt5Wc-`mJHZ${3TSb3$hk5uxh4p(_m!;6Vkab)3OC zgUPIWK`QeytzlNFFJ)4|`syzf2IdIh0X(E*5?>QY$K#Cb}fI}^UTYQpmJIn8f=Znb(Ane?(62VMP3(7|Ge!l zao6xo$EWcqaqr|}r=$fk0|K)$zTS) z{4E{d#)YVar>sW9tXlt%5}wsCj|Bx49TpZz+h$!(nf?-~^-QPYvb;E1CR9)Y198k6 zNMKeVG457aA00*8vBEZ8z6#f{Nj-L#!sr$w{= zWjNET(!s8+!z4Op2THF5A+RS%^v>zW2!Rqu2@6=N%P~WTs@#|CD+J!N-L^T*Xqx2o zsa0+bA2k|BmJ^Jz>BWhlWki7_Ht4b`P@5eQg_dnbXR$e{D4VI-DaOt+5xA}7n+wZR z=1P!C1q}sHDR`DGGiCWpZsnZmnRUyzJh}|LS(Ok+o9$GrbqY)Fs<&WG+LE0Pc_sl^ z-XY02-JEe^?2Cd~!k^)3s% zzP0ir#n9=)tfiXO*k5$r<<*s~Q#K-T%gwhLN}5`zZ!Lp}hpn9)xfnN@TidtBRQyu# zcdH_V7TmounhSTiV2-KyH7iU|sNxOIQ;}QaG|7ovlepmIH>6BZ`Al@-hlWE zH!;-sl*fRMdhiSs;K1cu3M=>ywP-B<&L-9=`|N!v?xgnAKCK38|WQPbS6JUj5c@BW=NXcNs~-Mn%qs3 z;nHZE$g~;vv~6JE{LpnA+`y3$DqP30>ll+S%5WrA)5)~5fm5TYOe(EzU}8j*61jai zliEP>CLRMu+tccs=*qOGwVU|5e18wS_$IZa=o?ZbGVR7(Vgpag+{A<2Ornc>1N^o@ zCw5~LX-uFSRb-f%UR*&Ru3{f+{|>x?9IoLm+`!%V0Q>PV4&YPH72ji&r%2-!T*P*6br!Xh<%QvMENiD z1Q1g(nt;j@COs8~LZS)5$-J|{sVlP`!sIv9=bQ@!+0_L343(eee@cGr zL?C^xvP1ifYBBp3+J~|?VFShN+u{Bq_d}bB3{jpY<}>7coE%NC9v{M9MwVUM9XbmT z$(v;v>Um<5tfvtBH#$gddy`lRCXQG5jNw)Mh-;2Sy+-|C1kYau&)0+Jo5AxfyiF~Q M8o$Hu@dsr73;Sp7@&Et; literal 0 HcmV?d00001 diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/DiceRoller.jar b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/DiceRoller.jar new file mode 100644 index 0000000000000000000000000000000000000000..f4823467ef637e869feda596a827cbeea29bdc37 GIT binary patch literal 3254 zcmaJ@+jARd75{yftd%!XohXhSUzBc}3%*HqF1W#tO&!N3B9?7x{EP|9#c` zTrP8*s%3swk6_a}1VALqu1HYCTyhR@7$s^wKS-L-&ES<5R4yo$5*b)0nBHWRSCyo@Z_|j=1lJtV&2LM>$P#bKI0^a|#!Z%7(+MNFjo2DV}YY zQ_SegI_5C1VIhI9;0=YB>f0;N(}cizrc-peKbRsn82OZ2B-*XBwqwl&iM3>|mMBTh zx;#pjP0yD8o-pcf*jz`)?2-J9(OsG6Q?R@Zdhk^_cI+gsKV>WyfJ zhwND6cGz<<#hYW%_N}ovh}$t)w(Mb5RB==Z6 z6`n6mJVd|^#I!<;4C~J54vcHkJ6G$COYcIhH__em485bxoz3ZI z$d1G~*xj>>OTZ3B(!WN6f*pL}DbnfRAjM947h^Jb`YCkj?qGsdXY(^m?&3?q2+dAX zb}F`uFYl>dpmm$5i}2Q-@I*~88wdn|NC3cHbg-S`;@jkE)AElPz%DZQ2T>PbZ-(H}c7?rH z@f2Uj9YQ;dU(wecQZa#_;u~y57{>>=2b1hg;|W$#AcuLpL)|+ht4RB9#GZ3{O@pPB z(xkCQ5>v6WZAr4m`zT}$KcPXC21eK4^?YO^J^118aB7g)=evKn`LpP~`6m(e^!dLB z|3aM*jCM}O`-fIn7{~}AxPmi;Ko-$YX^fKfAWV7<7Qul45Lr%?FiF5oL6`|NeT$T*|wXH=~{{pswz@gSc6_H^GH@A)&w!KRW1tD65lFewsVne>aq+qKF`|l5o!|^M^_p;>RDvYNP@=vU zlzvb?2+D^+`6wvg!FQ;uQ}4SZ{s-t>xTTufB78A^$`hU1{Ep*4lTz=$!ovr9-Sns@ zyBNs#?&ATL`=$*K_|KYLp1R>Dlk-7w@ZnpZTHeSnK7DJZ?>@eJ(6HeK2_C`=x0;0@ NG8)Bm*1rv={Xd%U=`#QT literal 0 HcmV?d00001 diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/README.TXT b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/README.TXT new file mode 100644 index 0000000..ff32cd4 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/dist/README.TXT @@ -0,0 +1,32 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "DiceRoller.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, these files (folders) +are not copied. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/manifest.mf b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/build-impl.xml b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/build-impl.xml new file mode 100644 index 0000000..700374c --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/genfiles.properties b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/genfiles.properties new file mode 100644 index 0000000..eb6265a --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=f2725b83 +build.xml.script.CRC32=6fed2c27 +build.xml.stylesheet.CRC32=f85dc8f2@1.101.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=f2725b83 +nbproject/build-impl.xml.script.CRC32=6f5873d9 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.101.0.48 diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.properties b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.properties new file mode 100644 index 0000000..6a597a9 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\Christopher\\AppData\\Roaming\\NetBeans\\12.6\\build.properties diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.xml b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.xml new file mode 100644 index 0000000..dc00c2f --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/private/private.xml @@ -0,0 +1,9 @@ + + + + + + file:/C:/Users/Christopher/Documents/NetBeansProjects/DiceRoller/src/diceroller/DiceRoller.java + + + diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.properties b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.properties new file mode 100644 index 0000000..c8a9832 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.properties @@ -0,0 +1,95 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/DiceRoller.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/DiceRoller +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=17 +javac.target=17 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=DiceRoller +main.class=diceroller.DiceRoller +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.xml b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.xml new file mode 100644 index 0000000..0da229f --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + DiceRoller + + + + + + + + + diff --git a/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/src/diceroller/DiceRoller.java b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/src/diceroller/DiceRoller.java new file mode 100644 index 0000000..44dc232 --- /dev/null +++ b/dndcharacterbuilder/src/main/java/com/builder/DiceRoller/src/diceroller/DiceRoller.java @@ -0,0 +1,72 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template + */ +package diceroller; + +import java.util.Arrays; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import javax.swing.JTextField; + +public class DiceRoller +{ + + public static void main(String[] args) + { + + JTextField diceNum = new JTextField(); + JTextField diceMod = new JTextField(); + String[] diceTypes = { "4", "6", "8", "10", "12", "20", "100"}; + JComboBox diceSize = new JComboBox(diceTypes); + Object[] fields = {"Number of dice", diceNum, "Type of dice", diceSize, "Modifier", diceMod}; + + + JOptionPane.showConfirmDialog(null, fields, "Dice Roller",JOptionPane.OK_CANCEL_OPTION); + + + int numberOfDice = Integer.parseInt(diceNum.getText()); + int sizeOfDice = Integer.parseInt(diceSize.getSelectedItem().toString()); + int modifier = Integer.parseInt(diceMod.getText()); + int[] diceRolls = rollDice(numberOfDice, sizeOfDice); + int rollTotal = rollTotal(diceRolls, modifier); + + String rollString = numberOfDice + "d" + sizeOfDice + modifierString(modifier) + "\nRolled: " + Arrays.toString(diceRolls) + "\nRoll Total"; + if (modifier == 0) + rollString += ": " + rollTotal; + else + rollString += " with " + modifierString(modifier) + " modifier: " + rollTotal; + JOptionPane.showMessageDialog(null,rollString,"Dice Rolls", JOptionPane.INFORMATION_MESSAGE); + } + + public static int[] rollDice(int numberOfDice, int sizeOfDice) + { + int[] diceRolls = new int[numberOfDice]; + for (int rolledDice = 0; rolledDice < diceRolls.length; rolledDice++) + { + diceRolls[rolledDice] = (int) (Math.random() * sizeOfDice) + 1; + } + return diceRolls; + } + + public static int rollTotal(int[] diceRolls, int modifier) + { + int rollTotal = 0; + for (int index = 0; index < diceRolls.length; index++) + { + rollTotal += diceRolls[index]; + } + rollTotal += modifier; + return rollTotal; + } + + public static String modifierString(int modifier) + { + String modifierString = ""; + if (modifier < 0) + modifierString += modifier; + if (modifier > 0) + modifierString+= "+" + modifier; + return modifierString; + } +}