当前位置: 首页>>代码示例>>C#>>正文


C# Dice.RollHigh方法代码示例

本文整理汇总了C#中Dice.RollHigh方法的典型用法代码示例。如果您正苦于以下问题:C# Dice.RollHigh方法的具体用法?C# Dice.RollHigh怎么用?C# Dice.RollHigh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dice的用法示例。


在下文中一共展示了Dice.RollHigh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Qualify

        internal override bool Qualify(Character character, Dice dice)
        {
            if (!character.LongTermBenefits.MayEnrollInSchool)
                return false;
            if (character.CurrentTerm > 3)
                return false;

            var dm = character.EducationDM;
            if (character.CurrentTerm == 2)
                dm += -1;
            if (character.CurrentTerm == 3)
                dm += -2;
            if (character.SocialStanding >= 9)
                dm += 1;

            dm += character.GetEnlistmentBonus("University", null);

            return dice.RollHigh(dm, 7);
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:19,代码来源:University.cs

示例2: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    character.AddHistory("You join a gambling circle on board.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Gambler");
                        skillList.Add("Deception");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);

                        if (dice.RollHigh(character.Skills.GetLevel("Gambler"), 8))
                            character.BenefitRolls += 1;
                        else
                            character.BenefitRolls += -1;
                    }

                    return;
                case 4:
                    character.AddHistory("Special assignment or duty on board ship.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 5:
                    character.AddHistory($"Advanced training in a specialist field");
                    if (dice.RollHigh(character.EducationDM, 8))
                        dice.Choose(character.Skills).Level += 1;
                    return;
                case 6:
                    character.AddHistory("Vessel participates in a notable military engagement.");
                    {

                        var skillList = new SkillTemplateCollection();
                        skillList.AddRange(SpecialtiesFor("Electronics"));
                        skillList.AddRange(SpecialtiesFor("Engineer"));
                        skillList.AddRange(SpecialtiesFor("Gunner"));
                        skillList.AddRange(SpecialtiesFor("Pilot"));
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    character.AddHistory("Vessel participates in a diplomatic mission.");
                    if (dice.D(2) == 1)
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Recon");
                        skillList.Add("Diplomat");
                        skillList.Add("Steward");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    else
                        character.AddHistory("Gain a contact.");

                    return;
                case 9:
                    character.AddHistory("You foil an attempted crime on board, such as mutiny, sabotage, smuggling or conspiracy. Gain an Enemy.");
                    character.CurrentTermBenefits.AdvancementDM += 2;
                    return;
                case 10:
                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("Abuse your position for profit");
                        character.BenefitRolls += 1;
                    }
                    else
                    {
                        character.AddHistory("Refuse to abuse your position for profit");
                        character.CurrentTermBenefits.AdvancementDM += 2;
                    }
                    return;
                case 11:
                    character.AddHistory("Commanding officer takes an interest in your career.");
                    switch (dice.D(2))
                    {
                        case 1:
                            character.Skills.Add("Tactics", "Military", 1);
                            return;
                        case 2:
                            character.CurrentTermBenefits.AdvancementDM += 4;
                            return;
                    }
                    return;
                case 12:
                    character.AddHistory("Display heroism in battle, saving the whole ship.");

                    character.CurrentTermBenefits.AdvancementDM += 100; //also applies to commission rolls

//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Navy.cs

示例3: Mishap

        internal override void Mishap(Character character, Dice dice)
        {
            switch (dice.D(6))
            {
                case 1:
                    Injury(character, dice, true);
                    return;
                case 2:
                    character.AddHistory("Placed in the frozen watch (cryogenically stored on board ship) and revived improperly.");
                    switch (dice.D(3))
                    {
                        case 1:
                            character.Strength -= 1;
                            return;
                        case 2:
                            character.Dexterity -= 1;
                            return;
                        case 3:
                            character.Endurance -= 1;
                            return;
                    }
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    var checkPassed = false;

                    switch (character.LastCareer.Assignment)
                    {
                        case "Line/Crew":
                            checkPassed = (dice.RollHigh(character.Skills.BestSkillLevel("Electronics", "Gunner"), 8));
                            break;
                        case "Engineer/Gunner":
                            checkPassed = (dice.RollHigh(character.Skills.BestSkillLevel("Mechanic", "Vacc Suit"), 8));
                            break;
                        case "Flight":
                            checkPassed = (dice.RollHigh(character.Skills.BestSkillLevel("Pilot", "Tactics"), 8));
                            break;
                    }
                    if (checkPassed)
                    {
                        character.AddHistory("During a battle, defeat or victory depends on your actions. You actions lead to an honorabe discharge.");
                        character.BenefitRolls += 1;
                    }
                    else
                    {
                        character.AddHistory("During a battle, defeat or victory depends on your actions. The ship suffers severe damage and you are blamed for the disaster. You are court - martialled and discharged.");
                    }

                    return;

                case 4:
                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("You are blamed for an accident that causes the death of several crew members. Your guilt drives you to excel.");

                        var skillTables = new List<SkillTable>();
                        skillTables.Add(PersonalDevelopment);
                        skillTables.Add(ServiceSkill);
                        skillTables.Add(AssignmentSkills);
                        if (character.Education >= AdvancedEductionMin)
                            skillTables.Add(AdvancedEducation);
                        if (character.LastCareer.CommissionRank > 0)
                            skillTables.Add(OfficerTraining);

                        dice.Choose(skillTables)(character, dice);
                    }
                    else
                    {
                        character.AddHistory("You are falsed accused for an accident that causes the death of several crew members. Gain the officer who blamed you as an Enemy.");
                        character.BenefitRolls += 1;
                    }
                    return;
                case 5:
                    character.AddHistory("You are tormented by or quarrel with an officer or fellow crewman. Gain that character as a Rival.");
                    return;
                case 6:
                    Injury(character, dice, false);
                    return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:80,代码来源:Navy.cs

示例4: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    character.AddHistory("An investigation takes on a dangerous turn.");

                    if (dice.RollHigh(character.Skills.BestSkillLevel("Investigate", "Streetwise"), 8))
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Deception");
                        skillList.Add("Jack-of-All-Trades");
                        skillList.Add("Persuade");
                        skillList.Add("Tactics");
                        character.Skills.Increase(dice.Choose(skillList));
                    }
                    else
                    {
                        Mishap(character, dice);
                    }
                    return;
                case 4:
                    character.AddHistory("Rewarded for a successful mission.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 5:
                    character.AddHistory($"Established a network of contacts. Gain {dice.D(3)} contacts.");
                    return;
                case 6:
                    character.AddHistory("Advanced training in a specialist field.");
                    if (dice.RollHigh(character.EducationDM, 8))
                    {
                        dice.Choose(character.Skills).Level += 1;
                    }
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    {
                        character.AddHistory("Go undercover to investigate an enemy.");

                        var career = dice.Choose(m_Careers);

                        if (dice.RollHigh(character.Skills.GetLevel("Deception"), 8))
                        {
                            career.Event(character, dice);
                            career.AssignmentSkills(character, dice);
                        }
                        else
                        {
                            career.Mishap(character, dice);
                        }
                    }
                    return;
                case 9:
                    character.AddHistory("You go above and beyond the call of duty.");
                    character.CurrentTermBenefits.AdvancementDM += 2;
                    return;
                case 10:
                    character.AddHistory("Given specialist training in vehicles.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.AddRange(SpecialtiesFor("Drive"));
                        skillList.AddRange(SpecialtiesFor("Flyer"));
                        skillList.AddRange(SpecialtiesFor("Pilot"));
                        skillList.AddRange(SpecialtiesFor("Gunner"));
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 11:
                    character.AddHistory("Befriended by a senior agent.");
                    switch (dice.D(2))
                    {
                        case 1:
                            character.Skills.Increase("Investigate");
                            return;
                        case 2:
                            character.CurrentTermBenefits.AdvancementDM += 4;
                            return;
                    }
                    return;
                case 12:
                    character.AddHistory("Uncover a major conspiracy against your employers.");
                    character.CurrentTermBenefits.AdvancementDM += 100;
                    return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:94,代码来源:Agent.cs

示例5: Qualify

        internal override bool Qualify(Character character, Dice dice)
        {
            var dm = character.IntellectDM;
            dm += -1 * character.CareerHistory.Count;

            dm += character.GetEnlistmentBonus(Name, Assignment);

            return dice.RollHigh(dm, 6);
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:9,代码来源:Agent.cs

示例6: Run

        internal override void Run(Character character, Dice dice)
        {
            CareerHistory careerHistory;
            if (!character.CareerHistory.Any(pc => pc.Name == Name))
            {
                character.AddHistory($"Became a {Assignment} at age {character.Age}");
                BasicTrainingSkills(character, dice, character.CareerHistory.Count == 0);

                careerHistory = new CareerHistory(Name, Assignment, 0);
                character.CareerHistory.Add(careerHistory);
                UpdateTitle(character, dice, careerHistory);
            }
            else
            {
                if (!character.CareerHistory.Any(pc => pc.Assignment == Assignment))
                {
                    character.AddHistory($"Switched to {Assignment} at age {character.Age}");
                    careerHistory = new CareerHistory(Name, Assignment, 0);
                    character.CareerHistory.Add(careerHistory);

                    if (!RankCarryover) //then this is a new career
                    {
                        UpdateTitle(character, dice, careerHistory);
                        BasicTrainingSkills(character, dice, false);
                    }

                }
                else if (character.LastCareer?.Assignment == Assignment)
                {
                    character.AddHistory($"Continued as {Assignment} at age {character.Age}");
                    careerHistory = character.CareerHistory.Single(pc => pc.Assignment == Assignment);
                }
                else
                {
                    character.AddHistory($"Returned to {Assignment} at age {character.Age}");
                    careerHistory = character.CareerHistory.Single(pc => pc.Assignment == Assignment);
                }

                var skillTables = new List<SkillTable>();
                skillTables.Add(PersonalDevelopment);
                skillTables.Add(ServiceSkill);
                skillTables.Add(AssignmentSkills);
                if (character.Education >= AdvancedEductionMin)
                    skillTables.Add(AdvancedEducation);

                dice.Choose(skillTables)(character, dice);
            }
            careerHistory.Terms += 1;

            if (RankCarryover)
            {
                careerHistory.Rank = character.CareerHistory.Where(c => c.Name == Name).Max(c => c.Rank);
                careerHistory.CommissionRank = character.CareerHistory.Where(c => c.Name == Name).Max(c => c.CommissionRank);
            }

            var survived = dice.RollHigh(character.GetDM(SurvivalAttribute) + character.NextTermBenefits.SurvivalDM, SurvivalTarget);
            if (survived)
            {
                character.BenefitRolls += 1;

                Event(character, dice);

                var advancementRoll = dice.D(2, 6);
                if (advancementRoll == 12)
                {
                    character.AddHistory("Forced to continue current assignment");
                    character.NextTermBenefits.MustEnroll = Assignment;
                }
                advancementRoll += character.GetDM(AdvancementAttribute) + character.CurrentTermBenefits.AdvancementDM;

                if (advancementRoll <= careerHistory.Terms)
                {
                    character.AddHistory("Forced to muster out.");
                    character.NextTermBenefits.MusterOut = true;
                }
                if (advancementRoll > AdvancementTarget)
                {

                    careerHistory.Rank += 1;
                    character.AddHistory($"Promoted to rank {careerHistory.Rank}");

                    UpdateTitle(character, dice, careerHistory);

                    //advancement skill
                    var skillTables = new List<SkillTable>();
                    skillTables.Add(PersonalDevelopment);
                    skillTables.Add(ServiceSkill);
                    skillTables.Add(AssignmentSkills);
                    if (character.Education >= AdvancedEductionMin)
                        skillTables.Add(AdvancedEducation);
                    dice.Choose(skillTables)(character, dice);
                }
            }
            else
            {
                character.NextTermBenefits.MusterOut = true;
                Mishap(character, dice);
            }

            character.LastCareer = careerHistory;
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:NormalCareer.cs

示例7: Run

        internal override void Run(Character character, Dice dice)
        {
            CareerHistory careerHistory;
            if (!character.CareerHistory.Any(pc => pc.Name == Name))
            {
                character.AddHistory($"Became a {Assignment} at age {character.Age}");
                BasicTraining(character, dice, character.CareerHistory.Count == 0);

                careerHistory = new CareerHistory(Name, Assignment, 0);
                character.CareerHistory.Add(careerHistory);

                UpdateTitle(character, dice, careerHistory);
            }
            else
            {
                if (!character.CareerHistory.Any(pc => pc.Assignment == Assignment))
                {
                    character.AddHistory($"Switched to {Assignment} at age {character.Age}");
                    careerHistory = new CareerHistory(Name, Assignment, 0);
                    character.CareerHistory.Add(careerHistory);
                }
                else if (character.LastCareer?.Assignment == Assignment)
                {
                    character.AddHistory($"Continued as {Assignment} at age {character.Age}");
                    careerHistory = character.CareerHistory.Single(pc => pc.Assignment == Assignment);
                }
                else
                {
                    character.AddHistory($"Returned to {Assignment} at age {character.Age}");
                    careerHistory = character.CareerHistory.Single(pc => pc.Assignment == Assignment);
                }

                var skillTables = new List<SkillTable>();
                skillTables.Add(PersonalDevelopment);
                skillTables.Add(ServiceSkill);
                skillTables.Add(AssignmentSkills);
                if (character.Education >= AdvancedEductionMin)
                    skillTables.Add(AdvancedEducation);
                if (careerHistory.CommissionRank > 0)
                    skillTables.Add(OfficerTraining);

                dice.Choose(skillTables)(character, dice);
            }
            careerHistory.Terms += 1;
            character.LastCareer = careerHistory;

            //rank carry-over
            careerHistory.Rank = character.CareerHistory.Where(c => c.Name == Name).Max(c => c.Rank);
            careerHistory.CommissionRank = character.CareerHistory.Where(c => c.Name == Name).Max(c => c.CommissionRank);

            //Early commission, possibly from military academy.
            if (careerHistory.CommissionRank == 0 && character.CurrentTermBenefits.FreeCommissionRoll)
            {
                AttemptCommission(character, dice, careerHistory);
            }

            var survived = dice.RollHigh(character.GetDM(SurvivalAttribute) + character.NextTermBenefits.SurvivalDM, SurvivalTarget);
            if (survived)
            {
                character.BenefitRolls += 1;

                Event(character, dice);

                var totalTermsInCareer = character.CareerHistory.Where(pc => pc.Name == Name).Sum(c => c.Terms);

                //Not all people will attempt a commission even when possible
                var attemptCommission = (totalTermsInCareer == 1 || character.SocialStanding >= 9) && dice.D(100) < Book.OddsOfSuccess(character, "Soc", 8 - character.CurrentTermBenefits.CommissionDM);

                var commissionEarned = false;

                if (careerHistory.CommissionRank == 0 && (attemptCommission || character.CurrentTermBenefits.FreeCommissionRoll))
                    commissionEarned = AttemptCommission(character, dice, careerHistory);

                if (!commissionEarned)
                {
                    //try for advancement only if failed to earn a commission.
                    var advancementRoll = dice.D(2, 6);
                    if (advancementRoll == 12)
                    {
                        character.AddHistory("Forced to continue current assignment");
                        character.NextTermBenefits.MustEnroll = Assignment;
                    }
                    advancementRoll += character.GetDM(AdvancementAttribute) + character.CurrentTermBenefits.AdvancementDM;

                    if (advancementRoll <= careerHistory.Terms)
                    {
                        character.AddHistory("Forced to muster out.");
                        character.NextTermBenefits.MusterOut = true;
                    }
                    if (advancementRoll > AdvancementTarget)
                    {
                        if (careerHistory.CommissionRank > 0)
                        {
                            careerHistory.CommissionRank += 1;
                            character.AddHistory($"Promoted to officer rank {careerHistory.CommissionRank}");
                        }
                        else
                        {
                            careerHistory.Rank += 1;
                            character.AddHistory($"Promoted to rank {careerHistory.Rank}");
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:MilitaryCareer.cs

示例8: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("Smuggle illegal items onto a planet.");
                        if (dice.RollHigh(character.Skills.BestSkillLevel("Deception", "Persuade"), 8))
                        {
                            character.Skills.Add("Streetwise", 1);
                            character.BenefitRolls += 1;
                        }
                    }
                    else
                        character.AddHistory("Refuse to smuggle illegal items onto a planet. Gain an Enemy.");
                    return;
                case 4:
                    {

                        var skillList = new SkillTemplateCollection();
                        skillList.AddRange(SpecialtiesFor("Profession"));
                        skillList.AddRange(SpecialtiesFor("Electronics"));
                        skillList.AddRange(SpecialtiesFor("Engineer"));
                        skillList.AddRange(SpecialtiesFor("Animals"));
                        skillList.AddRange(SpecialtiesFor("Science"));
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }

                    return;
                case 5:
                    if (dice.RollHigh(character.Skills.BestSkillLevel("Gambler", "Broker"), 8))
                    {
                        character.AddHistory($"Risk your fortune on a possibility lucrative deal and win.");
                        character.BenefitRolls *= 2;
                    }
                    else
                    {
                        character.BenefitRolls = 0;
                    }
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Broker");
                        skillList.Add("Gambler");
                        character.Skills.Increase(dice.Choose(skillList));
                    }
                    return;
                case 6:
                    character.AddHistory("Make an unexpected connection outside your normal circles. Gain a Contact.");
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    character.AddHistory("Embroiled in legal trouble.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Advocate");
                        skillList.Add("Admin");
                        skillList.Add("Diplomat");
                        skillList.Add("Investigate");
                    }
                    if (dice.D(2, 6) == 2)
                    {
                        character.NextTermBenefits.MusterOut = true;
                        character.NextTermBenefits.MustEnroll = "Prisoner";
                    }
                    return;
                case 9:
                    character.AddHistory("Given advanced training in a specialist field");
                    if (dice.RollHigh(character.EducationDM, 8))
                        dice.Choose(character.Skills).Level += 1;
                    return;
                case 10:
                    character.AddHistory("A good deal ensures you are living the high life for a few years.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 11:
                    character.AddHistory("Befriend a useful ally in one sphere. Gain an Ally.");
                    switch (dice.D(2))
                    {
                        case 1:
                            character.Skills.Add("Carouse", 1);
                            return;
                        case 2:
                            character.CurrentTermBenefits.AdvancementDM += 4;
                            return;
                    }
                    return;
                case 12:
                    character.AddHistory("Your business or ship thrives.");
                    character.CurrentTermBenefits.AdvancementDM += 100;
                    return;
            }
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Merchant.cs

示例9: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    character.AddHistory("Assigned to a planet with a hostile or wild environment.");
                    {

                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Vacc Suit");
                        skillList.AddRange(SpecialtiesFor("Engineer"));
                        skillList.Add("Animals", "Handling");
                        skillList.Add("Animals", "Training");
                        skillList.Add("Recon");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 4:
                    character.AddHistory("Assigned to an urbanised planet torn by war.");
                    {

                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Stealth");
                        skillList.Add("Streetwise");
                        skillList.Add("Persuade");
                        skillList.Add("Recon");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }

                    return;
                case 5:
                    character.AddHistory($"Given a special assignment or duty in your unit.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 6:
                    character.AddHistory("Thrown into a brutal ground war");
                    if (dice.RollHigh(character.EducationDM, 8))
                    {

                        var skillList = new SkillTemplateCollection();
                        skillList.AddRange(SpecialtiesFor("Gun Combat"));
                        skillList.Add("Leadership");
                        character.Skills.Increase(dice.Choose(skillList));
                    }
                    else
                    {
                        Injury(character, dice);
                    }
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    character.AddHistory("Advanced training in a specialist field");
                    if (dice.RollHigh(character.EducationDM, 8))
                        dice.Choose(character.Skills).Level += 1;
                    return;
                case 9:
                    character.AddHistory("Surrounded and outnumbered by the enemy, you hold out until relief arrives. ");
                    character.CurrentTermBenefits.AdvancementDM += 2;
                    return;
                case 10:
                    character.AddHistory("Assigned to a peacekeeping role.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Admin");
                        skillList.Add("Admin");
                        skillList.Add("Deception");
                        skillList.Add("Recon");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 11:
                    character.AddHistory("Commanding officer takes an interest in your career.");
                    switch (dice.D(2))
                    {
                        case 1:
                            character.Skills.Add("Tactics", "Military", 1);
                            return;
                        case 2:
                            character.CurrentTermBenefits.AdvancementDM += 4;
                            return;
                    }
                    return;
                case 12:
                    character.AddHistory("Display heroism in battle.");

                    character.CurrentTermBenefits.AdvancementDM += 100; //also applies to commission rolls

                    if (character.LastCareer.CommissionRank == 0)
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Army.cs

示例10: PreCareerEvents

        public void PreCareerEvents(Character character, Dice dice, params string[] skills)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    character.AddHistory("Contacted by an underground psionic group");
                    character.LongTermBenefits.MayTestPsi = true;
                    return;
                case 3:
                    character.AddHistory("Suffered a deep tragedy.");
                    character.CurrentTermBenefits.GraduationDM = -100;
                    return;
                case 4:
                    character.AddHistory("A prank goes horribly wrong.");
                    var roll = dice.D(2, 6) + character.SocialStandingDM;

                    if (roll >= 8)
                        character.AddHistory("Gain a Rival.");
                    else if (roll > 2)
                        character.AddHistory("Gain an Enemy.");
                    else
                        character.NextTermBenefits.MustEnroll = "Prisoner";
                    return;
                case 5:
                    character.AddHistory("Spent the college years partying.");
                    character.Skills.Add("Carouse", 1);
                    return;
                case 6:
                    character.AddHistory($"Made lifelong friends. Gain {dice.D(3)} Allies.");
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    if (dice.RollHigh(character.SocialStandingDM, 8))
                    {
                        character.AddHistory("Become leader in social movement.");
                        character.AddHistory("Gain an Ally and an Enemy.");
                    }
                    else
                        character.AddHistory("Join a social movement.");
                    return;
                case 9:
                    {
                        var skillList = new SkillTemplateCollection(m_RandomSkills);
                        skillList.RemoveOverlap(character.Skills, 0);

                        if (skillList.Count > 0)
                        {
                            var skill = dice.Choose(skillList);
                            character.Skills.Add(skill);
                            character.AddHistory($"Study {skill} as a hobby.");
                        }
                    }
                    return;
                case 10:

                    if (dice.RollHigh(9))
                    {
                        var skill = dice.Choose(skills);
                        character.Skills.Increase(skill, 1);
                        character.AddHistory($"Expand the field of {skill}, but gain a Rival in your former tutor.");
                    }
                    return;
                case 11:
                    character.AddHistory("War breaks out, triggering a mandatory draft.");
                    if (dice.RollHigh(character.SocialStandingDM, 9))
                        character.AddHistory("Used social standing to avoid the draft.");
                    else
                    {
                        character.CurrentTermBenefits.GraduationDM -= 100;
                        if (dice.D(2) == 1)
                        {
                            character.AddHistory("Fled from the draft.");
                            character.NextTermBenefits.MustEnroll = "Drifter";
                        }
                        else
                        {
                            var roll2 = dice.D(6);
                            if (roll2 <= 3)
                                character.NextTermBenefits.MustEnroll = "Army";
                            else if (roll2 <= 5)
                                character.NextTermBenefits.MustEnroll = "Marine";
                            else
                                character.NextTermBenefits.MustEnroll = "Navy";
                        }
                    }
                    return;
                case 12:
                    character.AddHistory("Widely recognized.");
                    character.SocialStanding += 1;
                    return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:94,代码来源:Book.cs

示例11: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    if (dice.D(2) == 1)
                    {
                        if (dice.RollHigh(character.Skills.BestSkillLevel("Pilot"), 8))
                        {
                            character.AddHistory("Your ship is ambushed by enemy vessels. You successfully ran to the jump point.");
                            character.Skills.Add("Electronics", "Sensors", 1);
                        }
                        else
                        {
                            character.AddHistory("Your ship is ambushed by enemy vessels. Attempted to run but caught and ship is destroyed.");
                            character.NextTermBenefits.MusterOut = true;
                        }
                    }
                    else
                    {
                        if (dice.RollHigh(character.Skills.BestSkillLevel("Persuade"), 10))
                        {
                            character.AddHistory("Your ship is ambushed by enemy vessels. You successfully bargain with them.");
                            character.Skills.Add("Electronics", "Sensors", 1);
                        }
                        else
                        {
                            character.AddHistory("Your ship is ambushed by enemy vessels. Attempted to bargain with them but fail and the ship is destroyed.");
                            character.NextTermBenefits.MusterOut = true;
                        }

                    }
                    return;
                case 4:
                    character.AddHistory("You survey an alien world.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Animals", "Handling");
                        skillList.Add("Animals", "Training");
                        skillList.Add("Survival");
                        skillList.Add("Recon");
                        skillList.AddRange(SpecialtiesFor("Science"));
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 5:
                    character.AddHistory("Perform an exemplary service for the scouts.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 6:
                    character.AddHistory("Spend several years jumping from world to world in your scout ship.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Astrogation");
                        skillList.AddRange(SpecialtiesFor("Electronics"));
                        skillList.Add("Navigation");
                        skillList.Add("Pilot", "Small craft");
                        skillList.Add("Mechanic");
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }

                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    if (dice.RollHigh(character.Skills.BestSkillLevel("Electronics", "Deception"), 8))
                    {
                        character.AddHistory("When dealing with an alien race, you have an opportunity to gather extra intelligence about them. Gain an Ally in the Imperium");
                        character.BenefitRollDMs.Add(2);
                    }
                    else
                    {
                        character.AddHistory("When dealing with an alien race, you botch an opportunity to gather extra intelligence about them.");
                        Mishap(character, dice);
                        character.NextTermBenefits.MusterOut = false;
                    }
                    return;
                case 9:
                    if (dice.RollHigh(character.Skills.BestSkillLevel("Medic", "Engineer"), 8))
                    {
                        character.AddHistory("Your scout ship is one of the first on the scene to rescue the survivors of a disaster. Gain a Contact.");
                        character.BenefitRollDMs.Add(2);
                    }
                    else
                    {
                        character.AddHistory("Your scout ship is one of the first on the scene to rescue the survivors of a disaster but you fail to help. Gain an Enemy.");
                        Mishap(character, dice);
                        character.NextTermBenefits.MusterOut = false;
                    }
                    return;
                case 10:
                    character.AddHistory("You spend a great deal of time on the fringes of Charted Space.");
                    if (dice.RollHigh(character.Skills.BestSkillLevel("Survival", "Pilot"), 8))
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Scout.cs

示例12: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    character.AddHistory("Arrested and charged.");
                    switch (dice.D(2))
                    {
                        case 1:
                            if (dice.RollHigh(character.Skills.GetLevel("Advocate"), 8))
                            {
                                character.AddHistory("Successfully defended self.");
                            }
                            else
                            {
                                character.AddHistory("Failed to defend self. Gain an Enemy and go to prison.");
                                character.NextTermBenefits.MustEnroll = "Prisoner";
                            }
                            return;
                        case 2:
                            character.AddHistory("Hired a lawyer to beat the charges.");
                            character.BenefitRolls += -1;
                            return;
                    }
                    return;
                case 4:
                    character.AddHistory("Involved in the planning of an impressive heist.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.AddRange(SpecialtiesFor("Electronics"));
                        skillList.Add("Mechanic");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }

                    return;
                case 5:
                    character.AddHistory("Crime pays off. Gain victim as Enemy.");
                    character.BenefitRollDMs.Add(2);
                    return;
                case 6:
                    switch (dice.D(2))
                    {
                        case 1:
                            character.AddHistory("Backstab a fellow rogue for personal gain.");
                            character.CurrentTermBenefits.AdvancementDM += 4;
                            return;
                        case 2:
                            character.AddHistory("Refuse to backstab a fellow rogue for personal gain. Gain an Ally");
                            return;
                    }
                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    character.AddHistory("You spend months in the dangerous criminal underworld.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Streetwise");
                        skillList.Add("Stealth");
                        skillList.AddRange(SpecialtiesFor("Melee"));
                        skillList.AddRange(SpecialtiesFor("Gun Combat"));
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 9:
                    character.AddHistory("Involved in a feud with a rival criminal organization.");
                    if (dice.RollHigh(character.Skills.BestSkillLevel("Stealth", "Gun Combat"), 8))
                        character.BenefitRolls += 1;
                    else
                        Injury(character, dice);
                    return;
                case 10:
                    character.AddHistory("Involved in a gambling ring. ");
                    character.Skills.Add("Gambler", 1);
                    if (character.BenefitRolls > 0)
                    {
                        if (dice.RollHigh(character.Skills.GetLevel("Gambler"), 8))
                            character.BenefitRolls = (int)Math.Ceiling(1.5 * character.BenefitRolls);
                        else
                            character.BenefitRolls = 0;
                    }
                    return;
                case 11:
                    character.AddHistory("A crime lord considers you his protégé.");
                    switch (dice.D(2))
                    {
                        case 1:
                            character.Skills.Add("Tactics", "Military", 1);
                            return;
                        case 2:
                            character.CurrentTermBenefits.AdvancementDM += 4;
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Rogue.cs

示例13: Event

        internal override void Event(Character character, Dice dice)
        {
            switch (dice.D(2, 6))
            {
                case 2:
                    Mishap(character, dice);
                    character.NextTermBenefits.MusterOut = false;
                    return;
                case 3:
                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("Refused to perform research that goes against your conscience.");
                    }
                    else
                    {
                        character.AddHistory($"Agreed to perform research that goes against your conscience. Gain {dice.D(3)} Enemies.");
                        character.BenefitRolls += 1;

                        var skillList = new SkillTemplateCollection(SpecialtiesFor("Science"));
                        character.Skills.Increase(dice.Pick(skillList));
                        character.Skills.Increase(dice.Pick(skillList)); //pick 2

                    }
                    return;
                case 4:
                    character.AddHistory("Assigned to work on a secret project for a patron or organisation.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Medic");
                        skillList.AddRange(SpecialtiesFor("Science"));
                        skillList.AddRange(SpecialtiesFor("Engineer"));
                        skillList.AddRange(SpecialtiesFor("Electronics"));
                        skillList.Add("Investigate");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 5:
                    character.AddHistory($"Win a prestigious prize for your work.");
                    character.BenefitRollDMs.Add(1);
                    return;
                case 6:
                    character.AddHistory("Advanced training in a specialist field.");
                    if (dice.RollHigh(character.EducationDM, 8))
                    {
                        var skillList = new SkillTemplateCollection(RandomSkills);
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }

                    return;
                case 7:
                    LifeEvent(character, dice);
                    return;
                case 8:
                    {
                        if (dice.D(2) == 1)
                        {
                            if (dice.RollHigh(character.Skills.BestSkillLevel("Deception", "Admin"), 8))
                            {
                                character.AddHistory("Cheated in some fashion, advancing your career and research by stealing another’s work, using an alien device, taking a shortcut and so forth.");
                                character.BenefitRollDMs.Add(2);
                                dice.Choose(character.Skills).Level += 1;
                            }
                            else
                            {
                                character.AddHistory("Caught cheating in some fashion, advancing your career and research by stealing another’s work, using an alien device, taking a shortcut and so forth.");
                                character.BenefitRolls += -1;
                                Mishap(character, dice);
                            }
                            character.AddHistory("Gain an Enemy");
                        }
                        else
                        {
                            character.AddHistory("Refuse to join a cheat in some fashion.");
                        }

                    }
                    return;
                case 9:
                    character.AddHistory("Make a breakthrough in your field.");
                    character.CurrentTermBenefits.AdvancementDM += 2;
                    return;
                case 10:
                    character.AddHistory("Entangled in a bureaucratic or legal morass that distracts you from your work.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Admin");
                        skillList.Add("Advocate");
                        skillList.Add("Persuade");
                        skillList.Add("Diplomat");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 11:
                    character.AddHistory("Work for an eccentric but brilliant mentor, who becomes an Ally.");
//.........这里部分代码省略.........
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:101,代码来源:Scholar.cs

示例14: Mishap

        internal override void Mishap(Character character, Dice dice)
        {
            switch (dice.D(6))
            {
                case 1:
                    Injury(character, dice, true);
                    return;
                case 2:
                    character.AddHistory("A disaster leaves several injured, and others blame you, forcing you to leave your career. Gain a Rival.");
                    Injury(character, dice);
                    return;
                case 3:
                    character.AddHistory("A disaster or war strikes.");
                    if (!dice.RollHigh(character.Skills.BestSkillLevel("Stealth", "Deception"), 8))
                        Injury(character, dice);

                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("The planetary government interferes with your research for political or religious reasons. You continue working secretely.");
                        character.SocialStanding += -2;
                    }
                    else
                    {
                        character.AddHistory("The planetary government interferes with your research for political or religious reasons. You continue working openly and gain an Enemy.");
                    }
                    character.Skills.Increase(dice.Choose(SpecialtiesFor("Science")));
                    character.NextTermBenefits.MusterOut = false;
                    return;

                case 4:
                    character.AddHistory("An expedition or voyage goes wrong, leaving you stranded in the wilderness.");
                    {
                        var skillList = new SkillTemplateCollection();
                        skillList.Add("Survival");
                        skillList.Add("Athletics", "Dexterity");
                        skillList.Add("Athletics", "Endurance");
                        skillList.RemoveOverlap(character.Skills, 1);
                        if (skillList.Count > 0)
                            character.Skills.Add(dice.Choose(skillList), 1);
                    }
                    return;
                case 5:
                    if (dice.D(2) == 1)
                    {
                        character.AddHistory("Your work is sabotaged by unknown parties. You may salvage what you can and give up.");
                        character.BenefitRolls += 1;
                    }
                    else
                    {
                        character.AddHistory("Your work is sabotaged by unknown parties. You start again from scratch.");
                        character.BenefitRolls = 0;
                        character.NextTermBenefits.MusterOut = false;
                    }
                    return;
                case 6:
                    character.AddHistory("A rival researcher blackens your name or steals your research. Gain a Rival.");
                    character.NextTermBenefits.MusterOut = false;
                    return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:60,代码来源:Scholar.cs

示例15: Qualify

        internal override bool Qualify(Character character, Dice dice)
        {
            var dm = character.EnduranceDM;
            dm += -1 * character.CareerHistory.Count;
            if (character.Age >= 30)
                dm += -2;

            dm += character.GetEnlistmentBonus(Name, Assignment);

            return dice.RollHigh(dm, 6);
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:11,代码来源:Marine.cs


注:本文中的Dice.RollHigh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。