generated from Jaysyn/ModuleTemplate
87 lines
2.4 KiB
Plaintext
87 lines
2.4 KiB
Plaintext
/////////////////////////////////////
|
|
// Dragon's Edge
|
|
// by Charly Carlos
|
|
/////////////////////////////////////
|
|
// Chooses a die for the dealer to reroll and rerolls it
|
|
// in the Skull's Dice game.
|
|
/////////////////////////////////////
|
|
void main()
|
|
{
|
|
int nDice1 = GetLocalInt(OBJECT_SELF, "nMyDice1");
|
|
int nDice2 = GetLocalInt(OBJECT_SELF, "nMyDice2");
|
|
int nDice3 = GetLocalInt(OBJECT_SELF, "nMyDice3");
|
|
int nTotal = GetLocalInt(OBJECT_SELF, "nMyTotalDice");
|
|
int nDiceTemp;
|
|
|
|
//if the dealer is over 15 find the highest die, if not find the lowest.
|
|
if (nTotal > 15)
|
|
{
|
|
if (nDice2 > nDice1)
|
|
{
|
|
if (nDice3 > nDice2)
|
|
{
|
|
nDiceTemp = 3;
|
|
}else
|
|
{
|
|
nDiceTemp = 2;
|
|
}
|
|
}else
|
|
{
|
|
if (nDice3 > nDice1)
|
|
{
|
|
nDiceTemp = 3;
|
|
}else
|
|
{
|
|
nDiceTemp = 1;
|
|
}
|
|
}
|
|
}else
|
|
{
|
|
if (nDice2 < nDice1)
|
|
{
|
|
if (nDice3 < nDice2)
|
|
{
|
|
nDiceTemp = 3;
|
|
}else
|
|
{
|
|
nDiceTemp = 2;
|
|
}
|
|
}else
|
|
{
|
|
if (nDice3 < nDice1)
|
|
{
|
|
nDiceTemp = 3;
|
|
}else
|
|
{
|
|
nDiceTemp = 1;
|
|
}
|
|
}
|
|
}
|
|
//Reroll the proper die and save it.
|
|
if (nDiceTemp == 1)
|
|
{
|
|
nDice1 = d6();
|
|
SetLocalInt(OBJECT_SELF, "nMyDice1", nDice1);
|
|
SetLocalInt(OBJECT_SELF, "nMyTotalDice", nDice1 + nDice2 + nDice3);
|
|
SetCustomToken(611, IntToString(nDice1));
|
|
SetCustomToken(614, IntToString(nDice1 + nDice2 + nDice3));
|
|
}else
|
|
if (nDiceTemp == 2)
|
|
{
|
|
nDice2 = d6();
|
|
SetLocalInt(OBJECT_SELF, "nMyDice2", nDice2);
|
|
SetLocalInt(OBJECT_SELF, "nMyTotalDice", nDice1 + nDice2 + nDice3);
|
|
SetCustomToken(611, IntToString(nDice2));
|
|
SetCustomToken(612, IntToString(nDice1));
|
|
SetCustomToken(614, IntToString(nDice1 + nDice2 + nDice3));
|
|
}else
|
|
{
|
|
nDice3 = d6();
|
|
SetLocalInt(OBJECT_SELF, "nMyDice3", nDice3);
|
|
SetLocalInt(OBJECT_SELF, "nMyTotalDice", nDice1 + nDice2 + nDice3);
|
|
SetCustomToken(611, IntToString(nDice3));
|
|
SetCustomToken(613, IntToString(nDice1));
|
|
SetCustomToken(614, IntToString(nDice1 + nDice2 + nDice3));
|
|
}
|
|
}
|