1.0.3 • Published 4 years ago
sandstone-score-template v1.0.3
Example usage:
const percent = new ScoreTemplate('whole := whole * percent; whole /= 100')
percent.apply({
    whole: Objective.get('stats')('health'),
    percent: Objective.get('status')('poison')
})
percent.apply({
    whole: Objective.get('stats')('mana'),
    percent: 37
})The code above is equivalent to:
Objective.get('stats')('health')
    .multipliedBy(Objective.get('status')('poison'))
    .divide(100)
Objective.get('stats')('mana')
    .multipliedBy(37)
    .divide(100)Supported operators:
- +Add two sides, return new score
- -Subtract two sides, return new score
- *Multiply two sides, return new score
- /Divide two sides, return new score
- +=Add the right side to the left side
- -=Subtract the right side from the left side
- *=Multiply the left side by the right side
- /=Divide the left side by the right side
- =Set the score on the left side to the right side
- :=Set the identifier on the left side to the score on the right side