예제 #1
0
 private void Awake()
 {
     List<Teleporter> teleporters = new List<Teleporter>() { new Teleporter(2, 12), new Teleporter(8, 3) };
     int finalPosition = 100;
     Dice dice = new Dice();
     board = new Board(dice, teleporters, finalPosition);
 }
예제 #2
0
 public Game(GameBoard gameBoard, Dice dice)
 {
     this.gameBoard = gameBoard;
     this.dice = dice;
     this.players = new List<Player>();
     this.shuffler = new Shuffler<Player>();
 }
예제 #3
0
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 1:
             return;
         case 2:
             careerHistory.Title = "Technician";
             {
                 var skillList = new SkillTemplateCollection(SpecialtiesFor("Profession"));
                 skillList.RemoveOverlap(character.Skills, 1);
                 if (skillList.Count > 0)
                     character.Skills.Add(dice.Choose(skillList), 1);
             }
             return;
         case 3:
             return;
         case 4:
             careerHistory.Title = "Craftsman";
             character.Skills.Add("Mechanic", 1);
             return;
         case 5:
             return;
         case 6:
             careerHistory.Title = "Master Technician";
             {
                 var skillList = new SkillTemplateCollection(SpecialtiesFor("Engineer"));
                 skillList.RemoveOverlap(character.Skills, 1);
                 if (skillList.Count > 0)
                     character.Skills.Add(dice.Choose(skillList), 1);
             }
             return;
     }
 }
예제 #4
0
 public Category(string title, IRule rule, Turn turn, Dice dice)
 {
     Title = title;
     _rule = rule;
     _turn = turn;
     _dice = dice;
 }
 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;
     }
 }
예제 #6
0
        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"));
        }
예제 #7
0
 public void SetUp()
 {
     _turn = Substitute.For<Turn>();
     _dice = Substitute.For<Dice>();
     _onesRule = Substitute.For<IRule>();
     _category = new Category("Ones", _onesRule, _turn, _dice);
 }
예제 #8
0
        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;
            }
        }
예제 #9
0
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 0:
             careerHistory.Title = "Wastrel";
             return;
         case 1:
             return;
         case 2:
             careerHistory.Title = "Ingrate";
             character.Skills.Add("Carouse", 1);
             return;
         case 3:
             return;
         case 4:
             careerHistory.Title = "Black Sheep";
             character.Skills.Add("Persuade", 1);
             return;
         case 5:
             return;
         case 6:
             careerHistory.Title = "Scoundrel";
             character.Skills.Add("Jack-of-all-Trades", 1);
             return;
     }
 }
        public static void calcEccentricity(Dice ourDice, Star s)
        {
            int modifiers = 0; //reset the thing.

            if (OptionCont.lessStellarEccent)
            {
                //now we generate eccentricities
                if (s.orbitalSep == Star.ORBSEP_VERYCLOSE) modifiers = modifiers - 10; //Very Close
                if (s.orbitalSep == Star.ORBSEP_CLOSE) modifiers = modifiers - 6; //Close
                if (s.orbitalSep == Star.ORBSEP_MODERATE) modifiers = modifiers - 2; //Moderate
            }
            else
            {
                if (s.orbitalSep == Star.ORBSEP_VERYCLOSE) modifiers = modifiers - 6; //Very Close
                if (s.orbitalSep == Star.ORBSEP_CLOSE) modifiers = modifiers - 4; //Close
                if (s.orbitalSep == Star.ORBSEP_MODERATE) modifiers = modifiers - 2; //Moderate
            }

            int roll = ourDice.gurpsRoll(modifiers);
            Star.generateEccentricity(roll, s);

            if (OptionCont.forceVeryLowStellarEccent)
            {
                if (s.orbitalEccent > .2) s.orbitalEccent = .1;
                if (s.orbitalEccent > .1 && s.orbitalEccent < .2) s.orbitalEccent = .05;

            }
        }
        internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
        {
            switch (careerHistory.Rank)
            {
                case 0:
                    return;
                case 1:
                    careerHistory.Title = "Agent";
                    character.Skills.Add("Deception", 1);
                    return;
                case 2:
                    careerHistory.Title = "Field Agent";
                    character.Skills.Add("Investigate", 1);
                    return;
                case 3:
                    return;
                case 4:
                    careerHistory.Title = "Special Agent";
                    var skillList = new SkillTemplateCollection(SpecialtiesFor("Gun Combat"));
                    skillList.RemoveOverlap(character.Skills, 1);
                    if (skillList.Count > 0)
                        character.Skills.Add(dice.Choose(skillList), 1);

                    return;
                case 5:
                    careerHistory.Title = "Assistant Director";
                    return;
                case 6:
                    careerHistory.Title = "Director";
                    return;
            }
        }
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 0:
             careerHistory.Title = "Assistant";
             return;
         case 1:
             careerHistory.Title = "Clerk";
             character.Skills.Add("Admin", 1);
             return;
         case 2:
             careerHistory.Title = "Supervisor";
             return;
         case 3:
             careerHistory.Title = "Manager";
             character.Skills.Add("Advocate", 1);
             return;
         case 4:
             careerHistory.Title = "Chief";
             return;
         case 5:
             careerHistory.Title = "Director";
             character.Skills.Add("Leadership", 1);
             return;
         case 6:
             careerHistory.Title = "Minister";
             return;
     }
 }
예제 #13
0
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 1:
             return;
         case 2:
             careerHistory.Title = "Settler";
             character.Skills.Add("Survival", 1);
             return;
         case 3:
             return;
         case 4:
             careerHistory.Title = "Explorer";
             character.Skills.Add("Navigation", 1);
             return;
         case 5:
             return;
         case 6:
             {
                 var skillList = new SkillTemplateCollection(SpecialtiesFor("Gun Combat"));
                 skillList.RemoveOverlap(character.Skills, 1);
                 if (skillList.Count > 0)
                     character.Skills.Add(dice.Choose(skillList), 1);
             }
             return;
     }
 }
 /// <summary>
 /// Titles the table.
 /// </summary>
 /// <param name="character">The character.</param>
 /// <param name="careerHistory">The career history.</param>
 /// <param name="dice">The dice.</param>
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 0:
             return;
         case 1:
             careerHistory.Title = "Freelancer";
             character.Skills.Add("Electronics", "Comms", 1);
             return;
         case 2:
             careerHistory.Title = "Staff Writer";
             character.Skills.Add("Investigate", 1);
             return;
         case 3:
             return;
         case 4:
             careerHistory.Title = "Correspondent";
             character.Skills.Add("Persuade", 1);
             return;
         case 5:
             return;
         case 6:
             careerHistory.Title = "Senior Correspondent";
             character.SocialStanding += 1;
             return;
     }
 }
