1package com.osroyale.game.world.entity.combat.strategy.player.custom;
3import com.osroyale.Config;
4import com.osroyale.game.Animation;
5import com.osroyale.game.Graphic;
6import com.osroyale.game.UpdatePriority;
7import com.osroyale.game.world.entity.combat.CombatType;
8import com.osroyale.game.world.entity.combat.attack.FightType;
9import com.osroyale.game.world.entity.combat.hit.CombatHit;
10import com.osroyale.game.world.entity.combat.hit.Hit;
11import com.osroyale.game.world.entity.combat.projectile.CombatProjectile;
12import com.osroyale.game.world.entity.combat.strategy.basic.MagicStrategy;
13import com.osroyale.game.world.entity.mob.Mob;
14import com.osroyale.game.world.entity.mob.player.Player;
15import com.osroyale.game.world.entity.mob.player.PlayerRight;
16import com.osroyale.game.world.entity.skill.Skill;
17import com.osroyale.game.world.items.Item;
18import com.osroyale.game.world.items.containers.equipment.Equipment;
19import com.osroyale.net.packet.out.SendMessage;
22 private static final TumekenStrategy INSTANCE =
new TumekenStrategy();
23 private static CombatProjectile PROJECTILE;
27 PROJECTILE = CombatProjectile.getDefinition(
"SHADOW");
28 }
catch (Exception e) {
34 public boolean canAttack(Player attacker, Mob defender) {
35 if (defender.isPlayer() && !PlayerRight.isOwner(defender.getPlayer())) {
36 attacker.send(
new SendMessage(
"You can't attack players with this weapon."));
40 Item weapon = attacker.equipment.get(Equipment.WEAPON_SLOT);
43 attacker.getCombat().reset();
50 public void start(Player attacker, Mob defender, Hit[] hits) {
51 PROJECTILE.getAnimation().ifPresent(animation -> attacker.animate(animation,
true));
52 PROJECTILE.getStart().ifPresent(attacker::graphic);
53 int projectileDuration = PROJECTILE.sendProjectile(attacker, defender);
54 final Graphic endGraphic = getEndGraphic(PROJECTILE.getEnd(), missed(hits),
SPLASH, projectileDuration);
55 if (endGraphic !=
null) {
56 defender.graphic(endGraphic);
59 if (!defender.isPlayer() || !PlayerRight.isIronman(attacker)) {
60 for (Hit hit : hits) {
61 int exp = 2 * hit.getDamage();
62 attacker.skills.addExperience(Skill.MAGIC, exp * Config.COMBAT_MODIFICATION);
63 attacker.skills.addExperience(Skill.HITPOINTS, exp / 3 * Config.COMBAT_MODIFICATION);
69 public void attack(Player attacker, Mob defender, Hit hit) {
70 attacker.tridentSeasCharges--;
74 public void hit(Player attacker, Mob defender, Hit hit) {
78 public Animation getAttackAnimation(Player attacker, Mob defender) {
79 int animation = attacker.getCombat().getFightType().getAnimation();
80 return new Animation(animation, UpdatePriority.HIGH);
84 public int getAttackDelay(Player attacker, Mob defender, FightType fightType) {
85 return attacker.getCombat().getFightType().getDelay();
89 public int getAttackDistance(Player attacker, FightType fightType) {
94 public CombatHit[] getHits(Player attacker, Mob defender) {
96 int level = attacker.skills.getLevel(Skill.MAGIC);
98 max += (level - 75) / 3;
100 return new CombatHit[]{nextMagicHit(attacker, defender, max, PROJECTILE)};
104 public CombatType getCombatType() {
105 return CombatType.MAGIC;
108 public static TumekenStrategy
get() {
static final Graphic SPLASH