示例#1
0
 /// <summary>
 /// Casts Magic Arrow/Missile
 /// </summary>
 /// <param name="caster">Caster.</param>
 /// <param name="Ready">If set to <c>true</c> ready.</param>
 /// <param name="EffectID">Effect ID of the spell</param>
 void Cast_OrtJux(GameObject caster, bool Ready, int EffectID)
 {
     //Magic Missile Spell
             if (Ready==true)
             {//Ready the spell to be cast.
                     ReadiedSpell= "Ort Jux";
                     UWHUD.instance.CursorIcon=UWHUD.instance.CursorIconTarget;
             }
             else
             {
                     SpellProp_MagicArrow spOJ =new SpellProp_MagicArrow();
                     spOJ.init (EffectID,caster);
                     CastProjectile(caster, (SpellProp)spOJ);
             }
 }
示例#2
0
    /// <summary>
    /// Casts the enchantment based on the spell rules, targets and ready state
    /// </summary>
    /// <returns>The enchantment applied</returns>
    /// <param name="caster">Caster.</param>
    /// <param name="target">Target.</param>
    /// <param name="EffectID">Effect ID of the spell</param>
    /// <param name="ready">If set to <c>true</c> ready.</param>
    /// <param name="SpellRule">Spell rule to apply.</param>
    /// Spells cast from anything that carries and enchantment.
    public SpellEffect CastEnchantment(GameObject caster, GameObject target, int EffectID, bool ready, int SpellRule)
    {
        //Eventually casts spells from things like fountains, potions, enchanted weapons.
            //TODO: The switch statement may need to be further divided because of passive/active effects.
            //TODO: this list may be incomplete. I need to include things from my spreadsheet that are not status effects.
            //UWCharacter playerUW = caster.GetComponent<UWCharacter>();
            int ActiveArrayIndex=-1;
            int PassiveArrayIndex=-1;
            int SpellResultType= SpellResultNone;//0=no spell effect, 1= passive spell effect, 2= active spell effect.
            SpellEffect[] other=null;

            if (SpellRule!=SpellRule_TargetVector)
            {
                    ActiveArrayIndex= playerUW.PlayerMagic.CheckActiveSpellEffect(caster);
                    PassiveArrayIndex= playerUW.PlayerMagic.CheckPassiveSpellEffectPC(caster);

                    if (target!=null)
                    {
                            PassiveArrayIndex=CheckPassiveSpellEffectNPC(target);//Was other.
                            if (target.GetComponent<NPC>()!=null)
                            {
                                    other= target.GetComponent<NPC>().NPCStatusEffects;
                            }
                    }
            }

            switch (EffectID)
            {

                case SpellEffect.UW1_Spell_Effect_LesserHeal:
                case SpellEffect.UW1_Spell_Effect_LesserHeal_alt01:
                case SpellEffect.UW1_Spell_Effect_LesserHeal_alt02:
                case SpellEffect.UW1_Spell_Effect_LesserHeal_alt03:
                case SpellEffect.UW1_Spell_Effect_Heal:
                case SpellEffect.UW1_Spell_Effect_Heal_alt01:
                case SpellEffect.UW1_Spell_Effect_Heal_alt02:
                case SpellEffect.UW1_Spell_Effect_Heal_alt03:
                case SpellEffect.UW1_Spell_Effect_EnhancedHeal:
                case SpellEffect.UW1_Spell_Effect_EnhancedHeal_alt01:
                case SpellEffect.UW1_Spell_Effect_EnhancedHeal_alt02:
                case SpellEffect.UW1_Spell_Effect_EnhancedHeal_alt03:
                case SpellEffect.UW1_Spell_Effect_GreaterHeal:
                case SpellEffect.UW1_Spell_Effect_GreaterHeal_alt01:
                case SpellEffect.UW1_Spell_Effect_GreaterHeal_alt02:
                case SpellEffect.UW1_Spell_Effect_GreaterHeal_alt03:
                case SpellEffect.UW1_Spell_Effect_LesserHeal_alt04:
                case SpellEffect.UW1_Spell_Effect_Heal_alt04:
                case SpellEffect.UW1_Spell_Effect_GreaterHeal_alt04:
                        //Only ever heal the player
                        Cast_Heal (caster,EffectID);//Get seperate values;
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_ManaBoost:
                case SpellEffect.UW1_Spell_Effect_ManaBoost_alt01:
                case SpellEffect.UW1_Spell_Effect_ManaBoost_alt02:
                case SpellEffect.UW1_Spell_Effect_ManaBoost_alt03:
                case SpellEffect.UW1_Spell_Effect_ManaBoost_alt04:
                case SpellEffect.UW1_Spell_Effect_RestoreMana_alt04:
                case SpellEffect.UW1_Spell_Effect_IncreaseMana:
                case SpellEffect.UW1_Spell_Effect_IncreaseMana_alt01:
                case SpellEffect.UW1_Spell_Effect_IncreaseMana_alt02:
                case SpellEffect.UW1_Spell_Effect_IncreaseMana_alt03:
                case SpellEffect.UW1_Spell_Effect_RegainMana:
                case SpellEffect.UW1_Spell_Effect_RegainMana_alt01:
                case SpellEffect.UW1_Spell_Effect_RegainMana_alt02:
                case SpellEffect.UW1_Spell_Effect_RegainMana_alt03:
                case SpellEffect.UW1_Spell_Effect_RestoreMana:
                case SpellEffect.UW1_Spell_Effect_RestoreMana_alt01:
                case SpellEffect.UW1_Spell_Effect_RestoreMana_alt02:
                case SpellEffect.UW1_Spell_Effect_RestoreMana_alt03:
                        //Only ever regen the player
                        Cast_Mana(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_Darkness:
                case SpellEffect.UW1_Spell_Effect_BurningMatch:
                case SpellEffect.UW1_Spell_Effect_Candlelight:
                case SpellEffect.UW1_Spell_Effect_Light:
                case SpellEffect.UW1_Spell_Effect_Daylight:
                case SpellEffect.UW1_Spell_Effect_Sunlight:

                        //These need to have different values. Create a system of unique values array(?)
                        //Only the player needs light.
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Light(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;

                case SpellEffect.UW1_Spell_Effect_MagicLantern:
                case SpellEffect.UW1_Spell_Effect_Light_alt01:
                case SpellEffect.UW1_Spell_Effect_Daylight_alt01:
                case SpellEffect.UW1_Spell_Effect_Light_alt02:
                case SpellEffect.UW1_Spell_Effect_Daylight_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Light(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;

                case SpellEffect.UW1_Spell_Effect_Leap:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Leap(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                        }
                        SpellResultType=SpellResultPassive;
                        break;
                case SpellEffect.UW1_Spell_Effect_Leap_alt01:
                case SpellEffect.UW1_Spell_Effect_Leap_alt02:
                        //TODO: Find out which one of these is a magic ring effect!
                        //Player only
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Leap(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;

                case SpellEffect.UW1_Spell_Effect_SlowFall:
                        //Player only
                        if (ActiveArrayIndex!=-1)
                        {
                            Cast_SlowFall(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                            SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_SlowFall_alt01:
                case SpellEffect.UW1_Spell_Effect_SlowFall_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                            Cast_SlowFall(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                            SpellResultType=SpellResultPassive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Levitate:
                case SpellEffect.UW1_Spell_Effect_Fly:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Levitate(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Fly_alt01:
                case SpellEffect.UW1_Spell_Effect_Levitate_alt01:
                case SpellEffect.UW1_Spell_Effect_Levitate_alt02:
                case SpellEffect.UW1_Spell_Effect_Fly_alt02:
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Levitate(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_WaterWalk:
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_WaterWalk(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_WaterWalk_alt01:
                case SpellEffect.UW1_Spell_Effect_WaterWalk_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_WaterWalk(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;

                case SpellEffect.UW1_Spell_Effect_ResistBlows:
                case SpellEffect.UW1_Spell_Effect_ThickSkin:
                case SpellEffect.UW1_Spell_Effect_IronFlesh:
                        {
                                if (PassiveArrayIndex!=-1)
                                {
                                        Cast_Resistance(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                        SpellResultType=SpellResultPassive;
                                }

                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_ResistBlows_alt01:
                case SpellEffect.UW1_Spell_Effect_ThickSkin_alt01:
                case SpellEffect.UW1_Spell_Effect_IronFlesh_alt01:
                case SpellEffect.UW1_Spell_Effect_ResistBlows_alt02:
                case SpellEffect.UW1_Spell_Effect_ThickSkin_alt02:
                case SpellEffect.UW1_Spell_Effect_IronFlesh_alt02:
                        {
                                if (ActiveArrayIndex!=-1)
                                {
                                        Cast_Resistance(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                        SpellResultType=SpellResultActive;
                                }
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_Stealth:
                case SpellEffect.UW1_Spell_Effect_Conceal:
                case SpellEffect.UW1_Spell_Effect_Invisibilty:
                        //PLayer only
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Stealth(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Stealth_alt01:
                case SpellEffect.UW1_Spell_Effect_Conceal_alt01:
                case SpellEffect.UW1_Spell_Effect_Stealth_alt02:
                case SpellEffect.UW1_Spell_Effect_Conceal_alt02:
                case SpellEffect.UW1_Spell_Effect_Invisibility_alt01:
                case SpellEffect.UW1_Spell_Effect_Invisibility_alt02:
                        //PLayer only
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Stealth(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;
                        //Missiles
                case SpellEffect.UW1_Spell_Effect_MissileProtection:
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_ResistanceAgainstType(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_MissileProtection_alt01:
                case SpellEffect.UW1_Spell_Effect_MissileProtection_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_ResistanceAgainstType(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;

                        //Flameproof. PLayer only.
                case SpellEffect.UW1_Spell_Effect_Flameproof:
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Flameproof(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Flameproof_alt01:
                case SpellEffect.UW1_Spell_Effect_Flameproof_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Flameproof(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;
                        //Magic
                case SpellEffect.UW1_Spell_Effect_MagicProtection:
                case SpellEffect.UW1_Spell_Effect_GreaterMagicProtection:
                        //player only
                        if (PassiveArrayIndex!=-1)
                        {
                            Cast_ResistanceAgainstType(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                            SpellResultType=SpellResultPassive;
                        }

                        break;
                case SpellEffect.UW1_Spell_Effect_PoisonResistance:
                        //player only
                        Debug.Log ("Poison Resistance enchantment");
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_Speed:
                case SpellEffect.UW1_Spell_Effect_Haste:
                        //player only
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Speed(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Telekinesis:

                        //player only
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_Telekinesis(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Telekinesis_alt01:
                case SpellEffect.UW1_Spell_Effect_Telekinesis_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_Telekinesis(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;

                case SpellEffect.UW1_Spell_Effect_FreezeTime:
                        //Active variation.
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_FreezeTime(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_FreezeTime_alt01:
                case SpellEffect.UW1_Spell_Effect_FreezeTime_alt02:
                        //player only
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_FreezeTime(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        //Cast_AnTym(target,EffectID);
                    //	SpellResultType=SpellResultNone;

                        break;
                case SpellEffect.UW1_Spell_Effect_Regeneration:
                        //player only
                        Debug.Log ("Regen enchantment");
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_ManaRegeneration:
                        //player only
                        Debug.Log ("mana regen enchantment");
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_MazeNavigation:
                        //player only
                        //Debug.Log ("Maze Navigation enchantment");
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_MazeNavigation(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Hallucination:
                        //player only
                        Cast_Hallucination(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                        SpellResultType=SpellResultPassive;
                        break;
                case SpellEffect.UW1_Spell_Effect_NightVision:
                        if (ActiveArrayIndex!=-1)
                        {
                                Cast_NightVision(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultActive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_NightVision_alt01:
                case SpellEffect.UW1_Spell_Effect_NightVision_alt02:
                        if (PassiveArrayIndex!=-1)
                        {
                                Cast_NightVision(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                                SpellResultType=SpellResultPassive;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Poison:
                case SpellEffect.UW1_Spell_Effect_Poison_alt01:
                case SpellEffect.UW1_Spell_Effect_PoisonHidden:
                        //Can effect player and npc
                        switch(SpellRule)
                        {
                        case SpellRule_TargetOther:
                                if (target!=null)
                                {
                                        if (PassiveArrayIndex!=-1)
                                        {
                                                Cast_Poison (target,other,EffectID,PassiveArrayIndex);SpellResultType=SpellResultNone;
                                        }
                                }break;
                        case SpellRule_TargetSelf:
                                if (PassiveArrayIndex!=-1)
                                {
                                        Cast_Poison (caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);SpellResultType=SpellResultPassive;
                                }break;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Paralyze:
                case SpellEffect.UW1_Spell_Effect_Paralyze_alt01:
                        //Can effect player and npc
                        //TODO: does this spell work from wands and the like. If so do I need to figure out targetting.
                        //Enchantment spells come in as target self. Presumably there is one version that is player paralyzes themselves
                        //and another where it is get random target. For now paralyze self :)
                        switch(SpellRule)
                        {
                        case SpellRule_TargetOther:
                                if (target!=null)
                                {
                                        if (PassiveArrayIndex!=-1)
                                        {
                                                Cast_Paralyze (target,other,EffectID,PassiveArrayIndex);SpellResultType=SpellResultNone;
                                        }
                                }break;
                        case SpellRule_TargetSelf:
                                if (PassiveArrayIndex!=-1)
                                {
                                        Cast_Paralyze (caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);SpellResultType=SpellResultPassive;
                                }
                                break;
                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_Ally:
                case SpellEffect.UW1_Spell_Effect_Ally_alt01:
                        //NPC only
                        Cast_InManiRel(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_Confusion:
                case SpellEffect.UW1_Spell_Effect_Confusion_alt01:
                        //NPC only
                        Cast_VasAnWis(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_MinorAccuracy:
                case SpellEffect.UW1_Spell_Effect_Accuracy:
                case SpellEffect.UW1_Spell_Effect_AdditionalAccuracy:
                case SpellEffect.UW1_Spell_Effect_MajorAccuracy:
                case SpellEffect.UW1_Spell_Effect_GreatAccuracy:
                case SpellEffect.UW1_Spell_Effect_VeryGreatAccuracy:
                case SpellEffect.UW1_Spell_Effect_TremendousAccuracy:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedAccuracy:
                        //Applies to weapon only do not implement here.
                        Debug.Log ("accuracy enchantment");
                        SpellResultType=SpellResultNone;
                        break;
                case SpellEffect.UW1_Spell_Effect_MinorDamage:
                case SpellEffect.UW1_Spell_Effect_Damage:
                case SpellEffect.UW1_Spell_Effect_AdditionalDamage:
                case SpellEffect.UW1_Spell_Effect_MajorDamage:
                case SpellEffect.UW1_Spell_Effect_GreatDamage:
                case SpellEffect.UW1_Spell_Effect_VeryGreatDamage:
                case SpellEffect.UW1_Spell_Effect_TremendousDamage:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedDamage:
                        //Applies to weapon only do not implement here.
                        SpellResultType=SpellResultNone;
                        Debug.Log ("damage enchantment");
                        break;
                case SpellEffect.UW1_Spell_Effect_MinorProtection:
                case SpellEffect.UW1_Spell_Effect_Protection:
                case SpellEffect.UW1_Spell_Effect_AdditionalProtection:
                case SpellEffect.UW1_Spell_Effect_MajorProtection:
                case SpellEffect.UW1_Spell_Effect_GreatProtection:
                case SpellEffect.UW1_Spell_Effect_VeryGreatProtection:
                case SpellEffect.UW1_Spell_Effect_TremendousProtection:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedProtection:
                        //Applies to armour only do not implement here.
                        SpellResultType=SpellResultNone;
                        Debug.Log ("protection enchantment");
                        break;
                case SpellEffect.UW1_Spell_Effect_MinorToughness:
                case SpellEffect.UW1_Spell_Effect_Toughness:
                case SpellEffect.UW1_Spell_Effect_AdditionalToughness:
                case SpellEffect.UW1_Spell_Effect_MajorToughness:
                case SpellEffect.UW1_Spell_Effect_GreatToughness:
                case SpellEffect.UW1_Spell_Effect_VeryGreatToughness:
                case SpellEffect.UW1_Spell_Effect_TremendousToughness:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedToughness:
                        //Applies to armour only do not implement here.
                        SpellResultType=SpellResultNone;
                        Debug.Log ("toughness enchantment");
                        break;

                case SpellEffect.UW1_Spell_Effect_Open:
                case SpellEffect.UW1_Spell_Effect_Open_alt01:
                        //Cast spell/no spell effect
                        Cast_ExYlem(caster,ready,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_CreateFood:
                case SpellEffect.UW1_Spell_Effect_CreateFood_alt01:
                        //Cast spell/no spell effect
                        Cast_InManiYlem(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_CurePoison:
                case SpellEffect.UW1_Spell_Effect_CurePoison_alt01:
                        //Cast spell/no spell effect
                        Cast_AnNox(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_SheetLightning:
                case SpellEffect.UW1_Spell_Effect_SheetLightning_alt01:
                        if (SpellRule!=SpellRule_TargetVector)
                        {
                                Cast_VasOrtGrav(caster,EffectID);
                        }
                        else
                        {
                                SpellProp_SheetLightning spVOG =new SpellProp_SheetLightning();
                                spVOG.init (EffectID,caster);
                                CastProjectile(caster,caster.transform.forward,(SpellProp)spVOG);
                        }
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_Armageddon:
                case SpellEffect.UW1_Spell_Effect_Armageddon_alt01:
                        //Cast spell/no spell effect
                        Cast_VasKalCorp(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_GateTravel:
                case SpellEffect.UW1_Spell_Effect_GateTravel_alt01:
                        //Cast spell/no spell effect
                        Cast_VasRelPor(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_MagicArrow:
                case SpellEffect.UW1_Spell_Effect_MagicArrow_alt01:
                        if (SpellRule!=SpellRule_TargetVector)
                        {
                                Cast_OrtJux(caster,ready,EffectID);
                        }
                        else
                        {
                                SpellProp_MagicArrow spOJ =new SpellProp_MagicArrow();
                                spOJ.init (EffectID,caster);
                                CastProjectile(caster,caster.transform.forward, (SpellProp)spOJ);
                        }
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_ElectricalBolt:
                case SpellEffect.UW1_Spell_Effect_ElectricalBolt_alt01:
                        {
                                if (SpellRule!=SpellRule_TargetVector)
                                {
                                        Cast_OrtGrav(caster,ready,EffectID);
                                }
                                else
                                {
                                        SpellProp_ElectricBolt spOG =new SpellProp_ElectricBolt();
                                        spOG.init (EffectID,caster);
                                        CastProjectile(caster,caster.transform.forward, (SpellProp)spOG);
                                }
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_Fireball:
                case SpellEffect.UW1_Spell_Effect_Fireball_alt01:
                        {
                                if (SpellRule!=SpellRule_TargetVector)
                                {
                                        Cast_PorFlam(caster,ready,EffectID);
                                }
                                else
                                {
                                        SpellProp_Fireball spPF =new SpellProp_Fireball();
                                        spPF.init (EffectID,caster);
                                        spPF.caster=caster;
                                        CastProjectile(caster,caster.transform.forward, (SpellProp)spPF);
                                }
                                SpellResultType=SpellResultNone;
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_FlameWind:
                case SpellEffect.UW1_Spell_Effect_FlameWind_alt01:
                        {
                                if (SpellRule!=SpellRule_TargetVector)
                                {
                                        Cast_FlamHur(caster,EffectID);
                                }
                                else
                                {
                                        SpellProp_FlameWind spFH =new SpellProp_FlameWind();
                                        spFH.init (EffectID,caster);
                                        CastProjectile(caster,caster.transform.forward, (SpellProp)spFH);
                                }
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_RoamingSight:
                case SpellEffect.UW1_Spell_Effect_RoamingSight_alt01:
                case SpellEffect.UW1_Spell_Effect_RoamingSight_alt02:
                        {
                                Cast_RoamingSight(caster,playerUW.ActiveSpell,EffectID,ActiveArrayIndex);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_RuneofWarding:
                case SpellEffect.UW1_Spell_Effect_RuneofWarding_alt01:
                        {
                                Cast_RuneOfWarding(caster.transform.position + (transform.forward * 0.3f),EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_StrengthenDoor:
                case SpellEffect.UW1_Spell_Effect_StrengthenDoor_alt01:
                        {
                                Cast_SanctJux(caster,ready,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_Tremor:
                case SpellEffect.UW1_Spell_Effect_Tremor_alt01:
                        {
                                Cast_VasPorYlem(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_SummonMonster:
                case SpellEffect.UW1_Spell_Effect_SummonMonster_alt01:
                        {
                                Cast_KalMani(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_CauseFear:
                case SpellEffect.UW1_Spell_Effect_CauseFear_alt01:
                        {
                                Cast_QuasCorp(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }
                case SpellEffect.UW1_Spell_Effect_SmiteUndead:
                case SpellEffect.UW1_Spell_Effect_SmiteUndead_alt01:
                        {
                                Cast_AnCorpMani(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_DetectMonster:
                case SpellEffect.UW1_Spell_Effect_DetectMonster_alt01:
                        {
                                Cast_DetectMonster(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_NameEnchantment:
                case SpellEffect.UW1_Spell_Effect_NameEnchantment_alt01:
                        {
                                Cast_NameEnchantment(caster,ready,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_Curse:
                case SpellEffect.UW1_Spell_Effect_Curse_alt01:
                case SpellEffect.UW1_Spell_Effect_Curse_alt02:

                        {
                                Cast_Curse(caster,EffectID);
                                SpellResultType=SpellResultNone;
                                break;
                        }

                case SpellEffect.UW1_Spell_Effect_Cursed:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt01:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt02:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt03:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt04:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt05:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt06:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt07:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt09:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt10:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt11:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt12:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt13:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt14:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt15:
                case SpellEffect.UW1_Spell_Effect_Cursed_alt16:
                        //Affect player from cursed items
                        if (PassiveArrayIndex!=-1)
                        {
                            Cast_CursedItem(caster,playerUW.PassiveSpell,EffectID,PassiveArrayIndex);
                            SpellResultType=SpellResultPassive;

                        }
                        break;
                case SpellEffect.UW1_Spell_Effect_RemoveTrap:
                case SpellEffect.UW1_Spell_Effect_RemoveTrap_alt01:

                        /*?*/

                case SpellEffect.UW1_Spell_Effect_SetGuard://?

                        //Cursed items? Apply spell effect to playe

                case SpellEffect.UW1_Spell_Effect_Reveal_alt01:

                        /*test*/
                case SpellEffect.UW1_Spell_Effect_Reveal:

                        /*Blank*/

                case SpellEffect.UW1_Spell_Effect_MassParalyze:
                case SpellEffect.UW1_Spell_Effect_Acid_alt01:
                case SpellEffect.UW1_Spell_Effect_LocalTeleport_alt01:
                        //Cast spell/no spell effect
                        SpellResultType=SpellResultNone;
                        break;

                case SpellEffect.UW1_Spell_Effect_theFrog:
                        //Debug.Log ("The frog");
                        //PC only
                        CastTheFrog(caster,EffectID);
                        SpellResultType=SpellResultNone;
                        break;

                        //Some cutscences can be played by a spell trap these are as follows (some known cases)
                case 224:
                        //Debug.Log ("play the intro cutscene");
                        Cutscene_Intro ci = UWHUD.instance.gameObject.AddComponent<Cutscene_Intro>();
                        UWHUD.instance.CutScenesFull.cs=ci;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 225:
                        Cutscene_EndGame ce = UWHUD.instance.gameObject.AddComponent<Cutscene_EndGame>();
                        UWHUD.instance.CutScenesFull.cs=ce;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 226:
                        Cutscene_Tybal ct = UWHUD.instance.gameObject.AddComponent<Cutscene_Tybal>();
                        UWHUD.instance.CutScenesFull.cs=ct;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 227:
                        Cutscene_Arial ca = UWHUD.instance.gameObject.AddComponent<Cutscene_Arial>();
                        UWHUD.instance.CutScenesFull.cs=ca;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 233:
                        Cutscene_Splash cs = UWHUD.instance.gameObject.AddComponent<Cutscene_Splash>();
                        UWHUD.instance.CutScenesFull.cs=cs;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 234:
                        Cutscene_Credits cc = UWHUD.instance.gameObject.AddComponent<Cutscene_Credits>();
                        UWHUD.instance.CutScenesFull.cs=cc;
                        UWHUD.instance.CutScenesFull.Begin();
                        break;
                case 235:
                        Debug.Log ("Vision - IN");
                        break;
                case 236:
                        Debug.Log ("Vision - SA");
                        break;
                case 237:
                        Debug.Log ("Vision - HN");
                        break;

                default:
                        Debug.Log ("effect Id is " + EffectID);
                        SpellResultType=SpellResultNone;
                        //ActiveSpellArray[index]=caster.AddComponent<SpellEffect>();
                        break;

                }
                //Return a reference to the spell effect. If any.
                switch (SpellResultType)
                {
                case SpellResultNone://No spell effect or unimplemented spell
                        return null;
                case SpellResultPassive://Passive spell effect
                        return playerUW.PassiveSpell[PassiveArrayIndex];
                case SpellResultActive://Active spell effect
                        return playerUW.ActiveSpell[ActiveArrayIndex];
                default:
                        return null;
                }
    }