Rebase with upstream

This commit is contained in:
verinia 2019-05-28 22:15:17 -08:00
commit 101b8314c9
2889 changed files with 481914 additions and 0 deletions

View file

@ -0,0 +1,7 @@
/**
* Holds combat-related plugins
*
* @author Emperor
*
*/
package plugin.combat;

View file

@ -0,0 +1,76 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the ancient mace special attack "Favour of the War God".
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class AncientMaceSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(6147, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1052);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(11061, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.1, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1));
if (entity.getSkills().getPrayerPoints() < entity.getSkills().getStaticLevel(5)) {
entity.getSkills().setPrayerPoints(entity.getSkills().getPrayerPoints() + hit);
}
victim.getSkills().decrementPrayerPoints(hit);
}
state.setEstimatedHit(hit);
return 1;
}
@Override
protected int getFormatedHit(Entity entity, Entity victim, BattleState state, int hit) {
// Disables protection prayers.
return formatHit(entity, victim, hit);
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,70 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the new Armadyl C'bow special attack.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class ArmadylCrossbowSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(4230, Priority.HIGH);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(14671, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
configureRangeData(p, state);
if (state.getWeapon() == null || !hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 2.0, 1.0)) {//2x the accuracy
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
}
useAmmo(entity, state, victim.getLocation());
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.animate(ANIMATION);
Projectile.create(entity, victim, 698, 36, 25, 35, 50).send();
}
}

View file

@ -0,0 +1,74 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Bone dagger special attack "Backstab".
* @author Emperor
*/
@InitializablePlugin
public final class BackstabSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 75;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(4198, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(704);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(8872, this);
CombatStyle.MELEE.getSwingHandler().register(8874, this);
CombatStyle.MELEE.getSwingHandler().register(8876, this);
CombatStyle.MELEE.getSwingHandler().register(8878, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
double accuracy = 1.0;
if (!victim.getProperties().getCombatPulse().isAttacking()) {
accuracy = 1.75;
}
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, accuracy, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
victim.getSkills().updateLevel(Skills.DEFENCE, -hit / 10, 0);
}
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,191 @@
package plugin.combat.special;
import java.util.Iterator;
import java.util.List;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.DeathTask;
import org.crandor.game.node.entity.combat.ImpactHandler.HitsplatType;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.system.task.Pulse;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.MapDistance;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.repository.Repository;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Rune throwing axe special attack "Chain-hit".
* @author Emperor
*/
@InitializablePlugin
public final class ChainhitSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The sp::ecial energy required.
*/
private static final int SPECIAL_ENERGY = 10;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1068, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(257, 96);
/**
* The door support locations.
*/
private static final Location[] DOOR_SUPPORTS = new Location[] { Location.create(2545, 10145, 0), Location.create(2545, 10141, 0) };
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(805, this);
return this;
}
@Override
public int swing(Entity entity, final Entity victim, BattleState state) {
if (entity.getAttribute("chain-hit_v") != null) {
((Player) entity).getPacketDispatch().sendMessage("You're already using the chain-hit special attack.");
((Player) entity).getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
if (victim instanceof NPC) {
NPC npc = victim.asNpc();
if (npc.getId() == 2443) {
for (Location l : DOOR_SUPPORTS) {
final NPC n = Repository.findNPC(l);
if (n == null) {
continue;
}
if (DeathTask.isDead(n) || n.getId() != n.getOriginalId()) {
continue;
}
int speed = (int) (32 + (victim.getLocation().getDistance(n.getLocation()) * 5));
Projectile.create(victim, n, 258, 40, 36, 32, speed, 5, 11).send();
n.getSkills().heal(100);
GameWorld.submit(new Pulse(3) {
@Override
public boolean pulse() {
n.getImpactHandler().manualHit(victim, 1, HitsplatType.NORMAL);
return true;
}
});
}
}
}
return super.swing(entity, victim, state);
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
int speed = (int) (32 + (entity.getLocation().getDistance(victim.getLocation()) * 5));
Projectile.create(entity, victim, 258, 40, 36, 32, speed, 5, 11).send();
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
handleHit(entity, victim, (Player) entity, state);
super.visualizeImpact(entity, victim, state);
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
// Empty.
}
/**
* Handles a hit.
* @param entity The entity.
* @param victim The victim.
* @param player The player.
* @param state The battle state.
* @param hit The hit.
*/
public void handleHit(final Entity entity, final Entity victim, final Player player, final BattleState state) {
GameWorld.submit(new Pulse(1, player, victim) {
@Override
public boolean pulse() {
ChainhitSpecialHandler.super.onImpact(player, victim, state);
ChainhitSpecialHandler.super.impact(entity, victim, state);
return true;
}
});
if (victim.getId() == 2440 || victim.getId() == 2446 || victim.getId() == 2443) {
return;
}
if (victim.getProperties().isMultiZone() && player.getSettings().getSpecialEnergy() >= SPECIAL_ENERGY) {
List<? extends Entity> list = getVictimsList(player, victim);
for (Iterator<? extends Entity> it = list.iterator(); it.hasNext();) {
final Entity e = it.next();
it.remove();
if (!e.isAttackable(player, CombatStyle.RANGE) || !e.getProperties().isMultiZone()) {
continue;
}
double distance = victim.getLocation().getDistance(e.getLocation());
int speed = (int) (32 + (distance * 5));
Projectile.create(victim, e, 258, 40, 36, 32, speed, 5, 11).send();
GameWorld.submit(new Pulse((int) (distance / 3), entity, victim, e) {
@Override
public boolean pulse() {
BattleState bs = new BattleState(entity, e);
bs.setMaximumHit(calculateHit(player, e, 1.0));
bs.setEstimatedHit(RandomFunction.RANDOM.nextInt(bs.getMaximumHit()));
handleHit(victim, e, player, bs);
ChainhitSpecialHandler.super.visualizeImpact(player, e, bs);
return true;
}
});
player.getSettings().setSpecialEnergy(player.getSettings().getSpecialEnergy() - SPECIAL_ENERGY);
return;
}
}
player.removeAttribute("chain-hit_v");
}
/**
* Gets the victims list.
* @param e The attacking entity.
* @return The victims list.
*/
private List<? extends Entity> getVictimsList(Entity e, Entity victim) {
List<? extends Entity> list = e.getAttribute("chain-hit_v");
if (list == null) {
int distance = MapDistance.RENDERING.getDistance() / 3;
if (victim instanceof NPC) {
e.setAttribute("chain-hit_v", list = RegionManager.getLocalNpcs(e, distance));
} else {
e.setAttribute("chain-hit_v", list = RegionManager.getLocalPlayers(e, distance));
}
list.remove(e);
list.remove(victim);
}
return list;
}
}

View file

@ -0,0 +1,69 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the cleave special handler.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class CleaveSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1058, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(248, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(1305, this) && CombatStyle.MELEE.getSwingHandler().register(13475, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.18, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.2203));
}
state.setEstimatedHit(hit);
entity.asPlayer().getAudioManager().send(new Audio(2529), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,76 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the dragon axe's clobbrer special handler.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class ClobberSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(2876, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(479, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(6739, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (entity instanceof Player) {
entity.asPlayer().sendChat("Chop chop!");
}
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.05, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
if (hit > 9) {
int amount = hit / 10;
victim.getSkills().updateLevel(Skills.DEFENCE, -amount, 0);
victim.getSkills().updateLevel(Skills.MAGIC, -amount, 0);
}
}
entity.getSkills().updateLevel(Skills.WOODCUTTING, 3);
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,149 @@
package plugin.combat.special;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.equipment.Ammunition;
import org.crandor.game.node.entity.combat.equipment.RangeWeapon;
import org.crandor.game.node.entity.combat.equipment.Weapon;
import org.crandor.game.node.entity.combat.equipment.Weapon.WeaponType;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the descent of darkness sepcial handler.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class DescentOfDarknessSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 65;
/**
* The descent of dragons projectile.
*/
private static final Projectile DRAGON_PROJECTILE = Projectile.create((Entity) null, null, 1099, 40, 36, 41, 46, 5, 11);
/**
* The descent of dragons secondary projectile.
*/
private static final Projectile DRAGON_PROJECTILE_1 = Projectile.create((Entity) null, null, 1099, 40, 36, 41, 55, 25, 11);
/**
* The descent of darkness projectile.
*/
private static final Projectile DARKNESS_PROJECTILE = Projectile.create((Entity) null, null, 1101, 40, 36, 41, 46, 5, 11);
/**
* The descent of darkness secondary projectile.
*/
private static final Projectile DARKNESS_PROJECTILE_1 = Projectile.create((Entity) null, null, 1101, 40, 36, 41, 55, 25, 11);
/**
* The descent of dragons impact graphic.
*/
private static final Graphics DRAGON_IMPACT = new Graphics(1100, 96);
/**
* The descent of darkness impact graphic.
*/
private static final Graphics DARKNESS_IMPACT = new Graphics(1103, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.RANGE.getSwingHandler().register(11235, this) && CombatStyle.RANGE.getSwingHandler().register(13405, this) && CombatStyle.RANGE.getSwingHandler().register(14803, this) && CombatStyle.RANGE.getSwingHandler().register(14804, this) && CombatStyle.RANGE.getSwingHandler().register(14805, this) && CombatStyle.RANGE.getSwingHandler().register(14806, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
RangeWeapon rw = RangeWeapon.get(p.getEquipment().getNew(3).getId());
if (rw == null) {
return -1;
}
Weapon w = new Weapon(p.getEquipment().get(3), rw.getAmmunitionSlot(), p.getEquipment().getNew(rw.getAmmunitionSlot()));
w.setType(rw.getWeaponType());
state.setRangeWeapon(rw);
state.setAmmunition(Ammunition.get(w.getAmmunition().getId()));
state.setWeapon(w);
if (!hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
state.setFrozen(ItemDefinition.forId(state.getAmmunition().getItemId()).getName().contains("ragon arrow"));
double mod = state.isFrozen() ? 1.5 : 1.3;
int minDamage = state.isFrozen() ? 8 : 5;
int max = calculateHit(entity, victim, mod);
state.setMaximumHit(max);
int hit = minDamage;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.15, 1.0)) {
hit += RandomFunction.random(max - minDamage);
}
state.setEstimatedHit(hit);
if (w.getType() == WeaponType.DOUBLE_SHOT) {
hit = minDamage;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.15, 1.0)) {
hit += RandomFunction.random(max - minDamage);
}
state.setSecondaryHit(hit);
}
useAmmo(entity, state, victim.getLocation());
return 1 + (int) Math.ceil(entity.getLocation().getDistance(victim.getLocation()) * 0.3);
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
Graphics start = null;
if (state.getAmmunition() != null) {
start = state.getAmmunition().getStartGraphics();
if (state.isFrozen()) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(new Audio(3736), true);
entity.asPlayer().getAudioManager().send(new Audio(3737), true);
}
DRAGON_PROJECTILE.copy(entity, victim, 5).send();
} else {
state.getAmmunition().getProjectile().copy(entity, victim, 5).send();
DARKNESS_PROJECTILE.copy(entity, victim, 5).send();
}
if (state.getWeapon().getType() == WeaponType.DOUBLE_SHOT && state.getAmmunition().getDarkBowGraphics() != null) {
start = state.getAmmunition().getDarkBowGraphics();
if (state.isFrozen()) {
DRAGON_PROJECTILE_1.copy(entity, victim, 10).send();
} else {
int speed = (int) (55 + (entity.getLocation().getDistance(victim.getLocation()) * 10));
Projectile.create(entity, victim, state.getAmmunition().getProjectile().getProjectileId(), 40, 36, 41, speed, 25).send();
DARKNESS_PROJECTILE_1.copy(entity, victim, 10).send();
}
}
}
entity.visualize(entity.getProperties().getAttackAnimation(), start);
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
victim.visualize(victim.getProperties().getDefenceAnimation(), state.isFrozen() ? DRAGON_IMPACT : DARKNESS_IMPACT);
}
}

View file

@ -0,0 +1,62 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Dragon Pickaxe's special attack.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class DragonPickaxeSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
//private static final Animation ANIMATION = new Animation(1057, Priority.HIGH);
/**
* The graphic.
*/
//private static final Graphics GRAPHIC = new Graphics(247);
@Override
public Object fireEvent(String identifier, Object... args) {
switch (identifier) {
case "instant_spec":
case "ncspec":
return true;
}
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(14669, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY))
return -1;
p.sendChat("Smashing!");
//p.visualize(ANIMATION, GRAPHIC);
p.getSkills().updateLevel(Skills.MINING, 3, p.getSkills().getStaticLevel(Skills.MINING) + 3);
return -1;
}
}

View file

@ -0,0 +1,73 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Abyssal whip's Energy drain special attack.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class EnergyDrainSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1658, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(341, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(4151, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.2, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1));
}
if (victim instanceof Player) {
((Player) victim).getSettings().updateRunEnergy(10);
((Player) entity).getSettings().updateRunEnergy(-10);
}
state.setEstimatedHit(hit);
entity.asPlayer().getAudioManager().send(new Audio(2713), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.animate(ANIMATION);
victim.graphics(GRAPHIC);
}
}

View file

@ -0,0 +1,65 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the excalibur special attack.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class ExcaliburSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1057, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(247);
@Override
public Object fireEvent(String identifier, Object... args) {
switch (identifier) {
case "instant_spec":
case "ncspec":
return true;
}
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(35, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY))
return -1;
p.sendChat("For Camelot!");
p.visualize(ANIMATION, GRAPHIC);
p.getSkills().updateLevel(Skills.DEFENCE, 8, p.getSkills().getStaticLevel(Skills.DEFENCE) + 8);
return -1;
}
}

View file

@ -0,0 +1,62 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles Vesta's Longsword special attack, feint.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class FeintSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(10502, Priority.HIGH);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(13899, this) && CombatStyle.MELEE.getSwingHandler().register(13901, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.0, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, RandomFunction.random(1.0, 2.50)));
}
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.animate(ANIMATION);
}
}

View file

@ -0,0 +1,80 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the healing blade special attack.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class HealingBladeSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(7071, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1220);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(11698, this);
CombatStyle.MELEE.getSwingHandler().register(13452, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.12, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.005));
}
state.setEstimatedHit(hit);
int healthRestore = hit / 2;
double prayerRestore = hit * 0.25;
if (healthRestore < 10) {
healthRestore = 10;
}
if (prayerRestore < 5) {
prayerRestore = 5;
}
entity.getSkills().heal(healthRestore);
entity.getSkills().incrementPrayerPoints(prayerRestore);
entity.asPlayer().getAudioManager().send(new Audio(3857), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,78 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Ice cleave special attack.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class IceCleaveSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 60;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(7070, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1221);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(11700, this);
CombatStyle.MELEE.getSwingHandler().register(13453, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.075, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.005));
}
state.setEstimatedHit(hit);
entity.asPlayer().getAudioManager().send(3846);
return 1;
}
@Override
public void adjustBattleState(Entity entity, Entity victim, BattleState state) {
super.adjustBattleState(entity, victim, state);
if (state.getEstimatedHit() > 0) {
victim.getStateManager().set(EntityState.FROZEN, 33);
victim.graphics(Graphics.create(369));
}
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,103 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.info.Rights;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Rune claws special attack "Impale".
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class ImpaleSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(923, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(274, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(3101, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player player = (Player) entity;
if (!player.getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
if (player.getName().equals("ethan") || player.getName().equals("austin") || player.getName().equals("") || player.getName().equals("")) {
int[] hits = new int[4];
for (int i = 0; i < 4; i++) {
int hit = i > 0 ? hits[i - 1] : 0;
if (hit < 1 && isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.5, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, i == 3 ? 1.45 : 1.0));
} else {
if (i == 3) {
hit = hits[1] - hits[2];
} else {
hit /= 2;
}
}
hits[i] = hit;
}
boolean allHits = hits[0] != 0 || hits[1] != 0;
if (!allHits) {
hits[1] = 1;
}
BattleState[] states = new BattleState[!allHits ? 2 : 4];
for (int i = 3; i >= 0; i--) {
if (allHits || i > 1) {
int index = allHits ? i : i - 2;
BattleState s = states[index] = new BattleState(entity, victim);
s.setStyle(CombatStyle.MELEE);
s.setEstimatedHit(hits[index]);
}
}
state.setTargets(states);
return 1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.1, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.1));
}
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
if (((Player) entity).getDetails().getRights() == Rights.ADMINISTRATOR) {
entity.animate(Animation.create(2068));
return;
}
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,69 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Judgement special attack.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class JudgementSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(7074, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1222);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(11694, this) && CombatStyle.MELEE.getSwingHandler().register(13450, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.25, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.25));
}
state.setEstimatedHit(hit);
entity.asPlayer().getAudioManager().send(new Audio(3865), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,71 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Magic longbow special attack "Powershot".
* @author Emperor
*/
@InitializablePlugin
public final class PowershotSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 35;
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(250, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(859, this);
CombatStyle.RANGE.getSwingHandler().register(10284, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
configureRangeData(p, state);
if (state.getWeapon() == null || !hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.98, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
}
entity.asPlayer().getAudioManager().send(2536);
state.setEstimatedHit(hit);
useAmmo(entity, state, victim.getLocation());
return 1 + (int) Math.ceil(entity.getLocation().getDistance(victim.getLocation()) * 0.3);
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(state.getRangeWeapon().getAnimation(), GRAPHIC);
int speed = (int) (46 + (entity.getLocation().getDistance(victim.getLocation()) * 5));
Projectile.create(entity, victim, 249, 40, 36, 45, speed, 5, 11).send();
}
}

View file

@ -0,0 +1,111 @@
package plugin.combat.special;
import java.util.List;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.InteractionType;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Powerstab special attack.
* @author Emperor
*/
@InitializablePlugin
public final class PowerstabSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 60;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(3157, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1225);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().getImpactHandler().handleImpact(entity, s.getEstimatedHit(), CombatStyle.MELEE, s);
}
}
return;
}
victim.getImpactHandler().handleImpact(entity, state.getEstimatedHit(), CombatStyle.MELEE, state);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(7158, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
boolean multi = entity.getProperties().isMultiZone();
if (!multi) {
return super.swing(entity, victim, state);
}
@SuppressWarnings("rawtypes")
List list = victim instanceof NPC ? RegionManager.getSurroundingNPCs(entity, 9, entity) : RegionManager.getSurroundingPlayers(entity, 9, entity);
BattleState[] targets = new BattleState[list.size()];
int count = 0;
for (Object o : list) {
Entity e = (Entity) o;
if (CombatStyle.RANGE.getSwingHandler().canSwing(entity, e) != InteractionType.NO_INTERACT) {
BattleState s = targets[count++] = new BattleState(entity, e);
int hit = 0;
if (isAccurateImpact(entity, e)) {
hit = RandomFunction.random(calculateHit(entity, e, 1.0));
}
s.setEstimatedHit(hit);
}
}
state.setTargets(targets);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().animate(victim.getProperties().getDefenceAnimation());
}
}
return;
}
victim.animate(victim.getProperties().getDefenceAnimation());
}
}

View file

@ -0,0 +1,84 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the puncture special attack combat swing.
* @author Emperor
*/
@InitializablePlugin
public final class PunctureSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1062, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(252, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
victim.getImpactHandler().handleImpact(entity, state.getEstimatedHit(), CombatStyle.MELEE, state);
victim.getImpactHandler().handleImpact(entity, state.getSecondaryHit(), CombatStyle.MELEE, state, null, true);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(1215, this) && CombatStyle.MELEE.getSwingHandler().register(1231, this) && CombatStyle.MELEE.getSwingHandler().register(5680, this) && CombatStyle.MELEE.getSwingHandler().register(5698, this) && CombatStyle.MELEE.getSwingHandler().register(13465, this) && CombatStyle.MELEE.getSwingHandler().register(13466, this) && CombatStyle.MELEE.getSwingHandler().register(13467, this) && CombatStyle.MELEE.getSwingHandler().register(13468, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
// First hit
//double accuracyMod, double defenceMod
int hit = 0;
// accuracyMod defenceMod
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.05, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.1306));
}
state.setEstimatedHit(hit);
// Second hit
// accuracyMod defenceMod
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.05, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.1306));
} else {
hit = 0;
}
entity.asPlayer().getAudioManager().send(2537);
state.setSecondaryHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,85 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the granite maul special attack.
* @author Emperor
*/
@InitializablePlugin
public final class QuickSmashSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1667, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(340, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
switch (identifier) {
case "instant_spec":
return true;
}
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(4153, this);
CombatStyle.MELEE.getSwingHandler().register(14792, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
if (victim == null) {
victim = p.getProperties().getCombatPulse().getLastVictim();
if (victim == null || GameWorld.getTicks() - p.getAttribute("combat-stop", -1) > 2 || !MeleeSwingHandler.canMelee(p, victim, 1)) {
p.getPacketDispatch().sendMessage("Warning: Since the maul's special is an instant attack, it will be wasted when used ");
p.getPacketDispatch().sendMessage("on a first strike.");
return -1;
}
}
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
visualize(entity, victim, null);
int hit = 0;
if (isAccurateImpact(entity, victim)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.));
}
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.MELEE);
entity.asPlayer().getAudioManager().send(new Audio(2715), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
victim.animate(victim.getProperties().getDefenceAnimation());
}
}

View file

@ -0,0 +1,78 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Rampage special attack.
* @author Emperor
*/
@InitializablePlugin
public final class RampageSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1056, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(246);
@Override
public Object fireEvent(String identifier, Object... args) {
switch (identifier) {
case "instant_spec":
case "ncspec":
return true;
}
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(1377, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
p.sendChat("Raarrrrrgggggghhhhhhh!");
p.visualize(ANIMATION, GRAPHIC);
@SuppressWarnings("unused")
int boost = 0;
for (int i = 0; i < 6; i++) {
if (i == 2 || i == 3 || i == 5) {
continue;
}
double drain = p.getSkills().getLevel(i) * 0.1;
boost += drain;
p.getSkills().updateLevel(i, (int) -drain, (int) (p.getSkills().getStaticLevel(i) - drain));
}
boost *= 0.25;
p.getSkills().updateLevel(Skills.STRENGTH, (int) (p.getSkills().getStaticLevel(Skills.STRENGTH) * 0.20));
p.getAudioManager().send(new Audio(386), true);
return -1;
}
}

