Esempio n. 1
0
        public override GameMove GenerateMove(GameData gameData)
        {
            var query = from actor in gameData.actorDataList
                        where actor.Name == name
                        select actor;

            ActorData myData = query.First();

            if (myData.Hp < 100 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name));
            }
            else if (gameData.actorDataList.Count <= 2)
            {
                return(new GameMove(GameMove.GetRandomLocation(), GameAction.Attack));
            }
            return(new GameMove(GameMove.GetRandomLocation(), GameMove.GetRandomAction()));
        }
Esempio n. 2
0
        public override GameMove GenerateMove(GameData gameData)
        {
            //foreach (var actor in gameData.actorDataList) {

            //    Console.WriteLine(actor.Name + "  =  " + actor.Hp);

            //}
            if (!gameData.isGunTaken)
            {
                if (!gameData.isSafeUnlocked)
                {
                    // return new GameMove(Location.Armory, GameAction.UnlockSafe);
                }
                else
                {
                    attack     = GameAction.NormalAttack;
                    Damage     = 100;
                    messageOwo = "*pew pew* OwO I did an oopsie woopsie";
                    return(new GameMove(Location.Armory, GameAction.TakeGun));
                }
            }

            var ezKill = from actor in gameData.actorDataList
                         where actor.Hp <= Damage && actor.Hp > 0 && actor.Name != name
                         orderby actor.Hp ascending
                         select actor;
            var everybody = from actor in gameData.actorDataList
                            where actor.Hp > 0 && actor.Name != name
                            orderby actor.Hp descending
                            select actor;
            ActorData target = everybody.First();

            if (ezKill.Count() != 0)
            {
                ActorData ripActor = ezKill.First();

                return(new GameMove(ripActor.CurrentLocation, attack, ripActor.Name, messageOwo));
            }

            return(new GameMove(target.CurrentLocation, attack, target.Name, messageOwo));
        }
Esempio n. 3
0
        public override GameMove GenerateMove(GameData gameData)
        {
            var myQuery = from actor in gameData.actorDataList
                          where actor.Name == name
                          select actor;

            ActorData myData = myQuery.First();

            var actorsAliveQuery = from actor in gameData.actorDataList
                                   where actor.Hp > 0
                                   select actor;

            if (myData.Hp < 74 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name, "I feel better."));
            }
            //if (gameData.isSafeUnlocked && !gameData.isGunTaken)
            //{
            //    return new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "I got the gun ! Get behind me, I'll protect you !");
            //}
            //if (!gameData.isMedkitTaken)
            //{
            //    return new GameMove(Location.Bathroom, GameAction.TakeMedkit, myData.Name, "I'm the support now, I'll take good care of you !");
            //}
            if (gameData.gateHp > 0)
            {
                return(new GameMove(Location.Exit, GameAction.RepairGate, myData.Name, "Let's get out of here !"));
            }
            if (gameData.generatorHp > 0)
            {
                return(new GameMove(Location.Basement, GameAction.RepairGenerator, myData.Name, "Let there be light !"));
            }

            if (actorsAliveQuery.Count() <= 2)
            {
                return(new GameMove(GameMove.GetRandomLocation(), GameAction.NormalAttack, "", "I don't wanna die!"));
            }
            return(new GameMove(GameMove.GetRandomLocation(), GameMove.GetRandomAction(), "", "Hmm..."));
        }
Esempio n. 4
0
        public override GameMove GenerateMove(GameData gameData)
        {
            var myQuery = from actor in gameData.actorDataList
                          where actor.Name == name
                          select actor;

            ActorData myData = myQuery.First();

            var actorsAliveQuery = from actor in gameData.actorDataList
                                   where actor.Hp > 0
                                   select actor;

            if (myData.Hp < 100 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name, "I feel better."));
            }
            else if (actorsAliveQuery.Count() <= 2)
            {
                return(new GameMove(GameMove.GetRandomLocation(), GameAction.NormalAttack, "", "I don't wanna die!"));
            }
            return(new GameMove(GameMove.GetRandomLocation(), GameMove.GetRandomAction(), "", "Hmm..."));
        }
Esempio n. 5
0
        public override GameMove GenerateMove(GameData gameData)
        {
            var myQuery = from actor in gameData.actorDataList
                          where actor.Name == name
                          select actor;

            ActorData myData = myQuery.First();

            var actorsAliveQuery = from actor in gameData.actorDataList
                                   where actor.Hp > 0
                                   select actor;

            //var actorsItemsQuery = from actor in gameData.actorDataList
            //                       where actor.Items.Contains(Item.Gun) || actor.Items.Contains(Item.Medkit)
            //                       select actor;

            //ActorData dangerousActor = null;
            if (gameData.isSafeUnlocked == false)
            {
                return(new GameMove(Location.Armory, GameAction.UnlockSafe, myData.Name, "I opened the safe !"));
            }
            if (gameData.isSafeUnlocked && gameData.isGunTaken == false)
            {
                return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "I got the gun ! Get behind me, I'll protect you !"));
            }

            foreach (var actor in actorsAliveQuery)
            {
                if (myData.Items.Contains(Item.Gun) && actor.Name != myData.Name)
                {
                    return(new GameMove(actor.CurrentLocation, GameAction.NormalAttack, actor.Name, "Take this !"));
                }
                else if (actor.Items.Count > 0 && actor.Name != myData.Name)
                {
                    return(new GameMove(actor.CurrentLocation, GameAction.StabAttack, actor.Name, "I love blood..."));
                    //dangerousActor = actor;
                }
                else if (actor.Hp <= 50 && actor.Hp > 0 && actor.Name != myData.Name)
                {
                    return(new GameMove(actor.CurrentLocation, GameAction.StabAttack, actor.Name, "I love blood..."));
                }
            }
            //if (actorsItemsQuery != null)
            //{
            //    ActorData dangerousActor = actorsItemsQuery.First();
            //}
            ActorData survivorActor = actorsAliveQuery.First();

            // je voulais faire une liste des actors dangereux


            if (myData.Hp < 74 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name, "I feel better."));
            }


            //if (dangerousActor != null)
            //{
            //    return new GameMove(dangerousActor.CurrentLocation, GameAction.StabAttack, "", "I need your life...");
            //}
            //if (actorsAliveQuery.ToList())
            //{
            //    return new GameMove(survivorActor.CurrentLocation, GameAction.StabAttack, "", "I need your life...");
            //}

            if (!gameData.isMedkitTaken)
            {
                return(new GameMove(Location.Bathroom, GameAction.TakeMedkit, myData.Name, "I'm the support now, I'll take good care of you !"));
            }

            return(new GameMove(GameMove.GetRandomLocation(), GameAction.StabAttack, "", "My blade thirsts..."));
        }
