Exemple #1
0
        // TODO: Consolidate with the code in TargetCreaturesInVolume_TargetCreaturesInVolumeRequest and the WhatSide parameter
        public static CharacterPositions GetAllCreaturesInVolume()
        {
            VectorDto          volumeCenter       = Targeting.TargetPoint.ToVectorDto();
            string             shapeName          = Targeting.ExpectedTargetDetails.Shape.ToString();
            CharacterPositions allTargetsInVolume = TaleSpireClient.GetAllCreaturesInVolume(volumeCenter, shapeName, Targeting.ExpectedTargetDetails.DimensionsFeet);

            return(allTargetsInVolume);
        }
Exemple #2
0
    static CharacterPositions CreateCharacterPositions(System.Func <bool, Vector3> startingPosGetter)
    {
        var c = new CharacterPositions();

        for (int i = 0; i < GlobalVariables.maxCombatantsOnTeam; i++)
        {
            var offset = GetIndexPositionOffset(i);
            c.meleePositions.Add(startingPosGetter(true) + offset);
            c.rangedPositions.Add(startingPosGetter(false) + offset);
        }
        return(c);
    }
        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);
            }
        }
Exemple #4
0
        private static void TargetCreaturesInVolume_TargetCreaturesInVolumeRequest(object sender, WhatSideEventArgs ea)
        {
            if (Targeting.ActualKind.HasFlag(TargetKind.Volume))
            {
                CharacterPositions characterPositions = TaleSpireClient.GetAllCreaturesInVolume(Targeting.TargetPoint.ToVectorDto(),
                                                                                                Targeting.ExpectedTargetDetails.Shape.ToString(), Targeting.ExpectedTargetDetails.DimensionsFeet,
                                                                                                ea.WhatSide.ToString());

                TaleSpireClient.CleanUpTargets();
                if (characterPositions != null)
                {
                    List <string> charactersToTarget = characterPositions.Characters.Select(x => x.ID).ToList();
                    TaleSpireClient.TargetCreatures(charactersToTarget);
                    TargetCreaturesByTaleSpireId(charactersToTarget);
                }
                CreatureManager.UpdateInGameStats();
            }
        }