Holiday candy and Revival Holiday candies are now on separate cooldowns,

more intuitive behavior.
This commit is contained in:
sigonasr2 2016-12-29 02:24:09 -06:00
parent 617d85d9c7
commit 25e4ffbb47
3 changed files with 97 additions and 91 deletions

Binary file not shown.

View File

@ -726,9 +726,8 @@ public class CustomDamage {
private static double modifyFateBasedOnHolidayTreats(Player p, double damage) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) {
boolean consumed=false;
if (p.getHealth()-damage<=0) {
boolean consumed=false,consumed2=false;
if (p.getHealth()-damage<=0 && pd.lastrevivecandyconsumed+200<TwosideKeeper.getServerTickTime()) {
for (int i=0;i<9;i++) {
ItemStack item = p.getInventory().getItem(i);
if (item!=null) {
@ -743,13 +742,13 @@ public class CustomDamage {
GenericFunctions.RevivePlayer(p,p.getMaxHealth());
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
GenericFunctions.RandomlyBreakBaubles(p, hotbar);
consumed=true;
consumed2=true;
return 0;
}
}
}
} else
if (p.getHealth()-damage<p.getMaxHealth()/2) {
if (p.getHealth()-damage<p.getMaxHealth()/2 && pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) {
//See if we can activate any treats. Check the hotbar.
for (int i=0;i<9;i++) {
ItemStack item = p.getInventory().getItem(i);
@ -820,7 +819,13 @@ public class CustomDamage {
if (consumed) {
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastcandyconsumed=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_CARROT, 40);
aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, 40);
}
if (consumed2) {
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, 200);
}
return damage;
}

View File

@ -136,6 +136,7 @@ public class PlayerStructure {
public long lastabsorptionhealthgiven = TwosideKeeper.getServerTickTime();
public long ignoretargetarmor = TwosideKeeper.getServerTickTime();
public long lastcandyconsumed = TwosideKeeper.getServerTickTime();
public long lastrevivecandyconsumed = TwosideKeeper.getServerTickTime();
public long icewandused = TwosideKeeper.getServerTickTime();
public PlayerMode playermode_on_death=PlayerMode.NORMAL;