Search in sources :

Example 1 with ResponseSex

use of com.lilithsthrone.game.dialogue.responses.ResponseSex in project liliths-throne-public by Innoxia.

the class Game method setContent.

public void setContent(int index) {
    Response response = currentDialogueNode.getResponse(responseTab, index);
    if (response != null) {
        String corruptionGains = "";
        if (!response.isAvailable()) {
            if (!response.isAbleToBypass()) {
                return;
            } else {
                Main.game.getPlayer().incrementAttribute(Attribute.MAJOR_CORRUPTION, response.getCorruptionNeeded().getCorruptionBypass());
                corruptionGains = ("<p style='text-align:center;'>" + "<b>You have gained +" + response.getCorruptionNeeded().getCorruptionBypass() + "</b> <b style='color:" + Attribute.MAJOR_CORRUPTION.getColour().toWebHexString() + ";'>corruption</b><b>!</b>" + "</p>");
            }
        }
        String chosenResponse = response.getTitle();
        DialogueNodeOld node = response.getNextDialogue();
        response.applyEffects();
        if (response instanceof ResponseCombat) {
            setContent(new Response("", "", ((ResponseCombat) response).initCombat()));
            return;
        } else if (response instanceof ResponseSex) {
            setContent(new Response("", "", ((ResponseSex) response).initSex()));
            return;
        } else if (response instanceof ResponseEffectsOnly) {
            return;
        } else if (response instanceof ResponseTrade) {
            ((ResponseTrade) response).openTrade();
            return;
        }
        if (node != null) {
            // Add characters in this scene to the player's encountered characters list:
            if (started) {
                if (!getCharactersPresent().isEmpty()) {
                    for (GameCharacter character : getCharactersPresent()) {
                        if (!Main.game.getPlayer().getCharactersEncountered().contains(character.getId())) {
                            if (character instanceof NPC) {
                                if (((NPC) character).isAddedToContacts()) {
                                    Main.game.getPlayer().addCharacterEncountered(character);
                                }
                                if (!character.isRaceConcealed()) {
                                    Main.getProperties().addRaceDiscovered(character.getRace());
                                }
                                ((NPC) character).setLastTimeEncountered(minutesPassed);
                            }
                        }
                    }
                }
            }
            String headerContent = node.getHeaderContent();
            String content = node.getContent();
            if (currentDialogueNode != null) {
                if (node.isContinuesDialogue()) {
                    if (!node.isNoTextForContinuesDialogue()) {
                        if (Main.game.isInSex()) {
                            dialogueTitle = UtilText.parse(node.getLabel());
                        }
                        if (node.isDisplaysActionTitleOnContinuesDialogue()) {
                            if (currentDialogueNode.getMapDisplay() == MapDisplay.NORMAL) {
                                positionAnchor++;
                            }
                            pastDialogueSB.append("<hr id='position" + positionAnchor + "'><p class='option-disabled'>&gt " + chosenResponse + "</p>");
                        }
                        if (getMapDisplay() == MapDisplay.NORMAL)
                            initialPositionAnchor = positionAnchor;
                        pastDialogueSB.append(UtilText.parse(corruptionGains + textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
                    }
                } else {
                    dialogueTitle = UtilText.parse(node.getLabel());
                    if (getMapDisplay() == MapDisplay.NORMAL)
                        initialPositionAnchor = positionAnchor;
                    if (currentDialogueNode.getMapDisplay() == MapDisplay.NORMAL)
                        positionAnchor = 0;
                    pastDialogueSB.setLength(0);
                    pastDialogueSB.append(UtilText.parse(corruptionGains + textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
                }
            } else {
                dialogueTitle = UtilText.parse(node.getLabel());
            }
            // currentDialogueNode.applyResponse(index, true);
            // updateUIAttributes();
            boolean resetPointer = true;
            if (node != currentDialogueNode) {
                responsePage = 0;
                currentDialogueNode = node;
            } else {
                currentDialogueNode = node;
                checkForResponsePage();
                resetPointer = false;
            }
            if (node.isContinuesDialogue()) {
                currentDialogue = "<body onLoad='scrollToElement()'>" + "<script>function scrollToElement() {document.getElementById('content-block').scrollTop = document.getElementById('position" + (positionAnchor) + "').offsetTop -64;}</script>" + "<div id='main-content'>" + getTitleDiv(dialogueTitle) + "<div class='div-center' id='content-block'>" + // + "<div class='inner-text-content'>"
                getMapDiv() + (headerContent != null ? "<div id='header-content' style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;-webkit-user-select: none;'>" + (currentDialogueNode.disableHeaderParsing() ? headerContent : UtilText.parse(headerContent)) + "</div>" : "") + (content != null ? "<div " + (Main.getProperties().fadeInText ? "id='text-content'" : "") + " style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;'>" + pastDialogueSB.toString() + "</div>" : "") + // + "</div>"
                "</div>" + "<div id='bottom-text'>Game saved!</div>" + getResponsesDiv(currentDialogueNode, resetPointer) + "</div>" + "</body>";
            } else {
                currentDialogue = "<body>" + "<div id='main-content'>" + getTitleDiv(dialogueTitle) + "<span id='position" + positionAnchor + "'></span>" + "<div class='div-center' id='content-block'>" + // + "<div class='inner-text-content'>"
                getMapDiv() + (headerContent != null ? "<div id='header-content' style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;-webkit-user-select: none;'>" + (currentDialogueNode.disableHeaderParsing() ? headerContent : UtilText.parse(headerContent)) + "</div>" : "") + (content != null ? "<div " + (Main.getProperties().fadeInText ? "id='text-content'" : "") + " style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;'>" + pastDialogueSB.toString() + "</div>" : "") + // + "</div>"
                "</div>" + "<div id='bottom-text'>Game saved!</div>" + getResponsesDiv(currentDialogueNode, resetPointer) + "</div>" + "</body>";
            }
            // Main.mainController.unbindListeners();
            Main.mainController.setMainContent(currentDialogue);
            textEndStringBuilder.setLength(0);
            textStartStringBuilder.setLength(0);
            if (started) {
                Main.game.endTurn(getCurrentDialogueNode().getMinutesPassed());
            }
            TooltipUpdateThread.cancelThreads = true;
        // Main.mainController.processNewDialogue();
        }
    }
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response) TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) GenericFemaleNPC(com.lilithsthrone.game.character.npc.GenericFemaleNPC) GenericAndrogynousNPC(com.lilithsthrone.game.character.npc.GenericAndrogynousNPC) GenericMaleNPC(com.lilithsthrone.game.character.npc.GenericMaleNPC) ResponseCombat(com.lilithsthrone.game.dialogue.responses.ResponseCombat) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) ResponseEffectsOnly(com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly) ResponseTrade(com.lilithsthrone.game.dialogue.responses.ResponseTrade) GameCharacter(com.lilithsthrone.game.character.GameCharacter) ResponseSex(com.lilithsthrone.game.dialogue.responses.ResponseSex)

Aggregations

GameCharacter (com.lilithsthrone.game.character.GameCharacter)1 GenericAndrogynousNPC (com.lilithsthrone.game.character.npc.GenericAndrogynousNPC)1 GenericFemaleNPC (com.lilithsthrone.game.character.npc.GenericFemaleNPC)1 GenericMaleNPC (com.lilithsthrone.game.character.npc.GenericMaleNPC)1 NPC (com.lilithsthrone.game.character.npc.NPC)1 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)1 DialogueNodeOld (com.lilithsthrone.game.dialogue.DialogueNodeOld)1 Response (com.lilithsthrone.game.dialogue.responses.Response)1 ResponseCombat (com.lilithsthrone.game.dialogue.responses.ResponseCombat)1 ResponseEffectsOnly (com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly)1 ResponseSex (com.lilithsthrone.game.dialogue.responses.ResponseSex)1 ResponseTrade (com.lilithsthrone.game.dialogue.responses.ResponseTrade)1