Oh... by random spell... u literally mean a random spell from all the spells in the game? Also what is the chance of dying?
Al
def spellReadTheGrimoire(caster):
iRnd = CyGame().getSorenRandNum(100, "Read the Grimoire")
if iRnd < 20:
caster.cast(gc.getInfoTypeForString('SPELL_SUMMON_SPECTRE'))
if iRnd >= 20 and iRnd < 40:
caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_UNHOLY_TAINT'), True)
if iRnd >= 40 and iRnd < 60:
caster.cast(gc.getInfoTypeForString('SPELL_WITHER'))
if iRnd >= 60 and iRnd < 70:
caster.cast(gc.getInfoTypeForString('SPELL_SUMMON_PIT_BEAST'))
if iRnd >= 70 and iRnd < 80:
caster.cast(gc.getInfoTypeForString('SPELL_BURNING_BLOOD'))
if iRnd >= 80 and iRnd < 90:
caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON'), True)
if iRnd >= 90:
caster.kill(True, 0)
if (ePlayer != NO_PLAYER)
{
gDLL->getEventReporterIFace()->unitKilled(this, ePlayer);
if (NO_UNIT != getLeaderUnitType())
{
for (int iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
szBuffer = gDLL->getText("TXT_KEY_MISC_GENERAL_KILLED", getNameKey());
gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, GC.getEraInfo(GC.getGameINLINE().getCurrentEra()).getAudioUnitDefeatScript(), MESSAGE_TYPE_MAJOR_EVENT);
}
}
}
}
if (bDelay)
{
startDelayedDeath();
return;
}