예제 #15
0
 internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
 {
     switch (careerHistory.Rank)
     {
         case 0:
             return;
         case 1:
             character.Skills.Add("Persuade", 1);
             return;
         case 2:
             return;
         case 3:
             var skillList = new SkillTemplateCollection();
             skillList.AddRange(SpecialtiesFor("Gun Combat"));
             skillList.AddRange(SpecialtiesFor("Melee"));
             skillList.RemoveOverlap(character.Skills, 1);
             if (skillList.Count > 0)
                 character.Skills.Add(dice.Choose(skillList), 1);
             return;
         case 4:
             return;
         case 5:
             character.Skills.Add("Streetwise", 1);
             return;
         case 6:
             return;
     }
 }
예제 #16
0
		public ItemBattleInfo(int _dv, int _pv, int _pvi, int _toHit, Dice _dmg)
		{
			DV = _dv;
			PV = _pv;
			PVI = _pvi;
			ToHit = _toHit;
			Dmg = _dmg;
		}
예제 #17
0
        // ReSharper restore InconsistentNaming
        /// <summary>
        /// Get a number of dice determined by a roll of dice.
        /// </summary>
        /// <param name="diceToRollForNumberOfDice"></param>
        /// <param name="numberOfSides"></param>
        /// <returns></returns>
        // ReSharper disable InconsistentNaming
        public static Dice d(this Dice diceToRollForNumberOfDice, int numberOfSides)
        {
            var dice = new Dice { NumberOfDice = 0, Sides = numberOfSides };

            dice.NumberOfDiceModifiers.Add(numberOfDice => numberOfDice + diceToRollForNumberOfDice.Roll());

            return dice;
        }
예제 #18
0
 public RaceGenerator(IBooleanPercentileSelector booleanPercentileSelector, ICollectionsSelector collectionsSelector, IAdjustmentsSelector adjustmentsSelector,
     Dice dice)
 {
     this.booleanPercentileSelector = booleanPercentileSelector;
     this.collectionsSelector = collectionsSelector;
     this.adjustmentsSelector = adjustmentsSelector;
     this.dice = dice;
 }
예제 #19
0
 ///<summary>
 /// Konstruktor.
 ///</summary>
 public Game(Board b, Player[] pemain, Dice d)
 {
     this.dice = d;
       this.papan = b;
       this.players = pemain;
       this.winner = null;
       this.totalPlayer = pemain.length;
 }
예제 #20
0
        //Default Constructor
        public Factory(GameAssets gameAssets_)
        {
            gameAssets = gameAssets_;
            spawnRulesList = new List<EnemySpawnRules>();

            InitEnemySpawnRules();
            spawnRulesSelector = new Dice(1, spawnRulesList.Count);
        }
        public void TestRepresentation(int number, DiceType diceType, string expectedToString, int minRoll, int maxRoll)
        {
            Dice dice = new Dice(number, diceType);

            Assert.That(dice.ToString(), Is.EqualTo(expectedToString));
            Assert.That(dice.MinRoll, Is.EqualTo(minRoll), "Incorrect minimum roll");
            Assert.That(dice.MaxRoll, Is.EqualTo(maxRoll), "Incorrect maximum roll");
        }
예제 #22
0
 // A three-of-a-kind and a pair
 public static Boolean isFullHouse(Dice[] dices)
 {
     initializer(dices);
     if (((Ones == 3) || (Twos == 3) || (Threes == 3) || (Fours == 3) || (Fives == 3) || (Sixes == 3)) && ((Ones == 2) || (Twos == 2) || (Threes == 2) || (Fours == 2) || (Fives == 2) || (Sixes == 2)))
     {
         return true;
     }
     return false;
 }
예제 #23
0
 public int Roll(int timesRolled, Dice dice)
 {
     int total = 0;
     for( int i = 0; i < timesRolled; ++i)
     {
         total += dice.Roll();
     }
     return total;
 }
예제 #24
0
 internal override int ComputeScore(Dice[] dices)
 {
     int score = 0;
     foreach (Dice dice in dices)
     {
             score += dice.value;
     }
     return score;
 }
예제 #25
0
        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;
            }
        }
예제 #26
0
 public int chanceScore(Dice[] chanceDice)
 {
     int score = 0;
     foreach (Dice d in chanceDice)
     {
         score += d.diceValue;
     }
     return score;
 }
예제 #27
0
 // At least four dice showing the same face
 public static Boolean isFourOfAKind(Dice[] dices)
 {
     initializer(dices);
     if ((Ones >= 4) || (Twos >= 4) || (Threes >= 4) || (Fours >= 4) || (Fives >= 4) || (Sixes >= 4))
     {
         return true;
     }
     return false;
 }
예제 #28
0
        public static int Attack(this AttackerRole attacker)
        {
            var dice = new Dice();

            var damageDealt = attacker.DetermineDamage();

            var damage = attacker.Hits(dice) ? damageDealt : 0;

            return damage < 0 ? 0 : damage;
        }
예제 #29
0
파일: DiceCtrl.cs 프로젝트: Kussi/Myosotis
    /// <summary>
    /// Initializes the dice object
    /// </summary>
    /// <param name="firstPlayerColor"></param>
    public static void InitializeDice(string firstPlayerColor)
    {
        GameObject diceObject = (GameObject)GameObject.Instantiate(Resources.Load(DicePrefab, typeof(GameObject)));
        diceObject.name = (DiceName);
        diceObject.transform.parent = GameObject.Find(DiceParentObject).transform;
        diceObject.transform.position = GetDicePosition(firstPlayerColor).position;

        diceObject.AddComponent<Dice>();
        dice = diceObject.GetComponent<Dice>();
    }
        /// <summary>
        /// Create a new <see cref="PowerDamage"/> that uses the given dice damage.
        /// </summary>
        /// <param name="name">
        /// The name of the damage, usually "[Power] damage".
        /// </param>
        /// <param name="dice">
        /// The damage done.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Niether name nor dice can be null.
        /// </exception>
        public PowerDamage(string name, Dice dice)
            : this(name)
        {
            if (dice == null)
            {
                throw new ArgumentNullException("dice");
            }

            this.dice = dice;
        }
예제 #31
0
        public Character Build(CharacterBuilderOptions options)
        {
            var seed      = options.Seed ?? (new Random()).Next();
            var dice      = new Dice(seed);
            var character = new Character();

            character.Seed            = seed;
            character.FirstAssignment = options.FirstAssignment;
            character.Name            = options.Name;
            character.Gender          = options.Gender;

            character.Strength       = dice.D(2, 6);
            character.Dexterity      = dice.D(2, 6);
            character.Endurance      = dice.D(2, 6);
            character.Intellect      = dice.D(2, 6);
            character.Education      = dice.D(2, 6);
            character.SocialStanding = dice.D(2, 6);

            if (character.EducationDM + 3 > 0)
            {
                var backgroundSKills = dice.Choose(s_BackgroundSkills, character.EducationDM + 3, allowDuplicates: false);
                foreach (var skill in backgroundSKills)
                {
                    character.Skills.Add(skill); //all skills added at level 0
                }
            }

            character.CurrentTerm      = 1;
            character.NextTermBenefits = new NextTermBenefits();

            if (!string.IsNullOrEmpty(options.FirstAssignment))
            {
                character.NextTermBenefits.MustEnroll = options.FirstAssignment;
            }

            while (!IsDone(options, character))
            {
                var nextCareer = PickNextCareer(character, dice);
                character.CurrentTermBenefits = character.NextTermBenefits;
                character.NextTermBenefits    = new NextTermBenefits();
                nextCareer.Run(character, dice);

                if (character.LongTermBenefits.MayTestPsi && dice.RollHigh(10))
                {
                    Book.TestPsionic(character, dice);
                }

                character.CurrentTerm += 1;

                if (character.CurrentTerm >= 4)
                {
                    AgingRoll(character, dice);
                }
            }

            //Add personality
            int personalityTraits = dice.D(3);

            for (var i = 0; i < personalityTraits; i++)
            {
                character.Personality.Add(dice.Choose(m_Personalities));
            }

            //Fixups
            if (options.MaxAge.HasValue && !character.IsDead)
            {
                character.Age = options.MaxAge.Value;
            }

            character.Title = character.CareerHistory.Where(c => c.Title != null).OrderByDescending(c => c.Rank + c.CommissionRank).Select(c => c.Title).FirstOrDefault();

            character.Skills.Collapse();

            return(character);
        }
예제 #32
0
 public override int Amount()
 {
     return(Dice.D8(CriticalHit ? 4 : 2) + Modifier);
 }
예제 #33
0
        internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
        {
            switch (careerHistory.Rank)
            {
            case 1:
                character.Skills.Add("Vacc Suit", 1);
                return;

            case 2:
                return;

            case 3:
                var skillList = new SkillTemplateCollection();
                skillList.Add("Profession", "Belter");
                skillList.Add("Mechanic");
                skillList.RemoveOverlap(character.Skills, 1);
                if (skillList.Count > 0)
                {
                    character.Skills.Add(dice.Choose(skillList), 1);
                }
                return;

            case 4:
                return;

            case 5:
                return;

            case 6:
                return;
            }
        }
 public void Awake()
 {
     dice = GetComponent <Dice>();
     _tf  = transform;
 }
예제 #35
0
        internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
        {
            switch (careerHistory.Rank)
            {
            case 0:
                return;

            case 1:
                character.Skills.Add("Broker", 1);
                return;

            case 2:
                return;

            case 3:
                careerHistory.Title = "Experienced Broker";
                character.Skills.Add("Streetwise", 1);
                return;

            case 4:
                return;

            case 5:
                return;

            case 6:
                return;
            }
        }
예제 #36
0
 public Attack(int rng, Dice att, Dice dmg)
 {
     range      = rng;
     attackDice = att;
     damageDice = dmg;
 }
예제 #37
0
 public ChargesGenerator(Dice dice, IRangeAttributesSelector rangeAttributesSelector, IBooleanPercentileSelector booleanPercentileSelector)
 {
     this.dice = dice;
     this.rangeAttributesSelector   = rangeAttributesSelector;
     this.booleanPercentileSelector = booleanPercentileSelector;
 }
예제 #38
0
 // Start is called before the first frame update
 void Start()
 {
     currentID = 84 + GetColor(color);
     manager   = GameObject.FindWithTag("Manager").GetComponent <GameManager>();
     die       = GameObject.FindWithTag("Finish").GetComponent <Dice>();
 }
        public int attack()
        {
            Dice attackDice = new Dice(damageMaximum);

            return(attackDice.roll());
        }
예제 #40
0
        private static string MainPhpAutoFishPrepare(string html)
        {
            var p1 = html.IndexOf(AppConsts.HtmlValueRiba, StringComparison.OrdinalIgnoreCase);

            if (p1 == -1)
            {
                return(string.Empty);
            }

            AppVars.CodeAddress = string.Empty;
            var pcode = html.IndexOf(AppConsts.HtmlCodePhp, StringComparison.OrdinalIgnoreCase);

            if (pcode != -1)
            {
                pcode += AppConsts.HtmlCodePhp.Length;
                var pe = html.IndexOf('"', pcode);
                if (pe == -1)
                {
                    return(string.Empty);
                }

                AppVars.CodeAddress = AppConsts.HtmlCodePhpFull + html.Substring(pcode, pe - pcode);
            }

            var getid = HelperStrings.SubString(html, "=get_id value=", ">");

            if (string.IsNullOrEmpty(getid))
            {
                return(string.Empty);
            }

            var act = HelperStrings.SubString(html, "=act value=", ">");

            if (string.IsNullOrEmpty(act))
            {
                return(string.Empty);
            }

            var vcode = HelperStrings.SubString(html, "=vcode value=", ">");

            if (string.IsNullOrEmpty(vcode))
            {
                return(string.Empty);
            }

            var lakeid = HelperStrings.SubString(html, "=lakeid value=", ">");

            if (string.IsNullOrEmpty(lakeid))
            {
                return(string.Empty);
            }

            AppVars.AutoFishMassa = HelperStrings.SubString(html, "<b>Масса Вашего инвентаря: ", "</b>");
            if (string.IsNullOrEmpty(AppVars.AutoFishMassa))
            {
                return(string.Empty);
            }

            var primid = string.Empty;
            var l1     = new List <string>();

            if ((AppVars.Profile.FishEnabledPrims & Prims.Bread) != 0)
            {
                l1.Add("Хлеб");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Worm) != 0)
            {
                l1.Add("Червяк");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.BigWorm) != 0)
            {
                l1.Add("Крупный червяк");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Stink) != 0)
            {
                l1.Add("Опарыш");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Fly) != 0)
            {
                l1.Add("Мотыль");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Light) != 0)
            {
                l1.Add("Блесна");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Donka) != 0)
            {
                l1.Add("Донка");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.Morm) != 0)
            {
                l1.Add("Мормышка");
            }

            if ((AppVars.Profile.FishEnabledPrims & Prims.HiFlight) != 0)
            {
                l1.Add("Заговоренная блесна");
            }

            var l2 = new List <string>();

            while (l1.Count > 0)
            {
                var n = Dice.Make(l1.Count);
                l2.Add(l1[n]);
                l1.RemoveAt(n);
            }

            while (l2.Count > 0)
            {
                var pr = string.Empty;
                switch (l2[0])
                {
                case "Хлеб":
                    pr     = "38";
                    primid = "38";
                    break;

                case "Червяк":
                    pr     = "39";
                    primid = "39";
                    break;

                case "Крупный червяк":
                    pr     = "40";
                    primid = "40";
                    break;

                case "Опарыш":
                    pr     = "41";
                    primid = "41";
                    break;

                case "Мотыль":
                    pr     = "42";
                    primid = "42";
                    break;

                case "Блесна":
                    pr     = "43";
                    primid = "43";
                    break;

                case "Донка":
                    pr     = "44";
                    primid = "44";
                    break;

                case "Мормышка":
                    pr     = "45";
                    primid = "45";
                    break;

                case "Заговоренная блесна":
                    pr     = "46";
                    primid = "46";
                    break;
                }

                var temp =
                    "<input type=radio name=primid value=" +
                    primid +
                    "></td><td bgcolor=#FFFFFF><img src=http://image.neverlands.ru/tools/" +
                    pr +
                    ".gif width=60 height=60></td><td bgcolor=#FFFFFF align=center class=nickname><b>" +
                    l2[0] +
                    "</b></td><td bgcolor=#FFFFFF align=center class=nickname><b>";
                var pos = html.IndexOf(temp, StringComparison.OrdinalIgnoreCase);
                if (pos != -1)
                {
                    AppVars.AutoFishLikeId  = primid;
                    AppVars.AutoFishLikeVal = HelperStrings.SubString(html, temp, "</b>");
                    if (pos != -1)
                    {
                        html = html.Insert(pos + 18, "checked ");
                    }

                    break;
                }

                primid = string.Empty;
                l2.RemoveAt(0);
            }

            if (string.IsNullOrEmpty(primid))
            {
                try
                {
                    if (AppVars.MainForm != null)
                    {
                        AppVars.MainForm.BeginInvoke(
                            new UpdateFishOffDelegate(AppVars.MainForm.UpdateFishOff),
                            new object[] { });
                    }
                }
                catch (InvalidOperationException)
                {
                }

                return(string.Empty);
            }

            /*
             * Без капчи
             *  /main.php?get_id=55&lakeid=2&act=4&primid=40&vcode=26ed9c9afae6128894a60e1b8275ebf4
             *
             *  /main.php?get_id=55&lakeid=1&act=4&primid=39&code=57397&vcode=e026c7b0ccf87e33cff2b6907f22679b
             */
            AppVars.FightLink =
                "http://www.neverlands.ru/main.php?get_id=" +
                getid +
                "&lakeid=" +
                lakeid +
                "&act=" +
                act +
                "&primid=" +
                primid +
                (string.IsNullOrEmpty(AppVars.CodeAddress) ? string.Empty : "&code=????") +
                "&vcode=" +
                vcode;

            if (!string.IsNullOrEmpty(AppVars.CodeAddress))
            {
                if (!AppVars.Profile.DoGuamod)
                {
                    if (AppVars.MainForm != null && AppVars.MainForm.TrayIsDigitsWaitTooLong())
                    {
                        try
                        {
                            if (AppVars.MainForm != null)
                            {
                                AppVars.MainForm.BeginInvoke(
                                    new UpdateGuamodTurnOnDelegate(AppVars.MainForm.UpdateGuamodTurnOn),
                                    new object[] { });
                            }
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }
                    else
                    {
                        EventSounds.PlayDigits();
                        try
                        {
                            if (AppVars.MainForm != null)
                            {
                                AppVars.MainForm.BeginInvoke(
                                    new UpdateTrayFlashDelegate(AppVars.MainForm.UpdateTrayFlash),
                                    new object[] { "Ввод цифр" });
                            }
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }

                    try
                    {
                        if (AppVars.MainForm != null)
                        {
                            AppVars.MainForm.BeginInvoke(
                                new UpdateTrayFlashDelegate(AppVars.MainForm.UpdateTrayFlash),
                                new object[] { "Ввод цифр" });
                        }
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }
            }

            return(html);
        }
예제 #41
0
 public Monster(string name, Position position)
 {
     Name      = name;
     Position  = position;
     Hitpoints = new Dice().RollForHitpoints(MinHitpoints, MaxHitpoints);
 }
예제 #42
0
        static void AgingRoll(Character character, Dice dice)
        {
            //TODO: Anagathics page 47

            var roll = dice.D(2, 6) - character.CurrentTerm;

            if (roll <= -6)
            {
                character.Strength  += -2;
                character.Dexterity += -2;
                character.Endurance += -2;
                switch (dice.D(3))
                {
                case 1: character.Intellect += -1; break;

                case 2: character.Education += -1; break;

                case 3: character.SocialStanding += -1; break;
                }
            }
            else if (roll == -5)
            {
                character.Strength  += -2;
                character.Dexterity += -2;
                character.Endurance += -2;
            }
            else if (roll == -4)
            {
                switch (dice.D(3))
                {
                case 1:
                    character.Strength  += -2;
                    character.Dexterity += -2;
                    character.Endurance += -1;
                    break;

                case 2:
                    character.Strength  += -1;
                    character.Dexterity += -2;
                    character.Endurance += -2;
                    break;

                case 3:
                    character.Strength  += -2;
                    character.Dexterity += -1;
                    character.Endurance += -2;
                    break;
                }
            }
            else if (roll == -3)
            {
                switch (dice.D(3))
                {
                case 1:
                    character.Strength  += -2;
                    character.Dexterity += -1;
                    character.Endurance += -1;
                    break;

                case 2:
                    character.Strength  += -1;
                    character.Dexterity += -2;
                    character.Endurance += -1;
                    break;

                case 3:
                    character.Strength  += -1;
                    character.Dexterity += -1;
                    character.Endurance += -2;
                    break;
                }
            }
            else if (roll == -2)
            {
                character.Strength  += -1;
                character.Dexterity += -1;
                character.Endurance += -1;
            }
            else if (roll == -1)
            {
                switch (dice.D(3))
                {
                case 1:
                    character.Strength  += -1;
                    character.Dexterity += -1;
                    break;

                case 2:
                    character.Strength  += -1;
                    character.Endurance += -1;
                    break;

                case 3:
                    character.Dexterity += -1;
                    character.Endurance += -1;
                    break;
                }
            }
            else if (roll == 0)
            {
                switch (dice.D(3))
                {
                case 1:
                    character.Strength += -1;
                    break;

                case 2:
                    character.Dexterity += -1;
                    break;

                case 3:
                    character.Endurance += -1;
                    break;
                }
            }
            else
            {
                return; //no again crisis possible.
            }

            if (character.Strength <= 0 ||
                character.Dexterity <= 0 ||
                character.Endurance <= 0 ||
                character.Intellect <= 0 ||
                character.Education <= 0 ||
                character.SocialStanding <= 0)
            {
                var bills = dice.D(6) * 10000;
                character.Debt += bills;
                character.AddHistory($"Aging Crisis. Owe {bills:N0} for medical bills.");

                if (character.Strength < 1)
                {
                    character.Strength = 1;
                }
                if (character.Dexterity < 1)
                {
                    character.Dexterity = 1;
                }
                if (character.Endurance < 1)
                {
                    character.Endurance = 1;
                }
                if (character.Intellect < 1)
                {
                    character.Intellect = 1;
                }
                if (character.Education < 1)
                {
                    character.Education = 1;
                }
                if (character.SocialStanding < 1)
                {
                    character.SocialStanding = 1;
                }
                character.LongTermBenefits.QualificationDM = -100;
                character.LongTermBenefits.Retired         = true;
            }
        }
예제 #43
0
 public override int Amount()
 {
     return(Dice.D10(CriticalHit ? 2 : 1) + Modifier);
 }
예제 #44
0
파일: Star.cs 프로젝트: Neakas/ProjectSWN
 /// <summary>
 ///     This updates the star to the current surface temperature given no alterations
 /// </summary>
 /// <param name="ageL">the age line of the star</param>
 /// <param name="lumin">The current luminosity of the star (used for White Dwarfs)</param>
 /// <param name="age">The age of the star</param>
 /// <param name="mass">The current mass of the star</param>
 /// <param name="ourDice">Ddice (due to randomization of the temperature)</param>
 /// <returns>The current temperature of the star</returns>
 public static double GetCurrentTemp(StarAgeLine ageL, double lumin, double age, double mass, Dice ourDice)
 {
     if (ageL.FindCurrentAgeGroup(age) == StarAgeLine.RetMainbranch)
     {
         return(GetInitTemp(mass));
     }
     if (ageL.FindCurrentAgeGroup(age) == StarAgeLine.RetSubbranch)
     {
         return(GetInitTemp(mass) - ageL.CalcWithInSubLimit(age) * (GetInitTemp(mass) - 4800));
     }
     if (ageL.FindCurrentAgeGroup(age) == StarAgeLine.RetGiantbranch)
     {
         return(3000 + ourDice.Rng(2, 6, -2) * 200);
     }
     return(ageL.FindCurrentAgeGroup(age) == StarAgeLine.RetCollaspedstar ? Math.Pow(lumin / Math.Pow(GetRadius(mass, 0, lumin, StarAgeLine.RetCollaspedstar), 2) * (5.38937375 * Math.Pow(10, 26)), 1.00 / 4) : 0);
 }
예제 #45
0
        internal override void TitleTable(Character character, CareerHistory careerHistory, Dice dice)
        {
            switch (careerHistory.Rank)
            {
            case 1:
                return;

            case 2:
                careerHistory.Title = "Technician";
                {
                    var skillList = new SkillTemplateCollection(SpecialtiesFor("Profession"));
                    skillList.RemoveOverlap(character.Skills, 1);
                    if (skillList.Count > 0)
                    {
                        character.Skills.Add(dice.Choose(skillList), 1);
                    }
                }
                return;

            case 3:
                return;

            case 4:
                careerHistory.Title = "Craftsman";
                character.Skills.Add("Mechanic", 1);
                return;

            case 5:
                return;

            case 6:
                careerHistory.Title = "Master Technician";
                {
                    var skillList = new SkillTemplateCollection(SpecialtiesFor("Engineer"));
                    skillList.RemoveOverlap(character.Skills, 1);
                    if (skillList.Count > 0)
                    {
                        character.Skills.Add(dice.Choose(skillList), 1);
                    }
                }
                return;
            }
        }
예제 #46
0
    public void OnStopped()
    {
        Random.InitState((int)System.DateTime.Now.Ticks);
        int diceRoll = Random.Range(1, 7);

        GameObject.Find("ClickTheDice").GetComponent <Text>().text = "DICE VALUES: ";

        if (DiceManager.APFound() == false)
        {
            GameObject ap = DiceManager.FindEmptyTypeTotal();
            ap.GetComponent <Text>().text = "AP: ";
            ap.transform.GetChild(0).GetComponent <Text>().enabled = true;
            DiceManager.SetAPFound(true);
        }

        string rollValueName = "RollValue" + Dice.LastDiceClicked().name.ToCharArray()[Dice.LastDiceClicked().name.Length - 1];

        GameObject.Find(rollValueName).GetComponent <Text>().text = diceRoll.ToString();

        int rollTotal = int.Parse(GameObject.Find("RollTotal").GetComponent <Text>().text);

        rollTotal += diceRoll;
        GameObject.Find("RollTotal").GetComponent <Text>().text    = rollTotal.ToString();
        GameObject.Find("RollTotal").GetComponent <Text>().enabled = true;

        int attackTotal = int.Parse(DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text);

        attackTotal += diceRoll;
        DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text = attackTotal.ToString();

        if (diceRoll == 1)
        {
            GameObject.Find("AttackMissed").GetComponent <BillboardMessage>().ShowMessage();
        }
    }
예제 #47
0
 public HitPointsGenerator(Dice dice, IAdjustmentsSelector adjustmentSelector)
 {
     this.dice = dice;
     this.adjustmentSelector = adjustmentSelector;
 }
예제 #48
0
        public static CelestialBody Generate(Dice die)
        {
            CelestialBody celestialObject = new CelestialBody();

            celestialObject.CelestialType = GenerateCelestialBodyType(die);

            // Terraforming Tier
            if (celestialObject.CelestialType == CelestialBodyType.Blackhole ||
                celestialObject.CelestialType == CelestialBodyType.SubStar ||
                celestialObject.CelestialType == CelestialBodyType.Wormhole ||
                celestialObject.CelestialType == CelestialBodyType.Comet)
            {
                celestialObject.TerraformingTier = TerraformationTier.Uninhabitable;
            }
            else
            {
                celestialObject.TerraformingTier = GenerateTerraformationTier(die);
            }

            // Stage of Life
            if (celestialObject.TerraformingTier == TerraformationTier.Uninhabitable ||
                celestialObject.CelestialType == CelestialBodyType.Blackhole ||
                celestialObject.CelestialType == CelestialBodyType.SubStar ||
                celestialObject.CelestialType == CelestialBodyType.Wormhole ||
                celestialObject.CelestialType == CelestialBodyType.Comet)
            {
                celestialObject.StageOfLife = LifeStage.NoLife;
            }
            else if (celestialObject.TerraformingTier == TerraformationTier.T1 ||
                     celestialObject.TerraformingTier == TerraformationTier.T2 ||
                     celestialObject.CelestialType == CelestialBodyType.GasPlanet)
            {
                celestialObject.StageOfLife = GenerateStageOfLifeT1T2(die);
            }
            else
            {
                celestialObject.StageOfLife = GenerateStageOfLife(die);
            }

            // Calculate Resource Value
            celestialObject.ResourceValue = GenerateResourceValue(die);
            if (celestialObject.CelestialType == CelestialBodyType.Blackhole || celestialObject.CelestialType == CelestialBodyType.Wormhole)
            {
                celestialObject.ResourceValue = 0;
            }
            else if (celestialObject.TerraformingTier == TerraformationTier.Uninhabitable)
            {
                celestialObject.ResourceValue += die.Roll(1, 10) + 10;
            }
            else if (celestialObject.TerraformingTier == TerraformationTier.T1)
            {
                celestialObject.ResourceValue += die.Roll(1, 5);
            }
            else if (celestialObject.TerraformingTier == TerraformationTier.T2)
            {
                celestialObject.ResourceValue += die.Roll(1, 3);
            }
            else if (celestialObject.TerraformingTier == TerraformationTier.T5)
            {
                celestialObject.ResourceValue += die.Roll(1, 5) + 3;
            }

            // Generate Sentient Species
            if (celestialObject.StageOfLife == LifeStage.SentientLife)
            {
                int numberOfSentients = GenerateNumberOfSentients(die);
                for (int i = 0; i < numberOfSentients; i++)
                {
                    celestialObject.Sentients.Add(SentientSpecies.Generate(die));
                }
            }

            // Generate Celestial Satellites
            if (celestialObject.CelestialType == CelestialBodyType.Comet)
            {
            }
            else if (celestialObject.CelestialType == CelestialBodyType.Wormhole)
            {
            }
            //else if (celestialObject.CelestialType == CelestialBodyType.AsteroidBelt) { }
            else
            {
                int numberOfCelestialSatellites = GenerateNumberOfCelestialSatellites(die);
                for (int i = 0; i < numberOfCelestialSatellites; i++)
                {
                    celestialObject.OrbitingSatellites.Add(CelestialSatellite.Generate(die));
                }
            }

            return(celestialObject);
        }
예제 #49
0
 public RollResult RollDice(Random rnd, Dice dice)
 {
     return(new RollResult {
         Dice = dice, RollValue = rnd.Next(1, 7)
     });
 }
예제 #50
0
 public void SetDice(string diceName, Dice dice)
 {
     _dice[diceName] = dice;
 }
예제 #51
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="spell"></param>
        /// <param name="origin"></param>
        /// <param name="target"></param>
        /// <param name="room"></param>
        public void DoSpell(string spellName, Player origin, string targetName = "", Room room = null)
        {
            if (!ValidStatus(origin))
            {
                return;
            }

            var spell = FindSpell(spellName, origin);

            if (spell == null)
            {
                return;
            }

            if (origin.ConnectionId != "mob" && !ManaCheck(spell, origin))
            {
                return;
            }

            // saves



            if (SpellAffectsCharacter(spell))
            {
                Player target = null;
                target = _spellTargetCharacter.ReturnTarget(spell, targetName, room, origin);

                if (target == null)
                {
                    return;
                }
                var spellSkill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(spell.Id));
                //saving throw
                if (spell.Type == SkillType.Affect)
                {
                    var savingThrow = target.Attributes.Attribute[EffectLocation.Intelligence] / 2;

                    var rollForSave = _dice.Roll(1, 1, 100);

                    if (rollForSave <= savingThrow)
                    {
                        //save
                        // half spell affect duration


                        if (rollForSave == 1)
                        {
                            // fail
                            spell.Rounds = origin.Level / 2;
                        }

                        if (rollForSave != 1)
                        {
                            spell.Rounds = origin.Level / 4;
                        }
                    }
                }


                ReciteSpellCharacter(origin, target, spell, room);



                //deduct mana
                origin.Attributes.Attribute[EffectLocation.Mana] -= spell.Cost.Table[Cost.Mana] == 0 ? 5 : spell.Cost.Table[Cost.Mana];
                _updateClientUi.UpdateMana(origin);



                if (SpellSuccess(origin, target, spell))
                {
                    //if (spell.Type == SkillType.Damage)
                    //{

                    //    var savingThrow = origin.Attributes.Attribute[EffectLocation.Dexterity] / 2;

                    //    var rollForSave = _dice.Roll(1, 1, 100);

                    //    if (rollForSave <= savingThrow || rollForSave == 100)
                    //    {
                    //        if (rollForSave > 1)
                    //        {
                    //            damage /= 2;

                    //            _writer.WriteLine("You partly evade " + origin.Name + "'s " + spell.Name + " by jumping back.", target.ConnectionId);

                    //            _writer.WriteLine($"{target.Name} partly evades your " + spell.Name + " by jumping back.", origin.ConnectionId);

                    //            foreach (var pc in room.Players)
                    //            {
                    //                if (pc.ConnectionId.Equals(origin.ConnectionId) ||
                    //                    pc.ConnectionId.Equals(target.ConnectionId))
                    //                {
                    //                    continue;
                    //                }

                    //                _writer.WriteLine($"{target.Name} partly evades {origin.Name}'s " + spell.Name + " by jumping back.", pc.ConnectionId);
                    //            }
                    //        }
                    //    }
                    //}


                    var skillTarget = new SkillTarget
                    {
                        Origin = origin,
                        Target = target,
                        Room   = room,
                        Skill  = spell
                    };



                    if (string.IsNullOrEmpty(spell.Formula) && spell.Type == SkillType.Damage)
                    {
                        //do this for cast cure
                        _spellList.CastSpell(spell.Name, "", target, "", origin, room, false);
                    }



                    if (spell.Type != SkillType.Damage)
                    {
                        _spellList.CastSpell(spell.Name, "", target, "", origin, room, false);
                    }
                }
                else
                {
                    var skill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(spell.Id));

                    if (skill == null)
                    {
                        return;
                    }

                    if (skill.Proficiency == 95)
                    {
                        return;
                    }

                    var increase = new Dice().Roll(1, 1, 3);

                    skill.Proficiency += increase;

                    origin.Experience            += 100;
                    origin.ExperienceToNextLevel -= 100;

                    _updateClientUi.UpdateExp(origin);

                    _writer.WriteLine(
                        $"<p class='improve'>You learn from your mistakes and gain 100 experience points.</p>",
                        origin.ConnectionId);
                    _writer.WriteLine(
                        $"<p class='improve'>Your {skill.SkillName} skill increases by {increase}%.</p>",
                        origin.ConnectionId);
                }
            }
            else if ((spell.ValidTargets & ValidTargets.TargetObjectInventory) != 0 || (spell.ValidTargets & ValidTargets.TargetObjectEquipped) != 0)
            {
                //Item.Item target = null;
                //target = _spellTargetCharacter.ReturnTargetItem(spell, targetName, room, origin);

                //if (target == null)
                //{
                //    return;
                //}
                var spellSkill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(spell.Id));


                ReciteSpellCharacter(origin, origin, spell, room);

                //deduct mana
                origin.Attributes.Attribute[EffectLocation.Mana] -= spell.Cost.Table[Cost.Mana] == 0 ? 5 : spell.Cost.Table[Cost.Mana];
                _updateClientUi.UpdateMana(origin);


                if (SpellSuccess(origin, null, spell))
                {
                    _spellList.CastSpell(spell.Name, targetName, null, "", origin, room, false);
                }
                else
                {
                    var skill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(spell.Id));

                    if (skill == null)
                    {
                        return;
                    }

                    if (skill.Proficiency == 95)
                    {
                        return;
                    }


                    var increase = new Dice().Roll(1, 1, 3);

                    skill.Proficiency += increase;

                    origin.Experience            += 100;
                    origin.ExperienceToNextLevel -= 100;

                    _updateClientUi.UpdateExp(origin);

                    _writer.WriteLine(
                        $"<p class='improve'>You learn from your mistakes and gain 100 experience points.</p>",
                        origin.ConnectionId);
                    _writer.WriteLine(
                        $"<p class='improve'>Your {skill.SkillName} skill increases by {increase}%.</p>",
                        origin.ConnectionId);
                }
            }
            else
            {
                //_writer.WriteLine(
                //    $"<p>You cannot cast this spell upon another.</p>",
                //    origin.ConnectionId);
            }
        }
예제 #52
0
 private MonsterType GetRandomMonsterType()
 => Dice.TryGetChance(EliteMonsterChance)
         ? MonsterType.Elite
         : MonsterType.Normal;
예제 #53
0
        protected virtual long CalculateGoldDrop(long value)
        {
            var randomKoef = Dice.GetRange(0.5, 1.5);

            return(Convert.ToInt64(value * randomKoef));
        }
예제 #54
0
 private Level GetRandomLevel()
 => new Level
 {
     Normal = Dice.GetRange(MonstersMinLevel, MonstersMaxLevel)
 };
예제 #55
0
 /// <summary>
 /// Converts <see cref="DiceExpressionSerialized"/> to <see cref="DiceExpression"/>.
 /// </summary>
 /// <returns/>
 public DiceExpression ToDiceExpression() => Dice.Parse(Expression);
예제 #56
0
파일: Star.cs 프로젝트: Neakas/ProjectSWN
        public static string SetColor(Dice ourDice, double effTemp)
        {
            if ((bool)!OptionCont.FantasyColors)
            {
                if (effTemp >= 33000)
                {
                    return("Blue");
                }
                if (effTemp >= 10000 && effTemp < 33000)
                {
                    return("Blue-White");
                }
                if (effTemp >= 7500 && effTemp < 10000)
                {
                    return("Whitish Blue");
                }
                if (effTemp >= 6000 && effTemp < 7500)
                {
                    return("White");
                }
                if (effTemp >= 5200 && effTemp < 6000)
                {
                    return("Yellow");
                }
                if (effTemp >= 4250 && effTemp < 5200)
                {
                    return("Yellowish Orange");
                }
                if (effTemp >= 3700 && effTemp < 4250)
                {
                    return("Orange");
                }
                if (effTemp >= 2000 && effTemp < 3700)
                {
                    return("Orangish Red");
                }
                if (effTemp >= 1300 && effTemp < 2000)
                {
                    return("Red");
                }
                if (effTemp >= 700 && effTemp < 1300)
                {
                    return("Purplish Red");
                }
                if (effTemp >= 100 && effTemp < 700)
                {
                    return("Brown");
                }
                if (effTemp < 100)
                {
                    return("Black");
                }
            }
            else
            {
                var roll = ourDice.Rng(100019);
                if (LibStarGen.Inbetween(roll, 0, 10))
                {
                    return("Black");
                }
                if (LibStarGen.Inbetween(roll, 11, 531))
                {
                    return("Green");
                }
                if (LibStarGen.Inbetween(roll, 532, 952))
                {
                    return("Yellow-Green");
                }
                if (LibStarGen.Inbetween(roll, 953, 6057))
                {
                    return("Red-Orange");
                }
                if (LibStarGen.Inbetween(roll, 6058, 6835))
                {
                    return("Blue");
                }
                if (LibStarGen.Inbetween(roll, 6836, 11940))
                {
                    return("Purple-Red");
                }
                if (LibStarGen.Inbetween(roll, 11941, 23948))
                {
                    return("Red");
                }
                if (LibStarGen.Inbetween(roll, 23949, 49960))
                {
                    return("Yellow");
                }
                if (LibStarGen.Inbetween(roll, 49961, 75972))
                {
                    return("Orange");
                }
                if (LibStarGen.Inbetween(roll, 75973, 87980))
                {
                    return("Yellow-Orange");
                }
                if (LibStarGen.Inbetween(roll, 87981, 93085))
                {
                    return("Blue-White");
                }
                if (LibStarGen.Inbetween(roll, 93086, 93763))
                {
                    return("White");
                }
                if (LibStarGen.Inbetween(roll, 93764, 98868))
                {
                    return("White-Blue");
                }
                if (LibStarGen.Inbetween(roll, 98869, 99289))
                {
                    return("Green-Blue");
                }
                if (LibStarGen.Inbetween(roll, 99290, 99710))
                {
                    return("Blue-Violet");
                }
                if (LibStarGen.Inbetween(roll, 99711, 100019))
                {
                    return("Purple");
                }
            }

            return("ERROR");
        }
