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


C# Dice.D方法代码示例

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


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

示例1: AddPassengerType

        public static void AddPassengerType(Passenger passenger, Dice random)
        {
            int roll1 = random.D66();
            int roll2 = random.D(6);
            int roll3 = random.D(6);

            switch (roll1)
            {
                case 11: passenger.PassengerType = "Refugee - political"; return;
                case 12: passenger.PassengerType = "Refugee - economic"; return;
                case 13: passenger.PassengerType = "Starting a new life offworld"; return;
                case 14: passenger.PassengerType = "Mercenary"; return;
                case 15: passenger.PassengerType = "Spy"; return;
                case 16: passenger.PassengerType = "Corporate Mechanic"; return;
                case 21: passenger.PassengerType = "Out to see the universe"; return;
                case 22: passenger.PassengerType = roll2 <= 3 ? "Tourist (Irritating)" : "Tourist (Charming)"; return;
                case 23: passenger.PassengerType = "Wide-eyed Yokel"; return;
                case 24: passenger.PassengerType = "Adventurer"; return;
                case 25: passenger.PassengerType = "Explorer"; return;
                case 26: passenger.PassengerType = "Claustrophobic"; return;
                case 31: passenger.PassengerType = "Expectant Mother"; return;
                case 32: passenger.PassengerType = "Wants to stowaway or join the crew"; return;
                case 33: passenger.PassengerType = "Possess something illegal or dangerous"; return;
                case 34:

                    if (roll2 <= 3)
                        passenger.PassengerType = "Causes Trouble (Drunk)";
                    else if (roll2 <= 5)
                        passenger.PassengerType = "Causes Trouble (Violent)";
                    else
                        passenger.PassengerType = "Causes Trouble (Insane)";
                    return;
                case 35: passenger.PassengerType = "Unusually Pretty or Handsome"; return;
                case 36: passenger.PassengerType = string.Format("Engineer (Engineer {0}, Mechanic {1})", (roll2 - 1), (roll3 - 1)); return;
                case 41: passenger.PassengerType = "Ex-scout"; return;
                case 42: passenger.PassengerType = "Wanderer"; return;
                case 43: passenger.PassengerType = "Thief or other criminal"; return;
                case 44: passenger.PassengerType = "Scientist"; return;
                case 45: passenger.PassengerType = "Journalist or researcher"; return;
                case 46: passenger.PassengerType = string.Format("Entertainer (Steward {0}, Perform {1})", (roll2 - 1), (roll3 - 1)); return;
                case 51: passenger.PassengerType = string.Format("Gambler (Gambler {0})", (roll2 - 1)); return;
                case 52: passenger.PassengerType = "Rich nobel - complains a lot"; return;
                case 53: passenger.PassengerType = "Rich nobel - eccentric"; return;
                case 54: passenger.PassengerType = "Rich nobel - raconteur"; return;
                case 55: passenger.PassengerType = "Diplomat on a mission"; return;
                case 56: passenger.PassengerType = "Agent on a mission"; return;
                case 61:
                    passenger.IsPatron = true;
                    passenger.PassengerType = "Patron";
                    return;
                case 62: passenger.PassengerType = "Alien"; return;
                case 63: passenger.PassengerType = "Bounty hunter"; return;
                case 64: passenger.PassengerType = "On the run"; return;
                case 65: passenger.PassengerType = "Wants to board the ship for some reason"; return;
                case 66: passenger.PassengerType = "Hijacker or pirate"; return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:57,代码来源:Passenger.cs

示例2: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
            {
                if (all)
                {
                    character.Skills.AddRange(SpecialtiesFor("Drive"));
                    character.Skills.Add("Vacc Suit");
                }
                else
                {
                    var skillList = new SkillTemplateCollection();
                    skillList.AddRange(SpecialtiesFor("Drive"));
                    skillList.Add("Vacc Suit");
                    skillList.RemoveOverlap(character.Skills, 0);
                    if (skillList.Count > 0)
                        character.Skills.Add(dice.Choose(skillList));
                }
            }

            if (all || roll == 2)
                character.Skills.AddRange(SpecialtiesFor("Athletics"));
            if (all || roll == 3)
                character.Skills.AddRange(SpecialtiesFor("Gun Combat"));
            if (all || roll == 4)
                character.Skills.Add("Recon");
            if (all || roll == 5)
                character.Skills.AddRange(SpecialtiesFor("Melee"));
            if (all || roll == 6)
                character.Skills.AddRange(SpecialtiesFor("Heavy Weapons"));
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:33,代码来源:Army.cs

示例3: AssignmentSkills

        internal override void AssignmentSkills(Character character, Dice dice)
        {
            switch (dice.D(6))
            {
                case 1:
                    character.Skills.Increase("Mechanic");
                    return;
                case 2:
                    character.Skills.Increase(dice.Choose(SpecialtiesFor("Drive")));
                    return;
                case 3:
                    character.Skills.Increase(dice.Choose(SpecialtiesFor("Flyer")));
                    return;
                case 4:
                    character.Skills.Increase("Recon");
                    return;
                case 5:
                    character.Skills.Increase("Heavy Weapons", "Vehicle");

                    return;
                case 6:
                    character.Skills.Increase("Electronics", "Sensors");
                    return;
            }
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:25,代码来源:Army.Cavalry.cs

示例4: AssignmentSkills

 internal override void AssignmentSkills(Character character, Dice dice)
 {
     switch (dice.D(6))
     {
         case 1:
             {
                 var skillList = new SkillTemplateCollection();
                 skillList.Add("Art", "Holography");
                 skillList.Add("Art", "Write");
                 character.Skills.Increase(dice.Choose(skillList));
             }
             return;
         case 2:
             character.Skills.Increase(dice.Choose(SpecialtiesFor("Electronics")));
             return;
         case 3:
             character.Skills.Increase(dice.Choose(SpecialtiesFor("Drive")));
             return;
         case 4:
             character.Skills.Increase("Investigate");
             return;
         case 5:
             character.Skills.Increase("Recon");
             return;
         case 6:
             character.Skills.Increase("Streetwise");
             return;
     }
 }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:29,代码来源:Entertainer.Journalist.cs

示例5: PassengersAsync

        public override async Task<PassengerList> PassengersAsync(World origin, World destination, Dice random, bool advancedCharacters)
        {

            var baseDM = 0;
            var lowDM = 1;
            var basicDM = 0;
            var middleDM = 0;
            var highDM = -4;

            if (origin.PopulationCode.Value <= 1)
                baseDM += -4;
            else if (origin.PopulationCode.Value == 6 || origin.PopulationCode.Value == 7)
                baseDM += 1;
            else if (origin.PopulationCode.Value >= 8)
                baseDM += 3;

            switch (origin.StarportCode.ToString())
            {
                case "A": baseDM += 2; break;
                case "B": baseDM += 1; break;
                case "E": baseDM += -1; break;
                case "X": baseDM += -3; break;
            }

            if (origin.ContainsRemark("A")) baseDM += 1;
            if (origin.ContainsRemark("R")) baseDM += -4;

            var result = new PassengerList();
            result.LowPassengers = random.D(PassengerTraffic(baseDM + lowDM, random));
            result.BasicPassengers = random.D(PassengerTraffic(baseDM + basicDM, random));
            result.MiddlePassengers = random.D(PassengerTraffic(baseDM + middleDM, random));
            result.HighPassengers = random.D(PassengerTraffic(baseDM + highDM, random));

            for (var i = 0; i < result.HighPassengers; i++)
                result.Passengers.Add(await PassengerDetailAsync(random, "High", advancedCharacters).ConfigureAwait(false));
            for (var i = 0; i < result.MiddlePassengers; i++)
                result.Passengers.Add(await PassengerDetailAsync(random, "Middle", advancedCharacters).ConfigureAwait(false));
            for (var i = 0; i < result.BasicPassengers; i++)
                result.Passengers.Add(await PassengerDetailAsync(random, "Basic", advancedCharacters).ConfigureAwait(false));
            for (var i = 0; i < result.LowPassengers; i++)
                result.Passengers.Add(await PassengerDetailAsync(random, "Low", advancedCharacters).ConfigureAwait(false));

            return result;
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:44,代码来源:TradeEngineMGT2.cs

示例6: FreightTraffic

        string FreightTraffic(int modifier, Dice random)
        {
            var roll = random.D(2, 6) + modifier;

            if (roll <= 1) return "0";
            if (roll <= 3) return "1D";
            if (roll <= 5) return "2D";
            if (roll <= 8) return "3D";
            if (roll <= 11) return "4D";
            if (roll <= 14) return "5D";
            if (roll == 16) return "6D";
            if (roll == 17) return "7D";
            if (roll == 18) return "8D";
            if (roll == 19) return "9D";
            return "10D";
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:16,代码来源:TradeEngineMGT2.cs

示例7: PassengerTraffic

        string PassengerTraffic(int modifier, Dice random)
        {
            var roll = random.D(2, 6) + modifier;

            if (roll <= 1) return "0";
            if (roll <= 3) return "1D";
            if (roll <= 6) return "2D";
            if (roll <= 10) return "3D";
            if (roll <= 13) return "4D";
            if (roll <= 15) return "5D";
            if (roll == 16) return "6D";
            if (roll == 17) return "7D";
            if (roll == 18) return "8D";
            if (roll == 19) return "9D";
            return "10D";
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:16,代码来源:TradeEngineMGT2.cs

示例8: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.AddRange(SpecialtiesFor("Drive"));
            if (all || roll == 2)
                character.Skills.Add("Vacc Suit");
            if (all || roll == 3)
                character.Skills.Add("Broker");
            if (all || roll == 4)
                character.Skills.Add("Steward");
            if (all || roll == 5)
                character.Skills.AddRange(SpecialtiesFor("Electronics"));
            if (all || roll == 6)
                character.Skills.Add("Persuade");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Merchant.cs

示例9: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.AddRange(SpecialtiesFor("Animals"));
            if (all || roll == 2)
                character.Skills.AddRange(SpecialtiesFor("Athletics"));
            //if (all || roll == 3)
            //character.Skills.Add("Jack-of-all-Trades");
            if (all || roll == 4)
                character.Skills.AddRange(SpecialtiesFor("Drive"));
            if (all || roll == 5)
                character.Skills.Add("Survival");
            if (all || roll == 6)
                character.Skills.Add("Recon");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Citizen.Colonist.cs

示例10: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.Add("Deception");
            if (all || roll == 2)
                character.Skills.Add("Recon");
            if (all || roll == 3)
                character.Skills.AddRange(SpecialtiesFor("Athletics"));
            if (all || roll == 4)
                character.Skills.AddRange(SpecialtiesFor("Gun Combat"));
            if (all || roll == 5)
                character.Skills.Add("Stealth");
            if (all || roll == 6)
                character.Skills.Add("Streetwise");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Rogue.cs

示例11: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.AddRange(SpecialtiesFor("Drive"));
            if (all || roll == 2)
                character.Skills.AddRange(SpecialtiesFor("Electronics"));
            if (all || roll == 3)
                character.Skills.Add("Diplomat");
            if (all || roll == 4)
                character.Skills.Add("Medic");
            if (all || roll == 5)
                character.Skills.Add("Investigate");
            if (all || roll == 6)
                character.Skills.AddRange(SpecialtiesFor("Science"));
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Scholar.cs

示例12: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.Add("Advocate");
            if (all || roll == 2)
                character.Skills.Add("Admin");
            if (all || roll == 3)
                character.Skills.Add("Broker");
            if (all || roll == 4)
                character.Skills.Add("Electronics", "Computer");
            if (all || roll == 5)
                character.Skills.Add("Diplomat");
            if (all || roll == 6)
                character.Skills.Add("Leadership");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Citizen.Corporate.cs

示例13: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.AddRange(SpecialtiesFor("Art"));
            if (all || roll == 2)
                character.Skills.Add("Carouse");
            if (all || roll == 3)
                character.Skills.AddRange(SpecialtiesFor("Drive"));
            if (all || roll == 4)
                character.Skills.Add("Deception");
            if (all || roll == 5)
                character.Skills.Add("Persuade");
            if (all || roll == 6)
                character.Skills.Add("Steward");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Entertainer.cs

示例14: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.Increase(dice.Choose(SpecialtiesFor("Pilot")));
            if (all || roll == 2)
                character.Skills.Increase("Vacc Suit");
            if (all || roll == 3)
                character.Skills.Increase(dice.Choose(SpecialtiesFor("Athletics")));
            if (all || roll == 4)
                character.Skills.Increase(dice.Choose(SpecialtiesFor("Gunner")));
            if (all || roll == 5)
                character.Skills.Increase("Mechanic");
            if (all || roll == 6)
                character.Skills.Increase(dice.Choose(SpecialtiesFor("Gun Combat ")));
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Navy.cs

示例15: BasicTrainingSkills

        internal override void BasicTrainingSkills(Character character, Dice dice, bool all)
        {
            var roll = dice.D(6);

            if (all || roll == 1)
                character.Skills.Add(dice.Choose(SpecialtiesFor("Athletics")));
            if (all || roll == 2)
                character.Skills.Add("Vacc Suit");
            if (all || roll == 3)
                character.Skills.Add(dice.Choose(SpecialtiesFor("Tactics")));
            if (all || roll == 4)
                character.Skills.Add(dice.Choose(SpecialtiesFor("Heavy Weapons")));
            if (all || roll == 5)
                character.Skills.Add(dice.Choose(SpecialtiesFor("Gun Combat")));
            if (all || roll == 6)
                character.Skills.Add("Stealth");
        }
开发者ID:Grauenwolf,项目名称:TravellerTools,代码行数:17,代码来源:Marine.cs


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