use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaActiveSpell method applySuccor.
private void applySuccor(SpellEffect spellEffect, ISoliniaSpell soliniaSpell, int casterLevel) {
if (!(getLivingEntity() instanceof Player))
return;
ISoliniaPlayer solPlayer;
try {
solPlayer = SoliniaPlayerAdapter.Adapt((Player) getLivingEntity());
SoliniaZone zone = solPlayer.getZone();
if (zone == null) {
getLivingEntity().sendMessage("Succor failed! Your body could not be pulled by an astral anchor (not found in a zone)!");
return;
}
if (zone.getSuccorx() == 0 && zone.getSuccory() == 0 && zone.getSuccorz() == 0) {
getLivingEntity().sendMessage("Succor failed! Your body could not be pulled by an astral anchor (zone has no succor point)!");
return;
}
double x = (zone.getSuccorx());
double y = (zone.getSuccory());
double z = (zone.getSuccorz());
Location loc = new Location(Bukkit.getWorld("world"), x, y, z);
getLivingEntity().teleport(loc);
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaActiveSpell method applyReclaimPet.
private void applyReclaimPet(SpellEffect spellEffect, ISoliniaSpell soliniaSpell, int casterLevel) {
if (!(getLivingEntity() instanceof Wolf))
return;
LivingEntity owner = (LivingEntity) ((Wolf) getLivingEntity()).getOwner();
if (owner == null)
return;
if (!(owner instanceof Player))
return;
try {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) owner);
LivingEntity pet = StateManager.getInstance().getEntityManager().getPet((Player) owner);
if (pet == null)
return;
solplayer.killAllPets();
SoliniaPlayerAdapter.Adapt((Player) owner).increasePlayerMana(20);
} catch (CoreStateInitException e) {
// do nothing
}
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method doAttack.
private DamageHitInfo doAttack(Plugin plugin, ISoliniaLivingEntity defender, DamageHitInfo hit) {
if (defender == null)
return hit;
// for riposte
int originalDamage = hit.damage_done;
hit = defender.avoidDamage(this, hit);
if (hit.avoided == true) {
if (hit.riposted == true && originalDamage > 0) {
if (defender.isPlayer()) {
((Player) defender.getBukkitLivingEntity()).sendMessage(ChatColor.GRAY + "* You riposte the attack!");
defender.tryIncreaseSkill("RIPOSTE", 1);
}
if (isPlayer()) {
((Player) getBukkitLivingEntity()).sendMessage(ChatColor.GRAY + "* " + defender.getBukkitLivingEntity().getCustomName() + " ripostes your attack!");
damage(plugin, originalDamage, getBukkitLivingEntity());
}
}
if (hit.dodged == true) {
if (defender.isPlayer()) {
((Player) defender.getBukkitLivingEntity()).sendMessage(ChatColor.GRAY + "* You dodge the attack!");
defender.tryIncreaseSkill("DODGE", 1);
}
if (isPlayer()) {
((Player) getBukkitLivingEntity()).sendMessage(ChatColor.GRAY + "* " + defender.getBukkitLivingEntity().getCustomName() + " dodges your attack!");
}
}
}
if (hit.damage_done >= 0) {
if (defender.checkHitChance(this, hit)) {
hit = defender.meleeMitigation(this, hit);
if (hit.damage_done > 0) {
hit = applyDamageTable(hit);
hit = commonOutgoingHitSuccess(defender, hit);
}
} else {
if (getBukkitLivingEntity() instanceof Player) {
((Player) getBukkitLivingEntity()).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("You tried to hit " + defender.getBukkitLivingEntity().getCustomName() + ", but missed!"));
}
if (defender.getBukkitLivingEntity() instanceof Player) {
((Player) defender.getBukkitLivingEntity()).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(getBukkitLivingEntity().getCustomName() + " tried to hit you, but missed!"));
try {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) defender.getBukkitLivingEntity());
solplayer.tryIncreaseSkill("DEFENSE", 1);
} catch (CoreStateInitException e) {
// skip
}
}
hit.damage_done = 0;
}
}
return hit;
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method getProcChancePct.
@Override
public int getProcChancePct() {
// (Dexterity / 35) / 25
int dexterity = 75;
if (this.getBukkitLivingEntity() instanceof Player) {
try {
ISoliniaPlayer player = SoliniaPlayerAdapter.Adapt((Player) this.getBukkitLivingEntity());
if (player != null)
dexterity = getDexterity();
} catch (CoreStateInitException e) {
}
}
if (this.getNpcid() > 0)
dexterity = getDexterity();
float dexdiv = (dexterity / 35);
float fina = ((dexdiv / 25) * 100);
return (int) Math.floor(fina);
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method getMaxHP.
@Override
public double getMaxHP() {
if (getNpcid() < 1 && !isPlayer())
return 1;
double statHp = Utils.getStatMaxHP(getClassObj(), getLevel(), getStamina());
double itemHp = getItemHp();
double totalHp = statHp + itemHp;
try {
if (getNpcid() > 0) {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
if (npc == null)
return totalHp;
totalHp += Utils.getTotalEffectTotalHP(this.getBukkitLivingEntity());
if (npc.isBoss()) {
totalHp += (Utils.getBossHPMultiplier() * npc.getLevel());
}
if (npc.isHeroic()) {
totalHp += (Utils.getHeroicHPMultiplier() * npc.getLevel());
}
if (npc.isRaidboss()) {
totalHp += (Utils.getRaidBossHPMultiplier() * npc.getLevel());
}
if (npc.isRaidheroic()) {
totalHp += (Utils.getRaidHeroicHPMultiplier() * npc.getLevel());
}
return totalHp;
}
if (isPlayer()) {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) getBukkitLivingEntity());
if (solplayer == null)
return totalHp;
totalHp += Utils.getTotalEffectTotalHP(this.getBukkitLivingEntity());
// get AA hp bonus
totalHp += Utils.getTotalAAEffectMaxHp(this.getBukkitLivingEntity());
return totalHp;
}
} catch (CoreStateInitException e) {
return totalHp;
}
return totalHp;
}
Aggregations