Search in sources :

Example 6 with Perk

use of com.lilithsthrone.game.character.effects.Perk in project liliths-throne-public by Innoxia.

the class Response method getTooltipBlockingList.

public String getTooltipBlockingList() {
    SB = new StringBuilder();
    if (perksRequired != null) {
        for (Perk p : perksRequired) {
            if (Main.game.getPlayer().hasTrait(p, true)) {
                SB.append("</br>" + "<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b>" + " (<span style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</span>): " + Util.capitaliseSentence(p.getName(Main.game.getPlayer())));
            } else {
                SB.append("</br>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b>" + " (<span style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</span>): " + Util.capitaliseSentence(p.getName(Main.game.getPlayer())));
            }
        }
    }
    if (femininityRequired != null) {
        if (isFemininityInRange()) {
            SB.append("</br>" + "<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b>" + " (Femininity): " + "<span style='color:" + femininityRequired.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(femininityRequired.getName(false)) + "</span>");
        } else {
            SB.append("</br>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b>" + " (Femininity): " + "<span style='color:" + femininityRequired.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(femininityRequired.getName(false)) + "</span>");
        }
    }
    if (raceRequired != null) {
        if (isRequiredRace()) {
            SB.append("</br>" + "<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b>" + " (Race): " + "<span style='color:" + raceRequired.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(raceRequired.getName()) + "</span>");
        } else {
            SB.append("</br>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b>" + " (Race): " + "<span style='color:" + raceRequired.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(raceRequired.getName()) + "</span>");
        }
    }
    if (penetrationTypeAccessRequired != null && characterPenetrating != null) {
        boolean penetrationAccess = characterPenetrating.isPenetrationTypeExposed(penetrationTypeAccessRequired);
        boolean penetrationFree = penetrationTypeAccessRequired.isFree(characterPenetrating);
        String penetrationName = Util.capitaliseSentence(penetrationTypeAccessRequired.getName(characterPenetrating));
        String accessText = (penetrationAccess ? "access" : "<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>access</span>");
        String freeText = (penetrationFree ? "free" : "<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>free</span>");
        String targetName = (characterPenetrating.isPlayer() ? "Your" : UtilText.parse(characterPenetrating, "[npc.Name]'s"));
        if (getSexActionType() == SexActionType.PLAYER_REQUIRES_NO_PENETRATION_AND_EXPOSED || getSexActionType() == SexActionType.PARTNER_REQUIRES_NO_PENETRATION_AND_EXPOSED || getSexActionType() == SexActionType.PLAYER_PENETRATION || getSexActionType() == SexActionType.PARTNER_PENETRATION) {
            if (penetrationAccess && penetrationFree) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + accessText + " & " + freeText + "): " + targetName + " " + penetrationName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + accessText + " & " + freeText + "): " + targetName + " " + penetrationName);
            }
        } else if (getSexActionType() == SexActionType.PLAYER_REQUIRES_NO_PENETRATION || getSexActionType() == SexActionType.PARTNER_REQUIRES_NO_PENETRATION) {
            if (penetrationFree) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + freeText + "): " + targetName + " " + penetrationName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + freeText + "): " + targetName + " " + penetrationName);
            }
        } else {
            if (penetrationAccess) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + accessText + "): " + targetName + " " + penetrationName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + accessText + "): " + targetName + " " + penetrationName);
            }
        }
    }
    if (orificeTypeAccessRequired != null && characterPenetrated != null) {
        boolean orificeAccess = characterPenetrated.isOrificeTypeExposed(orificeTypeAccessRequired);
        boolean orificeFree = orificeTypeAccessRequired.isFree(characterPenetrated);
        String orificeName = Util.capitaliseSentence(orificeTypeAccessRequired.getName(characterPenetrated));
        String accessText = (orificeAccess ? "access" : "<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>access</span>");
        String freeText = (orificeFree ? "free" : "<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>free</span>");
        String targetName = (characterPenetrated.isPlayer() ? "Your" : UtilText.parse(characterPenetrated, "[npc.Name]'s"));
        if (getSexActionType() == SexActionType.PLAYER_REQUIRES_NO_PENETRATION_AND_EXPOSED || getSexActionType() == SexActionType.PARTNER_REQUIRES_NO_PENETRATION_AND_EXPOSED || getSexActionType() == SexActionType.PLAYER_PENETRATION || getSexActionType() == SexActionType.PARTNER_PENETRATION) {
            if (orificeAccess && orificeFree) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + accessText + " & " + freeText + "): " + targetName + " " + orificeName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + accessText + " & " + freeText + "): " + targetName + " " + orificeName);
            }
        } else if (getSexActionType() == SexActionType.PLAYER_REQUIRES_NO_PENETRATION || getSexActionType() == SexActionType.PARTNER_REQUIRES_NO_PENETRATION) {
            if (orificeFree) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + freeText + "): " + targetName + " " + orificeName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + freeText + "): " + targetName + " " + orificeName);
            }
        } else {
            if (orificeAccess) {
                SB.append("</br><b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Requirement</b> (" + accessText + "): " + targetName + " " + orificeName);
            } else {
                SB.append("</br><b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Requirement</b> (" + accessText + "): " + targetName + " " + orificeName);
            }
        }
    }
    return SB.toString();
}
Also used : Perk(com.lilithsthrone.game.character.effects.Perk)

Example 7 with Perk

use of com.lilithsthrone.game.character.effects.Perk 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);
            }
        }
    }
}
Also used : TooltipInformationEventListener(com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener) Attribute(com.lilithsthrone.game.character.attributes.Attribute) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) ArrayList(java.util.ArrayList) Perk(com.lilithsthrone.game.character.effects.Perk) Spell(com.lilithsthrone.game.combat.Spell) InventorySelectedItemEventListener(com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener) Response(com.lilithsthrone.game.dialogue.responses.Response) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) InventoryTooltipEventListener(com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener) GameCharacter(com.lilithsthrone.game.character.GameCharacter) SpecialAttack(com.lilithsthrone.game.combat.SpecialAttack) EventTarget(org.w3c.dom.events.EventTarget)

Aggregations

Perk (com.lilithsthrone.game.character.effects.Perk)7 Attribute (com.lilithsthrone.game.character.attributes.Attribute)4 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)4 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)4 ArrayList (java.util.ArrayList)4 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)3 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)3 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)3 GameCharacter (com.lilithsthrone.game.character.GameCharacter)3 SpecialAttack (com.lilithsthrone.game.combat.SpecialAttack)3 Spell (com.lilithsthrone.game.combat.Spell)3 InventorySlot (com.lilithsthrone.game.inventory.InventorySlot)3 EventTarget (org.w3c.dom.events.EventTarget)3 NPC (com.lilithsthrone.game.character.npc.NPC)2 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)2 AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)2 ClothingSet (com.lilithsthrone.game.inventory.clothing.ClothingSet)2 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)2 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)2 EnumSet (java.util.EnumSet)2