use of eidolons.entity.active.DC_UnitAction in project Eidolons by IDemiurge.
the class DC_GameManager method previewMyAction.
public void previewMyAction(int index, ACTION_TYPE group) {
if (ExplorationMaster.isExplorationOn())
return;
DC_UnitAction action = getActiveObj().getActionMap().get(group).get(index);
GuiEventManager.trigger(GuiEventType.ACTION_HOVERED, action);
}
use of eidolons.entity.active.DC_UnitAction in project Eidolons by IDemiurge.
the class EnsnaredRule method checkCutAway.
private boolean checkCutAway(boolean offhand) {
int amount = 0;
DC_WeaponObj weapon = unit.getWeapon(offhand);
if (weapon == null) {
weapon = unit.getNaturalWeapon(offhand);
}
DC_UnitAction attack_action = unit.getAction(offhand ? "Offhand Attack" : "Attack");
if (// unit.getRef(),
!attack_action.canBeActivated(unit.getRef(), true)) // true
{
// TODO log " has no strength left to cut the bonds"
return false;
}
// }
if (weapon.getDamageType() != GenericEnums.DAMAGE_TYPE.BLUDGEONING) {
amount += unit.calculateDamage(offhand);
}
amount = MathMaster.applyMod(amount, unit.getIntParam(offhand ? PARAMS.OFF_HAND_ATTACK : PARAMS.ATTACK));
amount = MathMaster.applyMod(amount, CUT_AWAY_MOD);
amount = Math.min(getNumberOfCounters(unit), amount);
unit.modifyCounter(getCounterName(), -amount);
attack_action.payCosts();
// unit.modifyParameter(PARAMS.C_STAMINA, -sta_cost);
// unit.modifyParameter(PARAMS.C_N_OF_ACTIONS, -1);
String string = ((offhand) ? "...Then " : unit.getName()) + " cuts away " + ((offhand) ? " another " + amount : amount + " Ensnare counters") + " with " + weapon.getName();
if (getNumberOfCounters(unit) <= 0) {
string += " and breaks free!";
game.getLogManager().log(string);
return true;
} else {
game.getLogManager().log(string);
}
return false;
}
use of eidolons.entity.active.DC_UnitAction in project Eidolons by IDemiurge.
the class PanelActionsDataSource method getQuickSlotActions.
@Override
public List<ActionValueContainer> getQuickSlotActions() {
final DequeImpl<DC_QuickItemObj> items = unit.getQuickItems();
if (items == null)
return (List<ActionValueContainer>) ListMaster.fillWithNullElements(new ArrayList<ActionValueContainer>(), unit.getRemainingQuickSlots());
List<ActionValueContainer> list = items.stream().map((DC_QuickItemObj key) -> {
boolean valid = key.getActive().canBeManuallyActivated();
final ActionValueContainer valueContainer = new ActionValueContainer(valid, getOrCreateR(key.getImagePath()), key::invokeClicked);
ActionCostTooltip tooltip = new ActionCostTooltip(key.getActive());
tooltip.setUserObject(new ActionCostSourceImpl(key.getActive()));
valueContainer.addListener(tooltip.getController());
return valueContainer;
}).collect(Collectors.toList());
ObjType type = DataManager.getType(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()), DC_TYPE.ACTIONS);
TextureRegion invTexture = TextureCache.getOrCreateR(type.getImagePath());
DC_UnitAction action = unit.getAction(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()));
if (action == null)
return list;
boolean valid = action.canBeManuallyActivated();
ActionValueContainer invButton = new ActionValueContainer(valid, invTexture, () -> {
action.clicked();
});
list.add(invButton);
for (int i = 0; i < unit.getRemainingQuickSlots() - 1; i++) {
list.add(null);
}
return list;
}
use of eidolons.entity.active.DC_UnitAction in project Eidolons by IDemiurge.
the class PayCostEffect method applyThis.
@Override
public boolean applyThis() {
Unit hero = (Unit) ref.getTargetObj();
DC_UnitAction action = hero.getAction(actionName);
if (action == null) {
return false;
}
if (!force) {
// preCheck
}
action.payCosts();
return true;
}
use of eidolons.entity.active.DC_UnitAction in project Eidolons by IDemiurge.
the class InstantAttackRule method getInstantAttacks.
// could be a spell?..
public static List<DC_ActiveObj> getInstantAttacks(Unit unit) {
List<DC_ActiveObj> list = new ArrayList<>();
List<DC_UnitAction> attacks = new ArrayList<>(unit.getActionMap().get(ActionEnums.ACTION_TYPE.STANDARD_ATTACK));
if (unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK) != null) {
attacks.addAll(unit.getActionMap().get(ActionEnums.ACTION_TYPE.SPECIAL_ATTACK));
}
for (DC_UnitAction attack : attacks) {
if (checkAttackCanBeInstant(attack)) // if (attack
// .checkProperty(G_PROPS.ACTION_TAGS,
// ACTION_TAGS.INSTANT_ATTACK.toString()))
{
list.add(attack);
}
}
return list;
}
Aggregations