void OnTriggerStay(Collider other)
    {
        if (!other.CompareTag("Troop"))
        {
            return;
        }

        Fighting fScript = other.GetComponent <Fighting>();

        if (!once)
        {
            Debug.Log("I am the team:" + self.Team);
            Debug.Log("I have detected the team:" + fScript.Team);
            once = true;
        }

        if (self.Team == fScript.Team)
        {
            return;
        }

        // you don't need the CoolingDown bool at all:
        self.CoolDown -= Time.deltaTime;


        if (self.CoolDown > 0)
        {
            return;
        }

        fScript.TakeDamage(self.AttackDamage);
        self.CoolDown = self.original;
    }
Example #2
0
        private void CheckAloneFighter()
        {
            for (int i = 0; i < m_Areas.Count; ++i)
            {
                IPooledEnumerable eable   = JoinMap.GetMobilesInBounds(m_Areas[i]);
                List <Mobile>     players = new List <Mobile>();

                foreach (Mobile mob in eable)
                {
                    if (Contestants.Contains(mob))
                    {
                        players.Add(mob);
                    }
                }

                eable.Free();

                if (players.Count == 1) //Alone
                {
                    Mobile m = players[0];
                    m.MoveToWorld(WinLocation, WinMap);
                    m.PublicOverheadMessage(MessageType.Regular, 38, true, "Skipping to next round...");
                    m.Blessed = true;
                    Fighting.Remove(m);
                    Winners.Add(m);
                    UpdateScores(null, m);
                    AddFighters(false);
                }
            }
        }
Example #3
0
        public Conkeldurr(double health, string status)
        {
            name  = "Conkeldurr";
            type1 = new Fighting();

            estimatedSpeed = 309; estimatedHealth = 309; estimatedAttack = 309; estimatedDefense = 309; estimatedSpAttk = 309; estimatedSpDef = 309; move1 = new Flamethrower(); move2 = new Flamethrower(); move3 = new Flamethrower(); move4 = new Flamethrower(); Initialize(name, health, status);
        }
Example #4
0
        public Lucario(double health, string status)
        {
            name  = "Lucario";
            type1 = new Fighting();
            type2 = new Steel();

            estimatedSpeed = 309; estimatedHealth = 309; estimatedAttack = 309; estimatedDefense = 309; estimatedSpAttk = 309; estimatedSpDef = 309; move1 = new Flamethrower(); move2 = new Flamethrower(); move3 = new Flamethrower(); move4 = new Flamethrower(); Initialize(name, health, status);
        }
Example #5
0
        public Medicham(double health, string status)
        {
            name  = "Medicham";
            type1 = new Psychic();
            type2 = new Fighting();

            estimatedSpeed = 309; estimatedHealth = 309; estimatedAttack = 309; estimatedDefense = 309; estimatedSpAttk = 309; estimatedSpDef = 309; move1 = new Flamethrower(); move2 = new Flamethrower(); move3 = new Flamethrower(); move4 = new Flamethrower(); Initialize(name, health, status);
        }
Example #6
0
        public Breloom(double health, string status)
        {
            name  = "Breloom";
            type1 = new Grass();
            type2 = new Fighting();

            estimatedSpeed = 309; estimatedHealth = 309; estimatedAttack = 309; estimatedDefense = 309; estimatedSpAttk = 309; estimatedSpDef = 309; move1 = new Flamethrower(); move2 = new Flamethrower(); move3 = new Flamethrower(); move4 = new Flamethrower(); Initialize(name, health, status);
        }
Example #7
0
 private void Start()
 {
     _fighting      = GetComponent <Fighting>();
     _standing      = GetComponent <Standing>();
     _characterInfo = GetComponent <CharacterInformation>();
     _controller    = GetComponent <Controller>();
     _grabHandler   = GetComponent <GrabHandler>();
 }
Example #8
0
        public Terrakion(double health, string status)
        {
            name  = "Terrakion";
            type1 = new Rock();
            type2 = new Fighting();

            estimatedSpeed = 309; estimatedHealth = 309; estimatedAttack = 309; estimatedDefense = 309; estimatedSpAttk = 309; estimatedSpDef = 309; move1 = new Flamethrower(); move2 = new Flamethrower(); move3 = new Flamethrower(); move4 = new Flamethrower(); Initialize(name, health, status);
        }
Example #9
0
        static void Main(string[] args)
        {
            //Character character = new Warrior(100, 15, 1, 67);
            //character.PrintHealth(); //virtual zeby uzyc metod z warriora
            //character.PrintAttack(); //nie wirtual zeby uzyc z character
            //character.PrintMana();

            //Warrior warrior = new Warrior(100, 10, 5, 15);
            //warrior.PrintHealth(); //nawet bez wirtual uzyje character
            //warrior.PrintAttack();
            //warrior.PrintMana();

            Character warrior = new Warrior(500, 70, 0, 65);
            Character rouge   = new Rouge(400, 70, 0, 65);
            Character mage    = new Mage(300, 30, 3000, 10);
            Character ranger  = new Ranger(400, 60, 300, 30);

            Paladin     paladin     = new Paladin(700, 70, 100, 30, 50);
            Berserker   berserker   = new Berserker(700, 70, 0, 55);
            Assassin    assassin    = new Assassin(600, 80, 0, 79);
            Gambler     gambler     = new Gambler(600, 50, 0, 40, 3);
            Archmage    archmage    = new Archmage(500, 30, 5000, 60);
            Bloodmage   bloodmage   = new Bloodmage(500, 30, 2000, 60);
            Sniper      sniper      = new Sniper(600, 80, 100, 30);
            BeastMaster beastMaster = new BeastMaster(700, 60, 500, 50); // wip


            Fighting         fighting = new Fighting();
            List <Character> lista    = new List <Character>
            {
                paladin,
                berserker,
                assassin,
                gambler,
                archmage,
                bloodmage,
                sniper,
                beastMaster
            };

            Start start = new Start();

            start.StartingInterface(lista);
            //  if (berserker.GetHealth() <= 0)
            //  {
            //      for (int i = berserker.ImmortalRage(); i > 0; i--)
            //      {
            //          Fight(berserker, assassin, playerOneTurn = !playerOneTurn);
            //      }
            //  }
            Console.ReadKey();
        }
Example #10
0
    void Start()
    {
        m_damageable     = GetComponent <Damageable>();
        m_collider       = GetComponent <BoxCollider2D>();
        m_spriteRenderer = GetComponent <SpriteRenderer>();
        m_spriteRenderer = GetComponent <SpriteRenderer>();
        m_fighting       = GetComponent <Fighting>();
        m_rigidBody      = GetComponent <Rigidbody2D>();
        m_animator       = GetComponent <Animator>();

        playerDamage = GetComponent <PlayerTakeDamage>();
        currentScale = transform.localScale;
    }
Example #11
0
        private void SpawnContestants()
        {
            for (int i = 0; i < Contestants.Count; ++i)
            {
                if (Fighting.Contains(Contestants[i]) || Winners.Contains(Contestants[i]))
                {
                    continue;
                }

                SpawnMobile(Contestants[i]);
            }

            Timer.DelayCall(TimeSpan.FromSeconds(3), new TimerCallback(CheckAloneFighter));
        }
Example #12
0
        private void Attack(Robot rob)
        {
            Random rand = new Random();
            int    max  = rand.Next(20, 50);
            int    val  = rand.Next(0, max);

            rob.LifePoints = (rob.LifePoints - val);
            System.Threading.Thread.Sleep(200);

            Fighting?.Invoke(this, new StepEventArgs()
            {
                FightValue = val, Defender = rob, Fighter = this
            });
        }
Example #13
0
        public void SpawnMobile(Mobile m)
        {
            for (int i = 0; i < m_Areas.Count; ++i)
            {
                int mobCount            = 0;
                IPooledEnumerable eable = JoinMap.GetMobilesInBounds(m_Areas[i]);

                foreach (Mobile mob in eable)
                {
                    if (Contestants.Contains(mob) && mob.Alive)
                    {
                        mobCount++;
                    }
                }

                eable.Free();

                if (mobCount <= 1)     //Found an available area
                {
                    if (mobCount == 1) //Start area fight timer
                    {
                        Timer t;
                        m_MatchTimers.TryGetValue(m_Areas[i], out t);

                        if (t != null)
                        {
                            t.Stop();
                            m_MatchTimers.Remove(m_Areas[i]);
                        }

                        t = Contestants.Count > 2 ? new MatchTimer(this, m_Areas[i], false) : new MatchTimer(this, m_Areas[i], true);
                        t.Start();
                        m_MatchTimers.Add(m_Areas[i], t);
                    }

                    m.MoveToWorld(new Point3D(m_Areas[i].Start, JoinMap.GetAverageZ(m_Areas[i].X, m_Areas[i].Y)), JoinMap);
                    m.LocalOverheadMessage(MessageType.Regular, 38, true, string.Format("Fight will begin in {0} seconds!", FightDelayInSecs));
                    Fighting.Add(m);
                    FixPlayer(m);
                    new StartFightTimer(this, m).Start();
                    break;
                }
            }
        }
    void OnTriggerStay(Collider other)
    {
        // if wrong tag do nothing
        if (!other.CompareTag("Troop"))
        {
            return;
        }

        Fighting fScript = other.GetComponent <Fighting>();

        // here you should add a check
        if (!fScript)
        {
            // By using the other.gameObject as context you can find with which object
            // you collided exactly by clicking on the Log
            Debug.LogError("Something went wrong: Could not get the Fighting component of other", other.gameObject);
        }
        if (!once)
        {
            Debug.Log("I am the team:" + self.Team);
            Debug.Log("I have detected the team:" + fScript.Team);
            once = true;
        }

        // if same team do nothing
        if (self.Team == fScript.Team)
        {
            return;
        }

        // you don't need the CoolingDown bool at all:
        self.CoolDown -= Time.deltaTime;

        // if still cooling down do nothing
        if (self.CoolDown > 0)
        {
            return;
        }

        fScript.TakeDamage(self.AttackDamage);
        self.CoolDown = self.original;
    }
Example #15
0
        public void HandleDeath(Mobile m)
        {
            if (!m_Started)
            {
                return;
            }

            List <Mobile> opponents = new List <Mobile>();
            List <Mobile> referees  = new List <Mobile>();

            Rectangle2D area = GetArea(m);

            // Rob - remove and stop the Match or EndMatch timer
            if (m_MatchTimers.ContainsKey(area))
            {
                Timer t = m_MatchTimers[area];
                t.Stop();
                m_MatchTimers.Remove(area);
            }
            // end Rob
            IPooledEnumerable eable = JoinMap.GetMobilesInBounds(area);

            foreach (Mobile mob in eable)
            {
                if (mob != m && Contestants.Contains(mob))
                {
                    opponents.Add(mob);
                }
                else if (mob is Referee)
                {
                    referees.Add(mob);
                }
            }

            eable.Free();

            for (int i = 0; i < opponents.Count && opponents.Count <= 1; ++i)
            {
                Mobile mob = opponents[i];
                UpdateScores(m, mob);
                mob.MoveToWorld(WinLocation, WinMap);
                FixPlayer(mob);
                mob.Blessed = true;
                Fighting.Remove(mob);
                Winners.Add(mob);

                //Rob -re-add gear in case gear was removed
                if (ForceEnd == ForceEndType.ItemRemoval && NeedRestock.Contains(mob))
                {
                    SupplySystem.RemoveEventGear(mob);
                    SupplySystem.SupplyGear(mob, EventSupplier);
                    NeedRestock.Remove(mob);
                    mob.SendAsciiMessage("You have been resupplied!");
                }
            }

            NeedRestock.Remove(m); // loser doesn't need a restock
            // end - Rob

            for (int i = 0; i < referees.Count; ++i)
            {
                Mobile mob = referees[i];
                mob.Delete();
            }

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(ResurrectPlayer), m);

            HandleCorpse(m);

            Fighting.Remove(m);
            RemovePlayer(m, true, false);

            m.LastKiller = null;

            AddFighters(false);
        }
