Files
2009scape/Server/src/main/content/global/skill/magic/ancient/ShadowSpells.java
T
Zerken a105821427 Audio Refactor
1st of many audio refactors, the end goal is removing AudioManager.java and using contentAPI functions for all sound
Refactored playAudio
Refactored playGlobalAudio
Fixed lunar teleport sounds to not play if teleblocked
Refactored the following sounds:
All the special attack and DFS sounds defaulting to new API radius of 8 instead of 5
Dropping coins, item, and destroying object sounds fixed
Ectophial refill sound
Agility pyramid sounds
Emptying a fishbowl
Enchanted jewellery teleport sound
Enchanted jewellery enchant tab sound
All the sounds for Elemental Workshop 1 listeners
The sound when getting experience from a lamp
Blessing and repairing a grave
Hunter pitfall sounds
Hunter sound when catching a kebbit with a noose
Lunar cure me and cure group spell sound
High and low alchemy spells
Silver crafting at a furnace
Spinning at a spinning wheel
Drinking from a waterskin in the desert
Sound when being blessed by drezel in nature's spirit quest
Sound when poison immunity has 30 seconds left and when your immunity expires
Shearing regular sheep and the penguin sheep at lumbridge
Sound when regular spell book charge spell expires
GE sounds: making 0 coin offer when buying, not having enough money, placing a buy offer, not enough room in inventory
Sound when filling vessels from a water source
Regular and ancient combat spells
2023-08-20 07:21:24 +00:00

133 lines
5.1 KiB
Java

package content.global.skill.magic.ancient;
import java.util.List;
import core.game.node.entity.player.Player;
import core.game.node.entity.skill.Skills;
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.playGlobalAudio;
/**
* Handles the Shadow spells from the Ancient spellbook.
* @author Emperor
*/
@Initializable
public final class ShadowSpells extends CombatSpell {
/**
* The projectile for Shadow rush.
*/
private static final Projectile RUSH_PROJECTILE = Projectile.create((Entity) null, null, 378, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Shadow rush.
*/
private static final Graphics RUSH_END = new Graphics(379, 96);
/**
* The projectile for Shadow burst.
*/
private static final Projectile BURST_PROJECTILE = Projectile.create((Entity) null, null, 380, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Shadow burst.
*/
private static final Graphics BURST_END = new Graphics(381, 0);
/**
* The end graphic for Shadow blitz.
*/
private static final Graphics BLITZ_END = new Graphics(382, 96);
/**
* The end graphic for Shadow barrage.
*/
private static final Graphics BARRAGE_END = new Graphics(383, 0);
/**
* Constructs a new {@code ShadowSpells} {@code Object}.
*/
public ShadowSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code ShadowSpells} {@Code Object}
* @param type The spell type.
* @param level The level requirement.
* @param sound The casting sound.
* @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 ShadowSpells(SpellType type, int level, double baseExperience, int sound, int impactSound, Animation anim, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.ANCIENT, level, baseExperience, sound, impactSound, anim, start, projectile, end, runes);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.ANCIENT.register(12, new ShadowSpells(SpellType.RUSH, 52, 31.0, Sounds.SHADOW_CAST_178, Sounds.SHADOW_RUSH_IMPACT_179, new Animation(1978, Priority.HIGH), null, RUSH_PROJECTILE, RUSH_END, Runes.SOUL_RUNE.getItem(1), Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(2), Runes.AIR_RUNE.getItem(1)));
SpellBook.ANCIENT.register(14, new ShadowSpells(SpellType.BURST, 64, 37.0, Sounds.SHADOW_CAST_178, Sounds.SHADOW_BURST_IMPACT_177, new Animation(1979, Priority.HIGH), null, BURST_PROJECTILE, BURST_END, Runes.SOUL_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(4), Runes.AIR_RUNE.getItem(1)));
SpellBook.ANCIENT.register(13, new ShadowSpells(SpellType.BLITZ, 76, 43.0, Sounds.SHADOW_CAST_178, Sounds.SHADOW_BLITZ_IMPACT_176, new Animation(1978, Priority.HIGH), null, null, BLITZ_END, Runes.SOUL_RUNE.getItem(2), Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2)));
SpellBook.ANCIENT.register(15, new ShadowSpells(SpellType.BARRAGE, 88, 48.0, Sounds.SHADOW_CAST_178, Sounds.SHADOW_BARRAGE_IMPACT_175, new Animation(1979, Priority.HIGH), null, null, BARRAGE_END, Runes.SOUL_RUNE.getItem(3), Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(4), Runes.AIR_RUNE.getItem(4)));
return this;
}
@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.getId(), 20);
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (state.getEstimatedHit() > -1) {
int level = victim.getSkills().getStaticLevel(Skills.ATTACK);
victim.getSkills().updateLevel(Skills.ATTACK, (int) -(level * 0.1), (int) (level - (level * 0.1)));
}
}
@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, 2);
}
}