1.0.3 • Published 3 years ago

sandstone-score-template v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago