Calling all Math majors. Star Wars Saga size modifier - DONE

Discussion of initiative tool.

Moderators: dorpond, Azhrei

Post Reply
User avatar
drswoboda
Dragon
Posts: 313
Joined: Tue Apr 25, 2006 12:54 pm
Location: Milwaukee, WI

Calling all Math majors. Star Wars Saga size modifier - DONE

Post by drswoboda »

Hello,

So I'm hoping that all the math smart users can chime in and help.

The size modifer progression has been changed from the D&D progression. The code Jay uses in v1.1 is for DnD and is similar to what is used in PCGen.

The new progression is as follows:
Colossal = -10 (old -8 )
Gartantuan = -5 (old -4 )
Huge = -2
Large = -1
Medium = 0
Small = 1
Tiny = 2
Diminutive = 5 (old 4)
Fine = 10 (old 8)

Here is the formula that Jay uses of DnD progression (calculation is in property for "sizeModifier"):

Code: Select all

<property name="size" type="MAP" group="Description">
        <properties>
          <property name="name">
            <description>Size of the creature.</description>
          </property>
          <property name="difference" type="SCRIPT">
            <description>Size difference from a medium sized creature</description>
            <script>JavaScript::        
            var Java = new JavaImporter(java.math);
            with (Java) {
              var value = 0;
              if (name != null) {
                if (name.equalsIgnoreCase("small")) {
                  value = -1;
                } else if (name.equalsIgnoreCase("tiny")) {
                  value = -2;
                } else if (name.equalsIgnoreCase("diminutive")) {
                  value = -3;
                } else if (name.equalsIgnoreCase("fine")) {
                  value = -4;
                } else if (name.equalsIgnoreCase("large")) {
                  value = 1;
                } else if (name.equalsIgnoreCase("huge")) {
                  value = 2;
                } else if (name.equalsIgnoreCase("gargantuan")) {
                  value = 3;
                } else if (name.equalsIgnoreCase("colossal")) {
                  value = 4;
                } // endif
              } // endif
              new BigDecimal(value);
            } // endwith</script>
          </property>
          <property name="specialSizeModifier" type="SCRIPT">
            <description>Size bonus for special actions like trip and bull rush.</description>
            <script>difference * 4</script>
          </property>
          <property name="sizeModifier" type="SCRIPT">
            <description>Size modifier used for AC</description>
            <script>if(lt(difference, 0), 1, -1) * floor(2^(abs(difference) - 1))</script>
          </property>
        </properties>
      </property>
I'm not a "forumla guy" ;) Can this be made into an easy formula or should I just hard code it with a bunch of CASE statements (or Java equivilant statements)?

Thank you,
-David
Last edited by drswoboda on Sat Jan 12, 2008 9:15 pm, edited 1 time in total.

User avatar
drswoboda
Dragon
Posts: 313
Joined: Tue Apr 25, 2006 12:54 pm
Location: Milwaukee, WI

Post by drswoboda »

Instead of a formula I used this code to figure the size modifier. It is the same code Jay used for figuring the differnce in D&D. So far it has worked okay.

-David

Code: Select all

      <property name="size" type="MAP" group="Description">
        <properties>
          <property name="name">
            <description>Size of the creature.</description>
          </property>
          <property name="difference" type="SCRIPT">
            <description>Size difference from a medium sized creature</description>
            <script>JavaScript::        
            var Java = new JavaImporter(java.math);
            with (Java) {
              var value = 0;
              if (name != null) {
                if (name.equalsIgnoreCase("small")) {
                  value = -1;
                } else if (name.equalsIgnoreCase("tiny")) {
                  value = -2;
                } else if (name.equalsIgnoreCase("diminutive")) {
                  value = -3;
                } else if (name.equalsIgnoreCase("fine")) {
                  value = -4;
                } else if (name.equalsIgnoreCase("large")) {
                  value = 1;
                } else if (name.equalsIgnoreCase("huge")) {
                  value = 2;
                } else if (name.equalsIgnoreCase("gargantuan")) {
                  value = 3;
                } else if (name.equalsIgnoreCase("colossal")) {
                  value = 4;
                } // endif
              } // endif
              new BigDecimal(value);
            } // endwith</script>
          </property>
          <property name="specialSizeModifier" type="SCRIPT">
            <description>Size bonus for special actions like trip and bull rush.</description>
            <script>difference * 4</script>
          </property>
          <property name="sizeModifier" type="SCRIPT">
            <description>Size modifier used for AC</description>
            <script>if(lt(difference, 0), 1, -1) * floor(2^(abs(difference) - 1))</script>
          </property>
          <property name="swsSizeModifier" type="SCRIPT">
            <description>Star Wars Sage: Smaller creatures are harder to hit than bigger ones. Added to Reflex Defense only.</description>
            <script>JavaScript::        
            var Java = new JavaImporter(java.math);
            with (Java) {
              var value = 0;
              if (name != null) {
                if (name.equalsIgnoreCase("small")) {
                  value = 1;
                } else if (name.equalsIgnoreCase("tiny")) {
                  value = 2;
                } else if (name.equalsIgnoreCase("diminutive")) {
                  value = 5;
                } else if (name.equalsIgnoreCase("fine")) {
                  value = 10;
                } else if (name.equalsIgnoreCase("large")) {
                  value = -1;
                } else if (name.equalsIgnoreCase("huge")) {
                  value = -2;
                } else if (name.equalsIgnoreCase("gargantuan")) {
                  value = -5;
                } else if (name.equalsIgnoreCase("colossal")) {
                  value = -10;
                } // endif
              } // endif
              new BigDecimal(value);
            } // endwith</script>
          </property>          
        </properties>
      </property>

Post Reply

Return to “InitiativeTool”