Search in sources :

Example 36 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ConcealmentRule method getMissChance.

// DEPENDING ON VISIBILITY_LEVEL?
public static int getMissChance(DC_ActiveObj action) {
    DC_Obj source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    Obj cell = source.getGame().getCellByCoordinate(source.getCoordinates());
    // if (source.checkPassive(STANDARD_PASSIVES.DARKVISION))
    // return false;
    // if (source.checkPassive(STANDARD_PASSIVES.LIGHTVISION))
    // return false;
    int chance = target.getIntParam(PARAMS.CONCEALMENT) - source.getIntParam(PARAMS.DETECTION) - // - target.getIntParam(PARAMS.NOISE) / 2
    source.getIntParam(PARAMS.ACCURACY) - source.getIntParam(PARAMS.ILLUMINATION) + // vision...
    cell.getIntParam(PARAMS.CONCEALMENT);
    if (chance < 0) {
        chance = 0;
    }
    chance -= source.getIntParam(PARAMS.ILLUMINATION);
    if (chance < 0) {
        chance += 500;
        if (chance < 0)
            return -(chance) / 2;
        else
            return 0;
    }
    return (chance);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Example 37 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ConcealmentRule method checkMissed.

/*
     * add buff with a passive dodge ability addPassive effect?
	 * trigger/continuous effect to be removed...
	 * 
	 * or maybe I could hard-code it somewhere almost like resistance?
	 * 
	 * Only for *ranged touch* actions, which could be a STD spell/action
	 * passive or tag or classif.
	 */
public static boolean checkMissed(DC_ActiveObj action) {
    Unit source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    if (source == null || target == null) {
        return false;
    }
    if (source.getVisionMode() == VisionEnums.VISION_MODE.INFRARED_VISION) {
    }
    int chance = getMissChance(action);
    if (chance <= 0) {
        return false;
    }
    return RandomWizard.chance(chance);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) Unit(eidolons.entity.obj.unit.Unit)

Example 38 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ResistanceRule method getResistance.

public static int getResistance(Ref ref) {
    DC_ActiveObj spell = (DC_ActiveObj) ref.getObj(KEYS.SPELL);
    if (spell == null) {
        return 0;
    }
    Obj target = ref.getTargetObj();
    Obj source = ref.getSourceObj();
    DAMAGE_TYPE type = spell.getEnergyType();
    int specResist = 0;
    PARAMETER typeResistance = DC_ContentManager.getDamageTypeResistance(type);
    if (typeResistance != null) {
        specResist = target.getIntParam(typeResistance);
    }
    int resistance = specResist;
    // int resistance = target.getIntParam(PARAMS.RESISTANCE);
    // resistance = MathMaster.addFactor(resistance, specResist);
    resistance -= source.getIntParam(PARAMS.RESISTANCE_PENETRATION);
    int mod = spell.getIntParam(PARAMS.RESISTANCE_MOD);
    resistance = MathMaster.applyMod(resistance, mod);
    return resistance;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 39 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class EvasionRule method getMissChance.

public static int getMissChance(DC_ActiveObj action) {
    DC_Obj source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    int chance = target.getIntParam(PARAMS.EVASION) - source.getIntParam(PARAMS.ACCURACY);
    return chance;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Example 40 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class EvasionRule method checkMissed.

public static boolean checkMissed(DC_ActiveObj action) {
    DC_Obj source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    if (source == null || target == null) {
        return false;
    }
    if (source.checkPassive(UnitEnums.STANDARD_PASSIVES.TRUE_STRIKE)) {
        return false;
    }
    int chance = getMissChance(action);
    if (chance <= 0) {
        return false;
    }
    return RandomWizard.chance(chance);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)73 Unit (eidolons.entity.obj.unit.Unit)22 ArrayList (java.util.ArrayList)17 Obj (main.entity.obj.Obj)15 DC_UnitAction (eidolons.entity.active.DC_UnitAction)12 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 ActiveObj (main.entity.obj.ActiveObj)7 Effect (main.ability.effects.Effect)5 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)5 Targeting (main.elements.targeting.Targeting)5 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)4 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)4 FixedTargeting (main.elements.targeting.FixedTargeting)4 Coordinates (main.game.bf.Coordinates)4 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)3