コード例 #1
0
ファイル: double_faced.php プロジェクト: 4otaku/draft
 public function generate()
 {
     $double_ids = array_keys(Database::get_vector('card', 'id', Database::array_in('name', $this->double_list), $this->double_list));
     foreach ($this->pool as $rarity => $cards) {
         $this->double_pool[$rarity] = array();
         foreach ($cards as $card) {
             if (in_array($card, $double_ids)) {
                 $this->double_pool[$rarity][] = $card;
             }
         }
     }
     $rarity = mt_rand(0, $this->rare + $this->uncommon + $this->common);
     parent::generate();
     $this->is_foil = false;
     $this->land = 0;
     $this->common = 0;
     $this->uncommon = 0;
     $this->rare = 0;
     if ($rarity < $this->rare) {
         $this->rare = 1;
     } elseif ($rarity < $this->rare + $this->uncommon) {
         $this->uncommon = 1;
     } else {
         $this->common = 1;
     }
     $this->pool = $this->double_pool;
     parent::generate();
     return $this->ids;
 }
コード例 #2
0
ファイル: mythic_nonbasic.php プロジェクト: 4otaku/draft
 public function generate()
 {
     $rarity = mt_rand(0, $this->rare + $this->uncommon + $this->common);
     parent::generate();
     $this->pool = $this->land_pool;
     $this->is_foil = false;
     $this->common = 0;
     $this->uncommon = 0;
     $this->rare = 0;
     if ($rarity < $this->rare) {
         $this->rare = 1;
     } elseif ($rarity < $this->rare + $this->uncommon) {
         $this->uncommon = 1;
     } else {
         $this->common = 1;
     }
     parent::generate();
     return $this->ids;
 }