Skip to content

Commit

Permalink
fix fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed Sep 21, 2023
1 parent 4471e34 commit dc52717
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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: u8 = 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 = 1; // 2% = 1% up / 1% down
const MARKET_EVENT_CHANCE: u8 = 5; // on 1000 : 1% = 1% up / 1% down
const MARKET_EVENT_MIN: u8 = 50; // 50%
const MARKET_EVENT_MAX: u8 = 100; // 100%
10 changes: 5 additions & 5 deletions src/systems/travel.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit dc52717

Please sign in to comment.