1 | /* |
1 | /* |
2 | * static char *rcsid_shop_c = |
2 | * static char *rcsid_shop_c = |
3 | * "$Id: shop.c,v 1.10 2006/06/26 18:14:31 root Exp $"; |
3 | * "$Id: shop.c,v 1.17 2006/07/11 10:35:20 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
125 | LOG(llevError, "Asking for buy-value of unidentified object.\n"); |
125 | LOG(llevError, "Asking for buy-value of unidentified object.\n"); |
126 | val = tmp->arch->clone.value * 50 * number; |
126 | val = tmp->arch->clone.value * 50 * number; |
127 | } |
127 | } |
128 | else { /* Trying to sell something, or get true value */ |
128 | else { /* Trying to sell something, or get true value */ |
129 | if (tmp->type == POTION) |
129 | if (tmp->type == POTION) |
130 | val = number * 1000; /* Don't want to give anything away */ |
130 | val = number * 40; /* Don't want to give anything away */ |
131 | else { |
131 | else { |
132 | /* Get 2/3'rd value for applied objects, 1/3'rd for totally |
132 | /* Get 2/3'rd value for applied objects, 1/3'rd for totally |
133 | * unknown objects |
133 | * unknown objects |
134 | */ |
134 | */ |
135 | if (QUERY_FLAG(tmp, FLAG_BEEN_APPLIED)) |
135 | if (QUERY_FLAG(tmp, FLAG_BEEN_APPLIED)) |
… | |
… | |
185 | if (flag==F_SELL) |
185 | if (flag==F_SELL) |
186 | val=value_limit(val, number, who, shop); |
186 | val=value_limit(val, number, who, shop); |
187 | |
187 | |
188 | // use a nonlinear price adjustment. as my predecessor said, don't change |
188 | // use a nonlinear price adjustment. as my predecessor said, don't change |
189 | // the archetypes, its work required for balancing, and we don't care. |
189 | // the archetypes, its work required for balancing, and we don't care. |
190 | val = pow (val / 128., 1.4) * 128.; |
190 | //val = pow (val, 1.05); |
191 | |
191 | |
192 | /* This modification is for bargaining skill. |
192 | /* This modification is for bargaining skill. |
193 | * Now only players with max level in bargaining |
193 | * Now only players with max level in bargaining |
194 | * AND Cha = 30 will get optimal price. |
194 | * AND Cha = 30 will get optimal price. |
195 | * Thus charisma will never get useless. |
195 | * Thus charisma will never get useless. |
… | |
… | |
224 | |
224 | |
225 | /* ratio determines how much of the price modification |
225 | /* ratio determines how much of the price modification |
226 | * will come from the basic stat charisma |
226 | * will come from the basic stat charisma |
227 | * the rest will come from the level in bargaining skill |
227 | * the rest will come from the level in bargaining skill |
228 | */ |
228 | */ |
229 | const double cha_ratio = 0.35; |
229 | const double cha_ratio = 0.40; |
230 | |
230 | |
231 | diff = no_bargain ? 1.0 : 1. - pow (lev_bargain / (double)settings.max_level, 0.25); |
231 | diff = no_bargain ? 1.0 : 1. - pow (lev_bargain / (double)settings.max_level, 0.25); |
232 | |
232 | |
233 | diff = (1. - cha_ratio) * diff |
233 | diff = (1. - cha_ratio) * diff |
234 | + cha_ratio * (cha_bonus[who->stats.Cha] - 1.) / (cha_bonus[who->stats.Cha] + 1.); |
234 | + cha_ratio * (cha_bonus[who->stats.Cha] - 1.) / (cha_bonus[who->stats.Cha] + 1.); |
235 | |
235 | |
236 | diff = .02 + (1. - .02) * diff; |
236 | diff = .02 + (.80 - .02) * diff; |
237 | |
237 | |
238 | if (flag == F_BUY) val = val * (1. + diff); |
238 | if (flag == F_BUY) val += val * diff; |
239 | else if (flag == F_SELL) val = val * (1. - diff); |
239 | else if (flag == F_SELL) val -= val * diff; |
240 | |
240 | |
241 | // now find a price range. the less good we can judge, the larger the range is |
241 | // now find a price range. the less good we can judge, the larger the range is |
242 | // then the range is adjusted randomly around the correct value |
242 | // then the range is adjusted randomly around the correct value |
243 | if (approximate) |
243 | if (approximate) |
244 | approx_range = val / sqrt (lev_identify * 3 + 1); |
244 | approx_range = val / sqrt (lev_identify * 3 + 1); |