예제 #1
0
        static string GetDieTextColor(Creature targetCreature, string dieBackColor)
        {
            if (targetCreature is Character player)
            {
                return(player.dieFontColor);
            }
            InGameCreature inGameCreature = AllInGameCreatures.GetByCreature(targetCreature);

            if (inGameCreature != null)
            {
                return(inGameCreature.ForegroundHex);
            }
            return(DndViewer.GetDieTextColor(dieBackColor));
        }
예제 #2
0
        static string GetDieBackColor(Creature targetCreature)
        {
            if (targetCreature is Character player)
            {
                return(player.dieBackColor);
            }
            InGameCreature inGameCreature = AllInGameCreatures.GetByCreature(targetCreature);

            if (inGameCreature != null)
            {
                return(inGameCreature.BackgroundHex);
            }
            return("#ffffff");
        }
예제 #3
0
        private static void SavingThrowForTargetsRequested(object sender, SavingThrowRollEventArgs ea)
        {
            // TODO: Get all the targets.
            if (Targeting.ActualKind.HasFlag(TargetKind.Volume))
            {
                CharacterPositions allTargetsInVolume = TargetManager.GetAllCreaturesInVolume();
                if (allTargetsInVolume == null)
                {
                    return;
                }

                DiceRoll diceRoll = new DiceRoll(DiceRollType.SavingThrow, VantageKind.Normal, ea.DamageDieStr);
                diceRoll.SavingThrow = ea.Ability;

                diceRoll.SuppressLegacyRoll = true;
                diceRoll.Conditions         = ea.Condition;
                if (ea.CastedSpell?.SpellCaster is Character spellCaster)
                {
                    diceRoll.HiddenThreshold = spellCaster.SpellSaveDC;
                }

                foreach (CharacterPosition characterPosition in allTargetsInVolume.Characters)
                {
                    Creature creature = CreatureManager.GetCreatureFromTaleSpireId(characterPosition.ID);
                    DiceDto  diceDto  = null;
                    if (creature is Character player)
                    {
                        diceDto = DiceDto.AddD20ForCharacter(player, $"{player.Name}'s Save", player.GetSavingThrowModifier(ea.Ability), DieCountsAs.savingThrow);
                    }
                    else
                    {
                        InGameCreature inGameCreature = AllInGameCreatures.GetByCreature(creature);
                        if (inGameCreature != null)
                        {
                            diceDto = DiceDto.D20FromInGameCreature(inGameCreature, DiceRollType.SavingThrow, diceRoll.SavingThrow);
                        }
                    }
                    if (diceDto == null)
                    {
                        continue;
                    }

                    diceRoll.DiceDtos.Add(diceDto);
                    diceRoll.SpellID = ea.CastedSpell.ID;                        // Add ea.SpellGuid so we can undo the effect after the spell dispels.
                }
                SeriouslyRollTheDice(diceRoll);
            }
        }