Search in sources :

Example 1 with BuffsManager

use of delta.games.lotro.character.stats.buffs.BuffsManager in project lotro-companion by dmorcellet.

the class BuffEditionPanelController method add.

private void add() {
    BuffsManager buffs = _toon.getBuffs();
    List<Buff> possibleBuffs = BuffRegistry.getInstance().buildBuffSelection(_toon, buffs);
    Buff buff = BuffChoiceWindowController.selectBuff(_parentWindow, possibleBuffs, null);
    if (buff != null) {
        BuffInstance buffInstance = buff.buildInstance();
        buffs.addBuff(buffInstance);
        BuffIconController controller = buildBuffController(buffInstance);
        _buffControllers.add(controller);
        // Broadcast toon update event...
        CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
        EventsManager.invokeEvent(event);
    }
}
Also used : BuffInstance(delta.games.lotro.character.stats.buffs.BuffInstance) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) Buff(delta.games.lotro.character.stats.buffs.Buff) BuffsManager(delta.games.lotro.character.stats.buffs.BuffsManager)

Example 2 with BuffsManager

use of delta.games.lotro.character.stats.buffs.BuffsManager in project lotro-companion by dmorcellet.

the class BuffEditionPanelController method remove.

private void remove(int index) {
    BuffsManager buffs = _toon.getBuffs();
    buffs.removeBuffAt(index);
    _buffControllers.remove(index);
    // Update UI
    updateIconsPanel();
    // Broadcast toon update event...
    CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
    EventsManager.invokeEvent(event);
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent) BuffsManager(delta.games.lotro.character.stats.buffs.BuffsManager)

Example 3 with BuffsManager

use of delta.games.lotro.character.stats.buffs.BuffsManager in project lotro-companion by dmorcellet.

the class BuffEditionPanelController method updateTier.

private void updateTier(int index) {
    BuffsManager buffs = _toon.getBuffs();
    BuffInstance buff = buffs.getBuffAt(index);
    List<Integer> tiers = buff.getBuff().getImpl().getTiers();
    if ((tiers != null) && (tiers.size() > 0)) {
        Integer currentTier = buff.getTier();
        int currentTierIndex = tiers.indexOf(currentTier);
        if (currentTierIndex != -1) {
            currentTierIndex++;
            if (currentTierIndex == tiers.size()) {
                currentTierIndex = 0;
            }
            buff.setTier(tiers.get(currentTierIndex));
            _buffControllers.get(index).update();
            // Broadcast toon update event...
            CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
            EventsManager.invokeEvent(event);
        }
    }
}
Also used : BuffInstance(delta.games.lotro.character.stats.buffs.BuffInstance) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) BuffsManager(delta.games.lotro.character.stats.buffs.BuffsManager)

Example 4 with BuffsManager

use of delta.games.lotro.character.stats.buffs.BuffsManager in project lotro-companion by dmorcellet.

the class BuffEditionPanelController method buildBuffControllers.

private void buildBuffControllers(JPanel panel) {
    BuffsManager buffs = _toon.getBuffs();
    int nbBuffs = buffs.getBuffsCount();
    for (int i = 0; i < nbBuffs; i++) {
        BuffInstance buff = buffs.getBuffAt(i);
        BuffIconController controller = buildBuffController(buff);
        _buffControllers.add(controller);
    }
}
Also used : BuffInstance(delta.games.lotro.character.stats.buffs.BuffInstance) BuffsManager(delta.games.lotro.character.stats.buffs.BuffsManager)

Example 5 with BuffsManager

use of delta.games.lotro.character.stats.buffs.BuffsManager in project lotro-companion by dmorcellet.

the class MainTestShowBuffChoiceWindow method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    CharacterData c = new CharacterData();
    c.setCharacterClass(CharacterClass.CAPTAIN);
    c.setRace(Race.MAN);
    BuffsManager buffs = new BuffsManager();
    List<Buff> possibleBuffs = BuffRegistry.getInstance().buildBuffSelection(c, buffs);
    Buff initialBuff = possibleBuffs.get(3);
    System.out.println(initialBuff);
    Buff buff = BuffChoiceWindowController.selectBuff(null, possibleBuffs, initialBuff);
    System.out.println(buff);
}
Also used : CharacterData(delta.games.lotro.character.CharacterData) Buff(delta.games.lotro.character.stats.buffs.Buff) BuffsManager(delta.games.lotro.character.stats.buffs.BuffsManager)

Aggregations

BuffsManager (delta.games.lotro.character.stats.buffs.BuffsManager)5 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)3 BuffInstance (delta.games.lotro.character.stats.buffs.BuffInstance)3 Buff (delta.games.lotro.character.stats.buffs.Buff)2 CharacterData (delta.games.lotro.character.CharacterData)1