Skip to content

Commit

Permalink
Fix villager price can go negative (close #45)
Browse files Browse the repository at this point in the history
  • Loading branch information
VForiel committed Oct 7, 2023
1 parent c2dffe7 commit 09b054b
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@ scoreboard players operation #wallstreet.get_price.price data *= #wallstreet.get
scoreboard players operation #wallstreet.get_price.price data /= 1000 const
scoreboard players operation #wallstreet.get_price.price data /= 1000 const

# Apply limits
scoreboard players operation #wallstreet.get_price.max_price data = #wallstreet.get_price.global_price data
scoreboard players operation #wallstreet.get_price.max_price data *= 1500 const
scoreboard players operation #wallstreet.get_price.max_price data /= 1000 const
scoreboard players operation #wallstreet.get_price.max_price data /= 1000 const
scoreboard players operation #wallstreet.get_price.price data < #wallstreet.get_price.max_price data

scoreboard players operation #wallstreet.get_price.min_price data = #wallstreet.get_price.global_price data
scoreboard players operation #wallstreet.get_price.min_price data /= 2 const
scoreboard players operation #wallstreet.get_price.min_price data /= 1000 const
scoreboard players operation #wallstreet.get_price.price data > #wallstreet.get_price.min_price data

# Randomize
# scoreboard players operation #mean tmp = #wallstreet.get_price.price data
# scoreboard players operation #std tmp = #mean tmp
# scoreboard players operation #std tmp /= 10 const
# function #lib:random_normal
# scoreboard players operation #wallstreet.get_price.price data = #mean tmp
scoreboard players operation #mean tmp = #wallstreet.get_price.price data
scoreboard players operation #std tmp = #mean tmp
scoreboard players operation #std tmp /= 10 const
function #lib:random_normal
scoreboard players operation #wallstreet.get_price.price data = #x tmp

# Apply limits
# scoreboard players operation #wallstreet.get_price.max_price data = #wallstreet.get_price.global_price data
# scoreboard players operation #wallstreet.get_price.max_price data *= 1500 const
# scoreboard players operation #wallstreet.get_price.max_price data /= 1000 const
# scoreboard players operation #wallstreet.get_price.max_price data /= 1000 const
# scoreboard players operation #wallstreet.get_price.price data < #wallstreet.get_price.max_price data

# scoreboard players operation #wallstreet.get_price.min_price data = #wallstreet.get_price.global_price data
# scoreboard players operation #wallstreet.get_price.min_price data /= 2 const
# scoreboard players operation #wallstreet.get_price.max_price data /= 1000 const
# scoreboard players operation #wallstreet.get_price.min_price data < 1 const
# scoreboard players operation #wallstreet.get_price.price data > #wallstreet.get_price.min_price data
scoreboard players operation #wallstreet.get_price.price data > 1 const

0 comments on commit 09b054b

Please sign in to comment.