modified function.js :Exalted

mindwrap
2005-08-27
2013-05-23
  • mindwrap

    mindwrap - 2005-08-27

    i changed the function.js for the dicetool.js so you have nice exalted commands:

    Exalted(dicepool,margin)
    meaning that you roll (dicepool) d10 and get a result of one per roll over or equal the margin (usually 7) or a negative number, if you had no roll higher or equal to the margin but rolled 1's, meaning you get the degree of the fumble. and 10's count as two successes of course

    wound(number)
    rolls (number) dice against the margin of 6 without two successes for 10's.

    dawn(enemies,valor)
    for the dawn caste effect: standard output is the number of enemies that fail the valor roll (and get the -2 penalty) and writes the number of enemies who botch their roll and flee in terror.

    thanks for making this tool!
    by the way: is it possible to see a list of the individual rolls in the rightmost column?

    functions.js
    ------------------------------------------------------------------------------
    function registerFunctions() {
        var map = new java.util.HashMap();
        map.put("test01", test01);
        map.put("test02", test02);

        map.put("label", label);
        map.put("l", label);
       
        map.put("rr", rrLabel);
        map.put("manyAttack", manyAttack);

        map.put("Exalted", Exalted);
        map.put("wound", wound);
        map.put("dawn", dawn);

        return map;
    }

    function test01(a) {
        return a + 12;
    }

    function test02(a) {
        row.setLabel("In JS");
        row.setForegroundColor(255, 0, 0);
        row.setBackgroundColor(0, 255, 0);
        return a + 1;
    }

    function label(a, lbl) {
        row.setLabel(lbl);
        return a;
    }

    function rrLabel(a, lbl) {
        row.setReRollExpression(lbl);
        return a;
    }

    function manyAttack(number, ab, critRange, ac) {
        var hits = 0;
        var crits = 0;

        for (var i = 0; i < number; i++) {
            var roll = rand.nextInt(20) + 1;
            var critRoll = rand.nextInt(20) + 1;
            if (roll == 20 || roll + ab >= ac) {
                hits++;
               
                if (roll >= critRange && (critRoll == 20 || critRoll + ab >= ac)) {
                    crits++;
                }
            }
        }

        if (crits > 0) {
            resultSet.addExpression("crits", String.valueOf(crits), null, crits);
        }
       
        return hits;
    }

    function Exalted(number, diff) {
    var hits = 0;
    var fumble = 0;

    for (var i = 0; i < number; i++) {
    var roll = rand.nextInt(10) + 1;
    if (roll >= diff) {
    hits++;

    if (roll ==10) { hits++;}
    if (roll ==1) {fumble--;}
    }
    if (roll ==1) {fumble--;}
    }

    if (hits ==0) {
    hits = fumble;
    }

    return hits;
    }

    function wound(number) {
    var hits = 0;
    var diff = 6;

    for (var i = 0; i < number; i++) {
    var roll = rand.nextInt(10) + 1;
    if (roll >= diff) {
    hits++;

    }
    }

    return hits;
    }

    function dawn(number, valor) {
        var miss = 0;
        var crits = 0;
        var diff = 7;
        for (var j = 0; j < number; j++) {
           
                      var hits = 0;
              var fumble = 0;
                      for (var i = 0; i < valor; i++) {
                      var roll = rand.nextInt(10) + 1;
                      if (roll >= diff) {
                      hits++;
                      
                      if (roll ==10) { hits++;}
                      if (roll ==1) {fumble--;}
                      }
                      if (roll ==1) {fumble--;}
                      }
                      
                      if (hits ==0) {
                      hits = fumble;
                      }

            var a = hits;

            if (a==0)   {miss++;}
            if (a <0)    {crits++;}   
        }

        if (crits > 0) {
            resultSet.addExpression("fleeing in horror", String.valueOf(crits), null, crits);
        }
       
        return miss;
    }

     
    • David Rice

      David Rice - 2005-08-31

      Very cool.  Glad to see someone is using it.

      Dicetool is fairly stable, so I am not sure when the next release will be, but I will get this functions added for that next release.

      ~Giliath

       
    • mindwrap

      mindwrap - 2005-08-31

      great! feeling honored.
      is there a way to see the individual dice results -say- in the third column?

      by the way, for people interrested in exalted stuff, there is an really nice tool over at http://anathema.sourceforge.net/

      mindwrap

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks