1 | /* |
1 | /* |
2 | * static char *rcsid_shop_c = |
2 | * static char *rcsid_shop_c = |
3 | * "$Id: shop.c,v 1.1.1.2 2006/02/22 18:03:24 elmex Exp $"; |
3 | * "$Id: shop.c,v 1.1.1.3 2006/03/15 14:05:37 elmex 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 | |
… | |
… | |
182 | |
182 | |
183 | /* Limit amount of money you can get for really great items. */ |
183 | /* Limit amount of money you can get for really great items. */ |
184 | if (flag==F_TRUE || flag==F_SELL) |
184 | if (flag==F_TRUE || flag==F_SELL) |
185 | val=value_limit(val, number, who, shop); |
185 | val=value_limit(val, number, who, shop); |
186 | |
186 | |
|
|
187 | /* we need to multiply these by 4.0 to keep buy costs roughly the same |
|
|
188 | * (otherwise, you could buy a potion of charisma for around 400 pp. |
|
|
189 | * Arguable, the costs in the archetypes should be updated to better |
|
|
190 | * reflect values (potion charisma list for 1250 gold) |
|
|
191 | */ |
|
|
192 | val *= 4; |
|
|
193 | |
187 | /* This modification is for bargaining skill. |
194 | /* This modification is for bargaining skill. |
188 | * Now only players with max level in bargaining |
195 | * Now only players with max level in bargaining |
189 | * AND Cha = 30 will get optimal price. |
196 | * AND Cha = 30 will get optimal price. |
190 | * Thus charisma will never get useless. |
197 | * Thus charisma will never get useless. |
191 | * -b.e. edler@heydernet.de |
198 | * -b.e. edler@heydernet.de |
… | |
… | |
230 | diff *= 1-ratio; |
237 | diff *= 1-ratio; |
231 | |
238 | |
232 | /* Diff is now a float between 0.2 and 0.8 */ |
239 | /* Diff is now a float between 0.2 and 0.8 */ |
233 | diff+=(cha_bonus[who->stats.Cha]-1)/(1+cha_bonus[who->stats.Cha])*ratio; |
240 | diff+=(cha_bonus[who->stats.Cha]-1)/(1+cha_bonus[who->stats.Cha])*ratio; |
234 | |
241 | |
235 | /* we need to multiply these by 4.0 to keep buy costs roughly the same |
|
|
236 | * (otherwise, you could buy a potion of charisma for around 400 pp. |
|
|
237 | * Arguable, the costs in the archetypes should be updated to better |
|
|
238 | * reflect values (potion charisma list for 1250 gold) |
|
|
239 | */ |
|
|
240 | if(flag==F_BUY) |
242 | if(flag==F_BUY) |
241 | val=(4*val*(long)(1000*(1+diff)))/1000; |
243 | val=(val*(long)(1000*(1+diff)))/1000; |
242 | else if (flag==F_SELL) |
244 | else if (flag==F_SELL) |
243 | val=(4*val*(long)(1000*(1-diff)))/1000; |
245 | val=(val*(long)(1000*(1-diff)))/1000; |
244 | else val *=4; |
|
|
245 | |
246 | |
246 | /* If we are approximating, then the value returned should be allowed to be wrong |
247 | /* If we are approximating, then the value returned should be allowed to be wrong |
247 | * however merely using a random number each time will not be sufficiant, as then |
248 | * however merely using a random number each time will not be sufficiant, as then |
248 | * multiple examinations would give different answers, so we'll use the count |
249 | * multiple examinations would give different answers, so we'll use the count |
249 | * instead. By taking the sine of the count, a value between -1 and 1 is |
250 | * instead. By taking the sine of the count, a value between -1 and 1 is |