Esempio n. 6
0
        public override GameMove GenerateMove(GameData gameData)
        {
            int target = 0;


            int alive_count = 0;



            var myQuery = from actor in gameData.actorDataList
                          where actor.Name == name
                          select actor;

            ActorData myData = myQuery.First();

            var actorsAliveQuery = from actor in gameData.actorDataList
                                   where actor.Hp > 0
                                   select actor;

            if (counter == 0)
            {
                for (int x = 0; x < 5; x++)
                {
                    info.Add(x, gameData.actorDataList[x].Name);
                    names.Add(gameData.actorDataList[x].Name);
                    info_array[x, 0] = gameData.actorDataList[x].Hp;
                }
            }
            if (counter % 2 == 0 && counter != 0)
            {
                turns += 2;
                for (int x = 0; x < 5; x++)
                {
                    info_array2[x, 0] = gameData.actorDataList[x].Hp;
                }
            }
            else
            {
                for (int x = 0; x < 5; x++)
                {
                    info_array[x, 0] = gameData.actorDataList[x].Hp;
                }
            }
            for (int A = 0; A < 5; A++)
            {
                if (info_array[A, 0] - 50 == info_array2[A, 0] || info_array2[A, 0] - 50 == info_array[A, 0])
                {
                    Players.Add(gameData.actorDataList[A].Name);
                }
            }
            for (int count = 0; count < 5; count++)
            {
                if (gameData.actorDataList[count].Hp > 0)

                {
                    alive_count++;
                }
            }

            priority1_target = 0;



            for (int Y = 0; Y < 5; Y++)
            {
                target = 0;

                if (gameData.actorDataList[Y].Hp <= 0)
                {
                    target -= 100;
                    if (Head_to_Kill == gameData.actorDataList[Y].Name)
                    {
                        priority1_target = 0;
                        Head_to_Kill     = "";
                    }
                }



                if (counter % 2 == 0)
                {
                    if (info_array[Y, 0] == gameData.actorDataList[Y].Hp + 50)
                    {
                        Players.Add(gameData.actorDataList[Y].Name);
                        test    = gameData.actorDataList[Y].CurrentLocation;
                        Victim  = gameData.actorDataList[Y].Name;
                        target -= 10;
                    }
                    if (test == gameData.actorDataList[Y].CurrentLocation)
                    {
                        target += 3;
                        suspect = gameData.actorDataList[Y].Name;
                    }
                    if (suspect == gameData.actorDataList[Y].Name)
                    {
                        target += 5;
                    }
                }
                if (counter % 2 != 0)
                {
                    if (info_array2[Y, 0] == gameData.actorDataList[Y].Hp + 50)
                    {
                        Players.Add(gameData.actorDataList[Y].Name);

                        Victim  = gameData.actorDataList[Y].Name;
                        target -= 10;
                    }
                    if (test == gameData.actorDataList[Y].CurrentLocation)
                    {
                        target += 2;
                        if (gameData.actorDataList[Y].Name == suspect && suspect != Victim)
                        {
                            target += 15;
                        }
                    }
                }



                if (gameData.actorDataList[Y].Hp <= 50)
                {
                    target -= 2;
                }

                target_array[Y, 0] = +target;

                if (target_array[Y, 0] > priority1_target)
                {
                    priority1_target = target_array[Y, 0];
                    if (gameData.actorDataList[Y].Name != "David" && !Players.Contains(gameData.actorDataList[Y].Name))
                    {
                        Head_to_Kill          = gameData.actorDataList[Y].Name;
                        Head_to_Kill_location = gameData.actorDataList[Y].CurrentLocation;
                    }
                }



                //System.Diagnostics.Debugger.Break();
            }

            //System.Diagnostics.Debugger.Break();
            if (myData.Hp <= 50 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name, "I feel better."));
            }

            if (alive_count < 3 && !myData.Items.Contains(Item.Gun))
            {
                if (gameData.generatorHp > 0 || gameData.gateHp > 25)
                {
                    if (gameData.isGunTaken == true)
                    {
                        return(new GameMove(Head_to_Kill_location, GameAction.NormalAttack, myData.Name, "shit"));
                    }
                }
                if (gameData.generatorHp > 0 || gameData.gateHp > 25)
                {
                    if (gameData.isGunTaken == false)
                    {
                        if (gameData.isSafeUnlocked == false)
                        {
                            return(new GameMove(Location.Armory, GameAction.UnlockSafe, myData.Name, "shit"));
                        }
                        if (gameData.isSafeUnlocked == true)
                        {
                            return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                    }
                }
            }

            ////logic
            if (myData.Hp <= 50 && myData.Items.Contains(Item.Medkit))
            {
                return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name, "I feel better."));
            }
            else
            {
                ///turn 1///////////////////////
                if (counter == 0)
                {
                    counter++;
                    return(new GameMove(Location.Bathroom, GameAction.TakeMedkit, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                }
                ///turn 2///////////////////////
                if (counter == 1)
                {
                    counter++;
                    if (gameData.isSafeUnlocked == true && gameData.isGunTaken == false)
                    {
                        return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                    }
                    else
                    {
                        return(new GameMove(Location.Basement, GameAction.RepairGenerator, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                    }
                }
                ///turn 3///////////////////////
                if (counter == 2)
                {
                    counter++;
                    if (gameData.isSafeUnlocked == true && gameData.isGunTaken == false)
                    {
                        return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                    }
                    if (myData.Items.Contains(Item.Gun))
                    {
                        if (gameData.generatorHp > 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                        else
                        {
                            return(new GameMove(Location.Exit, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                    }
                    else
                    {
                        if (gameData.generatorHp > 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.RepairGenerator, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                    }
                }
                ///turn 4///////////////////////
                if (counter == 3)
                {
                    counter++;
                    if (gameData.isSafeUnlocked == true && myData.Items.Contains(Item.Gun) == false && gameData.isGunTaken == false)
                    {
                        return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                    }
                    if (myData.Items.Contains(Item.Gun))
                    {
                        if (gameData.generatorHp > 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                        else
                        {
                            return(new GameMove(Location.Exit, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                    }
                    else
                    {
                        if (gameData.generatorHp != 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.RepairGenerator, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                        if (gameData.generatorHp == 0)
                        {
                            return(new GameMove(Location.Exit, GameAction.RepairGate, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                    }
                }
                ///turn 5 & + ///////////////////////
                if (counter >= 4)
                {
                    counter++;
                    if (gameData.isSafeUnlocked == true && myData.Items.Contains(Item.Gun) == false && gameData.isGunTaken == false)
                    {
                        return(new GameMove(Location.Armory, GameAction.TakeGun, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                    }
                    if (myData.Items.Contains(Item.Gun))
                    {
                        if (gameData.generatorHp > 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                        else
                        {
                            return(new GameMove(Location.Exit, GameAction.NormalAttack, Head_to_Kill, "powpow"));
                        }
                    }
                    else
                    {
                        if (gameData.generatorHp != 0)
                        {
                            return(new GameMove(Location.Basement, GameAction.RepairGenerator, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                        if (gameData.generatorHp == 0)
                        {
                            return(new GameMove(Location.Exit, GameAction.RepairGate, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
                        }
                    }
                }
            }



            return(new GameMove(Location.Bathroom, GameAction.TakeMedkit, myData.Name, "repair gen!!!!!!!!!!!!!!!!!!"));
        }
Esempio n. 7
0
        public override GameMove GenerateMove(GameData gameData)
        {
            var query = from actor in gameData.actorDataList
                        where actor.Name == name
                        select actor;

            bool tryStabArmory = false;

            //var hLQuery = from actor in gameData.actorDataList
            //              where actor.Name != name
            //              where actor.Hp<=50
            //              where actor.Hp>0
            //              select actor;

            var ennemies = from actor in gameData.actorDataList
                           where actor.Name != name
                           select actor;

            var gunner = from actor in gameData.actorDataList
                         where actor.Items.Contains(Item.Gun)
                         select actor;

            var medic = from actor in gameData.actorDataList
                        where actor.Items.Contains(Item.Medkit)
                        select actor;



            int nbLActor = 0;

            foreach (ActorData a in gameData.actorDataList)
            {
                if (a.Hp > 0)
                {
                    nbLActor++;
                }
            }

            List <GameMove> lastGM = new List <GameMove>();

            foreach (GameMove m in moveHistory)
            {
                lastGM.Add(m);
            }



            ActorData myData   = query.First();
            ActorData gunOwner = new ActorData(new Actor(""));

            if (gunner.Count() > 0)
            {
                gunOwner = gunner.First();
            }
            ActorData medOwner = null;

            if (medic.Count() > 0)
            {
                medOwner = medic.First();
            }

            var gunLM = from move in lastGM
                        where move.actionAuthorName == gunOwner.Name
                        select move;


            List <ActorData> ennemiesData = ennemies.ToList();
            GameMove         gunnerLM     = null;

            if (lastGM.Count > nbLActor)
            {
                lastGM.RemoveRange(0, moveHistory.Count - nbLActor);
                if (gunLM.Count() > 0)
                {
                    gunnerLM = gunLM.First();
                }
            }


            {
                if (myData.Hp <= 50 && myData.Items.Contains(Item.Medkit))
                {
                    return(new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name));
                }
                else if (!gameData.isMedkitTaken)
                {
                    return(new GameMove(Location.Bathroom, GameAction.TakeMedkit));
                }
                else if (gameData.isSafeUnlocked && !gameData.isGunTaken)
                {
                    return(new GameMove(Location.Armory, GameAction.TakeGun));
                }
                else if (myData.Items.Contains(Item.Gun))
                {
                    if (gameData.generatorHp > 0)
                    {
                        return(new GameMove(Location.Basement, GameAction.StabAttack, GetLTarget(gameData)));
                    }
                    else
                    {
                        return(new GameMove(Location.Exit, GameAction.StabAttack, GetLTarget(gameData)));
                    }
                }
                else if (GetFLTarget(gameData) == null)
                {
                    if (!tryStabArmory)
                    {
                        tryStabArmory = true;
                        return(new GameMove(Location.Armory, GameAction.UnlockSafe));
                    }
                    else
                    {
                        tryStabArmory = false;
                        return(new GameMove(Location.Armory, GameAction.StabAttack, GetGunOwner(gameData)));
                    }
                }
                else if (gameData.generatorHp > 0)
                {
                    return(new GameMove(Location.Basement, GameAction.StabAttack, GetLTarget(gameData)));
                }
                else
                {
                    return(new GameMove(Location.Exit, GameAction.StabAttack, GetLTarget(gameData)));
                }
            }

            {
                //if (myData.Hp <= 50 && myData.Items.Contains(Item.Medkit))
                //{
                //    return new GameMove(myData.CurrentLocation, GameAction.UseMedkit, myData.Name);
                //}
                //else if (!gameData.isMedkitTaken)
                //{
                //    return new GameMove(Location.Bathroom, GameAction.TakeMedkit);
                //}
                //else if (gameData.isSafeUnlocked && !gameData.isGunTaken)
                //{
                //    return new GameMove(Location.Armory, GameAction.TakeGun);
                //}
                //else if(myData.Items.Contains(Item.Gun))
                //{
                //    string baseTarget = GetLTarget(gameData, Location.Basement);
                //    string exitTarget = GetLTarget(gameData, Location.Exit);
                //    string bathTarget = GetLTarget(gameData, Location.Bathroom);
                //    string armTarget = GetLTarget(gameData, Location.Armory);

                //    if(baseTarget!=null)
                //    {
                //        return new GameMove(Location.Basement, GameAction.StabAttack,baseTarget);

                //    }
                //    else if(exitTarget!=null)
                //    {
                //        return new GameMove(Location.Exit, GameAction.StabAttack, exitTarget);

                //    }
                //    else if (armTarget != null)
                //    {
                //        return new GameMove(Location.Armory, GameAction.StabAttack, armTarget);

                //    }
                //    else
                //    {
                //        return new GameMove(Location.Bathroom, GameAction.StabAttack, bathTarget);

                //    }

                //}
                //else if(GetFLTarget(gameData)==null)
                //{
                //    if(!gameData.isSafeUnlocked)
                //    {
                //        return new GameMove(Location.Armory, GameAction.UnlockSafe);
                //    }
                //    else
                //    {
                //        if(!gameData.isGunTaken)
                //        {
                //            return new GameMove(Location.Armory, GameAction.TakeGun);
                //        }
                //        else
                //        {
                //            return new GameMove(gunnerLM.nextLocation, GameAction.StabAttack, gunnerLM.actionAuthorName);
                //        }
                //    }
                //}
                //else
                //{
                //    string baseTarget = GetFLTarget(gameData, Location.Basement);
                //    string exitTarget = GetFLTarget(gameData, Location.Exit);
                //    string bathTarget = GetFLTarget(gameData, Location.Bathroom);
                //    string armTarget = GetFLTarget(gameData, Location.Armory);

                //    if (baseTarget != null)
                //    {
                //        return new GameMove(Location.Basement, GameAction.StabAttack, baseTarget);

                //    }
                //    else if (exitTarget != null)
                //    {
                //        return new GameMove(Location.Exit, GameAction.StabAttack, exitTarget);

                //    }
                //    else if (armTarget != null)
                //    {
                //        return new GameMove(Location.Armory, GameAction.StabAttack, armTarget);

                //    }
                //    else if(bathTarget!=null)
                //    {
                //        return new GameMove(Location.Bathroom, GameAction.StabAttack, bathTarget);

                //    }
                //    else
                //    {
                //        baseTarget = GetHLTarget(gameData, Location.Basement);
                //        exitTarget = GetHLTarget(gameData, Location.Exit);
                //        bathTarget = GetHLTarget(gameData, Location.Bathroom);
                //        armTarget = GetHLTarget(gameData, Location.Armory);
                //        if (baseTarget != null)
                //        {
                //            return new GameMove(Location.Basement, GameAction.StabAttack, baseTarget);

                //        }
                //        else if (exitTarget != null)
                //        {
                //            return new GameMove(Location.Exit, GameAction.StabAttack, exitTarget);

                //        }
                //        else if (armTarget != null)
                //        {
                //            return new GameMove(Location.Armory, GameAction.StabAttack, armTarget);

                //        }
                //        else if (bathTarget != null)
                //        {
                //            return new GameMove(Location.Bathroom, GameAction.StabAttack, bathTarget);

                //        }
                //        else
                //        {
                //            baseTarget = GetLTarget(gameData, Location.Basement);
                //            exitTarget = GetLTarget(gameData, Location.Exit);
                //            bathTarget = GetLTarget(gameData, Location.Bathroom);
                //            armTarget = GetLTarget(gameData, Location.Armory);
                //            if (baseTarget != null)
                //            {
                //                return new GameMove(Location.Basement, GameAction.StabAttack, baseTarget);

                //            }
                //            else if (exitTarget != null)
                //            {
                //                return new GameMove(Location.Exit, GameAction.StabAttack, exitTarget);

                //            }
                //            else if (armTarget != null)
                //            {
                //                return new GameMove(Location.Armory, GameAction.StabAttack, armTarget);

                //            }
                //            else
                //            {
                //                return new GameMove(Location.Bathroom, GameAction.StabAttack, bathTarget);

                //            }
                //        }
                //    }
                //}
            }
        }
Esempio n. 8
0
 public Actor(string name)
 {
     this.name = name;
     actorData = new ActorData(this);
 }