mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Rewrote the RNG system to be more unified
This commit is contained in:
@ -15,6 +15,7 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
|
||||
* Only skills using the old system will fire this event
|
||||
* @param player target player
|
||||
* @param subSkillType target subskill
|
||||
* @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually.
|
||||
*/
|
||||
@Deprecated
|
||||
public SubSkillEvent(Player player, SubSkillType subSkillType) {
|
||||
|
@ -4,22 +4,22 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
|
||||
public class SubSkillRandomCheckEvent extends SubSkillEvent {
|
||||
private double chance;
|
||||
|
||||
public SubSkillWeightedActivationCheckEvent(Player player, SubSkillType ability, double chance) {
|
||||
public SubSkillRandomCheckEvent(Player player, SubSkillType ability, double chance) {
|
||||
super(player, ability);
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public SubSkillWeightedActivationCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance)
|
||||
public SubSkillRandomCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance)
|
||||
{
|
||||
super(player, abstractSubSkill);
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
|
||||
* Gets the activation chance of the ability 0D being no chance, 100.0D being 100% chance
|
||||
*
|
||||
* @return The activation chance of the ability
|
||||
*/
|
||||
@ -28,7 +28,7 @@ public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the activation chance of the ability [0D-1.0D]
|
||||
* Sets the activation chance of the ability [0D-100.0D]
|
||||
*
|
||||
* @param chance The activation chance of the ability
|
||||
*/
|
||||
@ -42,6 +42,6 @@ public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
|
||||
* @param success whether it should be successful or not
|
||||
*/
|
||||
public void setSuccessful(boolean success) {
|
||||
this.chance = success ? 1.0D : 0D;
|
||||
this.chance = success ? 100.0D : 0D;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user