mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 11:25:11 -06:00
Improve lunar group spells
This commit is contained in:
parent
319b019ec3
commit
9c42c7e4c9
4 changed files with 35 additions and 31 deletions
|
|
@ -118,7 +118,7 @@ public final class HealSpell extends MagicSpell {
|
|||
List<Player> players = RegionManager.getLocalPlayers(player.getLocation(), 1);
|
||||
for (Iterator<Player> it = players.iterator(); it.hasNext();) {
|
||||
Player p = it.next();
|
||||
if (p.getName() == player.getName() || !p.getSettings().isAcceptAid() || !p.isActive() || p.getSkills().getLifepoints() == p.getSkills().getMaximumLifepoints()) {
|
||||
if (p == player || !p.getSettings().isAcceptAid() || !p.isActive() || p.getSkills().getLifepoints() == p.getSkills().getMaximumLifepoints()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,16 +497,16 @@ class LunarListeners : SpellListener("lunar"), Commands {
|
|||
removeRunes(player, true)
|
||||
visualizeSpell(player, Animations.LUNAR_SPELLBOOK_CURE_GROUP_4409, Graphics.LUNAR_SPELLBOOK_CURE_GROUP_744, 130, Sounds.LUNAR_CURE_GROUP_2882)
|
||||
curePoison(player)
|
||||
for (player in RegionManager.getLocalPlayers(player.location, 1)) {
|
||||
if (!player.isActive || player.locks.isInteractionLocked) {
|
||||
for (otherPlayer in RegionManager.getLocalPlayers(player.location, 1)) {
|
||||
if (otherPlayer == player || !otherPlayer.isActive || otherPlayer.locks.isInteractionLocked) {
|
||||
continue
|
||||
}
|
||||
if (!player.settings.isAcceptAid) {
|
||||
if (!otherPlayer.settings.isAcceptAid) {
|
||||
continue
|
||||
}
|
||||
curePoison(player)
|
||||
sendMessage(player, "You have been cured of poison.")
|
||||
visualizeSpell(player, -1, Graphics.LUNAR_SPELLBOOK_CURE_GROUP_744, 130, Sounds.LUNAR_CURE_OTHER_INDIVIDUAL_2889)
|
||||
curePoison(otherPlayer)
|
||||
sendMessage(otherPlayer, "You have been cured of poison.")
|
||||
visualizeSpell(otherPlayer, -1, Graphics.LUNAR_SPELLBOOK_CURE_GROUP_744, 130, Sounds.LUNAR_CURE_OTHER_INDIVIDUAL_2889)
|
||||
}
|
||||
addXP(player, 74.0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import core.game.world.update.flag.context.Animation;
|
|||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import org.rs09.consts.Items;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -63,7 +64,7 @@ public final class StatBoostSpell extends MagicSpell {
|
|||
int size = 0;
|
||||
for (Player o : pl) {
|
||||
if (size >= doses) break;
|
||||
if (!o.isActive() || o.getLocks().isInteractionLocked() || o == player) {
|
||||
if (!o.isActive() || o.getLocks().isInteractionLocked()) {
|
||||
continue;
|
||||
}
|
||||
if (!o.getSettings().isAcceptAid() && !(o instanceof AIPlayer)) {
|
||||
|
|
@ -79,17 +80,18 @@ public final class StatBoostSpell extends MagicSpell {
|
|||
return false;
|
||||
}
|
||||
super.meetsRequirements(player, true, true);
|
||||
potion.getEffect().activate(player);
|
||||
playGlobalAudio(player.getLocation(), Sounds.LUNAR_STRENGTH_SHARE_2901);
|
||||
player.animate(ANIMATION);
|
||||
player.graphics(GRAPHICS);
|
||||
player.getInventory().remove(item);
|
||||
int newIndex = (potion.getIds().length - doses) + size;
|
||||
if (newIndex > potion.getIds().length - 1) {
|
||||
player.getInventory().add(new Item(229));
|
||||
return true;
|
||||
}
|
||||
player.getInventory().add(new Item(potion.getIds()[newIndex]));
|
||||
if (player.getInventory().remove(item)) {
|
||||
potion.getEffect().activate(player);
|
||||
playGlobalAudio(player.getLocation(), Sounds.LUNAR_STRENGTH_SHARE_2901);
|
||||
player.animate(ANIMATION);
|
||||
player.graphics(GRAPHICS);
|
||||
int newIndex = (potion.getIds().length - doses) + size;
|
||||
if (newIndex > potion.getIds().length - 1) {
|
||||
player.getInventory().add(new Item(Items.VIAL_229));
|
||||
return true;
|
||||
}
|
||||
player.getInventory().add(new Item(potion.getIds()[newIndex]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import core.game.world.map.RegionManager;
|
|||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
import org.rs09.consts.Items;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -45,22 +46,22 @@ public class StatRestoreSpell extends MagicSpell {
|
|||
Item item = ((Item) target);
|
||||
player.getInterfaceManager().setViewedTab(6);
|
||||
|
||||
if (Consumables.getConsumableById(item.getId()) == null) {
|
||||
if (Consumables.getConsumableById(item.getId()) == null) {
|
||||
player.getPacketDispatch().sendMessage("You can only cast this spell on a potion.");
|
||||
return false;
|
||||
}
|
||||
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.");
|
||||
player.getPacketDispatch().sendMessage("You can only cast this spell on a potion.");
|
||||
return false;
|
||||
}
|
||||
if (!item.getDefinition().isTradeable() || !isRestore(potion)) {
|
||||
player.getPacketDispatch().sendMessage("You can't cast this spell on that item.");
|
||||
return false;
|
||||
}
|
||||
List<Player> pl = RegionManager.getLocalPlayers(player.getLocation(), 2);
|
||||
List<Player> pl = RegionManager.getLocalPlayers(player.getLocation(), 1);
|
||||
int doses = potion.getDose(item);
|
||||
if (pl.isEmpty()) {
|
||||
return false;
|
||||
|
|
@ -90,13 +91,14 @@ public class StatRestoreSpell extends MagicSpell {
|
|||
playGlobalAudio(player.getLocation(), Sounds.LUNAR_STAT_SHARE_2899);
|
||||
player.animate(ANIMATION);
|
||||
player.graphics(GRAPHICS);
|
||||
player.getInventory().remove(item);
|
||||
int newIndex = (potion.getIds().length - doses) + size;
|
||||
if (newIndex > potion.getIds().length - 1) {
|
||||
player.getInventory().add(new Item(229));
|
||||
return true;
|
||||
}
|
||||
player.getInventory().add(new Item(potion.getIds()[newIndex]));
|
||||
if (player.getInventory().remove(item)) {
|
||||
int newIndex = (potion.getIds().length - doses) + size;
|
||||
if (newIndex > potion.getIds().length - 1) {
|
||||
player.getInventory().add(new Item(Items.VIAL_229));
|
||||
return true;
|
||||
}
|
||||
player.getInventory().add(new Item(potion.getIds()[newIndex]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue