Esempio n. 1
0
 void Start()
 {
     EventAggregator.UpdateCache <ObjectBrokenMessage>();
 }
Esempio n. 2
0
 public void LaunchParachute()
 {
     EventAggregator.SendMessage(new LaunchParachuteMessage());
 }
Esempio n. 3
0
        private bool ChoiceVictim(int effectiveness)
        {
            var i       = 0;
            var j       = 0;
            var attacks = new List <Attack>();

            foreach (var enemyFairy in enemy.ActiveFairies)
            {
                j = 0;
                foreach (var playerFairy in player.ActiveFairies)
                {
                    if (DataOfModels.TableOfEffectiveness[(int)enemyFairy.Element, (int)playerFairy.Element] == effectiveness)
                    {
                        if (enemyFairy.Spells[0] != "Empty Slot" && EnemySpells[i, 0].Mana > 0)
                        {
                            attacks.Add(new Attack(i, j, EnemySpells[i, 0]));
                        }

                        if (enemyFairy.Spells[2] != "Empty Slot" && EnemySpells[i, 2].Mana > 0)
                        {
                            attacks.Add(new Attack(i, j, EnemySpells[i, 2]));
                        }
                    }

                    j++;
                }

                i++;
            }

            var choiceAttack = new Attack();
            var newNumber    = randomizer.Next(10);

            if (newNumber < 4)
            {
                var damage = 0.0;
                foreach (var attack in attacks)
                {
                    if (DataOfModels.OffensiveSpells[attack.Spell.Name].Damage * enemy.ActiveFairies[attack.Forward].LevelCoefficient > damage)
                    {
                        damage       = DataOfModels.OffensiveSpells[attack.Spell.Name].Damage * enemy.ActiveFairies[attack.Forward].LevelCoefficient;
                        choiceAttack = attack;
                    }
                }
            }
            else if (newNumber >= 4 && newNumber < 7)
            {
                var maxHP = 0.0;
                foreach (var attack in attacks)
                {
                    if (player.ActiveFairies[attack.Victim].HealthPoint > maxHP)
                    {
                        maxHP        = player.ActiveFairies[attack.Victim].HealthPoint;
                        choiceAttack = attack;
                    }
                }
            }
            else if (newNumber >= 7 && newNumber < 9)
            {
                var minHP = 30.0;
                foreach (var attack in attacks)
                {
                    if (player.ActiveFairies[attack.Victim].HealthPoint < minHP)
                    {
                        minHP        = player.ActiveFairies[attack.Victim].HealthPoint;
                        choiceAttack = attack;
                    }
                }
            }
            else
            {
                choiceAttack = attacks[randomizer.Next(attacks.Count)];
            }

            if (choiceAttack.WasChoice)
            {
                EventAggregator.OnEnemyAttack(choiceAttack.Forward, choiceAttack.Victim, choiceAttack.Spell.Name, "Player");
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
 public void LaunchRocket()
 {
     EventAggregator.SendMessage(new LaunchRocketMessage());
 }