| 348 | } |
| 349 | |
| 350 | bool itemLevelCurvePostProcess(Entity* my, Item* item, BaronyRNG& rng, int itemLevel, int* lastItemType, int* lastItemSpellType) |
| 351 | { |
| 352 | if ( !((my && my->behavior == &actItem) || item) ) |
| 353 | { |
| 354 | return false; |
| 355 | } |
| 356 | |
| 357 | bool modified = false; |
| 358 | itemLevelCurveType = ITEM_LEVEL_CURVE_TYPE_DEFAULT; |
| 359 | if ( my ) |
| 360 | { |
| 361 | if ( my->behavior == &actMonster && (my->getMonsterTypeFromSprite() == SHOPKEEPER || my->monsterCanTradeWith(-1)) ) |
| 362 | { |
| 363 | itemLevelCurveType = ITEM_LEVEL_CURVE_TYPE_SHOP; |
| 364 | itemLevelCurveShop = my->monsterStoreType; |
| 365 | } |
| 366 | else if ( my->behavior == &actChest ) |
| 367 | { |
| 368 | itemLevelCurveType = ITEM_LEVEL_CURVE_TYPE_CHEST; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | int itemType = (my && my->behavior == &actItem) ? my->skill[10] : item->type; |
| 373 | int itemStatus = (my && my->behavior == &actItem) ? my->skill[11] : item->type; |
| 374 | if ( itemType >= BRONZE_TOMAHAWK && itemType <= CRYSTAL_SHURIKEN ) |
| 375 | { |
| 376 | // thrown weapons always fixed status. (tomahawk = decrepit, shuriken = excellent) |
| 377 | itemStatus = std::min(static_cast<Status>(DECREPIT + (itemType - BRONZE_TOMAHAWK)), EXCELLENT); |
| 378 | if ( my && my->behavior == &actItem ) |
| 379 | { |
| 380 | my->skill[11] = itemStatus; |
| 381 | } |
| 382 | else |
| 383 | { |
| 384 | item->status = static_cast<Status>(itemStatus); |
| 385 | } |
| 386 | } |
| 387 | if ( itemType == BOLAS ) |
| 388 | { |
| 389 | itemStatus = SERVICABLE; |
| 390 | if ( my && my->behavior == &actItem ) |
| 391 | { |
| 392 | my->skill[11] = itemStatus; |
| 393 | } |
| 394 | else |
| 395 | { |
| 396 | item->status = static_cast<Status>(itemStatus); |
| 397 | } |
| 398 | } |
| 399 | if ( itemType >= 0 && itemType < NUMITEMS ) |
| 400 | { |
| 401 | if ( items[itemType].category == SPELLBOOK ) |
| 402 | { |
| 403 | //if ( itemLevelCurveType == ITEM_LEVEL_CURVE_TYPE_DEFAULT ) |
| 404 | { |
| 405 | std::vector<std::pair<int, int>> chances; |
| 406 | chances.reserve(NUM_SPELLS); |
| 407 | std::vector<unsigned int> chanceWeights; |
no test coverage detected