… | |
… | |
248 | * the rest will come from the level in bargaining skill |
248 | * the rest will come from the level in bargaining skill |
249 | */ |
249 | */ |
250 | const double cha_ratio = 0.40; |
250 | const double cha_ratio = 0.40; |
251 | |
251 | |
252 | diff = no_bargain ? 1.0 : 1. - pow (lev_bargain / (double) settings.max_level, 0.25); |
252 | diff = no_bargain ? 1.0 : 1. - pow (lev_bargain / (double) settings.max_level, 0.25); |
253 | |
|
|
254 | diff = (1. - cha_ratio) * diff + cha_ratio * (cha_bonus[who->stats.Cha] - 1.) / (cha_bonus[who->stats.Cha] + 1.); |
253 | diff = (1. - cha_ratio) * diff + cha_ratio * (cha_bonus[who->stats.Cha] - 1.) / (cha_bonus[who->stats.Cha] + 1.); |
255 | |
|
|
256 | diff = .02 + (.80 - .02) * diff; |
254 | diff = .02 + (.80 - .02) * diff; |
257 | |
255 | |
258 | if (flag == F_BUY) |
256 | if (flag == F_BUY) |
259 | val += (val * diff); |
257 | val += val * diff; |
260 | else if (flag == F_SELL) |
258 | else if (flag == F_SELL) |
261 | val -= (val * diff); |
259 | val -= val * diff; |
262 | |
260 | |
263 | // now find a price range. the less good we can judge, the larger the range is |
261 | // now find a price range. the less good we can judge, the larger the range is |
264 | // then the range is adjusted randomly around the correct value |
262 | // then the range is adjusted randomly around the correct value |
265 | if (approximate) |
263 | if (approximate) |
266 | approx_range = sint64 (val / sqrt (lev_identify * 3 + 1)); |
264 | approx_range = sint64 (val / sqrt (lev_identify * 3 + 1)); |
267 | } |
265 | } |
268 | |
266 | |
269 | /* I don't think this should really happen - if it does, it indicates and |
267 | /* I don't think this should really happen - if it does, it indicates and |
270 | * overflow of diff above. That shoudl only happen if |
268 | * overflow of diff above. That should only happen if |
271 | * we are selling objects - in that case, the person just |
269 | * we are selling objects - in that case, the person just |
272 | * gets no money. |
270 | * gets no money. |
273 | */ |
271 | */ |
274 | if ((sint64) val < 0) |
272 | if ((sint64) val < 0) |
275 | val = 0; |
273 | val = 0; |
… | |
… | |
303 | if (QUERY_FLAG (tmp, FLAG_PLAYER_SOLD)) |
301 | if (QUERY_FLAG (tmp, FLAG_PLAYER_SOLD)) |
304 | val = (val * shop_greed (who->map) * shop_specialisation_ratio (tmp, who->map) / shopkeeper_approval (who->map, who)); |
302 | val = (val * shop_greed (who->map) * shop_specialisation_ratio (tmp, who->map) / shopkeeper_approval (who->map, who)); |
305 | else |
303 | else |
306 | val = (val * shop_greed (who->map) / (shop_specialisation_ratio (tmp, who->map) * shopkeeper_approval (who->map, who))); |
304 | val = (val * shop_greed (who->map) / (shop_specialisation_ratio (tmp, who->map) * shopkeeper_approval (who->map, who))); |
307 | } |
305 | } |
|
|
306 | |
308 | /* we will also have an extra 0-5% variation between shops of the same type |
307 | /* we will also have an extra 0-5% variation between shops of the same type |
309 | * for valuable items (below a value of 50 this effect wouldn't be very |
308 | * for valuable items (below a value of 50 this effect wouldn't be very |
310 | * pointful, and could give fun with rounding. |
309 | * pointful, and could give fun with rounding. |
311 | */ |
310 | */ |
312 | //TODO: why use cosf at all, just % and scale linearly, gives more even distribution |
311 | //TODO: why use cosf at all, just % and scale linearly, gives more even distribution |