function CreateItem() { $this->refine = false; $this->option0 = false; $this->option1 = false; $this->option2 = false; list($low, $high) = ItemAbilityPossibility($this->type); // 2:3:4 // 付加能力がつく確率。 $prob = mt_rand(1, 9); switch ($prob) { case 1: case 2: case 3: $AddLow = true; break; case 4: case 5: case 6: $AddHigh = true; break; case 7: case 8: case 9: $AddLow = true; $AddHigh = true; break; } // array_rand() は微妙なので敬遠する。 if ($AddHigh) { $prob = mt_rand(0, count($high) - 1); $this->option1 = $high["{$prob}"]; } if ($AddLow) { $prob = mt_rand(0, count($low) - 1); $this->option2 = $low["{$prob}"]; } }
<?php include "../data/data.create.php"; include "../data/data.enchant.php"; list($low, $high) = ItemAbilityPossibility("½£"); print "---------------LOW<br />\n"; foreach ($low as $enchant) { $item = array(); AddEnchantData($item, $enchant); print '<span style="width:10em;text-align:right">' . $enchant . '</span>:' . $item["option"] . "<br />\n"; } print "---------------HIGH<br />\n"; foreach ($high as $enchant) { $item = array(); AddEnchantData($item, $enchant); print '<span style="width:10em;text-align:right">' . $enchant . '</span>:' . $item["option"] . "<br />\n"; } //dump($low); //dump($high); function dump($var) { print "<pre>\n"; var_dump($var); print "\n</pre>\n"; }
<?php include "../data/data.create.php"; include "../data/data.enchant.php"; list($low, $high) = ItemAbilityPossibility("Sword"); print "---------------LOW<br />\n"; foreach ($low as $enchant) { $item = array(); AddEnchantData($item, $enchant); print '<span style="width:10em;text-align:right">' . $enchant . '</span>:' . $item["option"] . "<br />\n"; } print "---------------HIGH<br />\n"; foreach ($high as $enchant) { $item = array(); AddEnchantData($item, $enchant); print '<span style="width:10em;text-align:right">' . $enchant . '</span>:' . $item["option"] . "<br />\n"; } //dump($low); //dump($high); function dump($var) { print "<pre>\n"; var_dump($var); print "\n</pre>\n"; }