public override TimedMethod[] EnemyTurn()
    {
        FratLord f = (FratLord)Party.GetEnemy(1);

        if (Attacks.EvasionCheck(Party.GetPlayer(), GetAccuracy()))
        {
            TimedMethod[] firePart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] {
                    ToString() + " was compelled to jump the bonfire, and failed"
                }),
                                                         new TimedMethod(0, "StagnantAttack", new object[] { false, 5, 5, GetAccuracy(), true, false, false }) };
            TimedMethod[] fratPart = f.Fail();
            TimedMethod[] moves    = new TimedMethod[firePart.Length + fratPart.Length];
            firePart.CopyTo(moves, 0);
            fratPart.CopyTo(moves, firePart.Length);
            return(moves);
        }
        else
        {
            Party.enemySlot = 1;
            TimedMethod[] firePart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] {
                    ToString() + " was compelled to jump the bonfire"
                }),
                                                         new TimedMethod(0, "AttackAny", new object[] { this, Party.GetPlayer(), 5, 5, GetAccuracy(), true, false, false }) };
            TimedMethod[] fratPart = f.Third();
            TimedMethod[] moves    = new TimedMethod[firePart.Length + fratPart.Length];
            firePart.CopyTo(moves, 0);
            fratPart.CopyTo(moves, firePart.Length);
            return(moves);
        }
    }
示例#2
0
    public override TimedMethod[] BasicAttack()
    {
        System.Random rng = new System.Random();
        TimedMethod[] stunPart;
        if (rng.Next(10) < 5 && Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
        {
            stunPart = Party.GetEnemy().status.Stun(2);
        }
        else
        {
            stunPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
        }
        Democracy castPassive = (Democracy)passive;

        castPassive.attacked = true;
        TimedMethod[] attackPart;
        Attacks.SetAudio("Blunt Hit", 10);
        if (Party.BagContains(new Metronome()))
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
        }
        else
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy());
        }
        TimedMethod[] moves = new TimedMethod[attackPart.Length + 3];
        moves[0] = new TimedMethod(0, "Audio", new object[] { "Big Swing" });
        attackPart.CopyTo(moves, 1);
        moves[moves.Length - 2] = stunPart[0];
        moves[moves.Length - 1] = stunPart[1];
        return(moves);
    }
 public override TimedMethod[] BasicAttack()
 {
     System.Random rng = new System.Random();
     TimedMethod[] blindPart;
     if (rng.Next(10) < 6 && Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
     {
         blindPart = Party.GetEnemy().status.Blind(2);
     }
     else
     {
         blindPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
     }
     TimedMethod[] attackPart;
     Attacks.SetAudio("Knife", 15);
     if (Party.BagContains(new Metronome()))
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
     }
     else
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy());
     }
     TimedMethod[] moves = new TimedMethod[attackPart.Length + 3];
     moves[0] = new TimedMethod(0, "Audio", new object[] { "Knife Throw" });
     attackPart.CopyTo(moves, 1);
     moves[moves.Length - 2] = blindPart[0];
     moves[moves.Length - 1] = blindPart[1];
     return(moves);
 }
 public override TimedMethod[] BasicAttack()
 {
     TimedMethod[] healPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
     if (Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
     {
         Heal(2);
         healPart = new TimedMethod[] { new TimedMethod(0, "AudioAfter", new object[] { "Heal", 15 }),
                                        new TimedMethod(0, "CharLogSprite", new object[] { "2", Party.playerSlot - 1, "healing", true }) };
     }
     TimedMethod[] attackPart;
     Attacks.SetAudio("Blunt Hit", 10);
     if (Party.BagContains(new Metronome()))
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
     }
     else
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy());
     }
     TimedMethod[] moves = new TimedMethod[attackPart.Length + 3];
     moves[0] = new TimedMethod(0, "AudioAfter", new object[] { "Small Swing", 10 });
     moves[1] = healPart[0];
     moves[2] = healPart[1];
     attackPart.CopyTo(moves, 3);
     return(moves);
 }
    public override TimedMethod[] UseSupport(int i)
    {
        Attacks.SetAudio("Blunt Hit", 15);
        TimedMethod[] moves = new TimedMethod[Party.playerCount + 2];
        moves[0] = new TimedMethod(60, "Log", new object[] { Party.members[i].ToString() + " led a team attack" });
        moves[1] = new TimedMethod(0, "Audio", new object[] { "Whistle" });
        int       index = 0;
        int       count = 1;
        Character current;

        while (count < Party.playerCount)
        {
            current = Party.members[index];
            if (index != i && current != null && current.GetAlive() && !current.GetStunned() && !current.GetAsleep() && !current.GetGooped() &&
                !current.GetApathy())
            {
                moves[count + 1] = new TimedMethod(0, "AttackAny", new object[] {
                    current, Party.GetEnemy(), current.GetStrength(), current.GetStrength() + 4, current.GetAccuracy(), true, false, false
                });
                count++;
            }
            index++;
        }
        moves[moves.Length - 1] = new TimedMethod(0, "StagnantAttack", new object[] { true, Party.members[i].GetStrength(),
                                                                                      Party.members[i].GetStrength() + 4, Party.members[i].GetAccuracy(), true, true, false });
        return(moves);
    }
