コード例 #1
0
ファイル: BuffService.java プロジェクト: rod2000/NGECore2
  public void clearBuffs(final CreatureObject creature) {

    // copy to array for thread safety

    for (final Buff buff : creature.getBuffList().get().toArray(new Buff[] {})) {

      if (buff.getGroup1().startsWith("setBonus")) {
        continue;
      }

      if (buff.isGroupBuff() && buff.getGroupBufferId() != creature.getObjectID()) {
        removeBuffFromCreature(creature, buff);
        continue;
      }

      if (buff.getRemainingDuration() > 0 && buff.getDuration() > 0) {
        ScheduledFuture<?> task =
            scheduler.schedule(
                new Runnable() {

                  @Override
                  public void run() {

                    removeBuffFromCreature(creature, buff);
                  }
                },
                (long) buff.getRemainingDuration(),
                TimeUnit.SECONDS);
        buff.setRemovalTask(task);
        continue;
      } else {
        removeBuffFromCreature(creature, buff);
      }
    }
  }
コード例 #2
0
ファイル: BuffService.java プロジェクト: rod2000/NGECore2
  public void addBuffToCreature(final CreatureObject creature, String buffName) {

    /*if(!FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py")) {
    	//System.out.println("Buff script doesnt exist for: " + buffName);
    	return;
    }*/

    final Buff buff = new Buff(buffName, creature.getObjectID());
    if (buff.isGroupBuff()) {
      addGroupBuff(creature, buffName);
    } else {
      doAddBuff(creature, buffName);
    }
  }