Beispiel #1
0
    public void InitiateSpell(JSONObject spellObject)
    {
        mName   = spellObject.GetString("name");
        mSchool = (MagicSchool)spellObject.GetNumber("school");
        JSONArray classes = spellObject.GetArray("classes");

        foreach (var val in classes)
        {
            SpellAttribute attribute = new SpellAttribute();
            attribute.attribute      = Attribute.Class;
            attribute.attributeValue = (int)val.Obj.GetNumber("class");
            attribute.rank           = (int)val.Obj.GetNumber("rank");
            mClasses.Add(attribute);
        }
        JSONArray domains = spellObject.GetArray("domains");

        foreach (var val in domains)
        {
            SpellAttribute attribute = new SpellAttribute();
            attribute.attribute      = Attribute.Domain;
            attribute.attributeValue = (int)val.Obj.GetNumber("domain");
            attribute.rank           = (int)val.Obj.GetNumber("rank");
            mDomains.Add(attribute);
        }
    }
Beispiel #2
0
    private void AdjustSpell(SpellAttribute attr, int delta)
    {
        if (Spell == null)
        {
            return;
        }

        Spell.AdjustAttribute(attr, delta);
    }
Beispiel #3
0
    public bool AdjustAttribute(SpellAttribute attribute, int power)
    {
        if (attribute == SpellAttribute.None)
        {
            throw new System.ArgumentException("Adjusted attribute cannot be 'None'.");
        }

        return(AdjustAttributeCore(attribute, power));
    }
 //Helper function whose purpose is to make the constructor is more readable
 private static List <RuneEnergy> EnergiesFromType(SpellAttribute type)
 {
     if (!type.IsElemental())
     {
         throw new System.Exception("type.IsElemental() must be true");
     }
     return(new List <RuneEnergy>()
     {
         new RuneEnergy(type, 10),
         new RuneEnergy(SpellAttribute.Power, 10),
         new RuneEnergy(SpellAttribute.Stability, -10)
     });
 }
Beispiel #5
0
    protected override bool AdjustAttributeCore(SpellAttribute attribute, int power)
    {
        switch (attribute)
        {
        case SpellAttribute.Force:
            splash.Value += power;
            chill.Value  += power;
            break;

        default:
            return(false);
        }

        return(true);
    }
Beispiel #6
0
    protected override bool AdjustAttributeCore(SpellAttribute attribute, int power)
    {
        //Adjust SpellStats based on attribute and power.
        switch (attribute)
        {
        case SpellAttribute.Force:
            chain.Value += power;
            break;

        case SpellAttribute.Skill:
            cooldown.Value -= power;
            break;

        default:
            return(false);
        }
        return(true);
    }
Beispiel #7
0
 public void Deserialize(JSONObject obj)
 {
     mName    = obj.GetString("name");
     mSchool  = (MagicSchool)obj.GetNumber("school");
     mClasses = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("classes"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = Attribute.Class;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("class");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
     mDomains = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("domains"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = Attribute.Domain;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("domain");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
 }
Beispiel #8
0
 public BasicRune(uint id, SpellAttribute type, string name)
     : base(id, new List <RuneEnergy>() { new RuneEnergy(type, 10) })
 {
     Name = name;
 }
Beispiel #9
0
 protected override bool AdjustAttributeCore(SpellAttribute attribute, int power)
 {
     Debug.LogWarning("TODO: GravityBall spell does not have adjustable attributes.");
     return(false);
 }
 public static bool IsElemental(this SpellAttribute attr)
 {
     return(attr == Fire || attr == Ice || attr == Volt);
 }
Beispiel #11
0
 public RuneEnergy(SpellAttribute attr, int energy)
 {
     this.attr   = attr;
     this.energy = energy;
 }
Beispiel #12
0
 protected abstract bool AdjustAttributeCore(SpellAttribute attribute, int power);
 public UnstableRune(uint id, SpellAttribute type, string name) : base(id, EnergiesFromType(type))
 {
     Name = name;
 }