mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Fixed ice spell casts allowing frozen victim movement for 1 tick
Fixed ice barrage animations Players who get successfully frozen by an ice spell now receive the message "You have been frozen!"
This commit is contained in:
parent
5533a2f78a
commit
1765f3a3b6
2 changed files with 210 additions and 209 deletions
|
|
@ -1,162 +1,160 @@
|
|||
package content.global.skill.magic.ancient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import core.game.node.entity.combat.spell.Runes;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import core.game.node.entity.combat.spell.CombatSpell;
|
||||
import core.game.node.entity.combat.spell.SpellType;
|
||||
import core.game.node.entity.impl.Projectile;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.item.Item;
|
||||
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.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Handles the Ice spells from the Ancient spellbook.
|
||||
* @author Emperor
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class IceSpells extends CombatSpell {
|
||||
|
||||
/**
|
||||
* The barrage orb GFX.
|
||||
*/
|
||||
private static final Graphics BARRAGE_ORB = new Graphics(1677, 96); //119
|
||||
|
||||
/**
|
||||
* The projectile for Ice rush.
|
||||
*/
|
||||
private static final Projectile RUSH_PROJECTILE = Projectile.create((Entity) null, null, 360, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics RUSH_END = new Graphics(361, 96);
|
||||
|
||||
/**
|
||||
* The projectile for Ice barrage.
|
||||
*/
|
||||
private static final Projectile BURST_PROJECTILE = Projectile.create((Entity) null, null, 362, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice barrage.
|
||||
*/
|
||||
private static final Graphics BURST_END = new Graphics(363, 0);
|
||||
|
||||
/**
|
||||
* The start graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics BLITZ_START = new Graphics(366, 96);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics BLITZ_END = new Graphics(367, 96);
|
||||
|
||||
/**
|
||||
* The projectile for Ice barrage.
|
||||
*/
|
||||
private static final Projectile BARRAGE_PROJECTILE = Projectile.create((Entity) null, null, 368, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice barrage.
|
||||
*/
|
||||
private static final Graphics BARRAGE_END = new Graphics(369, 0);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code IceSpells} {@code Object}.
|
||||
*/
|
||||
public IceSpells() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code IceSpells} {@Code Object}
|
||||
* @param type The spell type.
|
||||
* @param impactSound The impact sound id.
|
||||
* @param anim The animation.
|
||||
* @param start The start graphics.
|
||||
* @param projectile The projectile.
|
||||
* @param end The end graphics.
|
||||
*/
|
||||
private IceSpells(SpellType type, int level, double baseExperience, int impactSound, Animation anim, Graphics start, Projectile projectile, Graphics end, Item... runes) {
|
||||
super(type, SpellBook.ANCIENT, level, baseExperience, Sounds.ICE_CAST_171, impactSound, anim, start, projectile, end, runes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(Entity entity, Node target) {
|
||||
entity.graphics(graphic);
|
||||
if (projectile != null) {
|
||||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
playGlobalAudio(entity.getLocation(), audio.id, 20);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
|
||||
if (state.isFrozen()) {
|
||||
playGlobalAudio(target.getLocation(), impactAudio, 20);
|
||||
target.graphics(BARRAGE_ORB);
|
||||
return;
|
||||
}
|
||||
super.visualizeImpact(entity, target, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
||||
SpellBook.ANCIENT.register(0, new IceSpells(SpellType.RUSH, 58, 34.0, Sounds.ICE_RUSH_IMPACT_173, new Animation(1978, Priority.HIGH), null, RUSH_PROJECTILE, RUSH_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(2), Runes.WATER_RUNE.getItem(2)));
|
||||
SpellBook.ANCIENT.register(2, new IceSpells(SpellType.BURST, 70, 40.0, Sounds.ICE_BURST_IMPACT_170, new Animation(1979, Priority.HIGH), null, BURST_PROJECTILE, BURST_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(4), Runes.WATER_RUNE.getItem(4)));
|
||||
SpellBook.ANCIENT.register(1, new IceSpells(SpellType.BLITZ, 82, 46.0, Sounds.ICE_BLITZ_IMPACT_169, new Animation(1978, Priority.HIGH), BLITZ_START, null, BLITZ_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
|
||||
SpellBook.ANCIENT.register(3, new IceSpells(SpellType.BARRAGE, 94, 52.0, Sounds.ICE_BARRAGE_IMPACT_168, new Animation(1979, Priority.HIGH), null, BARRAGE_PROJECTILE, BARRAGE_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(4), Runes.WATER_RUNE.getItem(6)));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireEffect(Entity entity, Entity victim, BattleState state) {
|
||||
if (state.getEstimatedHit() == -1) {
|
||||
return;
|
||||
}
|
||||
int ticks = (1 + (type.ordinal() - SpellType.RUSH.ordinal())) * 8;
|
||||
if (state.getEstimatedHit() > -1) {
|
||||
if (!hasTimerActive(victim, "frozen:immunity")) {
|
||||
registerTimer(victim, spawnTimer("frozen", ticks, true));
|
||||
} else if (type == SpellType.BARRAGE) {
|
||||
state.setFrozen(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattleState[] getTargets(Entity entity, Entity target) {
|
||||
if (animation.getId() == 1978 || !entity.getProperties().isMultiZone() || !target.getProperties().isMultiZone()) {
|
||||
return super.getTargets(entity, target);
|
||||
}
|
||||
List<Entity> list = getMultihitTargets(entity, target, 9);
|
||||
BattleState[] targets = new BattleState[list.size()];
|
||||
int index = 0;
|
||||
for (Entity e : list) {
|
||||
targets[index++] = new BattleState(entity, e);
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
|
||||
return getType().getImpactAmount(entity, victim, 4);
|
||||
}
|
||||
|
||||
}
|
||||
package content.global.skill.magic.ancient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import core.game.node.entity.combat.spell.Runes;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import core.game.node.entity.combat.spell.CombatSpell;
|
||||
import core.game.node.entity.combat.spell.SpellType;
|
||||
import core.game.node.entity.impl.Projectile;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.item.Item;
|
||||
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.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Handles the Ice spells from the Ancient spellbook.
|
||||
* @author Emperor
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class IceSpells extends CombatSpell {
|
||||
|
||||
/**
|
||||
* The barrage orb GFX.
|
||||
*/
|
||||
private static final Graphics BARRAGE_ORB = new Graphics(1677, 96); //119
|
||||
|
||||
/**
|
||||
* The projectile for Ice rush.
|
||||
*/
|
||||
private static final Projectile RUSH_PROJECTILE = Projectile.create((Entity) null, null, 360, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics RUSH_END = new Graphics(361, 96);
|
||||
|
||||
/**
|
||||
* The projectile for Ice barrage.
|
||||
*/
|
||||
private static final Projectile BURST_PROJECTILE = Projectile.create((Entity) null, null, 362, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice barrage.
|
||||
*/
|
||||
private static final Graphics BURST_END = new Graphics(363, 0);
|
||||
|
||||
/**
|
||||
* The start graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics BLITZ_START = new Graphics(366, 96);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice rush.
|
||||
*/
|
||||
private static final Graphics BLITZ_END = new Graphics(367, 96);
|
||||
|
||||
/**
|
||||
* The projectile for Ice barrage.
|
||||
*/
|
||||
private static final Projectile BARRAGE_PROJECTILE = Projectile.create((Entity) null, null, 368, 40, 36, 52, 75, 15, 11);
|
||||
|
||||
/**
|
||||
* The end graphic for Ice barrage.
|
||||
*/
|
||||
private static final Graphics BARRAGE_END = new Graphics(369, 0);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code IceSpells} {@code Object}.
|
||||
*/
|
||||
public IceSpells() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code IceSpells} {@Code Object}
|
||||
* @param type The spell type.
|
||||
* @param impactSound The impact sound id.
|
||||
* @param anim The animation.
|
||||
* @param start The start graphics.
|
||||
* @param projectile The projectile.
|
||||
* @param end The end graphics.
|
||||
*/
|
||||
private IceSpells(SpellType type, int level, double baseExperience, int impactSound, Animation anim, Graphics start, Projectile projectile, Graphics end, Item... runes) {
|
||||
super(type, SpellBook.ANCIENT, level, baseExperience, Sounds.ICE_CAST_171, impactSound, anim, start, projectile, end, runes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(Entity entity, Node target) {
|
||||
entity.graphics(graphic);
|
||||
if (projectile != null) {
|
||||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
playGlobalAudio(entity.getLocation(), audio.id, 20);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
|
||||
if (state.isFrozen()) {
|
||||
playGlobalAudio(target.getLocation(), impactAudio, 20);
|
||||
target.graphics(BARRAGE_ORB);
|
||||
return;
|
||||
}
|
||||
super.visualizeImpact(entity, target, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
||||
SpellBook.ANCIENT.register(0, new IceSpells(SpellType.RUSH, 58, 34.0, Sounds.ICE_RUSH_IMPACT_173, new Animation(1978, Priority.HIGH), null, RUSH_PROJECTILE, RUSH_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(2), Runes.WATER_RUNE.getItem(2)));
|
||||
SpellBook.ANCIENT.register(2, new IceSpells(SpellType.BURST, 70, 40.0, Sounds.ICE_BURST_IMPACT_170, new Animation(1979, Priority.HIGH), null, BURST_PROJECTILE, BURST_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(4), Runes.WATER_RUNE.getItem(4)));
|
||||
SpellBook.ANCIENT.register(1, new IceSpells(SpellType.BLITZ, 82, 46.0, Sounds.ICE_BLITZ_IMPACT_169, new Animation(1978, Priority.HIGH), BLITZ_START, null, BLITZ_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
|
||||
SpellBook.ANCIENT.register(3, new IceSpells(SpellType.BARRAGE, 94, 52.0, Sounds.ICE_BARRAGE_IMPACT_168, new Animation(1979, Priority.HIGH), null, BARRAGE_PROJECTILE, BARRAGE_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(4), Runes.WATER_RUNE.getItem(6)));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireEffect(Entity entity, Entity victim, BattleState state) {
|
||||
if (state.getEstimatedHit() == -1) {
|
||||
return;
|
||||
}
|
||||
int ticks = (type.ordinal() - 4) * 8;
|
||||
if (hasTimerActive(victim, "frozen") || hasTimerActive(victim, "frozen:immunity")) {
|
||||
if (type == SpellType.BARRAGE) { state.setFrozen(true); }
|
||||
return;
|
||||
}
|
||||
registerTimer(victim, spawnTimer("frozen", ticks, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattleState[] getTargets(Entity entity, Entity target) {
|
||||
if (animation.getId() == 1978 || !entity.getProperties().isMultiZone() || !target.getProperties().isMultiZone()) {
|
||||
return super.getTargets(entity, target);
|
||||
}
|
||||
List<Entity> list = getMultihitTargets(entity, target, 9);
|
||||
BattleState[] targets = new BattleState[list.size()];
|
||||
int index = 0;
|
||||
for (Entity e : list) {
|
||||
targets[index++] = new BattleState(entity, e);
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
|
||||
return getType().getImpactAmount(entity, victim, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,50 @@
|
|||
package core.game.system.timer.impl
|
||||
|
||||
import core.game.system.timer.*
|
||||
import core.api.*
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.repository.Repository
|
||||
import org.json.simple.*
|
||||
|
||||
class Frozen : PersistTimer (1, "frozen", flags = arrayOf(TimerFlag.ClearOnDeath)) {
|
||||
var shouldApplyImmunity = false
|
||||
|
||||
override fun save (root: JSONObject, entity: Entity) {
|
||||
root["ticksLeft"] = (nextExecution - getWorldTicks()).toString()
|
||||
root["applyImmunity"] = shouldApplyImmunity
|
||||
}
|
||||
|
||||
override fun parse (root: JSONObject, entity: Entity) {
|
||||
runInterval = root["ticksLeft"].toString().toInt()
|
||||
shouldApplyImmunity = root["applyImmunity"] as? Boolean ?: false
|
||||
}
|
||||
|
||||
override fun beforeRegister (entity: Entity) {
|
||||
if (hasTimerActive<FrozenImmunity>(entity)) {
|
||||
removeTimer(entity, this)
|
||||
return
|
||||
}
|
||||
if (hasTimerActive<Frozen>(entity)) {
|
||||
removeTimer(entity, this)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
override fun run (entity: Entity) : Boolean {
|
||||
if (shouldApplyImmunity) {
|
||||
registerTimer (entity, spawnTimer<FrozenImmunity>(7))
|
||||
} else (entity as? Player)?.debug ("Can't apply immunity")
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getTimer (vararg args: Any) : RSTimer {
|
||||
val inst = Frozen()
|
||||
inst.runInterval = args.getOrNull(0) as? Int ?: 10
|
||||
inst.shouldApplyImmunity = args.getOrNull(1) as? Boolean ?: false
|
||||
return inst
|
||||
}
|
||||
}
|
||||
package core.game.system.timer.impl
|
||||
|
||||
import core.game.system.timer.*
|
||||
import core.api.*
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.repository.Repository
|
||||
import org.json.simple.*
|
||||
|
||||
class Frozen : PersistTimer (1, "frozen", flags = arrayOf(TimerFlag.ClearOnDeath)) {
|
||||
var shouldApplyImmunity = false
|
||||
|
||||
override fun save (root: JSONObject, entity: Entity) {
|
||||
root["ticksLeft"] = (nextExecution - getWorldTicks()).toString()
|
||||
root["applyImmunity"] = shouldApplyImmunity
|
||||
}
|
||||
|
||||
override fun parse (root: JSONObject, entity: Entity) {
|
||||
runInterval = root["ticksLeft"].toString().toInt()
|
||||
shouldApplyImmunity = root["applyImmunity"] as? Boolean ?: false
|
||||
}
|
||||
|
||||
override fun beforeRegister (entity: Entity) {
|
||||
if (hasTimerActive<FrozenImmunity>(entity)) {
|
||||
removeTimer(entity, this)
|
||||
return
|
||||
}
|
||||
if (hasTimerActive<Frozen>(entity)) {
|
||||
removeTimer(entity, this)
|
||||
return
|
||||
}
|
||||
if (entity is Player) {
|
||||
sendMessage(entity as Player, "You have been frozen!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun run (entity: Entity) : Boolean {
|
||||
if (shouldApplyImmunity) {
|
||||
registerTimer (entity, spawnTimer<FrozenImmunity>(7))
|
||||
} else (entity as? Player)?.debug ("Can't apply immunity")
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getTimer (vararg args: Any) : RSTimer {
|
||||
val inst = Frozen()
|
||||
inst.runInterval = args.getOrNull(0) as? Int ?: 10
|
||||
inst.shouldApplyImmunity = args.getOrNull(1) as? Boolean ?: false
|
||||
return inst
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue