mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
queueScript rewrite
This commit is contained in:
parent
2e54da86a4
commit
78693bbbbc
1 changed files with 23 additions and 34 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package content.region.fremennik.waterbirth.handlers;
|
||||
|
||||
import core.game.interaction.QueueStrength;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import core.game.node.entity.combat.spell.CombatSpell;
|
||||
|
|
@ -8,8 +9,6 @@ import core.game.node.entity.combat.InteractionType;
|
|||
import core.game.node.entity.combat.equipment.SwitchAttack;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
|
|
@ -81,7 +80,7 @@ public final class SpinolypNPC extends AbstractNPC {
|
|||
setSpell();
|
||||
getAggressiveHandler().setAllowTolerance(false);
|
||||
startSubmerged();
|
||||
startSubmergePulse();
|
||||
startSubmergeScript();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,38 +147,28 @@ public final class SpinolypNPC extends AbstractNPC {
|
|||
visualize(Animation.create(RESURFACE_ANIMATION), Graphics.create(WATER_SPLASH_GFX));
|
||||
}
|
||||
|
||||
private void startSubmergePulse() {
|
||||
GameWorld.getPulser().submit(new Pulse(getInitialResurfaceDelay(), this) {
|
||||
private int stage = 2;
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (stage == 0) {
|
||||
submerge();
|
||||
stage = 1;
|
||||
setDelay(SUBMERGE_ANIMATION_DELAY);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stage == 1) {
|
||||
transformWithHpCarryover(SUBMERGED_SPINOLYP);
|
||||
setNeverWalks(false);
|
||||
setWalks(true);
|
||||
getLocks().unlockMovement();
|
||||
resetWalk();
|
||||
stage = 2;
|
||||
setDelay(getSubmergedDuration());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stage == 2) {
|
||||
resurface();
|
||||
stage = 0;
|
||||
setDelay(getCombatDuration());
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
private void startSubmergeScript() {
|
||||
queueScript(this, getInitialResurfaceDelay(), QueueStrength.SOFT, true, (Integer stage) -> {
|
||||
if (stage == 0) {
|
||||
resurface();
|
||||
return delayScript(this, getCombatDuration());
|
||||
}
|
||||
|
||||
if (stage == 1) {
|
||||
submerge();
|
||||
return delayScript(this, SUBMERGE_ANIMATION_DELAY);
|
||||
}
|
||||
|
||||
if (stage == 2) {
|
||||
transformWithHpCarryover(SUBMERGED_SPINOLYP);
|
||||
setNeverWalks(false);
|
||||
setWalks(true);
|
||||
getLocks().unlockMovement();
|
||||
resetWalk();
|
||||
setCurrentScriptState(this, 0);
|
||||
return delayScript(this, getSubmergedDuration());
|
||||
}
|
||||
return stopExecuting(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue