public ModScoreTest(DifficultyLevel diffLevel, int damage, int health, int armor, int sm, int speed, int dr, int diff, int potency, int taxes, int rank, int tier, int scarcity, int bountyless, int unwell, int rr, int bp, int cm, int gc, int supply, int vd, int expected)
 {
     Diff       = diffLevel;
     Damage     = damage;
     Health     = health;
     Armor      = armor;
     Sm         = sm;
     Speed      = speed;
     Dr         = dr;
     Difficulty = diff;
     Potency    = potency;
     Taxes      = taxes;
     Rank       = rank;
     Tier       = tier;
     Scarcity   = scarcity;
     Bountyless = bountyless;
     Unwell     = unwell;
     Rr         = rr;
     Bp         = bp;
     Cm         = cm;
     Gc         = gc;
     Supply     = supply;
     Vd         = vd;
     Expected   = expected;
 }
        public void TestDeleteNotInUse()
        {
            DifficultyLevel     level = _dataGenerator.CreateDifficultyLevel();
            IDifficultyLevelDao dao   = new DifficultyLevelDao(_graphClient);

            dao.Delete(level);
        }
예제 #3
0
        public static void SetupCoffer(Coffer coffer)
        {
            if ((coffer.Name).Contains(" coffer"))
            {
                coffer.CofferType = (coffer.Name).Replace(" coffer", "");
            }
            coffer.Name = "coffer";

            coffer.Hue = 0x6A5;
            if (Utility.RandomMinMax(0, 13) != 13)
            {
                coffer.Hue = Server.Misc.RandomThings.GetRandomWoodColor();
            }

            int money1 = 30;
            int money2 = 120;

            double w1 = money1 * (DifficultyLevel.GetGoldCutRate() * .01);
            double w2 = money2 * (DifficultyLevel.GetGoldCutRate() * .01);

            money1 = (int)w1;
            money2 = (int)w2;

            coffer.CofferGold     = Utility.RandomMinMax(money1, money2);
            coffer.CofferRobber   = "";
            coffer.CofferRobbed   = 0;
            coffer.CofferSnooperA = null;
            coffer.CofferSnooperB = null;
            coffer.CofferSnooperC = null;
            coffer.CofferSnooperD = null;
            coffer.CofferSnooperE = null;
        }
 /// <summary>
 /// Only way to create a SampleBrowerItem is via the AddSample static method.
 /// </summary>
 /// <param name="name">Display name.</param>
 /// <param name="lazySample">Creator for the sample.</param>
 private SampleBrowserItem(string name, Lazy<FrameworkElement, ISampleMetadata> lazySample)
 {
     Name = name;
     SampleType = lazySample.Value.GetType();
     OriginalName = lazySample.Metadata.Name;
     SampleLevel = lazySample.Metadata.DifficultyLevel;
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public VariationItemDesignViewModel()
 {
     DifficultyLevel = new DifficultyLevel()
     {
         Name = "7b", Score = 100
     };
 }
예제 #6
0
        public List <SimonResponseData> GetTopFiveUsers(DifficultyLevel difficultyLevel)
        {
            List <SimonResponseData> userWithScores = new List <SimonResponseData>();

            // Get all users as per given difficulty level
            var difficultyLevelUsers = _context.Users.Where(u => u.Scores.Any(s => s.DifficultyLevel == difficultyLevel));

            // Get top 5 users with Highest scores
            var sortedUsersByScores = difficultyLevelUsers.OrderByDescending(u => u.GetTopScoreByDifficultyLevel(difficultyLevel));

            // Get top 5 users
            foreach (var user in sortedUsersByScores.Take(5))
            {
                SimonResponseData data = new SimonResponseData
                {
                    UserName        = user.Name,
                    DifficultyLevel = difficultyLevel,
                    Score           = user.GetTopScoreByDifficultyLevel(difficultyLevel)
                };

                userWithScores.Add(data);
            }

            return(userWithScores);
        }
예제 #7
0
    private GameObject GetShip(DifficultyLevel difficulty)
    {
        float totalWeight = difficulty.ship3Weight + difficulty.ship2Weight + difficulty.ship1Weight;

        if (totalWeight != 0)
        {
            float thresholdValue = Random.Range(0f, 1f);
            float ship3Threshold = difficulty.ship3Weight / totalWeight;
            float ship2Threshold = difficulty.ship2Weight / totalWeight;

            if (thresholdValue < ship3Threshold)
            {
                return(spaceship3);
            }

            thresholdValue -= ship3Threshold;

            if (thresholdValue < ship2Threshold)
            {
                return(spaceship2);
            }
        }

        // default to easiest
        return(spaceship1);
    }
예제 #8
0
            public ConsoleGame(DifficultyLevel difficultyLevel, ActivePlayer computerColor, bool computerPlaysFirst, IODevice iODevice, bool isComputerPlaying, int rows, int columns)
                : base(difficultyLevel, computerColor, computerPlaysFirst, iODevice, isComputerPlaying, rows, columns)
            {
                humanPlayer1 = Player.CreateHumanPlayer(computerColor == ActivePlayer.Red ? ActivePlayer.Yellow : ActivePlayer.Red, iODevice);

                if (isComputerPlaying)
                {
                    computerPlayer = Player.CreateComputerPlayer(computerColor, difficultyLevel, iODevice);
                    if (computerPlaysFirst)
                    {
                        activePlayer = computerPlayer;
                    }
                    else
                    {
                        activePlayer = humanPlayer1;
                    }
                }
                else
                {
                    activePlayer = humanPlayer1;
                    humanPlayer2 = Player.CreateHumanPlayer(humanPlayer1.Color == ActivePlayer.Red ? ActivePlayer.Yellow : ActivePlayer.Red, iODevice);
                }

                this.iODevice = iODevice;
            }
예제 #9
0
 public void Init(DifficultyLevel difficulty)
 {
     _lastTilePos = new Vector3(1, 0, 1);
     _difficulty  = difficulty;
     CreateStartPad();
     CreatePath();
 }
예제 #10
0
 private Game(DifficultyLevel difficultyLevel, ActivePlayer computerColor, bool computerPlaysFirst, IODevice iODevice, bool isComputerPlaying, int rows, int columns)
 {
     this.board              = new Board(rows, columns);
     this.iODevice           = iODevice;
     this.isComputerPlaying  = isComputerPlaying;
     this.computerPlaysFirst = computerPlaysFirst;
 }
예제 #11
0
 public Lock(DifficultyLevel difficultyLevel)
 {
     _randomizer      = new Random();
     _difficultyLevel = difficultyLevel;
     _successZone     = new SuccessZone(difficultyLevel);
     IsOpened         = false;
 }
예제 #12
0
        public void Init(string mapPath, DifficultyLevel level)
        {
            if(GameValues.FFNames == null)
            {
                GameValues.FFNames = new List<string>();
                GameValues.FFNames.Add("Johny");
                GameValues.FFNames.Add("Jeff");
                GameValues.FFNames.Add("Jenny");
                GameValues.FFNames.Add("Jerry");
            }

            Map = new Map(RowsNumber, ColsNumber, mapPath, InitialMarkersCount(level));
            actionMethods = new ActionMethods(Map);

            CreateFirefighters(GameValues.FFNames);
            SceneGenerator.GenerateMap(Map, width, height, distance);

            for (int i = 0; i < Firefighters.Count; i++)
            {
                Firefighters[i].ID = i;
                (Map.Field(Map.RollD6()*2, Map.RollD8()*2) as Room).PutFirefighter(Firefighters[i]);
            }

            GameValues.CurrentFF.NewTurn();
        }
        private static float GetProbability(DifficultyLevel difficultyLevel, FirearmAvailability firearmAvailability, GearSpawnInfo gearSpawnInfo)
        {
            switch (difficultyLevel)
            {
            case DifficultyLevel.Pilgram:
                return(Settings.options.pilgramSpawnExpectation / 403f * 100f);

            case DifficultyLevel.Voyager:
                return(Settings.options.voyagerSpawnExpectation / 403f * 100f);

            case DifficultyLevel.Stalker:
                return(Settings.options.stalkerSpawnExpectation / 403f * 100f);

            case DifficultyLevel.Interloper:
                return(Settings.options.interloperSpawnExpectation / 403f * 100f);

            case DifficultyLevel.Challenge:
                return(Settings.options.challengeSpawnExpectation / 403f * 100f);

            case DifficultyLevel.Storymode:
                return(Settings.options.storySpawnExpectation / 403f * 100f);

            default:
                return(0f);
            }
        }
예제 #14
0
 public Format2()
 {
     this.Question    =
         this.Fact    = string.Empty;
     this.IsTrue      = false;
     this._Difficulty = DifficultyLevel.Easy;
 }
예제 #15
0
    void checkHighScore()
    {
        print("check highscore called");
        switch (DifficultyLevel.getDifficultyLevel())
        {
        case 2:
            HS = easyHighScore;
            calculateHighScore();
            easyHighScore = HS;
            break;

        case 3:
            HS = normalHighScore;
            calculateHighScore();
            normalHighScore = HS;
            break;

        case 4:
            HS = hardHighScore;
            calculateHighScore();
            hardHighScore = HS;
            break;

        case 5:
            HS = insaneHighScore;
            calculateHighScore();
            insaneHighScore = HS;
            break;
        }
    }
예제 #16
0
    /// <summary>
    /// Gets the an int value that will modify a stat.
    /// </summary>
    /// <returns>The modifier value.</returns>
    /// <param name="m">Minimum value.</param>
    /// <param name="M">Maximum value.</param>
    public int GetModPwr(int m, int M)
    {
        // Minimum and maximum is multiplied by the dificulty level.
        int mod = Random.Range(m * DifficultyLevel.GetInstance().GetDifficultyMultiplier(), M * DifficultyLevel.GetInstance().GetDifficultyMultiplier());

        return(mod);
    }
예제 #17
0
        static ClasicGameSetting()
        {
            var data = Setting.Get(SettingKey.BoardSize);

            if (!string.IsNullOrWhiteSpace(data))
            {
                _boardSize = int.Parse(data);
            }

            data = Setting.Get(SettingKey.DifficulyLevel);
            if (!string.IsNullOrWhiteSpace(data))
            {
                _difficultyLevel = (DifficultyLevel)Enum.Parse(typeof(DifficultyLevel), data);
            }
            else
            {
                _difficultyLevel = DifficultyLevel.Medium;
            }

            data = Setting.Get(SettingKey.FirstMove);
            if (!string.IsNullOrWhiteSpace(data))
            {
                _firstMove = bool.Parse(data);
            }

            data = Setting.Get(SettingKey.Is2Players);
            if (!string.IsNullOrWhiteSpace(data))
            {
                _is2Players = bool.Parse(data);
            }
        }
예제 #18
0
        /// <summary>
        /// Creates a new board, according to the difficulty level
        /// </summary>
        /// <param name="level">Difficulty level</param>
        /// <remarks>Don't use this constructor to create a custom game</remarks>
        internal Board(DifficultyLevel level) : this()
        {
            if (level == DifficultyLevel.Custom)
            {
                throw new MastermindBoardException("The difficulty level cannot be custom");
            }

            switch (level)
            {
            case DifficultyLevel.Level1:
                this.NumberPegs = 4;
                this.NumberRows = 8;
                break;

            case DifficultyLevel.Level2:
                this.NumberPegs = 5;
                this.NumberRows = 10;
                break;

            case DifficultyLevel.Level3:
                this.NumberPegs = 6;
                this.NumberRows = 12;
                break;

            default:
                break;
            }

            this.rows = new ColoredPegRow[this.NumberRows];
        }
예제 #19
0
    void Update()
    {
        float timeSinceSpawn    = Time.time - lastSpawnTime;
        float randomSpawnFactor = Random.value;

        // Check if it is in intra stages, and the player has finished killing the enemies
        if (bPauseSpawning && spawnedEnemies.Count == 0)
        {
        }

        GameLevel       currentGameLevel = levels[currentLevel];
        DifficultyLevel diffculty        = currentGameLevel.difficultyLevels[levelDifficulty];

        if (spawnedEnemies.Count < diffculty.maxEnemies && !bPauseSpawning)
        {
            // Mandatory spawn case
            if (timeSinceSpawn > maxSpawnInterval || spawnedEnemies.Count < diffculty.minEnemies)
            {
                SpawnEnemy();
            }
            else if (diffculty.spawnRate * Time.deltaTime > randomSpawnFactor)
            {
                // random chance of spawn happening at any given time
                SpawnEnemy();
            }
        }

        // Check for level update
        if (player.GetPoints() > diffculty.pointsThreshold && !bPauseSpawning)
        {
            // Increment difficulty level, if its the end of the level set, go to the next set
            levelDifficulty += 1;
            if (levelDifficulty >= currentGameLevel.difficultyLevels.Length)
            {
                levelDifficulty = currentGameLevel.difficultyLevels.Length - 1;
                EndOfLevelSet();
            }
            else
            {
                UpdateNewDifficultyLevel();
            }
        }

        // if waiting on enemies, go to next level when spawned are all killed
        if (bWaitingOnEnemys && spawnedEnemies.Count == 0)
        {
            TransitionToNextLevel();
        }

        // Update timed functions
        for (int i = timerList.Count - 1; i >= 0; i--)
        {
            if (Time.time - timerList[i].addedTime >= timerList[i].delay)
            {
                timerList[i].function();

                timerList.RemoveAt(i);
            }
        }
    }
예제 #20
0
        public void Execute(string name, DifficultyLevelScale scale, DifficultyLevel level)
        {
            Name            = name;
            DifficultyLevel = level;


            NameAndLevelInputView       view = AppContext.Container.Resolve <NameAndLevelInputView>();
            INameAndLevelInputViewModel vm   = AppContext.Container.Resolve <INameAndLevelInputViewModel>();

            view.DataContext = vm;

            vm.RequestCloseAfterCancel += delegate { view.Close(); };
            vm.RequestCloseAfterOk     += delegate
            {
                view.Close();
                Name            = vm.Name;
                DifficultyLevel = vm.SelectedDifficultyLevel;
            };

            vm.LoadData();

            vm.PresetValues(name, scale, level);

            view.Owner = WindowParentHelper.Instance.GetWindowBySpecificType(typeof(MainView));

            view.ShowDialog();
        }
예제 #21
0
    Difficulty GetDifficultySpecifics(DifficultyLevel difficultyLevel)
    {
        switch (difficultyLevel)
        {
        case DifficultyLevel.Easy:
            Difficulty.SetDungeonSize(7);
            Difficulty.SetLight(200);
            Difficulty.SetSpecterSpeed(1.65f);
            break;

        case DifficultyLevel.Normal:
            Difficulty.SetDungeonSize(10);
            Difficulty.SetLight(500);
            Difficulty.SetSpecterSpeed(1.5f);
            break;

        case DifficultyLevel.Hard:
            Difficulty.SetDungeonSize(14);
            Difficulty.SetLight(800);
            Difficulty.SetSpecterSpeed(1.35f);
            break;

        default:
            return(null);
        }
        return(Difficulty);
    }
        public void CreateControllerTest_InputAlienWave()
        {
            //Erzeugung Testumgebung

            ControllerManager target = new ControllerManager();
            //Nicht benötigt
            object sender = null;


            BehaviourEnum          behaviour   = BehaviourEnum.BlockMovement;
            LinkedList <IGameItem> controllees = new LinkedList <IGameItem>();

            controllees.AddFirst(new Alien(Vector2.Zero, new Vector2(5, 5), 1, 1, new PlayerNormalWeapon(), 7));

            DifficultyLevel difficultyLevel = DifficultyLevel.EasyDifficulty;



            ControllerEventArgs desiredController = new ControllerEventArgs(behaviour, controllees, difficultyLevel); // TODO: Initialize to an appropriate value


            //Test start
            target.CreateController(sender, desiredController);


            //Testergebnis
            Assert.AreEqual(target.Controllers.Count, 1);
        }
예제 #23
0
    // Update is called once per frame
    void Update()
    {
        // this means it is not abducting
        if (!beam_gameObject.activeInHierarchy)
        {
            if (Cow_controller.instances.Count > 0)
            {
                for (int i = difficultLevels.Length - 1; i >= 0; i--)
                {
                    if (difficultLevels[i].time_Activation <= SceneController_gameScene.instance.time_duration)
                    {
                        currentDifficulty = difficultLevels[i];
                        break;
                    }
                }

                //MoveToClosestCow();
                SmartMove();

                BeamCheck();
            }
            else
            {
                temp3V1   = transform.position;
                temp3V1.z = 0.0f;

                temp3V2   = startingPoint;
                temp3V2.z = 0.0f;

                // then move towards the closest cow
                transform.position = Vector3.MoveTowards(temp3V1, temp3V2, currentDifficulty.movement_speed * Time.deltaTime);
            }
        }
    }
예제 #24
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Slider slMoney      = UIHelpers.FindChild <Slider>(this, "money");
            Slider slLoan       = UIHelpers.FindChild <Slider>(this, "loan");
            Slider slPrice      = UIHelpers.FindChild <Slider>(this, "price");
            Slider slPassengers = UIHelpers.FindChild <Slider>(this, "passengers");
            Slider slAI         = UIHelpers.FindChild <Slider>(this, "AI");
            Slider slStartData  = UIHelpers.FindChild <Slider>(this, "startdata");

            double money      = slMoney.Value;
            double loan       = slLoan.Value;
            double passengers = slPassengers.Value;
            double price      = slPrice.Value;
            double AI         = slAI.Value;
            double startData  = slStartData.Value;

            DifficultyLevel level = new DifficultyLevel("Custom", money, loan, passengers, price, AI, startData);

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2406"), Translator.GetInstance().GetString("MessageBox", "2406", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                DifficultyLevels.AddDifficultyLevel(level);

                PageNavigator.NavigateTo(new PageNewGame());
            }
        }
예제 #25
0
            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                {
                    return;
                }

                string myQuest = CharacterDatabase.GetQuestInfo(m_Mobile, "FishingQuest");

                int    nAllowedForAnotherQuest = FishingQuestFunctions.QuestTimeNew(m_Mobile);
                int    nServerQuestTimeAllowed = DifficultyLevel.GetTimeBetweenQuests();
                int    nWhenForAnotherQuest    = nServerQuestTimeAllowed - nAllowedForAnotherQuest;
                string sAllowedForAnotherQuest = nWhenForAnotherQuest.ToString();

                if (CharacterDatabase.GetQuestState(m_Mobile, "FishingQuest"))
                {
                    m_Mobile.PrivateOverheadMessage(MessageType.Regular, 1150, false, "You are already on a quest. Return here when you are done.", m_Mobile.NetState);
                }
                else if (nWhenForAnotherQuest > 0)
                {
                    m_Mobile.PrivateOverheadMessage(MessageType.Regular, 1150, false, "There are no quests at the moment. Check back in " + sAllowedForAnotherQuest + " minutes.", m_Mobile.NetState);
                }
                else
                {
                    int nFame = m_Mobile.Fame * 2;
                    nFame = Utility.RandomMinMax(0, nFame) + 2000;

                    FishingQuestFunctions.FindTarget(m_Mobile, nFame);

                    string TellQuest = FishingQuestFunctions.QuestStatus(m_Mobile) + ".";
                    m_Mobile.PrivateOverheadMessage(MessageType.Regular, 1150, false, TellQuest, m_Mobile.NetState);
                }
            }
