示例#1
0
        /**
         * Updates the infomation panel descripting the raising details for the selected character
         */
        private void doUpdateRaiseInfo()
        {
            MDRCharacter character = deadCharactersList.Selected;

            raiseCost = GameRules.CostToRaise(character);

            if (character == null)
            {
                raiseInfo.Caption = "";
                costLabel.Visible = false;
                return;
            }

            string notice = "{0} has died.";

            if (raiseCost == 0)
            {
                notice += "\n\nBecause {0} is less than level 10 the temple has agreed to raise him for free.";
            }
            else
            {
                notice += "\n\nThe cost to raise {0} is {1}";
                if (raiseCost > CoM.Party.Gold)
                {
                    notice += "\nHowever you only have {2}.";
                }
            }

            raiseInfo.Caption = string.Format(notice, CoM.Format(character), CoM.CoinsAmount(raiseCost), CoM.CoinsAmount(CoM.Party.Gold));

            costLabel.Visible = true;
            costLabel.Value   = raiseCost;
        }
示例#2
0
        /**
         * Raises the given character
         */
        private void doRaiseCharacter(MDRCharacter character)
        {
            if (character == null)
            {
                throw new ArgumentNullException("character", "[character] is null.");
            }
            if (!character.IsDead)
            {
                throw new Exception("Character is not dead.");
            }

            if (CoM.Party.Gold < raiseCost)
            {
                Engine.ShowLargeModal("Not Enough Coin",
                                      string.Format(
                                          "The party does not have enough coin to raise {0}.\nYou need {1} but together only have {2}",
                                          CoM.Format(character), CoM.CoinsAmount(raiseCost), CoM.CoinsAmount(CoM.Party.Gold)
                                          ));
                return;
            }

            CoM.Party.DebitGold(raiseCost, character);



            string complicationsMessage = GameRules.RaiseCharacterFromDead(character);

            if (complicationsMessage == "")
            {
                SoundManager.Play("OLDFX_RAISE");
                Engine.ShowModal("Success", string.Format("{0} was successfully raised back to life.", CoM.Format(character)));
            }
            else
            {
                SoundManager.Play("OLDFX_PARAL");
                Engine.ShowModal("Complications", string.Format("\nThere where problems while raising {0}.\n{0} {1}\n", CoM.Format(character), complicationsMessage));
            }

            PopulateDeadCharacterList();
        }
示例#3
0
文件: GuildState.cs 项目: bsimser/CoM
        /** Refreshs the guild info text as per the selected guild */
        private void updateGuildInfo()
        {
            JoinButton.SelfEnabled  = canJoinSelectedGuild();
            LevelButton.SelfEnabled = canLevel();

            JoinButton.Visible  = !selectedGuildIsCurrent;
            LevelButton.Visible = selectedGuildIsCurrent;

            if ((SelectedGuild == null) || (Character == null))
            {
                return;
            }

            JoinButton.Caption = (Character.Membership[SelectedGuild].IsMember) ? "Reacquaint" : "Join";

            MDRGuildMembership membership = Character.Membership[SelectedGuild];

            string requiredStatsString = "";

            for (int lp = 0; lp <= MDRStats.SHORT_STAT_NAME.Length; lp++)
            {
                int requirement = SelectedGuild.RequiredStats[lp];
                if (requirement != 0)
                {
                    requiredStatsString += Util.Colorise(MDRStats.SHORT_STAT_NAME[lp] + ":" + requirement + " ", Character.Stats[lp] >= requirement ? Color.green : Color.red);
                }
            }

            GuildTitle.Caption = "<B>" + SelectedGuild.Name + "</B>";

            string text = "";

            if (requiredStatsString != "")
            {
                text += "Required Stats: \n " + requiredStatsString + "\n\n";
            }

            if (membership.IsMember)
            {
                text += "You are a member of this guild. \n";
                if (membership.ReqXP > 0)
                {
                    text += "You require " + Util.Colorise(Util.Comma(membership.ReqXP), Color.green) + " more XP to obtain level " + Util.Colorise((membership.CurrentLevel + 1).ToString(), Color.green) + "\n";
                }
                else
                {
                    text += "You are ready for level " + Util.Colorise((membership.CurrentLevel + 1).ToString(), Color.green) + "\n";
                }
                text += "\nGaining this level will cost " + CoM.CoinsAmount(membership.RequiredGold) + ".";
            }
            else
            {
                text += "You are not a member of this guild. \n";
                if (Character.BaseStats >= SelectedGuild.RequiredStats)
                {
                    text += "You " + Util.Colorise("meet the stats requirements", Color.green) + " for this guild. \n";
                }
                else
                {
                    text += "You do not meet stats requirements for this guild. \n\n";
                }

                if (membership.Guild.RequiredGuild != null)
                {
                    text += "You must obtain level " + Util.Colorise(membership.Guild.RequiredGuildRequiredLevel, Color.green) + " with " + Util.Colorise(membership.Guild.RequiredGuild.Name, Color.green) + " first before joining this guild.\n\n";
                }

                if (Character.Membership.JoinedGuilds <= 1)
                {
                    text += "As this is your second guild, you may join for free. \n\n";
                }
                else
                {
                    text += "You require " + Util.Colorise(Util.Comma(SelectedGuild.JoinCost), Color.yellow) + " gold to join. \n\n";
                }
            }

            GuildInfo.Caption = text;
        }
示例#4
0
        public AllPartyMembersDeadState(MDRParty party) : base("Party has Died")
        {
            Party = party;

            Window.Width  = 500;
            Window.Height = 300;

            costToHire = GameRules.CostToHireRescue(party.Depth);

            var label = new GuiLabel("", 450, 200);

            label.Color     = Colors.FourNines;
            label.TextAlign = TextAnchor.UpperCenter;
            label.WordWrap  = true;
            Window.Add(label, 0, 0, true);

            var okButton = new GuiButton("Ok");

            okButton.Visible = false;
            Window.Add(okButton, 0, -20, true);

            var returnButton = new GuiButton("Return to Menu", 160, 24);

            returnButton.Visible = false;
            Window.Add(returnButton, 0, 20, true);

            var hireButton = new GuiButton("Hire", 140, 30);

            hireButton.Visible     = false;
            hireButton.SelfEnabled = Party.Gold >= costToHire;
            Window.Add(hireButton, 0, -25, true);

            var hireCost = new GuiCoinAmount();

            Window.Add(hireCost, (int)hireButton.Bounds.xMax + 20, -31, true);
            hireCost.Value   = costToHire;
            hireCost.Visible = false;

            var retrieveButton = new GuiButton("Retrieve");

            retrieveButton.Visible = false;
            Window.Add(retrieveButton, 0, 0);

            string message = "All party members have died.\n";

            if (party.Depth == 1)
            {
                message         += "\nThankfuly some friendly adventures have found you and brought you back to the town temple.";
                okButton.Visible = true;
            }
            else if (party.Depth < 10)
            {
                message += "\nIt might take a while for anyone to find you down here.";

                if (Party.Gold >= costToHire)
                {
                    message += "\n\nYou'll need to either hire some adventurers or organise your own rescue party.";
                }
                else
                {
                    message += "\n\nLooks like you don't have enough to hire a rescue party.";
                    message += "\nTogether you have only {0}.";
                    message += "\n\nYou'll need to either form your own rescue party or have another character pay to send rescuers out.";

                    Window.Height += 60;
                }

                returnButton.Visible = true;
                hireCost.Visible     = true;
                hireButton.Visible   = true;
            }
            else
            {
                message += "\nVery few venture this deep.  You won't be able to hire any adventures this time.";
                message += "\nYou need to either organise your own rescue party or pay at the temple for them to retrieve your soul.";
                returnButton.Visible   = true;
                retrieveButton.Visible = true;
            }

            label.Caption = string.Format(message, CoM.CoinsAmount(Party.Gold));

            okButton.OnMouseClicked += delegate {
                CoM.AutoGotoTemple = true;
                CoM.Party.ReturnToTown();
                Engine.PopState();
            };

            hireButton.OnMouseClicked += delegate {
                CoM.AutoGotoTemple = true;
                CoM.Party.DebitGold(costToHire);
                CoM.Party.ReturnToTown();
                Engine.PopState();
            };

            returnButton.OnMouseClicked += CoM.ReturnToMainMenu;
        }