Search in sources :

Example 21 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class BaseMap method removeJoinedPartyMemberFromPeopleList.

public void removeJoinedPartyMemberFromPeopleList(Party party) {
    if (city == null) {
        return;
    }
    for (PartyMember pm : party.getMembers()) {
        String name = pm.getPlayer().name;
        Person joiner = null;
        for (Person p : city.getPeople()) {
            if (p != null && p.getRole() != null && p.getRole().getRole().equals("companion") && p.getConversation() != null && p.getConversation().getName().equals(name)) {
                joiner = p;
                break;
            }
        }
        city.getPeople().remove(joiner);
    }
}
Also used : PartyMember(objects.Party.PartyMember)

Example 22 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class CombatScreen method render.

@Override
public void render(float delta) {
    time += delta;
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.position.set(newMapPixelCoords.x + 5 * tilePixelWidth, newMapPixelCoords.y, 0);
    camera.update();
    renderer.setView(camera.combined, // this is voodoo
    camera.position.x - tilePixelWidth * 10, camera.position.y - tilePixelHeight * 10, Ultima4.MAP_WIDTH, Ultima4.MAP_HEIGHT);
    renderer.render();
    renderer.getBatch().begin();
    for (Creature cr : combatMap.getCreatures()) {
        if (cr.currentPos == null || !cr.getVisible()) {
            continue;
        }
        renderer.getBatch().draw(cr.getAnim().getKeyFrame(time, true), cr.currentPos.x, cr.currentPos.y);
    }
    for (PartyMember p : party.getMembers()) {
        if (p.combatCr == null || p.combatCr.currentPos == null || p.fled) {
            continue;
        }
        if (p.getPlayer().status != StatusType.DEAD && p.getPlayer().status != StatusType.SLEEPING) {
            renderer.getBatch().draw(p.combatCr.getAnim().getKeyFrame(time, true), p.combatCr.currentPos.x, p.combatCr.currentPos.y);
        } else {
            renderer.getBatch().draw(Ultima4.corpse, p.combatCr.currentPos.x, p.combatCr.currentPos.y);
        }
    }
    renderer.getBatch().end();
    batch.begin();
    batch.draw(Ultima4.backGround, 0, 0);
    Ultima4.hud.render(batch, party);
    Ultima4.font.setColor(Color.WHITE);
    if (showZstats > 0) {
        party.getSaveGame().renderZstats(showZstats, Ultima4.font, batch, Ultima4.SCREEN_HEIGHT);
    }
    if (context.getAura().getType() != AuraType.NONE) {
        Ultima4.font.draw(batch, context.getAura().getType().toString(), 430, Ultima4.SCREEN_HEIGHT - 7);
    }
    batch.end();
    stage.act();
    stage.draw();
}
Also used : Creature(objects.Creature) PartyMember(objects.Party.PartyMember)

Example 23 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class ConversationDialog method initialize.

private void initialize() {
    screen.gameTimer.active = false;
    setModal(true);
    defaults().space(10);
    add(internalTable = new Table(Ultima4.skin)).expand().fill();
    row();
    internalTable.defaults().pad(1);
    scrollPane = new LogScrollPane(Ultima4.skin, width);
    scrollPane.setHeight(height);
    input = new TextField("", Ultima4.skin);
    input.setTextFieldListener(new TextFieldListener() {

        @Override
        public void keyTyped(TextField tf, char key) {
            if (key == '\r') {
                if (tf.getText().length() == 0) {
                    if (!cancelHide) {
                        hide();
                    }
                    cancelHide = false;
                }
                Conversation conversation = person.getConversation();
                if (conversation != null) {
                    if (conversation instanceof CustomInputConversation) {
                        ((CustomInputConversation) conversation).setParty(screen.context.getParty());
                    }
                    String query = tf.getText();
                    Topic t = conversation.matchTopic(query);
                    if (t != null) {
                        if (t.getQuery() != null && t.getQuery().equals("join")) {
                            String name = conversation.getName();
                            Virtue virtue = screen.context.getParty().getVirtueForJoinable(name);
                            if (virtue != null) {
                                CannotJoinError join = screen.context.getParty().join(name);
                                if (join == CannotJoinError.JOIN_SUCCEEDED) {
                                    scrollPane.add("I am honored to join thee!");
                                    screen.context.getCurrentMap().removeJoinedPartyMemberFromPeopleList(screen.context.getParty());
                                } else {
                                    scrollPane.add("Thou art not " + (join == CannotJoinError.JOIN_NOT_VIRTUOUS ? virtue.getDescription() : "experienced") + " enough for me to join thee.");
                                }
                            } else {
                                scrollPane.add("I cannot join thee.");
                            }
                        } else {
                            if (!conversation.isStandardQuery(query)) {
                                screen.context.addEntry(conversation.getName(), conversation.getMap(), t.getPhrase());
                            }
                            scrollPane.add(t.getPhrase());
                            if (t.getQuestion() != null) {
                                scrollPane.add(t.getQuestion());
                            }
                        }
                        previousTopic = t;
                    } else {
                        if (previousTopic != null && previousTopic.getQuestion() != null) {
                            if (query.toLowerCase().contains("y")) {
                                screen.context.addEntry(conversation.getName(), conversation.getMap(), previousTopic.getYesResponse());
                                scrollPane.add(previousTopic.getYesResponse());
                                if (conversation.getRespAffectsHumility() > 0) {
                                    screen.context.getParty().adjustKarma(KarmaAction.BRAGGED);
                                }
                            } else {
                                screen.context.addEntry(conversation.getName(), conversation.getMap(), previousTopic.getNoResponse());
                                scrollPane.add(previousTopic.getNoResponse());
                                if (previousTopic.isLbHeal()) {
                                    for (PartyMember pm : screen.context.getParty().getMembers()) {
                                        pm.heal(HealType.CURE);
                                        pm.heal(HealType.FULLHEAL);
                                    }
                                    Sounds.play(Sound.HEALING);
                                }
                                if (conversation.getRespAffectsHumility() > 0) {
                                    screen.context.getParty().adjustKarma(KarmaAction.HUMBLE);
                                }
                            }
                        } else {
                            scrollPane.add("That I cannot help thee with.");
                        }
                        previousTopic = null;
                    }
                } else if (person.getRole() != null && vendor != null) {
                    String input = tf.getText();
                    vendor.setResponse(input);
                    vendor.nextDialog();
                }
                tf.setText("");
            }
        }
    });
    defaults().pad(5);
    internalTable.add(scrollPane).maxWidth(width).width(width);
    internalTable.row();
    internalTable.add(input).maxWidth(width).width(width);
    focusListener = new FocusListener() {

        @Override
        public void keyboardFocusChanged(FocusEvent event, Actor actor, boolean focused) {
            if (!focused) {
                focusChanged(event);
            }
        }

        @Override
        public void scrollFocusChanged(FocusEvent event, Actor actor, boolean focused) {
            if (!focused) {
                focusChanged(event);
            }
        }

        private void focusChanged(FocusEvent event) {
            Stage stage = getStage();
            if (isModal() && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == ConversationDialog.this) {
                Actor newFocusedActor = event.getRelatedActor();
                if (newFocusedActor != null && !newFocusedActor.isDescendantOf(ConversationDialog.this) && !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus))) {
                    event.cancel();
                }
            }
        }
    };
    person.setTalking(true);
    if (person.getConversation() != null) {
        if (person.getRole() != null && person.getRole().getRole().equals("lordbritish")) {
            LordBritishConversation conv = (LordBritishConversation) person.getConversation();
            scrollPane.add(conv.intro(screen.context));
            SequenceAction seq = Actions.action(SequenceAction.class);
            Party party = screen.context.getParty();
            if (party.getMember(0).getPlayer().status == StatusType.DEAD) {
                party.getMember(0).heal(HealType.RESURRECT);
                party.getMember(0).heal(HealType.FULLHEAL);
                seq.addAction(Actions.run(new LBAction(Sound.HEALING, "I resurrect thee.")));
                seq.addAction(Actions.delay(3f));
            }
            for (int i = 0; i < party.getMembers().size(); i++) {
                PartyMember pm = party.getMember(i);
                if (pm.getPlayer().advanceLevel()) {
                    seq.addAction(Actions.run(new LBAction(Sound.MAGIC, pm.getPlayer().name + " thou art now level " + pm.getPlayer().getLevel())));
                    seq.addAction(Actions.delay(3f));
                }
            }
            stage.addAction(seq);
        } else if (person.getRole() != null && person.getRole().getRole().equals("hawkwind")) {
            HawkwindConversation conv = (HawkwindConversation) person.getConversation();
            conv.setParty(screen.context.getParty());
            scrollPane.add(conv.intro());
        } else {
            scrollPane.add("You meet " + person.getConversation().getDescription().toLowerCase() + ".");
        }
    } else if (person.getRole() != null && person.getRole().getInventoryType() != null) {
        vendor = Ultima4.vendorClassSet.getVendorImpl(person.getRole().getInventoryType(), Maps.get(screen.context.getCurrentMap().getId()), screen.context);
        vendor.setScreen(screen);
        vendor.setScrollPane(scrollPane);
        vendor.nextDialog();
    }
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) PartyMember(objects.Party.PartyMember) LordBritishConversation(objects.LordBritishConversation) LogScrollPane(util.LogScrollPane) Conversation(objects.Conversation) CustomInputConversation(objects.CustomInputConversation) LordBritishConversation(objects.LordBritishConversation) HawkwindConversation(objects.HawkwindConversation) HawkwindConversation(objects.HawkwindConversation) Party(objects.Party) Actor(com.badlogic.gdx.scenes.scene2d.Actor) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextFieldListener(com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener) Topic(objects.Conversation.Topic) FocusListener(com.badlogic.gdx.scenes.scene2d.utils.FocusListener) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction) CustomInputConversation(objects.CustomInputConversation)

