use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class DC_MovementManager method getMoves.
public static List<DC_ActiveObj> getMoves(Unit unit) {
List<DC_ActiveObj> moveActions = new ArrayList<>();
DequeImpl<DC_UnitAction> actions = unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_MOVE);
if (actions != null) {
moveActions = new ArrayList<>(Arrays.asList(actions.toArray(new DC_ActiveObj[actions.size()])));
}
if (moveActions.isEmpty()) {
moveActions.addAll(unit.getActionMap().get(ActionEnums.ACTION_TYPE.ADDITIONAL_MOVE));
} else {
for (DC_UnitAction a : unit.getActionMap().get(ActionEnums.ACTION_TYPE.ADDITIONAL_MOVE)) {
String name = a.getName();
switch(// have a switch to turn off all default moves!
name) {
case "Clumsy Leap":
if (!DataManager.toStringList(moveActions).contains("Leap")) {
moveActions.add(a);
}
continue;
case "Move Right":
case "Move Left":
if (!DataManager.toStringList(moveActions).contains("Sidestep Right")) {
moveActions.add(a);
}
continue;
}
moveActions.add(a);
}
}
moveActions.addAll(AiUnitActionMaster.getSpells(AiEnums.AI_LOGIC.MOVE, unit));
moveActions = DC_ActionManager.filterActionsByCanBePaid(moveActions);
return moveActions;
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class TargetingMaster method selectTargetForAction.
public static Integer selectTargetForAction(DC_ActiveObj a) {
/*
* getOrCreate possible targets init goal type prioritize
*/
GOAL_TYPE type = GoalManager.getGoalFromAction(a);
Obj target = null;
int max_priority = Integer.MIN_VALUE;
Set<Obj> objects = null;
a.getTargeting().getFilter().setRef(a.getRef());
try {
objects = a.getTargeting().getFilter().getObjects();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
for (Obj obj : objects) {
ActionSequence sequence = new ActionSequence(type, new Action(a, obj));
sequence.setAi(a.getOwnerObj().getUnitAI());
sequence.setType(type);
int priority = DC_PriorityManager.getPriority(sequence);
if (priority > max_priority) {
target = obj;
max_priority = priority;
}
}
if (target == null) {
return null;
}
return target.getId();
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class DC_GameManager method select.
@Override
public Integer select(Set<Obj> selectingSet, Ref ref) {
Pair<Set<Obj>, TargetRunnable> p = new ImmutablePair<>(selectingSet, (t) -> {
if (ref.getActive() instanceof DC_ActiveObj) {
// TODO CLICK ON ANY OTHER OBJ MUST RESULT IN SELECTION STOP!
// ((DC_ActiveObj) ref.getActive()).activateOn(t);
// WaitMaster.receiveInput(WAIT_OPERATIONS.SELECT_BF_OBJ, t.getId());
t.invokeClicked();
}
});
GuiEventManager.trigger(SELECT_MULTI_OBJECTS, p);
for (Obj obj : new ArrayList<>(selectingSet)) {
if (obj instanceof DC_Obj) {
DC_Obj unit = (DC_Obj) obj;
if (getActiveObj() != null) {
if (getActiveObj().getZ() != unit.getZ()) {
selectingSet.remove(unit);
}
}
}
}
this.selectingSet = selectingSet;
if (selectingSet.isEmpty()) {
// getGame().getToolTipMaster().addTooltip(SCREEN_POSITION.ACTIVE_UNIT_BOTTOM,
// "No targets available!");
DC_SoundMaster.playStandardSound(STD_SOUNDS.ACTION_CANCELLED);
return null;
}
setSelecting(true);
for (Obj obj : selectingSet) {
DrawMasterStatic.getObjImageCache().remove(obj);
}
Integer id = selectAwait();
if (id == null) {
if (ref.getTarget() != null) {
return ref.getTarget();
}
}
return id;
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class AttackDamageTest method testDamageCalc.
@Test
public void testDamageCalc() {
DC_ActiveObj action = entity.getAttack().getSubActions().get(0);
// setAveraged(true);
action.activateOn(entity2);
Attack attack = DC_AttackMaster.getAttackFromAction(action);
int precalc = DamageCalculator.precalculateDamage(attack);
// DamageFactory.getDamageFromAttack(attack);
printingAsserts.assertEqualAndLog(action.getDamageDealt().getAmount(), precalc, action + " dmg precalc", action + " Damage Dealt");
}
use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.
the class ModeEffect method addEndTurnEffect.
private void addEndTurnEffect() {
Condition condition = new StringComparison(prop, mode.toString(), true);
if (mode == STD_MODES.DIVINATION) {
Effect effect = new DivinationEffect();
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
return;
}
String formula = mode.getFormula();
if (ref.getActive() instanceof DC_ActiveObj) {
DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
} else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
}
}
ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
PARAMETER param = ContentManager.getPARAM(mode.getParameter());
effect.setParam(param);
effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
effect.setFormula(appendedByModifier);
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
Aggregations