diff --git a/Server/src/main/java/core/game/node/entity/npc/familiar/ElementalTitanNPC.java b/Server/src/main/java/core/game/node/entity/npc/familiar/ElementalTitanNPC.java new file mode 100644 index 000000000..69b4f0e71 --- /dev/null +++ b/Server/src/main/java/core/game/node/entity/npc/familiar/ElementalTitanNPC.java @@ -0,0 +1,36 @@ +package core.game.node.entity.npc.familiar; + +import core.game.node.entity.player.Player; +import core.game.node.entity.skill.Skills; +import core.game.node.entity.skill.summoning.familiar.Familiar; +import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial; + +public abstract class ElementalTitanNPC extends Familiar { + + private static final int scrollHealAmount = 8; + private static final double scrollDefenceBoostPercent = 12.5; + + public ElementalTitanNPC(Player owner, int id, int ticks, int pouchId, int specialCost, int attackStyle) { + super(owner, id, ticks, pouchId, specialCost, attackStyle); + } + + /** + raises defence by 12.5% and heals 8 hp (with ability to over heal) + */ + @Override + protected boolean specialMove(FamiliarSpecial special) { + int currentDefenceLevel = owner.getSkills().getLevel(Skills.DEFENCE); + owner.getSkills().updateLevel(Skills.DEFENCE, (int)(scrollDefenceBoostPercent * currentDefenceLevel)); + int currentHp = owner.getSkills().getLifepoints(); + int maxHp = owner.getSkills().getMaximumLifepoints() + scrollHealAmount; + int healAmount = Math.min(maxHp - currentHp, scrollHealAmount); + if (healAmount> 0) { + owner.getSkills().healNoRestrictions(healAmount); + return true; + } + else { + owner.sendMessage("You are already at maximum hitpoints!"); + return false; + } + } +} diff --git a/Server/src/main/java/core/game/node/entity/npc/familiar/FireTitanNPC.java b/Server/src/main/java/core/game/node/entity/npc/familiar/FireTitanNPC.java index cad29bd36..6f0e44fe7 100644 --- a/Server/src/main/java/core/game/node/entity/npc/familiar/FireTitanNPC.java +++ b/Server/src/main/java/core/game/node/entity/npc/familiar/FireTitanNPC.java @@ -1,5 +1,7 @@ package core.game.node.entity.npc.familiar; +import core.game.node.entity.combat.equipment.WeaponInterface; +import core.game.node.entity.skill.Skills; import core.game.node.entity.skill.summoning.familiar.Familiar; import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial; import core.plugin.Initializable; @@ -10,7 +12,7 @@ import core.game.node.entity.player.Player; * @author Aero */ @Initializable -public class FireTitanNPC extends Familiar { +public class FireTitanNPC extends ElementalTitanNPC { /** * Constructs a new {@code FireTitanNPC} {@code Object}. @@ -25,7 +27,7 @@ public class FireTitanNPC extends Familiar { * @param id The id. */ public FireTitanNPC(Player owner, int id) { - super(owner, id, 6200, 12802, 20); + super(owner, id, 6200, 12802, 20, WeaponInterface.STYLE_CAST); } @Override @@ -33,11 +35,6 @@ public class FireTitanNPC extends Familiar { return new FireTitanNPC(owner, id); } - @Override - protected boolean specialMove(FamiliarSpecial special) { - return false; - } - @Override public int[] getIds() { return new int[] { 7355, 7356 }; diff --git a/Server/src/main/java/core/game/node/entity/npc/familiar/IceTitanNPC.java b/Server/src/main/java/core/game/node/entity/npc/familiar/IceTitanNPC.java index 72f1f9ece..028e51225 100644 --- a/Server/src/main/java/core/game/node/entity/npc/familiar/IceTitanNPC.java +++ b/Server/src/main/java/core/game/node/entity/npc/familiar/IceTitanNPC.java @@ -14,7 +14,7 @@ import core.game.world.update.flag.context.Graphics; * @author Aero */ @Initializable -public class IceTitanNPC extends Familiar { +public class IceTitanNPC extends ElementalTitanNPC { /** * Constructs a new {@code IceTitanNPC} {@code Object}. @@ -37,11 +37,6 @@ public class IceTitanNPC extends Familiar { return new IceTitanNPC(owner, id); } - @Override - protected boolean specialMove(FamiliarSpecial special) { - owner.getSkills().updateLevel(Skills.DEFENCE, (int) ((int) owner.getSkills().getStaticLevel(Skills.DEFENCE) * 0.12)); - return true; - } @Override public void visualizeSpecialMove() { diff --git a/Server/src/main/java/core/game/node/entity/npc/familiar/MossTitanNPC.java b/Server/src/main/java/core/game/node/entity/npc/familiar/MossTitanNPC.java index cbab007e7..43c296d88 100644 --- a/Server/src/main/java/core/game/node/entity/npc/familiar/MossTitanNPC.java +++ b/Server/src/main/java/core/game/node/entity/npc/familiar/MossTitanNPC.java @@ -11,7 +11,7 @@ import core.game.node.entity.player.Player; * @author Aero */ @Initializable -public class MossTitanNPC extends Familiar { +public class MossTitanNPC extends ElementalTitanNPC { /** * Constructs a new {@code MossTitanNPC} {@code Object}. @@ -34,11 +34,6 @@ public class MossTitanNPC extends Familiar { return new MossTitanNPC(owner, id); } - @Override - protected boolean specialMove(FamiliarSpecial special) { - return false; - } - @Override public int[] getIds() { return new int[] { 7357, 7358 };