mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-09-28 15:55:34 +00:00
27 lines
497 B
Java
27 lines
497 B
Java
|
package com.bytezone.diskbrowser.wizardry;
|
||
|
|
||
|
class Dice
|
||
|
{
|
||
|
int qty;
|
||
|
int sides;
|
||
|
int bonus;
|
||
|
|
||
|
public Dice (byte[] buffer, int offset)
|
||
|
{
|
||
|
qty = buffer[offset];
|
||
|
sides = buffer[offset + 2];
|
||
|
bonus = buffer[offset + 4];
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String toString ()
|
||
|
{
|
||
|
if (qty == 0)
|
||
|
return "";
|
||
|
StringBuilder text = new StringBuilder ();
|
||
|
text.append (String.format ("%dd%d", qty, sides));
|
||
|
if (bonus > 0)
|
||
|
text.append ("+" + bonus);
|
||
|
return text.toString ();
|
||
|
}
|
||
|
}
|