use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.
the class MainController method openCharactersPresent.
public void openCharactersPresent(GameCharacter characterViewed) {
if (!Main.game.isStarted()) {
return;
}
if (characterViewed != null && characterViewed != CharactersPresentDialogue.characterViewed) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
CharactersPresentDialogue.resetContent(characterViewed);
Main.game.setContent(new Response("", "", CharactersPresentDialogue.MENU));
} else {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.CHARACTERS_PRESENT) {
Main.game.restoreSavedContent();
} else if (!Main.game.getCharactersPresent().isEmpty()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
CharactersPresentDialogue.resetContent(characterViewed);
Main.game.setContent(new Response("", "", CharactersPresentDialogue.MENU));
}
}
}
use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.
the class EnchantmentEventListener method handleEvent.
@Override
public void handleEvent(Event event) {
if (itemToEnchant != null) {
if (itemToEnchant.getEnchantmentEffect() != null) {
EnchantmentDialogue.resetEnchantmentVariables();
EnchantmentDialogue.ingredient = itemToEnchant;
}
} else if (primaryModifier != null) {
EnchantmentDialogue.primaryMod = primaryModifier;
} else if (secondaryModifier != null) {
EnchantmentDialogue.secondaryMod = secondaryModifier;
} else if (potency != null) {
EnchantmentDialogue.potency = potency;
} else if (effect) {
ItemEffect e = EnchantmentDialogue.effects.get(effectIndex);
EnchantmentDialogue.effects.remove(e);
} else if (limit != EnchantmentDialogue.limit) {
EnchantmentDialogue.limit = limit;
}
if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getPrimaryModifiers().contains(EnchantmentDialogue.primaryMod)) {
EnchantmentDialogue.primaryMod = EnchantmentDialogue.ingredient.getEnchantmentEffect().getPrimaryModifiers().get(0);
}
if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getSecondaryModifiers(EnchantmentDialogue.primaryMod).contains(EnchantmentDialogue.secondaryMod)) {
EnchantmentDialogue.secondaryMod = EnchantmentDialogue.ingredient.getEnchantmentEffect().getSecondaryModifiers(EnchantmentDialogue.primaryMod).get(0);
}
if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getPotencyModifiers(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod).contains(EnchantmentDialogue.potency)) {
EnchantmentDialogue.potency = TFPotency.MINOR_BOOST;
}
if (EnchantmentDialogue.limit > EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod)) {
EnchantmentDialogue.limit = EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod);
}
Main.game.setContent(new Response("Enchanting", "Start enchanting.", EnchantmentDialogue.ENCHANTMENT_MENU));
}
use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.
the class TooltipResponseDescriptionEventListener method handleEvent.
@Override
public void handleEvent(Event event) {
Main.mainController.setTooltipContent("");
if (nextPage) {
if (Main.game.isHasNextResponsePage()) {
Main.mainController.setTooltipSize(360, 60);
double xPosition = ((MouseEvent) event).getScreenX() + 16 - 180;
if (xPosition + 360 > Main.primaryStage.getX() + Main.primaryStage.getWidth() - 16)
xPosition = Main.primaryStage.getX() + Main.primaryStage.getWidth() - 360 - 16;
double yPosition = Main.primaryStage.getY() + Main.primaryStage.getHeight() - (34 * (MainController.RESPONSE_COUNT / 5) + 4) - Main.mainController.getTooltip().getHeight() - (Main.mainScene.getWindow().getHeight() - Main.mainScene.getHeight() - Main.mainScene.getY());
Main.mainController.getTooltip().setAnchorX(xPosition);
Main.mainController.getTooltip().setAnchorY(yPosition);
Main.mainController.setTooltipContent("<div class='title'>Next Page</div>");
Main.mainController.getTooltip().setAnchorX(xPosition);
Main.mainController.getTooltip().setAnchorY(yPosition);
(new Thread(new TooltipUpdateThread(xPosition, yPosition))).start();
}
} else if (previousPage) {
if (Main.game.getResponsePage() != 0) {
Main.mainController.setTooltipSize(360, 60);
double xPosition = ((MouseEvent) event).getScreenX() + 16 - 180;
if (xPosition + 360 > Main.primaryStage.getX() + Main.primaryStage.getWidth() - 16)
xPosition = Main.primaryStage.getX() + Main.primaryStage.getWidth() - 360 - 16;
double yPosition = Main.primaryStage.getY() + Main.primaryStage.getHeight() - (34 * (MainController.RESPONSE_COUNT / 5) + 4) - Main.mainController.getTooltip().getHeight() - (Main.mainScene.getWindow().getHeight() - Main.mainScene.getHeight() - Main.mainScene.getY());
Main.mainController.getTooltip().setAnchorX(xPosition);
Main.mainController.getTooltip().setAnchorY(yPosition);
Main.mainController.setTooltipContent("<div class='title'>Previous Page</div>");
Main.mainController.getTooltip().setAnchorX(xPosition);
Main.mainController.getTooltip().setAnchorY(yPosition);
(new Thread(new TooltipUpdateThread(xPosition, yPosition))).start();
}
} else {
Response response = null;
if (Main.game.getCurrentDialogueNode() != null) {
if (Main.game.getResponsePage() == 0) {
response = Main.game.getCurrentDialogueNode().getResponse(Main.game.getResponseTab(), index);
} else {
if (index != 0) {
response = Main.game.getCurrentDialogueNode().getResponse(Main.game.getResponseTab(), Main.game.getResponsePage() * MainController.RESPONSE_COUNT + index - 1);
} else {
response = Main.game.getCurrentDialogueNode().getResponse(Main.game.getResponseTab(), Main.game.getResponsePage() * MainController.RESPONSE_COUNT + MainController.RESPONSE_COUNT - 1);
}
}
}
if (response != null) {
tooltipSB.setLength(0);
int boxHeight = 130;
if (!response.hasRequirements()) {
if (response.isSexHighlight()) {
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex</span></div>");
boxHeight += 44;
} else if (response.isCombatHighlight()) {
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_COMBAT.toWebHexString() + ";'>Combat</span></div>");
boxHeight += 44;
}
tooltipSB.append("<div class='description'>" + response.getTooltipText() + "</div>");
} else {
if (response.isAvailable()) {
if (response.isSexHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex</span> (<span style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Available</span>)</div>");
else if (response.isCombatHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_COMBAT.toWebHexString() + ";'>Combat</span> (<span style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Available</span>)</div>");
else
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Available</span></div>");
boxHeight += 44;
if (response.getSexPace() != null) {
tooltipSB.append("<div class='subTitle'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex Pace:</span>" + " <span style='color:" + response.getSexPace().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(response.getSexPace().getName()) + "</span></div>");
boxHeight += 44;
}
tooltipSB.append("<div class='description'>" + response.getTooltipText() + "</div>");
} else if (response.isAbleToBypass()) {
if (response.isSexHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex</span> (<span style='color:" + Colour.GENERIC_ARCANE.toWebHexString() + ";'>Corruptive</span>)</div>");
else if (response.isCombatHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_COMBAT.toWebHexString() + ";'>Combat</span> (<span style='color:" + Colour.GENERIC_ARCANE.toWebHexString() + ";'>Corruptive</span>)</div>");
else
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_ARCANE.toWebHexString() + ";'>Corruptive</span></div>");
boxHeight += 44;
if (response.getSexPace() != null) {
tooltipSB.append("<div class='subTitle'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex Pace:</span>" + " <span style='color:" + response.getSexPace().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(response.getSexPace().getName()) + "</span></div>");
boxHeight += 44;
}
tooltipSB.append("<div class='description'>" + response.getTooltipText() + "</div>");
} else {
if (response.isSexHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex</span> (<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Unavailable</span>)</div>");
else if (response.isCombatHighlight())
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_COMBAT.toWebHexString() + ";'>Combat</span> (<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Unavailable</span>)</div>");
else
tooltipSB.append("<div class='title'><span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Unavailable</span></div>");
boxHeight += 44;
if (response.getSexPace() != null) {
tooltipSB.append("<div class='subTitle'><span style='color:" + Colour.GENERIC_SEX.toWebHexString() + ";'>Sex Pace:</span>" + " <span style='color:" + response.getSexPace().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(response.getSexPace().getName()) + "</span></div>");
boxHeight += 44;
}
tooltipSB.append("<div class='description'><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>" + response.getTooltipText() + "</span></div>");
}
tooltipSB.append("<div class='description' style='height:" + ((response.lineHeight() + 2) * 18) + "; text-align:center;'>" + "<b>Availability:</b>" + response.getTooltipBlockingList() + response.getTooltipRequiredList() + "</div>");
tooltipSB.append("<div class='description-small'>" + response.getTooltipCorruptionBypassText() + "</div>");
boxHeight += 54;
boxHeight += 24 + ((response.lineHeight() + 1) * 18);
}
Main.mainController.setTooltipSize(360, boxHeight);
double xPosition = ((MouseEvent) event).getScreenX() + 16 - 180;
if (xPosition + 360 > Main.primaryStage.getX() + Main.primaryStage.getWidth() - 16)
xPosition = Main.primaryStage.getX() + Main.primaryStage.getWidth() - 360 - 16;
double yPosition = Main.primaryStage.getY() + Main.primaryStage.getHeight() - (34 * (MainController.RESPONSE_COUNT / 5) + 4) - boxHeight - (Main.mainScene.getWindow().getHeight() - Main.mainScene.getHeight() - Main.mainScene.getY());
Main.mainController.getTooltip().setAnchorX(xPosition);
Main.mainController.getTooltip().setAnchorY(yPosition);
(new Thread(new TooltipUpdateThread(xPosition, yPosition))).start();
Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
}
}
}
use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.
the class Game method setActiveWorld.
/**
* @param world
* @param location Location to set player to
*/
public void setActiveWorld(World world, Vector2i location, boolean setDefaultDialogue) {
// activeWorld = world;
player.setWorldLocation(world.getWorldType());
player.setLocation(location);
if (setDefaultDialogue) {
DialogueNodeOld dn = Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getPlace().getDialogue(true);
Main.game.setContent(new Response("", "", dn));
}
if (Main.game.started) {
Main.saveGame("AutoSave_" + Main.game.getPlayer().getName(), true);
}
}
use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.
the class Game method endTurn.
public void endTurn(int turnTime, boolean advanceTime) {
// long tStart = System.nanoTime();
long startHour = getHour();
if (advanceTime) {
minutesPassed += turnTime;
updateResponses();
}
if (Main.game.getCurrentWeather() != Weather.SNOW && Main.game.getSeason() != Season.WINTER) {
Main.game.getDialogueFlags().values.remove(DialogueFlagValue.hasSnowedThisWinter);
for (NPC npc : Main.game.getReindeerOverseers()) {
if (npc.getLocation() != Main.game.getPlayer().getLocation()) {
npc.setLocation(WorldType.EMPTY, PlaceType.GENERIC_EMPTY_TILE, true);
}
}
}
// Slavery: TODO
int hoursPassed = (int) (getHour() - startHour);
int hourStartTo24 = (int) (startHour % 24);
for (int i = 1; i <= hoursPassed; i++) {
slaveryUtil.performHourlyUpdate(this.getDayNumber(startHour * 60 + i * 60), (hourStartTo24 + i) % 24);
}
// If the time has passed midnight on this turn:
boolean newDay = ((int) (minutesPassed / (60 * 24)) != (int) (((minutesPassed - turnTime) / (60 * 24))));
if (newDay) {
// TODO replace with methods in each GenericPlace:
AbstractClothing goggles = AbstractClothingType.generateClothing(ClothingType.SCIENTIST_EYES_SAFETY_GOGGLES, Colour.CLOTHING_BLACK, false);
if (!Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().hasClothing(goggles)) {
Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().addClothing(goggles);
}
pendingSlaveInStocksReset = true;
// Reindeer:
for (NPC npc : Main.game.getReindeerOverseers()) {
if (npc.getLocationPlace().getPlaceType() == PlaceType.DOMINION_STREET && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) {
npc.moveToAdjacentMatchingCellType();
Main.game.getDialogueFlags().dailyReindeerReset(npc.getId());
}
}
}
if (pendingSlaveInStocksReset && Main.game.getPlayer().getLocationPlace().getPlaceType() != PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS) {
for (NPC npc : Main.game.getCharactersPresent(Main.game.getWorlds().get(WorldType.SLAVER_ALLEY).getCell(PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS))) {
if (npc instanceof SlaveInStocks) {
Main.game.banishNPC(npc);
}
}
for (int i = 0; i < 4; i++) {
SlaveInStocks slave = new SlaveInStocks(GenderPreference.getGenderFromUserPreferences());
if (Math.random() > 0.5f) {
Main.game.getGenericFemaleNPC().addSlave(slave);
} else {
Main.game.getGenericMaleNPC().addSlave(slave);
}
try {
Main.game.addNPC(slave, false);
} catch (Exception e) {
e.printStackTrace();
}
}
pendingSlaveInStocksReset = false;
}
handleAtmosphericConditions(turnTime);
// Apply status effects and update all NPCs:
isInNPCUpdateLoop = true;
for (NPC npc : NPCMap.values()) {
// Remove Dominion attackers if they aren't in alleyways: TODO this is because storm attackers need to be removed after a storm
if (npc.getLocationPlace().getPlaceType() != PlaceType.DOMINION_BACK_ALLEYS && npc.getWorldLocation() == WorldType.DOMINION && npc instanceof DominionAlleywayAttacker && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
banishNPC(npc);
}
// Non-slave NPCs clean clothes:
if (!npc.isSlave() && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
npc.cleanAllClothing();
npc.cleanAllDirtySlots();
}
// Set NPC resource values:
if (!Main.game.isInCombat() && !Main.game.isInSex()) {
if (!Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
npc.setHealthPercentage(1);
npc.setManaPercentage(1);
// npc.setLust(npc.getRestingLust());
}
npc.alignLustToRestingLust(turnTime * 10);
}
npc.calculateStatusEffects(turnTime);
if ((npc.isPendingClothingDressing() || (!npc.isSlave() && !npc.isUnique() && (npc.hasStatusEffect(StatusEffect.EXPOSED) || npc.hasStatusEffect(StatusEffect.EXPOSED_BREASTS) || npc.hasStatusEffect(StatusEffect.EXPOSED_PLUS_BREASTS)))) && (Main.game.getCurrentDialogueNode().equals(Main.game.getPlayer().getLocationPlace().getDialogue(false)) || !(npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation() && npc.getLocation().equals(Main.game.getPlayer().getLocation())))) {
npc.equipClothing(true, true);
npc.setPendingClothingDressing(false);
}
if (npc.isPendingTransformationToGenderIdentity()) {
npc.setBody(npc.getGenderIdentity(), RacialBody.valueOfRace(npc.getRace()), npc.getRaceStage());
CharacterUtils.randomiseBody(npc);
npc.setPendingTransformationToGenderIdentity(false);
}
// Prostitutes stay on promiscuity pills to avoid pregnancies, and, if the NPC is male, to avoid knocking up their clients
if ((!npc.isPregnant() && !npc.isSlave() && npc.getHistory() == History.PROSTITUTE && !npc.hasStatusEffect(StatusEffect.PROMISCUITY_PILL) && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) || (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_PROMISCUITY_PILLS))) {
npc.useItem(AbstractItemType.generateItem(ItemType.PROMISCUITY_PILL), npc, false);
}
if (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_VIXENS_VIRILITY)) {
npc.useItem(AbstractItemType.generateItem(ItemType.VIXENS_VIRILITY), npc, false);
}
if (npc.hasStatusEffect(StatusEffect.PREGNANT_3) && (minutesPassed - npc.getTimeProgressedToFinalPregnancyStage()) > (12 * 60)) {
if (npc instanceof Lilaya) {
if (!Main.game.getDialogueFlags().values.contains(DialogueFlagValue.reactedToPregnancyLilaya)) {
// Lilaya will only end pregnancy after you've seen it.
npc.endPregnancy(true);
}
} else {
npc.endPregnancy(true);
if (npc instanceof Kate) {
Main.game.getDialogueFlags().values.remove(DialogueFlagValue.reactedToKatePregnancy);
}
}
}
if (npc.getLocation().equals(Main.game.getPlayer().getLocation()) && npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation()) {
for (CoverableArea ca : CoverableArea.values()) {
if (npc.isCoverableAreaExposed(ca) && ca != CoverableArea.MOUTH) {
npc.getPlayerKnowsAreas().add(ca);
}
}
}
if (newDay) {
npc.dailyReset();
}
}
isInNPCUpdateLoop = false;
for (NPC npc : npcsToRemove) {
NPCMap.remove(npc.getId());
}
for (NPC npc : npcsToAdd) {
NPCMap.put(npc.getId(), npc);
}
npcsToRemove.clear();
npcsToAdd.clear();
// If not in combat:
if (!isInCombat()) {
// Regenerate health and stamina over time:
if (!isInSex() && !currentDialogueNode.isRegenerationDisabled()) {
if (Main.game.getPlayer().getHealthPercentage() < 1) {
Main.game.getPlayer().incrementHealth(turnTime * 0.1f);
}
if (Main.game.getPlayer().getManaPercentage() < 1) {
Main.game.getPlayer().incrementMana(turnTime * 0.1f);
}
Main.game.getPlayer().alignLustToRestingLust(turnTime);
}
}
if (Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
Main.game.getPlayer().calculateStatusEffects(turnTime);
}
RenderingEngine.ENGINE.renderButtons();
Main.mainController.updateUI();
Main.mainController.getTooltip().hide();
if (!Main.game.getPlayer().getStatusEffectDescriptions().isEmpty() && Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
Main.game.setContent(new Response("", "", MiscDialogue.STATUS_EFFECTS) {
@Override
public void effects() {
if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY) && Main.game.getPlayer().hasNonArcaneEssences()) {
Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().startQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY));
}
if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY) && Main.game.getPlayer().isVisiblyPregnant()) {
Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().startQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY));
}
}
});
Main.game.getPlayer().getStatusEffectDescriptions().clear();
}
// System.out.println((System.nanoTime()-tStart)/1000000000d+"s");
}
Aggregations