コード例 #1
0
ファイル: Warrior.cs プロジェクト: maldon/ClassicCraft
        public override void PrepFight()
        {
            base.PrepFight();

            ww   = new Whirlwind(this);
            bt   = new Bloodthirst(this);
            hs   = new HeroicStrike(this);
            exec = new Execute(this);
            br   = new Bloodrage(this);
            bs   = new BattleShout(this);
            ham  = new Hamstring(this);
            slam = new Slam(this);

            HasteMod = CalcHaste();

            if (Cooldowns != null)
            {
                foreach (string s in Cooldowns)
                {
                    switch (s)
                    {
                    case "Death Wish": cds.Add(new DeathWish(this), DeathWishBuff.LENGTH); break;

                    case "Juju Flurry": cds.Add(new JujuFlurry(this), JujuFlurryBuff.LENGTH); break;

                    case "Mighty Rage": cds.Add(new MightyRage(this), MightyRageBuff.LENGTH); break;

                    case "Recklessness": cds.Add(new Recklessness(this), RecklessnessBuff.LENGTH); break;

                    case "Racial":
                        if (Race == Races.Orc)
                        {
                            cds.Add(new BloodFury(this), BloodFuryBuff.LENGTH);
                        }
                        else if (Race == Races.Troll)
                        {
                            cds.Add(new Berserking(this), BerserkingBuff.LENGTH);
                        }
                        break;
                    }
                }
            }

            if (GetTalentPoints("IS") > 0)
            {
                rota = 1;
            }
        }
コード例 #2
0
        public void StartSim()
        {
            List <AutoAttack> autos = new List <AutoAttack>();

            autos.Add(new AutoAttack(Player, Player.MH, true));
            if (Player.OH != null)
            {
                autos.Add(new AutoAttack(Player, Player.OH, false));
            }

            CurrentTime = 0;

            Whirlwind    ww = new Whirlwind(Player);
            Bloodthirst  bt = new Bloodthirst(Player);
            HeroicStrike hs = new HeroicStrike(Player);

            hs.RessourceCost -= Player.GetTalentPoints("IHS");
            Execute     exec = new Execute(Player);
            Bloodrage   br   = new Bloodrage(Player);
            BattleShout bs   = new BattleShout(Player);
            Hamstring   ham  = new Hamstring(Player);

            Dictionary <Spell, int> cds = null;

            if (Player.Cooldowns != null)
            {
                cds = new Dictionary <Spell, int>();
                foreach (string s in Player.Cooldowns)
                {
                    switch (s)
                    {
                    case "Death Wish": cds.Add(new DeathWish(Player), DeathWishBuff.LENGTH); break;

                    case "Juju Flurry": cds.Add(new JujuFlurry(Player), JujuFlurryBuff.LENGTH); break;

                    case "Mighty Rage": cds.Add(new MightyRage(Player), MightyRageBuff.LENGTH); break;

                    case "Recklessness": cds.Add(new Recklessness(Player), RecklessnessBuff.LENGTH); break;

                    case "Racial":
                        if (Player.Race == Player.Races.Orc)
                        {
                            cds.Add(new BloodFury(Player), BloodFuryBuff.LENGTH);
                        }
                        else if (Player.Race == Player.Races.Troll)
                        {
                            cds.Add(new Berserking(Player), BerserkingBuff.LENGTH);
                        }
                        break;
                    }
                }
            }

            Boss.LifePct = 1;

            // Pre-cast Battle Shout (starts GCD as Charge would)
            bs.Cast();

            // Charge
            Player.Ressource += 15;

            int rota = 1;

            while (CurrentTime < FightLength)
            {
                if (AutoLife)
                {
                    Boss.LifePct = Math.Max(0, 1 - (CurrentTime / FightLength) * (16.0 / 17.0));
                }
                else if (CurrentTime >= LowLifeTime && Boss.LifePct == 1)
                {
                    Boss.LifePct = 0.10;
                }

                foreach (Effect e in Player.Effects)
                {
                    e.CheckEffect();
                }
                foreach (Effect e in Boss.Effects)
                {
                    e.CheckEffect();
                }

                Player.Effects.RemoveAll(e => e.Ended);
                Boss.Effects.RemoveAll(e => e.Ended);

                if (br.CanUse() && Player.Ressource <= 90)
                {
                    br.Cast();
                }

                if (bs.CanUse() && (!Player.Effects.Any(e => e is BattleShoutBuff) || ((BattleShoutBuff)Player.Effects.Where(e => e is BattleShoutBuff).First()).RemainingTime() < Player.GCD))
                {
                    bs.Cast();
                }


                if (cds != null)
                {
                    foreach (Spell cd in cds.Keys)
                    {
                        if (cd.CanUse() &&
                            (FightLength - CurrentTime <= cds[cd] ||
                             FightLength - CurrentTime >= cd.BaseCD + cds[cd]))
                        {
                            cd.Cast();
                        }
                    }
                }

                if (rota == 0)
                {
                }
                else if (rota == 1)
                {
                    if (Boss.LifePct > 0.2)
                    {
                        if (bt.CanUse())
                        {
                            bt.Cast();
                        }
                        else if (ww.CanUse() && Player.Ressource >= ww.RessourceCost + bt.RessourceCost && bt.RemainingCD() >= Player.GCD)
                        {
                            ww.Cast();
                        }
                        else if (ham.CanUse() && Player.Ressource >= Bloodthirst.COST + Whirlwind.COST + Hamstring.COST && ww.RemainingCD() >= Player.GCD && bt.RemainingCD() >= Player.GCD && (!Player.Effects.Any(e => e is Flurry) || ((Flurry)Player.Effects.Where(f => f is Flurry).First()).CurrentStacks < 3))
                        {
                            ham.Cast();
                        }

                        if (Player.Ressource >= Bloodthirst.COST + Whirlwind.COST + HeroicStrike.COST && hs.CanUse())
                        {
                            hs.Cast();
                        }
                    }
                    else
                    {
                        if (exec.CanUse())
                        {
                            exec.Cast();
                        }
                    }
                }
                else if (rota == 2)
                {
                    if (ww.CanUse())
                    {
                        ww.Cast();
                    }
                    else if (bt.CanUse() && Player.Ressource >= ww.RessourceCost + bt.RessourceCost)
                    {
                        bt.Cast();
                    }
                    else if (ham.CanUse() && Player.Ressource >= Bloodthirst.COST + Whirlwind.COST + Hamstring.COST && ww.RemainingCD() >= Player.GCD && bt.RemainingCD() >= Player.GCD && (!Player.Effects.Any(e => e is Flurry) || ((Flurry)Player.Effects.Where(f => f is Flurry).First()).CurrentStacks < 3))
                    {
                        ham.Cast();
                    }

                    if (Player.Ressource >= Bloodthirst.COST + Whirlwind.COST + HeroicStrike.COST && hs.CanUse())
                    {
                        hs.Cast();
                    }
                }

                foreach (AutoAttack a in autos)
                {
                    if (a.Available())
                    {
                        if (a.MH && Player.applyAtNextAA != null)
                        {
                            Player.applyAtNextAA.DoAction();
                            a.NextAA();
                        }
                        else
                        {
                            a.Cast();
                        }
                    }
                }

                Player.Effects.RemoveAll(e => e.Ended);
                Boss.Effects.RemoveAll(e => e.Ended);

                CurrentTime += 1 / RATE;
            }

            Program.damages.Add(Damage);
            Program.totalActions.Add(Actions);
            Program.totalEffects.Add(Effects);

            Ended = true;
        }