// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
//      Magicbane Emulator Project © 2013 - 2022
//                www.magicbane.com


package engine.powers.effectmodifiers;

import engine.jobs.AbstractEffectJob;
import engine.mbEnums.ModType;
import engine.mbEnums.SourceType;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.objects.Building;
import engine.objects.Item;
import engine.powers.EffectsBase;
import engine.wpak.data.ModifierEntry;

import java.sql.ResultSet;
import java.sql.SQLException;


public abstract class AbstractEffectModifier {

    public float minMod;
    public SourceType sourceType;
    public ModType modType;
    protected EffectsBase parent;
    protected int UUID;
    protected String IDString;
    protected String effectType;
    protected float maxMod;
    protected float percentMod;
    protected float ramp;
    protected boolean useRampAdd;
    protected String type;
    protected String string1;
    protected String string2;

    public AbstractEffectModifier(ResultSet rs){

    }
    public AbstractEffectModifier(ModifierEntry mod) {

        this.IDString = mod.type.name();
        this.effectType = mod.type.name();
        this.modType = mod.type;
        this.type = mod.type.name().replace("\"", "");
        this.sourceType = SourceType.GetSourceType(this.type.replace(" ", "").replace("-", ""));
        this.minMod = mod.min;
        this.maxMod = mod.max;
        this.percentMod = mod.value;
        this.ramp = (float)mod.compoundCurveType.getValue();
        this.useRampAdd = (float)mod.compoundCurveType.getValue() != 0;

        this.string1 = mod.arg1;
        this.string2 = mod.arg2;
    }


    public int getUUID() {
        return this.UUID;
    }

    // public String getIDString() {
    // return this.IDString;
    // }

    public String getmodType() {
        return this.effectType;
    }

    public float getMinMod() {
        return this.minMod;
    }

    public float getMaxMod() {
        return this.maxMod;
    }

    public float getPercentMod() {
        return this.percentMod;
    }

    public float getRamp() {
        return this.ramp;
    }

    public String getType() {
        return this.type;
    }

    public String getString1() {
        return this.string1;
    }

    public String getString2() {
        return this.string2;
    }

    public EffectsBase getParent() {
        return this.parent;
    }

    public void setParent(EffectsBase value) {
        this.parent = value;
    }

    public void applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {

        _applyEffectModifier(source, awo, trains, effect);
    }

    protected abstract void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect);

    public abstract void applyBonus(AbstractCharacter ac, int trains);

    public abstract void applyBonus(Item item, int trains);

    public abstract void applyBonus(Building building, int trains);
}
