Lucky craft.
Contributed by Liamxroy.
This commit is contained in:
@@ -407,9 +407,9 @@ public class RecipeController
|
||||
// handle possible cheaters here
|
||||
// (they click craft then try to get rid of items in order to get free craft)
|
||||
}
|
||||
else if (Rnd.get(100) < _recipeList.getSuccessRate())
|
||||
else if ((Rnd.get(100) < _recipeList.getSuccessRate()) || _target.tryLuck())
|
||||
{
|
||||
rewardPlayer(); // and immediately puts created item in its place
|
||||
rewardPlayer(_target); // and immediately puts created item in its place
|
||||
updateMakeInfo(true);
|
||||
}
|
||||
else
|
||||
@@ -657,7 +657,7 @@ public class RecipeController
|
||||
_activeMakers.remove(_player.getObjectId());
|
||||
}
|
||||
|
||||
private void rewardPlayer()
|
||||
private void rewardPlayer(L2PcInstance player)
|
||||
{
|
||||
final int rareProdId = _recipeList.getRareItemId();
|
||||
int itemId = _recipeList.getItemId();
|
||||
@@ -674,6 +674,11 @@ public class RecipeController
|
||||
}
|
||||
}
|
||||
|
||||
if (player.tryLuck())
|
||||
{
|
||||
itemCount *= 2;
|
||||
}
|
||||
|
||||
_target.getInventory().addItem("Manufacture", itemId, itemCount, _target, _player);
|
||||
|
||||
// inform customer of earned item
|
||||
|
@@ -13959,4 +13959,15 @@ public final class L2PcInstance extends L2Playable
|
||||
addStatusUpdateValue(StatusUpdateType.MAX_CP);
|
||||
addStatusUpdateValue(StatusUpdateType.CUR_CP);
|
||||
}
|
||||
|
||||
public boolean tryLuck()
|
||||
{
|
||||
if ((Rnd.nextDouble() < BaseStats.LUC.getValue(getLUC())) && !hasSkillReuse(CommonSkill.LUCKY_CLOVER.getSkill().getReuseHashCode()))
|
||||
{
|
||||
SkillCaster.triggerCast(this, this, CommonSkill.LUCKY_CLOVER.getSkill());
|
||||
sendPacket(SystemMessageId.LADY_LUCK_SMILES_UPON_YOU);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -170,7 +170,7 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100);
|
||||
|
||||
final double random = 100 * Rnd.nextDouble();
|
||||
final boolean success = (random < finalChance);
|
||||
boolean success = (random < finalChance) || player.tryLuck();
|
||||
|
||||
if (player.isDebug())
|
||||
{
|
||||
|
@@ -57,7 +57,8 @@ public enum CommonSkill
|
||||
ALCHEMY_CUBE(17943, 1),
|
||||
ALCHEMY_CUBE_RANDOM_SUCCESS(17966, 1),
|
||||
PET_SWITCH_STANCE(6054, 1),
|
||||
WEIGHT_PENALTY(4270, 1);
|
||||
WEIGHT_PENALTY(4270, 1),
|
||||
LUCKY_CLOVER(18103, 1);
|
||||
|
||||
private final SkillHolder _holder;
|
||||
|
||||
|
Reference in New Issue
Block a user