예제 #1
0
        public override bool UseItem(ItemCollection collection)
        {
            PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
            uint         gameMinutes  = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();
            uint         hunger       = gameMinutes - playerEntity.LastTimePlayerAteOrDrankAtTavern;
            uint         cals         = GetCalories() / ((uint)FoodStatus + 1);

            if (FoodStatus == StatusPutrid)
            {
                DaggerfallUI.MessageBox(string.Format("This {0} is too disgusting to force down.", shortName));
            }
            else if (hunger >= cals)
            {
                if (hunger > cals + 240)
                {
                    playerEntity.LastTimePlayerAteOrDrankAtTavern = gameMinutes - 240;
                }
                playerEntity.LastTimePlayerAteOrDrankAtTavern += cals;

                collection.RemoveItem(this);
                DaggerfallUI.MessageBox(string.Format("You eat the {0}.", shortName));
                DaggerfallUI.AddHUDText("You feel invigorated by the meal.");
            }
            else
            {
                DaggerfallUI.MessageBox(string.Format("You are not hungry enough to eat the {0} right now.", shortName));
            }
            return(true);
        }
예제 #2
0
 private static void WaxingMoon_OnNewMagicRound()
 {
     if (GameManager.Instance.PlayerEffectManager.HasLycanthropy())
     {
         if (timeNow.MassarLunarPhase == LunarPhases.ThreeWax)
         {
             if (timeNow.IsNight && timeNow.Hour < 10 && !waxWarning)
             {
                 waxWarning = true;
                 DaggerfallUI.AddHUDText("Masser is waxing, soon it will be a full moon...");
             }
             else if (timeNow.IsDay)
             {
                 waxWarning = false;
             }
         }
         else if (timeNow.SecundaLunarPhase == LunarPhases.ThreeWax)
         {
             if (timeNow.IsNight && timeNow.Hour < 10 && !waxWarning)
             {
                 waxWarning = true;
                 DaggerfallUI.AddHUDText("Secunda is waxing, soon it will be a full moon...");
             }
             else if (timeNow.IsDay)
             {
                 waxWarning = false;
             }
         }
         else
         {
             waxWarning = false;
         }
     }
 }
예제 #3
0
        private void StealButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            if (windowMode == WindowModes.Buy && cost > 0)
            {
                // Calculate the weight of all items picked from shelves, then get chance of shoplifting success.
                int weightAndNumItems   = (int)basketItems.GetWeight() + basketItems.Count;
                int chanceBeingDetected = FormulaHelper.CalculateShopliftingChance(PlayerEntity, null, buildingDiscoveryData.quality, weightAndNumItems);
                PlayerEntity.TallySkill(DFCareer.Skills.Pickpocket, 1);

                if (Dice100.FailedRoll(chanceBeingDetected))
                {
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "stealSuccess"), 2);
                    RaiseOnTradeHandler(basketItems.GetNumItems(), 0);
                    PlayerEntity.Items.TransferAll(basketItems);
                    PlayerEntity.TallyCrimeGuildRequirements(true, 1);
                }
                else
                {   // Register crime and start spawning guards.
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "stealFailure"), 2);
                    RaiseOnTradeHandler(0, 0);
                    PlayerEntity.CrimeCommitted = PlayerEntity.Crimes.Theft;
                    PlayerEntity.SpawnCityGuards(true);
                }
                CloseWindow();
            }
        }
예제 #4
0
        /// <summary>
        /// Called by entity holding Open incumbent when they activate a door.
        /// For player this is called by PlayerActivate when opening/closing a door.
        /// Enemies cannot use Lock/Open effects at this time.
        /// This effect will automatically open door if closed when spell triggered.
        /// </summary>
        /// <param name="actionDoor">DaggerfallActionDoor activated by entity.</param>
        public void TriggerOpenEffect(DaggerfallActionDoor actionDoor)
        {
            if (forcedRoundsRemaining == 0)
            {
                return;
            }

            bool activatedByPlayer = (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour);

            if (actionDoor.IsLocked)
            {
                // Unlocks door to level of entity - from spell description "Unlocks chest or door to lock-level of caster."
                // Skeleton's Key can open even magical locks
                if (castBySkeletonKey || actionDoor.CurrentLockValue <= manager.EntityBehaviour.Entity.Level)
                {
                    actionDoor.CurrentLockValue = 0;
                }
                else if (activatedByPlayer)
                {
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "openFailed"), 1.5f);
                }
            }

            if (!actionDoor.IsLocked && actionDoor.IsClosed)
            {
                // Automatically open door if closed and unlocked
                actionDoor.ToggleDoor(activatedByPlayer);
            }

            // Expire effect once door activated
            CancelEffect();
        }
예제 #5
0
        /// <summary>
        /// 32
        /// Shows text at the top of the screen when player clicks on associated door in info mode.
        /// </summary>
        public static void DoorText(GameObject triggerObj, DaggerfallAction thisAction)
        {
            // The way that classic handles this action has some problems. The text is only displayed
            // if the door is clicked in info mode, so it can easily be missed, and if clicked in info mode
            // the trespassing check isn't run but the door is still opened, making it an exploit.
            // For DF Unity, we're showing the text on the first click of the door, and opening the door
            // and running the trespassing check from the second click onward, all regardless of interaction mode.

            int DoorTextID = TYPE_99_TEXT_INDEX + thisAction.Index;

            // Patch some textID lookups.
            switch (DoorTextID)
            {
            case 7700:                           // action.Index was 0.
                thisAction.ActionEnabled = true; // This means skip over trying to display the message and proceed to the trespassing check.
                                                 // DaggerfallActionDoor will also proceed with opening the door even on first activation.
                break;

            case 7701:
            case 7702:
            case 7703:
            case 7704:
            {
                DoorTextID = 7705;         // All of these are the same except that only 7705 correctly has "allowed" instead of "allow"
                break;
            }

            case 7706:      // Doesn't exist. This is on a door in Castle Wayrest to a room with some potions, bookshelves, weighting scales and a telescope.
            case 7711:      // Doesn't exist. Found on door to kitchen in Wayrest dungeon.
            case 7712:      // Doesn't exist. Found on door to storage room in Wayrest dungeon kitchen.
            case 7715:      // Doesn't exist. Found on doors in back of Orsinium throne room.
            case 7717:      // "A strong, orcish voice in the back of the hall snarls 'All who enter must face the trial by arms.'" Incorrectly located on a door to an armory room in Wayrest dungeon.
            case 7719:      // Doesn't exist. This is on the doors to a room near the start of the Orsinium dungeon area with a long table lined with chairs and a fireplace.
            {
                thisAction.ActionEnabled = true;
                break;
            }
            }

            if (thisAction.activationCount == 1 && DoorTextID != 7700 && !thisAction.ActionEnabled)
            {
                TextFile.Token[] tokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(DoorTextID);
                if (tokens != null)
                {
                    DaggerfallUI.AddHUDText(tokens, 2.0f);
                }
                else
                {
                    throw new System.Exception(string.Format("DaggerfallAction: Bad DoorTextID requested: {0}.", DoorTextID));
                }
            }
            else
            {
                // Classic seems to only check whether this value is greater than 5, as a trespassing check
                if (thisAction.ActionAxisRawValue > 5)
                {
                    GameManager.Instance.MakeEnemiesHostile();
                }
            }
        }
        /// <summary>
        /// Assigns a new spell to be cast.
        /// For player entity, this will display "press button to fire spell" message.
        /// </summary>
        public void SetReadySpell(EntityEffectBundle spell)
        {
            // Do nothing if silenced
            if (SilenceCheck())
            {
                return;
            }

            // Spell must appear valid
            if (spell == null || spell.Settings.Version < minAcceptedSpellVersion)
            {
                return;
            }

            // Assign spell - caster only spells are cast instantly
            readySpell = spell;
            if (readySpell.Settings.TargetType == TargetTypes.CasterOnly)
            {
                instantCast = true;
            }

            if (isPlayerEntity && !instantCast)
            {
                DaggerfallUI.AddHUDText(HardStrings.pressButtonToFireSpell, 0.4f);
            }
        }
예제 #7
0
        static public void FoodRot(int rotBonus = 0)
        {
            bool rotted    = false;
            int  rotChance = 0;

            foreach (ItemCollection playerItems in new ItemCollection[] { GameManager.Instance.PlayerEntity.Items, GameManager.Instance.PlayerEntity.WagonItems, GameManager.Instance.PlayerEntity.OtherItems })
            {
                for (int i = 0; i < playerItems.Count; i++)
                {
                    DaggerfallUnityItem item = playerItems.GetItem(i);
                    if (item is AbstractItemFood)
                    {
                        rotChance = UnityEngine.Random.Range(1, 100) + rotBonus;
                        AbstractItemFood food = item as AbstractItemFood;
                        if (rotChance > food.maxCondition && !food.RotFood())
                        {
                            food.RotFood();
                            rotted = true;
                        }
                        rotChance = 0;
                    }
                }
            }
            if (rotted)
            {
                daysRot = 0;
                rotted  = false;
                DaggerfallUI.AddHUDText("Your food is getting a bit ripe...");
            }
        }
        IEnumerator TakeScreenshot()
        {
            string name = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");
            int    inc  = 1;

            if (File.Exists(Path.Combine(UnityScreenshotsPath, name + ".png")))
            {
                while (File.Exists(Path.Combine(UnityScreenshotsPath, name + "_" + inc + ".png")))
                {
                    inc++;
                }
                name += "_" + inc;
            }

            string path = Path.Combine(UnityScreenshotsPath, name + ".png");

            //this is an async function
            ScreenCapture.CaptureScreenshot(path);

            //prevent the HUD text below from appearing on the screenshot
            while (!File.Exists(path))
            {
                yield return(new WaitForSeconds(0.1f));
            }

            DaggerfallUI.AddHUDText("Screenshot captured as '" + name + ".png'");
        }
예제 #9
0
        protected override void BecomeIncumbent()
        {
            base.BecomeIncumbent();

            // Output trap start message
            string messageID = string.Empty;

            switch (manager.EntityBehaviour.EntityType)
            {
            case EntityTypes.CivilianNPC:
            case EntityTypes.EnemyClass:
                messageID = "trapHumanoid";
                ResignAsIncumbent();
                End();
                break;

            case EntityTypes.EnemyMonster:
                messageID = "trapActive";
                break;

            default:
                ResignAsIncumbent();
                End();
                return;
            }
            DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, messageID));
        }
예제 #10
0
 static void TavernDrink(int alcohol)
 {
     DaggerfallUI.Instance.FadeBehaviour.SmashHUDToBlack();
     PassTime(600);
     DaggerfallUI.Instance.FadeBehaviour.FadeHUDFromBlack();
     drunk += alcohol;
     Debug.Log("[Climates & Calories]  drunk = " + drunk.ToString());
     if (drunk > playerEntity.Stats.LiveEndurance)
     {
         ShitFaced();
     }
     else if (drunk > playerEntity.Stats.LiveEndurance / 2)
     {
         DaggerfallUI.AddHUDText("You are getting drunk...");
     }
     else if (alcohol > 0)
     {
         DaggerfallUI.AddHUDText("The drink fortifies you.");
         playerEntity.IncreaseFatigue(alcohol, true);
     }
     else
     {
         DaggerfallUI.AddHUDText("The drink refreshes you.");
         playerEntity.IncreaseFatigue(5, true);
     }
 }
예제 #11
0
        private static void MountWagon(RaycastHit hit)
        {
            DaggerfallMessageBox wagonPopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow);

            if (hit.transform.gameObject.GetInstanceID() == Wagon.GetInstanceID())
            {
                if (GameManager.Instance.PlayerActivate.CurrentMode == PlayerActivateModes.Info)
                {
                    DaggerfallUI.AddHUDText("You see your wagon");
                }
                else if (!transportManager.HasHorse())
                {
                    DaggerfallUI.MessageBox("You have no horse to pull your wagon.");
                }
                else if (!GameManager.Instance.PlayerController.isGrounded)
                {
                    DaggerfallUI.MessageBox("You are unable to levitate your wagon.");
                }
                else
                {
                    DaggerfallUnityItem WagonItem = ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Small_cart);
                    DestroyWagon();
                    GameManager.Instance.PlayerEntity.Items.AddItem(WagonItem);
                    WagonDeployed = false;
                    WagonMatrix   = new Matrix4x4();
                    transportManager.TransportMode = TransportModes.Cart;
                    DaggerfallUI.MessageBox("You hitch your wagon.");
                }
            }
            else
            {
                DaggerfallUI.MessageBox("This is not your wagon.");
            }
        }
예제 #12
0
        private static void MountHorse(RaycastHit hit)
        {
            DaggerfallMessageBox horsePopUp = new DaggerfallMessageBox(DaggerfallUI.UIManager, DaggerfallUI.UIManager.TopWindow);

            if (hit.transform.gameObject.GetInstanceID() == Horse.GetInstanceID())
            {
                if (GameManager.Instance.PlayerActivate.CurrentMode == PlayerActivateModes.Info)
                {
                    DaggerfallUI.AddHUDText("You see " + HorseName);
                }
                else if (playerEntity.IsInBeastForm)
                {
                    DaggerfallUI.MessageBox(HorseName + " shies away from you.");
                }
                else if (!GameManager.Instance.PlayerController.isGrounded)
                {
                    DaggerfallUI.MessageBox(HorseName + " is unable to levitate.");
                }
                else
                {
                    DaggerfallUnityItem HorseItem = ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Horse);
                    DestroyHorse();
                    GameManager.Instance.PlayerEntity.Items.AddItem(HorseItem);
                    HorseDeployed = false;
                    HorseMatrix   = new Matrix4x4();
                    transportManager.TransportMode = TransportModes.Horse;
                    DaggerfallUI.MessageBox("You mount " + HorseName + ".");
                }
            }
            else
            {
                DaggerfallUI.MessageBox("This is not your " + HorseName + ".");
            }
        }
예제 #13
0
        IEnumerator TakeScreenshot()
        {
            string name = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");
            int    inc  = 1;

            if (File.Exists(Path.Combine(UnityScreenshotsPath, name + fileExtension)))
            {
                while (File.Exists(Path.Combine(UnityScreenshotsPath, name + "_" + inc + fileExtension)))
                {
                    inc++;
                }
                name += "_" + inc;
            }

            yield return(endOfFrame);

            string path = Path.Combine(UnityScreenshotsPath, name + fileExtension);

            Texture2D pic = new Texture2D(Screen.width, Screen.height);

            pic.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
            pic.Apply();
            byte[] bytes = pic.EncodeToJPG();

            // Save file
            System.IO.File.WriteAllBytes(path, bytes);

            // Prevent the HUD text below from appearing on the screenshot
            while (!File.Exists(path))
            {
                yield return(new WaitForSeconds(0.1f));
            }

            DaggerfallUI.AddHUDText("Screenshot captured as '" + name + fileExtension + "'");
        }
        private void StealButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            if (windowMode == WindowModes.Buy && cost > 0)
            {
                // Calculate the weight of all items picked from shelves, then get chance of shoplifting success.
                int weightAndNumItems = (int)basketItems.GetWeight() + basketItems.Count;
                int chance            = FormulaHelper.CalculateShopliftingChance(PlayerEntity, null, buildingDiscoveryData.quality, weightAndNumItems);
                PlayerEntity.TallySkill(DFCareer.Skills.Pickpocket, 1);

                if (UnityEngine.Random.Range(0, 101) > chance)
                {
                    DaggerfallUI.AddHUDText(HardStrings.youAreSuccessful, 2);
                    RaiseOnTradeHandler(basketItems.GetNumItems(), 0);
                    PlayerEntity.Items.TransferAll(basketItems);
                    PlayerEntity.TallyCrimeGuildRequirements(true, 1);
                }
                else
                {   // Register crime and start spawning guards.
                    DaggerfallUI.AddHUDText(HardStrings.youAreNotSuccessful, 2);
                    RaiseOnTradeHandler(0, 0);
                    PlayerEntity.CrimeCommitted = PlayerEntity.Crimes.Theft;
                    PlayerEntity.SpawnCityGuards(true);
                }
                CloseWindow();
            }
        }
예제 #15
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Attempt to get Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                Debug.LogErrorFormat("Could not find Item resource symbol {0}", itemSymbol);
                return;
            }

            // Release item so we can give back to player
            // Sometimes a quest item is both carried by player then handed back to them
            // Example is Sx012 where courier hands back two items of jewellery
            GameManager.Instance.PlayerEntity.ReleaseQuestItemForReoffer(item.DaggerfallUnityItem);

            // Give quest item to player
            if (item.DaggerfallUnityItem.IsOfTemplate(ItemGroups.Currency, (int)Currency.Gold_pieces))
            {
                // Give player gold equal to stack size and notify
                int amount = item.DaggerfallUnityItem.stackCount;
                GameManager.Instance.PlayerEntity.GoldPieces += amount;
                DaggerfallUI.AddHUDText(HardStrings.youReceiveGoldPieces.Replace("%s", amount.ToString()));
            }
            else
            {
                // Give player actual item
                GameManager.Instance.PlayerEntity.Items.AddItem(item.DaggerfallUnityItem, ItemCollection.AddPosition.Front);
            }

            SetComplete();
        }
예제 #16
0
 private static void WaxingMoon_OnNewMagicRound()
 {
     timeNow = DaggerfallUnity.Instance.WorldTime.Now;
     if (timeNow.MinuteOfDay == 720 || timeNow.MinuteOfDay == 1080)
     {
         waxWarning = false;
     }
     if (GameManager.Instance.PlayerEffectManager.HasLycanthropy() && !GameManager.IsGamePaused && !DaggerfallUI.Instance.FadeBehaviour.FadeInProgress)
     {
         if (FullTonight(true) && !waxWarning)
         {
             waxWarning = true;
             DaggerfallUI.AddHUDText("Masser is waxing...");
             ModManager.Instance.SendModMessage("TravelOptions", "showMessage", "The coming night will have a full moon...");
             DaggerfallUI.AddHUDText("The coming night will have a full moon.");
             ModManager.Instance.SendModMessage("TravelOptions", "showMessage", "The coming night will have a full moon.");
         }
         else if (FullTonight(false) && !waxWarning)
         {
             waxWarning = true;
             DaggerfallUI.AddHUDText("Secunda is waxing...");
             ModManager.Instance.SendModMessage("TravelOptions", "showMessage", "The coming night will have a full moon...");
             DaggerfallUI.AddHUDText("The coming night will have a full moon.");
             ModManager.Instance.SendModMessage("TravelOptions", "showMessage", "The coming night will have a full moon.");
         }
         else if (!FullTonight(true) && !FullTonight(false))
         {
             waxWarning = false;
         }
     }
 }
예제 #17
0
        protected override void IncrementDailyDiseaseEffects()
        {
            if (infectionCyclesPassed <= 0) // Simulated Absorption/Incubation period before effects start to kick in, in this case 1 cycles, or approx. 5 in-game minutes, or 5 magic rounds.
            {
                return;
            }

            DaggerfallEntityBehaviour host = GetPeeredEntityBehaviour(manager);

            if (infectionCyclesPassed == 1)
            {
                ChangeStatMod(DFCareer.Stats.Willpower, UnityEngine.Random.Range(3, 7 + 1));
                ChangeStatMod(DFCareer.Stats.Agility, UnityEngine.Random.Range(3, 5 + 1));
                ChangeStatMod(DFCareer.Stats.Endurance, -UnityEngine.Random.Range(3, 4 + 1));
                host.Entity.DecreaseHealth(UnityEngine.Random.Range(2, 5 + 1));
                DaggerfallUI.AddHUDText("You feel more relaxed and limber", 4f);
                return;
            }

            if (infectionCyclesPassed >= 22)
            {
                if (GetAttributeMod(DFCareer.Stats.Willpower) > 0)
                {
                    SetStatMod(DFCareer.Stats.Willpower, 0);
                }
                if (GetAttributeMod(DFCareer.Stats.Agility) > 0)
                {
                    SetStatMod(DFCareer.Stats.Agility, 0);
                }

                DaggerfallUI.AddHUDText("The relaxed feeling has left, and you feel just a bit less healthy than before", 4f);
                return;
            }
        }
예제 #18
0
        void StartSummon() // Change this for summon behavior
        {
            // Get peered entity gameobject
            DaggerfallEntityBehaviour entityBehaviour = GetPeeredEntityBehaviour(manager);

            if (!entityBehaviour)
            {
                return;
            }

            // Part where monster ally is actually created
            UnityEngine.GameObject   player = GameManager.Instance.PlayerObject;
            UnityEngine.GameObject[] mobile = DaggerfallWorkshop.Utility.GameObjectHelper.CreateFoeGameObjects(player.transform.position + player.transform.forward * 2, (MobileTypes)(int)monsterCareer, 1, MobileReactions.Hostile, null, true);

            DaggerfallEntityBehaviour behaviour = mobile[0].GetComponent <DaggerfallEntityBehaviour>();
            EnemyEntity entity = behaviour.Entity as EnemyEntity;

            //mobile[0].transform.LookAt(mobile[0].transform.position + (mobile[0].transform.position - player.transform.position));
            mobile[0].SetActive(true);
            manager.AttachedSummonedEntity = mobile[0];

            // Output "You Summoned Something" if the host manager is player
            if (awakeAlert && manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
            {
                DaggerfallUI.AddHUDText(string.Format("You Summon A {0}", (MobileTypes)monsterCareer), 1.5f);
                awakeAlert = false;
            }
        }
예제 #19
0
        private static void FoodEffects_OnNewMagicRound()
        {
            Debug.Log("[FillingFood Food] Round Start");

            uint gameMinutes = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();
            uint ateTime     = GameManager.Instance.PlayerEntity.LastTimePlayerAteOrDrankAtTavern;
            uint hunger      = (gameMinutes - ateTime);

            if (hunger <= 240)
            {
                foodCount += (200 - (int)hunger);
                Debug.Log(foodCount.ToString());
                if (foodCount >= 500)
                {
                    playerEntity.IncreaseFatigue(1, true);
                    foodCount = 0;
                    Debug.Log("[FillingFood Food] +1 Fatigue");
                }
            }
            else
            {
                Debug.Log("[FillingFood Food] Hungry");
                hungry = true;
                DaggerfallUI.AddHUDText("Your stomach rumbles...");
                EntityEffectBroker.OnNewMagicRound -= FoodEffects_OnNewMagicRound;
                Debug.Log("[FillingFood Food] De-registering from OnNewMagicRound");
            }
            Debug.Log("[FillingFood Food] Round End");
        }
예제 #20
0
 void ShowPlayerParalyzed()
 {
     // Output "You are paralyzed." if the host manager is player
     if (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
     {
         DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "youAreParalyzed"), 1.5f);
     }
 }
예제 #21
0
 void ShowPlayerDrained()
 {
     // Output "you feel drained." if the host manager is player
     if (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
     {
         DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "youFeelDrained"));
     }
 }
        /// <summary>
        /// Assigns a new spell to be cast.
        /// For player entity, this will display "press button to fire spell" message.
        /// </summary>
        /// <param name="spell"></param>
        public void SetReadySpell(FakeSpell spell)
        {
            readySpell = spell;

            if (isPlayerEntity)
            {
                DaggerfallUI.AddHUDText(HardStrings.pressButtonToFireSpell);
            }
        }
예제 #23
0
        public override void Start(EntityEffectManager manager, DaggerfallEntityBehaviour caster = null)
        {
            base.Start(manager, caster);

            // Output "You are regenerating." if the host manager is player
            if (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
            {
                DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "youAreRegenerating"), 1.5f);
            }
        }
예제 #24
0
 public void FoodOnHUD()
 {
     if (ClimateCalories.isVampire)
     {
         DaggerfallUI.AddHUDText("The meal does nothing for you.");
     }
     else
     {
         DaggerfallUI.AddHUDText("You feel invigorated by the meal.");
     }
 }
예제 #25
0
        protected override void IncrementDailyDiseaseEffects()
        {
            if (infectionCyclesPassed <= 2) // Simulated Absorption/Incubation period before effects start to kick in, in this case 3 cycles, or approx. 36 in-game minutes, or 36 magic rounds.
            {
                return;
            }

            DaggerfallEntityBehaviour host = GetPeeredEntityBehaviour(manager);

            if (infectionCyclesPassed == 3)
            {
                ChangeStatMod(DFCareer.Stats.Endurance, UnityEngine.Random.Range(35, 40 + 1));
                ChangeStatMod(DFCareer.Stats.Speed, -UnityEngine.Random.Range(25, 30 + 1));
                host.Entity.IncreaseHealth(UnityEngine.Random.Range(3, 5 + 1));
                DaggerfallUI.AddHUDText("You feel more healthy than you ever have! But also much slower than usual", 4f);
                return;
            }

            if (infectionCyclesPassed >= 4 && infectionCyclesPassed < 35)
            {
                host.Entity.IncreaseHealth(UnityEngine.Random.Range(1, 4 + 1));
                DaggerfallUI.AddHUDText("Your wounds close before your eyes...", 3f);
                return;
            }

            if (infectionCyclesPassed == 35)
            {
                ChangeStatMod(DFCareer.Stats.Endurance, -UnityEngine.Random.Range(10, 20 + 1));
                ChangeStatMod(DFCareer.Stats.Speed, UnityEngine.Random.Range(5, 8 + 1));
                host.Entity.IncreaseHealth(UnityEngine.Random.Range(1, 3 + 1));
                DaggerfallUI.AddHUDText("You still feel very healthy, but less so than before", 4f);
                return;
            }

            if (infectionCyclesPassed >= 36 && infectionCyclesPassed < 50)
            {
                host.Entity.IncreaseHealth(UnityEngine.Random.Range(1, 2 + 1));
                DaggerfallUI.AddHUDText("Your wounds slowly close before your eyes...", 3f);
                return;
            }

            if (infectionCyclesPassed >= 50)
            {
                if (GetAttributeMod(DFCareer.Stats.Endurance) > 0)
                {
                    SetStatMod(DFCareer.Stats.Endurance, 0);
                }
                ChangeStatMod(DFCareer.Stats.Speed, UnityEngine.Random.Range(7, 10 + 1));

                host.Entity.IncreaseHealth(UnityEngine.Random.Range(1, 2 + 1));
                DaggerfallUI.AddHUDText("The feeling of great health has left, but you still feel much slower than normal...", 4f);
                return;
            }
        }
예제 #26
0
 public override bool AvoidDeath()
 {
     if (deity == Divines.Stendarr &&
         !GameManager.Instance.PlayerEnterExit.IsPlayerSubmerged &&
         UnityEngine.Random.Range(0, 50) < rank)
     {
         DaggerfallUI.AddHUDText(TextManager.Instance.GetLocalizedText("avoidDeath"));
         return(true);
     }
     return(false);
 }
예제 #27
0
 public override bool AvoidDeath()
 {
     if (rank >= 6 && Random.Range(0, 50) < rank &&
         GameManager.Instance.PlayerEntity.FactionData.GetReputation((int)FactionFile.FactionIDs.Stendarr) >= 0 &&
         !GameManager.Instance.PlayerEnterExit.IsPlayerSubmerged)
     {
         DaggerfallUI.AddHUDText(HardStrings.avoidDeath);
         return(true);
     }
     return(false);
 }
예제 #28
0
        void Update()
        {
            // Prevent kicking while in menus. Thanks, |3lessed.
            if (consoleController.ui.isConsoleOpen || GameManager.IsGamePaused || SaveLoadManager.Instance.LoadInProgress || DaggerfallUI.UIManager.WindowCount != 0)
            {
                return;
            }

            // Perform forward kick on keypress and hide weapon from HUD when attack finishes.
            var playerEntity  = GameManager.Instance.PlayerEntity;
            var weaponManager = GameManager.Instance.WeaponManager;

            if (InputManager.Instance.GetKey(kickKey) &&
                !Kicker.IsAttacking() &&
                !weaponManager.ScreenWeapon.IsAttacking() &&
                weaponManager.ScreenWeapon.WeaponType != WeaponTypes.Melee &&
                weaponManager.ScreenWeapon.WeaponType != WeaponTypes.Werecreature)
            {
                Kicker.ShowWeapon = true;
                Kicker.OnAttackDirection(WeaponManager.MouseDirections.Up);
                if (timeSinceLastKick >= messageCooldownTime)
                {
                    DaggerfallUI.AddHUDText("Mighty foot engaged");
                }
                timeSinceLastKick = 0.0f;
            }
            else
            {
                timeSinceLastKick += Time.deltaTime;
            }

            // Damage the target on hit.
            if (isDamageFinished && Kicker.GetCurrentFrame() == 0)
            {
                isDamageFinished = false;
            }
            if (!isDamageFinished && Kicker.GetCurrentFrame() == Kicker.GetHitFrame())
            {
                bool hitEnemy;
                MeleeDamage(Kicker, out hitEnemy);
                if (!hitEnemy)
                {
                    Kicker.PlaySwingSound();
                }
                isDamageFinished = true;
                if (hitEnemy)
                {
                    // Advance skills
                    playerEntity.TallySkill(DFCareer.Skills.HandToHand, 1);
                    playerEntity.TallySkill(DFCareer.Skills.CriticalStrike, 1);
                }
            }
        }
예제 #29
0
        void Update()
        {
            uint gameMinutes = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();
            uint ateTime     = GameManager.Instance.PlayerEntity.LastTimePlayerAteOrDrankAtTavern;
            uint hunger      = (gameMinutes - ateTime);

            if (hunger <= 240 && hungry)
            {
                hungry = false;
                EntityEffectBroker.OnNewMagicRound += FoodEffects_OnNewMagicRound;
                DaggerfallUI.AddHUDText("You feel invigorated by the meal.");
                Debug.Log("[FillingFood Food] Registering OnNewMagicRound");
            }
        }
예제 #30
0
        void Update()
        {
            if (readyToOpenUI)
            {
                if (InputManager.Instance.GetKeyDown(openMenuKeyCode) && !InputManager.Instance.IsPaused && GameManager.Instance.IsPlayerOnHUD)
                {
                    if (SettingEntries == 1 && killCounts.Count < 1)
                    {
                        return;
                    }
                    if (AllText.Pages.Count < 1)
                    {
                        return;
                    }

                    switch (SettingMenuUnlock)
                    {
                    case 0:
                        DaggerfallUI.UIManager.PushWindow(bestiaryUIScreen);
                        break;

                    case 1:
                        if (playerEntity.Items.SearchItems(ItemGroups.UselessItems2, BestiaryItem.templateIndex).Count >= 1)
                        {
                            DaggerfallUI.UIManager.PushWindow(bestiaryUIScreen);
                        }
                        else
                        {
                            DaggerfallUI.AddHUDText("You do not to have the Bestiary item in your inventory.");
                        }
                        break;

                    case 2:
                        if (UnlockedBestiary)
                        {
                            DaggerfallUI.UIManager.PushWindow(bestiaryUIScreen);
                        }
                        else
                        {
                            DaggerfallUI.AddHUDText("You have not yet unlocked the Bestiary. Find the Bestiary book item and click USE on it.");
                        }
                        break;
                    }
                }
                else if (bestiaryUIScreen.isShowing && openMenuKeyCode != KeyCode.None && InputManager.Instance.GetKeyDown(openMenuKeyCode))
                {
                    bestiaryUIScreen.CloseWindow();
                }
            }
        }