예제 #26
0
        public GameEngine(DifficultyLevel level, Game gameBoard)
        {
            Level      = level;
            _gameBoard = gameBoard;

            switch (Level)
            {
            case DifficultyLevel.Begginer:
                Rows          = 8;
                Columns       = 8;
                NumberOfMines = 10;
                break;

            case DifficultyLevel.Intermediate:
                Rows          = 16;
                Columns       = 16;
                NumberOfMines = 40;
                break;

            case DifficultyLevel.Expert:
                Rows          = 16;
                Columns       = 30;
                NumberOfMines = 99;
                break;

            default:
                Rows          = 8;
                Columns       = 8;
                NumberOfMines = 10;
                break;
            }

            _totalTilesToUnflip = Rows * Columns - NumberOfMines;
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            DifficultyLevel level = new DifficultyLevel("Custom", slMoney.Value, slLoan.Value, slPassengers.Value, slPrice.Value, slAI.Value, slStartData.Value);

            this.Selected = level;
            this.Close();
        }
예제 #28
0
    public void SetGameDifficulty(string difficultySelection)
    {
        switch (difficultySelection)
        {
        case "EASY":
            gameDifficulty = DifficultyLevel.EASY;
            DataManager.Instance.gameDifficultyLevel = gameDifficulty;
            break;

        case "MEDIUM":
            gameDifficulty = DifficultyLevel.MEDIUM;
            DataManager.Instance.gameDifficultyLevel = gameDifficulty;
            break;

        case "HARD":
            gameDifficulty = DifficultyLevel.HARD;
            DataManager.Instance.gameDifficultyLevel = gameDifficulty;
            break;

        case "INSANE":
            gameDifficulty = DifficultyLevel.INSANE;
            DataManager.Instance.gameDifficultyLevel = gameDifficulty;
            break;

        default:
            break;
        }
    }
예제 #29
0
 public Scenario(
     string name,
     string description,
     Airline airline,
     Airport homebase,
     int startyear,
     int endyear,
     long startcash,
     DifficultyLevel difficulty)
 {
     Name = name;
     Airline = airline;
     Homebase = homebase;
     StartYear = startyear;
     StartCash = startcash;
     Description = description;
     Difficulty = difficulty;
     EndYear = endyear;
     OpponentAirlines = new List<ScenarioAirline>();
     Destinations = new List<Airport>();
     Fleet = new Dictionary<AirlinerType, int>();
     Routes = new List<ScenarioAirlineRoute>();
     Failures = new List<ScenarioFailure>();
     PassengerDemands = new List<ScenarioPassengerDemand>();
 }
예제 #30
0
 /// <summary>
 /// Turns EnemyCreator module on.
 /// Must be parameterised with difficulty level.
 /// Will work until turned off.
 /// </summary>
 public void TurnOn(DifficultyLevel difficultyLevel)
 {
     if (difficultyLevel.Enemies.Length == 0)
     {
         Debug.LogError("No Enemies were provided with the difficulty level.");
         return;
     }
     //получение текущего уровня сложности
     currentDifficultyLevel = difficultyLevel;
     GetFactories();
     RecalculateSpawnChances();
     //проеверяем, нужны ли враги на старте
     if (currentDifficultyLevel.SpawnOnStart)
     {
         //спавним сколько нужно
         SpawnWave(currentDifficultyLevel.NumberToSpawnOnStart, StartSpawnChances);
     }
     //отключаем корутины, которые могли остаться с предыдущего уровня сложности
     StopAllCoroutines();
     //проверяем, нужно ли спавнить врагов по таймеру
     if (currentDifficultyLevel.SpawnAfterStart)
     {
         if (currentDifficultyLevel.SpawnInterval != 0)
         {
             StartCoroutine(IntervalSpawn(currentDifficultyLevel.SpawnInterval));
         }
     }
 }
