Плавка рун #1
This commit is contained in:
parent
5f4b2cbf77
commit
c5fb9868e6
65
_incl_data/class/Insallah/Runes/Runes.php
Normal file
65
_incl_data/class/Insallah/Runes/Runes.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
|
||||
class Runes
|
||||
{
|
||||
public static function get($level)
|
||||
{
|
||||
if (!in_array($level, [8, 9, 10])) {
|
||||
return [];
|
||||
}
|
||||
$power = [8 => 3, 9 => 5, 10 => 7];
|
||||
$rand9 = array_rand(array_flip(['hpAll', 'm2', 'm5']));
|
||||
$runes = [
|
||||
['s1', 'pa2', $rand9, 'antm3'],
|
||||
['s1', 'pa3', $rand9, 'za'],
|
||||
['s2', 'pa1', $rand9, 'antm3'],
|
||||
['s2', 'pa1', $rand9, 'm3'],
|
||||
['s3', 'pa4', $rand9, 'm3'],
|
||||
['s5', 'm11', 'mpAll', 'pzm']
|
||||
];
|
||||
$vars = [
|
||||
's1' => ['Ñèëà', mt_rand(1, 3)],
|
||||
's2' => ['Ëîâêîñòü', mt_rand(1, 3)],
|
||||
's3' => ['Èíòóèöèÿ', mt_rand(1, 3)],
|
||||
's5' => ['Èíòåëëåêò', mt_rand(1, 3)],
|
||||
'pa1' => ['Ìîùíîñòè Êîëþùåãî óðîíà', mt_rand(1, $power[$level])],
|
||||
'pa2' => ['Ìîùíîñòè Ðóáÿùåãî óðîíà', mt_rand(1, $power[$level])],
|
||||
'pa3' => ['Ìîùíîñòè Äðîáÿùåãî óðîíà', mt_rand(1, $power[$level])],
|
||||
'pa4' => ['Ìîùíîñòè Ðåæóùåãî óðîíà', mt_rand(1, $power[$level])],
|
||||
'm2' => ['???', mt_rand(5, 15)],
|
||||
'm3' => ['ÌÊ', mt_rand(1, 3)],
|
||||
'antm3' => ['ÏÌÊ', mt_rand(1, 3)],
|
||||
'm5' => ['???', mt_rand(5, 10)],
|
||||
'm11' => ['Ìîùíîñòè Ìàãèè ñòèõèè', mt_rand(1, $power[$level])],
|
||||
'hpAll' => ['HP', mt_rand(5, 15)],
|
||||
'mpAll' => ['MP', mt_rand(10, 20)],
|
||||
'pzm' => ['Ïîäàâëåíèå çàùèòû îò ìàãèè', 1]
|
||||
];
|
||||
|
||||
$rune = $runes[array_rand($runes)]; // arr (s, pa\m, rand9\mpAll, other)
|
||||
$runeTxt = [$vars[$rune[0][0]], $vars[$rune[1][0]], $vars[$rune[2][0]], $vars[$rune[3][0]]];
|
||||
$runeVals = [$vars[$rune[0][1]], $vars[$rune[1][1]], $vars[$rune[2][1]], $vars[$rune[3][1]]];
|
||||
$resultRune = array_combine($rune, $runeVals);
|
||||
$resultText = array_combine($runeTxt, array_map('self::addPlus', $runeVals));
|
||||
if ($level < 10) { // Îòðåçàåì ïàðàìåòð 4.
|
||||
array_pop($resultRune);
|
||||
array_pop($resultText);
|
||||
}
|
||||
if ($level < 9) { // Îòðåçàåì ïàðàìåòð 3.
|
||||
array_pop($resultRune);
|
||||
array_pop($resultText);
|
||||
}
|
||||
//Ñòðî÷êà data â áàçó
|
||||
$returnData = '|' . http_build_query($resultRune, 'add_', '|');
|
||||
//Ñòðî÷êà ÷åëîâåêîïîíÿòíûõ ïàðàìåòðîâ â ñòàòóñ.
|
||||
$returnText = implode(', ', $resultText);
|
||||
return [$returnData, $returnText];
|
||||
}
|
||||
|
||||
private static function addPlus($var)
|
||||
{
|
||||
return '+' . (string)$var;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user