using Content.Shared.EntityEffects;
using Content.Shared.EntityEffects.Effects.Botany;
using Content.Shared.FixedPoint;
+using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
return;
var chemicals = entity.Comp.Seed.Chemicals;
- var randomChems = _proto.Index(args.Effect.RandomPickBotanyReagent).Fills;
+ var randomChems = _proto.Index(args.Effect.RandomPickBotanyReagent);
// Add a random amount of a random chemical to this set of chemicals
- var pick = _random.Pick(randomChems);
- var chemicalId = _random.Pick(pick.Reagents);
- var amount = _random.NextFloat(0.1f, (float)pick.Quantity);
+ var (chemicalId, quantity) = randomChems.Pick(_random);
+ var amount = FixedPoint2.Max(_random.NextFloat(0f, 1f) * quantity, FixedPoint2.Epsilon);
var seedChemQuantity = new SeedChemQuantity();
if (chemicals.ContainsKey(chemicalId))
{
else
{
//Set the minimum to a fifth of the quantity to give some level of bad luck protection
- seedChemQuantity.Min = FixedPoint2.Clamp(pick.Quantity / 5f, FixedPoint2.Epsilon, 1f);
+ seedChemQuantity.Min = FixedPoint2.Clamp(quantity / 5f, FixedPoint2.Epsilon, 1f);
seedChemQuantity.Max = seedChemQuantity.Min + amount;
seedChemQuantity.Inherent = false;
}
- type: weightedRandomFillSolution
id: EvilRandomFillSolution
fills:
- - quantity: 0.1 # Common but low quantity
- weight: 20
+ - quantity: 0.05 # Common but very low quantity
+ weight: 40
reagents:
- - Vestine
- - quantity: 0.5 # High quantity but uncommon
- weight: 10
- reagents:
- - Stimulants
+ - Nocturine
- MuteToxin
- - quantity: 0.5 # High quantity but very rare
+ - Lead
+ - quantity: 0.1
+ weight: 5 # 99.9% chance of appearing at least once with 60u of vestine with an average of 6.5 occurances.
+ reagents:
+ - Vestine
+ - quantity: 1.0 # High quantity but on average only 1 per chemical kit
weight: 1
reagents:
- Tazinide
- - Lead
- - Nocturine
+ - Stimulants
- Lexorin