This commit is contained in:
MuHua-123
2025-07-21 18:14:40 +08:00
parent 2b349081e2
commit a7eb4f7bbb
12 changed files with 338 additions and 109 deletions
+12
View File
@@ -12,6 +12,13 @@ public static class Dice {
public static int Roll(int value) {
return Random.Range(1, value + 1);
}
/// <summary> d20 + 调整值 + 加值 </summary>
public static int Roll20(int modifier = 0, int addValue = 0, DiceGrade grade = DiceGrade.) {
int d1 = Roll(20); int d2 = Roll(20);
if (grade == DiceGrade.) { d1 = d1 >= d2 ? d1 : d2; }
if (grade == DiceGrade.) { d1 = d1 <= d2 ? d1 : d2; }
return d1 + modifier + addValue;
}
/// <summary> Attribute规则:投4次d6,去掉最低值 </summary>
public static int RollAttribute() {
int[] rolls = { Roll(6), Roll(6), Roll(6), Roll(6) };
@@ -19,3 +26,8 @@ public static class Dice {
return rolls[1] + rolls[2] + rolls[3]; // 弃最低值
}
}
public enum DiceGrade {
= 0,
= 1,
= 2
}