<NME> a_ward_trap.cs
<BEF> ﻿using UnityEngine;
using System.Collections;

public class a_ward_trap : trap_base
{
    //?
    /*
	 * Magic ward traps.
	 * NPC collides with one it will set off a spell property object.
	 */

    public SpellProp spellprop;//The spell properties of the ward.
    public bool CanHitPlayer = true;
    protected override void Start()
    {
        base.Start();
        this.gameObject.layer = LayerMask.NameToLayer("Ward");
        BoxCollider bx = this.gameObject.GetComponent<BoxCollider>();
        if (bx == null)
        {
            bx = this.gameObject.AddComponent<BoxCollider>();
        }

			if (npc!=null)//Has the collision hit an npc
			{
					spellprop.init();
					if(spellprop.BaseDamage!=0)
					{
							npc.ApplyAttack(spellprop.BaseDamage);
					}
					spellprop.onImpact(npc.transform);
					spellprop.onHit(npc.gameObject.GetComponent<ObjectInteraction>());
					Destroy (this.gameObject);
			}
			else
			{
                                break;
                            }
                        case 415://tym trap
                            {
                                SpellProp_Tym spty = new SpellProp_Tym();
                                spty.init(SpellEffect.UW2_Spell_Effect_Paralyze, UWCharacter.Instance.gameObject);
                                spellprop = spty;
                                break;
                            }
                        default:
                            Debug.Log("unimplemented ward trap type " + item_id);
                            break;
                    }
                    break;
                }
            default://UW1 rune of warding
                {
                    SpellProp_RuneOfWarding spIJ = new SpellProp_RuneOfWarding();//myObj.AddComponent<SpellProp_RuneOfWarding>();
                    spIJ.init(SpellEffect.UW1_Spell_Effect_RuneofWarding, UWCharacter.Instance.gameObject);
                    spellprop = spIJ;
                    CanHitPlayer = false;
                    break;
                }
        }

    }

    void OnTriggerEnter(Collider other)
    {
        //Get the NPC that hit the ward
        NPC npc = other.gameObject.GetComponent<NPC>();

        if (npc != null)//Has the collision hit an npc
        {
            if (spellprop.BaseDamage != 0)
            {
                npc.ApplyAttack(spellprop.BaseDamage);
            }
            spellprop.onImpact(npc.transform);
            spellprop.onHit(npc.gameObject.GetComponent<ObjectInteraction>());
            objInt().consumeObject();
        }
        else
        {
            if (other.gameObject.GetComponent<UWCharacter>() )
            {
                if (CanHitPlayer)
                {
                    if (spellprop.BaseDamage != 0)
                    {
                        UWCharacter.Instance.ApplyDamage(spellprop.BaseDamage);
                    }
                    spellprop.onHitPlayer();
                    objInt().consumeObject();
                }
            }
            else
            {
                if (_RES == GAME_UW2)
                {//An object has been thrown at the trap to consume it.
                    objInt().consumeObject();
                }
            }
        }

    }
}

<MSG> More sensible naming of spell property files.
Moved spell property values from magic.cs into the various spell properties objects
Combined some duplicate magic spells and effects
<DFF> @@ -23,14 +23,14 @@ public class a_ward_trap : trap_base {
 
 			if (npc!=null)//Has the collision hit an npc
 			{
-					spellprop.init();
-					if(spellprop.BaseDamage!=0)
-					{
-							npc.ApplyAttack(spellprop.BaseDamage);
-					}
-					spellprop.onImpact(npc.transform);
-					spellprop.onHit(npc.gameObject.GetComponent<ObjectInteraction>());
-					Destroy (this.gameObject);
+				spellprop.init(SpellEffect.UW1_Spell_Effect_RuneofWarding);
+				if(spellprop.BaseDamage!=0)
+				{
+						npc.ApplyAttack(spellprop.BaseDamage);
+				}
+				spellprop.onImpact(npc.transform);
+				spellprop.onHit(npc.gameObject.GetComponent<ObjectInteraction>());
+				Destroy (this.gameObject);
 			}
 			else
 			{

More sensible naming of spell property files. Moved spell property values from magic.cs into the various spell properties objects Combined some duplicate magic spells and effects