use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class PartyInfoPanel method init.
public void init(MacroParty party) {
clearChildren();
clearListeners();
this.party = party;
TablePanel main = new TablePanel();
this.columnDefaults(0).width(getMainWidth());
this.columnDefaults(0).minWidth(getMainWidth());
for (Unit sub : party.getMembers()) {
PartyMemberComponent component = new PartyMemberComponent(sub);
main.add(component).maxWidth(getMainWidth());
main.row();
}
setSize((getMainWidth()), 128 * party.getMembers().size());
// ;
add(main);
setX(0);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class FearsomeEffect method applyThis.
@Override
public boolean applyThis() {
super.applyThis();
Formula buffer = new Formula(formula.toString());
formula = formula.getAppendedByFactor(-0.5);
try {
for (Unit unit : ((DC_Game) game).getUnits()) {
if (!friendlyFire) {
if (unit.getOwner().equals(ref.getSourceObj().getOwner())) {
continue;
}
}
if (!unit.checkInSightForUnit((Unit) ref.getSourceObj())) {
continue;
}
ref.setTarget(unit.getId());
super.applyThis();
}
} catch (Exception ignored) {
} finally {
formula = buffer;
}
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class CampEffect method applyThis.
@Override
public boolean applyThis() {
/*
restore fully, dispel all timed buffs, apply bonus
*/
List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
if (allies.isEmpty())
getGame().getMetaMaster().getPartyManager().getParty().addMember(getGame().getMetaMaster().getPartyManager().getParty().getLeader());
// mystery fix
for (Unit sub : new LinkedList<>(allies)) {
DC_HeroItemObj item = sub.getItemFromInventory("Food");
if (item != null) {
sub.removeFromInventory(item);
continue;
}
DC_QuickItemObj qitem = sub.getQuickItem("Food");
if (item != null) {
sub.removeQuickItem(qitem);
continue;
}
allies.remove(sub);
continue;
// remove
}
if (allies.isEmpty()) {
FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "You need food supplies to camp!", ref.getSourceObj());
return false;
}
Effects restorationEffects = new Effects();
restorationEffects.add(new ModifyValueEffect(PARAMS.C_ENDURANCE, MOD.SET_TO_PERCENTAGE, "125", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.SET_TO_PERCENTAGE, "70", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_ESSENCE, MOD.SET_TO_PERCENTAGE, "100", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_STAMINA, MOD.SET_TO_PERCENTAGE, "125", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_TOUGHNESS, MOD.SET_TO_PERCENTAGE, "100", true));
for (Unit sub : allies) {
Ref REF = sub.getRef().getTargetingRef(sub);
restorationEffects.apply(REF);
}
float time = 20;
getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
// applyRested();
for (Unit sub : allies) {
}
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class RestEffect method applyThis.
@Override
public boolean applyThis() {
// whole party!
/*
add regen and wait()
interrupt?
remove buff?
or rely on reset() ?
block actions
add shader
*/
List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
for (Unit sub : allies) {
Ref REF = sub.getRef().getTargetingRef(sub);
new ModeEffect(STD_MODES.SLEEPING).apply(REF);
}
float time = 120;
// (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.WAIT_COMPLETE);
Boolean result = getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
if (result) {
// applyRested();
for (Unit sub : allies) {
sub.removeBuff("Sleeping");
Ref REF = sub.getRef().getTargetingRef(sub);
getRestedBuffEffect().apply(REF);
new ModifyValueEffect(PARAMS.C_MORALE, MOD.MODIFY_BY_PERCENT, "15").apply(REF);
}
}
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ThrowEffect method throwWeapon.
private boolean throwWeapon(DC_WeaponObj weapon) {
ref.setID(KEYS.WEAPON, weapon.getId());
ref.setValue(KEYS.DAMAGE_TYPE, weapon.getDamageType().getName());
setWeapon(weapon);
setOffhand(offhand);
boolean result = super.applyThis();
if (fromHand) {
Unit hero = (Unit) ref.getSourceObj();
if (offhand) {
hero.setSecondWeapon(null);
} else {
hero.setWeapon(null);
if (hero.getOffhandWeapon() != null) {
if (!hero.getOffhandWeapon().isRanged()) {
if (hero.getOffhandWeapon().isWeapon()) {
hero.setWeapon(hero.getOffhandWeapon());
hero.setSecondWeapon(null);
}
}
}
}
}
weapon.getGame().getDroppedItemManager().itemFalls(ref.getTargetObj().getCoordinates(), weapon);
getActiveObj().getRef().setID(offhand ? KEYS.OFFHAND : KEYS.WEAPON, null);
return result;
}
Aggregations