lunar pot fixes

This commit is contained in:
Player Name 2026-07-25 08:32:24 +02:00
parent 642dc4b162
commit c4fa99d6d3
3 changed files with 14 additions and 17 deletions

View file

@ -1,5 +1,6 @@
package content.global.skill.magic.lunar;
import core.game.bots.AIPlayer;
import core.game.node.entity.combat.spell.MagicSpell;
import core.game.node.entity.combat.spell.Runes;
import core.plugin.Initializable;
@ -92,7 +93,7 @@ public final class HealSpell extends MagicSpell {
player.getPacketDispatch().sendMessage("This player is busy.");
return false;
}
if (!o.getSettings().isAcceptAid()) {
if (!o.getSettings().isAcceptAid() || (o instanceof AIPlayer)) {
player.getPacketDispatch().sendMessage("The player is not accepting any aid.");
return false;
}

View file

@ -41,15 +41,16 @@ public final class StatBoostSpell extends MagicSpell {
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
Item item = ((Item) target);
final Potion potion = (Potion) Consumables.getConsumableById(item.getId()).getConsumable();
final Player player = (Player) entity;
Item item = (Item) target;
player.getInterfaceManager().setViewedTab(6);
final Potion potion = (Potion) Consumables.getConsumableById(item.getId()).getConsumable();
if (potion == null) {
player.getPacketDispatch().sendMessage("You can only cast this spell on a potion.");
return false;
}
if (!item.getDefinition().isTradeable() || item.getName().toLowerCase().contains("restore") || item.getName().toLowerCase().contains("zamorak") || item.getName().toLowerCase().contains("saradomin") || item.getName().toLowerCase().contains("combat")) {
if (!item.getDefinition().isTradeable() || item.getName().toLowerCase().contains("restore") || item.getName().toLowerCase().contains("zamorak") || item.getName().toLowerCase().contains("saradomin")) {
player.getPacketDispatch().sendMessage("You can't cast this spell on that item.");
return false;
}
@ -70,7 +71,7 @@ public final class StatBoostSpell extends MagicSpell {
if (!o.isActive() || o.getLocks().isInteractionLocked()) {
continue;
}
if (!o.getSettings().isAcceptAid() && !(o instanceof AIPlayer)) {
if (!o.getSettings().isAcceptAid() || o instanceof AIPlayer) {
continue;
}
o.graphics(GRAPHICS);

View file

@ -46,13 +46,7 @@ public class StatRestoreSpell extends MagicSpell {
Item item = ((Item) target);
player.getInterfaceManager().setViewedTab(6);
if (Consumables.getConsumableById(item.getId()) == null) {
player.getPacketDispatch().sendMessage("You can only cast this spell on a potion.");
return false;
}
final Potion potion = (Potion) Consumables.getConsumableById(item.getId()).getConsumable();
if (potion == null) {
player.getPacketDispatch().sendMessage("You can only cast this spell on a potion.");
return false;
@ -63,22 +57,23 @@ public class StatRestoreSpell extends MagicSpell {
}
List<Player> pl = RegionManager.getLocalPlayers(player.getLocation(), 1);
int doses = potion.getDose(item);
if (pl.isEmpty()) {
return false;
}
if (!super.meetsRequirements(player, true, false)) {
return false;
}
int size = 0;
for (Player o : pl) {
if (size >= doses) break;
if (!o.isActive() || o.getLocks().isInteractionLocked() || o == player) {
if (o == player) {
continue;
}
if (!o.getSettings().isAcceptAid() && !(o instanceof AIPlayer)) {
if (!o.isActive() || o.getLocks().isInteractionLocked()) {
continue;
}
if (!o.getSettings().isAcceptAid() || (o instanceof AIPlayer)) {
continue;
}
o.graphics(GRAPHICS);
playGlobalAudio(o.getLocation(), Sounds.LUNAR_STAT_SHARE_INDIVIDUAL_2897);
potion.getEffect().activate(o);
size++;
}