Amon_PRC8/_module/nss/mengaripayload.nss

87 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
void main()
{
object oToken = GetItemPossessedBy(GetPCSpeaker(), "MengariCov");
// Get Ints from Token for Calculations
int nOldCurDwarves = GetLocalInt(oToken, "curdwarf");
int nOldCurLevel = GetLocalInt(oToken, "curlevel");
int nOldWeather = GetLocalInt(oToken, "weather");
int nOldCavein = GetLocalInt(oToken, "fitness");
int nOldHealth = GetLocalInt(oToken, "health");
int nOldMutiny = GetLocalInt(oToken, "mutiny");
int nOldFunds = GetLocalInt(oToken, "funds");
// Set Random Numbers
int nWeather = d6(1);
int nFitness = d6(1);
int nCaveInAdd = d8(1);
int nFlooding = d100(1);
int nXtraDwarves = d100(1);
int nMysContrib = d100(1);
int nHealth = (nOldHealth - nWeather + 3);
int nMutiny = d100(1);
int nCaveIn = (nOldCavein - nCaveInAdd - nOldCurLevel - nWeather + (nHealth / 10));
int nFunds = (nOldFunds - 15000);
// Update Token
SetLocalInt(oToken, "weather", nWeather);
SetLocalInt(oToken, "fitness", nFitness);
SetLocalInt(oToken, "cavein", nCaveIn);
SetLocalInt(oToken, "flooding", nFlooding);
SetLocalInt(oToken, "xtradwarves", nXtraDwarves);
SetLocalInt(oToken, "myscontrib", nMysContrib);
SetLocalInt(oToken, "mutiny", nMutiny);
SetLocalInt(oToken, "health", nHealth);
SetLocalInt(oToken, "funds", nFunds);
//check for cave in
int nCaveChance = d100(1);
if(nCaveChance <= nCaveIn)
{
SetLocalInt(oToken, "curlevel", nOldCurLevel - 1);
SetLocalInt(oToken, "CaveInEvent", 1);
}
//check for flooding
int nFloodChance = d100(1);
if(nFloodChance <= nFlooding)
{
SetLocalInt(oToken, "FloodEvent", 1);
}
//check for mutiny
if(nHealth <= 50)
{
int nMutinyChance = d8(1);
if(nMutinyChance <= nMutiny)
{
SetLocalInt(oToken, "MutinyEvent", 1);
}
}
//check for XtraDwarves
// int nCaveChance = d100(1); ALready called
if(nCaveChance <= 95)
{
SetLocalInt(oToken, "XtraDwfEvent", 1);
}
//check for Mystery Donation
// int nCaveChance = d100(1); Already called
if(nCaveChance <= 95)
{
SetLocalInt(oToken, "MysDonEvent", 1);
}
}