예제 #31
0
        public Lobby(
            string gameID,
            string host,
            string hostID,
            ObservableCollection <Player> players,
            GameModes gameMode,
            DifficultyLevel difficulty,
            int playersCount,
            int nPlayersMax,
            Languages language,
            int nbRounds
            )
        {
            PlayersCount = playersCount;
            Players      = players;
            PlayersMax   = nPlayersMax;

            ID         = gameID;
            Host       = host;
            HostID     = hostID;
            Mode       = gameMode;
            Difficulty = difficulty;
            Language   = language;
            Rounds     = nbRounds;

            Duration = CalculateDuration();
        }
예제 #32
0
        private void ReadSetting()
        {
            var data = DependencyService.Get <IUserPreferences>().GetString("BoardSize");

            if (!string.IsNullOrWhiteSpace(data))
            {
                currentBoardSize = int.Parse(data);
            }

            data = DependencyService.Get <IUserPreferences>().GetString("DifficulyLevel");
            if (!string.IsNullOrWhiteSpace(data))
            {
                currentDifficulyLevel = (DifficultyLevel)Enum.Parse(typeof(DifficultyLevel), data);
            }

            data = DependencyService.Get <IUserPreferences>().GetString("FirstMove");
            if (!string.IsNullOrWhiteSpace(data))
            {
                currentFirstMove = bool.Parse(data);
            }

            data = DependencyService.Get <IUserPreferences>().GetString("IsMute");
            if (!string.IsNullOrWhiteSpace(data))
            {
                IsMute = bool.Parse(data);
            }
        }
예제 #33
0
 public Stat this[DifficultyLevel level, CoreCZ.Side side]
 {
     get
     {
         return other[index(level, side)];
     }
 }
예제 #34
0
    // Use this for initialization
    void Start()
    {
        if (transform.parent.tag != "Player")
        {
            difficulty = GetComponentInParent <EnemyBase>().currentDifficulty;
        }

        SetType(Type);

        if (PROJECTILE_ANCHOR == null)
        {
            GameObject go = new GameObject("_ProjectileAnchor");
            PROJECTILE_ANCHOR = go.transform;
        }

        GameObject rootGO = transform.root.gameObject;

        if (rootGO.GetComponent <Player>() != null)
        {
            rootGO.GetComponent <Player>().fireDelegate += Fire;
        }

        if (gameObject.GetComponentInParent <EnemyBase>() != null)
        {
            gameObject.GetComponentInParent <EnemyBase>().fireDelegate += Fire;
        }
    }
 /// <summary>
 /// Initializes a new instance of the SampleAttribute class.
 /// </summary>
 /// <param name="name">
 /// Name of the sample.
 /// </param>
 /// <param name="difficultyLevel">
 /// Difficulty Level of the sample.
 /// </param>
 /// <param name="category">
 /// Category of the sample.
 /// </param>
 public SampleAttribute(string name, DifficultyLevel difficultyLevel, string category)
     : base("Sample", typeof(FrameworkElement))
 {
     Debug.Assert(!string.IsNullOrEmpty(name), "name should not be empty!");
     Name = name;
     DifficultyLevel = difficultyLevel;
     Category = category;
 }
예제 #36
0
 public Stat this[DifficultyLevel level]
 {
     get
     {
         Stat s1 = other[index(level, CoreCZ.Side.Cross)];
         Stat s2 = other[index(level, CoreCZ.Side.Zero)];
         return new Stat(s1.Count + s2.Count, s1.Victory + s2.Victory, s1.TurnsAmount + s2.TurnsAmount);
     }
 }
예제 #37
0
        public static bool UseSkill(Skill skill, Entity entity, DifficultyLevel difficulty)
        {
            bool result = false;
            int target = skill.SkillValue + (int)difficulty;

            foreach (string s in skill.ClassModifiers.Keys)
            {
                if (s == entity.EntityClass)
                {
                    target += skill.ClassModifiers[s];
                }
            }

            foreach (Modifier m in entity.SkillModifiers)
            {
                if (m.Modifying == skill.SkillName)
                {
                    target += m.Amount;
                }
            }

            string lower = skill.PrimaryAttribute.ToLower();

            switch (lower)
            {
                case "strength":
                    target += Skill.AttributeModifier(entity.Strength);
                    break;
                case "dexterity":
                    target += Skill.AttributeModifier(entity.Dexterity);
                    break;
                case "intelligence":
                    target += Skill.AttributeModifier(entity.Intelligence);
                    break;
                case "agility":
                    target += Skill.AttributeModifier(entity.Agility);
                    break;
                case "wisdom":
                    target += Skill.AttributeModifier(entity.Wisdom);
                    break;
                case "vitality":
                    target += Skill.AttributeModifier(entity.Vitality);
                    break;
            }

            if (Mechanics.RollDie(DieType.D100) <= target)
            {
                result = true;
            }

            return result;
        }
예제 #38
0
파일: Mechanics.cs 프로젝트: vkuts/Gamesor
        public static bool UseSkill(Skill skill, Entity entity, DifficultyLevel difficulty)
        {
            bool result = false;

            int target = skill.SkillValue + (int)difficulty;

            foreach (string s in skill.ClassModifiers.Keys)
                if (s == entity.EntityClass)
                    target += skill.ClassModifiers[s];

            foreach (Modifier m in entity.SkillModifiers)
            {
                if (m.Modifying == skill.SkillName)
                {
                    target += m.Amount;
                }
            }

            string lower = skill.PrimaryAttribute.ToLower();

            switch (lower)
            {
                case "strength":
                    target += Skill.AttributeModifier(entity.Strength);
                    break;
                case "dexterity":
                    target += Skill.AttributeModifier(entity.Dexterity);
                    break;
                case "cunning":
                    target += Skill.AttributeModifier(entity.Cunning);
                    break;
                case "willpower":
                    target += Skill.AttributeModifier(entity.Willpower);
                    break;
                case "magic":
                    target += Skill.AttributeModifier(entity.Magic);
                    break;
                case "constitution":
                    target += Skill.AttributeModifier(entity.Constitution);
                    break;
            }

            if (Mechanics.RollDie(DieType.D100) <= target)
                result = true;

            return result;
        }
예제 #39
0
 public AdditionProblem(DifficultyLevel level)
 {
     switch (level)
     {
         case DifficultyLevel.EASY:
             SetupInstance(rng.Next(10, 100), rng.Next(10, 100));
             break;
         case DifficultyLevel.MEDIUM:
             SetupInstance(rng.Next(100, 1000), rng.Next(100, 1000));
             break;
         case DifficultyLevel.HARD:
             SetupInstance(rng.Next(1000, 10000), rng.Next(1000, 10000));
             break;
         default:
             throw new ArgumentException("Not a valid difficulty level");
     }
 }
예제 #40
0
        public void SetupBoard(IList<Player> players, DifficultyLevel difficultyLevel)
        {
            if (players == null) { throw new ArgumentNullException("Players was null"); }
            if (players.Count == 0) { throw new ArgumentOutOfRangeException("Players was out of range"); }
            if (difficultyLevel == DifficultyLevel.Unknown) { throw new ArgumentOutOfRangeException("DifficultyLevel was out of range"); }

            Initialize();

            foreach (var player in players)
            {
                Players.Add(player, new MoveManager(new MoveGenerator()));
            }

            CurrentDifficultyLevel = difficultyLevel;

            _gameClockTimer.Start();
            GamePlayStatus = GamePlayStatus.BeingPlayed;
        }
예제 #41
0
        public ArithmeticChallenge(DifficultyLevel level, int numProblems)
            : base()
        {
            InitializeComponent();
            this.numProblems = numProblems;
            tblProblems.RowCount = numProblems;
            problems = new ArithmeticProblem[numProblems];
            lblProblems = new Label[numProblems];
            tbxProblems = new TextBox[numProblems];

            for (int i = 0; i < numProblems; i++)
            {
                problems[i] = ArithmeticProblem.MakeRandomProblem(level);

                lblProblems[i] = new Label();
                lblProblems[i].Text = problems[i].ToString();
                tblProblems.Controls.Add(lblProblems[i], 0, i);

                tbxProblems[i] = new TextBox();
                tbxProblems[i].TextChanged += ArithmeticChallenge_TextChanged;
                tblProblems.Controls.Add(tbxProblems[i], 1, i);
            }
        }
 public IEnumerable<QuizQuestion> GetQuestions(DifficultyLevel ofLevel)
 {
     return from QuizQuestion q in _db
            where q.Difficulty == ofLevel
            select q;
 }
예제 #43
0
        public Dictionary<Marker, int> InitialMarkersCount(DifficultyLevel level)
        {
            Dictionary<Marker, int> imc = new Dictionary<Marker, int>();

            switch(level)
            {
                case DifficultyLevel.Recruit:
                    imc[Marker.Fire] = 3; //Tyle eksplozji. Punkty zapalne od razu dodają się przy eksplozjach.
                    imc[Marker.UncoveredPoi] = 3; //Tyle Ofiar
                    imc[Marker.Hazard] = 3; //Tyle materiałów niebezpiecznych
                    imc[Marker.Ignition] = 3+2; //To - 9 dodatkowych punktów zapalnych.
                    GameValues.IgnitionsLeft = 6;
                    break;
                case DifficultyLevel.Veteran:
                    imc[Marker.Fire] = 3;
                    imc[Marker.UncoveredPoi] = 3;
                    imc[Marker.Hazard] = 4;
                    imc[Marker.Ignition] = 3+5;
                    GameValues.IgnitionsLeft = 6;
                    break;
                case DifficultyLevel.Heroic:
                    imc[Marker.Fire] = 4;
                    imc[Marker.UncoveredPoi] = 3;
                    imc[Marker.Hazard] = 4;
                    imc[Marker.Ignition] = 4+8;
                    GameValues.IgnitionsLeft = 12;
                    break;
            }

            GameValues.BuildingHealth = 24;
            GameValues.FalseAlarms = 5;

            return imc;
        }
 public int CountQuestions(DifficultyLevel ofLevel)
 {
     return (from QuizQuestion q in _db
             where q.Difficulty == ofLevel
             select q).Count();
 }
예제 #45
0
파일: Game.cs 프로젝트: bjeanes/uni
        /// <summary>
        /// NewPuzzle(DifficultyLevel level) clears previous puzzle, 
        /// if it exists, and creates a new one of specified difficulty.
        /// <remarks>Precondition: PuzzlesAvailable() returns true.</remarks>
        /// </summary>
        /// <param name="level">difficulty level of the new puzzle</param>
        public bool NewPuzzle(DifficultyLevel level)
        {
            if (morePuzzles[(int)level].Count > 0)
            {
                // If a puzzle is already in existence, get rid of it:
                if (currentPuzzle != null)
                {
                    currentPuzzle.Clear();
                }

                // Randomly choose puzzle
                int i = new Random().Next(morePuzzles[(int)level].Count);

                // Create puzzle
                currentPuzzle =
                    new Puzzle(this, (string)morePuzzles[(int)level][i]);

                // if game is unfinished,
                //   the puzzlestring in puzzle will be re-added to
                //   morePuzzles iff they didn't save game.

                // remove new puzzle from the morePuzzles list
                morePuzzles[(int)level].RemoveAt(i);
                puzzlesAvailable--; // decrease the level of puzzlesAvailable.

                return true;
            }
            else
            {
                MessageBox.Show("No puzzles available in that difficulty. \n" +
                                "Please add more puzzles or choose a " +
                                "different difficulty", "No more puzzles!",
                                MessageBoxButtons.OK);
                return false;
            }
        }
예제 #46
0
        /// <summary>
        /// Generates a grid with the given difficulty level.
        /// </summary>
        public Grid Generate(DifficultyLevel difficulty)
        {
            // Generates stuff
            // 1. Randomnly fill in the top and left part of the grid.
            // 2. Try to solve it
            // 3. Until we have enough blanks:
            //      remove some blanks
            //      if it isn't uniquely solvable, add those two blanks again.
            Grid grid = GenerateBlankGrid();

            Grid result;

            // Top row
            List<int> row = Enumerable.Range(1, 9).OrderBy((i) => rand.Next()).ToList();
            for (int i = 0; i < 9; i++)
            {
                grid.Set(row[i], false, i, 0);
            }

            // Top column
            row = Enumerable.Range(1, 9).OrderBy((i) => rand.Next()).ToList();
            row.Remove(grid.Get(0, 0));
            for (int i = 0; i < 8; i++)
            {
                grid.Set(row[i], false, 0, i+1);
            }

            if (solver.FindErrors(grid).Count > 0)
            {
                // This is not enough to guarantee correctness.
                // If we get an invalid grid, try try again!
                result = Generate(difficulty);
            }
            else
            {
                solver.Solve(grid);

                // How many blanks do we need?
                int targetBlanks = 0;
                switch (difficulty)
                {
                    case DifficultyLevel.Easy:
                        targetBlanks = 30;
                        break;
                    case DifficultyLevel.Medium:
                        targetBlanks = 45;
                        break;
                    case DifficultyLevel.Hard:
                        targetBlanks = 50;
                        break;
                }

                // Remove squares until we have the right number of blanks.
                int tries = 0;
                while (tries < 100 && CountBlank(grid) < targetBlanks)
                {
                    Grid saveCopy = grid.Copy();
                    // Solving is expensive. Blanking squares is easy!
                    // When the grid is mostly full, you can blank squares
                    // in relative safety without generating a non-unique
                    // puzzle. When the puzzle gets more sparse, you
                    // need to be more careful.
                    // That's what we're doing here. Quick optimization.
                    for (int i = 0; i < (targetBlanks - CountBlank(grid))/2 + 1; i++)
                    {
                        MaybeRandomBlank(grid);
                    }
                    if (!solver.Solve(grid.Copy()))
                    {
                        // it failed
                        grid = saveCopy;
                    }
                    tries++;
                }
                //Console.WriteLine("Generated puzzle in " + tries + " tries with "+CountBlank(grid)+" blanks");

                // Finally, set every square to be not editable
                grid.ForEachSquare((r, c, val) =>
                {
                    if (val != 0)
                    {
                        grid.SetEditable(false, r, c);
                    }
                });

                result = grid;
            }
            return result;
        }
