private Spell onlyPrimary(AttributeTag primary) {
			switch (Extensions.StringToSchool(primary.Name)) {
			case School.Death:
				return getNecromancer (primary.Value);
			case School.Fire:
				return getPyromancer(primary.Value);
			case School.Life:
				return getCleric (primary.Value);
			case School.Water:
				return getHydromancer (primary.Value);
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given school " + primary);
		}
Exemplo n.º 2
0
        public Item(Item clonedFrom) : this(clonedFrom.ItemName, clonedFrom.Description,
                                            clonedFrom.Value, clonedFrom.Type, clonedFrom.maxStackSize, clonedFrom.Id, null)
        {
            this.icon   = clonedFrom.icon;
            this.prefab = clonedFrom.prefab;

            var attrs = new AttributeTag[clonedFrom.Attributes.Length];

            //Clone attributes
            for (int i = 0; i < clonedFrom.Attributes.Length; i++)
            {
                attrs [i] = new AttributeTag(clonedFrom.Attributes [i]);
            }
            Attributes = attrs;

            if (prefab != null)
            {
                var inGame = prefab.GetComponent <Assets.Scripts.Weapon.Displayable> ();
                inGame.RegisterToItemID(Id);
            }
        }
		public Spell GetSpellFromCrystal(AttributeTag[] twoBestSchools) {
			//There are no points in any schools on the crystal, just return null.
			if (twoBestSchools [0] == null && twoBestSchools [1] == null) {
				return null;
			}
				
			if (twoBestSchools[1] == null){
				return onlyPrimary (twoBestSchools[0]);
			}

			switch (Extensions.StringToSchool( twoBestSchools[0].Name )) {
			case School.Death:
				return deathPrimary (twoBestSchools[0], twoBestSchools[1]);
			case School.Fire:
				return firePrimary (twoBestSchools[0], twoBestSchools[1]);
			case School.Life:
				return lifePrimary (twoBestSchools[0], twoBestSchools[1]);
			case School.Water:
				return waterPrimary (twoBestSchools[0], twoBestSchools[1]);
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given schools " + twoBestSchools[0] + " and " + twoBestSchools[1]);
		}
		private Spell waterPrimary(AttributeTag primary, AttributeTag secondary) {
			byte sum = (byte) (primary.Value + secondary.Value);
			switch (Extensions.StringToSchool(secondary.Name)) {
			case School.Death:
				return getIcelord (sum);
			case School.Fire:
				return getSteam (sum);
			case School.Life:
				throw new NotImplementedException ("This specialization is yet to be added.");
			default:
				break;
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given schools " + primary + " and " + secondary);
		}
		private Spell lifePrimary(AttributeTag primary, AttributeTag secondary) {
			byte sum = (byte) (primary.Value + secondary.Value);
			switch (Extensions.StringToSchool(secondary.Name)) {
			case School.Death:
				return getVampire (sum);
			case School.Fire:
				return getPhoenix (sum);
			case School.Water:
				throw new NotImplementedException ("This specialization is yet to be added");
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given schools " + primary + " and " + secondary);
		}
		private Spell firePrimary(AttributeTag primary, AttributeTag secondary) {
			byte sum = (byte) (primary.Value + secondary.Value);
			switch (Extensions.StringToSchool(secondary.Name)) {
			case School.Death:
				return getVolcano (sum);
			case School.Life:
				return getPhoenix (sum);
			case School.Water:
				return getSteam (sum);
			default:
				break;
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given schools " + primary + " and " + secondary);
		}
		private Spell deathPrimary(AttributeTag primary, AttributeTag secondary) {
			int sum = (byte) (primary.Value + secondary.Value);
			switch (Extensions.StringToSchool(secondary.Name)) {
			case School.Fire:
				return getVolcano (sum);
			case School.Life:
				return getVampire (sum);
			case School.Water:
				return getIcelord (sum);
			}

			throw new InvalidOperationException ("Could not find a spell fitting to the given schools " + primary + " and " + secondary);
		}
Exemplo n.º 8
0
		public Item (Item clonedFrom) : this(clonedFrom.ItemName, clonedFrom.Description, 
			clonedFrom.Value, clonedFrom.Type, clonedFrom.maxStackSize, clonedFrom.Id, null) 
		{
			this.icon = clonedFrom.icon;
			this.prefab = clonedFrom.prefab;

			var attrs = new AttributeTag[clonedFrom.Attributes.Length];
			//Clone attributes
			for (int i = 0; i < clonedFrom.Attributes.Length; i++) {
				attrs [i] = new AttributeTag (clonedFrom.Attributes [i]);
			}
			Attributes = attrs;

			if (prefab != null) {
				var inGame = prefab.GetComponent<Assets.Scripts.Weapon.Displayable> ();
				inGame.RegisterToItemID (Id);
			}
		}
Exemplo n.º 9
0
		public Item(string name, string desc, int value, ItemType type, int maxStack, int id, AttributeTag[] attrs) {
			ItemName = name;
			Id = id;
			Description = desc;
			Value = value;
			Type = type;
			maxStackSize = maxStack;
			Attributes = attrs;
		}
Exemplo n.º 10
0
		public AttributeTag(AttributeTag clonedFrom) {
			Name = clonedFrom.Name;
			Value = clonedFrom.Value;
		}
Exemplo n.º 11
0
 public AttributeTag(AttributeTag clonedFrom)
 {
     Name  = clonedFrom.Name;
     Value = clonedFrom.Value;
 }