use of com.solinia.solinia.Models.ActiveSpellEffect in project solinia3-core by mixxit.
the class Utils method getActiveSpellEffectsRemainingValue.
public static int getActiveSpellEffectsRemainingValue(LivingEntity livingEntity, SpellEffectType effectType) {
int totalRemaining = 0;
SoliniaEntitySpells effects;
try {
effects = StateManager.getInstance().getEntityManager().getActiveEntitySpells(livingEntity);
for (SoliniaActiveSpell activeSpell : effects.getActiveSpells()) {
for (ActiveSpellEffect effect : activeSpell.getActiveSpellEffects()) {
if (!(effect.getSpellEffectType().equals(effectType)))
continue;
totalRemaining += effect.getRemainingValue();
}
}
} catch (CoreStateInitException e) {
// skip
}
return totalRemaining;
}
use of com.solinia.solinia.Models.ActiveSpellEffect in project solinia3-core by mixxit.
the class Utils method getActiveSpellEffects.
public static List<ActiveSpellEffect> getActiveSpellEffects(LivingEntity livingEntity, SpellEffectType effectType) {
List<ActiveSpellEffect> returnEffects = new ArrayList<ActiveSpellEffect>();
SoliniaEntitySpells effects;
try {
effects = StateManager.getInstance().getEntityManager().getActiveEntitySpells(livingEntity);
for (SoliniaActiveSpell activeSpell : effects.getActiveSpells()) {
for (ActiveSpellEffect effect : activeSpell.getActiveSpellEffects()) {
if (!(effect.getSpellEffectType().equals(effectType)))
continue;
returnEffects.add(effect);
}
}
} catch (CoreStateInitException e) {
// skip
}
return returnEffects;
}
use of com.solinia.solinia.Models.ActiveSpellEffect in project solinia3-core by mixxit.
the class Utils method reduceDamage.
public static double reduceDamage(ISoliniaLivingEntity defender, double damage) {
if (damage <= 0)
return damage;
int spellMitigateMeleeDamage = 0;
for (ActiveSpellEffect effect : Utils.getActiveSpellEffects(defender.getBukkitLivingEntity(), SpellEffectType.MitigateMeleeDamage)) {
spellMitigateMeleeDamage += effect.getRemainingValue();
}
// We should check this in advance really
if (spellMitigateMeleeDamage < 1)
return damage;
double damage_to_reduce = damage * (spellMitigateMeleeDamage / 100);
return (damage - damage_to_reduce);
}
Aggregations