forked from 2009Scape/Server
Telekinetic grab now grabs all matching items within 10 tiles of the target item
If casting without line of sight, the player will now walk closer rather than simply being unable to cast
This commit is contained in:
parent
59c55708a6
commit
590e9fe44f
1 changed files with 45 additions and 5 deletions
|
|
@ -25,6 +25,9 @@ import core.game.global.action.PickupHandler;
|
|||
import core.game.world.GameWorld;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import core.game.world.map.Location;
|
||||
import core.game.interaction.MovementPulse;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
|
|
@ -106,9 +109,22 @@ public final class TelekineticGrabSpell extends MagicSpell {
|
|||
if (!canCast(entity, ground)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Snowscape: pick up all items of the target type within a square centered on the target
|
||||
int radius = 10;
|
||||
for (int x = target.getLocation().getX() - radius; x <= target.getLocation().getX() + radius; x++) {
|
||||
for (int y = target.getLocation().getY() - radius; y <= target.getLocation().getY() + radius; y++) {
|
||||
GroundItem targetItem = GroundItemManager.get(target.getId(), new Location(x,y), (Player) entity);
|
||||
if (targetItem != null) {
|
||||
GameWorld.getPulser().submit(getGrabPulse(entity, targetItem));
|
||||
visualize(entity, targetItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entity.lock(2);
|
||||
visualize(entity, target);
|
||||
GameWorld.getPulser().submit(getGrabPulse(entity, ground));
|
||||
//visualize(entity, target);
|
||||
//GameWorld.getPulser().submit(getGrabPulse(entity, ground));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +165,15 @@ public final class TelekineticGrabSpell extends MagicSpell {
|
|||
}
|
||||
playAudio(player, Sounds.VULNERABILITY_IMPACT_3008);
|
||||
if (!teleZone) {
|
||||
player.getInventory().add(new Item(g.getId(), g.getAmount(), g.getCharge()));
|
||||
if (hasSpaceFor(player, g)) {
|
||||
player.getInventory().add(new Item(g.getId(), g.getAmount(), g.getCharge()));
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TelekineticZone zone = TelekineticZone.getZone(player);
|
||||
zone.moveStatue();
|
||||
player.lock(getDelay());
|
||||
//player.lock(getDelay());
|
||||
}
|
||||
player.getPacketDispatch().sendPositionedGraphics(END_GRAPHIC, ground.getLocation());
|
||||
}
|
||||
|
|
@ -178,7 +198,27 @@ public final class TelekineticGrabSpell extends MagicSpell {
|
|||
if (entity instanceof Player) {
|
||||
final Player player = (Player) entity;
|
||||
if (!CombatSwingHandler.isProjectileClipped(player, item, false)) {
|
||||
sendMessage(player, "I can't reach that."); //TODO authentic message?
|
||||
//Move to the target, stopping and recasting when within line of sight.
|
||||
player.getPulseManager().run(new MovementPulse(player, item) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
castSpell(player, SpellBook.MODERN, SPELL_ID, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update() {
|
||||
if (CombatSwingHandler.isProjectileClipped(player, item, false)) {
|
||||
player.getWalkingQueue().reset();
|
||||
pulse();
|
||||
stop();
|
||||
return true;
|
||||
}
|
||||
return super.update();
|
||||
}
|
||||
});
|
||||
|
||||
//sendMessage(player, "I can't reach that."); //TODO authentic message?
|
||||
return false;
|
||||
}
|
||||
if (!hasSpaceFor(player, item)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue