コード例 #1
0
        public void Test_BasicAttack_AbilityScoreRangedWeaponCombinations(int strength, int constitution, int dexterity, int intelligence,
            RangedType type, WeaponHandedness handedness, WeaponWeight weight, int expectedAttackBonus, int expectedDamageDiceCount, 
            DiceType expectedDamageDiceType, int expectedDamageBonus, int expectedRange)
        {
            Character character;
            BasicAttack basicAttack;

            character = new Character(new int[] { strength, constitution, dexterity, intelligence },
                new NullOrigin(ScoreType.Wisdom), new NullOrigin(ScoreType.Charisma), ScoreType.Acrobatics);
            character.SetHeldItem(Hand.Main, new RangedWeapon(type, handedness, weight));
            character.Update();

            basicAttack = character.GetPowers().First(x => x is BasicAttack) as BasicAttack;
            Assert.That(basicAttack, !Is.Null, "Basic Attack is null");
            Assert.That(basicAttack.Attacks.Count, Is.EqualTo(1), "Incorrect number of Basic Attack attacks");
            Assert.That(basicAttack.Attacks[0].AttackBonus.Total, Is.EqualTo(expectedAttackBonus),
                string.Format("Incorrect Basic Attack attack bonus: {0}", basicAttack.Attacks[0].AttackBonus));
            Assert.That(basicAttack.Attacks[0].Damage.Dice, Is.EqualTo(new Dice(expectedDamageDiceCount, expectedDamageDiceType)),
                "Incorrect Basic Attack damage");
            Assert.That(basicAttack.Attacks[0].DamageBonus.Total, Is.EqualTo(expectedDamageBonus),
                string.Format("Incorrect Basic Attack damage bonus: {0}", basicAttack.Attacks[0].DamageBonus));
            Assert.That(basicAttack.AttackTypeAndRange.AttackType, Is.EqualTo(AttackType.Ranged),
                "Incorrect Basic Attack attack type");
            Assert.That(basicAttack.AttackTypeAndRange.Range, Is.EqualTo(expectedRange.ToString()),
                "Incorrect Basic Attack range");
        }
コード例 #2
0
ファイル: Dice.cs プロジェクト: arturcp/Samjokgo
 public static int Throw(DiceType diceType)
 {
     /*byte[] array = new byte[1];
     System.Security.Cryptography.RandomNumberGenerator.Create().GetNonZeroBytes(array);
     return (array[0] % (int)diceType) + 1;*/
     return randomClass.Next(1,(int)diceType + 1);
 }
コード例 #3
0
ファイル: Dice.cs プロジェクト: kamiya-tips/DND4
	public static int Roll (int number, DiceType type, int modify)
	{
		int result = modify;
		for (int i = 0; i < number; i++) {
			result += Dice.Roll ((int)type);
		}
		return result;
	}
コード例 #4
0
        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");
        }
コード例 #5
0
ファイル: Randomizer.Misc.cs プロジェクト: NotYours180/Fluky
        /// <summary>
        /// Return a value equal to the roll of a die.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public int Dice(DiceType? type = null)
        {
            var diceTypes = EnumExtensions.GetEnumValues<DiceType>().ToList();
              type = type.HasValue ? type.Value : Pick(diceTypes);

              var max = (int)type.Value;

              return Natural(1, max);
        }
コード例 #6
0
        public void Game_can_be_started_with_normal_dice_or_crooked_dice(DiceType diceType)
        {
            var gameSetting = new GameSetting
            {
                BoardSetting = new BoardSetting {
                    Min = 1, Max = 100
                },
                MaxPlayersAllowed = 1,
                MinPlayersNeeded  = 1,
                TotalTurns        = 1
            };

            var dice = new DiceFactory().Create(diceType);

            var player = new Player {
                Id = "p123"
            };
            int playerOriginalPosition = player.CurrentPosition;

            var playerProgressListnerMock = new Mock <IPlayerProgressListener>();

            playerProgressListnerMock.Setup(x => x.OnPlayed(It.IsAny <PlayerMoveResult>()))
            .Callback((PlayerMoveResult playerResult) =>
            {
                playerResult.Should().NotBeNull();
                playerResult.NewPosition.Should().BeGreaterThan(playerOriginalPosition);
                playerResult.Status.Should().Be(MoveStatus.Moved);
            });

            var endGameListnerMock = new Mock <IEndGameListener>();

            endGameListnerMock.Setup(x => x.OnEndGame(It.IsAny <GameResult>()))
            .Callback((GameResult gameResult) =>
            {
                var playerResult = gameResult.PlayerResults.FirstOrDefault(x => x.Key.Equals(player));
                playerResult.Should().NotBeNull();
                playerResult.Value.NewPosition.Should().BeGreaterThan(playerOriginalPosition);
                playerResult.Value.Status.Should().Be(MoveStatus.Moved);
            });

            var game = new Game(dice, gameSetting, endGameListnerMock.Object);

            game.AddPlayer(player);
            game.RegisterPlayerProgressListener(playerProgressListnerMock.Object);

            game.Start();

            endGameListnerMock.Setup(x => x.OnEndGame(It.IsAny <GameResult>()))
            .Callback((GameResult gameResult) =>
            {
                var playerResult = gameResult.PlayerResults.FirstOrDefault(x => x.Key.Equals(player));
                playerResult.Value.Status.Should().Be(MoveStatus.Stopped);
            });
            game.Stop();
        }
コード例 #7
0
 private void ShowDice(IList <int> results, DiceType dice)
 {
     this.DiceResults.Controls.Clear();
     foreach (var die in results)
     {
         var face = new DiceFace();
         face.Height = face.Width = this.DiceResults.Height > 200 ? 200 : this.DiceResults.Height - 10;
         face.SetNumber(dice, die);
         this.DiceResults.Controls.Add(face);
     }
 }
コード例 #8
0
ファイル: DiceRoll.cs プロジェクト: Mcfli/Moai
		// INIT
		private void init(int size, DiceType type, ref NPack.MersenneTwister _rand)
		{
			_result = new int[size];
			_dice_type = type;
			_size = size;
			
			for (int i = 0; i < _size; i++) {
				// Cast enum to int to get the value
				_result[i] = _rand.Next( 1, (int) type);
			}
		}
コード例 #9
0
ファイル: Dice.cs プロジェクト: christiantusborg/DiceHandler
        public List<int> Roll(DiceType diceType, int numberOfDice)
        {
            List<int> listOfRolls = new List<int>();

            for (int i = 1; i < numberOfDice; i++)
            {
                listOfRolls.Add(Roll(diceType));
            }

            return listOfRolls;
        }
コード例 #10
0
        private static IDiceComparer GetComparer(DiceType diceType)
        {
            var diceComparerLookup = new Dictionary <DiceType, IDiceComparer>()
            {
                { DiceType.SameColor, new SameColorDiceComparer() },
                { DiceType.NoPoints, new NoPointsDiceComparer() },
                { DiceType.NormalPoints, new NormalPointsDiceComparer() }
            };

            return(diceComparerLookup[diceType]);
        }
コード例 #11
0
        public void Dice_ShouldBeInRange_OfSpecifiedType(DiceType type, int expectedMin, int expectedMax)
        {
            // Arrange

            // Act
            var result = _sut.Dice(type);

            // Assert
            Assert.IsNotNull(result);
            result.ShouldBeInRange(expectedMin, expectedMax);
        }
コード例 #12
0
        public void Dice_ShouldBeInRange_OfSpecifiedType(DiceType type, int expectedMin, int expectedMax)
        {
            // Arrange

              // Act
              var result = _sut.Dice(type);

              // Assert
              Assert.IsNotNull(result);
              result.ShouldBeInRange(expectedMin, expectedMax);
        }
コード例 #13
0
        // INIT
        private void init(int size, DiceType type, ref NPack.MersenneTwister _rand)
        {
            _result    = new int[size];
            _dice_type = type;
            _size      = size;

            for (int i = 0; i < _size; i++)
            {
                // Cast enum to int to get the value
                _result[i] = _rand.Next(1, (int)type);
            }
        }
コード例 #14
0
        public static DiceType IntToDiceType(int index)
        {
            DiceType diceType = DiceType.Zero;

            switch (index)
            {
            case 0:
                diceType = DiceType.Zero;
                break;

            case 1:
                diceType = DiceType.One;
                break;

            case 2:
                diceType = DiceType.D2;
                break;

            case 3:
                diceType = DiceType.D3;
                break;

            case 4:
                diceType = DiceType.D4;
                break;

            case 5:
                diceType = DiceType.D6;
                break;

            case 6:
                diceType = DiceType.D8;
                break;

            case 7:
                diceType = DiceType.D10;
                break;

            case 8:
                diceType = DiceType.D12;
                break;

            case 9:
                diceType = DiceType.D20;
                break;

            case 10:
                diceType = DiceType.D100;
                break;
            }
            return(diceType);
        }
コード例 #15
0
 /*************************************************************/
 /*                       Functionality                       */
 /*************************************************************/
 #region Methods
 #region Constructors
 // --------------------
 /// <summary>
 ///     Constructor for a dice object
 /// </summary>
 ///
 /// <param name="initialFaceValue">
 ///     Optional face value of the new dice
 /// </param>
 ///
 /// <param name="initialStatus">
 ///     Optional status of the new dice of type
 ///     "enum DiceStatus"
 /// </param>
 ///
 /// <exception cref="ArgumentOutOfRangeException">
 ///     Thrown when trying to set the dice value outside the
 ///     valid range of dice face values.
 /// </exception>
 ///
 /// <returns>
 ///     Nothing. This is a constructor.
 /// </returns>
 public Dice(
     int initialFaceValue                   = MIN_FACE_VALUE,
     DiceType initialType                   = DiceType.Rollable,
     Image initialImage                     = null,
     Availability initialAvailability       = Availability.Available,
     UpdateImageSource initialImageModifier = null)
 {
     this.faceValue      = initialFaceValue;
     this.type           = initialType;
     this.imageControl   = initialImage;
     this.availability   = initialAvailability;
     updateImageDelegate = initialImageModifier;
 }
コード例 #16
0
        public static int Roll(int numberOfDice, DiceType type)
        {
            int TotalRolled = 0;

            for (int i = 0; i < numberOfDice; i++)
            {
                //this generates a randomly seeded random number generator - avoids duplicate random numbers
                Random rnd = new Random(Guid.NewGuid().GetHashCode());
                //add 1 as random will generate a number between 0 and 1 less than the max
                TotalRolled += rnd.Next((int)type) + 1;
            }
            return(TotalRolled);
        }
コード例 #17
0
    public static string GetDiceValueString(int diceCount, DiceType type, int bonus = 0)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append(diceCount);
        sb.Append(type.ToString());
        if (bonus != 0)
        {
            sb.Append(GetSignedValueString(bonus, true));
        }

        return(sb.ToString());
    }
コード例 #18
0
        public Dice Create(DiceType diceType)
        {
            switch (diceType)
            {
            case DiceType.Random:
                return(new RandomDice());

            case DiceType.RandomCrooked:
                return(new RandomCrookedDice());
            }

            throw new NotSupportedException($"{diceType.ToString()} is not a supported device");
        }
コード例 #19
0
    public override void OnRollEnd(int number, DiceType type, Poring poring = null)
    {
        stepWalking = number;

        state = DokaponGameState.plan;
        SetCamera(CameraType.TopDown);

        panelStepRemain.SetActive(true);
        ParseMovableNode();
        DisplayNodeHeat();

        bgm.ChangeVolume(0.5f);
    }
コード例 #20
0
            static bool Prefix(ref int __result, int rolls, DiceType dice)
            {
                switch (dice)
                {
                case DiceType.Zero:
                    __result = 0;
                    break;

                case DiceType.One:
                    __result = 1;
                    break;

                case DiceType.D2:
                    __result = BucketWrapper.D2.Result(rolls);
                    break;

                case DiceType.D3:
                    __result = BucketWrapper.D3.Result(rolls);
                    break;

                case DiceType.D4:
                    __result = BucketWrapper.D4.Result(rolls);
                    break;

                case DiceType.D6:
                    __result = BucketWrapper.D6.Result(rolls);
                    break;

                case DiceType.D8:
                    __result = BucketWrapper.D8.Result(rolls);
                    break;

                case DiceType.D10:
                    __result = BucketWrapper.D10.Result(rolls);
                    break;

                case DiceType.D12:
                    __result = BucketWrapper.D12.Result(rolls);
                    break;

                case DiceType.D20:
                    __result = BucketWrapper.D20.Result(rolls);
                    break;

                case DiceType.D100:
                    __result = BucketWrapper.D100.Result(rolls);
                    break;
                }
                //Main.Mod.Debug(__result);
                return(false);
            }
コード例 #21
0
        public static bool IsDiceAviliable(this Player player, DiceType diceType)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            if (!Enum.IsDefined(typeof(DiceType), diceType))
            {
                throw new ArgumentOutOfRangeException(nameof(diceType), "Value should be defined in the DiceType enum.");
            }

            //todo:
            return(player.DiceList.ContainsKey(diceType) && player.DiceList [diceType] != 0);
        }
コード例 #22
0
ファイル: ObjectPoolManager.cs プロジェクト: chanmob/Dice
    public Dice GetDice(DiceType diceType)
    {
        Dice dice = null;

        switch (diceType)
        {
        case DiceType.Red:
            if (_stack_RedDice.Count == 0)
            {
                MakeDice(DiceType.Red, 1);
            }
            dice = _stack_RedDice.Pop();
            break;

        case DiceType.Blue:
            if (_stack_BlueDice.Count == 0)
            {
                MakeDice(DiceType.Blue, 1);
            }
            dice = _stack_BlueDice.Pop();
            break;

        case DiceType.Green:
            if (_stack_GreenDice.Count == 0)
            {
                MakeDice(DiceType.Green, 1);
            }
            dice = _stack_GreenDice.Pop();
            break;

        case DiceType.Purple:
            if (_stack_PurpleDice.Count == 0)
            {
                MakeDice(DiceType.Purple, 1);
            }
            dice = _stack_PurpleDice.Pop();
            break;

        case DiceType.Yellow:
            if (_stack_YellowDice.Count == 0)
            {
                MakeDice(DiceType.Yellow, 1);
            }
            dice = _stack_YellowDice.Pop();
            break;
        }

        return(dice);
    }
コード例 #23
0
ファイル: DiceWithValue.cs プロジェクト: GDxU/Richman4L
        public DiceWithValue(DiceType diceType, int value)
        {
            if (!Enum.IsDefined(typeof(DiceType), diceType))
            {
                throw new ArgumentOutOfRangeException(nameof(diceType), "Value should be defined in the DiceType enum.");
            }
            if (value <= 0 ||
                value > ( int )diceType)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }

            DiceType = diceType;
            Value    = value;
        }
コード例 #24
0
    /// <summary>
    /// 请求大富翁掷色子
    /// </summary>
    /// <param name="diceType"></param>
    /// <param name="callBack"></param>
    public static void NotifyServerDice(DiceType diceType, Action <SCDiceResult> callBack)
    {
        CSDice cSDice = new CSDice();

        cSDice.Dice = diceType;
        ProtocalManager.Instance().SendCSDice(cSDice, (SCDiceResult sCDiceResult) =>
        {
            Debug.Log("请求大富翁掷色子成功!");
            callBack?.Invoke(sCDiceResult);
        },
                                              (ErrorInfo er) =>
        {
            Debug.Log("请求大富翁掷色子失败!err:" + er.ErrorMessage);
            callBack?.Invoke(null);
        });
    }
コード例 #25
0
        private static IComparer <Dice> GetComparer(DiceType type)
        {
            switch (type)
            {
            case DiceType.OneColor:
                //1 > 4 > 6 > 5 > 3 > 2
                return(new OneColorComparer());

            case DiceType.NormalPoints:
                return(new NormalPointsComparer());

            case DiceType.NoPoints:
                return(new NoPointsComparer());
            }
            return(null);
        }
コード例 #26
0
        /// <summary>
        /// Click handler for the Roll button for basic dice definition.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">event args</param>
        private void RollButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            // first clear any expression in the dice service
            this.diceService.Clear();

            // setup the dice expression
            DiceType diceType = (DiceType)this.DiceTypeCombobox.SelectedItem;

            this.diceService.Dice(diceType.DiceSides, (int)this.DiceNumberNumeric.Value);
            this.diceService.Constant((int)this.DiceModifierNumeric.Value);

            // roll the dice and save the results
            DiceResult result = this.diceService.Roll(this.dieRoller);

            this.DiceRollResults.Insert(0, result);
        }
コード例 #27
0
    public static DiceType SearchDiceType(string diceTypeName)
    {
        DiceType returnDiceType = null;

        GameObject diceTypeManager = GameObject.Find("DiceTypeManager");

        foreach (DiceType dT in diceTypeManager.GetComponents <DiceType>())
        {
            if (dT.GetName().Contains(diceTypeName))
            {
                returnDiceType = dT;
            }
        }

        return(returnDiceType);
    }
コード例 #28
0
ファイル: DiceService.cs プロジェクト: Rodry37/FerchuBot
        public async Task <int> RollTheDice(int times, DiceType diceType, int modifier)
        {
            int amount = 0;

            if (times == 0)
            {
                return(amount);
            }

            for (int i = 0; i < times; i++)
            {
                amount += randomGenerator.Next((int)diceType);
            }

            return(await Task.FromResult(amount + modifier));
        }
コード例 #29
0
    public void ChangeDice(string diceType)
    {
        DiceType myDiceType = DiceManager.SearchDiceType(diceType);

        if (myDiceType != null)
        {
            this.gameObject.SetActive(true);
            this.GetComponent <Animator>().runtimeAnimatorController = myDiceType.GetAnimationController();
            m_OnDiceStopped  = myDiceType.GetOnStoppedEvent();
            m_OnAttack       = myDiceType.GetOnAttackEvent();
            m_OnStatusEffect = myDiceType.GetOnStatusEvent();
        }
        else
        {
            this.gameObject.SetActive(false);
        }
    }
コード例 #30
0
        public DiceRollView Create(DiceType diceType, int index)
        {
            switch (diceType)
            {
            case DiceType.D3:
                return(_diceRollD3.Create(index));

            case DiceType.D6:
                return(_diceRollD6.Create(index));

            case DiceType.D8:
                return(_diceRollD8.Create(index));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #31
0
        public static int Roll(int totalDice, DiceType diceType)
        {
            int result = 0;

            switch (diceType)
            {
            case DiceType.D4:
                result = Roll(totalDice, 4);
                break;

            case DiceType.D6:
                result = Roll(totalDice, 6);
                break;

            case DiceType.D8:
                result = Roll(totalDice, 8);
                break;

            case DiceType.D10:
                result = Roll(totalDice, 10);
                break;

            case DiceType.D12:
                result = Roll(totalDice, 12);
                break;

            case DiceType.D20:
                result = Roll(totalDice, 20);
                break;

            case DiceType.D24:
                result = Roll(totalDice, 24);
                break;

            case DiceType.D30:
                result = Roll(totalDice, 30);
                break;

            default:
                result = Roll(totalDice, 6);
                break;
            }

            return(result);
        }
コード例 #32
0
ファイル: Helper.cs プロジェクト: lucianposton/KingmakerFumi
        /// <summary>AbilityRankType is only relevant for ContextValueType.Rank</summary>
        public static ContextDiceValue CreateContextDiceValue(DiceType Dx, ContextValueType diceType = ContextValueType.Simple, AbilityRankType diceRank = AbilityRankType.Default, int diceValue = 0, ContextValueType bonusType = ContextValueType.Simple, AbilityRankType bonusRank = AbilityRankType.Default, int bonusValue = 0)
        {
            var result = new ContextDiceValue();

            result.DiceType = Dx;

            result.DiceCountValue           = new ContextValue();
            result.DiceCountValue.ValueType = diceType;
            result.DiceCountValue.ValueRank = diceRank;
            result.DiceCountValue.Value     = diceValue;

            result.BonusValue           = new ContextValue();
            result.BonusValue.ValueType = bonusType;
            result.BonusValue.ValueRank = bonusRank;
            result.BonusValue.Value     = bonusValue;

            return(result);
        }
コード例 #33
0
        public virtual void TestAttackPower(Type type, int attack, int attackBonus, int damageDiceCount, DiceType damageDiceType, int damageBonus, string additionalText)
        {
            AttackPower attackPower;

            attackPower = Character.GetPowers().Where(x => (x.GetType() == type)).First() as AttackPower;
            Assert.NotNull(attackPower, "Attack power not found");
            Assert.GreaterOrEqual(attack, 0, "Attack index is negative");
            Assert.Less(attack, attackPower.Attacks.Count, "Attack index is greater than the number of the power's attacks");

            Assert.AreEqual(attackBonus, attackPower.Attacks[attack].AttackBonus.Total, "Attack bonuses differ");
            if (damageDiceCount > 0)
            {
                Assert.AreEqual(damageDiceCount, attackPower.Attacks[attack].Damage.Dice.Number, "Damage dice count differs");
                Assert.AreEqual(damageDiceType, attackPower.Attacks[attack].Damage.Dice.DiceType, "Damage dice type differs");
                Assert.AreEqual(damageBonus, attackPower.Attacks[attack].DamageBonus.Total, "Damage differs");
            }
            Assert.AreEqual(additionalText, attackPower.Attacks[attack].AdditionalText, "Additional text differs");
        }
コード例 #34
0
ファイル: Character.cs プロジェクト: sai-maple/Arianrhod
        public void AddDice(DiceType diceType)
        {
            switch (diceType)
            {
            case DiceType.D3:
                _d3.Value++;
                break;

            case DiceType.D6:
                _d6.Value++;
                break;

            case DiceType.D8:
                _d8.Value++;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #35
0
    private void FreezeOnRoll(int num)
    {
        Dice.LastDiceClicked().GetComponent <Animator>().enabled = false;

        DiceType myDiceType = DiceManager.SearchDiceType("Poison");

        List <Sprite> freezeSprites = myDiceType.GetFreezeSprites();

        Sprite freezeSprite = null;

        foreach (Sprite s in freezeSprites)
        {
            if (s.name.Contains(num.ToString()))
            {
                freezeSprite = s;
            }
        }

        Dice.LastDiceClicked().GetComponent <Image>().sprite = freezeSprite;
    }
コード例 #36
0
    public void SetAnimations(DiceType diceType, Animations.EditAnimationSet animationSet)
    {
        if (animationSet.animations == null)
        {
            animationSet.animations = new List <Animations.EditAnimation>();
        }
        if (animationSet.animations.Count == 0)
        {
            animationSet.animations.Add(new Animations.EditAnimation());
        }

        // Drop current animation
        _animIndex = -1;

        // Store animation set
        DiceType      = diceType;
        _animationSet = animationSet;

        RefreshNames();
        ShowAnimation(0);
    }
コード例 #37
0
    public int GetSynergyCount(DiceType type)
    {
        switch (type)
        {
        case DiceType.Red:
            return(_redSynergy.Count);

        case DiceType.Blue:
            return(_blueSynergy.Count);

        case DiceType.Green:
            return(_greenSynergy.Count);

        case DiceType.Purple:
            return(_purpleSynergy.Count);

        case DiceType.Yellow:
            return(_yellowSynergy.Count);
        }

        return(0);
    }
コード例 #38
0
    /// <summary>
    /// 当前选中的骰子的下标
    /// </summary>
    /// <param name="index"></param>
    private void CurSelectDice(int index)
    {
        switch (index)
        {
        case 0:
            _selectDiceType = DiceType.LowDice;
            break;

        case 1:
            _selectDiceType = DiceType.PureDice;
            break;

        case 2:
            _selectDiceType = DiceType.HighDice;
            break;

        default:
            _selectDiceType = DiceType.PureDice;
            break;
        }
        Debug.Log("当前选中的骰子的下标 index = " + index);
    }
コード例 #39
0
ファイル: Dice.cs プロジェクト: chanmob/Dice
    public void Collabo()
    {
        StopAttackCoroutine();

        lv++;

        damage      = (int)((Mathf.Pow(lv, 2) * 2) + 1);
        attackSpeed = _attackSpeed - lv * 0.1f;

        int randomType = Random.Range(0, (int)DiceType.None);

        diceType = (DiceType)randomType;

        Color c;

        if (ColorUtility.TryParseHtmlString(InGameManager.instance.DiceColorHexCode[randomType], out c) == false)
        {
            return;
        }

        _diceColor.color = c;

        int len = _diceLv.Length;

        for (int i = 0; i < len; i++)
        {
            _diceLv[i].SetActive(false);
        }

        SpriteRenderer[] srs = _diceLv[lv].GetComponentsInChildren <SpriteRenderer>();
        int srLen            = srs.Length;

        for (int i = 0; i < srLen; i++)
        {
            srs[i].color = c;
        }

        _diceLv[lv].SetActive(true);
    }
コード例 #40
0
ファイル: Dice.cs プロジェクト: kamiya-tips/DND4
	public static int Roll (DiceType type)
	{
		return Dice.Roll (1, type, 0);
	}
コード例 #41
0
ファイル: Dice.cs プロジェクト: kamiya-tips/DND4
	public static int Roll (int number, DiceType type)
	{
		return Dice.Roll (number, type, 0);
	}
コード例 #42
0
 public override void TestAttackPower(Type type, int attack, int attackBonus, int damageDiceCount, DiceType damageDiceType, int damageBonus, string additionalText)
 {
     base.TestAttackPower(type, attack, attackBonus, damageDiceCount, damageDiceType, damageBonus, additionalText);
 }
コード例 #43
0
ファイル: Dice.cs プロジェクト: kamiya-tips/DND4
	public static int Roll (DiceType type, int modify)
	{
		return Dice.Roll (1, type, modify);
	}
コード例 #44
0
ファイル: Mechanics.cs プロジェクト: Sharparam/DiseasedToast
 public static int RollDice(DiceType dice)
 {
     return Rand.Next(0, (int) dice) + 1;
 }
コード例 #45
0
 public void TestExpectedDamageDice(RangedType rangedType, WeaponHandedness handedness, WeaponWeight weight, int expectedNumber, DiceType expectedDiceType)
 {
     Assert.That(new RangedWeapon(rangedType, handedness, weight).Damage, Is.EqualTo(new Dice(expectedNumber, expectedDiceType)));
 }
コード例 #46
0
ファイル: Dice.cs プロジェクト: christiantusborg/DiceHandler
 public int Roll(DiceType diceType)
 {
     return Random((byte) diceType);
 }
コード例 #47
0
ファイル: DiceRoll.cs プロジェクト: Mcfli/Moai
		// CONSTRUCTOR
		public DiceRoll(int size, DiceType type, ref NPack.MersenneTwister _rand)
		{
			if (size < 1) throw new ArgumentOutOfRangeException ("Number of dices shlud be > 0");
			init(size,type,ref _rand);
		}
コード例 #48
0
ファイル: Helpers.cs プロジェクト: Vintharas/WP7projects
 /// <summary>
 /// Get a dice throw
 /// </summary>
 /// <param name="dice"></param>
 /// <returns></returns>
 public static short GetRandomNumber(DiceType dice)
 {
     return (short) rnd.Next(1, (int) dice + 1);
 }