RECENT NEWS
📢 𝟑𝟎% Discount for all ads only this month ❄️

FireSpell.java re-write

GFX Tom
power_settings_new
Seen 4 months ago
Mithril Warrior (21/30)
Mithril Warrior
0
0
0
21 Posts
Posts
0
Warning level
1
Likes
0
Dislikes
Joined: 2022-04-24

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

}
00
  • Like
Reactions: