Advertisement
Krythic

Enchantment

Jul 22nd, 2020
1,257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using VoidwalkerEngine.Framework.Logic;
  7. using VoidwalkerEngine.Framework.Maths;
  8. using VoidwalkerEngine.Framework.Systems.GameProperties;
  9.  
  10. namespace VoidwalkerEngine.Framework.Systems.Enchanting
  11. {
  12.     public class Enchantment
  13.     {
  14.         public string Identifier { get; set; }
  15.         public string Name { get; set; }
  16.         public string Description { get; set; }
  17.         public string Family { get; set; }
  18.         public Range LevelBracket { get; set; }
  19.         public int Frequency { get; set; }
  20.  
  21.         public bool IsLearnable { get; set; }
  22.         public bool IsRemovable { get; set; }
  23.         public bool IsSpawnable { get; set; }
  24.         /// <summary>
  25.         /// The Sorting Priority of this enchantment.
  26.         /// </summary>
  27.         public EnchantmentPriority Priority { get; set; }
  28.         public List<ItemType> Constraints { get; set; }
  29.         public List<GameProperty> Properties { get; set; }
  30.  
  31.         public Enchantment()
  32.         {
  33.             this.Constraints = new List<ItemType>();
  34.             this.Properties = new List<GameProperty>();
  35.         }
  36.  
  37.         public Enchantment MakeCopy()
  38.         {
  39.             Enchantment copy = new Enchantment();
  40.             copy.Copy(this);
  41.             return copy;
  42.         }
  43.  
  44.         public void Copy(Enchantment other)
  45.         {
  46.             this.Identifier = other.Identifier;
  47.             this.Name = other.Name;
  48.             this.Description = other.Description;
  49.             this.LevelBracket = other.LevelBracket;
  50.             this.Frequency = other.Frequency;
  51.             this.IsLearnable = other.IsLearnable;
  52.             this.IsSpawnable = other.IsSpawnable;
  53.             this.Priority = other.Priority;
  54.             this.IsRemovable = other.IsRemovable;
  55.             this.Constraints = other.Constraints.ToList();
  56.             this.Properties ??= new List<GameProperty>();
  57.             this.Properties.Clear();
  58.             foreach (GameProperty effect in other.Properties)
  59.             {
  60.                 this.Properties.Add(effect.MakeCopy());
  61.             }
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement