From: Jaka K. <lyn...@us...> - 2013-01-20 11:59:34
|
gemrb: Infinity Engine emulator The branch master has been updated via 71d84f8ddfde2e16f2e734bbe3d7a582c7142f99 (commit) via 46c95518a4eaab290a4bae5aca8e1364fc304994 (commit) via 23c173af7a7eabdd80269b84bb2df578e5de56f9 (commit) Summary of changes: gemrb/core/Scriptable/Actor.cpp | 30 ++++++++++++++++++++---------- gemrb/core/Scriptable/Actor.h | 4 ++-- gemrb/core/Scriptable/CombatInfo.cpp | 5 +++++ gemrb/core/Scriptable/CombatInfo.h | 2 ++ 4 files changed, 29 insertions(+), 12 deletions(-) from 85dd538021f5ed638d1cefcc5e27987b626dd669 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=71d84f8ddfde2e16f2e734bbe3d7a582c7142f99 commit 71d84f8ddfde2e16f2e734bbe3d7a582c7142f99 Author: Jaka Kranjc <lyn...@us...> Date: Sun Jan 20 12:36:03 2013 +0100 ToHitStats: also store the BAB decrement and set it in SetBaseAPRandAB diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 312ba79..1d48c49 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -5647,6 +5647,7 @@ int Actor::SetBaseAPRandAB(bool CheckRapidShot) if (LevelSum == Modified[IE_CLASSLEVELSUM]) { // skip to apr calc, no need to check the other classes ToHit.SetBase(pBAB); + ToHit.SetBABDecrement(pBABDecrement); return BAB2APR(pBAB, pBABDecrement, CheckRapidShot); } } @@ -5667,6 +5668,7 @@ int Actor::SetBaseAPRandAB(bool CheckRapidShot) assert(LevelSum == Modified[IE_CLASSLEVELSUM]); ToHit.SetBase(pBAB); + ToHit.SetBABDecrement(pBABDecrement); return BAB2APR(pBAB, pBABDecrement, CheckRapidShot); } diff --git a/gemrb/core/Scriptable/CombatInfo.cpp b/gemrb/core/Scriptable/CombatInfo.cpp index e444c42..a46cb9f 100644 --- a/gemrb/core/Scriptable/CombatInfo.cpp +++ b/gemrb/core/Scriptable/CombatInfo.cpp @@ -199,6 +199,7 @@ void ArmorClass::dump() const ToHitStats::ToHitStats() { base = 0; + babDecrement = 0; Owner = NULL; ResetAll(); @@ -299,6 +300,10 @@ void ToHitStats::HandleFxBonus(int mod, bool permanent) } } +void ToHitStats::SetBABDecrement(int decrement) { + babDecrement = decrement; +} + void ToHitStats::dump() const { StringBuffer buffer; diff --git a/gemrb/core/Scriptable/CombatInfo.h b/gemrb/core/Scriptable/CombatInfo.h index 4c051ea..52ec317 100644 --- a/gemrb/core/Scriptable/CombatInfo.h +++ b/gemrb/core/Scriptable/CombatInfo.h @@ -99,6 +99,7 @@ public: void SetWeaponBonus(int bonus, int mod=1); void SetGenericBonus(int bonus, int mod=1); + void SetBABDecrement(int decrement); void HandleFxBonus(int mod, bool permanent); void dump() const; @@ -106,6 +107,7 @@ private: Actor *Owner; int total; // modified stat, now really containing all the boni int base; // base stat + int babDecrement; // 3ed, used for calculating the tohit value of succeeding attacks // to-hit boni int weaponBonus; http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=46c95518a4eaab290a4bae5aca8e1364fc304994 commit 46c95518a4eaab290a4bae5aca8e1364fc304994 Author: Jaka Kranjc <lyn...@us...> Date: Sun Jan 20 12:34:24 2013 +0100 Actor: renamed GetBaseAPRandAB and made it store the AB directly diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 99a6375..312ba79 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -5579,13 +5579,12 @@ int Actor::Immobile() const return 0; } -ieDword Actor::GetNumberOfAttacks() const +ieDword Actor::GetNumberOfAttacks() { int bonus = 0; if (third) { - int tmp; - int base = GetBaseAPRandAB (true, tmp); + int base = SetBaseAPRandAB (true); // add the offhand extra attack // TODO: check effects too bonus = 2 * IsDualWielding(); @@ -5617,7 +5616,7 @@ static int SetLevelBAB(int level, ieDword index) // return the base APR derived from the base attack bonus, which we have to construct here too //NOTE: this doesn't break iwd2 monsters, since they have their level stored as fighters (if not more) -int Actor::GetBaseAPRandAB(bool CheckRapidShot, int &BAB) const +int Actor::SetBaseAPRandAB(bool CheckRapidShot) { int pBAB = 0; int pBABDecrement = BaseAttackBonusDecrement; @@ -5626,7 +5625,7 @@ int Actor::GetBaseAPRandAB(bool CheckRapidShot, int &BAB) const int i; if (!third) { - BAB = BaseStats[IE_TOHIT]; + ToHit.SetBase(BaseStats[IE_TOHIT]); return 0; } @@ -5647,7 +5646,7 @@ int Actor::GetBaseAPRandAB(bool CheckRapidShot, int &BAB) const LevelSum += level; if (LevelSum == Modified[IE_CLASSLEVELSUM]) { // skip to apr calc, no need to check the other classes - BAB = pBAB; + ToHit.SetBase(pBAB); return BAB2APR(pBAB, pBABDecrement, CheckRapidShot); } } @@ -5667,7 +5666,7 @@ int Actor::GetBaseAPRandAB(bool CheckRapidShot, int &BAB) const } assert(LevelSum == Modified[IE_CLASSLEVELSUM]); - BAB = pBAB; + ToHit.SetBase(pBAB); return BAB2APR(pBAB, pBABDecrement, CheckRapidShot); } @@ -5745,8 +5744,7 @@ void Actor::InitRound(ieDword gameTime) bool Actor::GetCombatDetails(int &tohit, bool leftorright, WeaponInfo& wi, ITMExtHeader *&header, ITMExtHeader *&hittingheader, \ int &DamageBonus, int &speed, int &CriticalBonus, int &style, Actor *target) { - GetBaseAPRandAB(true, tohit); - ToHit.SetBase(tohit); + SetBaseAPRandAB(true); speed = -(int)GetStat(IE_PHYSICALSPEED); ieDword dualwielding = IsDualWielding(); header = GetWeapon(wi, leftorright && dualwielding); diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h index 83fcbbd..a962b9b 100644 --- a/gemrb/core/Scriptable/Actor.h +++ b/gemrb/core/Scriptable/Actor.h @@ -615,7 +615,7 @@ public: /* reorients to face target (for immediate attack) */ void FaceTarget(Scriptable *actor); /* returns the number of attacks (handles monk barehanded bonus) */ - ieDword GetNumberOfAttacks() const; + ieDword GetNumberOfAttacks(); /* starts combat round*/ void InitRound(ieDword gameTime); /* returns melee penalty */ @@ -853,7 +853,7 @@ public: void DisplayHeadHPRatio(); /* if Lasttarget is gone, call this */ void StopAttack(); - int GetBaseAPRandAB(bool CheckRapidShot, int &BAB) const; + int SetBaseAPRandAB(bool CheckRapidShot); int BAB2APR(int pBAB, int pBABDecrement, int CheckRapidShot) const; }; } http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=23c173af7a7eabdd80269b84bb2df578e5de56f9 commit 23c173af7a7eabdd80269b84bb2df578e5de56f9 Author: Jaka Kranjc <lyn...@us...> Date: Sun Jan 20 12:30:15 2013 +0100 Actor: in 3ed, only one attack can be made by the offhand diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index dd5b2d8..99a6375 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -6214,7 +6214,17 @@ void Actor::PerformAttack(ieDword gameTime) //which hand is used //we do apr - attacksleft so we always use the main hand first - bool leftorright = (bool) ((attacksperround-attackcount)&1); + // however, in 3ed, only one attack can be made by the offhand + bool leftorright; + if (third) { + leftorright = false; + // make only the last attack with the offhand (iwd2) + if (attackcount == 1 && IsDualWielding()) { + leftorright = true; + } + } else { + leftorright = (bool) ((attacksperround-attackcount)&1); + } WeaponInfo wi; ITMExtHeader *header = NULL; ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |