From f6f07f549714db617957cbba6328cf317e378825 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Thu, 1 Jun 2017 16:33:52 -0500 Subject: [PATCH 1/6] clear mGoToJail flag on load --- apps/openmw/mwworld/worldimp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 217a06ee1..0421ecb24 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -309,6 +309,7 @@ namespace MWWorld mDoorStates.clear(); + mGoToJail = false; mTeleportEnabled = true; mLevitationEnabled = true; From 42f3c73c7540006d48d5190d2d1354cfbed1d26e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 3 Jun 2017 13:16:44 +0400 Subject: [PATCH 2/6] Spell priority: dispel usage improvements --- apps/openmw/mwmechanics/aicombataction.cpp | 59 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index d0464418b..1acf2f041 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -61,7 +61,7 @@ float suggestCombatRange(int rangeTypes) } } -int numEffectsToCure (const MWWorld::Ptr& actor, int effectFilter=-1) +int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) { int toCure=0; const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); @@ -75,9 +75,14 @@ int numEffectsToCure (const MWWorld::Ptr& actor, int effectFilter=-1) if (effectFilter != -1 && effectId != effectFilter) continue; const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effectId); - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful - && effectIt->mDuration > 3 // Don't attempt to cure if effect runs out shortly anyway - ) + + if (effectIt->mDuration <= 3) // Don't attempt to dispel if effect runs out shortly anyway + continue; + + if (negative && magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + ++toCure; + + if (!negative && !(magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)) ++toCure; } } @@ -400,14 +405,49 @@ namespace MWMechanics } break; - // Prefer Cure effects over Dispel, because Dispel also removes positive effects case ESM::MagicEffect::Dispel: - return 1000.f * numEffectsToCure(actor); + { + int numPositive = 0; + int numNegative = 0; + int diff = 0; + + if (effect.mRange == ESM::RT_Self) + { + numPositive = numEffectsToDispel(actor, -1, false); + numNegative = numEffectsToDispel(actor); + + diff = numNegative - numPositive; + } + else + { + if (enemy.isEmpty()) + return 0.f; + + numPositive = numEffectsToDispel(enemy, -1, false); + numNegative = numEffectsToDispel(enemy); + + diff = numPositive - numNegative; + + // if rating < 0 here, the spell will be considered as negative later + rating *= -1; + } + + if (diff <= 0) + return 0.f; + + int magnitude = (effect.mMagnMin + effect.mMagnMax) / 2; + + rating *= (diff) / 5.f; + + break; + } + + // Prefer Cure effects over Dispel, because Dispel also removes positive effects case ESM::MagicEffect::CureParalyzation: - return 1001.f * numEffectsToCure(actor, ESM::MagicEffect::Paralyze); - case ESM::MagicEffect::CurePoison: - return 1001.f * numEffectsToCure(actor, ESM::MagicEffect::Poison); + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Paralyze); + case ESM::MagicEffect::CurePoison: + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Poison); case ESM::MagicEffect::DisintegrateArmor: { if (enemy.isEmpty()) @@ -555,6 +595,7 @@ namespace MWMechanics // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. if (effect.mRange != ESM::RT_Self) rating *= -1.f; + return rating; } From f4a187a9c289b9c1bb7431488b2f1cf2a821d959 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 3 Jun 2017 23:03:24 +0400 Subject: [PATCH 3/6] Move a setting to show enchanting success chance from GUI to Game section --- apps/openmw/mwgui/enchantingdialog.cpp | 2 +- docs/source/reference/modding/settings/GUI.rst | 11 ----------- docs/source/reference/modding/settings/game.rst | 11 +++++++++++ files/settings-default.cfg | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index 8d8440626..e44dc6fcc 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -181,7 +181,7 @@ namespace MWGui mBuyButton->setCaptionWithReplacing("#{sCreate}"); - bool enabled = Settings::Manager::getBool("show enchant chance","GUI"); + bool enabled = Settings::Manager::getBool("show enchant chance","Game"); mChanceLayout->setVisible(enabled); diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index cdc3bd889..ad3514ffa 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -127,14 +127,3 @@ The default value is "1.0 0.15 0.15 1.0" which is a bright red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the crosshair setting in the HUD Settings Section is false. This setting has no effect if the show owned setting in the Game Settings Section is false. - -show enchant chance ----------------- - -:Type: boolean -:Range: True/False -:Default: False - -Whether or not the chance of success will be displayed in the enchanting menu. - -The default value is false. This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index d5828ee12..62fe5a70e 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -40,6 +40,17 @@ If this setting is true, melee weapons reach and speed will be showed on item to The default value is false. This setting can only be configured by editing the settings configuration file. +show enchant chance +------------------- + +:Type: boolean +:Range: True/False +:Default: False + +Whether or not the chance of success will be displayed in the enchanting menu. + +The default value is false. This setting can only be configured by editing the settings configuration file. + best attack ----------- diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 0a1af81b1..9c3667a6e 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -141,9 +141,6 @@ werewolf overlay = true color background owned = 0.15 0.0 0.0 1.0 color crosshair owned = 1.0 0.15 0.15 1.0 -# Show success probability in self-enchant dialog -show enchant chance = false - [HUD] # Displays the crosshair or reticle when not in GUI mode. @@ -161,6 +158,9 @@ show projectile damage = false # Show additional melee weapon info: reach and attack speed show melee info = false +# Show success probability in self-enchant dialog +show enchant chance = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From d6b97604ba690c7c78020ca68ac0b5c7e0246f1a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 4 Jun 2017 11:19:28 +0200 Subject: [PATCH 4/6] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 158e16ee6..d119c9b1a 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -108,6 +108,7 @@ Programmers Narmo Nathan Jeffords (blunted2night) NeveHanter + Nialsy Nikolay Kasyanov (corristo) nobrakal Nolan Poe (nopoe) From 00402b71545c0957eb91cf2cc5c87320c3503111 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 4 Jun 2017 14:09:23 +0400 Subject: [PATCH 5/6] Removed unused variable --- apps/openmw/mwmechanics/aicombataction.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 1acf2f041..37b67c9b2 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -435,8 +435,6 @@ namespace MWMechanics if (diff <= 0) return 0.f; - int magnitude = (effect.mMagnMin + effect.mMagnMax) / 2; - rating *= (diff) / 5.f; break; From 6f878327bf28544e33a90edf3b0ad6da1aa42d7b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 4 Jun 2017 12:50:25 +0200 Subject: [PATCH 6/6] Fix unused ICS_MAX warning --- extern/oics/ICSInputControlSystem.cpp | 2 ++ extern/oics/ICSInputControlSystem.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extern/oics/ICSInputControlSystem.cpp b/extern/oics/ICSInputControlSystem.cpp index a8aedfd2e..8bb9c4638 100644 --- a/extern/oics/ICSInputControlSystem.cpp +++ b/extern/oics/ICSInputControlSystem.cpp @@ -28,6 +28,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace ICS { + const float ICS_MAX = std::numeric_limits::max(); + InputControlSystem::InputControlSystem(std::string file, bool active , DetectingBindingListener* detectingBindingListener , InputControlSystemLog* log, size_t channelCount) diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index a82a11d75..691a93725 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -236,7 +236,7 @@ namespace ICS }; - static const float ICS_MAX = std::numeric_limits::max(); + extern const float ICS_MAX; }