Ejemplo n.º 1
0
 static void Main()
 {
     using (var db = new HeroContext())
     {
         var axe = new HeroModel()
         {
             Name = "Axe",
             AdditionalAgility      = 0,
             AdditionalIntellegence = 0,
             AdditionalStrength     = 0,
             BaseAgility            = 0,
             BaseArmor              = 0,
             BaseAttack             = 0,
             BaseAttackInterval     = 0,
             BaseAttackRange        = 0,
             BaseDayVision          = 0,
             BaseHealth             = 0,
             BaseHealthRegeneration = 0,
             BaseIntellegence       = 0,
             BaseMagicResistance    = 25,
             BaseMana             = 0,
             BaseManaRegeneration = 0,
             BaseMoveSpeed        = 0,
             BaseNightVision      = 0,
             BaseStrength         = 0,
             BaseTurnSpeed        = 0,
             IsMeleeAttack        = true,
             MainAttribute        = HeroAttributeType.Str,
             Roles = HeroRole.Disabler | HeroRole.Initiator | HeroRole.Jungler | HeroRole.Durabler
         };
         db.Heroes.Add(axe);
         db.SaveChanges();
     }
     Console.ReadLine();
 }
Ejemplo n.º 2
0
 public int GetHeroMaxLevelAttribute(HeroModel hero, HeroAttributeType attr)
 {
     if (attr == HeroAttributeType.Str)
     {
         return((int)(hero.BaseStrength + (hero.AdditionalStrength * (GameConstantes.HERO_MAX_LEVEL - 1))));
     }
     else if (attr == HeroAttributeType.Agi)
     {
         return((int)(hero.BaseAgility + (hero.AdditionalAgility * (GameConstantes.HERO_MAX_LEVEL - 1))));
     }
     else if (attr == HeroAttributeType.Int)
     {
         return((int)(hero.BaseIntellegence + (hero.AdditionalIntellegence * (GameConstantes.HERO_MAX_LEVEL - 1))));
     }
     throw new Exception("Unknown hero attribute");
 }
Ejemplo n.º 3
0
 public int GetHeroAttributeInLevel(HeroModel hero, HeroAttributeType attr, int lvl)
 {
     if (lvl < 1)
     {
         return(0);
     }
     if (attr == HeroAttributeType.Str)
     {
         return((lvl == 1) ? hero.BaseStrength : (int)(hero.BaseStrength + (hero.AdditionalStrength * (lvl - 1))));
     }
     else if (attr == HeroAttributeType.Agi)
     {
         return((lvl == 1) ? hero.BaseAgility : (int)(hero.BaseAgility + (hero.AdditionalAgility * (lvl - 1))));
     }
     else if (attr == HeroAttributeType.Int)
     {
         return((lvl == 1) ? hero.BaseIntellegence : (int)(hero.BaseIntellegence + (hero.AdditionalIntellegence * (lvl - 1))));
     }
     throw new Exception("Unknown hero attribute");
 }