Example #1
0
 private void SetupContentReaders(bool force = false)
 {
     if (reader == null || force)
     {
         // Ensure content readers available even when path not valid
         if (isPathValidated)
         {
             DaggerfallUnity.LogMessage(string.Format("Setting up content readers with arena2 path '{0}'.", Arena2Path));
             reader = new ContentReader(Arena2Path);
         }
         else
         {
             DaggerfallUnity.LogMessage(string.Format("Setting up content readers without arena2 path. Not all features will be available."));
             reader = new ContentReader(string.Empty);
         }
     }
 }
Example #2
0
        private bool ReadyCheck()
        {
            // Must have both world and sky cameras to draw
            if (!mainCamera || !myCamera)
            {
                return(false);
            }

            // Do nothing if DaggerfallUnity not ready
            if (!dfUnity.IsReady)
            {
                DaggerfallUnity.LogMessage("DaggerfallSky: DaggerfallUnity component is not ready. Have you set your Arena2 path?");
                return(false);
            }

            return(true);
        }
Example #3
0
        /// <summary>
        /// Updates enemy state based on current settings.
        /// Called automatially by SetEnemyType().
        /// This should be called after changing enemy state (e.g. from in code or in editor).
        /// </summary>
        private void ApplyEnemyState()
        {
            // Get state animations
            summary.StateAnims = GetStateAnims(summary.EnemyState);
            if (summary.StateAnims == null)
            {
                // Log error message
                DaggerfallUnity.LogMessage(string.Format("DaggerfalMobileUnit: Enemy does not have animation for {0} state. Defaulting to Idle state.", summary.EnemyState.ToString()), true);

                // Set back to idle (which every enemy has in one form or another)
                summary.EnemyState = MobileStates.Idle;
                summary.StateAnims = GetStateAnims(summary.EnemyState);
            }

            // Orient enemy relative to camera
            UpdateOrientation();
        }
Example #4
0
        private static bool GetSystemAndCultureInfo(StringBuilder builder)
        {
            if (builder == null)
            {
                DaggerfallUnity.LogMessage("Builder was null");
                builder = new StringBuilder();
            }


            try
            {
                CultureInfo currentCult = CultureInfo.CurrentCulture;

                var cultProps = typeof(CultureInfo).GetProperties();
                var envProps  = typeof(Environment).GetProperties();
                builder.AppendLine(string.Format("### Start Enviornment Info ###")).AppendLine(Environment.NewLine);

                foreach (var prop in envProps)
                {
                    var value = prop.GetValue(currentCult, null);
                    if (value.ToString() == Environment.UserName || value.ToString() == Environment.UserDomainName || prop.Name == "StackTrace")
                    {
                        continue;
                    }
                    DaggerfallUnity.LogMessage(string.Format("{0} | {1}", prop.Name, value));
                    builder.AppendLine(string.Format("{0} | {1} ", prop.Name, value)).AppendLine(Environment.NewLine);
                }

                builder.Append(string.Format("### Start Culture Info ###")).AppendLine(Environment.NewLine).AppendLine(Environment.NewLine);
                foreach (var prop in cultProps)
                {
                    DaggerfallUnity.LogMessage(string.Format("{0} | {1}", prop.Name, prop.GetValue(currentCult, null)));

                    builder.AppendLine(string.Format("{0} | {1}", prop.Name, prop.GetValue(currentCult, null))).AppendLine(Environment.NewLine);
                }

                builder.AppendLine(string.Format("### End Culture Properties ### ")).AppendLine(Environment.NewLine).AppendLine(Environment.NewLine);
            }
            catch (Exception ex)
            {
                DaggerfallUnity.LogMessage(ex.Message);
                builder.AppendLine(string.Format("!!! Error in GetSystemAndCultureInfo: {0} !!!", ex.Message)).AppendLine(Environment.NewLine);
                return(false);
            }
            return(true);
        }
Example #5
0
        public void __EditorFindLocation()
        {
            DFLocation location;

            if (!GameObjectHelper.FindMultiNameLocation(EditorFindLocationString, out location))
            {
                DaggerfallUnity.LogMessage(string.Format("Could not find location [Region={0}, Name={1}]", location.RegionName, location.Name), true);
                return;
            }

            int        longitude = (int)location.MapTableData.Longitude;
            int        latitude  = (int)location.MapTableData.Latitude;
            DFPosition pos       = MapsFile.LongitudeLatitudeToMapPixel(longitude, latitude);

            MapPixelX = pos.X;
            MapPixelY = pos.Y;
        }
        private bool ReadyCheck()
        {
            // Ensure we have a DaggerfallUnity reference
            if (dfUnity == null)
            {
                dfUnity = DaggerfallUnity.Instance;
            }

            // Do nothing if DaggerfallUnity not ready
            if (!dfUnity.IsReady)
            {
                DaggerfallUnity.LogMessage("DaggerfallDungeon: DaggerfallUnity component is not ready. Have you set your Arena2 path?");
                return(false);
            }

            return(true);
        }
        void ReadSettings()
        {
            // Attempt to load settings.ini
            bool   loadedUserSettings = false;
            string userIniPath        = Path.Combine(Application.dataPath, settingsIniName);

            if (File.Exists(userIniPath))
            {
                userIniData        = iniParser.ReadFile(userIniPath);
                loadedUserSettings = true;
            }

            // Load fallback.ini
            bool      loadedFallbackSettings = false;
            TextAsset asset = Resources.Load <TextAsset>(fallbackIniName);

            if (asset != null)
            {
                MemoryStream stream = new MemoryStream(asset.bytes);
                StreamReader reader = new StreamReader(stream);
                fallbackIniData = iniParser.ReadData(reader);
                reader.Close();
                usingFallback          = true;
                loadedFallbackSettings = true;
                //Create new settings.ini in data directory from fallback.ini if settings.ini not found
                if (!Application.isEditor && loadedFallbackSettings && !loadedUserSettings)
                {
                    File.WriteAllBytes(Path.Combine(Application.dataPath, settingsIniName), asset.bytes);
                }
            }

            // Report on primary ini file
            if (loadedUserSettings)
            {
                DaggerfallUnity.LogMessage("Using settings.ini.");
            }
            else if (!loadedUserSettings && loadedFallbackSettings)
            {
                DaggerfallUnity.LogMessage("Using fallback.ini");
            }
            else
            {
                DaggerfallUnity.LogMessage("Failed to load fallback.ini.");
            }
        }
        // Finds start and enter markers, should be called with true for starting block, otherwise false to just get water level and castle block data
        private void FindMarkers(DaggerfallRDBBlock dfBlock, ref DFLocation.DungeonBlock block, bool assign)
        {
            if (!dfBlock)
            {
                throw new Exception("DaggerfallDungeon: dfBlock cannot be null.");
            }

            if (dfBlock.StartMarkers != null && dfBlock.StartMarkers.Length > 0)
            {
                // There should only be one start marker per start block
                // This message will let us know if more than one is found
                if (dfBlock.StartMarkers.Length > 1)
                {
                    DaggerfallUnity.LogMessage("DaggerfallDungeon: Multiple 'Start' markers found. Using first marker.", true);
                }

                if (assign)
                {
                    startMarker = dfBlock.StartMarkers[0];
                }

                DaggerfallBillboard dfBillboard = dfBlock.StartMarkers[0].GetComponent <DaggerfallBillboard>();
                block.WaterLevel  = dfBillboard.Summary.WaterLevel;
                block.CastleBlock = dfBillboard.Summary.CastleBlock;
            }
            else // No water
            {
                block.WaterLevel = 10000;
            }

            if (dfBlock.EnterMarkers != null && dfBlock.EnterMarkers.Length > 0)
            {
                // There should only be one enter marker per start block
                // This message will let us know if more than one is found
                if (dfBlock.EnterMarkers.Length > 1)
                {
                    DaggerfallUnity.LogMessage("DaggerfallDungeon: Multiple 'Enter' markers found. Using first marker.", true);
                }

                if (assign)
                {
                    enterMarker = dfBlock.EnterMarkers[0];
                }
            }
        }
 void WriteSettings()
 {
     if (iniParser != null && !usingFallback)
     {
         try
         {
             string path = Path.Combine(Application.dataPath, settingsIniName);
             if (File.Exists(path))
             {
                 iniParser.WriteFile(path, userIniData);
             }
         }
         catch
         {
             DaggerfallUnity.LogMessage("Failed to write settings.ini.");
         }
     }
 }
Example #10
0
 void WriteSettingsFile()
 {
     if (iniParser != null)
     {
         try
         {
             string path = Path.Combine(PersistentDataPath, settingsIniName);
             if (File.Exists(path))
             {
                 iniParser.WriteFile(path, userIniData);
             }
         }
         catch
         {
             DaggerfallUnity.LogMessage("Failed to write settings.ini.");
         }
     }
 }
        /// <summary>
        /// Add a billboard to batch.
        /// </summary>
        public void AddItem(int record, Vector3 localPosition)
        {
            // Limit maximum billboards in batch
            if (billboardItems.Count + 1 > maxBillboardCount)
            {
                DaggerfallUnity.LogMessage("DaggerfallBillboardBatch: Maximum batch size reached.", true);
                return;
            }

            // Add new billboard to batch
            BillboardItem bi = new BillboardItem()
            {
                record   = record,
                position = origin + localPosition,
            };

            billboardItems.Add(bi);
        }
 /// <summary>
 /// Handles the input return event for action type 12
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="userInput"></param>
 public void UserInputHandler(DaggerfallInputMessageBox sender, string userInput)
 {
     if (type12_answers == null || type12_answers.Length == 0)
     {
         DaggerfallUnity.LogMessage(string.Format(("No answers to check for: {0} {1}"), this.gameObject.name, this.Index));
         return;
     }
     userInput = userInput.ToLower();
     for (int i = 0; i < type12_answers.Length; i++)
     {
         if (userInput == type12_answers[i].ToLower())
         {
             ActivateNext();
             return;
         }
     }
     //Debug.Log("no matching answer found for: " + userInput);
 }
Example #13
0
        private bool ReadyCheck()
        {
            if (isReady)
            {
                return(true);
            }

            if (dfUnity == null)
            {
                dfUnity = DaggerfallUnity.Instance;
            }

            if (LocalPlayerGPS == null)
            {
                return(false);
            }
            else
            {
                InitWorld(true);
            }

            // Do nothing if DaggerfallUnity not ready
            if (!dfUnity.IsReady)
            {
                DaggerfallUnity.LogMessage("StreamingWorld: DaggerfallUnity component is not ready. Have you set your Arena2 path?");
                return(false);
            }

            // Perform initial runtime setup
            if (Application.isPlaying)
            {
                // Fix coastal climate data
                TerrainHelper.DilateCoastalClimate(dfUnity.ContentReader, 2);

                // Smooth steep location on steep gradients
                TerrainHelper.SmoothLocationNeighbourhood(dfUnity.ContentReader);
            }

            // Raise ready flag
            isReady = true;
            RaiseOnReadyEvent();

            return(true);
        }
        /// <summary>
        /// 14
        /// Teleports player to next object position.
        /// </summary>
        public static void Teleport(GameObject triggerObj, DaggerfallAction thisAction)
        {
            if (thisAction.NextObject == null)
            {
                DaggerfallUnity.LogMessage(string.Format("Teleport next object null - can't teleport"), true);
                return;
            }

            GameObject   playerObject;
            PlayerEntity playerEntity;

            if (!GetPlayer(out playerObject, out playerEntity))
            {
                DaggerfallUnity.LogMessage("Failed to get Player or Player entity", true);
                return;
            }
            playerObject.transform.position = thisAction.NextObject.transform.position;
            playerObject.transform.rotation = thisAction.NextObject.transform.rotation;
        }
        /// <summary>
        /// 28
        /// Drains Magicka
        /// Only on models in vanilla daggerfall (usually on bottom of pits, drains magica while you walk around)
        /// </summary>
        /// <param name="playerObj"></param>
        /// <param name="thisAction"></param>
        public static void DrainMagicka(GameObject triggerObj, DaggerfallAction thisAction)
        {
            GameObject   playerObject;
            PlayerEntity playerEntity;

            if (!GetPlayer(out playerObject, out playerEntity))
            {
                DaggerfallUnity.LogMessage("Failed to get Player or Player entity", true);
                return;
            }
            if (thisAction.IsFlat)
            {
                playerEntity.DecreaseMagicka((int)Mathf.Max(1, thisAction.Magnitude));
            }
            else
            {
                playerEntity.DecreaseMagicka((int)Mathf.Max(1, thisAction.ActionAxisRawValue));
            }
        }
Example #16
0
        /// <summary>
        ///  Used by door actions (open / close / unlock), tries to get DaggerfallActionDoor from object
        ///  returns true if object is a valid action door, false if not
        /// </summary>
        public static bool GetDoor(GameObject go, out DaggerfallActionDoor door)
        {
            door = null;
            if (go == null)
            {
                return(false);
            }

            door = go.GetComponent <DaggerfallActionDoor>();
            if (door == null)
            {
                DaggerfallUnity.LogMessage(string.Format("No DaggerfallActionDoor component found to unlock door: {0}", go.name));
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #17
0
        bool SaveFontTextureAsset(string fontName, out Texture2D fontAtlas, out Rect[] fontRects)
        {
            string assetPath = Path.Combine(ResourcesPath, fontName);
            string filePath  = assetPath + ".png";

            // Get font atlas
            ImageProcessing.CreateFontAtlas(fntFile, BackgroundColor, TextColor, out fontAtlas, out fontRects);

            // Save atlas texture
            byte[] fontAtlasPNG = fontAtlas.EncodeToPNG();
            File.WriteAllBytes(filePath, fontAtlasPNG);

            // Loading back asset to modify importer properties
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            fontAtlas = Resources.Load <Texture2D>(fontName);
            string assetTexturePath = AssetDatabase.GetAssetPath(fontAtlas);

            // Modify asset importer properties
            TextureImporter importer = AssetImporter.GetAtPath(assetTexturePath) as TextureImporter;

            if (importer == null)
            {
                DaggerfallUnity.LogMessage("FontGeneratorWindow: Failed to get TextureImporter. Ensure your target folder is called 'Resources'.", true);
                return(false);
            }
            importer.textureType    = TextureImporterType.Image;
            importer.maxTextureSize = 256;
            importer.mipmapEnabled  = false;
            importer.isReadable     = false;
            importer.textureFormat  = TextureImporterFormat.ARGB32;
            importer.filterMode     = this.TextureFilterMode;

            // Reimport asset with new importer settings
            AssetDatabase.ImportAsset(assetTexturePath, ImportAssetOptions.ForceUpdate);

            // Finish up
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            return(true);
        }
        /// <summary>
        /// Add a billboard to batch.
        /// </summary>
        public void AddItem(int record, Vector3 localPosition)
        {
            // Cannot use with a custom material
            if (customMaterial != null)
            {
                throw new Exception("Cannot use with custom material. Use AddItem(Rect rect, Vector2 size, Vector2 scale, Vector3 localPosition) overload instead.");
            }

            // Must have set a material
            if (cachedMaterial.key == 0)
            {
                DaggerfallUnity.LogMessage("DaggerfallBillboardBatch: Must call SetMaterial() before adding items.", true);
                return;
            }

            // Limit maximum billboards in batch
            if (billboardItems.Count + 1 > maxBillboardCount)
            {
                DaggerfallUnity.LogMessage("DaggerfallBillboardBatch: Maximum batch size reached.", true);
                return;
            }

            // Get frame count and start frame
            int frameCount = cachedMaterial.atlasFrameCounts[record];
            int startFrame = 0;

            if (RandomStartFrame)
            {
                startFrame = UnityEngine.Random.Range(0, frameCount);
            }

            // Add new billboard to batch
            BillboardItem bi = new BillboardItem()
            {
                record       = record,
                position     = BlockOrigin + localPosition,
                totalFrames  = frameCount,
                currentFrame = startFrame,
            };

            billboardItems.Add(bi);
        }
        private void SetupContentReaders(bool force = false)
        {
            if (reader == null || force)
            {
                // Ensure content readers available even when path not valid
                if (isPathValidated)
                {
                    DaggerfallUnity.LogMessage(string.Format("Setting up content readers with arena2 path '{0}'.", Arena2Path));
                    reader = new ContentReader(Arena2Path);
                }
                else
                {
                    DaggerfallUnity.LogMessage(string.Format("Setting up content readers without arena2 path. Not all features will be available."));
                    reader = new ContentReader(string.Empty);
                }

                // Allow external code to set their own terrain sampler at start
                RaiseOnSetTerrainSamplerEvent();
            }
        }
        private bool ReadyCheck()
        {
            // Ensure we have a DaggerfallUnity reference
            if (dfUnity == null)
            {
                dfUnity = DaggerfallUnity.Instance;
            }

            // Do nothing if DaggerfallUnity not ready
            if (!dfUnity.IsReady)
            {
                DaggerfallUnity.LogMessage("DaggerfallBillboardBatch: DaggerfallUnity component is not ready. Have you set your Arena2 path?");
                return(false);
            }

            // Save references
            meshRenderer = GetComponent <MeshRenderer>();

            return(true);
        }
        private byte[] LoadSong(string filename)
        {
            // Get custom midi song
            if (SoundReplacement.CustomMidiSongExist(filename))
            {
                return(SoundReplacement.LoadCustomMidiSong(filename));
            }

            // Get Daggerfal song
            TextAsset asset = Resources.Load <TextAsset>(Path.Combine(SongFolder, filename));

            if (asset != null)
            {
                return(asset.bytes);
            }

            DaggerfallUnity.LogMessage(string.Format("DaggerfallSongPlayer: Song file '{0}' not found.", filename));

            return(null);
        }
        void Start()
        {
            dfUnity = DaggerfallUnity.Instance;

            // Check we have PlayerGPS
            if (!LocalPlayerGPS)
            {
                DaggerfallUnity.LogMessage("StreamingWorld: Missing PlayerGPS reference.", true);
                if (Application.isEditor)
                {
                    Debug.Break();
                }
                else
                {
                    Application.Quit();
                }
            }

            // Init world
            InitWorld(true);
        }
Example #23
0
        /// <summary>
        /// 18
        /// Opens (and unlocks if is locked) door
        /// </summary>
        public static void OpenDoor(GameObject prevObj, DaggerfallAction thisAction)
        {
            DaggerfallActionDoor door;

            if (!GetDoor(thisAction.gameObject, out door))
            {
                DaggerfallUnity.LogMessage(string.Format("No DaggerfallActionDoor component found"));
            }
            else
            {
                if (door.IsOpen)
                {
                    return;
                }
                else
                {
                    door.CurrentLockValue = 0;
                    door.ToggleDoor();
                }
            }
        }
        /// <summary>
        /// 20
        /// Closes door on activate.  If door has a starting lock value, will re-lock door.
        /// </summary>
        public static void CloseDoor(GameObject triggerObj, DaggerfallAction thisAction)
        {
            DaggerfallActionDoor door;

            if (!GetDoor(thisAction.gameObject, out door))
            {
                DaggerfallUnity.LogMessage(string.Format("No DaggerfallActionDoor component found"), true);
            }
            else
            {
                if (!door.IsOpen)
                {
                    return;
                }
                else
                {
                    door.ToggleDoor();
                    door.CurrentLockValue = door.StartingLockValue;
                }
            }
        }
Example #25
0
        // Finds start marker, should only be called for starting block
        private void FindStartMarker(DaggerfallRDBBlock dfBlock)
        {
            if (!dfBlock)
            {
                throw new Exception("DaggerfallDungeon: dfBlock cannot be null.");
            }
            if (dfBlock.StartMarkers.Length == 0)
            {
                DaggerfallUnity.LogMessage("DaggerfallDungeon: No start markers found in block.", true);
                return;
            }

            // There should only be one start marker per start block
            // This message will let us know if more than one is found
            if (dfBlock.StartMarkers.Length > 1)
            {
                DaggerfallUnity.LogMessage("DaggerfallDungeon: Multiple start markers found. Using first marker.", true);
            }

            startMarker = dfBlock.StartMarkers[0];
        }
Example #26
0
        /// <summary>
        /// 20
        /// Closes door on activate.  If door has a starting lock value, will re-lock door.
        /// </summary>
        public static void CloseDoor(GameObject triggerObj, DaggerfallAction thisAction)
        {
            // Try regular action door
            DaggerfallActionDoor door;

            if (!GetDoor(thisAction.gameObject, out door))
            {
                DaggerfallUnity.LogMessage(string.Format("No DaggerfallActionDoor or DaggerfallActionDoorSpecial component found"), true);
            }
            else
            {
                if (!door.IsOpen)
                {
                    return;
                }
                else
                {
                    door.ToggleDoor();
                    door.CurrentLockValue = door.StartingLockValue;
                    return;
                }
            }

            // Try special action door
            if (thisAction != null && thisAction.gameObject)
            {
                DaggerfallActionDoorSpecial specialDoor = thisAction.gameObject.GetComponent <DaggerfallActionDoorSpecial>();
                if (specialDoor)
                {
                    if (specialDoor.IsClosed)
                    {
                        return;
                    }
                    else
                    {
                        specialDoor.ToggleDoor();
                    }
                }
            }
        }
        private bool ReadyCheck()
        {
            // Ensure we have a DaggerfallUnity reference
            if (dfUnity == null)
            {
                dfUnity = DaggerfallUnity.Instance;
            }
            if (!dfUnity.IsReady)
            {
                return(false);
            }

            // Get audio source
            audioSource = GetComponent <AudioSource>();
            if (audioSource == null)
            {
                DaggerfallUnity.LogMessage("DaggerfallAudioSource: Could not find AudioSource component.");
                return(false);
            }

            return(true);
        }
        private void LayoutDungeon(ref DFLocation location)
        {
#if SHOW_LAYOUT_TIMES
            // Start timing
            System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew();
            long startTime = stopwatch.ElapsedMilliseconds;
#endif

            // Calculate monster power - this is a clamped 0-1 value based on player's level from 1-20
            float monsterPower = Mathf.Clamp01(GameManager.Instance.PlayerEntity.Level / 20f);

            // Create dungeon layout
            foreach (var block in location.Dungeon.Blocks)
            {
                GameObject go = GameObjectHelper.CreateRDBBlockGameObject(
                    block.BlockName,
                    DungeonTextureTable,
                    block.IsStartingBlock,
                    Summary.DungeonType,
                    monsterPower,
                    RandomMonsterVariance,
                    (int)DateTime.Now.Ticks /*Summary.ID*/,      // TODO: Add more options for seed
                    dfUnity.Option_DungeonBlockPrefab);
                go.transform.parent   = this.transform;
                go.transform.position = new Vector3(block.X * RDBLayout.RDBSide, 0, block.Z * RDBLayout.RDBSide);

                DaggerfallRDBBlock daggerfallBlock = go.GetComponent <DaggerfallRDBBlock>();
                if (block.IsStartingBlock)
                {
                    FindMarkers(daggerfallBlock);
                }
            }

#if SHOW_LAYOUT_TIMES
            // Show timer
            long totalTime = stopwatch.ElapsedMilliseconds - startTime;
            DaggerfallUnity.LogMessage(string.Format("Time to layout dungeon: {0}ms", totalTime), true);
#endif
        }
Example #29
0
        private bool ReadyCheck()
        {
            // Ensure we have a DaggerfallUnity reference
            if (dfUnity == null)
            {
                dfUnity = DaggerfallUnity.Instance;
            }

            // Do nothing if DaggerfallUnity not ready
            if (!dfUnity.IsReady)
            {
                DaggerfallUnity.LogMessage("SoundReader: DaggerfallUnity component is not ready. Have you set your Arena2 path?");
                return(false);
            }

            // Ensure sound reader is ready
            if (soundFile == null)
            {
                soundFile = new SndFile(Path.Combine(dfUnity.Arena2Path, SndFile.Filename), FileUsage.UseMemory, true);
            }

            return(true);
        }
        /// <summary>
        /// 21
        /// Damages players health, uses random range & activates sporadically
        /// </summary>
        /// <param name="prevObj"></param>
        /// <param name="thisAction"></param>
        public static void DrainHealth21(GameObject triggerObj, DaggerfallAction thisAction)
        {
            //action type 21 activates every ~20 times for some reason.  Might be better to rand instead
            if (thisAction.activationCount % 20 != 0)
            {
                return;
            }

            GameObject   playerObject;
            PlayerEntity playerEntity;

            if (!GetPlayer(out playerObject, out playerEntity))
            {
                DaggerfallUnity.LogMessage("Failed to get Player or Player entity", true);
                return;
            }

            int damage = 0;

            damage = UnityEngine.Random.Range(Mathf.Max(1, (int)thisAction.Magnitude), Mathf.Max(1, thisAction.Index)) * Mathf.Max(playerEntity.Level, 1);
            playerObject.SendMessage("RemoveHealth", damage);
            //DaggerfallUnity.LogMessage("DrainHealth21, damage: " + damage, true);
        }