use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.
the class DC_InventoryManager method execute.
private void execute(OPERATIONS operation, String typeName) {
DC_HeroItemObj item = getHero().findItem(typeName, getMode(operation));
execute(operation, item.getType());
}
use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.
the class DC_InventoryManager method execute.
private int execute(OPERATIONS operation, Entity type) {
boolean alt = false;
// if (operation == OPERATIONS.PICK_UP) {
// item = unit.getGame().getDroppedItemManager().findDroppedItem(typeName,
// unit.getCoordinates()); // TODO finish
// }
DC_HeroItemObj item = null;
item = (DC_HeroItemObj) type;
// getHero().
// findItem(type.getName(),
// getMode(operation));
boolean drop = false;
int cost = 0;
switch(operation) {
case EQUIP:
cost = CharacterCreator.getHeroManager().addSlotItem(getHero(), type, alt);
break;
case DROP:
drop = true;
case UNEQUIP:
cost = 1;
getHero().unequip(item, drop);
break;
case EQUIP_QUICK_SLOT:
// CharacterCreator.getHeroManager().addItem(unit, type,
// OBJ_TYPES.ITEMS, PROPS.QUICK_ITEMS, true);
cost = CharacterCreator.getHeroManager().addQuickItem(getHero(), type);
break;
case PICK_UP:
cost = 1;
game.getDroppedItemManager().pickUp(getHero(), type);
break;
case UNEQUIP_QUICK_SLOT:
cost = 1;
CharacterCreator.getHeroManager().removeQuickSlotItem(getHero(), type);
break;
}
return cost;
}
use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.
the class CreateItemEffect method applyThis.
@Override
public boolean applyThis() {
if (!groupInitialized) {
initGroup();
}
String typeName = ListChooser.chooseType(typeList, TYPE);
typeName = typeName.trim();
if (!DataManager.isTypeName(material.getName() + " " + typeName)) {
ItemGenerator.getDefaultGenerator().generateItem(ItemEnums.QUALITY_LEVEL.NORMAL, material, DataManager.getType(typeName, TYPE));
}
typeName = material.getName() + " " + typeName;
ObjType type = new ObjType(DataManager.getType(typeName, TYPE));
Integer durability = (type.getIntParam(PARAMS.DURABILITY) * durabilityFormula.getInt(ref)) / 100;
type.setParam(PARAMS.DURABILITY, durability);
DC_HeroItemObj item = ItemGenerator.getDefaultGenerator().createItem(type, ref, // init
false);
String itemName = prefix + item.getName();
item.setName(itemName);
// Entity hero = ref.getTargetObj();
// if (!game.getRequirementsManager().preCheck(hero, item))
// // if cannot use, add to inventory
// return new ManipulateInventoryEffect(INVENTORY_ACTIONS.ADD)
// .apply(ref);
EquipEffect equipEffect = new EquipEffect(item);
ref.setID((weapon) ? KEYS.WEAPON : KEYS.ARMOR, item.getId());
return equipEffect.apply(ref);
}
use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.
the class DurabilityReductionEffect method applyThis.
@Override
public boolean applyThis() {
Obj weapon = ref.getObj(KEYS.WEAPON);
Obj armorItem = ref.getTargetObj().getRef().getObj(KEYS.ARMOR);
int amount = (dmg_amount == null) ? ref.getAmount() : dmg_amount;
int armor = 0;
durabilityLost = 0;
if (armorItem != null) {
armor = armorItem.getIntParam(PARAMS.ARMOR);
}
if (attacker == null) {
// spell
DC_HeroItemObj item = (DC_HeroItemObj) ref.getTargetObj();
// mod = ref.getActive().getIntParam(param, base)
durabilityLost = item.reduceDurabilityForDamage(dmg_amount, armor, 100, simulation);
return true;
}
DC_HeroItemObj item = (DC_HeroItemObj) ((attacker) ? weapon : armorItem);
if (item == null) {
return false;
}
if (attacker) {
if (ref.getObj(KEYS.SPELL) != null) {
return false;
}
}
// ref.getObj(KEYS.TARGET).getIntParam(PARAMS.ARMOR);
int mod;
mod = ((attacker) ? weapon : armorItem).getIntParam(PARAMS.DURABILITY_DAMAGE_MOD);
int hardness = ((!attacker) ? weapon : armorItem).getIntParam(PARAMS.HARDNESS);
int hardness2 = ((attacker) ? weapon : armorItem).getIntParam(PARAMS.HARDNESS);
mod += hardness * 100 / hardness2;
if (mod > 0) {
durabilityLost = item.reduceDurabilityForDamage(amount, armor, mod, simulation);
}
return true;
}
use of eidolons.entity.item.DC_HeroItemObj in project Eidolons by IDemiurge.
the class TossItemEffect method applyThis.
/*
* size? from hand?
*
* interrupt?
*/
@Override
public boolean applyThis() {
Unit source = (Unit) ref.getSourceObj();
Ref REF = ref.getCopy();
conditions = new OrConditions(DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.MY_ITEM), DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON));
if (!new SelectiveTargeting(conditions).select(REF)) {
ref.getActive().setCancelled(true);
return false;
}
DC_HeroItemObj item = (DC_HeroItemObj) REF.getTargetObj();
conditions = new Conditions(// ++ Max distance?
new DistanceCondition(ref.getActive().getIntParam(PARAMS.RANGE, false) + ""), // new NumericCondition("{match_c_n_of_actions}", "1"),
new CanActCondition(KEYS.MATCH), new NotCondition(ConditionMaster.getSelfFilterCondition()), DC_ConditionMaster.getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES.ANY_ALLY));
// non-immobile, ++facing?
if (!new SelectiveTargeting(conditions).select(REF)) {
ref.getActive().setCancelled(true);
return false;
}
Unit unit = (Unit) REF.getTargetObj();
boolean result = roll(source, unit, item);
if (item instanceof DC_QuickItemObj) {
DC_QuickItemObj quickItem = (DC_QuickItemObj) item;
source.removeQuickItem(quickItem);
if (result) {
unit.addQuickItem(quickItem);
} else {
dropped(item, unit);
}
} else {
source.unequip(item, null);
if (result) {
// TODO equip in hand if
unit.addItemToInventory(item);
} else // possible? spend AP?
{
dropped(item, unit);
}
}
// ref.getObj(KEYS.ITEM);
unit.modifyParameter(PARAMS.C_N_OF_ACTIONS, -1);
return true;
}
Aggregations