pets: take task reddness into account when calculating chance drop
This commit is contained in:
+41
-42
@@ -123,55 +123,54 @@ score = (model, taskId, direction, times, batch, cron) ->
|
||||
Drops
|
||||
###
|
||||
|
||||
# debugging purpose - 50% chance during development, 3% chance on prod
|
||||
chanceMultiplier = if (model.flags.nodeEnv is 'development') then 50 else 3
|
||||
|
||||
# % chance of getting a pet or meat
|
||||
if direction is 'up' and user.get('flags.dropsEnabled') and Math.random() < (.01 * chanceMultiplier)
|
||||
# current breakdown - 3% (adjustable) chance on drop
|
||||
# If they got a drop: 50% chance of egg, 50% Food. If food, broken down further even further
|
||||
rarity = Math.random()
|
||||
if direction is 'up'
|
||||
# debugging purpose - 50% chance during development, 3% chance on prod
|
||||
chanceMultiplier = if (model.flags.nodeEnv is 'development') then 50 else 1
|
||||
chanceMultiplier *= Math.abs(delta) # multiply chance by reddness
|
||||
if user.get('flags.dropsEnabled') and Math.random() < (.01 * chanceMultiplier)
|
||||
# current breakdown - 3% (adjustable) chance on drop
|
||||
# If they got a drop: 50% chance of egg, 50% Food. If food, broken down further even further
|
||||
rarity = Math.random()
|
||||
|
||||
# Egg, 40% chance
|
||||
if rarity > .6
|
||||
drop = randomVal(pets)
|
||||
user.push 'items.eggs', drop
|
||||
drop.type = 'Egg'
|
||||
drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}"
|
||||
# Egg, 40% chance
|
||||
if rarity > .6
|
||||
drop = randomVal(pets)
|
||||
user.push 'items.eggs', drop
|
||||
drop.type = 'Egg'
|
||||
drop.dialog = "You've found a #{drop.text} Egg! #{drop.notes}"
|
||||
|
||||
|
||||
# Food, 60% chance - break down by rarity even more. FIXME this may not be the best method, so revisit
|
||||
else
|
||||
acceptableDrops = []
|
||||
|
||||
# Tier 5 (Blue Moon Rare)
|
||||
if rarity < .1
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton', 'Zombie', 'CottonCandyPink', 'CottonCandyBlue', 'Golden']
|
||||
|
||||
# Tier 4 (Very Rare)
|
||||
else if rarity < .2
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton', 'Zombie', 'CottonCandyPink', 'CottonCandyBlue']
|
||||
|
||||
# Tier 3 (Rare)
|
||||
else if rarity < .3
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton']
|
||||
|
||||
# Tier 2 (Scarce)
|
||||
else if rarity < .4
|
||||
acceptableDrops = ['Base', 'White', 'Desert']
|
||||
# Tier 1 (Common)
|
||||
# Food, 60% chance - break down by rarity even more. FIXME this may not be the best method, so revisit
|
||||
else
|
||||
acceptableDrops = ['Base']
|
||||
acceptableDrops = []
|
||||
|
||||
acceptableDrops = _.filter(food, (foodItem) -> foodItem.name in acceptableDrops)
|
||||
drop = randomVal acceptableDrops
|
||||
user.push 'items.food', drop.name
|
||||
drop.type = 'Food'
|
||||
drop.dialog = "You've found #{drop.text} Hatching Powder! #{drop.notes}"
|
||||
# Tier 5 (Blue Moon Rare)
|
||||
if rarity < .1
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton', 'Zombie', 'CottonCandyPink', 'CottonCandyBlue', 'Golden']
|
||||
|
||||
# Tier 4 (Very Rare)
|
||||
else if rarity < .2
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton', 'Zombie', 'CottonCandyPink', 'CottonCandyBlue']
|
||||
|
||||
model.set '_drop', drop
|
||||
$('#item-dropped-modal').modal 'show'
|
||||
# Tier 3 (Rare)
|
||||
else if rarity < .3
|
||||
acceptableDrops = ['Base', 'White', 'Desert', 'Red', 'Shade', 'Skeleton']
|
||||
|
||||
# Tier 2 (Scarce)
|
||||
else if rarity < .4
|
||||
acceptableDrops = ['Base', 'White', 'Desert']
|
||||
# Tier 1 (Common)
|
||||
else
|
||||
acceptableDrops = ['Base']
|
||||
|
||||
acceptableDrops = _.filter(food, (foodItem) -> foodItem.name in acceptableDrops)
|
||||
drop = randomVal acceptableDrops
|
||||
user.push 'items.food', drop.name
|
||||
drop.type = 'Food'
|
||||
drop.dialog = "You've found #{drop.text} Hatching Powder! #{drop.notes}"
|
||||
|
||||
model.set '_drop', drop
|
||||
$('#item-dropped-modal').modal 'show'
|
||||
|
||||
return delta
|
||||
|
||||
|
||||
Reference in New Issue
Block a user