Example 24 with PartyMember

use of objects.Party.PartyMember in project ultimate-java by pantinor.

the class HawkwindConversation method intro.

public String intro() {
    StringBuffer sb = new StringBuffer();
    PartyMember pm = party.getMember(0);
    if (pm.getPlayer().status == StatusType.SLEEPING || pm.getPlayer().status == StatusType.DEAD) {
        sb.append(hawkwindText[HW_SPEAKONLYWITH]);
        sb.append(pm.getPlayer().name);
        sb.append(hawkwindText[HW_RETURNWHEN] + "\n");
        sb.append(pm.getPlayer().name);
        sb.append(hawkwindText[HW_ISREVIVED]);
    } else {
        sb.append(hawkwindText[HW_WELCOME] + "\n");
        sb.append(pm.getPlayer().name + "\n");
        sb.append(hawkwindText[HW_GREETING1] + "\n");
        sb.append(hawkwindText[HW_GREETING2]);
    }
    party.adjustKarma(KarmaAction.HAWKWIND);
    return sb.toString();
}
Also used : PartyMember(objects.Party.PartyMember)

Aggregations

PartyMember (objects.Party.PartyMember)24 PartyDeathException (util.PartyDeathException)9 Creature (objects.Creature)5 Tile (objects.Tile)5 TiledMapTile (com.badlogic.gdx.maps.tiled.TiledMapTile)4 StaticTiledMapTile (com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile)4 DungeonTileModelInstance (util.DungeonTileModelInstance)4 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)3 Color (com.badlogic.gdx.graphics.Color)2 Vector3 (com.badlogic.gdx.math.Vector3)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 Person (objects.Person)2 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)1 GlyphLayout (com.badlogic.gdx.graphics.g2d.GlyphLayout)1 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)1 Action (com.badlogic.gdx.scenes.scene2d.Action)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)1 TextFieldListener (com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener)1