public ActionResult GetStatTarget(int sportId) { var sport = DataContext.Sports.Single(x => x.Id == sportId); var statTargets = StatTarget.GetStatTargets(sport); ViewBag.SportId = sport.Id; var eventTypes = DataContext.EventTypes.Where(x => x.SportId == sportId && !x.IsSystemEventType).ToList(); ViewBag.EventTypes = eventTypes; return(PartialView("_StatTarget", statTargets)); }
public int this[StatTarget stat] { get { if (stat == StatTarget.HP) { return(this.baseStat[stat]); } int mod = this._mod[(int)stat]; int baz = this.baseStat[stat]; // base stats double r = baz + (stat == this._evDist.ev1 || stat == this._evDist.ev2 ? 63 : 0); // EVs r = (int)(r * (this._nature.up == stat ? 1.1 : this._nature.down == stat ? .9 : 1)); // nature if (this.Status == Status.Paralysis && stat == StatTarget.Speed) //Paralysis { r = (int)(r * 0.5); } return((int)(r * (mod < 0 ? 1 / (1 - .5 * mod) : 1 + .5 * mod))); // modif } set // e.g.: shif gears -> pok[StatTarget] = 2 --> actualy does +2 { if (this.ability.id == 48) //ContraryExeption { if (value == 0) { this._mod[(int)stat] = 0; } else if (-7 < this._mod[(int)stat] + value && this._mod[(int)stat] + value < 7) { this._mod[(int)stat] -= value; } } else { if (value == 0) { this._mod[(int)stat] = 0; } else if (-7 < this._mod[(int)stat] + value && this._mod[(int)stat] + value < 7) { this._mod[(int)stat] += value; } } } }
public static String ShortString(this StatTarget st) { switch (st) { case StatTarget.Attack: return("atk"); case StatTarget.Defence: return("def"); case StatTarget.AttackSpecial: return("spa"); case StatTarget.DefenceSpecial: return("spd"); case StatTarget.Speed: return("spe"); case StatTarget.HP: return("pdv"); default: return("oof"); } }
public int this[StatTarget stat] { get { return(this._stats[(int)stat]); } }
public static Sps GetSps(this StatTarget st) { return(st.IsSpecial() ? Sps.Special : st.IsPhysical() ? Sps.Physic : Sps.Stat); }
public static bool IsSpecial(this StatTarget st) { return(st == StatTarget.AttackSpecial || st == StatTarget.DefenceSpecial); }
public int GetMod(StatTarget mods) { return(this._mod[(int)mods]); }
public static bool IsPhysical(this StatTarget st) { return(st == StatTarget.Attack || st == StatTarget.Defence); }
public Nature(String up, String down) { this.up = StatTargetExtensions.Parse(up); this.down = StatTargetExtensions.Parse(down); }
public EVDist(String ev1, String ev2) { this.ev1 = StatTargetExtensions.Parse(ev1); this.ev2 = StatTargetExtensions.Parse(ev2); }