Witherless Rose mechanic reworked from halving wither damage to having a

25% chance (multiplicative) of negating the damage tick. This makes the
effect more noticeable to the player (previously the player still took
damage from every single wither tick no matter how many roses they had),
and also reduces the diminishing returns effect from holding multiple
roses.
This commit is contained in:
Nonoriri 2013-12-08 21:54:43 -05:00
parent 7db09a34a1
commit d775a20155
2 changed files with 10 additions and 1 deletions

View File

@ -5135,6 +5135,10 @@ public void payDay(int time)
return false; return false;
} }
/**
* @param p - The player which we're checking the rose count for
* @return - The number of Witherless Roses (Unwilting Flowers) in the player's inventory.
*/
public int getWitherlessRoseCount(Player p) { public int getWitherlessRoseCount(Player p) {
int count = 0; int count = 0;
for (int m=0;m<p.getInventory().getContents().length;m++) { for (int m=0;m<p.getInventory().getContents().length;m++) {

View File

@ -8693,7 +8693,12 @@ implements Listener
e.setDamage(e.getDamage()*2); e.setDamage(e.getDamage()*2);
} }
if (e.getCause()==DamageCause.WITHER) { if (e.getCause()==DamageCause.WITHER) {
e.setDamage(e.getDamage()*Math.pow(0.5, this.plugin.getWitherlessRoseCount(p))); // e.setDamage(e.getDamage()*Math.pow(0.5, this.plugin.getWitherlessRoseCount(p)));
// For each Witherless Rose, add a multiplicative 25% chance to negate this tick of wither damage.
if (Math.random() > Math.pow(0.75, this.plugin.getWitherlessRoseCount(p))) {
e.setCancelled(true);
}
} }
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override @Override