mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Fixed period of 0 for exp items
This commit is contained in:
parent
8d53cbfcc7
commit
a659468775
@ -55,9 +55,7 @@ public class ExperienceItem {
|
|||||||
Validate.isTrue(config.contains("triggers"));
|
Validate.isTrue(config.contains("triggers"));
|
||||||
id = config.getName();
|
id = config.getName();
|
||||||
|
|
||||||
final int periodOption = config.getInt("period", 1);
|
period = config.getInt("period", 1);
|
||||||
// A period of 0 means the item will only trigger once
|
|
||||||
period = periodOption == 0 ? Integer.MAX_VALUE : periodOption;
|
|
||||||
firstTrigger = config.getInt("first-trigger", period);
|
firstTrigger = config.getInt("first-trigger", period);
|
||||||
lastTrigger = config.getInt("last-trigger", Integer.MAX_VALUE);
|
lastTrigger = config.getInt("last-trigger", Integer.MAX_VALUE);
|
||||||
claimChance = config.getDouble("chance", 100) / 100;
|
claimChance = config.getDouble("chance", 100) / 100;
|
||||||
@ -79,10 +77,17 @@ public class ExperienceItem {
|
|||||||
* account the randomness factor from the 'chance' parameter
|
* account the randomness factor from the 'chance' parameter
|
||||||
*/
|
*/
|
||||||
public boolean roll(int professionLevel, int timesCollected) {
|
public boolean roll(int professionLevel, int timesCollected) {
|
||||||
|
|
||||||
|
// Check for the last triggering level
|
||||||
if (professionLevel > lastTrigger)
|
if (professionLevel > lastTrigger)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period));
|
// A period of 0 means the item only triggers once
|
||||||
|
if (period == 0 && timesCollected > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Basic formula
|
||||||
|
final int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period));
|
||||||
if (claimsRequired < 1)
|
if (claimsRequired < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user