-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
146 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Image from "next/image" | ||
import Punic1 from "@/images/wars/punic1.png" | ||
import MilitaryIcon from "@/images/icons/military.svg" | ||
import War from "@/classes/War" | ||
|
||
interface WarPortraitProps { | ||
war: War | ||
} | ||
|
||
const WarPortrait = ({ war }: WarPortraitProps) => { | ||
return ( | ||
<div> | ||
<div className="p-0.5 bg-black rounded"> | ||
<div className="relative p-0.5 bg-red-600 dark:bg-red-800 flex"> | ||
<div className="absolute rounded-tl bg-black/75 h-[36px] w-[36px] flex justify-center items-center"> | ||
<Image src={MilitaryIcon} alt="War Icon" height={30} width={30} /> | ||
</div> | ||
<div className="absolute right-0.5 bottom-0.5 h-[36px] w-[36px] flex justify-center items-center"> | ||
<div className="h-[26px] w-[26px] bg-black/75 rounded-full flex justify-center items-center"> | ||
<div className="h-[16px] w-[16px] bg-green-500 rounded-full"></div> | ||
</div> | ||
</div> | ||
<Image | ||
src={Punic1} | ||
alt={`Portrait of the ${war.getName()}`} | ||
height={120} | ||
width={120} | ||
placeholder="blur" | ||
unoptimized | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default WarPortrait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const getDiceRollProbability = ( | ||
dice_count: number, | ||
target_numbers: number[] | ||
) => { | ||
// Work out the probability of a dice roll hitting any of the target numbers | ||
const dice_sides = [1, 2, 3, 4, 5, 6] | ||
let outcomes = [1, 2, 3, 4, 5, 6] | ||
for (let dice_index = 1; dice_index < dice_count; dice_index++) { | ||
let next_set_of_outcomes: number[] = [] | ||
outcomes.forEach((outcome) => { | ||
for (let side_index = 0; side_index < dice_sides.length; side_index++) { | ||
next_set_of_outcomes.push(outcome + dice_sides[side_index]) | ||
} | ||
}) | ||
outcomes = next_set_of_outcomes | ||
} | ||
let match_count = 0 | ||
outcomes.forEach((outcome) => { | ||
if (target_numbers.includes(outcome)) { | ||
match_count += 1 | ||
} | ||
}) | ||
const probability = | ||
match_count === 1 ? 1 : Math.round((match_count / outcomes.length) * 100) | ||
return `${probability}%` | ||
} | ||
|
||
export default getDiceRollProbability |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ | |
"sulpicius", | ||
"terentius", | ||
"tullius", | ||
"unoptimized", | ||
"unprosecuted", | ||
"valerius", | ||
"verrucosus", | ||
|