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; }
/** * @param {String} $set * @return Booster_Abstract */ public static function make_for_set($set, $id) { switch ($set) { case 'AN': case 'AQ': case 'LG': case 'DK': case 'FE': case 'IA': case 'HL': case 'AL': case 'MI': case 'VI': case 'WL': case 'TE': case 'SH': case 'EX': case '2E': case '3E': case '4E': case '5E': $booster = new Booster_Prefoil($id); break; case 'US': case 'UL': case 'UD': case 'MM': case 'NE': case 'PY': case 'IN': case 'PS': case 'AP': case 'OD': case 'TO': case 'JU': case 'ON': case 'LE': case 'SC': case 'MR': case 'DS': case 'FD': case 'CK': case 'BK': case 'SK': case 'RA': case 'GP': case 'DI': case 'CS': case '6E': $booster = new Booster_Old_Noland($id); break; case '7E': case '8E': case '9E': $booster = new Booster_Old_Land($id); break; case 'TS': $booster = new Booster_Timeshifted_Spiral($id); break; case 'PC': $booster = new Booster_Timeshifted_Chaos($id); break; case 'FS': case 'LW': case 'MT': case 'SM': case 'ET': $booster = new Booster_New_Noland($id); break; case '10E': $booster = new Booster_New_Land($id); break; case 'ISD': case 'DKA': $booster = new Booster_Double_Faced($id); break; case 'DGM': $booster = new Booster_Mythic_Nonbasic($id); $booster->set_nonbasic_pool(self::get_land_cards($set)); break; case 'MMA': $booster = new Booster_Forced_Foil($id); break; default: $booster = new Booster_Mythic($id); break; } $booster->set_pool(self::get_cards($set)); return $booster; }