Ejemplo n.º 1
0
        private static void PrepareForSavingThrow(DiceRoll diceRoll, int dieOwnerId, string rollData, ref string dieBackColorOverride,
                                                  ref string dieTextColorOverride, ref double modifier, ref string diePlayerName,
                                                  ref double scaleOverride, ref int dieOwnerOverride)
        {
            Ability savingThrowAbility = DndUtils.ToAbility(rollData);

            if (savingThrowAbility == Ability.none)
            {
                return;
            }

            // We have a saving throw!
            Creature targetCreature = DndUtils.GetCreatureById(dieOwnerId);

            if (targetCreature == null)
            {
                return;
            }
            dieOwnerOverride = dieOwnerId;

            diePlayerName = targetCreature.Name;
            if (scaleOverride > 1)
            {
                scaleOverride = 1;                 // Player dice are always thrown at no more than 100% scale.
            }
            modifier                 = targetCreature.GetSavingThrowModifier(savingThrowAbility);
            dieBackColorOverride     = GetDieBackColor(targetCreature);
            dieTextColorOverride     = GetDieTextColor(targetCreature, dieBackColorOverride);
            diceRoll.SavingThrow     = savingThrowAbility;
            diceRoll.Type            = DiceRollType.DamagePlusSavingThrow;
            diceRoll.HiddenThreshold = INT_ViewerSpellCasterDC;
            diceRoll.TrailingEffects.Clear();              // No viewer trailing effects on saving throws.
            diceRoll.DieTotalMessage = "";
        }
        public bool Matches(string message)
        {
            testAllPlayers = false;
            Match match = Regex.Match(message, @"^sv\s+(\w+)" + PlayerSpecifier);

            if (match.Success)
            {
                SetTargetPlayer(match.Groups);
                abilityToTest = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.none);
            }
            match = Regex.Match(message, @"^svs\s+(\w+)$");
            if (match.Success)
            {
                testSelectedPlayers = true;
                abilityToTest       = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.none);
            }
            match = Regex.Match(message, @"^sva\s+(\w+)$");
            if (match.Success)
            {
                testAllPlayers = true;
                abilityToTest  = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.none);
            }
            return(false);
        }
Ejemplo n.º 3
0
 public void TestStringToAbilityConversion()
 {
     Assert.AreEqual(Ability.dexterity | Ability.intelligence, DndUtils.ToAbility("dexterity,intelligence"));
     Assert.AreEqual(Ability.dexterity | Ability.intelligence, DndUtils.ToAbility("Intelligence,Dexterity"));
     Assert.AreEqual(Ability.charisma | Ability.constitution | Ability.dexterity | Ability.intelligence | Ability.strength, DndUtils.ToAbility("Charisma,  constitution ,Dexterity, Intelligence , Strength"));
     Assert.AreEqual(Ability.constitution, DndUtils.ToAbility("Constitution"));
     Assert.AreEqual(Ability.strength, DndUtils.ToAbility("strength"));
 }
        public bool Matches(string message)
        {
            Match match = Regex.Match(message, @"^sv\s+(\w+)$");

            if (match.Success)
            {
                abilityToTest = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.None);
            }
            return(false);
        }
Ejemplo n.º 5
0
        public bool Matches(string message)
        {
            testAllPlayers = false;
            Match match = Regex.Match(message, @"^sv\s+(\w+)$");

            if (match.Success)
            {
                abilityToTest = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.none);
            }
            match = Regex.Match(message, @"^sva\s+(\w+)$");
            if (match.Success)
            {
                testAllPlayers = true;
                abilityToTest  = DndUtils.ToAbility(match.Groups[1].Value);
                return(abilityToTest != Ability.none);
            }
            return(false);
        }
Ejemplo n.º 6
0
 Ability GetSpellCastingAbility()
 {
     return(DndUtils.ToAbility(statSpellcastingAbility.Text));
 }