예제 #1
0
파일: SR_Party.php 프로젝트: sinfocol/gwf3
 /**
  * Set two parties fighting each other.
  * @param SR_Party $party
  */
 public function fight(SR_Party $party, $announce = true)
 {
     if ($this->getID() === $party->getID()) {
         Dog_Log::error('Party should not fight itself!');
         return false;
     }
     if ($party->getMemberCount() === 0) {
         Dog_Log::error('Cannot fight empty party!');
         return false;
     }
     if ($party->getAction() === self::ACTION_DELETE) {
         $party->cloneAction($this);
     } elseif ($this->getAction() === self::ACTION_DELETE) {
         $this->cloneAction($party);
     }
     $this->pushAction(self::ACTION_FIGHT, $party->getID(), 0);
     $party->pushAction(self::ACTION_FIGHT, $this->getID(), 0);
     $this->initNPCb($party);
     $this->setContactEta(rand(10, 25));
     $party->setContactEta(rand(10, 25));
     $this->initFightBusy(1);
     $party->initFightBusy(-1);
     if ($announce === true) {
         $this->ntice('5095', array($party->displayMembers(true, true)));
         $party->ntice('5095', array($this->displayMembers(true, true)));
         // 			$this->notice(sprintf('You encounter %s.', $party->displayMembers(true, true)));
         // 			$party->notice(sprintf('You encounter %s.', $this->displayMembers(true, true)));
     }
     // 		$this->setMemberOptions(SR_Player::PARTY_DIRTY, true);
     // 		$party->setMemberOptions(SR_Player::PARTY_DIRTY, true);
     return true;
 }