// Script appended once to baldur*.bcs

// Blocks needed to spot regular thieves: we have to change the
// trueclass thieves to something else, immediately.
// The regular kit checks wouldn't serve otherwise, as "trueclass"
// is appliable to *any* class.

IF
	Kit(Player%i%,TRUECLASS)
	OR(3)
		Class(Player%i%,THIEF)
		Class(Player%i%,CLERIC_THIEF)
		Class(Player%i%,FIGHTER_THIEF)
THEN
	RESPONSE #100
		ActionOverride(Player%i%,AddKit(trueres))
END

IF
	Kit(Player%i%,TRUECLASS)
	Class(Player%i%,MAGE)
THEN
	RESPONSE #100
		ActionOverride(Player%i%,AddKit(magetw))
END

// The following globals are used by the checks below.
// Each is reset when the relative party member leaves.
// Maybe they don't grant complete cases coverage , but I'm 
// *quite sure they do*, since new comers get always the  
// last number, which must be free.
// More likely some NPCs could gain a few useless effects
// (totally unharmful for them!) after some nasty party
// reforming combos.
 
IF
	!InParty(Player%i%)
	Global("USSCBloc%i%","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobal("USSCBloc%i%","GLOBAL",0)
END

// Scripts used to "grey" the Use Scrolls and Scribe Scrolls icons 
// for Wizardslayers dualled to thieves. They won't be allowed
// to use magery.
IF
	Kit(Player%i%,WIZARDSLAYER)
	Global("USSCBloc%i%","GLOBAL",0)
	OR(2)
		Class(Player%i%,THIEF)
		Class(Player%i%,FIGHTER_THIEF)
THEN
	RESPONSE #100
		SetGlobal("USSCBloc%i%","GLOBAL",1)
		ApplySpellRES("LI#BLWS",Player%i%) // No such index
END

// Scripts used to "grey" the Use Scrolls icon for mages 
// dualled to thieves. They "know the ability" already!
IF
	OR(2)
		Class(Player%i%,THIEF)
		Class(Player%i%,MAGE_THIEF)
	Global("USSCBloc%i%","GLOBAL",0)
	OR(%numberofmagekits%)
		Kit(Player%i%,magetw)
		Kit(Player%i%,MAGESCHOOL_ABJURER)
		Kit(Player%i%,MAGESCHOOL_CONJURER)
		Kit(Player%i%,MAGESCHOOL_DIVINER)
		Kit(Player%i%,MAGESCHOOL_ENCHANTER)
		Kit(Player%i%,MAGESCHOOL_ILLUSIONIST)
		Kit(Player%i%,MAGESCHOOL_INVOKER)
		Kit(Player%i%,MAGESCHOOL_NECROMANCER)
		Kit(Player%i%,MAGESCHOOL_TRANSMUTER)
    %kitwildmage%
THEN
	RESPONSE #100
		SetGlobal("USSCBloc%i%","GLOBAL",1)
		ApplySpellRES("LI#BLMT",Player%i%) // No such index
END

// Below even race is checked, as multiclass Mage/Thieves
// will have their own table (without Use Scrolls!)
// The actions are useless if the character has dualled TO
// mage, but no harm comes from this.
IF
	Class(Player%i%,MAGE_THIEF)
	OR(2)
		Kit(Player%i%,0)
		Kit(Player%i%,TRUECLASS)
	Global("USSCBloc%i%","GLOBAL",0)
THEN
	RESPONSE #100
		SetGlobal("USSCBloc%i%","GLOBAL",1)
		ApplySpellRES("LI#BLMT",Player%i%) // No such index
END

// Scripts to disallow illusionist specific HLAs for all
// multiclassed characters who share the same tables as 
// multiclass illusionists, while not being illusionists 
// themselves... ehm! :D
// They don't really belong here, but hey!
IF
	Global("USSCBloc%i%","GLOBAL",0)
	OR(5)
	       Class(Player%i%,MAGE_THIEF)
	       Class(Player%i%,FIGHTER_MAGE)
	       Class(Player%i%,CLERIC_MAGE)
		   Class(Player%i%,FIGHTER_MAGE_THIEF)
		   Class(Player%i%,FIGHTER_MAGE_CLERIC)
        !Kit(Player%i%,MAGESCHOOL_ILLUSIONIST)
THEN
	RESPONSE #100
		SetGlobal("USSCBloc%i%","GLOBAL",1)
		ApplySpellRES("LI#BLIL",Player%i%) // No such index
END

// Bah! Needed for Shapeshifters who pick Feral Spirit 
// AND decide to dual to fighters...
IF
  Kit(Player%i%,shaptw)
  Class(Player%i%,FIGHTER)
THEN
  RESPONSE #100
    ActionOverride(Player%i%,AddKit(shaptF))
END
IF
  Kit(Player%i%,shaptF)
  Class(Player%i%,FIGHTER_DRUID)
THEN
  RESPONSE #100
    ActionOverride(Player%i%,AddKit(shaptw))
END
