parameters: ()
return_statement: return
docstring: Prepares a spell to be cast.
docstring_summary: Prepares a spell to be cast.
docstring_tokens: Prepares a spell to be cast .
function: def SpellPressed ():
  	"""Prepares a spell to be cast."""
  
  	pc = GemRB.GameGetFirstSelectedActor ()
  
  	Spell = GemRB.GetVar ("Spell")
  	Type = GemRB.GetVar ("Type")
  
  	if Type == 1 << IE_IWD2_SPELL_SONG or Type == 1 << IE_SPELL_TYPE_SONG:
  		SelectBardSong (Spell)
  		ActionBardSongPressed()
  		return
  
  	GemRB.GameControlSetTargetMode (TARGET_MODE_CAST)
  	if Type != -1:
  		Type = Spell // 1000
  	Spell = Spell % 1000
  	slot = GemRB.GetVar ("QSpell")
  	if slot>=0:
  		#setup quickspell slot
  		#if spell has no target, return
  		#otherwise continue with casting
  		Target = GemRB.SetupQuickSpell (pc, slot, Spell, Type)
  		#sabotage the immediate casting of self targeting spells
  		if Target == 5 or Target == 7:
  			Type = -1
  			GemRB.GameControlSetTargetMode (TARGET_MODE_NONE)
  
  	if Type==-1:
  		GemRB.SetVar ("ActionLevel", UAW_STANDARD)
  		GemRB.SetVar("Type", 0)
  	GemRB.SpellCast (pc, Type, Spell)
  	if GemRB.GetVar ("Type")!=-1:
  		GemRB.SetVar ("ActionLevel", UAW_STANDARD)
  		#init spell list
  		GemRB.SpellCast (pc, -1, 0)
  	GemRB.SetVar ("TopIndex", 0)
  	UpdateActionsWindow ()
  	return
function_tokens: def SpellPressed ( ) : pc = GemRB . GameGetFirstSelectedActor ( ) Spell = GemRB . GetVar ( "Spell" ) Type = GemRB . GetVar ( "Type" ) if Type == 1 << IE_IWD2_SPELL_SONG or Type == 1 << IE_SPELL_TYPE_SONG : SelectBardSong ( Spell ) ActionBardSongPressed ( ) return GemRB . GameControlSetTargetMode ( TARGET_MODE_CAST ) if Type != - 1 : Type = Spell // 1000 Spell = Spell % 1000 slot = GemRB . GetVar ( "QSpell" ) if slot >= 0 : #setup quickspell slot #if spell has no target, return #otherwise continue with casting Target = GemRB . SetupQuickSpell ( pc , slot , Spell , Type ) #sabotage the immediate casting of self targeting spells if Target == 5 or Target == 7 : Type = - 1 GemRB . GameControlSetTargetMode ( TARGET_MODE_NONE ) if Type == - 1 : GemRB . SetVar ( "ActionLevel" , UAW_STANDARD ) GemRB . SetVar ( "Type" , 0 ) GemRB . SpellCast ( pc , Type , Spell ) if GemRB . GetVar ( "Type" ) != - 1 : GemRB . SetVar ( "ActionLevel" , UAW_STANDARD ) #init spell list GemRB . SpellCast ( pc , - 1 , 0 ) GemRB . SetVar ( "TopIndex" , 0 ) UpdateActionsWindow ( ) return