コード例 #1
0
ファイル: GameResult.cs プロジェクト: Middlederg/Splendor
 public GameResult(int position, string playerName, Prestige prestige, int developments)
 {
     Position     = position;
     PlayerName   = playerName;
     Prestige     = prestige;
     Developments = developments;
 }
コード例 #2
0
        protected override void OnMouseClick()
        {
            if (IsDisabled)
            {
                return;
            }
            Game1.playSound("bigSelect");
            //Magic numbers for tile size multipliers have been determined through trial and error.
            var dialogWidth  = Game1.tileSize * 12;
            var dialogHeight = Game1.tileSize * 6;

            var viewport      = Game1.graphics.GraphicsDevice.Viewport;
            var screenXCenter = (int)(viewport.Width * (1.0 / Game1.options.zoomLevel)) / 2;
            var screenYCenter = (int)(viewport.Height * (1.0 / Game1.options.zoomLevel)) / 2;
            var dialogXCenter = (dialogWidth + IClickableMenu.borderWidth * 2) / 2;
            var dialogYCenter = (dialogHeight + IClickableMenu.borderWidth * 2) / 2;
            var bounds        = new Rectangle(screenXCenter - dialogXCenter, screenYCenter - dialogYCenter,
                                              dialogWidth + IClickableMenu.borderWidth * 2, dialogHeight + IClickableMenu.borderWidth * 2);

            Logger.LogVerbose($"{Skill.Type.Name} skill prestige attempted.");
            var message = $"Are you sure you wish to prestige your {Skill.Type.Name} skill? This cannot be undone and will revert you back to level 0 {Skill.Type.Name}. All associated benefits {(PerSaveOptions.Instance.ResetRecipesOnPrestige ? "and" : "except for")} crafting/cooking recipes will be lost.";

            Game1.activeClickableMenu.exitThisMenuNoSound();
            Game1.activeClickableMenu = new WarningDialog(bounds, message, () => { Prestige.PrestigeSkill(Skill); },
                                                          () => { });
        }
コード例 #3
0
ファイル: PrestigeButton.cs プロジェクト: Laos0/ClickGame
 // Prestige
 //      Called by button press
 public void prestige()
 {
     // Delete the old game manager
     // A new one will be generated automatically when the scene is reloaded
     GameObject.Destroy(mGameManager);
     Prestige.prestige(mGameManager.GetComponent <MainGameManager>().currency + mShop.GetComponent <Shop>().getShopValue());
 }
コード例 #4
0
        protected override void Apply(string[] args)
        {
            if (args.Length < 1)
            {
                ModEntry.LogMonitor.Log("<skill> must be specified");
                return;
            }
            if (Game1.player == null)
            {
                ModEntry.LogMonitor.Log("A game file must be loaded in order to run this command.");
                return;
            }
            string skillArgument = args[0];

            ModEntry.LogMonitor.Log($"This command will reset your character's prestiged selections and prestige points for the {skillArgument} skill. " + Environment.NewLine +
                                    "Please note that this command by itself will only clear the prestige data located in the skills prestige mod folder, " +
                                    "and *not* the player's gained professions. once this is run all professions already prestiged/purchased will still belong to the player." + Environment.NewLine +
                                    "If you have read this and wish to continue confirm with 'y' or 'yes'");
            string response = Console.ReadLine();

            if (response == null || (!response.Equals("y", StringComparison.InvariantCultureIgnoreCase) && !response.Equals("yes", StringComparison.InvariantCultureIgnoreCase)))
            {
                Logger.LogVerbose($"Cancelled prestige reset for {skillArgument} skill.");
                return;
            }
            Logger.LogInformation($"Resetting prestige data for {skillArgument} skill...");
            Prestige prestige = PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType.Name.Equals(skillArgument, StringComparison.InvariantCultureIgnoreCase));

            prestige.PrestigePoints = 0;
            prestige.PrestigeProfessionsSelected = new List <int>();
            PrestigeSaveData.Instance.Save();
            Logger.LogInformation($"{skillArgument} skill prestige data reset.");
        }
コード例 #5
0
 public PrestigeMenu(Rectangle bounds, Skill skill, Prestige prestige)
     : base(bounds.X, bounds.Y, bounds.Width, bounds.Height, true)
 {
     Logger.LogVerbose($"New {skill.Type.Name} Prestige Menu created.");
     _skill    = skill;
     _prestige = prestige;
     InitiatePrestigeButton();
     InitiateSettingsButton();
 }
コード例 #6
0
 public PrestigeMenu(Rectangle bounds, Skill skill, Prestige prestige) : base(bounds.X, bounds.Y, bounds.Width, bounds.Height, true)
 {
     Logger.LogVerbose($"New {skill.Type.Name} Prestige Menu created.");
     _skill    = skill;
     _prestige = prestige;
     InitiatePrestigeButton();
     InitiateSettingsButton();
     _professionButtons = new List <MinimalistProfessionButton>();
     exitFunction       = DeregisterMouseEvents;
 }
コード例 #7
0
 protected override void OnMouseClick()
 {
     if (IsDisabled)
     {
         return;
     }
     Game1.playSound("bigSelect");
     Prestige.AddPrestigeProfession(Profession.Id);
     Selected = true;
 }
コード例 #8
0
ファイル: MoveTests.cs プロジェクト: Middlederg/Splendor
        public void ShouldBuyDevelopmentAndNoble()
        {
            var buy = new BuyDevelopment(fourPointDevelopment, Nobles.ElisabethOfAustria);

            buy.Development.Should().BeEquivalentTo(fourPointDevelopment);
            buy.Noble.Should().BeEquivalentTo(Nobles.ElisabethOfAustria);
            buy.Type.Should().Be(MoveType.BuyDevelopment);
            buy.PrestigeObtained.Should().Be(Prestige.FromScalar(7));
            buy.PrestigeObtainedText.Should().Be(Prestige.FromScalar(7).ToString());
        }
コード例 #9
0
ファイル: MoveTests.cs プロジェクト: Middlederg/Splendor
        public void ShouldBuyDevelopment()
        {
            var buy = new BuyDevelopment(fourPointDevelopment, null);

            buy.Development.Should().BeEquivalentTo(fourPointDevelopment);
            buy.Noble.Should().BeNull();
            buy.Type.Should().Be(MoveType.BuyDevelopment);
            buy.PrestigeObtained.Should().Be(Prestige.FromScalar(4));
            buy.PrestigeObtainedText.Should().Be(Prestige.FromScalar(4).ToString());
        }
コード例 #10
0
        public string Description()
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.Append($"Games won: {GamesWon.GetValueOrDefault(0)}, ");
            stringBuilder.Append($"Prestige: {Prestige.GetValueOrDefault(0)}, ");
            stringBuilder.Append($"Rating: {Rating}, ");
            stringBuilder.Append($"F*g: {(new Random().Next(2) == 0 ? "Yes" : "No")}");

            return(stringBuilder.ToString());
        }
コード例 #11
0
ファイル: MoveTests.cs プロジェクト: Middlederg/Splendor
        public void ShouldReserveDevelopmentAndNoble()
        {
            var reserve = new ReserveDevelopment(fourPointDevelopment, takeGold: true, Nobles.CharlesQuint);

            reserve.Development.Should().BeEquivalentTo(fourPointDevelopment);
            reserve.TakeGold.Should().BeTrue();
            reserve.Noble.Should().BeEquivalentTo(Nobles.CharlesQuint);
            reserve.Type.Should().Be(MoveType.ReserveDevelopment);
            reserve.PrestigeObtained.Should().Be(Prestige.FromScalar(3));
            reserve.PrestigeObtainedText.Should().Be(Prestige.FromScalar(3).ToString());
        }
コード例 #12
0
ファイル: Vic2Country.cs プロジェクト: Dinglydell/EU4ToVic2
        public PdxSublist GetHistoryCountryFile(Vic2World world)
        {
            var data = new PdxSublist(null);

            data.AddValue("capital", Capital.ToString());
            data.AddValue("primary_culture", PrimaryCulture);
            AcceptedCultures.ForEach(c => data.AddValue("culture", c));
            data.AddValue("religion", Religion);
            data.AddValue("government", Government);
            data.AddValue("plurality", Plurality.ToString());
            if (NationalValues != null)
            {
                data.AddValue("nationalvalue", NationalValues.Value);
            }
            data.AddValue("literacy", Literacy.ToString());
            data.AddValue("civilized", IsCivilised ? "yes" : "no");

            data.AddValue("prestige", Prestige.ToString());
            if (Reforms != null)
            {
                Reforms.AddData(data);
            }
            if (Technologies != null)
            {
                Technologies.ForEach(t => data.AddValue(t, "1"));
            }
            data.AddValue("consciousness", Consciousness.ToString());
            // todo
            data.AddValue("nonstate_consciousness", (Consciousness / 3).ToString());
            if (RulingParty != null)
            {
                data.AddValue("ruling_party", RulingParty.Name);
            }
            data.AddDate("last_election", LastElection);
            if (UpperHouse != null)
            {
                data.AddSublist("upper_house", UpperHouse.GetData(data));
            }
            if (TechSchools != null)
            {
                data.AddValue("schools", Enum.GetName(typeof(TechSchool), TechSchools.TechSchool));
            }

            if (FemaleLeaders && (Reforms.vote_franschise == vote_franschise.universal_voting || Reforms.vote_franschise == vote_franschise.universal_weighted_voting))
            {
                var entry = new PdxSublist();
                entry.AddValue("decision", "enact_female_suffrage");

                data.AddSublist(world.StartDate, entry);
            }
            return(data);
        }
コード例 #13
0
        public GemsServiceTests()
        {
            game = new Game(Prestige.FromScalar(15),
                            (Avatars.Danilo, ColorFactory.DefaultBlue),
                            (Avatars.Debra, ColorFactory.Gray));

            foreach (var gem in Gems.GetAllGems())
            {
                Take(gem.Get(2).ToArray());
            }
            //Take(new Gem[3] { Gems.Diamond, Gems.Ruby, Gems.Onyx });
            //Take(new Gem[3] { Gems.Diamond, Gems.Ruby, Gems.Onyx });
        }
コード例 #14
0
ファイル: MoveTests.cs プロジェクト: Middlederg/Splendor
        public void ShouldTakeGemsandNoble()
        {
            var takeGems = new TakeGems(new List <Gem> {
                Gems.Onyx, Gems.Ruby
            }, Nobles.AnneOfBrittany);

            takeGems.Gems.Should().Contain(Gems.Onyx);
            takeGems.Gems.Should().Contain(Gems.Ruby);
            takeGems.Noble.Should().BeEquivalentTo(Nobles.AnneOfBrittany);
            takeGems.Type.Should().Be(MoveType.TakeGems);
            takeGems.PrestigeObtained.Should().Be(Prestige.FromScalar(3));
            takeGems.PrestigeObtainedText.Should().Be(Prestige.FromScalar(3).ToString());
        }
コード例 #15
0
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        /// <param name="e">The event data.</param>
        /// <param name="isClick">Whether the button press is a click.</param>
        public override void OnButtonPressed(ButtonPressedEventArgs e, bool isClick)
        {
            base.OnButtonPressed(e, isClick);
            if (IsDisabled)
            {
                return;
            }

            if (isClick && IsHovered)
            {
                Game1.playSound("bigSelect");
                Prestige.AddPrestigeProfession(Profession.Id);
                Selected = true;
            }
        }
コード例 #16
0
        private void ToggleLevelTenMenu()
        {
            Logger.LogInformation("Toggling level 10 menu...");
            _isRightSideOfTree = !_isRightSideOfTree;
            List <Profession> professionsToChoose = _currentSkill.Professions.Where(x => x is TierTwoProfession).Skip(_isRightSideOfTree ? 2 : 0).ToList();

            _internalMenu.SetInstanceField(_professionsToChooseInternalName, professionsToChoose.Select(x => x.Id).ToList());
            _internalMenu.SetInstanceField(_leftProfessionDescriptionInternalName, _getProfessionDescription.Invoke(professionsToChoose[0].Id));
            _internalMenu.SetInstanceField(_rightProfessionDescriptionInternalName, _getProfessionDescription.Invoke(professionsToChoose[1].Id));
            Prestige          prestigeData = PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType == _currentSkill.Type);
            List <Profession> prestigedProfessionsForThisSkillAndLevel = _currentSkill.Professions.Where(x => prestigeData.PrestigeProfessionsSelected.Contains(x.Id) && x.LevelAvailableAt == _currentLevel).ToList();
            List <Profession> professionsToChooseFrom = _currentSkill.Professions.Where(x => x.LevelAvailableAt == _currentLevel).ToList();

            _drawLeftPrestigedIndicator  = prestigedProfessionsForThisSkillAndLevel.Contains(professionsToChooseFrom.Skip(_isRightSideOfTree == false ? 0 : 2).First());
            _drawRightPrestigedIndicator = prestigedProfessionsForThisSkillAndLevel.Contains(professionsToChooseFrom.Skip(_isRightSideOfTree == false ? 1 : 3).First());
        }
コード例 #17
0
        private static void OpenPrestigeMenu(Skill skill)
        {
            Logger.LogVerbose("Skills Menu - Setting up Prestige Menu...");
            int menuWidth  = Game1.tileSize * 18;
            int menuHeight = Game1.tileSize * 10;

            int       menuXCenter   = (menuWidth + IClickableMenu.borderWidth * 2) / 2;
            int       menuYCenter   = (menuHeight + IClickableMenu.borderWidth * 2) / 2;
            Viewport  viewport      = Game1.graphics.GraphicsDevice.Viewport;
            int       screenXCenter = (int)(viewport.Width * (1.0 / Game1.options.zoomLevel)) / 2;
            int       screenYCenter = (int)(viewport.Height * (1.0 / Game1.options.zoomLevel)) / 2;
            Rectangle bounds        = new Rectangle(screenXCenter - menuXCenter, screenYCenter - menuYCenter, menuWidth + IClickableMenu.borderWidth * 2, menuHeight + IClickableMenu.borderWidth * 2);

            Game1.playSound("bigSelect");
            Logger.LogVerbose("Getting currently loaded prestige data...");
            Prestige prestige = PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType == skill.Type);

            Game1.activeClickableMenu = new PrestigeMenu(bounds, skill, prestige);
            Logger.LogVerbose("Skills Menu - Loaded Prestige Menu.");
        }
コード例 #18
0
ファイル: SectProtocol.cs プロジェクト: midgithub/BestSects
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0L)
            {
                hash ^= Id.GetHashCode();
            }
            if (PlayerId != 0L)
            {
                hash ^= PlayerId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Level != 0)
            {
                hash ^= Level.GetHashCode();
            }
            if (Exp != 0L)
            {
                hash ^= Exp.GetHashCode();
            }
            if (Prestige != 0)
            {
                hash ^= Prestige.GetHashCode();
            }
            if (Gold != 0L)
            {
                hash ^= Gold.GetHashCode();
            }
            if (Diamond != 0)
            {
                hash ^= Diamond.GetHashCode();
            }
            hash ^= roles_.GetHashCode();
            return(hash);
        }
コード例 #19
0
    /// <summary>
    /// 通过等级获得对应称号
    /// </summary>
    public Prestige createPrestigeByLevel(long exp)
    {
        Prestige p = new Prestige(exp);

        return(p);
    }
コード例 #20
0
ファイル: PrestigeTests.cs プロジェクト: Middlederg/Splendor
        public void Should_not_instantiate_lower_than_0()
        {
            Action action = () => Prestige.FromScalar(-1);

            action.Should().Throw <ArgumentOutOfRangeException>();
        }
コード例 #21
0
ファイル: PrepareGame.cs プロジェクト: Middlederg/Splendor
 private Prestige GetPrestige() => Prestige.FromScalar(ObjetiveSelector.CurrentValue);
コード例 #22
0
 public string Title(string battleTag)
 {
     return($"{battleTag} (Level {(Prestige.GetValueOrDefault(0) * 100) + Level.GetValueOrDefault(0)})");
 }
コード例 #23
0
ファイル: MainView.cs プロジェクト: Middlederg/Splendor
 public MainView(Prestige objetive, params (Avatar avatar, ColorGroup color)[] profiles)
コード例 #24
0
        private void InitiateUi()
        {
            if (_uiInitiated)
            {
                return;
            }
            _uiInitiated = true;
            Logger.LogVerbose("Level Up Menu - initializing UI...");
            Prestige          prestigeData = PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType == _currentSkill.Type);
            List <Profession> prestigedProfessionsForThisSkillAndLevel = _currentSkill.Professions
                                                                         .Where(x => prestigeData.PrestigeProfessionsSelected.Contains(x.Id) && x.LevelAvailableAt == _currentLevel)
                                                                         .ToList();
            List <Profession> professionsToChooseFrom = _currentSkill.Professions.Where(x => x.LevelAvailableAt == _currentLevel).ToList();

            if (_currentLevel == 5)
            {
                if (!prestigedProfessionsForThisSkillAndLevel.Any())
                {
                    Logger.LogVerbose("Level Up Menu - No prestiged professions found for this skill/level combination.");
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count == 1)
                {
                    Logger.LogInformation("Level Up Menu - One level 5 prestiged profession found, automatically selecting the other.");
                    Profession professionToAdd = professionsToChooseFrom.First(x => !prestigedProfessionsForThisSkillAndLevel.Contains(x));
                    Game1.player.professions.Add(professionToAdd.Id);
                    professionToAdd.SpecialHandling?.ApplyEffect();
                    _internalMenu.exitThisMenu(false);
                    RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                    Game1.activeClickableMenu = new LevelUpMessageDialogWithProfession(MessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel} and gained a profession!", _currentSkill, professionToAdd);
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count >= 2)
                {
                    Logger.LogInformation("Level Up Menu - Both available level 5 professions are already prestiged.");
                    _internalMenu.exitThisMenu(false);
                    RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                    Game1.activeClickableMenu = new LevelUpMessageDialog(MessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel}!", _currentSkill);
                    return;
                }
            }
            if (_currentLevel != 10)
            {
                return;
            }

            int levelFiveProfessionsCount = Game1.player.professions
                                            .Intersect(
                _currentSkill.Professions.Where(x => x is TierOneProfession).Select(x => x.Id)
                )
                                            .Count();

            if (levelFiveProfessionsCount == 1)
            {
                if (!prestigedProfessionsForThisSkillAndLevel.Any())
                {
                    Logger.LogVerbose("Level Up Menu - No prestiged professions found for this skill/level combination.");
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count == 1)
                {
                    Logger.LogInformation("Level Up Menu - One level 10 prestiged profession found for only one available level 5 skill (cheater!), automatically selecting the other.");
                    TierOneProfession tierOneProfession = ((TierTwoProfession)prestigedProfessionsForThisSkillAndLevel.First()).TierOneProfession;
                    Profession        professionToAdd   = professionsToChooseFrom
                                                          .First(x =>
                                                                 (x as TierTwoProfession)?.TierOneProfession == tierOneProfession &&
                                                                 !prestigedProfessionsForThisSkillAndLevel.Contains(x)
                                                                 );
                    Game1.player.professions.Add(professionToAdd.Id);
                    professionToAdd.SpecialHandling?.ApplyEffect();
                    _internalMenu.exitThisMenu(false);
                    RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                    Game1.activeClickableMenu = new LevelUpMessageDialogWithProfession(ExtraTallMessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel} and gained a profession! {Environment.NewLine} You may now prestige this skill again!", _currentSkill, professionToAdd);
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count < 2)
                {
                    return;
                }
                Logger.LogInformation("Level Up Menu - Only one level 5 profession found with both level 10 professions already prestiged (cheater!).");
                _internalMenu.exitThisMenu(false);
                RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                Game1.activeClickableMenu = new LevelUpMessageDialog(MessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel}!  {Environment.NewLine} You may now prestige this skill again!", _currentSkill);
            }
            else
            {
                if (prestigedProfessionsForThisSkillAndLevel.Count <= 2)
                {
                    Logger.LogInformation("Level Up Menu - Two or less prestiged level 10 professions found for this skill, with more than one level 5 profession found.");
                    if (prestigedProfessionsForThisSkillAndLevel.Intersect(professionsToChooseFrom.Take(2)).Count() == 2)
                    {
                        Logger.LogInformation("Level Up Menu - All of one level 10 profession branch found, switching to remaining menu.");
                        ToggleLevelTenMenu();
                        return;
                    }
                    if (prestigedProfessionsForThisSkillAndLevel.Intersect(professionsToChooseFrom.Skip(2).Take(2)).Count() == 2)
                    {
                        Logger.LogInformation("Level Up Menu - All of one level 10 profession branch found, leaving at default menu.");
                        return;
                    }
                    Logger.LogInformation("Level Up Menu - Both level up menus found as viable, enabling user side toggle.");
                    SetupLevelTenToggleButton();
                    _drawToggleSwitch           = true;
                    _drawLeftPrestigedIndicator = prestigedProfessionsForThisSkillAndLevel
                                                  .Contains(professionsToChooseFrom.Skip(_isRightSideOfTree == false ? 0 : 2).First());
                    _drawRightPrestigedIndicator = prestigedProfessionsForThisSkillAndLevel
                                                   .Contains(professionsToChooseFrom.Skip(_isRightSideOfTree == false ? 1 : 3).First());
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count == 3)
                {
                    Logger.LogInformation("Level Up Menu - All but one level 10 profession found, selecting remaining profession.");
                    Profession professionToAdd = professionsToChooseFrom.First(x => !prestigedProfessionsForThisSkillAndLevel.Contains(x));
                    Game1.player.professions.Add(professionToAdd.Id);
                    professionToAdd.SpecialHandling?.ApplyEffect();
                    _internalMenu.exitThisMenu(false);
                    RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                    Game1.activeClickableMenu = new LevelUpMessageDialogWithProfession(ExtraTallMessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel} and gained a profession!  {Environment.NewLine} You may now prestige this skill again!", _currentSkill, professionToAdd);
                    return;
                }
                if (prestigedProfessionsForThisSkillAndLevel.Count < 4)
                {
                    return;
                }
                Logger.LogInformation("Level Up Menu - All professions already prestiged for this skill.");
                _internalMenu.exitThisMenu(false);
                RemoveLevelFromLevelList(_currentSkill.Type.Ordinal, _currentLevel);
                Game1.activeClickableMenu = new LevelUpMessageDialog(ExtraTallMessageDialogBounds, $"You levelled your {_currentSkill.Type.Name} skill to level {_currentLevel}!  {Environment.NewLine} Congratulations! You have prestiged all of your professions and reached level 10 again! You may continue to earn prestige points if you wish, as more prestige options are coming soon!", _currentSkill);
            }
        }