几天前我开始学习PHP,当然还有其他人遇到的问题,如果没有经验丰富的人的帮助,我无法解决。
我的想法是我不想用这段代码来实现。
如果您滚动的数字等于或高于$ difficulity变量,则preg_match会执行魔术并且这些数字会以粗体颜色标记。 +在奖金中,我想了解如何检查/计算我有多少数字。
此刻我已经走到了这一步。
感谢任何帮助和建议。
PS。
抱歉我的英文。
<?php
//mission params
$mission_title = "Give a hug to stranger";
$mission_description = "Sneak up on that MF!!";
$mission_type = 2;
$difficulity = 6; // Minimal number needed
$success = 2; // How much times you need to get $difficulity or higher number
//Character stats
$masteries_level = 5; // How much rolls you have
$masteries_bonus = 1; // Bonus to range
$range_start = 1; // Minimal number
$range_end = 10; // Max number
//variables
$pattern = '/^[$difficulity - $range_end]*$/';
// I still don't understand it, but still it works
?>
<!-- place for style -->
<?php
echo '<h3>'.$mission_title.'</h3>';
echo '<p>'.$mission_description.'</p><br>';
echo "Dice result<br><hr><br>";
for ($x=1; $x<=$masteries_level; $x++) {
$done = rand($range_start, $range_end+$masteries_bonus);
$result_mission_p = preg_match($pattern, $done, $matches);
print $result_mission_p;
}
?>