示例#6
0
 public override TimedMethod[] BasicAttack()
 {
     TimedMethod[] statusPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
     if (Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
     {
         if (GetPoisoned())
         {
             statusPart[0] = new TimedMethod(0, "CharLogSprite", new object[] { "Cured", Party.playerSlot - 1, "poison", true });
         }
         if (GetGooped())
         {
             statusPart[1] = new TimedMethod(0, "CharLogSprite", new object[] { "Cleaned", Party.playerSlot - 1, "goop", true });
         }
         status.poisoned = 0;
         status.gooped   = false;
     }
     TimedMethod[] attackPart;
     Attacks.SetAudio("Knife", 20);
     if (Party.BagContains(new Metronome()))
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
     }
     else
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy());
     }
     TimedMethod[] moves = new TimedMethod[attackPart.Length + 3];
     moves[0] = new TimedMethod(0, "Audio", new object[] { "Knife Throw" });
     moves[1] = statusPart[0];
     moves[2] = statusPart[1];
     attackPart.CopyTo(moves, 3);
     return(moves);
 }
示例#7
0
 public override TimedMethod[] Use()
 {
     Attacks.SetAudio("Blunt Hit", 15);
     if (Attacks.EvasionCheck(Party.GetEnemy(), Party.GetPlayer().GetAccuracy()) && Party.enemyCount > 1)
     {
         //Character second = Party.enemies[0];
         TimedMethod[] moves = new TimedMethod[Party.enemyCount + 1];
         moves[0] = new TimedMethod(0, "Audio", new object[] { "Running" });
         int index = 1;
         for (int i = 0; i < 4; i++)
         {
             if (i != Party.enemySlot - 1 && Party.enemies[i] != null && Party.enemies[i].GetAlive())
             {
                 moves[index] = new TimedMethod(0, "AttackAny", new object[] { Party.GetPlayer(), Party.enemies[i],
                                                                               Party.GetPlayer().GetStrength() / 2, (Party.GetPlayer().GetStrength() + 5) / 2, Party.GetPlayer().GetAccuracy(), true, false, false });
                 //break;
                 index++;
             }
         }
         moves[index] = new TimedMethod(0, "StagnantAttack", new object[] {
             true, Party.GetPlayer().GetStrength(), Party.GetPlayer().GetStrength() + 5, Party.GetPlayer().GetAccuracy(), true, true, false
         });
         return(moves);
     }
     else
     {
         return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Running" }), new TimedMethod(0, "StagnantAttack", new object[] {
                 true, Party.GetPlayer().GetStrength(), Party.GetPlayer().GetStrength() + 5, Party.GetPlayer().GetAccuracy(), true, true, false
             }) });
     }
 }
        private void OnExampleLoaded(object sender, RoutedEventArgs e)
        {
            // Manages the state of example on enter
            Reset();

            _startDelegate = TimedMethod.Invoke(this.Start).After(500).Go();
        }
示例#9
0
 public override TimedMethod[] AI()
 {
     TimedMethod[] moves;
     if (health < maxHP / 2)
     {
         return(Switch());
     }
     else
     {
         moves = new TimedMethod[] { new TimedMethod(60, "Log", new object[] { "The " + ToString() + " is rallying. Team power has increased" }),
                                     new TimedMethod(0, "Audio", new object[] { "Whistle" }),
                                     new TimedMethod(6, "CharLogSprite", new object[] { "1", 0, "power", false }),
                                     new TimedMethod(6, "CharLogSprite", new object[] { "1", 1, "power", false }),
                                     new TimedMethod(6, "CharLogSprite", new object[] { "1", 2, "power", false }),
                                     new TimedMethod(6, "CharLogSprite", new object[] { "1", 3, "power", false }) };
         foreach (Character current in Party.enemies)
         {
             if (current != null && current.GetAlive())
             {
                 current.GainPower(1);
             }
         }
     }
     return(moves);
 }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            // Create our data in another thread to stop the UI from being stalled.
            // It's not appending to SciChart Dataseries that is the problem, its Calling Rand.Next() two million times which is pretty slow :)
            TimedMethod.Invoke(() =>
            {
                var dataSeries = new XyDataSeries <double, double>()
                {
                    AcceptsUnsortedData = true
                };
                var rand = new FasterRandom();

                // Allow 1M points in WPF/DirectX. In Silverlight or software rendering, 100k points is enough to stress the renderer
                int count = FeaturesHelper.Instance.SupportsHardwareAcceleration ? (int)1E6 : (int)1E5;

                // Append some data
                for (int i = 0; i < count; i++)
                {
                    dataSeries.Append(rand.NextDouble(), rand.NextDouble());
                }

                // Bind to scichart
                Action bindData = () => { BindData(dataSeries); };
                Dispatcher.BeginInvoke(bindData);
            }).After(200).OnThread(TimedMethodThread.Background).Go();
        }
示例#11
0
        public override void FilterAll()
        {
            _filteredDataSeries.Clear();

            int    index = 0;
            double animationStepMillisconds = 1;

            Action appendPoint = null;

            Action onAppendCallback = () =>
            {
                // 2.) Append the point
                _filteredDataSeries.Append(_originalDataSeries.XValues[index], _originalDataSeries.YValues[index]);
                _filteredDataSeries.InvalidateParentSurface(RangeMode.ZoomToFit);

                // 3.) Schedule another until complete
                if (++index < _originalDataSeries.Count)
                {
                    // Achieve some rudimentary easing
                    animationStepMillisconds *= 1.05;
                    animationStepMillisconds  = Math.Min(animationStepMillisconds, 10);

                    // Next point
                    appendPoint();
                }
            };

            appendPoint = () =>
            {
                TimedMethod.Invoke(onAppendCallback).After((int)animationStepMillisconds).Go();
            };

            // 1.) Schedule one point to be appended
            appendPoint();
        }
    public override TimedMethod[] BasicAttack()
    {
        TimedMethod[] attackPart;
        Attacks.SetAudio("Knife", 6);
        if (Party.BagContains(new Metronome()))
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
        }
        else
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy());
        }
        GainEvasion(3);
        TimedMethod evadePart = new TimedMethod("Null");

        if (!GetGooped())
        {
            evadePart = new TimedMethod(0, "CharLogSprite", new object[] { "3", Party.playerSlot - 1, "evasion", true });
        }
        TimedMethod[] moves = new TimedMethod[attackPart.Length + 2];
        moves[0] = new TimedMethod(0, "Audio", new object[] { "Small Swing" });
        moves[1] = evadePart;
        attackPart.CopyTo(moves, 2);
        return(moves);
    }
示例#13
0
        private static void UpdateResults(string resultsFile, string codecCode, TimedMethod compressor, TimedMethod decompressor)
        {
            Console.WriteLine("Updating results");

            var     serializer = new XmlSerializer(typeof(Results));
            Results results;

            if (File.Exists(resultsFile))
            {
                using (var stream = File.OpenRead(resultsFile)) results = (Results)serializer.Deserialize(stream);
            }
            else
            {
                results = new Results();
            }

            if (results.Update(codecCode, compressor.Speed, decompressor.Speed, compressor.InputLength, compressor.OutputLength))
            {
                Console.WriteLine("IMPROVED!!!");
            }

            using (var stream = File.Create(resultsFile)) serializer.Serialize(stream, results);
            results.SaveAsCSV(resultsFile + ".csv");

            Console.WriteLine("---- Latest results ----");
            foreach (var item in results.Items)
            {
                Console.WriteLine("  {0}: {1:0.00} / {2:0.00}", item.Codec, item.CompressionSpeed, item.DecompressionSpeed);
            }
            Console.WriteLine("------------------------");
        }
