implement fire, ice and moss titan summoning scrolls

This commit is contained in:
vk 2021-10-03 03:13:48 +00:00 committed by Ceikry
parent 1e66ca6935
commit 4c0da02e44
4 changed files with 42 additions and 19 deletions

View file

@ -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;
}
}
}

View file

@ -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 };

View file

@ -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() {

View file

@ -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 };