View file

@ -0,0 +1,83 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Saradomin sword special attack.
* @author Emperor
*/
@InitializablePlugin
public final class SaradominsLightningHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(7072, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1224);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(11730, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
int secondary = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.10, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.1));
secondary = 5 + RandomFunction.RANDOM.nextInt(14);
}
state.setEstimatedHit(hit);
state.setSecondaryHit(secondary);
entity.asPlayer().getAudioManager().send(new Audio(3853), true);
return 1;
}
@Override
public void impact(Entity entity, Entity victim, BattleState s) {
int hit = s.getEstimatedHit();
if (hit > -1) {
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.MELEE, s);
}
hit = s.getSecondaryHit();
if (hit > -1) {
victim.graphics(Graphics.create(1194));
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.MAGIC, s);
}
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
}

View file

@ -0,0 +1,80 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the Seercull's special attack which lowers the opponent's magic
* level.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class SeercullSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Graphics DRAWBACK_GFX = new Graphics(472, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(6724, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
configureRangeData(p, state);
if (state.getWeapon() == null || !hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.05, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
victim.getSkills().updateLevel(Skills.MAGIC, -hit, 0);
}
useAmmo(entity, state, victim.getLocation());
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
victim.graphics(new Graphics(474));
int speed = (int) (35 + (entity.getLocation().getDistance(victim.getLocation()) * 10));
entity.visualize(entity.getProperties().getAttackAnimation(), DRAWBACK_GFX);
Projectile.create(entity, victim, 473, 40, 40, 40, speed, 15, 11).send();
}
@Override
public void impact(final Entity entity, final Entity victim, final BattleState state) {
int hit = state.getEstimatedHit();
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.RANGE, state);
}
}

View file

@ -0,0 +1,82 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.prayer.PrayerType;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Sever special attack.
* @author Emperor
*/
@InitializablePlugin
public final class SeverSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 55;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1872, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(347, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(4587, this) && CombatStyle.MELEE.getSwingHandler().register(13477, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY))
return -1;
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.124, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
if (victim instanceof Player) {
Player p = (Player) victim;
if (p.getPrayer().get(PrayerType.PROTECT_FROM_MAGIC)) {
p.getPrayer().toggle(PrayerType.PROTECT_FROM_MAGIC);
}
if (p.getPrayer().get(PrayerType.PROTECT_FROM_MELEE)) {
p.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE);
}
if (p.getPrayer().get(PrayerType.PROTECT_FROM_MISSILES)) {
p.getPrayer().toggle(PrayerType.PROTECT_FROM_MISSILES);
}
if (p.getPrayer().get(PrayerType.PROTECT_FROM_SUMMONING)) {
p.getPrayer().toggle(PrayerType.PROTECT_FROM_SUMMONING);
}
}
}
entity.asPlayer().getAudioManager().send(2540);
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,68 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Shatter special attack.
* @author Emperor
*/
@InitializablePlugin
public final class ShatterSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1060, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(251, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(1434, this);
CombatStyle.MELEE.getSwingHandler().register(13479, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 0.87, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.3546));
}
entity.asPlayer().getAudioManager().send(new Audio(2541), true);
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,124 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.world.map.Direction;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.Point;
import org.crandor.game.world.map.path.Pathfinder;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the dragon spear special attack.
* @author Emperor
*/
@InitializablePlugin
public final class ShoveSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 25;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1064, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(253, 96);
/**
* The stun animation.
*/
private static Animation STUN_ANIM = new Animation(424);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(1249, this);
CombatStyle.MELEE.getSwingHandler().register(1263, this);
CombatStyle.MELEE.getSwingHandler().register(3176, this);
CombatStyle.MELEE.getSwingHandler().register(5716, this);
CombatStyle.MELEE.getSwingHandler().register(5730, this);
CombatStyle.MELEE.getSwingHandler().register(11716, this);
CombatStyle.MELEE.getSwingHandler().register(14662, this);
return this;
}
@Override
public int swing(Entity entity, final Entity victim, BattleState state) {
if (victim.size() > 1) {
((Player) entity).getPacketDispatch().sendMessage("That creature is too large to knock back!");
((Player) entity).getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
state.setEstimatedHit(-1);
Direction dir = null;
int vx = victim.getLocation().getX();
int vy = victim.getLocation().getY();
int sx = entity.getLocation().getX();
int sy = entity.getLocation().getY();
if (vx == sx && vy > sy) {
dir = Direction.NORTH;
} else if (vx == sx && vy < sy) {
dir = Direction.SOUTH;
} else if (vx > sx && vy == sy) {
dir = Direction.EAST;
} else if (vx < sx && vy == sy) {
dir = Direction.WEST;
} else if (vx > sx && vy > sy) {
dir = Direction.NORTH_EAST;
} else if (vx < sx && vy > sy) {
dir = Direction.NORTH_WEST;
} else if (vx > sx && vy < sy) {
dir = Direction.SOUTH_EAST;
} else if (vx < sx && vy < sy) {
dir = Direction.SOUTH_WEST;
}
victim.getWalkingQueue().reset();
victim.getPulseManager().clear();
victim.animate(STUN_ANIM);
victim.getStateManager().set(EntityState.STUNNED, 5);
if (dir != null) {
Point p = Direction.getWalkPoint(dir);
Location dest = victim.getLocation().transform(p.getX(), p.getY(), 0);
if (Pathfinder.find(victim, dest, false, Pathfinder.DUMB).isSuccessful()) {
victim.getWalkingQueue().addPath(dest.getX(), dest.getY());
}
}
entity.asPlayer().getAudioManager().send(2533);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
}
}

View file

@ -0,0 +1,107 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Dragon claws special attack "Slice and Dice".
* @author Emperor
*
*/
@InitializablePlugin
public final class SliceAndDiceSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(10961, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1950);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(14484, this);
CombatStyle.MELEE.getSwingHandler().register(14486, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int maximum = calculateHit(entity, victim, 1.0);
int[] hits = new int[] {0, 1};
int hit = getHit(entity, victim, maximum);
if (hit > 0) {
hits = new int[] {hit, hit / 2, (hit / 2) / 2, (hit / 2) - ((hit / 2) / 2)};
} else {
hit = getHit(entity, victim, maximum);
if (hit > 0) {
hits = new int[] {0, hit, hit / 2, hit - (hit / 2)};
} else {
hit = getHit(entity, victim, maximum);
if (hit > 0) {
hits = new int[] {0, 0, hit / 2, (hit / 2) + 10};
} else {
hit = getHit(entity, victim, (int) (maximum * 1.5));
if (hit > 0) {
maximum *= 1.5;
hits = new int[] {0, 0, 0, hit};
} else {
hits = new int[] {0, RandomFunction.random(2)};
}
}
}
}
BattleState[] states = new BattleState[hits.length];
for (int i = 0; i < hits.length; i++) {
BattleState s = states[i] = new BattleState(entity, victim);
s.setStyle(CombatStyle.MELEE);
s.setEstimatedHit(hits[i]);
}
state.setTargets(states);
return 1;
}
/**
* Gets the current hit.
* @param entity The attacking entity.
* @param victim The victim.
* @param maximum The maximum hit.
* @return The hit.
*/
private int getHit(Entity entity, Entity victim, int maximum) {
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.25, 0.98)) {
return RandomFunction.random(maximum);
}
return 0;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,70 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles Statius' Warhammer special attack - Smash.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class SmashSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 35;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(10501, Priority.HIGH);
/**
* The gfx
*/
private static final Graphics GRAPHIC = new Graphics(1840, 0, 16);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
if (CombatStyle.MELEE.getSwingHandler().register(13902, this) && CombatStyle.MELEE.getSwingHandler().register(13904, this))
;
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.0, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, RandomFunction.random(1.0, 1.5)));
int lower = (int) (victim.getSkills().getLevel(Skills.DEFENCE) * 0.30);
victim.getSkills().updateLevel(Skills.DEFENCE, -lower, 0);
}
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,108 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.system.task.Pulse;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the magic shortbow special attack "Snapshot".
* @author Emperor
*/
@InitializablePlugin
public final class SnapshotSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 55;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1074, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(249, 96);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(861, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
configureRangeData(p, state);
if (state.getWeapon() == null || !hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int max = calculateHit(entity, victim, 1.0);
state.setMaximumHit(max);
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 0.9, 1.0)) {
hit = RandomFunction.random(max);
}
state.setEstimatedHit(hit);
hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 0.9, 1.0)) {
hit = RandomFunction.random(max);
}
entity.asPlayer().getAudioManager().send(2545);
state.setSecondaryHit(hit);
useAmmo(entity, state, victim.getLocation());
return 1 + (int) Math.ceil(entity.getLocation().getDistance(victim.getLocation()) * 0.3);
}
@Override
public void impact(final Entity entity, final Entity victim, final BattleState state) {
int hit = state.getEstimatedHit();
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.RANGE, state);
if (state.getSecondaryHit() > -1) {
final int hitt = state.getSecondaryHit();
if (victim.getLocation().withinDistance(entity.getLocation(), 2)) {
victim.getImpactHandler().handleImpact(entity, hitt, CombatStyle.RANGE, state);
return;
}
GameWorld.submit(new Pulse(1, victim) {
@Override
public boolean pulse() {
victim.getImpactHandler().handleImpact(entity, hitt, CombatStyle.RANGE, state);
return true;
}
});
}
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
int speed = (int) (27 + (entity.getLocation().getDistance(victim.getLocation()) * 5));
Projectile.create(entity, victim, 249, 40, 36, 20, speed, 15, 11).send();
speed = (int) (32 + (entity.getLocation().getDistance(victim.getLocation()) * 10));
Projectile.create(entity, victim, 249, 40, 36, 50, speed, 15, 11).send();
}
}

View file

@ -0,0 +1,73 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.RangeSwingHandler;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the Dorgeshuun crossbow's special attack - snipe.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class SnipeSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 75;
/**
* The attack animation. TODO: This is techically the wrong animation. The
* real one is incredibly similiar but I can't find it anywhere.
*/
private static final Animation ANIMATION = new Animation(4230, Priority.HIGH);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.RANGE.getSwingHandler().register(8880, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
configureRangeData(p, state);
if (state.getWeapon() == null || !hasAmmo(entity, state)) {
entity.getProperties().getCombatPulse().stop();
p.getSettings().toggleSpecialBar();
return -1;
}
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.05, 1.0)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
victim.getSkills().updateLevel(Skills.DEFENCE, -hit, 0);
}
useAmmo(entity, state, victim.getLocation());
state.setEstimatedHit(hit);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.animate(ANIMATION);
Projectile.create(entity, victim, 698, 36, 25, 35, 72).send();
}
}

View file

