From 05f6cf388b23e6d14a7f510767018f1dc61bf795 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sat, 27 Oct 2018 14:43:21 +0200 Subject: KYRA: (EOB) - minor fix for EOB 1 monster hit chance calculation --- engines/kyra/darkmoon.h | 4 ++++ engines/kyra/eob.h | 4 ++++ engines/kyra/eobcommon.cpp | 7 +++---- engines/kyra/eobcommon.h | 2 ++ engines/kyra/staticres_eob.cpp | 22 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/kyra/darkmoon.h b/engines/kyra/darkmoon.h index 57eb46eb1c..f23787d865 100644 --- a/engines/kyra/darkmoon.h +++ b/engines/kyra/darkmoon.h @@ -119,6 +119,10 @@ private: const uint8 *_dscDoorType5Offs; + // Fight + static const uint8 _monsterAcHitChanceTbl1[]; + static const uint8 _monsterAcHitChanceTbl2[]; + // Rest party void restParty_npc(); bool restParty_extraAbortCondition(); diff --git a/engines/kyra/eob.h b/engines/kyra/eob.h index 09b6380c91..889144b705 100644 --- a/engines/kyra/eob.h +++ b/engines/kyra/eob.h @@ -96,6 +96,10 @@ private: const uint8 *_doorSwitchShapeEncodeDefs; const uint8 *_doorSwitchCoords; + // Fight + static const uint8 _monsterAcHitChanceTbl1[]; + static const uint8 _monsterAcHitChanceTbl2[]; + // Magic void turnUndeadAuto(); void turnUndeadAutoHit(); diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index 2264d99dde..b8887528e4 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -66,6 +66,8 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) _redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = 0; _blackBoxSmallGrid = _weaponSlotGrid = _blackBoxWideGrid = _lightningColumnShape = 0; + _monsterAcHitChanceTable1 = _monsterAcHitChanceTable2 = 0; + _monsterDustStrings = 0; _enemyMageSpellList = 0; _enemyMageSfx = 0; @@ -2366,13 +2368,10 @@ int EoBCoreEngine::getDexHitChanceModifier(int charIndex) { } int EoBCoreEngine::getMonsterAcHitChanceModifier(int charIndex, int monsterAc) { - static const uint8 mod1[] = { 1, 3, 3, 2 }; - static const uint8 mod2[] = { 1, 1, 2, 1 }; - int l = _characters[charIndex].level[0] - 1; int cm = _charClassModifier[_characters[charIndex].cClass]; - return (20 - ((l / mod1[cm]) * mod2[cm])) - monsterAc; + return (20 - ((l / _monsterAcHitChanceTable1[cm]) * _monsterAcHitChanceTable2[cm])) - monsterAc; } void EoBCoreEngine::explodeMonster(EoBMonsterInPlay *m) { diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index d214da0944..157c820c5d 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -915,6 +915,8 @@ protected: bool _preventMonsterFlash; int16 _foundMonstersArray[5]; int8 _monsterBlockPosArray[6]; + const uint8 *_monsterAcHitChanceTable1; + const uint8 *_monsterAcHitChanceTable2; // magic void useMagicBookOrSymbol(int charIndex, int type); diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index aa7adc7461..f4897b5256 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -1109,6 +1109,9 @@ void EoBEngine::initStaticResource() { p->dmgModifierEvade = *ps++; } + _monsterAcHitChanceTable1 = _monsterAcHitChanceTbl1; + _monsterAcHitChanceTable2 = _monsterAcHitChanceTbl2; + static const char *const errorSlotNoNameString[3] = { " You must specify\r a name for your\r save game!", " Spielstaende mues-\r sen einen Namen\r haben!", @@ -1212,6 +1215,14 @@ const uint8 EoBEngine::_egaDefaultPalette[] = { 0, 5, 3, 2, 10, 14, 12, 6, 4, 11, 9, 1, 0, 8, 7, 15 }; +const uint8 EoBEngine::_monsterAcHitChanceTbl1[] = { + 3, 2, 1, 3 +}; + +const uint8 EoBEngine::_monsterAcHitChanceTbl2[] = { + 2, 1, 1, 1 +}; + void DarkMoonEngine::initStaticResource() { int temp; _mainMenuStrings = _staticres->loadStrings(kEoB2MainMenuStrings, temp); @@ -1262,6 +1273,9 @@ void DarkMoonEngine::initStaticResource() { _wallOfForceDsNumH = _staticres->loadRawData(kEoB2WallOfForceNumH, temp); _wallOfForceShpId = _staticres->loadRawData(kEoB2WallOfForceShpId, temp); + _monsterAcHitChanceTable1 = _monsterAcHitChanceTbl1; + _monsterAcHitChanceTable2 = _monsterAcHitChanceTbl2; + static const char *const errorSlotNoNameString[3] = { " You must specify\r a name for your\r save game!", " Spielst[nde m]ssen\r einen Namen haben!", @@ -1364,6 +1378,14 @@ const uint8 DarkMoonEngine::_egaDefaultPalette[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +const uint8 DarkMoonEngine::_monsterAcHitChanceTbl1[] = { + 1, 3, 3, 2 +}; + +const uint8 DarkMoonEngine::_monsterAcHitChanceTbl2[] = { + 1, 1, 2, 1 +}; + #endif // ENABLE_EOB } // End of namespace Kyra -- cgit v1.2.3