예제 #47
0
파일: Game.cs 프로젝트: bjeanes/uni
        /// <summary>
        /// Reads in a given file and parses each new puzzle string into the
        /// morePuzzles ArrayList.
        /// </summary>
        /// <param name="filename">this is the location of puzzles file.</param>
        public void ReadPuzzles(String filename)
        {
            // Check that the file is valid:
            if (File.Exists(filename))
            {
                // open file stream:
                StreamReader puzzleFile = new StreamReader(filename);

                // read in first line to find out how many puzzles it contains:
                String line = puzzleFile.ReadLine();

                int puzzlesInFile = int.Parse(line);

                // iterate through each line of file, adding each one too
                // morePuzzles, if it isn't already in the morePuzzles
                // ArrayList.
                for(int i=0,errorCount=0; i<puzzlesInFile; i++)
                {
                    line = puzzleFile.ReadLine();
                    if (line == null)
                    {
                        puzzleFile.Close();
                        return;
                    }

                    if (this.ValidPuzzle(line.Remove(0, 1)))
                    {
                        DifficultyLevel level = new DifficultyLevel();
                        switch (line[0])
                        {
                            case 'E':
                                level = DifficultyLevel.easy;
                                break;
                            case 'M':
                                level = DifficultyLevel.medium;
                                break;
                            case 'H':
                                level = DifficultyLevel.hard;
                                break;
                            case 'G':
                                level = DifficultyLevel.genius;
                                break;
                        }
                        if (!morePuzzles[(int)level].Contains(line))
                        {
                            // Add puzzle to the appropriate list:
                            morePuzzles[(int)level].Add(line);
                            // increment the puzzles counter:
                            puzzlesAvailable++;
                        }
                    }
                    else
                    {
                        errorCount++;
                        MessageBox.Show("A corrupted puzzle string was found." +
                            " This puzzle string is being skipped.\n\n" +
                            "There have been " + errorCount.ToString() +
                            " broken puzzle string(s) found.",
                            "Puzzle error",MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                }
                puzzleFile.Close();
            }
        }
 /// <summary>
 /// Initializes a new instance of the SampleAttribute class.
 /// </summary>
 /// <param name="name">
 /// Name of the sample.
 /// </param>
 /// <param name="difficultyLevel">
 /// Difficulty Level of the sample.
 /// </param>
 public SampleAttribute(string name, DifficultyLevel difficultyLevel)
 {
     Debug.Assert(!string.IsNullOrEmpty(name), "name should not be empty!");
     Name = name;
     DifficultyLevel = difficultyLevel;
 }
예제 #49
0
 public void AddGame(bool win, DifficultyLevel level, CoreCZ.Side side, int turnsAmount)
 {
     overall = increment(overall, win, turnsAmount);
     other[index(level, side)] = increment(other[index(level, side)], win, turnsAmount);
 }
예제 #50
0
 private bool SeSofpagjaTezinskoNivo(string word, DifficultyLevel difficultyLevel)
 {
     if (word.StartsWith(EasyPrefix) && difficultyLevel == DifficultyLevel.Easy)
     {
         return true;
     }
     if (word.StartsWith(MediumPrefix) && difficultyLevel == DifficultyLevel.Medium)
     {
         return true;
     }
     if (word.StartsWith(HardPrefix) && difficultyLevel == DifficultyLevel.Hard)
     {
         return true;
     }
     return false;
 }
예제 #51
0
 private string key(DifficultyLevel level, CoreCZ.Side side)
 {
     string off = side == CoreCZ.Side.Cross ? "Cross" : "Zero";
     return off + (level == DifficultyLevel.EASY ? "Easy" : "Hard");
 }
예제 #52
0
 private int index(DifficultyLevel level, CoreCZ.Side side)
 {
     int off = side == CoreCZ.Side.Cross ? 0 : 1;
     return off + (level == DifficultyLevel.EASY ? 0 : 2);
 }
예제 #53
0
 public static float GetFifficultyLevelCoef(DifficultyLevel difficultyLevel)
 {
     switch (difficultyLevel)
     {
         case DifficultyLevel.Easy: return DIFFICULTY_LEVEL_EASY_COEF;
         case DifficultyLevel.Normal: return DIFFICULTY_LEVEL_NORMAL_COEF;
         case DifficultyLevel.Hard: return DIFFICULTY_LEVEL_HARD_COEF;
         case DifficultyLevel.Insane: return DIFFICULTY_LEVEL_INSANE_COEF;
         case DifficultyLevel.God: return DIFFICULTY_LEVEL_GOD_COEF;
         default: return DIFFICULTY_LEVEL_NORMAL_COEF;
     }
 }
예제 #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Race"/> class.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <param name="difficulty">The difficulty level.</param>
 public Race(string text, DifficultyLevel difficulty)
 {
     Text = text;
     Difficulty = difficulty;
 }
예제 #55
0
 public static ArithmeticProblem MakeRandomProblem(DifficultyLevel level)
 {
     switch (rng.Next(NUM_TYPES_PUZZLE))
     {
         case 0:
             return new AdditionProblem(level);
         case 1:
             return new MultiplicationProblem(level);
         default:
             throw new Exception();
     }
 }
예제 #56
0
파일: Sudoku.cs 프로젝트: bjeanes/uni
        /// <summary>
        /// Check one difficulty level and ensure everything else is unchecked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DifficultyToolStripMenuItem_Click(object sender, 
            EventArgs e)
        {
            ToolStripMenuItem levelSelect = (ToolStripMenuItem)sender;

            mediumToolStripMenuItem.Checked = false;
            hardToolStripMenuItem.Checked = false;
            geniusToolStripMenuItem.Checked = false;
            easyToolStripMenuItem.Checked = false;

            switch (levelSelect.Text.ToString().Remove(0,1))
            {
                case "Easy":
                    easyToolStripMenuItem.Checked = true;
                    this.level = DifficultyLevel.easy;
                    break;
                case "Medium":
                    mediumToolStripMenuItem.Checked = true;
                    this.level = DifficultyLevel.medium;
                    break;
                case "Hard":
                    hardToolStripMenuItem.Checked = true;
                    this.level = DifficultyLevel.hard;
                    break;
                case "Genius":
                    geniusToolStripMenuItem.Checked = true;
                    this.level = DifficultyLevel.genius;
                    break;
            }
        }
예제 #57
0
        private void ChangeDifficultyLevel(object sender, EventArgs e)
        {
            // Koe nivo e odbrano, takva tezina da se dade
            string option = ((ToolStripMenuItem)sender).Tag as string;
            DifficultyLevel newLevel = DifficultyLevel.Easy;
            switch (option)
            {
                case "Easy":
                    newLevel = DifficultyLevel.Easy;
                    break;
                case "Medium":
                    newLevel = DifficultyLevel.Medium;
                    break;
                case "Hard":
                    newLevel = DifficultyLevel.Hard;
                    break;
            }

            // Ako e odbrana nova tezina, restartiraj ja igrata
            if (tezinaNaIgra != newLevel)
            {
                tezinaNaIgra = newLevel;

                // Proveri go nivoto na tezina
                easyToolStripMenuItem.Checked = (tezinaNaIgra == DifficultyLevel.Easy);
                mediumToolStripMenuItem.Checked = (tezinaNaIgra == DifficultyLevel.Medium);
                hardToolStripMenuItem.Checked = (tezinaNaIgra == DifficultyLevel.Hard);

                ZapocniIgra();
            }
        }
예제 #58
0
    public void StartGame(string difficultyLevel)
    {
        anim.ResetTrigger ("GameOverTrigger");
        score = 0;
        switch (difficultyLevel) {
        case "Easy":
            difficulty = DifficultyLevel.Easy;
            CubeSpeed = difficultyInfo[0].x;
            break;
        case "Medium":
            difficulty = DifficultyLevel.Medium;
            CubeSpeed = difficultyInfo[1].x;
            break;
        case "Hard":
            difficulty = DifficultyLevel.Hard;
            CubeSpeed = difficultyInfo[2].x;
            break;
        case "O_xtreme":
            difficulty = DifficultyLevel.O_xtreme;
            CubeSpeed = difficultyInfo[3].x;
            break;
        }

        timer.StartTimer (3.0f, false, "StartSpawnTimer");
        timer.OnTimerEvent["StartSpawnTimer"] += StartSpawnTimer;
    }