@ -0,0 +1,110 @@
package plugin.combat.special;
import java.util.List;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.InteractionType;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles Vesta's Spear special attack - Spear Wall.
* @author Splinter
*/
@InitializablePlugin
public final class SpearWallSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 50;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(10499, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1835);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().getImpactHandler().handleImpact(entity, s.getEstimatedHit(), CombatStyle.MELEE, s);
}
}
return;
}
victim.getImpactHandler().handleImpact(entity, state.getEstimatedHit(), CombatStyle.MELEE, state);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(13905, this);
CombatStyle.MELEE.getSwingHandler().register(13907, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
boolean multi = entity.getProperties().isMultiZone();
if (!multi) {
return super.swing(entity, victim, state);
}
@SuppressWarnings("rawtypes")
List list = victim instanceof NPC ? RegionManager.getSurroundingNPCs(entity, 9, entity) : RegionManager.getSurroundingPlayers(entity, 9, entity);
BattleState[] targets = new BattleState[list.size()];
int count = 0;
for (Object o : list) {
Entity e = (Entity) o;
if (CombatStyle.RANGE.getSwingHandler().canSwing(entity, e) != InteractionType.NO_INTERACT) {
BattleState s = targets[count++] = new BattleState(entity, e);
int hit = 0;
hit = RandomFunction.random(calculateHit(entity, e, 1.0));
s.setEstimatedHit(hit);
}
}
state.setTargets(targets);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().animate(victim.getProperties().getDefenceAnimation());
}
}
return;
}
victim.animate(victim.getProperties().getDefenceAnimation());
}
}

View file

@ -0,0 +1,69 @@
package plugin.combat.special;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Staff of the Dead's special attack.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class StaffOfTheDeadSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(10518, 10, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1589);
@Override
public Object fireEvent(String identifier, Object... args) {
switch (identifier) {
case "instant_spec":
case "ncspec":
return true;
}
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(14726, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
Player p = (Player) entity;
if(p.getStateManager().hasState(EntityState.STAFF_OF_THE_DEAD)){
p.sendMessage("You are already affected by the special move of the staff.");
p.getSettings().toggleSpecialBar();
return -1;
}
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY))
return -1;
p.visualize(ANIMATION, GRAPHIC);
p.getStateManager().set(EntityState.STAFF_OF_THE_DEAD, 100);
return -1;
}
}

View file

@ -0,0 +1,161 @@
package plugin.combat.special;
import java.util.ArrayList;
import java.util.List;
import org.crandor.game.content.skill.member.summoning.familiar.Familiar;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.Direction;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Dragon halberd special attack.
* @author Emperor
*/
@InitializablePlugin
public final class SweepSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 30;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(1203, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(282, 96);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(3204, this);
return this;
}
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
BattleState[] targets = getTargets(entity, victim, state);
state.setTargets(targets);
for (BattleState s : targets) {
int hit = 0;
if (isAccurateImpact(entity, s.getVictim(), CombatStyle.MELEE, 1, 0.94)) {
hit = RandomFunction.random(calculateHit(entity, s.getVictim(), 1.1));
}
s.setEstimatedHit(hit);
if (s.getVictim().size() > 1) {
hit = 0;
if (isAccurateImpact(entity, s.getVictim(), CombatStyle.MELEE, 1, 0.94)) {
hit = RandomFunction.random(calculateHit(entity, s.getVictim(), 1.1));
}
s.setSecondaryHit(hit);
}
}
return 1;
}
/**
* Gets the targets.
* @param entity The entity.
* @param victim The victim.
* @param state The battle state.
* @return The targets array.
*/
private BattleState[] getTargets(Entity entity, Entity victim, BattleState state) {
if (!entity.getProperties().isMultiZone() || !victim.getProperties().isMultiZone()) {
return new BattleState[] { state };
}
Location vl = victim.getLocation();
int x = vl.getX();
int y = vl.getY();
Direction dir = Direction.getDirection(x - entity.getLocation().getX(), y - entity.getLocation().getY());
List<BattleState> l = new ArrayList<>();
l.add(new BattleState(entity, victim));
for (Entity n : victim instanceof NPC ? RegionManager.getSurroundingNPCs(victim, 9, entity, victim) : RegionManager.getSurroundingPlayers(victim, 9, entity, victim)) {
if (n instanceof Familiar) {
continue;
}
if (n.getLocation().equals(vl.transform(dir.getStepY(), dir.getStepX(), 0)) || n.getLocation().equals(vl.transform(-dir.getStepY(), -dir.getStepX(), 0))) {
l.add(new BattleState(entity, n));
if (l.size() >= 3) {
break;
}
}
}
return l.toArray(new BattleState[l.size()]);
}
@Override
public void adjustBattleState(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
super.adjustBattleState(entity, s.getVictim(), s);
}
}
return;
}
super.adjustBattleState(entity, victim, state);
}
@Override
public void impact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().getImpactHandler().handleImpact(entity, s.getEstimatedHit(), CombatStyle.MELEE, s);
if (s.getSecondaryHit() > -1) {
s.getVictim().getImpactHandler().handleImpact(entity, s.getSecondaryHit(), CombatStyle.MELEE, s);
}
}
}
return;
}
victim.getImpactHandler().handleImpact(entity, state.getEstimatedHit(), CombatStyle.MELEE, state);
if (state.getSecondaryHit() > -1) {
victim.getImpactHandler().handleImpact(entity, state.getSecondaryHit(), CombatStyle.MELEE, state);
}
}
@Override
public void visualizeImpact(Entity entity, Entity victim, BattleState state) {
if (state.getTargets() != null) {
for (BattleState s : state.getTargets()) {
if (s != null) {
s.getVictim().animate(victim.getProperties().getDefenceAnimation());
}
}
return;
}
victim.animate(victim.getProperties().getDefenceAnimation());
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,88 @@
package plugin.combat.special;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.combat.handlers.MeleeSwingHandler;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Handles the Warstrike special attack.
* @author Emperor
*/
@InitializablePlugin
public final class WarstrikeSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
/**
* The special energy required.
*/
private static final int SPECIAL_ENERGY = 100;
/**
* The attack animation.
*/
private static final Animation ANIMATION = new Animation(7073, Priority.HIGH);
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(1223);
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
CombatStyle.MELEE.getSwingHandler().register(11696, this);
CombatStyle.MELEE.getSwingHandler().register(13451, this);
return this;
}
@Override
public int swing(Entity entity, Entity victim, BattleState state) {
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
return -1;
}
int hit = 0;
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.049, 0.98)) {
hit = RandomFunction.random(calculateHit(entity, victim, 1.1));
}
state.setEstimatedHit(hit);
if (victim instanceof Player) {
((Player) victim).getPacketDispatch().sendMessage("You have been drained.");
}
int left = -victim.getSkills().updateLevel(Skills.DEFENCE, -hit, 0);
if (left > 0) {
left = -victim.getSkills().updateLevel(Skills.STRENGTH, -left, 0);
if (left > 0) {
left = -victim.getSkills().updateLevel(Skills.ATTACK, -left, 0);
if (left > 0) {
left = (int) -(victim.getSkills().getPrayerPoints() + left);
victim.getSkills().decrementPrayerPoints(left);
if (left > 0) {
left = -victim.getSkills().updateLevel(Skills.MAGIC, -left, 0);
if (left > 0)
victim.getSkills().updateLevel(Skills.RANGE, -left, 0);
}
}
}
}
entity.asPlayer().getAudioManager().send(new Audio(3834), true);
return 1;
}
@Override
public void visualize(Entity entity, Entity victim, BattleState state) {
entity.visualize(ANIMATION, GRAPHIC);
}
}

View file

