use of eidolons.entity.item.DC_QuickItemObj in project Eidolons by IDemiurge.
the class TossItemEffect method roll.
private boolean roll(Unit source, Unit unit, DC_HeroItemObj item) {
String fail = "5*1.5*sqrt" + StringMaster.wrapInParenthesis("" + (1 + PositionMaster.getDistance(unit, source)));
// account for range
if (item instanceof DC_QuickItemObj) {
DC_QuickItemObj quickItemObj = (DC_QuickItemObj) item;
}
Ref REF = ref.getCopy();
REF.setTarget(source.getId());
boolean result = RollMaster.roll(GenericEnums.ROLL_TYPES.ACCURACY, "-", fail, ref, "@, missing the " + item.getName() + " toss", item.getName() + " toss");
fail = "5";
if (!result) {
fail += "*2";
}
REF.setTarget(unit.getId());
result = !RollMaster.roll(GenericEnums.ROLL_TYPES.REFLEX, "-", fail, ref, "@, dropping the tossed " + item.getName(), item.getName() + " toss");
return result;
}
use of eidolons.entity.item.DC_QuickItemObj 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.item.DC_QuickItemObj in project Eidolons by IDemiurge.
the class ThrowEffect method applyThis.
@Override
public boolean applyThis() {
if (stormOfMissiles) {
fromHand = true;
DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
boolean result = throwWeapon(weapon);
weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
if (weapon != null) {
offhand = true;
result = throwWeapon(weapon);
}
Unit hero = (Unit) ref.getObj(KEYS.SOURCE);
fromHand = false;
for (DC_QuickItemObj q : hero.getQuickItems()) {
weapon = q.getWrappedWeapon();
if (weapon != null) {
result &= throwWeapon(weapon);
}
}
return result;
}
DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
try {
if (offhand || ref.getObj(KEYS.ACTIVE).checkProperty(G_PROPS.ACTION_TAGS, "" + ActionEnums.ACTION_TAGS.OFF_HAND)) {
weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
offhand = true;
}
// offhand mods?
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return throwWeapon(weapon);
}
use of eidolons.entity.item.DC_QuickItemObj in project Eidolons by IDemiurge.
the class UnitShop method equip.
private static void equip(Unit unit, DC_HeroItemObj item, ITEM_SLOT slot) {
if (slot != null) {
if (!unit.equip(item, slot)) {
LogMaster.log(1, unit.getName() + " failed to equip " + item.getName());
}
} else {
if (item instanceof DC_JewelryObj) {
unit.addJewelryItem((DC_JewelryObj) item);
} else {
if (item instanceof DC_QuickItemObj) {
unit.getQuickItems().add((DC_QuickItemObj) item);
} else {
DC_HeroItemObj itemObj = ItemFactory.createItemObj(item.getType(), unit.getOriginalOwner(), unit.getGame(), unit.getRef(), true);
unit.getQuickItems().add((DC_QuickItemObj) itemObj);
}
}
}
}
use of eidolons.entity.item.DC_QuickItemObj in project Eidolons by IDemiurge.
the class HungItemMaster method actionActivated.
@Override
protected boolean actionActivated(HUNG_ITEM_ACTION sub, Unit unit, DungeonObj obj) {
if (!(obj instanceof HungItem))
return false;
HungItem hungObj = ((HungItem) obj);
switch(sub) {
case TAKE:
DC_HeroItemObj item = hungObj.getItem();
if (item == null) {
item = generateItem(hungObj);
}
// quick slot?
if (!unit.isQuickSlotsFull() && item instanceof DC_QuickItemObj) {
unit.addQuickItem((DC_QuickItemObj) item);
} else {
unit.addItemToInventory(item);
}
GuiEventManager.trigger(GuiEventType.ITEM_TAKEN, hungObj);
// take animation
obj.kill(obj, false, true);
break;
case USE:
break;
}
return true;
}
Aggregations