use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class DC_CounterMaster method getCounterPriority.
public static float getCounterPriority(String counterName, DC_Obj target) {
if (target instanceof Unit) {
Unit heroObj = (Unit) target;
String realName = CounterMaster.findCounter(counterName);
switch(new EnumMaster<COUNTER>().retrieveEnumConst(COUNTER.class, realName)) {
case Blaze:
if (!target.getGame().getRules().getBlazeRule().checkApplies(heroObj)) {
return 0;
}
break;
case Bleeding:
if (!target.getGame().getRules().getBleedingRule().checkApplies(heroObj)) {
return 0;
}
break;
case Blight:
if (!target.getGame().getRules().getBlightRule().checkApplies(heroObj)) {
return 0;
}
break;
case Corrosion:
break;
case Despair:
break;
case Disease:
if (!target.getGame().getRules().getDiseaseRule().checkApplies(heroObj)) {
return 0;
}
break;
case Ensnared:
if (!target.getGame().getRules().getEnsnareRule().checkApplies(heroObj)) {
return 0;
}
break;
case Freeze:
if (!target.getGame().getRules().getFreezeRule().checkApplies(heroObj)) {
return 0;
}
break;
case Hatred:
break;
case Lust:
break;
case Madness:
break;
case Moist:
break;
case Poison:
if (!target.getGame().getRules().getPoisonRule().checkApplies(heroObj)) {
return 0;
}
break;
case Rage:
break;
case Soul:
break;
case Undying:
break;
default:
break;
}
}
return CounterMaster.getCounterPriority(counterName, target);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class RollMaster method checkRollType.
public static boolean checkRollType(ROLL_TYPES rollType, Ref ref) {
Unit unit = (Unit) ref.getTargetObj();
if (unit == null) {
return false;
}
boolean result = true;
switch(rollType) {
case MASS:
if (unit.checkPassive(UnitEnums.STANDARD_PASSIVES.IMMATERIAL)) {
result = false;
}
break;
case FAITH:
case MIND_AFFECTING:
if (!unit.isLiving()) {
result = false;
}
if (unit.checkPassive(UnitEnums.STANDARD_PASSIVES.MIND_AFFECTING_IMMUNE)) {
result = false;
}
break;
default:
break;
}
if (!result) {
result = !unit.checkProperty(G_PROPS.IMMUNITIES, rollType.getName());
}
if (!result) {
ref.getGame().getLogManager().logAlert(unit.getName() + " is immune to " + rollType.getName() + " !");
}
return result;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class UnlockMaster method promptUnlock.
public static boolean promptUnlock(PARAMETER param, Entity entity) {
int masteriesUnlocked = DC_MathManager.getMasteriesUnlocked(entity);
masteriesUnlocked -= DC_MathManager.getMasteryDiscount(entity);
// 25 75 150 250 400 500 [500]?
Unit hero = CharacterCreator.getHeroManager().getHero((ObjType) entity);
int xpCost = getXpCost(entity, masteriesUnlocked, hero);
int goldCost = getGoldCost(entity, masteriesUnlocked, hero);
if (!entity.checkParam(PARAMS.GOLD, goldCost + "") && !entity.checkParam(PARAMS.XP, xpCost + "")) {
DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_BLOCKED);
return false;
}
// gold/xp cost reduction?
final UnlockDialog view = new UnlockDialog(entity, param, xpCost, goldCost);
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
view.show();
}
});
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
// return result;
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class UnlockMaster method unlock.
public static void unlock(Entity entity, PARAMETER param, boolean gold) {
int masteriesUnlocked = DC_MathManager.getMasteriesUnlocked(entity);
masteriesUnlocked -= DC_MathManager.getMasteryDiscount(entity);
// 25 75 150 250 400 500 [500]?
Unit hero = CharacterCreator.getHeroManager().getHero((ObjType) entity);
int cost = gold ? getGoldCost(entity, masteriesUnlocked, hero) : getXpCost(entity, masteriesUnlocked, hero);
unlock(entity, param, gold, cost);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class AnimMaster method bindEvents.
public void bindEvents() {
DC_SoundMaster.bindEvents();
GuiEventManager.bind(GuiEventType.ADD_FLOATING_TEXT, p -> {
FloatingText floatingText = (FloatingText) p.get();
// if (!floatingText.isInitialized())
floatingText.init();
addActor(floatingText);
});
GuiEventManager.bind(GuiEventType.MOUSE_HOVER, p -> {
if (!isOn()) {
return;
}
if (!(p.get() instanceof Unit)) {
return;
}
if (showBuffAnimsOnHoverLength == null) {
return;
}
try {
mouseHover((Unit) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
GuiEventManager.bind(GuiEventType.ACTION_INTERRUPTED, p -> {
if (!isOn()) {
return;
}
leadAnimation.interrupt();
});
GuiEventManager.bind(GuiEventType.ACTION_BEING_RESOLVED, p -> {
// CompositeAnim animation = constructor.getOrCreate((DC_ActiveObj) portrait.get());
});
GuiEventManager.bind(GuiEventType.ACTION_RESOLVES, p -> {
if (!isOn()) {
return;
}
ActionInput input = (ActionInput) p.get();
try {
initActionAnimation(input.getAction(), (AnimContext) input.getContext());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
// GuiEventManager.bind(GuiEventType.UPDATE_BUFFS, p -> {
// updateContinuousAnims();
// });
// GuiEventManager.bind(GuiEventType.ABILITY_RESOLVES, p -> {
// if (!isOn()) {
// return;
// }
// Ability ability = (Ability) p.get();
// what about triggers?
// getParentAnim(ability.getRef().getActive()).addAbilityAnims(ability);
// });
GuiEventManager.bind(GuiEventType.INGAME_EVENT_TRIGGERED, p -> {
if (!isOn()) {
return;
}
try {
initEventAnimation((Event) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
GuiEventManager.bind(GuiEventType.EFFECT_APPLIED, p -> {
if (!isOn()) {
return;
}
try {
initEffectAnimation((Effect) p.get());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
});
}
Aggregations