diff --git a/src/constants.cairo b/src/constants.cairo index b7856e9b1..bcaed9702 100644 --- a/src/constants.cairo +++ b/src/constants.cairo @@ -17,11 +17,11 @@ const STARTING_BAG_LIMIT: usize = 100; // inventory size const STARTING_HEALTH: u8 = 100; // market price variation -const PRICE_VAR_CHANCE: u8 = 25; // 50% chance = 25% up / 25% down +const PRICE_VAR_CHANCE: u32 = 250; // on 1000 : 50% chance = 25% up / 25% down const PRICE_VAR_MIN: u8 = 1; // 1% const PRICE_VAR_MAX: u8 = 5; // 5% // market price events -const MARKET_EVENT_CHANCE: u8 = 2; // 2% = 1% up / 1% down +const MARKET_EVENT_CHANCE: u32 = 5; // on 1000 : 1% = 0.5% up / 0.5% down const MARKET_EVENT_MIN: u8 = 50; // 50% const MARKET_EVENT_MAX: u8 = 100; // 100% diff --git a/src/systems/travel.cairo b/src/systems/travel.cairo index 2209ad48b..d46f929e3 100644 --- a/src/systems/travel.cairo +++ b/src/systems/travel.cairo @@ -113,19 +113,19 @@ fn market_variations(ctx: Context, game_id: u32) { match drugs.pop_front() { Option::Some(drug_id) => { seed = pedersen::pedersen(seed, *drug_id); - let rand = random(seed, 0, 100); + let rand = random(seed, 0, 1000); - if rand <= PRICE_VAR_CHANCE.into() { + if rand < PRICE_VAR_CHANCE.into() { // increase price price_variation_with_cash( ctx, game_id, *location_id, *drug_id, ref seed, true ); - } else if rand >= (99 - PRICE_VAR_CHANCE).into() { + } else if rand >= (999 - PRICE_VAR_CHANCE).into() { // decrease price price_variation_with_cash( ctx, game_id, *location_id, *drug_id, ref seed, false ); - } else if rand > 50 && rand < 50 + MARKET_EVENT_CHANCE.into() { + } else if rand > 500 && rand <= 500 + MARKET_EVENT_CHANCE.into() { // big move up price_variation_with_drug( ctx, game_id, *location_id, *drug_id, ref seed, true @@ -139,7 +139,7 @@ fn market_variations(ctx: Context, game_id: u32) { increase: true } ); - } else if rand < 50 && rand > 50 - MARKET_EVENT_CHANCE.into() { + } else if rand < 500 && rand >= 500 - MARKET_EVENT_CHANCE.into() { // big move down price_variation_with_drug( ctx, game_id, *location_id, *drug_id, ref seed, false