mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
Add Randomise function to module selection
This commit is contained in:
1 parent
18cc885869
commit
d28c56fe1c
1 file changed
+36
+36
@@ -392,6 +392,42 @@ export function Modules() {
|
|||||||
>
|
>
|
||||||
{strings.website.tools.tankopedia.configuration.modules.upgrade}
|
{strings.website.tools.tankopedia.configuration.modules.upgrade}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
color="blue"
|
||||||
|
onClick={() => {
|
||||||
|
Duel.mutate((draft) => {
|
||||||
|
// Random turret
|
||||||
|
const randomTurret =
|
||||||
|
draft.protagonist.tank.turrets[
|
||||||
|
Math.floor(Math.random() * draft.protagonist.tank.turrets.length)
|
||||||
|
];
|
||||||
|
draft.protagonist.turret = randomTurret;
|
||||||
|
|
||||||
|
// Random gun from the selected turret
|
||||||
|
const randomGun =
|
||||||
|
randomTurret.guns[
|
||||||
|
Math.floor(Math.random() * randomTurret.guns.length)
|
||||||
|
];
|
||||||
|
draft.protagonist.gun = randomGun;
|
||||||
|
draft.protagonist.shell = randomGun.shells[0];
|
||||||
|
|
||||||
|
// Random engine
|
||||||
|
draft.protagonist.engine =
|
||||||
|
draft.protagonist.tank.engines[
|
||||||
|
Math.floor(Math.random() * draft.protagonist.tank.engines.length)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Random track
|
||||||
|
draft.protagonist.track =
|
||||||
|
draft.protagonist.tank.tracks[
|
||||||
|
Math.floor(Math.random() * draft.protagonist.tank.tracks.length)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Randomize
|
||||||
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
Reference in new issue
Block a user