Example #16
0
        public void RemovePlayer(Mobile m, bool defeated, bool kicked)
        {
            SupplySystem.RemoveEventGear(m);
            m.IsInEvent = false;
            m.Blessed   = false;

            m.MoveToWorld(LeaveLocation, LeaveMap);

            if (Contestants.Contains(m))
            {
                Contestants.Remove(m);
            }

            if (Fighting.Contains(m))
            {
                Fighting.Remove(m);
            }

            if (Winners.Contains(m))
            {
                Winners.Remove(m);
            }

            // Rob
            if (NeedRestock.Contains(m))
            {
                NeedRestock.Remove(m);
            }
            // end Rob

            if (m.NetState != null)
            {
                if (defeated)
                {
                    m.SendAsciiMessage(38, "You have been defeated");
                }
                else if (kicked)
                {
                    m.SendAsciiMessage(38, "You have been kicked from the tournament");
                }
                else
                {
                    m.SendAsciiMessage(38, "You have left the tournament");
                }
            }

            //Only print the message if the match is onging
            if (!m_Started)
            {
                return;
            }

            string leaveMessage;

            if (defeated)
            {
                leaveMessage = string.Format("{0} has been defeated", m.Name);
            }
            else if (kicked)
            {
                leaveMessage = string.Format("{0} has been kicked from a tournament", m.Name);
            }
            else
            {
                leaveMessage = string.Format("{0} has left a tournament", m.Name);
            }

            TournamentCore.SendMessage(Contestants, leaveMessage, true);
        }
 private void Awake()
 {
     myFighting = GetComponent <Fighting>();
 }
Example #18
0
        public override void Execute(RootObject update, VkApi client, SqlConnection Con)
        {
            MessagesSendParams @params  = new MessagesSendParams();
            MessagesSendParams @params2 = new MessagesSendParams();
            var  chatId          = [email protected]_id;
            var  keyboardBuilder = new KeyboardBuilder().Clear();
            long defence         = 0;
            long attack          = 0;

            var client2 = new VkApi();

            client2.AuthorizeAsync(new ApiAuthParams
            {
                AccessToken = AppSettings.TokenArena
            });

            try
            {
                if (update.group_id == AppSettings.GroupIDArena)
                {
                    var users = new List <UserObject>();

                    SqlCommand getUser = new SqlCommand("SELECT chatId FROM Users WHERE inTheSearchEnemy = @inTheSearchEnemy;", Con);
                    getUser.Parameters.AddWithValue("@inTheSearchEnemy", 1);
                    SqlDataReader rgetUser = getUser.ExecuteReader();
                    while (rgetUser.Read())
                    {
                        users.Add(new UserObject()
                        {
                            chatId = (long)Convert.ToDouble(rgetUser["chatId"])
                        });
                    }
                    rgetUser.Close();

                    if (users.FindAll(u => u.chatId != chatId).Count > 0)
                    {
                        Random random = new Random();

                        switch (random.Next(0, 2))
                        {
                        case 0:
                            defence         = chatId;
                            @params.UserId  = chatId;
                            @params.Message = "🛡 Ты сражаешься на стороне защиты. Бой начнётся через 5, 4,\n" +
                                              "3\n" +
                                              "2\n" +
                                              "1\n";

                            attack           = users.Find(u => u.chatId != chatId).chatId;
                            @params2.UserId  = attack;
                            @params2.Message = "⚔ Ты сражаешься на стороне атаки. Бой начнётся через 5, 4,\n" +
                                               "3\n" +
                                               "2\n" +
                                               "1\n";

                            break;

                        default:
                            attack          = chatId;
                            @params.UserId  = chatId;
                            @params.Message = "⚔ Ты сражаешься на стороне атаки. Бой начнётся через 5, 4,\n" +
                                              "3\n" +
                                              "2\n" +
                                              "1\n";

                            defence          = users.Find(u => u.chatId != chatId).chatId;
                            @params2.UserId  = defence;
                            @params2.Message = "🛡 Ты сражаешься на стороне защиты. Бой начнётся через 5, 4,\n" +
                                               "3\n" +
                                               "2\n" +
                                               "1\n";
                            break;
                        }
                        @params2.RandomId = GetRandomId();
                        client2.Messages.SendAsync(@params2);
                        @params.RandomId = GetRandomId();
                        client2.Messages.SendAsync(@params);

                        SqlCommand addUser = new SqlCommand("INSERT INTO Fights (defence, attack, state) VALUES (@defence, @attack, @state);", Con);
                        addUser.Parameters.AddWithValue("@defence", defence);
                        addUser.Parameters.AddWithValue("@attack", attack);
                        addUser.Parameters.AddWithValue("@state", 1);
                        addUser.ExecuteNonQuery();

                        SqlCommand getFight = new SqlCommand("SELECT MAX(id) as fightId From Fights WHERE defence = @defence AND attack = @attack;", Con);
                        getFight.Parameters.AddWithValue("@defence", defence);
                        getFight.Parameters.AddWithValue("@attack", attack);
                        SqlDataReader rgetFight = getFight.ExecuteReader();
                        rgetFight.Read();
                        int fightId = Convert.ToInt32(rgetFight["fightId"]);
                        rgetFight.Close();

                        Fighting fighting = new Fighting();
                        fighting.Execute(update, client, Con, fightId, defence, attack);
                    }
                    else
                    {
                        @params.UserId   = chatId;
                        @params.Message  = "Супер! Ты готов! Не теряй концентрации, твой противник вот-вот подключится";
                        @params.RandomId = GetRandomId();
                        client2.Messages.SendAsync(@params);
                    }
                    return;
                }

                var ids  = new long[] { chatId };
                var user = client.Users.Get(ids);

                SqlCommand updTag = new SqlCommand("UPDATE Users SET tag = @tag WHERE chatId = @chatId;", Con);
                updTag.Parameters.AddWithValue("@chatId", chatId);
                updTag.Parameters.AddWithValue("@tag", "Старт");
                updTag.ExecuteNonQuery();

                keyboardBuilder
                .AddButton("👦Школьник", "selectRole-1", KeyboardButtonColor.Primary)
                .AddButton("👨‍🎓Студент", "selectRole-2", KeyboardButtonColor.Primary)
                .AddLine()
                .AddButton("👨‍💼Работающий", "selectRole-3", KeyboardButtonColor.Primary)
                .AddButton("👴Пенсионер", "selectRole-4", KeyboardButtonColor.Primary);


                @params.UserId  = chatId;
                @params.Message = "👋🏻Привет! Ты зачислен на миссию по колонизации новой планеты.\n" +
                                  "Тебя ждёт интересное приключение!";
                @params.RandomId = GetRandomId();
                client.Messages.SendAsync(@params);

                Thread.Sleep(2500);

                @params.UserId  = chatId;
                @params.Message = "На связи чат-бот Космос.\n" +
                                  "Я как Джарвис для Тони Старка, только создан специально для тебя (а ещё у меня лапки🐾).";
                @params.RandomId = GetRandomId();
                client.Messages.SendAsync(@params);

                Thread.Sleep(2500);

                @params.Keyboard = keyboardBuilder.Build();
                @params.UserId   = chatId;
                @params.Message  = "Командир собирает данные по социальному статусу экипажа, чтобы назначить " +
                                   "каждому участнику персональную миссию в рамках колонизации. Выбери свой статус👇🏻";
                @params.RandomId = GetRandomId();
                client.Messages.SendAsync(@params);
            }
            catch (Exception ee)
            {
                @params.Message     = "Ошибка в StartCommand: " + ee.Message;
                @params.Attachments = null;
                @params.Keyboard    = null;
                @params.UserId      = 59111081;
                @params.RandomId    = GetRandomId();
                client.Messages.SendAsync(@params);
            }
        }