예제 #57
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="spell"></param>
        /// <param name="origin"></param>
        /// <param name="target"></param>
        /// <param name="room"></param>
        public void PerfromSkill(Model.Skill performSkill, string command, Player origin, string targetName = "", Room room = null)
        {
            if (!ValidStatus(origin))
            {
                return;
            }

            var FoundSkill = FindSkill(performSkill, command, origin);

            if (FoundSkill == null)
            {
                return;
            }

            //if (!ManaCheck(spell, origin))
            //{
            //    return;
            //}

            // saves



            if (AffectsCharacter(FoundSkill))
            {
                // check if affects a target
                // if target blank
                // error with to  kick whome?

                if (!AffectsSelf(FoundSkill) && (origin.Status & CharacterStatus.Status.Fighting) == 0 && (!string.IsNullOrEmpty(targetName) && targetName == command))
                {
                    _writer.WriteLine(FoundSkill.Name + " whom?");
                    return;
                }

                Player target = null;

                if (targetName == command)
                {
                    targetName = string.Empty;
                }
                target = _spellTargetCharacter.ReturnTarget(FoundSkill, targetName, room, origin);

                if (target == null)
                {
                    return;
                }
                var spellSkill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(FoundSkill.Id));
                //saving throw
                if (FoundSkill.Type == SkillType.Affect)
                {
                    var savingThrow = target.Attributes.Attribute[EffectLocation.Intelligence] / 2;

                    var rollForSave = _dice.Roll(1, 1, 100);

                    if (rollForSave <= savingThrow)
                    {
                        //save
                        // half spell affect duration


                        if (rollForSave == 1)
                        {
                            // fail
                            FoundSkill.Rounds = origin.Level / 2;
                        }

                        if (rollForSave != 1)
                        {
                            FoundSkill.Rounds = origin.Level / 4;
                        }
                    }
                }



                // spell lag
                // add lag property to player
                // lag == spell round
                // stops spell/skill spam
                // applies after spell is cast
                // is it needed?

                // hit / miss messages

                //  _writer.WriteLine(spell.SkillStart.ToPlayer);

                if (SkillSuccess(origin, target, FoundSkill))
                {
                    //if (spell.Type == SkillType.Damage)
                    //{

                    //    var savingThrow = origin.Attributes.Attribute[EffectLocation.Dexterity] / 2;

                    //    var rollForSave = _dice.Roll(1, 1, 100);

                    //    if (rollForSave <= savingThrow || rollForSave == 100)
                    //    {
                    //        if (rollForSave > 1)
                    //        {
                    //            damage /= 2;

                    //            _writer.WriteLine("You partly evade " + origin.Name + "'s " + spell.Name + " by jumping back.", target.ConnectionId);

                    //            _writer.WriteLine($"{target.Name} partly evades your " + spell.Name + " by jumping back.", origin.ConnectionId);

                    //            foreach (var pc in room.Players)
                    //            {
                    //                if (pc.ConnectionId.Equals(origin.ConnectionId) ||
                    //                    pc.ConnectionId.Equals(target.ConnectionId))
                    //                {
                    //                    continue;
                    //                }

                    //                _writer.WriteLine($"{target.Name} partly evades {origin.Name}'s " + spell.Name + " by jumping back.", pc.ConnectionId);
                    //            }
                    //        }
                    //    }
                    //}


                    var skillTarget = new SkillTarget
                    {
                        Origin = origin,
                        Target = target,
                        Room   = room,
                        Skill  = FoundSkill
                    };



                    if (string.IsNullOrEmpty(FoundSkill.Formula) && FoundSkill.Type == SkillType.Damage)
                    {
                        //do this for cast cure
                        _skillList.DoSkill(FoundSkill.Name, "", target, "", origin, room, false);
                    }



                    if (FoundSkill.Type != SkillType.Damage)
                    {
                        _skillList.DoSkill(FoundSkill.Name, "", target, "", origin, room, false);
                    }
                }
                else
                {
                    var skill = origin.Skills.FirstOrDefault(x => x.SkillId.Equals(FoundSkill.Id));

                    if (skill == null)
                    {
                        return;
                    }

                    if (skill.Proficiency == 95)
                    {
                        return;
                    }

                    var increase = new Dice().Roll(1, 1, 3);

                    skill.Proficiency += increase;

                    origin.Experience            += 100;
                    origin.ExperienceToNextLevel -= 100;

                    _updateClientUi.UpdateExp(origin);

                    _writer.WriteLine(
                        $"<p class='improve'>You learn from your mistakes and gain 100 experience points.</p>",
                        origin.ConnectionId);
                    _writer.WriteLine(
                        $"<p class='improve'>Your {skill.SkillName} skill increases by {increase}%.</p>",
                        origin.ConnectionId);
                }
            }
            else
            {
                if (FoundSkill.Name.Equals("Axe"))
                {
                    _writer.WriteLine(
                        $"<p>What!? I don't understand.</p>",
                        origin.ConnectionId);
                    return;
                }
                _writer.WriteLine(
                    $"<p>You cannot cast this spell upon another.</p>",
                    origin.ConnectionId);
            }
        }
예제 #58
0
    // Handler for generating the new numbers and the acquiring the new textures for the dice.

    public void startGenerator()
    {
        // Handles each state of the game seperatly, depending on what cycle is active.
        if (cycle.stateAna)
        {
            calc = GameObject.FindWithTag("Analyse").GetComponent <DiceCalculator>();
            for (int i = 0; i < GameObject.FindWithTag("AnalyseDice").transform.childCount; i++)
            {
                diceToRoll = GameObject.FindWithTag("AnalyseDice").transform.GetChild(i);
                dice.Add(diceToRoll);
                Dice TESTING = dice[i].gameObject.GetComponent <Dice>();
                int  roll    = randomGenerator();
                TESTING.numberChange(textures[roll - 1]);
            }
            calc.anaCalc(totalDiceRoll);
            totalDiceRoll = 0;
            dice.Clear();
        }
        if (cycle.stateDev)
        {
            for (int i = 0; i < GameObject.FindWithTag("DevDice").transform.childCount; i++)
            {
                diceToRoll = GameObject.FindWithTag("DevDice").transform.GetChild(i);
                dice.Add(diceToRoll);
                Dice TESTING = dice[i].gameObject.GetComponent <Dice>();
                int  roll    = randomGenerator();
                TESTING.numberChange(textures[roll - 1]);
            }
            calc.devCalc(totalDiceRoll);
            totalDiceRoll = 0;
            dice.Clear();
        }
        if (cycle.stateDeploy)
        {
            for (int i = 0; i < GameObject.FindWithTag("DeployDice").transform.childCount; i++)
            {
                diceToRoll = GameObject.FindWithTag("DeployDice").transform.GetChild(i);
                dice.Add(diceToRoll);
                Dice TESTING = dice[i].gameObject.GetComponent <Dice>();
                int  roll    = randomGenerator();
                TESTING.numberChange(textures[roll - 1]);
            }
            calc.deployCalc(totalDiceRoll);
            totalDiceRoll = 0;
            dice.Clear();
        }
        if (cycle.stateTest)
        {
            for (int i = 0; i < GameObject.FindWithTag("TestDice").transform.childCount; i++)
            {
                diceToRoll = GameObject.FindWithTag("TestDice").transform.GetChild(i);
                dice.Add(diceToRoll);
                Dice TESTING = dice[i].gameObject.GetComponent <Dice>();
                int  roll    = randomGenerator();
                TESTING.numberChange(textures[roll - 1]);
            }
            calc.testCalc(totalDiceRoll);
            totalDiceRoll = 0;
            dice.Clear();
        }

        toggleScript();
    }
 public void Setup()
 {
     _dice          = A.Fake <Dice>();
     _shrineFactory = new DefaultHealingHealingShrineFactory(_dice);
 }
예제 #60
0
        /// <summary>
        /// This has the cargo, people, etc. that want to travel from one location to another.
        /// </summary>
        /// <param name="worlds">The worlds.</param>
        /// <param name="random">The random.</param>
        /// <param name="illegalGoods">if set to <c>true</c> [illegal goods].</param>
        /// <param name="advancedCharacters">if set to <c>true</c> [advanced characters].</param>
        /// <returns></returns>
        async Task <ManifestCollection> BuildManifestsAsync(IReadOnlyList <World> worlds, Dice random, bool illegalGoods, bool advancedCharacters)
        {
            var result = new ManifestCollection();

            result.Origin = worlds[0];
            for (var i = 1; i < worlds.Count; i++)
            {
                if (!worlds[i].UWP.Contains("?")) //skip uncharted words
                {
                    result.Add(await BuildManifestAsync(result.Origin, worlds[i], random, illegalGoods, advancedCharacters).ConfigureAwait(false));
                }
            }
            return(result);
        }