示例#14
0
    public override TimedMethod[] Lecture()
    {
        TimedMethod[] sleepPart;
        TimedMethod[] totalSleep = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null") };
        int index = 0;

        foreach (Character c in Party.members)
        {
            if (c != null && c.GetAlive() && Attacks.EvasionCycle(this, c))
            {
                sleepPart = c.status.Sleep();
                Status.NullifyAttack(c); Status.NullifyDefense(c);
                totalSleep[index + 2] = new TimedMethod(0, "CharLogSprite", new object[] { "atk reset", c.partyIndex, "nullAttack", true });
                totalSleep[index + 3] = new TimedMethod(0, "CharLogSprite", new object[] { "def reset", c.partyIndex, "nullDefense", true });
            }
            else
            {
                sleepPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
            }
            totalSleep[index]     = sleepPart[0];
            totalSleep[index + 1] = sleepPart[1];
            index += 4;
        }
        return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Filibuster" }),
                                   new TimedMethod(60, "Log", new object[] { ToString() + " lectured" }), totalSleep[0], totalSleep[1], totalSleep[2], totalSleep[3],
                                   totalSleep[4], totalSleep[5], totalSleep[6], totalSleep[7], totalSleep[8], totalSleep[9], totalSleep[10], totalSleep[11],
                                   totalSleep[12], totalSleep[13], totalSleep[14], totalSleep[15] });
    }
    public TimedMethod[] Filibuster()
    {
        TimedMethod[] totalSleep = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null") };
        int index = 0;

        TimedMethod[] sleepPart;
        foreach (Character c in Party.members)
        {
            if (c != null && c.GetAlive() && Attacks.EvasionCycle(this, c))
            {
                sleepPart = c.status.Sleep();
            }
            else
            {
                sleepPart = new TimedMethod[] { new TimedMethod(0, "CharLog", new object[] { "miss", c.partyIndex, true }), new TimedMethod("Null") };
            }
            totalSleep[index]     = sleepPart[0];
            totalSleep[index + 1] = sleepPart[1];
            index += 2;
        }
        return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Filibuster" }),
                                   new TimedMethod(60, "Log", new object[] { "The Politician filibustered" }), totalSleep[0], totalSleep[1], totalSleep[2], totalSleep[3],
                                   totalSleep[4], totalSleep[5], totalSleep[6], totalSleep[7] });
    }
 public override TimedMethod[] BasicAttack()
 {
     System.Random rng = new System.Random();
     TimedMethod[] poisonPart;
     if (rng.Next(10) < 3 && Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
     {
         poisonPart = Party.GetEnemy().status.Poison(1);
     }
     else
     {
         poisonPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
     }
     Attacks.SetAudio("Acid", 10);
     TimedMethod[] attackPart;
     if (Party.BagContains(new Metronome()))
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
     }
     else
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy());
     }
     TimedMethod[] moves = new TimedMethod[attackPart.Length + 4];
     moves[0] = new TimedMethod(0, "Audio", new object[] { "Missile" });
     moves[1] = new TimedMethod(0, "AudioAfter", new object[] { "Glass Break", 20 });
     attackPart.CopyTo(moves, 2);
     moves[moves.Length - 2] = poisonPart[0];
     moves[moves.Length - 1] = poisonPart[1];
     return(moves);
 }
    public override TimedMethod[] BasicAttack()
    {
        TimedMethod guardPart = new TimedMethod("Null");

        if (Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
        {
            guardPart = new TimedMethod(0, "CharLogDelay", new object[] { "-1", Party.enemySlot - 1, "guard", false });
            Party.GetEnemy().GainGuard(-1);
        }
        TimedMethod[] attackPart;
        Attacks.SetAudio("Metal Hit", 10);
        if (Party.BagContains(new Metronome()))
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
        }
        else
        {
            attackPart = Attacks.Attack(this, Party.GetEnemy());
        }
        TimedMethod[] moves = new TimedMethod[attackPart.Length + 2];
        moves[0] = new TimedMethod(0, "Audio", new object[] { "Big Swing" });
        moves[moves.Length - 1] = guardPart;
        attackPart.CopyTo(moves, 1);
        return(moves);
    }
