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; }
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; }