use of com.lilithsthrone.game.character.attributes.Attribute in project liliths-throne-public by Innoxia.
the class GameCharacter method applyUnequipClothingEffects.
private void applyUnequipClothingEffects(AbstractClothing clothing) {
incrementBonusAttribute(Attribute.RESISTANCE_PHYSICAL, -clothing.getClothingType().getPhysicalResistance());
for (Entry<Attribute, Integer> e : clothing.getAttributeModifiers().entrySet()) {
incrementBonusAttribute(e.getKey(), -e.getValue());
}
for (ItemEffect ie : clothing.getEffects()) {
if (ie.getSecondaryModifier() != null && ie.getSecondaryModifier().getFetish() != null) {
Fetish associatedFetish = ie.getSecondaryModifier().getFetish();
switch(ie.getPotency()) {
case MINOR_BOOST:
clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) - 1);
break;
case BOOST:
clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) - 2);
break;
case MAJOR_BOOST:
fetishesFromClothing.remove(associatedFetish);
applyFetishLossEffects(associatedFetish);
break;
case MINOR_DRAIN:
clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 1);
break;
case DRAIN:
clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 2);
break;
case MAJOR_DRAIN:
clothingFetishDesireModifiersMap.putIfAbsent(associatedFetish, 0);
clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 999);
break;
}
}
}
}
use of com.lilithsthrone.game.character.attributes.Attribute in project liliths-throne-public by Innoxia.
the class AbstractClothing method getDescription.
@Override
public String getDescription() {
descriptionSB.setLength(0);
descriptionSB.append("<p>" + getTypeDescription() + "</p>");
// Physical resistance
descriptionSB.append("<p>" + (getClothingType().isPlural() ? "They" : "It") + " provide" + (getClothingType().isPlural() ? "" : "s") + " <b>" + getClothingType().getPhysicalResistance() + "</b> <b style='color: " + Attribute.RESISTANCE_PHYSICAL.getColour().toWebHexString() + ";'> " + Attribute.RESISTANCE_PHYSICAL.getName() + "</b>.</p>");
if (enchantmentKnown) {
descriptionSB.append("<p>Effects:");
if (!this.getEffects().isEmpty()) {
for (ItemEffect e : this.getEffects()) {
if (e.getPrimaryModifier() != TFModifier.CLOTHING_ATTRIBUTE) {
for (String s : e.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer())) {
descriptionSB.append("</br>" + s);
}
}
}
for (Entry<Attribute, Integer> entry : this.getAttributeModifiers().entrySet()) {
descriptionSB.append("</br>" + (entry.getValue() < 0 ? "[style.boldBad(" + entry.getValue() + ")] " : "[style.boldGood(+" + entry.getValue() + ")] ") + "<b style='color:" + entry.getKey().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(entry.getKey().getName()) + "</b>");
}
} else {
descriptionSB.append("[style.boldDisabled(None)]");
}
descriptionSB.append("</p>");
descriptionSB.append("<p>" + (getClothingType().isPlural() ? "They" : "It") + " " + (getClothingType().isPlural() ? "have" : "has") + " a value of " + UtilText.formatAsMoney(getValue()) + ".");
} else {
descriptionSB.append("</br>" + (getClothingType().isPlural() ? "They" : "It") + " " + (getClothingType().isPlural() ? "have" : "has") + " an <b>unknown value</b>!");
}
descriptionSB.append("</p>");
if (getClothingType().getClothingSet() != null)
descriptionSB.append("<p>" + (getClothingType().isPlural() ? "They" : "It") + " " + (getClothingType().isPlural() ? "are" : "is") + " part of the <b style='color:" + Colour.RARITY_EPIC.toWebHexString() + ";'>" + getClothingType().getClothingSet().getName() + "</b> set." + "</p>");
return descriptionSB.toString();
}
use of com.lilithsthrone.game.character.attributes.Attribute in project liliths-throne-public by Innoxia.
the class AbstractWeapon method saveAsXML.
public Element saveAsXML(Element parentElement, Document doc) {
Element element = doc.createElement("weapon");
parentElement.appendChild(element);
CharacterUtils.addAttribute(doc, element, "id", this.getWeaponType().getId());
CharacterUtils.addAttribute(doc, element, "damageType", this.getDamageType().toString());
CharacterUtils.addAttribute(doc, element, "coreEnchantment", (this.getCoreEnchantment() == null ? "null" : this.getCoreEnchantment().toString()));
Element attributeElement = doc.createElement("attributeModifiers");
element.appendChild(attributeElement);
for (Entry<Attribute, Integer> entry : this.getAttributeModifiers().entrySet()) {
Element modifier = doc.createElement("modifier");
attributeElement.appendChild(modifier);
CharacterUtils.addAttribute(doc, modifier, "attribute", entry.getKey().toString());
CharacterUtils.addAttribute(doc, modifier, "value", String.valueOf(entry.getValue()));
}
Element innerElement = doc.createElement("spells");
element.appendChild(innerElement);
for (Spell s : this.getSpells()) {
Element spell = doc.createElement("spell");
innerElement.appendChild(spell);
CharacterUtils.addAttribute(doc, spell, "value", s.toString());
}
return element;
}
use of com.lilithsthrone.game.character.attributes.Attribute in project liliths-throne-public by Innoxia.
the class MainController method manageAttributeListeners.
private void manageAttributeListeners() {
documentAttributes = (Document) webEngineAttributes.executeScript("document");
EventListenerDataMap.put(documentAttributes, new ArrayList<>());
// Map:
if (((EventTarget) documentAttributes.getElementById("upButton")) != null) {
addEventListener(documentAttributes, "upButton", "click", moveNorthListener, true);
}
if (((EventTarget) documentAttributes.getElementById("downButton")) != null) {
addEventListener(documentAttributes, "downButton", "click", moveSouthListener, true);
}
if (((EventTarget) documentAttributes.getElementById("leftButton")) != null) {
addEventListener(documentAttributes, "leftButton", "click", moveWestListener, true);
}
if (((EventTarget) documentAttributes.getElementById("rightButton")) != null) {
addEventListener(documentAttributes, "rightButton", "click", moveEastListener, true);
}
// Inventory:
// For all equipped clothing slots:
String id;
for (InventorySlot invSlot : InventorySlot.values()) {
id = invSlot.toString() + "Slot";
if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(Main.game.getPlayer(), invSlot);
addEventListener(documentAttributes, id, "click", el, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
} else {
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(Main.game.getPlayer(), invSlot);
addEventListener(documentAttributes, id, "click", el, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
}
}
id = "DATE_DISPLAY_TOGGLE";
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
Main.getProperties().calendarDisplay = !Main.getProperties().calendarDisplay;
Main.saveProperties();
this.updateUI();
}, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Calendar Display", "Toggle the date's display between a calendar and day count.");
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
id = "TWENTY_FOUR_HOUR_TIME_TOGGLE";
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
Main.getProperties().twentyFourHourTime = !Main.getProperties().twentyFourHourTime;
Main.saveProperties();
this.updateUI();
}, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Time Display", "Toggle the display of time between a 24 and 12-hour clock.");
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
if (((EventTarget) documentAttributes.getElementById("ESSENCE_" + TFEssence.ARCANE.hashCode())) != null) {
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setEssence(TFEssence.ARCANE);
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseenter", el2, false);
}
Attribute[] attributes = { Attribute.HEALTH_MAXIMUM, Attribute.MANA_MAXIMUM, Attribute.EXPERIENCE, Attribute.MAJOR_PHYSIQUE, Attribute.MAJOR_ARCANE, Attribute.MAJOR_CORRUPTION, Attribute.AROUSAL, Attribute.LUST };
List<GameCharacter> charactersBeingRendered = new ArrayList<>();
if (Main.game.isInSex()) {
charactersBeingRendered.addAll(Sex.getDominantParticipants().keySet());
charactersBeingRendered.addAll(Sex.getSubmissiveParticipants().keySet());
} else if (Main.game.isInCombat()) {
charactersBeingRendered.add(Main.game.getPlayer());
charactersBeingRendered.addAll(Combat.getAllies());
} else {
if (Main.game.getPlayer() != null) {
charactersBeingRendered.add(Main.game.getPlayer());
}
}
for (GameCharacter character : charactersBeingRendered) {
String idModifier = (character.isPlayer() ? "PLAYER_" : "NPC_" + character.getId() + "_");
for (Attribute a : attributes) {
if (((EventTarget) documentAttributes.getElementById(idModifier + a.getName())) != null) {
if (a == Attribute.EXPERIENCE) {
((EventTarget) documentAttributes.getElementById(idModifier + a.getName())).addEventListener("click", e -> {
if (character.isPlayer()) {
// block when in character creation
if (Main.game.isInNewWorld()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_APPEARANCE) {
openPhone();
} else {
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
}
} else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
}
}
} else {
openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
}
}, false);
}
addEventListener(documentAttributes, idModifier + a.getName(), "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, idModifier + a.getName(), "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setAttribute(a, character);
addEventListener(documentAttributes, idModifier + a.getName(), "mouseenter", el, false);
}
}
if (((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")) != null) {
((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")).addEventListener("click", e -> {
if (character.isPlayer()) {
// block when in character creation
if (Main.game.isInNewWorld()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_LEVEL_UP) {
openPhone();
} else {
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
}
} else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
}
}
} else {
// TODO display NPC perk tree
openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
}
}, false);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setExtraAttributes(character);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseenter", el, false);
}
// For status effect slots:
for (StatusEffect se : character.getStatusEffects()) {
if (((EventTarget) documentAttributes.getElementById("SE_" + idModifier + se)) != null) {
addEventListener(documentAttributes, "SE_" + idModifier + se, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setStatusEffect(se, character);
addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseenter", el, false);
}
}
for (Perk trait : character.getTraits()) {
id = "TRAIT_" + idModifier + trait;
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setPerk(trait, character);
addEventListener(documentAttributes, id, "mouseenter", el, false);
}
}
for (Fetish f : character.getFetishes()) {
if (((EventTarget) documentAttributes.getElementById("FETISH_" + idModifier + f)) != null) {
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setFetish(f, character);
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseenter", el, false);
}
}
for (SpecialAttack sa : character.getSpecialAttacks()) {
if (((EventTarget) documentAttributes.getElementById("SA_" + idModifier + sa)) != null) {
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setSpecialAttack(sa, character);
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mouseenter", el, false);
}
}
for (Spell s : character.getAllSpells()) {
if (((EventTarget) documentAttributes.getElementById("SPELL_" + idModifier + s)) != null) {
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setSpell(s, character.getLevel(), character);
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseenter", el, false);
}
}
}
}
use of com.lilithsthrone.game.character.attributes.Attribute in project liliths-throne-public by Innoxia.
the class InventoryTooltipEventListener method weaponTooltip.
private void weaponTooltip(AbstractWeapon absWep) {
int yIncrease = 0;
int listIncrease = absWep.getAttributeModifiers().size();
listIncrease += absWep.getSpells().size();
yIncrease += Math.max(0, listIncrease - 3);
// Title:
tooltipSB.setLength(0);
tooltipSB.append("<body>" + "<div class='container-full-width center'><h5>" + Util.capitaliseSentence(absWep.getDisplayName(true)) + "</h5></div>");
// Core info:
tooltipSB.append("<div class='container-half-width titular' style='color:" + absWep.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(absWep.getDamageType().getName()) + " damage</div>");
tooltipSB.append("<div class='container-half-width titular'>" + (absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? "Primary Slot" : "Secondary Slot") + "</div>");
// Attribute modifiers:
tooltipSB.append("<div class='container-full-width'>" + "<div class='container-half-width titular' style='width:calc(66.6% - 16px);'>");
if (equippedToCharacter != null) {
tooltipSB.append("<b>" + Attack.getMinimumDamage(owner, null, absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? Attack.MAIN : Attack.OFFHAND, absWep) + " - " + Attack.getMaximumDamage(owner, null, absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? Attack.MAIN : Attack.OFFHAND, absWep) + "</b>" + " <b style='color:" + absWep.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>Damage</b>");
} else {
tooltipSB.append("<b>" + Attack.getMinimumDamage(Main.game.getPlayer(), null, absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? Attack.MAIN : Attack.OFFHAND, absWep) + " - " + Attack.getMaximumDamage(Main.game.getPlayer(), null, absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? Attack.MAIN : Attack.OFFHAND, absWep) + "</b>" + " <b style='color:" + absWep.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>Damage</b>");
}
// Spell school:
tooltipSB.append("</br>" + "<b>" + (absWep.getWeaponType().getSlot() == InventorySlot.WEAPON_MAIN ? "Offensive" : "Defensive") + "</b>" + " <b style='color:" + absWep.getSpellSchool().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(absWep.getSpellSchool().getName()) + "</b>" + " <b>spells</b>");
// }
for (Entry<Attribute, Integer> entry : absWep.getAttributeModifiers().entrySet()) {
tooltipSB.append("</br>" + (entry.getValue() < 0 ? "[style.boldBad(" + entry.getValue() + ")] " : "[style.boldGood(+" + entry.getValue() + ")] ") + "<b style='color:" + entry.getKey().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(entry.getKey().getName()) + "</b>");
}
for (Spell s : absWep.getSpells()) {
tooltipSB.append("</br><b style='color:" + Colour.DAMAGE_TYPE_SPELL.toWebHexString() + ";'>Grants Spell</b><b>:</b> <b style='color:" + s.getSpellSchool().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(s.getName()) + "</b>");
}
tooltipSB.append("</div>");
// Picture:
tooltipSB.append("<div class='container-half-width' style='width:calc(33.3% - 16px);'>" + absWep.getSVGString() + "</div>");
tooltipSB.append("</div>");
tooltipSB.append("<div class='container-full-width' style='padding:8px; height:106px;'>" + absWep.getWeaponType().getDescription() + "</div>");
if (InventoryDialogue.getInventoryNPC() != null && InventoryDialogue.getNPCInventoryInteraction() == InventoryInteraction.TRADING) {
if (owner.isPlayer()) {
if (InventoryDialogue.getInventoryNPC().willBuy(absWep)) {
tooltipSB.append("<div class='container-full-width titular'>" + "Value: " + UtilText.formatAsMoney(absWep.getValue()) + " | " + InventoryDialogue.getInventoryNPC().getName("The") + " offers: " + UtilText.formatAsMoney(absWep.getPrice(InventoryDialogue.getInventoryNPC().getBuyModifier())) + "</div>");
} else {
tooltipSB.append("<div class='container-full-width titular'>" + "Value: " + UtilText.formatAsMoney(absWep.getValue()) + " | " + "<span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>" + InventoryDialogue.getInventoryNPC().getName("The") + " will not buy this</span>" + "</div>");
}
} else {
if (InventoryDialogue.isBuyback()) {
tooltipSB.append("<div class='container-full-width titular'>" + "Value: " + UtilText.formatAsMoney(absWep.getValue()) + " | " + InventoryDialogue.getInventoryNPC().getName("The") + " wants " + UtilText.formatAsMoney(+getBuybackPriceFor(absWep)) + "</div>");
} else {
tooltipSB.append("<div class='container-full-width titular'>" + "Value: " + UtilText.formatAsMoney(absWep.getValue()) + " | " + InventoryDialogue.getInventoryNPC().getName("The") + " wants " + UtilText.formatAsMoney(absWep.getPrice(InventoryDialogue.getInventoryNPC().getSellModifier())) + "</div>");
}
}
} else {
tooltipSB.append("<div class='container-full-width titular'>" + "Value: " + UtilText.formatAsMoney(absWep.getValue()) + "</div>");
}
tooltipSB.append("</body>");
Main.mainController.setTooltipSize(360, 356 + (yIncrease * LINE_HEIGHT_TITULAR));
Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
}
Aggregations