forked from teamnwah/openmw-tes3coop
Fixed error in deciding type of attack
This commit is contained in:
parent
21e249cb92
commit
4256e151b1
1 changed files with 3 additions and 5 deletions
|
@ -689,16 +689,14 @@ ESM::Weapon::AttackType chooseBestAttack(const ESM::Weapon* weapon, MWMechanics:
|
||||||
int chop = (weapon->mData.mChop[0] + weapon->mData.mChop[1])/2;
|
int chop = (weapon->mData.mChop[0] + weapon->mData.mChop[1])/2;
|
||||||
int thrust = (weapon->mData.mThrust[0] + weapon->mData.mThrust[1])/2;
|
int thrust = (weapon->mData.mThrust[0] + weapon->mData.mThrust[1])/2;
|
||||||
|
|
||||||
float total = static_cast<float>(slash + chop + thrust);
|
float roll = Misc::Rng::rollClosedProbability() * (slash + chop + thrust);
|
||||||
|
if(roll <= slash)
|
||||||
float roll = Misc::Rng::rollClosedProbability();
|
|
||||||
if(roll <= (slash/total))
|
|
||||||
{
|
{
|
||||||
movement.mPosition[0] = (Misc::Rng::rollClosedProbability() < 0.5f) ? 1.0f : -1.0f;
|
movement.mPosition[0] = (Misc::Rng::rollClosedProbability() < 0.5f) ? 1.0f : -1.0f;
|
||||||
movement.mPosition[1] = 0;
|
movement.mPosition[1] = 0;
|
||||||
attackType = ESM::Weapon::AT_Slash;
|
attackType = ESM::Weapon::AT_Slash;
|
||||||
}
|
}
|
||||||
else if(roll <= (slash + (thrust/total)))
|
else if(roll <= (slash + thrust))
|
||||||
{
|
{
|
||||||
movement.mPosition[1] = 1;
|
movement.mPosition[1] = 1;
|
||||||
attackType = ESM::Weapon::AT_Thrust;
|
attackType = ESM::Weapon::AT_Thrust;
|
||||||
|
|
Loading…
Reference in a new issue