示例#18
0
 public override TimedMethod[] BasicAttack()
 {
     TimedMethod[] apathyPart;
     if (Attacks.EvasionCheck(Party.GetEnemy(), GetAccuracy()))
     {
         apathyPart = Party.GetEnemy().status.CauseApathy(1);
     }
     else
     {
         apathyPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
     }
     TimedMethod[] attackPart;
     Attacks.SetAudio("Cheese", 20);
     if (Party.BagContains(new Metronome()))
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy(), strength + 3, strength + 3, GetAccuracy(), true, true, false);
     }
     else
     {
         attackPart = Attacks.Attack(this, Party.GetEnemy());
     }
     TimedMethod[] moves = new TimedMethod[attackPart.Length + 3];
     moves[0] = new TimedMethod(0, "Audio", new object[] { "Big Swing" });
     attackPart.CopyTo(moves, 1);
     moves[moves.Length - 2] = apathyPart[0];
     moves[moves.Length - 1] = apathyPart[1];
     return(moves);
 }
示例#19
0
    public override TimedMethod[] UseSupport(int i)
    {
        TimedMethod[] totalSleep = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null") };
        int index = 0;

        TimedMethod[] sleepPart;
        foreach (Character c in Party.members)
        {
            if (c != null && c.GetAlive())
            {
                sleepPart             = c.status.Sleep();
                totalSleep[index]     = sleepPart[0];
                totalSleep[index + 1] = sleepPart[1];
            }
            index += 2;
        }
        index = 8;
        foreach (Character c in Party.enemies)
        {
            if (c != null && c.GetAlive())
            {
                c.status.Sleep();
                sleepPart             = c.status.Sleep();
                totalSleep[index]     = sleepPart[0];
                totalSleep[index + 1] = sleepPart[1];
            }
            index += 2;
        }
        return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Filibuster" }),
                                   new TimedMethod(60, "Log", new object[] { Party.members[i].ToString() + " wouldn't stop talking" }),
                                   totalSleep[0], totalSleep[1], totalSleep[2], totalSleep[3], totalSleep[4], totalSleep[5], totalSleep[6], totalSleep[7],
                                   totalSleep[8], totalSleep[9], totalSleep[10], totalSleep[11], totalSleep[12], totalSleep[13], totalSleep[14], totalSleep[15] });
    }
示例#20
0
        private static void TestSpeed(byte[] original, TimedMethod compressor, TimedMethod decompressor)
        {
            int length = original.Length;

            byte[] compressed = compressor.Run(original, length);
            AssertEqual(original, decompressor.Run(compressed, length), compressor.Name);
        }
    public virtual TimedMethod[] Lecture()
    {
        TimedMethod[] totalSleep = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"),
                                                       new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null"), new TimedMethod("Null") };
        int index = 0;

        TimedMethod[] sleepPart;
        foreach (Character c in Party.members)
        {
            if (c != null && c.GetAlive() && Attacks.EvasionCycle(this, c))
            {
                sleepPart = c.status.Sleep();
            }
            else
            {
                sleepPart = new TimedMethod[] { new TimedMethod("Null"), new TimedMethod("Null") };
            }
            totalSleep[index]     = sleepPart[0];
            totalSleep[index + 1] = sleepPart[1];
            index += 2;
        }
        return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Filibuster" }),
                                   new TimedMethod(60, "Log", new object[] { ToString() + " lectured" }), totalSleep[0], totalSleep[1], totalSleep[2], totalSleep[3],
                                   totalSleep[4], totalSleep[5], totalSleep[6], totalSleep[7] });
    }
示例#22
0
 public void StatusCheck()
 {
     TimedMethod[] statuses;
     for (int i = 0; i < 4; i++)
     {
         if (i == Party.playerSlot - 1)
         {
             statuses = Party.members[i].status.CheckLead();
         }
         else if (Party.members[i] != null && Party.members[i].GetAlive())
         {
             statuses = Party.members[i].status.Check();
         }
         else
         {
             statuses = new TimedMethod[0];
         }
         foreach (TimedMethod t in statuses)
         {
             methodQueue.Enqueue(t);
         }
     }
     //TimedMethod[] statuses = Party.GetPlayer().status.Check();
     //foreach (TimedMethod t in statuses) {
     //methodQueue.Enqueue(t);
     //}
     GetPlayer();
     if (Party.GetPlayer().GetAsleep() || Party.GetPlayer().GetStunned())
     {
         methodQueue.Enqueue(new TimedMethod(0, "Incapacitated"));
     }
     else
     {
         methodQueue.Enqueue(new TimedMethod(0, "Awaken"));
     }
     if (Party.GetPlayer().GetGooped())
     {
         methodQueue.Enqueue(new TimedMethod(0, "Stuck"));
     }
     else
     {
         methodQueue.Enqueue(new TimedMethod(0, "Freed"));
     }
     if (Party.GetPlayer().GetPassing())
     {
         Party.GetPlayer().status.passing = false;
         CharLogSprite("SKIP", Party.playerSlot - 1, "skip", true);
         Audio("Skip Turn");
         methodQueue.Enqueue(new TimedMethod("EndTurn"));
     }
     else
     {
         methodQueue.Enqueue(new TimedMethod(0, "ToggleMenu", new object[] { true }));
         methodQueue.Enqueue(new TimedMethod(0, "Log", new object[] { "" }));
     }
     statusBars.transform.Find("Player Status").GetComponent <StatusBarP>().Check();
     statusBars.transform.Find("Enemy Status").GetComponent <StatusBarE>().Check();
 }
示例#23
0
 public override TimedMethod[] Use()
 {
     TimedMethod[] sleepPart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] { "Miss" }), new TimedMethod("Null") };
     if (Attacks.EvasionCycle(Party.GetPlayer().GetAccuracy() * 2, Party.GetEnemy()))
     {
         sleepPart = Party.GetEnemy().status.Sleep();
     }
     return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Hypnotize" }),
                                sleepPart[0], sleepPart[1] });
 }
示例#24
0
 public TimedMethod[] Poison()
 {
     TimedMethod[] poisonPart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] { "miss" }), new TimedMethod("Null") };
     if (Attacks.EvasionCycle(this, Party.GetPlayer()))
     {
         poisonPart = Party.GetPlayer().status.Poison(2);
     }
     return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Fumes" }),
                                new TimedMethod(60, "Log", new object[] { "The Megalomaniac sprayed poison fumes" }), poisonPart[0], poisonPart[1] });
 }
示例#25
0
        private void OnExampleUnloaded(object sender, RoutedEventArgs e)
        {
            if (_startDelegate != null)
            {
                _startDelegate.Dispose();
                _startDelegate = null;
            }

            PauseButton_Click(this, null);
        }
示例#26
0
        public MainWindowViewModel(IModule module, IUsageCalculator usageCalculator)
        {
            SearchText              = "";
            SearchResults           = new ObservableCollection <ISelectable>();
            _autoCompleteDataSource = module.Examples.Select(ex => ex.Value.Title).ToList();

            WithTrait <AutoCompleteSearchBehaviour>();
            WithTrait <InitializationBehaviour>();

            _hideSearchCommand = new ActionCommand(() =>
            {
                SearchText = null;
            });

            _showSettingsCommand = new ActionCommand(() =>
            {
                IsSettingsShow     = true;
                BlurOnSearchParams = _blurredParams;
            });

            _hideSettingsCommand = new ActionCommand(() =>
            {
                IsSettingsShow     = false;
                BlurOnSearchParams = _defaultParams;
            });

            _exportCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                DeveloperModManager.Manage.IsDeveloperMode = false;
                TimedMethod.Invoke(() => HtmlExportHelper.ExportExampleToHtml(SelectedExample)).After(1000).Go();
            }, () => SelectedExample != null);

            _exportAllHtmlCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                DeveloperModManager.Manage.IsDeveloperMode = false;
                TimedMethod.Invoke(() => HtmlExportHelper.ExportExamplesToHtml(module)).After(1000).Go();
            }, () => SelectedExample != null);

            _exportAllSolutionsCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                ExportExampleHelper.ExportExamplesToSolutions(module);
            }, () => SelectedExample != null);

            _gcCollectCommand = new ActionCommand(() =>
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForFullGCApproach();
            });
        }
        private void OnExampleUnloaded(object sender, RoutedEventArgs e)
        {
            // Manages the state of the example on exit
            if (_startDelegate != null)
            {
                _startDelegate.Dispose();
                _startDelegate = null;
            }

            Pause();
        }
示例#28
0
 public override TimedMethod[] UseSupport(int i)
 {
     TimedMethod[] apathyPart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] { "miss" }), new TimedMethod("Null") };
     if (Attacks.EvasionCycle(Party.members[i], Party.GetEnemy()))
     {
         apathyPart = Party.GetEnemy().status.CauseApathy(3);
     }
     return(new TimedMethod[] { new TimedMethod(0, "Audio", new object[] { "Filibuster" }), new TimedMethod(60, "Log", new object[] {
             Party.members[i].ToString() + " recited so much Pi it could lower self-esteem"
         }), apathyPart[0], apathyPart[1] });
 }
示例#29
0
 private static void DoLoaded(object sender, EventArgs e)
 {
     TimedMethod.Invoke(() =>
     {
         var command = GetLoadedEventCommand((DependencyObject)sender);
         if (command != null)
         {
             command.Execute(null);
         }
     }).After(200).Go();
 }
示例#30
0
    public TimedMethod[] Meal(string food)
    {
        string message = "";

        TimedMethod[] statusPart = new TimedMethod[] { new TimedMethod(60, "Log", new object[] { "Miss" }), new TimedMethod("Null") };
        TimedMethod   audioPart  = new TimedMethod("Null");

        switch (food)
        {
        case "eat": message     = ToString() + " ate some food";
            Heal(8); statusPart = new TimedMethod[] { new TimedMethod(0, "CharLogSprite", new object[] { "8", Party.enemySlot - 1, "healing", false }),
                                                      new TimedMethod("Null") };
            audioPart = new TimedMethod(0, "Audio", new object[] { "Eat" });
            break;

        case "poison": message = ToString() + " chucked raw chicken";
            if (Attacks.EvasionCycle(this, Party.GetPlayer()))
            {
                statusPart = Party.GetPlayer().status.Poison(1);
            }
            audioPart = new TimedMethod(0, "Audio", new object[] { "Missile" });
            break;

        case "attack": message = ToString() + " chucked bread";
            if (Attacks.EvasionCycle(this, Party.GetPlayer()))
            {
                Party.GetPlayer().GainCharge(-6);
                statusPart[0] = new TimedMethod(0, "CharLogSprite", new object[] { "-6", Party.playerSlot - 1, "charge", true });
                statusPart[1] = new TimedMethod(0, "Audio", new object[] { "Nullify" });
            }
            audioPart = new TimedMethod(0, "Audio", new object[] { "Missile" });
            break;

        case "defense": message = ToString() + " chucked jello";
            if (Attacks.EvasionCycle(this, Party.GetPlayer()))
            {
                Party.GetPlayer().GainGuard(-6);
                statusPart[0] = new TimedMethod(0, "CharLogSprite", new object[] { "-6", Party.playerSlot - 1, "guard", true });
                statusPart[1] = new TimedMethod(0, "Audio", new object[] { "Slime" });
            }
            audioPart = new TimedMethod(0, "Audio", new object[] { "Missile" });
            break;

        case "stun": message = ToString() + " chucked pepper";
            if (Attacks.EvasionCycle(this, Party.GetPlayer()))
            {
                statusPart = Party.GetPlayer().status.Stun(3);
            }
            audioPart = new TimedMethod(0, "Audio", new object[] { "Powder" });
            break;
        }
        return(new TimedMethod[] { audioPart, new TimedMethod(60, "Log", new object[] { message }), statusPart[0], statusPart[1] });
    }
示例#31
0
 /// <summary>
 /// Add a method to be called in a specified time for a specified number of repetitions
 /// </summary>
 /// <param name="d">The delegate representing the method to be called</param>
 /// <param name="time">The amount of milliseconds you want to wait to call this method, and to wait inbetween each calling if it repeats (note that this is rounded to 10ths of a second)</param>
 /// <param name="repeat">the number of times to repeat this call</param>
 /// <param name="PassBack">the object to pass back to the method that is called.</param>
 public static void AddTimedMethod(TimedMethodDelegate d, int time, int repeat, object PassBack)
 {
     TimedMethod TMS = new TimedMethod(d, time, repeat, PassBack);
     TimedMethodList.Add(TMS);
 }