Implemented regen brace
Fixed timing of stat decrementing Saradomin brews can now lower stats all the way to zero
This commit is contained in:
@@ -324,7 +324,7 @@ public enum Consumables {
|
|||||||
FISHING(new Potion(new int[] {2438, 151, 153, 155}, new SkillEffect(Skills.FISHING, 3, 0))),
|
FISHING(new Potion(new int[] {2438, 151, 153, 155}, new SkillEffect(Skills.FISHING, 3, 0))),
|
||||||
PRAYER(new Potion(new int[] {2434, 139, 141, 143}, new PrayerEffect(7, 0.25))),
|
PRAYER(new Potion(new int[] {2434, 139, 141, 143}, new PrayerEffect(7, 0.25))),
|
||||||
SUPER_RESTO(new Potion(new int[] {3024, 3026, 3028, 3030}, new MultiEffect(new RestoreEffect(8, 0.25), new PrayerEffect(8, 0.25), new SummoningEffect(8, 0.25)))),
|
SUPER_RESTO(new Potion(new int[] {3024, 3026, 3028, 3030}, new MultiEffect(new RestoreEffect(8, 0.25), new PrayerEffect(8, 0.25), new SummoningEffect(8, 0.25)))),
|
||||||
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(0.1, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
||||||
ANTIFIRE(new Potion(new int[] {2452, 2454, 2456, 2458}, new SetAttributeEffect("fire:immune", 600, true))),
|
ANTIFIRE(new Potion(new int[] {2452, 2454, 2456, 2458}, new SetAttributeEffect("fire:immune", 600, true))),
|
||||||
GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(5), new HealingEffect(5)))),
|
GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(5), new HealingEffect(5)))),
|
||||||
MAGIC_ESS(new Potion(new int[] {11491, 11489}, new SkillEffect(Skills.MAGIC,3,0))),
|
MAGIC_ESS(new Potion(new int[] {11491, 11489}, new SkillEffect(Skills.MAGIC,3,0))),
|
||||||
@@ -334,7 +334,7 @@ public enum Consumables {
|
|||||||
|
|
||||||
/** Barbarian Mixes */
|
/** Barbarian Mixes */
|
||||||
PRAYERMIX(new BarbarianMix(new int[] {11465, 11467}, new MultiEffect(new PrayerEffect(7, 0.25), new HealingEffect(6)))),
|
PRAYERMIX(new BarbarianMix(new int[] {11465, 11467}, new MultiEffect(new PrayerEffect(7, 0.25), new HealingEffect(6)))),
|
||||||
ZAMMY_MIX(new BarbarianMix(new int[] {11521, 11523}, new MultiEffect(new SkillEffect(Skills.HITPOINTS, 0, -0.10), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
ZAMMY_MIX(new BarbarianMix(new int[] {11521, 11523}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
||||||
ATT_MIX(new BarbarianMix(new int[] {11429, 11431}, new MultiEffect(new SkillEffect(Skills.ATTACK, 3, 0.1), new HealingEffect(3)))),
|
ATT_MIX(new BarbarianMix(new int[] {11429, 11431}, new MultiEffect(new SkillEffect(Skills.ATTACK, 3, 0.1), new HealingEffect(3)))),
|
||||||
ANTIP_MIX(new BarbarianMix(new int[] {11433, 11435}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new SetAttributeEffect("poison:immunity", 143), new HealingEffect(3)))),
|
ANTIP_MIX(new BarbarianMix(new int[] {11433, 11435}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new SetAttributeEffect("poison:immunity", 143), new HealingEffect(3)))),
|
||||||
RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new RemoveStateEffect("disease"), new SetAttributeEffect("disease:immunity", 300), new HealingEffect(3)))),
|
RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new RemoveStateEffect("disease"), new SetAttributeEffect("disease:immunity", 300), new HealingEffect(3)))),
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class SkillEffect extends ConsumableEffect {
|
|||||||
public void activate(Player p) {
|
public void activate(Player p) {
|
||||||
Skills skills = p.getSkills();
|
Skills skills = p.getSkills();
|
||||||
int slevel = skills.getStaticLevel(skill_slot);
|
int slevel = skills.getStaticLevel(skill_slot);
|
||||||
skills.updateLevel(skill_slot,(int)(base + (bonus * slevel)),slevel + (int)(base + (bonus * slevel)));
|
int delta = (int)(base + (bonus * slevel));
|
||||||
|
skills.updateLevel(skill_slot, delta, delta >= 0 ? slevel + delta : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,26 +26,8 @@ public enum PrayerType {
|
|||||||
ROCK_SKIN(10, 6, 86, 15, PrayerCategory.BABY_BLUE, 2684, new SkillBonus(Skills.DEFENCE, 0.1)),
|
ROCK_SKIN(10, 6, 86, 15, PrayerCategory.BABY_BLUE, 2684, new SkillBonus(Skills.DEFENCE, 0.1)),
|
||||||
SUPERHUMAN_STRENGTH(13, 6, 87, 17, PrayerCategory.GREEN, 2689, new SkillBonus(Skills.STRENGTH, 0.1)),
|
SUPERHUMAN_STRENGTH(13, 6, 87, 17, PrayerCategory.GREEN, 2689, new SkillBonus(Skills.STRENGTH, 0.1)),
|
||||||
IMPROVED_REFLEXES(16, 6, 88, 19, PrayerCategory.PINK, 2662, new SkillBonus(Skills.ATTACK, 0.1)),
|
IMPROVED_REFLEXES(16, 6, 88, 19, PrayerCategory.PINK, 2662, new SkillBonus(Skills.ATTACK, 0.1)),
|
||||||
RAPID_RESTORE(19, 26, 89, 21, PrayerCategory.PURPLE, 2679){
|
RAPID_RESTORE(19, 26, 89, 21, PrayerCategory.PURPLE, 2679),
|
||||||
@Override
|
RAPID_HEAL(22, 18, 90, 23, PrayerCategory.PURPLE, 2678),
|
||||||
public boolean toggle(Player player, boolean on) {
|
|
||||||
for(SkillRestoration restore : player.getSkills().getRestoration()){
|
|
||||||
if(restore == null) continue;
|
|
||||||
restore.restartStat(on);
|
|
||||||
}
|
|
||||||
return super.toggle(player, on);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RAPID_HEAL(22, 18, 90, 23, PrayerCategory.PURPLE, 2678){
|
|
||||||
@Override
|
|
||||||
public boolean toggle(Player player, boolean on) {
|
|
||||||
for(SkillRestoration restore : player.getSkills().getRestoration()){
|
|
||||||
if(restore == null) continue;
|
|
||||||
restore.restartHpSummPray(on);
|
|
||||||
}
|
|
||||||
return super.toggle(player, on);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PROTECT_ITEMS(25, 18, 91, 25, PrayerCategory.DARK_GREEN, 1982),
|
PROTECT_ITEMS(25, 18, 91, 25, PrayerCategory.DARK_GREEN, 1982),
|
||||||
HAWK_EYE(26, 6, 864, 27, PrayerCategory.LIME_GREEN, 2666, new SkillBonus(Skills.RANGE, 0.1)),
|
HAWK_EYE(26, 6, 864, 27, PrayerCategory.LIME_GREEN, 2666, new SkillBonus(Skills.RANGE, 0.1)),
|
||||||
MYSTIC_LORE(27, 6, 865, 29, PrayerCategory.LIME_GREEN, 2668, new SkillBonus(Skills.MAGIC, 0.1)),
|
MYSTIC_LORE(27, 6, 865, 29, PrayerCategory.LIME_GREEN, 2668, new SkillBonus(Skills.MAGIC, 0.1)),
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package core.game.node.entity.skill;
|
package core.game.node.entity.skill;
|
||||||
|
|
||||||
|
import core.game.container.impl.EquipmentContainer;
|
||||||
import core.game.node.entity.Entity;
|
import core.game.node.entity.Entity;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||||
|
import core.game.node.item.Item;
|
||||||
|
import org.rs09.consts.Items;
|
||||||
import rs09.game.node.entity.skill.skillcapeperks.SkillcapePerks;
|
import rs09.game.node.entity.skill.skillcapeperks.SkillcapePerks;
|
||||||
import rs09.game.world.GameWorld;
|
import rs09.game.world.GameWorld;
|
||||||
|
|
||||||
@@ -17,21 +20,12 @@ public final class SkillRestoration {
|
|||||||
*/
|
*/
|
||||||
private final int skillId;
|
private final int skillId;
|
||||||
|
|
||||||
/**
|
|
||||||
* The current tick.
|
|
||||||
*/
|
|
||||||
private int statTick;
|
|
||||||
|
|
||||||
private int hpSummPrayTick;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code SkillRestoration} {@code Object}.
|
* Constructs a new {@code SkillRestoration} {@code Object}.
|
||||||
* @param skillId The skill id.
|
* @param skillId The skill id.
|
||||||
*/
|
*/
|
||||||
public SkillRestoration(int skillId) {
|
public SkillRestoration(int skillId) {
|
||||||
this.skillId = skillId;
|
this.skillId = skillId;
|
||||||
restartHpSummPray(false);
|
|
||||||
restartStat(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,47 +35,43 @@ public final class SkillRestoration {
|
|||||||
public void restore(Entity entity) {
|
public void restore(Entity entity) {
|
||||||
Skills skills = entity.getSkills();
|
Skills skills = entity.getSkills();
|
||||||
int max = skills.getStaticLevel(skillId);
|
int max = skills.getStaticLevel(skillId);
|
||||||
if(skillId == Skills.HITPOINTS && entity instanceof Player && SkillcapePerks.isActive(SkillcapePerks.DAMAGE_SPONG,entity.asPlayer())){
|
int tickDivisor = 1;
|
||||||
max = 110;
|
if(skillId == Skills.HITPOINTS){
|
||||||
|
max = skills.getMaximumLifepoints();
|
||||||
|
if(entity instanceof Player) {
|
||||||
|
Player player = entity.asPlayer();
|
||||||
|
if(player.getPrayer().getActive().contains(PrayerType.RAPID_HEAL)) {
|
||||||
|
tickDivisor *= 2;
|
||||||
|
}
|
||||||
|
Item gloves = player.getEquipment().get(EquipmentContainer.SLOT_HANDS);
|
||||||
|
if(gloves != null && gloves.getId() == Items.REGEN_BRACELET_11133) {
|
||||||
|
tickDivisor *= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(hpSummPrayTick < GameWorld.getTicks()){
|
if(skillId == Skills.PRAYER) {
|
||||||
if(skillId == Skills.HITPOINTS || skillId == Skills.SUMMONING || skillId == Skills.PRAYER){
|
return;
|
||||||
if(skillId == Skills.HITPOINTS){
|
}
|
||||||
if(skills.getLifepoints() >= max){
|
if(skillId != Skills.HITPOINTS && skillId != Skills.SUMMONING) {
|
||||||
return;
|
if(entity instanceof Player) {
|
||||||
}
|
if(entity.asPlayer().getPrayer().getActive().contains(PrayerType.RAPID_RESTORE)) {
|
||||||
skills.heal(1);
|
tickDivisor *= 2;
|
||||||
} else {
|
}
|
||||||
int current = skills.getLevel(skillId);
|
}
|
||||||
skills.updateLevel(skillId,current < max ? 1 : -1,max);
|
}
|
||||||
}
|
|
||||||
restartHpSummPray(entity.asPlayer().getPrayer().getActive().contains(PrayerType.RAPID_HEAL));
|
int ticks = 100 / tickDivisor;
|
||||||
|
if(GameWorld.getTicks() % ticks == 0){
|
||||||
|
if(skillId == Skills.HITPOINTS){
|
||||||
|
if(skills.getLifepoints() >= max){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
skills.heal(1);
|
||||||
|
} else {
|
||||||
|
int current = skills.getLevel(skillId);
|
||||||
|
skills.updateLevel(skillId,current < max ? 1 : -1,max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(statTick < GameWorld.getTicks()) {
|
|
||||||
if (skillId != Skills.HITPOINTS && skillId != Skills.SUMMONING && skillId != Skills.PRAYER) {
|
|
||||||
int current = skills.getLevel(skillId);
|
|
||||||
skills.updateLevel(skillId,current < max ? 1 : -1,max);
|
|
||||||
restartStat(entity.asPlayer().getPrayer().getActive().contains(PrayerType.RAPID_RESTORE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the tick.
|
|
||||||
* @return The tick.
|
|
||||||
*/
|
|
||||||
public int getTick() {
|
|
||||||
return hpSummPrayTick;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the tick.
|
|
||||||
* @param tick The tick to set.
|
|
||||||
*/
|
|
||||||
public void setTick(int tick) {
|
|
||||||
this.hpSummPrayTick = tick;
|
|
||||||
this.statTick = tick;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,23 +81,4 @@ public final class SkillRestoration {
|
|||||||
public int getSkillId() {
|
public int getSkillId() {
|
||||||
return skillId;
|
return skillId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Restarts the restoration.
|
|
||||||
*/
|
|
||||||
public void restartHpSummPray(boolean half) {
|
|
||||||
int ticks = 100;
|
|
||||||
if(half){
|
|
||||||
ticks /= 2;
|
|
||||||
}
|
|
||||||
this.hpSummPrayTick = GameWorld.getTicks() + ticks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void restartStat(boolean half) {
|
|
||||||
int ticks = 100;
|
|
||||||
if(half){
|
|
||||||
ticks /= 2;
|
|
||||||
}
|
|
||||||
this.statTick = GameWorld.getTicks() + ticks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -604,10 +604,6 @@ public final class Skills {
|
|||||||
prayerPoints = level;
|
prayerPoints = level;
|
||||||
}
|
}
|
||||||
dynamicLevels[slot] = level;
|
dynamicLevels[slot] = level;
|
||||||
if (restoration[slot] != null) {
|
|
||||||
restoration[slot].restartHpSummPray(false);
|
|
||||||
restoration[slot].restartStat(false);
|
|
||||||
}
|
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
PacketRepository.send(SkillLevel.class, new SkillContext((Player) entity, slot));
|
PacketRepository.send(SkillLevel.class, new SkillContext((Player) entity, slot));
|
||||||
}
|
}
|
||||||
@@ -818,10 +814,6 @@ public final class Skills {
|
|||||||
} else if (amount > 0 && level > maximum) {
|
} else if (amount > 0 && level > maximum) {
|
||||||
dynamicLevels[skill] = maximum;
|
dynamicLevels[skill] = maximum;
|
||||||
}
|
}
|
||||||
if (restoration[skill] != null) {
|
|
||||||
restoration[skill].restartHpSummPray(false);
|
|
||||||
restoration[skill].restartStat(false);
|
|
||||||
}
|
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
PacketRepository.send(SkillLevel.class, new SkillContext((Player) entity, skill));
|
PacketRepository.send(SkillLevel.class, new SkillContext((Player) entity, skill));
|
||||||
}
|
}
|
||||||
@@ -992,4 +984,4 @@ public final class Skills {
|
|||||||
public int[] getDynamicLevels() {
|
public int[] getDynamicLevels() {
|
||||||
return dynamicLevels;
|
return dynamicLevels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ public class PrayerAltarPlugin extends OptionHandler {
|
|||||||
player.getPacketDispatch().sendMessage("You recharge your Prayer points.");
|
player.getPacketDispatch().sendMessage("You recharge your Prayer points.");
|
||||||
if (node.getId() == 2640) {
|
if (node.getId() == 2640) {
|
||||||
player.getSkills().setLevel(Skills.PRAYER, player.getSkills().getStaticLevel(Skills.PRAYER) + 2);
|
player.getSkills().setLevel(Skills.PRAYER, player.getSkills().getStaticLevel(Skills.PRAYER) + 2);
|
||||||
player.getSkills().getRestoration()[Skills.PRAYER] = new SkillRestoration(Skills.PRAYER);
|
|
||||||
player.getSkills().getRestoration()[Skills.PRAYER].restartHpSummPray(false);
|
|
||||||
}
|
}
|
||||||
if (node.getId() == 409
|
if (node.getId() == 409
|
||||||
&& player.getLocation().withinDistance(new Location(3209, 3495, 1))
|
&& player.getLocation().withinDistance(new Location(3209, 3495, 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user