@ -0,0 +1,126 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the combat spell plugin used to handle air spells.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class AirSpell extends CombatSpell {
/**
* The start graphic for Air strike.
*/
private static final Graphics STRIKE_START = new Graphics(90, 96);
/**
* The projectile for Air strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 91, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air strike.
*/
private static final Graphics STRIKE_END = new Graphics(92, 96);
/**
* The start graphic for Air bolt.
*/
private static final Graphics BOLT_START = new Graphics(117, 96);
/**
* The projectile for Air bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 118, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air bolt.
*/
private static final Graphics BOLT_END = new Graphics(119, 96);
/**
* The start graphic for Air blast.
*/
private static final Graphics BLAST_START = new Graphics(132, 96); // 129
/**
* The projectile for Air blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 133, 40, 36, 52, 75, 15, 11); // 130
/**
* The end graphic for Air blast.
*/
private static final Graphics BLAST_END = new Graphics(134, 96); // 131
/**
* The start graphic for Air wave.
*/
private static final Graphics WAVE_START = new Graphics(158, 96);
/**
* The projectile for Air wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 159, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air wave.
*/
private static final Graphics WAVE_END = new Graphics(160, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code AirSpell} {@Code Object}
*/
public AirSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code AirSpell} {@Code Object}
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private AirSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 1);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(1, new AirSpell(SpellType.STRIKE, 1, 5.5, 220, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(10, new AirSpell(SpellType.BOLT, 17, 13.5, 218, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(24, new AirSpell(SpellType.BLAST, 41, 25.5, 216, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(45, new AirSpell(SpellType.WAVE, 62, 36.0, 222, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.AIR_RUNE.getItem(5)));
return this;
}
}

View file

@ -0,0 +1,145 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the binding combat spell.
* @author 'Vexia
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class BindSpell extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics BIND_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile BIND_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics BIND_END = new Graphics(181, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics SNARE_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile SNARE_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics SNARE_END = new Graphics(180, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics ENTANGLE_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile ENTANGLE_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics ENTANGLE_END = new Graphics(179, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(710, Priority.HIGH);
/**
* Constructs a new {@code BindSpell} {@Code Object}
*/
public BindSpell() {
/**
* empty.
*/
}
/**
* Constructs a new {@code BindSpell} {@code Object}.
* @param type the type.
* @param level the level.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private BindSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, -1, ANIMATION, start, projectile, end, runes);
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (victim instanceof NPC) {
NPC npc = (NPC) victim;
if (npc.getName().contains("impling")) {
state.setEstimatedHit(-2);
}
}
if (state.getEstimatedHit() == -1) {
return;
}
int tick = 0;
if (getType() == SpellType.BIND) {
state.setEstimatedHit(-2);
}
if (state.getSpell().getSpellId() == 12) {
tick = 8;
} else if (state.getSpell().getSpellId() == 30) {
tick = 16;
} else if (state.getSpell().getSpellId() == 56) {
tick = 25;
}
if (!victim.getLocks().isMovementLocked() && victim instanceof Player) {
((Player) victim).getPacketDispatch().sendMessage("A magical force stops you from moving!");
}
victim.getWalkingQueue().reset();
victim.getLocks().lockMovement(tick);
entity.setAttribute("entangleDelay", GameWorld.getTicks() + tick + 2);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType() == SpellType.ENTANGLE ? 5 : 3;
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(12, new BindSpell(SpellType.BIND, 20, 30.0, 151, BIND_START, BIND_PROJECTILE, BIND_END, Runes.NATURE_RUNE.getItem(2), Runes.EARTH_RUNE.getItem(3), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(30, new BindSpell(SpellType.SNARE, 50, 60.0, 152, SNARE_START, SNARE_PROJECTILE, SNARE_END, Runes.NATURE_RUNE.getItem(3), Runes.EARTH_RUNE.getItem(4), Runes.WATER_RUNE.getItem(4)));
SpellBook.MODERN.register(56, new BindSpell(SpellType.ENTANGLE, 79, 89.0, 153, ENTANGLE_START, ENTANGLE_PROJECTILE, ENTANGLE_END, Runes.NATURE_RUNE.getItem(4), Runes.EARTH_RUNE.getItem(5), Runes.WATER_RUNE.getItem(5)));
return this;
}
}

View file

@ -0,0 +1,132 @@
package plugin.combat.spell;
import java.util.List;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Blood spells from the Ancient spellbook.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class BloodSpells extends CombatSpell {
/**
* The projectile for Blood rush.
*/
private static final Projectile RUSH_PROJECTILE = Projectile.create((Entity) null, null, 372, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Blood rush.
*/
private static final Graphics RUSH_END = new Graphics(373, 96);
/**
* The end graphic for Blood burst.
*/
private static final Graphics BURST_END = new Graphics(376, 0);
/**
* The projectile for Blood blitz.
*/
private static final Projectile BLITZ_PROJECTILE = Projectile.create((Entity) null, null, 374, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Blood blitz.
*/
private static final Graphics BLITZ_END = new Graphics(375, 96);
/**
* The end graphic for Blood barrage.
*/
private static final Graphics BARRAGE_END = new Graphics(377, 0);
/**
* Constructs a new {@code BloodSpells} {@code Object}.
*/
public BloodSpells() {
/*
* ( empty.
*/
}
/**
* Constructs a new {@code BloodSpells} {@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 BloodSpells(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(4, new BloodSpells(SpellType.RUSH, 56, 33.0, -1, -1, new Animation(1978, Priority.HIGH), null, RUSH_PROJECTILE, RUSH_END, Runes.BLOOD_RUNE.getItem(1), Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(2)));
SpellBook.ANCIENT.register(6, new BloodSpells(SpellType.BURST, 68, 39.0, -1, -1, new Animation(1979, Priority.HIGH), null, null, BURST_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(4)));
SpellBook.ANCIENT.register(5, new BloodSpells(SpellType.BLITZ, 80, 45.0, -1, -1, new Animation(1978, Priority.HIGH), null, BLITZ_PROJECTILE, BLITZ_END, Runes.BLOOD_RUNE.getItem(4), Runes.DEATH_RUNE.getItem(2)));
SpellBook.ANCIENT.register(7, new BloodSpells(SpellType.BARRAGE, 92, 51.0, -1, -1, new Animation(1979, Priority.HIGH), null, null, BARRAGE_END, Runes.SOUL_RUNE.getItem(1), Runes.BLOOD_RUNE.getItem(4), Runes.DEATH_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);
sendAudio(entity, getAudio());
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (state.getEstimatedHit() > -1) {
int heal = state.getEstimatedHit() / 4;
if (heal > 0) {
entity.getSkills().heal(heal);
if (entity instanceof Player) {
((Player) entity).getPacketDispatch().sendMessage("You drain some of your opponent's health.");
}
}
}
}
@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, 3);
}
}

View file

@ -0,0 +1,55 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the crumble undead spell.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class CrumbleUndead extends CombatSpell {
/**
* Constructs a new {@code CrumbleUndead} {@code Object}.
*/
public CrumbleUndead() {
super(SpellType.CRUMBLE_UNDEAD, SpellBook.MODERN, 39, 24.5, 122, 123, new Animation(724, Priority.HIGH), new Graphics(145, 96), Projectile.create((Entity) null, null, 146, 40, 36, 52, 75, 15, 11), new Graphics(147, 96), Runes.EARTH_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(1));
}
@Override
public boolean cast(Entity entity, Node target) {
NPC npc = target instanceof NPC ? (NPC) target : null;
if (npc == null || npc.getTask() == null || !npc.getTask().isUndead()) {
((Player) entity).getPacketDispatch().sendMessage("This spell only affects the undead.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(22, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}

View file

@ -0,0 +1,195 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the curse spells.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
public final class CurseSpells extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics CONFUSE_START = new Graphics(102, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile CONFUSE_PROJECTILE = Projectile.create((Entity) null, null, 103, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics CONFUSE_END = new Graphics(104, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics WEAKEN_START = new Graphics(105, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile WEAKEN_PROJECTILE = Projectile.create((Entity) null, null, 106, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics WEAKEN_END = new Graphics(107, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics CURSE_START = new Graphics(108, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile CURSE_PROJECTILE = Projectile.create((Entity) null, null, 109, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics CURSE_END = new Graphics(110, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics VULNER_START = new Graphics(167, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile VULNER_PROJECTILE = Projectile.create((Entity) null, null, 168, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics VULNER_END = new Graphics(169, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics ENFEEBLE_START = new Graphics(170, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile ENFEEBLE_PROJECTILE = Projectile.create((Entity) null, null, 171, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics ENFEEBLE_END = new Graphics(172, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics STUN_START = new Graphics(173, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile STUN_PROJECTILE = Projectile.create((Entity) null, null, 174, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics STUN_END = new Graphics(107, 96);
/**
* The cast animation.
*/
private static final Animation LOW_ANIMATION = new Animation(716, Priority.HIGH);
/**
* The cast animation.
*/
private static final Animation HIGH_ANIMATION = new Animation(729, Priority.HIGH);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public CurseSpells() {
/**
* empty.
*/
}
/**
* Constructs a new {@code CurseSpells} {@code Object}.
* @param type the type.
* @param level the level.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private CurseSpells(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, -1, type.ordinal() <= SpellType.CURSE.ordinal() ? LOW_ANIMATION : HIGH_ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return 1;
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (state.getEstimatedHit() == -1) {
return;
}
state.setEstimatedHit(-2);
switch (getType()) {
case CONFUSE:
victim.getSkills().drainLevel(Skills.ATTACK, 0.05, 0.05);
break;
case WEAKEN:
victim.getSkills().drainLevel(Skills.STRENGTH, 0.05, 0.05);
break;
case CURSE:
victim.getSkills().drainLevel(Skills.DEFENCE, 0.05, 0.05);
break;
case VULNERABILITY:
victim.getSkills().drainLevel(Skills.DEFENCE, 0.10, 0.10);
break;
case ENFEEBLE:
victim.getSkills().drainLevel(Skills.STRENGTH, 0.10, 0.10);
break;
case STUN:
victim.getSkills().drainLevel(Skills.ATTACK, 0.10, 0.10);
break;
default:
}
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(2, new CurseSpells(SpellType.CONFUSE, 3, 13.0, 99, CONFUSE_START, CONFUSE_PROJECTILE, CONFUSE_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(7, new CurseSpells(SpellType.WEAKEN, 11, 21.0, 100, WEAKEN_START, WEAKEN_PROJECTILE, WEAKEN_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(11, new CurseSpells(SpellType.CURSE, 19, 29.0, 101, CURSE_START, CURSE_PROJECTILE, CURSE_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(3), Runes.WATER_RUNE.getItem(2)));
SpellBook.MODERN.register(50, new CurseSpells(SpellType.VULNERABILITY, 66, 76.0, 119, VULNER_START, VULNER_PROJECTILE, VULNER_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(5), Runes.WATER_RUNE.getItem(5)));
SpellBook.MODERN.register(53, new CurseSpells(SpellType.ENFEEBLE, 73, 83.0, 120, ENFEEBLE_START, ENFEEBLE_PROJECTILE, ENFEEBLE_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(8), Runes.WATER_RUNE.getItem(8)));
SpellBook.MODERN.register(57, new CurseSpells(SpellType.STUN, 80, 90.0, 121, STUN_START, STUN_PROJECTILE, STUN_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(12), Runes.WATER_RUNE.getItem(12)));
return this;
}
}

View file

@ -0,0 +1,127 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the earth combat spells.
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
public final class EarthSpell extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics STRIKE_START = new Graphics(96, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 97, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics STRIKE_END = new Graphics(98, 96);
/**
* The start graphic for Earth bolt.
*/
private static final Graphics BOLT_START = new Graphics(123, 96);
/**
* The projectile for Earth bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 124, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth bolt.
*/
private static final Graphics BOLT_END = new Graphics(125, 96);
/**
* The start graphic for Earth blast.
*/
private static final Graphics BLAST_START = new Graphics(138, 96);
/**
* The projectile for Earth blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 139, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth blast.
*/
private static final Graphics BLAST_END = new Graphics(140, 96);
/**
* The start graphic for Earth wave.
*/
private static final Graphics WAVE_START = new Graphics(164, 96);
/**
* The projectile for Earth wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 165, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth wave.
*/
private static final Graphics WAVE_END = new Graphics(166, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public EarthSpell() {
/**
* empty.
*/
}
/**
* Constructs a new {@code EarthSpell} {@Code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private EarthSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 3);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(6, new EarthSpell(SpellType.STRIKE, 9, 9.5, 132, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(17, new EarthSpell(SpellType.BOLT, 29, 19.5, 130, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(3), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(33, new EarthSpell(SpellType.BLAST, 53, 31.5, 128, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(4), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(52, new EarthSpell(SpellType.WAVE, 70, 40.0, 134, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}

View file

@ -0,0 +1,128 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the fire spells.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
public final class FireSpell extends CombatSpell {
/**
* The start graphic for Fire strike.
*/
private static final Graphics STRIKE_START = new Graphics(99, 96);
/**
* The projectile for Fire strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 100, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire strike.
*/
private static final Graphics STRIKE_END = new Graphics(101, 96);
/**
* The start graphic for Fire bolt.
*/
private static final Graphics BOLT_START = new Graphics(126, 96);
/**
* The projectile for Fire bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 127, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire bolt.
*/
private static final Graphics BOLT_END = new Graphics(128, 96);
/**
* The start graphic for Fire blast.
*/
private static final Graphics BLAST_START = new Graphics(129, 96);
/**
* The projectile for Fire blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 130, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire blast.
*/
private static final Graphics BLAST_END = new Graphics(131, 96);
/**
* The start graphic for Fire wave.
*/
private static final Graphics WAVE_START = new Graphics(155, 96);
/**
* The projectile for Fire wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 156, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire wave.
*/
private static final Graphics WAVE_END = new Graphics(157, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code FireSpell} {@Code Object}
*/
public FireSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code FireSpell} {@code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private FireSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 4);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(8, new FireSpell(SpellType.STRIKE, 13, 11.5, 160, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(3), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(20, new FireSpell(SpellType.BOLT, 35, 22.5, 157, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(4), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(38, new FireSpell(SpellType.BLAST, 59, 34.5, 155, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(5), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(55, new FireSpell(SpellType.WAVE, 75, 42.5, 162, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}

View file

@ -0,0 +1,194 @@
package plugin.combat.spell;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the god spells.
* @author Emperor
* @author 'Vexia
*/
@InitializablePlugin
public final class GodSpells extends CombatSpell {
/**
* The spell names.
*/
private static final String[] NAMES = new String[] { "Saradomin strike", "Guthix claws", "Flames of Zamorak" };
/**
* The start graphic for Air strike.
*/
private static final Graphics SARA_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile SARA_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics SARA_END = new Graphics(76, 0);
/**
* The start graphic for Air strike.
*/
private static final Graphics GUTHIX_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile GUTHIX_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics GUTHIX_END = new Graphics(77, 0);
/**
* The start graphic for Air strike.
*/
private static final Graphics ZAM_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile ZAM_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics ZAM_END = new Graphics(78, 0);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(811, Priority.HIGH);
/**
* Constructs a new {@code AirSpell} {@Code Object}
*/
public GodSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code GodSpells} {@code Object}.
* @param type the type.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private GodSpells(SpellType type, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, 60, 35.0, -1, -1, ANIMATION, start, projectile, end, runes);
}
@Override
public boolean meetsRequirements(Entity caster, boolean message, boolean remove) {
if (caster instanceof NPC) {
return true;
}
if (caster instanceof Player) {
int staffId = ((Player) caster).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId();
int required = -1;
int index = 0;
switch (runes[1].getAmount()) {
case 2: // Saradomin strike
required = 2415;
break;
case 1: // Guthix claws
required = 2416;
index = 1;
break;
case 4: // Flames of Zamorak
required = 2417;
index = 2;
break;
}
Player p = (Player) caster;
if (p.getSavedData().getActivityData().getGodCasts()[index] < 100 && !p.getZoneMonitor().isInZone("mage arena")) {
p.sendMessage("You need to cast " + NAMES[index] + " " + (100 - p.getSavedData().getActivityData().getGodCasts()[index]) + " more times inside the Mage Arena.");
return false;
}
if (staffId == 8841 && index == 1) {// Void Knight Mace
return true;
}
if (staffId != required) {
if (message) {
((Player) caster).getPacketDispatch().sendMessage("You need to wear a " + ItemDefinition.forId(required).getName() + " to cast this spell.");
}
return false;
}
}
return super.meetsRequirements(caster, message, remove);
}
@Override
public void visualize(Entity entity, Node target) {
super.visualize(entity, target);
if (entity instanceof NPC) {
NPC n = (NPC) entity;
if (n.getId() > 911 && n.getId() < 915 || (n.getId() > 906 && n.getId() < 912)) {
n.getAnimator().forceAnimation(n.getProperties().getAttackAnimation());
}
}
}
@Override
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
if (entity instanceof Player) {
int index = 0; // Saradomin strike
switch (runes[1].getAmount()) {
case 1: // Guthix claws
index = 1;
break;
case 4: // Flames of Zamorak
index = 2;
break;
}
Player p = (Player) entity;
if (p.getSavedData().getActivityData().getGodCasts()[index] < 100) {
p.getSavedData().getActivityData().getGodCasts()[index]++;
if (p.getSavedData().getActivityData().getGodCasts()[index] >= 100) {
p.sendMessage("You can now cast " + NAMES[index] + " outside the Arena.");
}
}
}
super.visualizeImpact(entity, target, state);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 0);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(41, new GodSpells(SpellType.GOD_STRIKE, -1, SARA_START, SARA_PROJECTILE, SARA_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(2), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(42, new GodSpells(SpellType.GOD_STRIKE, -1, GUTHIX_START, GUTHIX_PROJECTILE, GUTHIX_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(1), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(43, new GodSpells(SpellType.GOD_STRIKE, -1, ZAM_START, ZAM_PROJECTILE, ZAM_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(4), Runes.AIR_RUNE.getItem(1)));
return this;
}
}

View file

@ -0,0 +1,53 @@
package plugin.combat.spell;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the iban blast spell.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
public final class IbanBlast extends CombatSpell {
/**
* Constructs a new {@code IbanBlast} {@code Object}.
*/
public IbanBlast() {
super(SpellType.IBANS_BLAST, SpellBook.MODERN, 50, 60.5, -1, -1, new Animation(708, Priority.HIGH), new Graphics(87, 96), Projectile.create((Entity) null, null, 88, 40, 36, 52, 75, 15, 11), new Graphics(89, 96), Runes.FIRE_RUNE.getItem(5), Runes.DEATH_RUNE.getItem(1));
}
@Override
public boolean cast(Entity entity, Node target) {
if (((Player) entity).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId() != 1409) {
((Player) entity).getPacketDispatch().sendMessage("You need to wear Iban's staff to cast this spell.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(29, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}

View file

@ -0,0 +1,163 @@
package plugin.combat.spell;
import java.util.List;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.entity.player.link.audio.Audio;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Ice spells from the Ancient spellbook.
* @author Emperor
* @version 1.0
*/
@InitializablePlugin
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, 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);
sendAudio(entity, audio);
}
@Override
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
if (state.isFrozen()) {
if (target == entity.getProperties().getCombatPulse().getVictim()) {
sendAudio(target, new Audio(impactAudio, 1, 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, 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, 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, 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, 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 (victim.getAttribute("freeze_immunity", -1) < GameWorld.getTicks()) {
victim.getStateManager().set(EntityState.FROZEN, ticks);
} 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);
}
}

View file

@ -0,0 +1,57 @@
package plugin.combat.spell;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the magic dart spell.
* @author Emperor
*/
@InitializablePlugin
public class MagicDart extends CombatSpell {
/**
* Constructs a new {@code MagicDart} {@code Object}.
*/
public MagicDart() {
super(SpellType.MAGIC_DART, SpellBook.MODERN, 50, 61.0, 218, 219, new Animation(1576, Priority.HIGH), null, Projectile.create((Entity) null, null, 330, 40, 36, 52, 75, 15, 11), new Graphics(331, 96), Runes.DEATH_RUNE.getItem(1), Runes.MIND_RUNE.getItem(4));
}
@Override
public boolean cast(Entity entity, Node target) {
if (entity.getSkills().getLevel(Skills.SLAYER) < 55) {
((Player) entity).getPacketDispatch().sendMessage("You need a Slayer level of 55 to cast this spell.");
return false;
}
if (((Player) entity).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId() != 4170) {
((Player) entity).getPacketDispatch().sendMessage("You need to wear a Slayer's staff to cast this spell.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(31, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}

View file

@ -0,0 +1,180 @@
package plugin.combat.spell;
import java.util.List;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Miasmic spells that are a part of the Ancient spellbook.
* @author Splinter
* @version 1.0
*/
@InitializablePlugin
public final class MiasmicSpells extends CombatSpell {
/**
* The start graphic for Miasmic rush.
*/
private static final Graphics RUSH_START = new Graphics(1845, 0, 15);
/**
* The end graphic for Miasmic rush.
*/
private static final Graphics RUSH_END = new Graphics(1847, 40);
/**
* The start graphic for Miasmic rush.
*/
private static final Graphics BURST_START = new Graphics(1848, 0);
/**
* The end graphic for Miasmic barrage.
*/
private static final Graphics BURST_END = new Graphics(1849, 20, 30);
/**
* The start graphic for Miasmic rush.
*/
private static final Graphics BLITZ_START = new Graphics(1850, 15);
/**
* The end graphic for Miasmic rush.
*/
private static final Graphics BLITZ_END = new Graphics(1851, 0);
/**
* The start graphic for Miasmic rush.
*/
private static final Graphics BARRAGE_START = new Graphics(1853, 0);
/**
* The end graphic for Miasmic barrage.
*/
private static final Graphics BARRAGE_END = new Graphics(1854, 0, 30);
/**
* The item ids of the staves able to cast Miasmic spells.
*/
private static final int[] VALID_STAFF_IDS = { 13867, 13869, 13841, 13843 };
/**
* Constructs a new {@code MiasmicSpells} {@code Object}.
*/
public MiasmicSpells() {
}
/**
* Constructs a new {@code MiasmicSpells} {@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 MiasmicSpells(SpellType type, int level, double baseExperience, int impactSound, Animation anim, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.ANCIENT, level, baseExperience, 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);
sendAudio(entity, audio);
}
@Override
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
super.visualizeImpact(entity, target, state);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.ANCIENT.register(16, new MiasmicSpells(SpellType.RUSH, 61, 36.0, 173, new Animation(10513, Priority.HIGH), RUSH_START, null, RUSH_END, Runes.EARTH_RUNE.getItem(1), Runes.SOUL_RUNE.getItem(1), Runes.CHAOS_RUNE.getItem(2)));
SpellBook.ANCIENT.register(17, new MiasmicSpells(SpellType.BURST, 73, 42.0, 170, new Animation(10516, Priority.HIGH), BURST_START, null, BURST_END, Runes.EARTH_RUNE.getItem(3), Runes.SOUL_RUNE.getItem(3), Runes.CHAOS_RUNE.getItem(4)));
SpellBook.ANCIENT.register(18, new MiasmicSpells(SpellType.BLITZ, 85, 48.0, 169, new Animation(10524, Priority.HIGH), BLITZ_START, null, BLITZ_END, Runes.EARTH_RUNE.getItem(3), Runes.SOUL_RUNE.getItem(3), Runes.BLOOD_RUNE.getItem(2)));
SpellBook.ANCIENT.register(19, new MiasmicSpells(SpellType.BARRAGE, 97, 54.0, 168, new Animation(10518, Priority.HIGH), BARRAGE_START, null, BARRAGE_END, Runes.EARTH_RUNE.getItem(4), Runes.SOUL_RUNE.getItem(4), Runes.BLOOD_RUNE.getItem(4)));
return this;
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (victim.getAttribute("miasmic_immunity", -1) < GameWorld.getTicks()) {
victim.getStateManager().register(EntityState.MIASMIC, true, (getSpellId() - 15) * 20);
}
}
/**
* Checks if a valid staff is equipped.
* @param entity The attacking entity.
* @return {@code True} if so.
*/
public boolean validStaffEquipped(Entity entity){
for(int i = 0; i < VALID_STAFF_IDS.length; i++){
if(((Player) entity).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId() == VALID_STAFF_IDS[i]){
return true;
}
}
return false;
}
@Override
public boolean cast(Entity entity, Node target) {
if (!validStaffEquipped(entity) && !GameWorld.getSettings().isDevMode()) {
((Player) entity).getPacketDispatch().sendMessage("You need to be wielding Zuriel's staff in order to cast this spell.");
return false;
}
if (!meetsRequirements(entity, true, false)) {
return false;
}
return super.cast(entity, target);
}
@Override
public BattleState[] getTargets(Entity entity, Entity target) {
if (animation.getId() == 10513 || animation.getId() == 10524
|| !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) {
int add = 9;
if(animation.getId() == 10524 || animation.getId() == 10516){
add = 6;
}
if(animation.getId() == 10513){
add = 4;
}
return getType().getImpactAmount(entity, victim, add);
}
}

View file

@ -0,0 +1,128 @@
package plugin.combat.spell;
import java.util.List;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Shadow spells from the Ancient spellbook.
* @author Emperor
*/
@InitializablePlugin
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, 175, 176, 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, 177, 178, 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, 181, 182, 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, 181, 185, 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);
sendAudio(entity, audio);
}
@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);
}
}

View file

@ -0,0 +1,137 @@
package plugin.combat.spell;
import java.util.List;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.entity.state.EntityState;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the Smoke spells from the Ancient spellbook.
* @author Emperor
*/
@InitializablePlugin
public final class SmokeSpells extends CombatSpell {
/**
* The projectile for Smoke rush.
*/
private static final Projectile RUSH_PROJECTILE = Projectile.create((Entity) null, null, 384, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Smoke rush.
*/
private static final Graphics RUSH_END = new Graphics(385, 96);
/**
* The projectile for Smoke burst.
*/
private static final Projectile BURST_PROJECTILE = Projectile.create((Entity) null, null, 386, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Smoke burst.
*/
private static final Graphics BURST_END = new Graphics(387, 0);
/**
* The projectile for Smoke blitz.
*/
private static final Projectile BLITZ_PROJECTILE = Projectile.create((Entity) null, null, 389, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Smoke blitz.
*/
private static final Graphics BLITZ_END = new Graphics(388, 96);
/**
* The projectile for Smoke barrage.
*/
private static final Projectile BARRAGE_PROJECTILE = Projectile.create((Entity) null, null, 391, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Smoke barrage.
*/
private static final Graphics BARRAGE_END = new Graphics(390, 0);
/**
* Constructs a new {@code SmokeSpells} {@code Object}.
*/
public SmokeSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code SmokeSpells} {@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 SmokeSpells(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(8, new SmokeSpells(SpellType.RUSH, 50, 30.0, 176, 177, new Animation(1978, Priority.HIGH), null, RUSH_PROJECTILE, RUSH_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(1), Runes.AIR_RUNE.getItem(1)));
SpellBook.ANCIENT.register(10, new SmokeSpells(SpellType.BURST, 62, 36.0, 179, 180, new Animation(1979, Priority.HIGH), null, BURST_PROJECTILE, BURST_END, Runes.DEATH_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(4), Runes.FIRE_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2)));
SpellBook.ANCIENT.register(9, new SmokeSpells(SpellType.BLITZ, 74, 42.0, 183, 184, new Animation(1978, Priority.HIGH), null, BLITZ_PROJECTILE, BLITZ_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2)));
SpellBook.ANCIENT.register(11, new SmokeSpells(SpellType.BARRAGE, 86, 48.0, 183, 185, new Animation(1979, Priority.HIGH), null, BARRAGE_PROJECTILE, BARRAGE_END, Runes.BLOOD_RUNE.getItem(2), Runes.DEATH_RUNE.getItem(4), Runes.FIRE_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);
sendAudio(entity, audio);
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (state.getEstimatedHit() > -1) {
victim.getStateManager().register(EntityState.POISONED, false, type.ordinal() >= SpellType.BLITZ.ordinal() ? 48 : 28, entity);
}
}
@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, 1);
}
}

View file

@ -0,0 +1,61 @@
package plugin.combat.spell;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the sonic wave spell of an evil chicken.
* @author 'Vexia
* @date 24/11/2013
*/
@InitializablePlugin
public final class SonicWaveSpell extends CombatSpell {
/**
* The projectile for Earth strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 337, 8, 8, 52, 100, 15, 1);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public SonicWaveSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code EarthSpell} {@Code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private SonicWaveSpell(SpellType type, int level, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, 0.0, sound, sound + 1, null, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 5);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(63232, new SonicWaveSpell(SpellType.STRIKE, 1, -1, new Graphics(337), STRIKE_PROJECTILE, null));
return this;
}
}

View file

@ -0,0 +1,300 @@
package plugin.combat.spell;
import java.util.ArrayList;
import java.util.List;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.dialogue.DialogueAction;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.interaction.NodeUsageEvent;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.interaction.UseWithHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.PluginManager;
/**
* Handles the trident of seas.
* @author Empathy
*
*/
@InitializablePlugin
public class TridentOfSeas extends CombatSpell {
/**
* Constructs a new {@code TridentOfSeas} {@code Object}.
*/
public TridentOfSeas() {
super(SpellType.TRIDENT_OF_SEAS, SpellBook.MODERN, 75, 0, -1, -1, new Animation(1167, Priority.HIGH), new Graphics(2004, 96), Projectile.create((Entity) null, null, 2002, 20, 0, 52, 75, 15, 11), new Graphics(2003));
}
@Override
public void addExperience(Entity entity, int hit) {
if (!(entity instanceof Player) || hit < 1) {
return;
}
entity.getSkills().addExperience(Skills.HITPOINTS, hit * 1, true);
entity.getSkills().addExperience(Skills.MAGIC, hit * 2, true);
}
@Override
public boolean cast(Entity entity, Node target) {
if (target instanceof Player) {
entity.asPlayer().sendMessage("You can only cast this spell on an npc.");
return false;
}
return super.cast(entity, target);
}
@Override
public boolean meetsRequirements(Entity caster, boolean message, boolean remove) {
Player player = caster.asPlayer();
Item item = player.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
if (item.getId() == 14664 || item.getId() == 14666) {
if (item.getCharge() > 1000) {
int charges = item.getCharge();
if (item.getId() == 14664) {
player.getEquipment().replace(new Item(14666), EquipmentContainer.SLOT_WEAPON);
item = player.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
}
item.setCharge(charges - 1);
return true;
}
player.sendMessage("Your staff has run out of charges.");
player.getEquipment().replace(new Item(14667), EquipmentContainer.SLOT_WEAPON);
return false;
}
return false;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
PluginManager.definePlugin(new TridentOfSeasHandler(), new TridentOfSeasOptionHandler());
SpellBook.MODERN.register(126, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 20);
}
/**
* Handles the trident of seas.
* @author Empathy
*
*/
public class TridentOfSeasHandler extends UseWithHandler {
/**
* The items to charge a trident.
*/
private final Item chaosRune = new Item(562), fireRune = new Item(554, 5), deathRune = new Item(560), coins = new Item(995, 10);
/**
* The charging animation.
*/
private final Animation charge = new Animation(11296);
/**
* Constructs a new @{Code TridentOfSeasHandler} object.
*/
public TridentOfSeasHandler() {
super(14667, 14666);
}
/**
* The staff Ids.
*/
public final int[] tridentIds = new int[] { 14664, 14666 };
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (int id : tridentIds) {
ItemDefinition.forId(id).getConfigurations().put("equipment", this);
}
addHandler(coins.getId(), ITEM_TYPE, this);
addHandler(chaosRune.getId(), ITEM_TYPE, this);
addHandler(fireRune.getId(), ITEM_TYPE, this);
addHandler(deathRune.getId(), ITEM_TYPE, this);
return this;
}
@Override
public Object fireEvent(String identifier, Object... args) {
final Player player = (Player) args[0];
switch (identifier) {
case "equip":
//player.getProperties().setAutocastSpell((CombatSpell) SpellBook.MODERN.getSpell(126));
break;
case "unequip":
player.getProperties().setAutocastSpell(null);
break;
}
return true;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
Item item = event.getUsedItem();
if (item.getCharge() == 3500) {
player.sendMessage("This item is fully charged.");
return false;
}
if (hasRequirements(player)) {
if (player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null || player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) != null) {
player.getDialogueInterpreter().sendItemMessage(14664, "You need your hands free to charge the weapon.");
return true;
}
player.animate(charge);
int charges = calculateCharges(player, item);
addCharges(player, item, charges);
player.getDialogueInterpreter().sendItemMessage(14664, "You add " + charges + " charges to the weapon.", "New total: " + (item.getId() == 14666 ? item.getCharge() - 1000 : charges));
return true;
}
player.getDialogueInterpreter().sendItemMessage(14664, "You need one death rune, one chaos rune, five fire", "runes and ten coins to charge the weapon.");
return false;
}
/**
* Adds the charges to the trident.
* @param player The player.
* @param item The item.
* @param charges The charges.
*/
private void addCharges(Player player, Item item, int charges) {
Item staff = item;
if (staff.getId() == 14667) {
player.getInventory().replace(new Item(14666), staff.getSlot());
staff = player.getInventory().get(staff.getSlot());
}
chaosRune.setAmount(charges);
fireRune.setAmount(charges * 5);
deathRune.setAmount(charges);
coins.setAmount(charges * 10);
player.getInventory().remove(chaosRune, fireRune, deathRune, coins);
chaosRune.setAmount(1);
fireRune.setAmount(5);
deathRune.setAmount(1);
coins.setAmount(10);
staff.setCharge(staff.getCharge() + charges);
if (staff.getCharge() == 3500) {
player.getInventory().replace(new Item(14664), staff.getSlot());
staff = player.getInventory().get(staff.getSlot());
staff.setCharge(3500);
}
}
/**
* Calculates the charges for trident.
* @param player The player.
* @return the charges.
*/
private int calculateCharges(Player player, Item item) {
int max = 3500 - item.getCharge();
List<Integer> requiredItems = new ArrayList<>();
requiredItems.add(player.getInventory().getAmount(fireRune) / 5);
requiredItems.add(player.getInventory().getAmount(coins) / 10);
requiredItems.add(player.getInventory().getAmount(deathRune));
requiredItems.add(player.getInventory().getAmount(chaosRune));
int lowestAmount = 3500;
for (Integer i : requiredItems) {
if (i < lowestAmount) {
lowestAmount = i;
}
}
return lowestAmount > max ? max : lowestAmount;
}
/**
* Checks if the player has the requirements to charge the trident.
* @param player The player.
* @return true if so.
*/
private boolean hasRequirements(Player player) {
if (!player.getInventory().containsItems(deathRune, chaosRune, fireRune, coins)) {
return false;
}
return true;
}
}
/**
* Handles the check and uncharge option for the trident.
* @author Empathy
*
*/
public class TridentOfSeasOptionHandler extends OptionHandler {
/**
* The trident ids.
*/
public final int[] tridentIds = new int[] { 14664, 14666 };
/**
* The items.
*/
private final Item chaosRune = new Item(562), fireRune = new Item(554, 5), deathRune = new Item(560);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (int i : tridentIds) {
ItemDefinition.forId(i).getConfigurations().put("option:check", this);
ItemDefinition.forId(i).getConfigurations().put("option:uncharge", this);
}
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
final Item item = node.asItem();
switch(option) {
case "check":
player.sendMessage("Your trident has " + (item.getCharge() - 1000) + " charges.");
break;
case "uncharge":
player.getDialogueInterpreter().sendOptions("You will NOT get the coins back.", "Okay, uncharge it.", "No, don't uncharge it.");
player.getDialogueInterpreter().addAction(new DialogueAction() {
@Override
public void handle(Player player, int buttonId) {
switch(buttonId) {
case 2:
if (!player.getInventory().hasSpaceFor(chaosRune) || !player.getInventory().hasSpaceFor(deathRune) || !player.getInventory().hasSpaceFor(fireRune)) {
player.sendMessage("You need more inventory space to do this.");
break;
}
int charges = item.getCharge() - 1000;
chaosRune.setAmount(charges);
fireRune.setAmount(charges * 5);
deathRune.setAmount(charges);
player.getInventory().replace(new Item(14667), item.getSlot());
player.getInventory().add(fireRune, deathRune, chaosRune);
break;
}
}
});
break;
}
return true;
}
}
}

View file

@ -0,0 +1,363 @@
package plugin.combat.spell;
import java.util.ArrayList;
import java.util.List;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.dialogue.DialogueAction;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.interaction.NodeUsageEvent;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.interaction.UseWithHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.PluginManager;
/**
* Handles the trident of seas.
* @author Empathy
*
*/
@InitializablePlugin
public class TridentOfSwamp extends CombatSpell {
/**
* Constructs a new {@code TridentOfSeas} {@code Object}.
*/
public TridentOfSwamp() {
super(SpellType.TRIDENT_OF_SEAS, SpellBook.MODERN, 75, 0, -1, -1, new Animation(1167, Priority.HIGH), new Graphics(2004, 96), Projectile.create((Entity) null, null, 2002, 20, 0, 52, 75, 15, 11), new Graphics(2003));
}
@Override
public void addExperience(Entity entity, int hit) {
if (!(entity instanceof Player) || hit < 1) {
return;
}
entity.getSkills().addExperience(Skills.HITPOINTS, hit * 1, true);
entity.getSkills().addExperience(Skills.MAGIC, hit * 2, true);
}
/*
* Full: 15024
* Charged: 14981
* Empty: 14982
*
*
* F: 14664
* C: 14666
* E: 14667
*/
@Override
public boolean cast(Entity entity, Node target) {
if (target instanceof Player) {
entity.asPlayer().sendMessage("You can only cast this spell on an npc.");
return false;
}
return super.cast(entity, target);
}
@Override
public boolean meetsRequirements(Entity caster, boolean message, boolean remove) {
Player player = caster.asPlayer();
Item item = player.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
if (item.getId() == 15024 || item.getId() == 14981) {
if (item.getCharge() > 1000) {
int charges = item.getCharge();
if (item.getId() == 15024) {
player.getEquipment().replace(new Item(14981), EquipmentContainer.SLOT_WEAPON);
item = player.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
}
item.setCharge(charges - 1);
return true;
}
player.sendMessage("Your staff has run out of charges.");
player.getEquipment().replace(new Item(14982), EquipmentContainer.SLOT_WEAPON);
return false;
}
return false;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
PluginManager.definePlugin(new TridentOfSwampHandler(), new TridentOfSwampOptionHandler());
SpellBook.MODERN.register(127, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 20);
}
/**
* Handles the trident of seas.
* @author Empathy
*
*/
public class TridentOfSwampHandler extends UseWithHandler {
/**
* The items to charge a trident.
*/
private final Item chaosRune = new Item(562), fireRune = new Item(554, 5), deathRune = new Item(560), coins = new Item(14959, 1);
/**
* The charging animation.
*/
private final Animation charge = new Animation(11296);
/**
* Constructs a new @{Code TridentOfSeasHandler} object.
*/
/*
* Full: 15024
* Charged: 14981
* Empty: 14982
*
*
* F: 14664
* C: 14666
* E: 14667
*/
public TridentOfSwampHandler() {
super(14982, 14981);
}
/**
* The staff Ids.
*/
public final int[] tridentIds = new int[] { 15024, 14981 };
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (int id : tridentIds) {
ItemDefinition.forId(id).getConfigurations().put("equipment", this);
}
addHandler(coins.getId(), ITEM_TYPE, this);
addHandler(chaosRune.getId(), ITEM_TYPE, this);
addHandler(fireRune.getId(), ITEM_TYPE, this);
addHandler(deathRune.getId(), ITEM_TYPE, this);
return this;
}
@Override
public Object fireEvent(String identifier, Object... args) {
final Player player = (Player) args[0];
switch (identifier) {
case "equip":
//player.getProperties().setAutocastSpell((CombatSpell) SpellBook.MODERN.getSpell(126));
break;
case "unequip":
player.getProperties().setAutocastSpell(null);
break;
}
return true;
}
/*
* Full: 15024
* Charged: 14981
* Empty: 14982
*
*
* F: 14664
* C: 14666
* E: 14667
*/
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
Item item = event.getUsedItem();
if (item.getCharge() == 3500) {
player.sendMessage("This item is fully charged.");
return false;
}
if (hasRequirements(player)) {
if (player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null || player.getEquipment().get(EquipmentContainer.SLOT_SHIELD) != null) {
player.getDialogueInterpreter().sendItemMessage(15024, "You need your hands free to charge the weapon.");
return true;
}
player.animate(charge);
int charges = calculateCharges(player, item);
addCharges(player, item, charges);
player.getDialogueInterpreter().sendItemMessage(15024, "You add " + charges + " charges to the weapon.", "New total: " + (item.getId() == 14981 ? item.getCharge() - 1000 : charges));
return true;
}
player.getDialogueInterpreter().sendItemMessage(15024, "You need one death rune, one chaos rune, five fire", "runes and one zulrah scale to charge the weapon.");
return false;
}
/*
* Full: 15024
* Charged: 14981
* Empty: 14982
*
*
* F: 14664
* C: 14666
* E: 14667
*/
/**
* Adds the charges to the trident.
* @param player The player.
* @param item The item.
* @param charges The charges.
*/
private void addCharges(Player player, Item item, int charges) {
Item staff = item;
if (staff.getId() == 14982) {
player.getInventory().replace(new Item(14981), staff.getSlot());
staff = player.getInventory().get(staff.getSlot());
}
chaosRune.setAmount(charges);
fireRune.setAmount(charges * 5);
deathRune.setAmount(charges);
coins.setAmount(charges * 1);
player.getInventory().remove(chaosRune, fireRune, deathRune, coins);
chaosRune.setAmount(1);
fireRune.setAmount(5);
deathRune.setAmount(1);
coins.setAmount(1);
staff.setCharge(staff.getCharge() + charges);
if (staff.getCharge() == 3500) {
player.getInventory().replace(new Item(15024), staff.getSlot());
staff = player.getInventory().get(staff.getSlot());
staff.setCharge(3500);
}
}
/**
* Calculates the charges for trident.
* @param player The player.
* @return the charges.
*/
private int calculateCharges(Player player, Item item) {
int max = 3500 - item.getCharge();
List<Integer> requiredItems = new ArrayList<>();
requiredItems.add(player.getInventory().getAmount(fireRune) / 5);
requiredItems.add(player.getInventory().getAmount(coins) / 1);
requiredItems.add(player.getInventory().getAmount(deathRune));
requiredItems.add(player.getInventory().getAmount(chaosRune));
int lowestAmount = 3500;
for (Integer i : requiredItems) {
if (i < lowestAmount) {
lowestAmount = i;
}
}
return lowestAmount > max ? max : lowestAmount;
}
/**
* Checks if the player has the requirements to charge the trident.
* @param player The player.
* @return true if so.
*/
private boolean hasRequirements(Player player) {
if (!player.getInventory().containsItems(deathRune, chaosRune, fireRune, coins)) {
return false;
}
return true;
}
}
/**
* Handles the check and uncharge option for the trident.
* @author Empathy
*
*/
/*
* Full: 15024
* Charged: 14981
* Empty: 14982
*
*
* F: 14664
* C: 14666
* E: 14667
*/
public class TridentOfSwampOptionHandler extends OptionHandler {
/**
* The trident ids.
*/
public final int[] tridentIds = new int[] { 15024, 14981 };
/**
* The items.
*/
private final Item chaosRune = new Item(562), fireRune = new Item(554, 5), deathRune = new Item(560), coins = new Item(14959);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (int i : tridentIds) {
ItemDefinition.forId(i).getConfigurations().put("option:check", this);
ItemDefinition.forId(i).getConfigurations().put("option:uncharge", this);
}
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
final Item item = node.asItem();
switch(option) {
case "check":
player.sendMessage("Your trident has " + (item.getCharge() - 1000) + " charges.");
break;
case "uncharge":
player.getDialogueInterpreter().sendOptions("Select an Option", "Okay, uncharge it.", "No, don't uncharge it.");
player.getDialogueInterpreter().addAction(new DialogueAction() {
@Override
public void handle(Player player, int buttonId) {
switch(buttonId) {
case 2:
if (!player.getInventory().hasSpaceFor(chaosRune) || !player.getInventory().hasSpaceFor(deathRune) || !player.getInventory().hasSpaceFor(fireRune)) {
player.sendMessage("You need more inventory space to do this.");
break;
}
int charges = item.getCharge() - 1000;
chaosRune.setAmount(charges);
fireRune.setAmount(charges * 5);
deathRune.setAmount(charges);
coins.setAmount(charges);
player.getInventory().replace(new Item(14982), item.getSlot());
player.getInventory().add(fireRune, deathRune, chaosRune, coins);
break;
}
}
});
break;
}
return true;
}
}
}

View file

@ -0,0 +1,127 @@
package plugin.combat.spell;
import org.crandor.game.content.skill.free.magic.Runes;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.combat.equipment.SpellType;
import org.crandor.game.node.entity.impl.Projectile;
import org.crandor.game.node.entity.impl.Animator.Priority;
import org.crandor.game.node.entity.player.link.SpellBookManager.SpellBook;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the water spells.
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
public final class WaterSpell extends CombatSpell {
/**
* The start graphic for Water strike.
*/
private static final Graphics STRIKE_START = new Graphics(93, 96);
/**
* The projectile for Water strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 94, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water strike.
*/
private static final Graphics STRIKE_END = new Graphics(95, 96);
/**
* The start graphic for Water bolt.
*/
private static final Graphics BOLT_START = new Graphics(120, 96);
/**
* The projectile for Water bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 121, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water bolt.
*/
private static final Graphics BOLT_END = new Graphics(122, 96);
/**
* The start graphic for Water blast.
*/
private static final Graphics BLAST_START = new Graphics(135, 96); // 129
/**
* The projectile for Water blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 136, 40, 36, 52, 75, 15, 11); // 130
/**
* The end graphic for Water blast.
*/
private static final Graphics BLAST_END = new Graphics(137, 96); // 131
/**
* The start graphic for Water wave.
*/
private static final Graphics WAVE_START = new Graphics(161, 96);
/**
* The projectile for Water wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 162, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water wave.
*/
private static final Graphics WAVE_END = new Graphics(163, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code WaterSpell} {@Code Object}
*/
public WaterSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code WaterSpell} {@Code Object}
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private WaterSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 2);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(4, new WaterSpell(SpellType.STRIKE, 5, 7.5, 211, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.WATER_RUNE.getItem(1), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(14, new WaterSpell(SpellType.BOLT, 23, 16.5, 209, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.WATER_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(27, new WaterSpell(SpellType.BLAST, 47, 28.5, 207, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.WATER_RUNE.getItem(3), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(48, new WaterSpell(SpellType.WAVE, 65, 37.5, 213, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.WATER_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}