this pretty much gives proper tome of fire support since there is none in kronos, enjoy.
Code:
package io.ruin.model.skills.magic.spells.modern;
import io.ruin.cache.ItemDef;
import io.ruin.model.combat.Hit;
import io.ruin.model.entity.Entity;
import io.ruin.model.entity.player.Player;
import io.ruin.model.item.actions.impl.chargable.TomeOfFire;
import io.ruin.model.item.containers.Equipment;
import io.ruin.model.skills.magic.spells.TargetSpell;
/**
*
* @Author Morrigan
*
* checks for tome before & after properly
*
*
*/
public class FireSpell extends TargetSpell {
static {
ItemDef.cached.values().stream().filter(def -> def.name.toLowerCase().contains("tome of fire")).forEach(def -> def.tomeOfFire = true);
}
public static boolean hasTomeEquipped(Player player) {
ItemDef def = player.getEquipment().getDef(Equipment.SLOT_SHIELD);
return def != null && ((ItemDef) def).tomeOfFire;
}
@Override
protected void beforeHit(Hit hit, Entity target) {
super.beforeHit(hit, target);
if (hit.attacker != null && hit.attacker.player != null) {
if (hasTomeEquipped(hit.attacker.player)) {
TomeOfFire.consumeCharge(hit.attacker.player);
hit.boostDamage(0.5);
}
}
}
@Override
public void afterHit(Hit hit, Entity target) {
if(hit.damage > 0 && target.player != null) {
if (!hasTomeEquipped(hit.attacker.player)) {
return;
}
}
}
}
thanks @Polar for guidance and helping me clean it up a bit