コード例 #1
0
ファイル: QuestState.java プロジェクト: Skunkk/l2j-universe
    @Override
    public void onDeath(Creature actor, Creature killer) {
      Player player = actor.getPlayer();
      if (player == null) {
        return;
      }

      player.removeListener(this);

      _quest.notifyDeath(killer, actor, QuestState.this);
    }
コード例 #2
0
ファイル: Creature.java プロジェクト: jasonfong/animats
  public Creature mateWith(Creature partner) {
    Creature child;

    if (mateWait != 0) {
      return null;
    }

    subEnergy(mateCost);

    if (partner.isWillingToMateWith(this)) {
      Genome childGenes = genes.crossoverWithAndMutate(partner.genes);

      mateWait = mateDelay;
      partner.mateWait = mateDelay;
      partner.subEnergy(mateCost);

      child = new Creature(world, color, childGenes);
      return child;
    } else {
      return null;
    }
  }
コード例 #3
0
ファイル: QuestState.java プロジェクト: Skunkk/l2j-universe
    @Override
    public void onKill(Creature actor, Creature victim) {
      if (!victim.isPlayer()) {
        return;
      }

      Player actorPlayer = (Player) actor;
      List<Player> players = null;
      switch (_quest.getParty()) {
        case Quest.PARTY_NONE:
          players = Collections.singletonList(actorPlayer);
          break;
        case Quest.PARTY_ALL:
          if (actorPlayer.getParty() == null) {
            players = Collections.singletonList(actorPlayer);
          } else {
            players = new ArrayList<Player>(actorPlayer.getParty().getMemberCount());
            for (Player member : actorPlayer.getParty().getPartyMembers()) {
              if (member.isInRange(actorPlayer, Creature.INTERACTION_DISTANCE)) {
                players.add(member);
              }
            }
          }
          break;
        default:
          players = Collections.emptyList();
          break;
      }

      for (Player player : players) {
        QuestState questState = player.getQuestState(_quest.getClass());
        if ((questState != null) && !questState.isCompleted()) {
          _quest.notifyKill((Player) victim, questState);
        }
      }
    }