mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-16 01:12:35 +00:00
Merge pull request 'fix(fishing): fix catch type return and correct aux value calculations' (#10) from GeorgeV22/LegacyEvolved:main into main
Reviewed-on: https://codeberg.org/piebot/LegacyEvolved/pulls/10
This commit is contained in:
commit
fb5cd3abfe
|
|
@ -50,16 +50,16 @@ CatchType FishingHelper::getRandCatchType(int luck, Random* random)
|
||||||
CatchTypeWeighedItem* catchTypeWeighedItem = nullptr;
|
CatchTypeWeighedItem* catchTypeWeighedItem = nullptr;
|
||||||
catchTypeArray.calcWeights(luck); // Recalculate the weights based on the luck level of the player
|
catchTypeArray.calcWeights(luck); // Recalculate the weights based on the luck level of the player
|
||||||
catchTypeWeighedItem = static_cast<CatchTypeWeighedItem *>(WeighedRandom::getRandomItem(random, catchTypeArray));
|
catchTypeWeighedItem = static_cast<CatchTypeWeighedItem *>(WeighedRandom::getRandomItem(random, catchTypeArray));
|
||||||
|
return catchTypeWeighedItem->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
CatchWeighedItem* FishingHelper::getRandCatch(CatchType catchType, Random* random)
|
CatchWeighedItem* FishingHelper::getRandCatch(CatchType catchType, Random* random)
|
||||||
{
|
{
|
||||||
CatchWeighedItem* catchWeighedItem = nullptr;
|
|
||||||
switch (catchType) {
|
switch (catchType) {
|
||||||
case CatchType::FISH:
|
case CatchType::FISH:
|
||||||
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingFishArray));
|
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingFishArray));
|
||||||
case CatchType::TREASURE:
|
case CatchType::TREASURE:
|
||||||
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingTreasuresArray));;
|
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingTreasuresArray));
|
||||||
case CatchType::JUNK:
|
case CatchType::JUNK:
|
||||||
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingJunkArray));
|
return static_cast<CatchWeighedItem *>(WeighedRandom::getRandomItem(random, fishingJunkArray));
|
||||||
}
|
}
|
||||||
|
|
@ -75,11 +75,11 @@ std::shared_ptr<ItemInstance> FishingHelper::handleCatch(CatchWeighedItem* weigh
|
||||||
itemInstance->setAuxValue((int) (itemInstance->getMaxDamage() * ((double) random->nextInt(901) + 100.0) / 1000.0)); // 10% to 100% damage
|
itemInstance->setAuxValue((int) (itemInstance->getMaxDamage() * ((double) random->nextInt(901) + 100.0) / 1000.0)); // 10% to 100% damage
|
||||||
}
|
}
|
||||||
else if (itemInstance->id == Item::fishingRod_Id && catchType == CatchType::TREASURE) {
|
else if (itemInstance->id == Item::fishingRod_Id && catchType == CatchType::TREASURE) {
|
||||||
itemInstance->setAuxValue((int)(itemInstance->getMaxDamage() * ((double)random->nextInt(251) / 1000.0)); // 0% to 25% damage
|
itemInstance->setAuxValue((int)(itemInstance->getMaxDamage() * ((double)random->nextInt(251) / 1000.0))); // 0% to 25% damage
|
||||||
itemInstance = EnchantmentHelper::enchantItem(random, itemInstance, 30);
|
itemInstance = EnchantmentHelper::enchantItem(random, itemInstance, 30);
|
||||||
}
|
}
|
||||||
else if (itemInstance->id == Item::bow_Id) {
|
else if (itemInstance->id == Item::bow_Id) {
|
||||||
itemInstance->setAuxValue((int)(itemInstance->getMaxDamage() * ((double)random->nextInt(251) / 1000.0)); // 0% to 25% damage
|
itemInstance->setAuxValue((int)(itemInstance->getMaxDamage() * ((double)random->nextInt(251) / 1000.0))); // 0% to 25% damage
|
||||||
itemInstance = EnchantmentHelper::enchantItem(random, itemInstance, 30);
|
itemInstance = EnchantmentHelper::enchantItem(random, itemInstance, 30);
|
||||||
}
|
}
|
||||||
else if (itemInstance->id == Item::book_Id) {
|
else if (itemInstance->id == Item::book_Id) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue