Apocalyptic Weapon Bug (Dual wield)

Fixed/closed bug reports are moved to this board in archival state. Also contains all the original bug reports from the past years.
Ricekrispies
Posts: 301

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Ricekrispies »

Vicarious wrote:
Ricekrispies wrote:Lets see how many pages of "bumps" we can get, shall we.
Bump, should be #1 in priority in bug fixes in my opinion.
Discussion must go on, else the subject might fade away..
"The greatest trick the Devil ever pulled was convincing the world he didn't exist."
User avatar
Henhouse
Administrator
Administrator
Posts: 7855
Location: Sweden
Contact:

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Henhouse »

We are well aware of the issues and bumping won't deliver us resources on our doorsteps, or give birth to a developer to come swooping in and help us. Unfortunately these things take time and a lot of patience.
Administrator - Project Lead / Server Management / Core Development
Ricekrispies
Posts: 301

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Ricekrispies »

Henhouse wrote:We are well aware of the issues and bumping won't deliver us resources on our doorsteps, or give birth to a developer to come swooping in and help us. Unfortunately these things take time and a lot of patience.
I SHALT SUMMONE THEE A DEVELOPER FROM THE INFERNAL DEPTHS OF THE TWISTING NETHER!
"The greatest trick the Devil ever pulled was convincing the world he didn't exist."
User avatar
Exsurgo
Game Master
Game Master
Posts: 558

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Exsurgo »

I just wish there was more info/resources on 2.4.3 private servers. The core coding for me is the easy part, and I can (just) about manage basic SQL. The problem is the architecture of a server is pretty complex, and I have no idea how to test stuff. I have a server but I don't know how to spawn target dummies and players with gear, and therefore I have no idea how I can test any code changes I write. I have had zero luck finding one nice big list of server/admin commands that lets me do this stuff and I do not have the time to just use trial and error.
Retired Developer.
User avatar
Exsurgo
Game Master
Game Master
Posts: 558

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Exsurgo »

Could I get a link the the current Unit.cpp that SF currently uses?

I think this issue can be solved by a simple conditional statement and addition operation, but I can't say for sure until I know what version of the file that we use.

Assuming we use the oldish style Unit.cpp file we need to modify the hit chance by a simple -19 for dual wield attacks.

This should be solvable by something like:

if (haveOffhandWeapon() && !spellId)

hitChance = hitChance - 19.0f;


This will add a dual wield penalty providing the character is dual wielding and the damage type is non-special.
If I can see what the current file looks like this could be tidied up by being mergedf into the current conditional operator.
Retired Developer.
User avatar
Henhouse
Administrator
Administrator
Posts: 7855
Location: Sweden
Contact:

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Henhouse »

Did you just say you understand the code, but you do not understand how to do any of the GM stuff?

That's like saying you can write your doctorate dissertation thesis, but not read a newspaper. O_o


If you need any help with that, let me know. I have a private VPS server at my disposal if you want to use a Linux server to compile, edit stuff, etc. for development.

As for linking the Unit.cpp I doubt ours is very much different. All our changes are private but ~100 changes in 2 million lines of code is merely like a grain of sand to the entire source code.

We're based off of https://github.com/ProjectSkyfire/SkyFire_one which was taken from OregonCore. They just did some nice improvements, and structured the files like Trinity. That would be the best thing to use since it is closest to us and I can apply pretty much anything from it.
Administrator - Project Lead / Server Management / Core Development
User avatar
Deems
Posts: 1508
Location: Wonderland

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Deems »

Henhouse wrote: That's like saying you can write your doctorate dissertation thesis, but not read a newspaper. O_o
I don't know. A better comparison would be front end vs. back end web developers. Front end might not have a clue what happens at the back end and vice versa.
Google [Bot]
Gregoriano
Posts: 109

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Gregoriano »

I might have 3 possible solutions(A,B and C):
A. Assuming the function:

Code: Select all

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType) const
is called only for auto attacks(which I'm unsure of). You can just revert the change and use the old function "MeleeMissChanceCalc"(which contains the dual wield penalty check) rather than "MeleeSpellMissChance". So it would look like this:

Code: Select all

float miss_chance = MeleeMissChanceCalc(pVictim, attType);
//float miss_chance = MeleeSpellMissChance(pVictim, attType, int32(GetWeaponSkillValue(attType, pVictim)) - int32(pVictim->GetDefenseSkillValue(this)), 0);
rather than current:

Code: Select all

//float miss_chance = MeleeMissChanceCalc(pVictim, attType);
float miss_chance = MeleeSpellMissChance(pVictim, attType, int32(GetWeaponSkillValue(attType, pVictim)) - int32(pVictim->GetDefenseSkillValue(this)), 0);
However, I suspect that the developer intended to stop using the "MeleeMissChanceCalc"(it isn't called anywhere I think) function altogether, but he forgot that the "MeleeSpellMissChance" doesn't check for dual wield. So maybe it is better to add such check to that function instead.
so - B. and C.
In function:

Code: Select all

float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
after the line:

Code: Select all

float miss_chance= 100.0f - HitChance;
B. add the exact same code from "MeleeMissChanceCalc" which did the job done.

Code: Select all

// DualWield - white damage has additional 19% miss penalty
    if (haveOffhandWeapon() && attType != RANGED_ATTACK)
    {
        bool isNormal = false;
        for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
        {
            if (m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL))
            {
                isNormal = true;
                break;
            }
        }
        if (!isNormal && !m_currentSpells[CURRENT_MELEE_SPELL])
            miss_chance+= 19.0f;
    }
or C. assuming "uint32 spellId" always equals zero ONLY for auto attack - something simpler then:

Code: Select all

// DualWield - white damage has additional 19% miss penalty
    if (haveOffhandWeapon() && attType != RANGED_ATTACK && !spellId)
       miss_chance+= 19.0f;
Gnomecore
User avatar
Deems
Posts: 1508
Location: Wonderland

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Deems »

Image
Google [Bot]
User avatar
Exsurgo
Game Master
Game Master
Posts: 558

Re: Apocalyptic Weapon Bug (Dual wield)

Post by Exsurgo »

MeleeMissChanceCalc is a strange function that never gets called (The function call is commented out). I have checked the Trinity and Oregon Core Files and it was commented out in them also. So we might aswell ignore this anomaly and concentrate on the standard MeleeSpellMissChance function.
Gregoriano wrote: A. Assuming the function:

Code: Select all

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType) const
is called only for auto attacks(which I'm unsure of). You can just revert the change and use the old function "MeleeMissChanceCalc"(which contains the dual wield penalty check) rather than "MeleeSpellMissChance". So it would look like this:
So as I said above, I think MeleeSpellMissChance is actually the old function and MeleeMissChanceCalc is the new unused function. What is interesting is the WOTLK 3.3.5a core uses the original MeleeSpellMissChance, so I am reasonably confident it is the proper function to work on.
Now from what I see, MeleeSpellMissChance is used for all melee attacks (both auto and special attacks). This can be inferred from the description in the wrath client and also the work spell.

Code: Select all

// Melee based spells can be miss, parry or dodge on this step
// Crit or block - determined on damage calculation phase! (and can be both in some time)
float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, uint32 spellId) const
{
I propose that the current function MeleeSpellMissChance is ammended as below:
(This can literally be pasted in untop of the old function)

Code: Select all

// Melee based spells can be miss, parry or dodge on this step
// Crit or block - determined on damage calculation phase! (and can be both in some time)
float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
{
    // Calculate hit chance (more correct for chance mod)
    float HitChance = 0.0f;

    // PvP - PvE melee chances
    if (pVictim->GetTypeId() == TYPEID_PLAYER)
        HitChance = 95.0f + skillDiff * 0.04f;
    else if (skillDiff < -10)
        HitChance = 93.0f + (skillDiff + 10) * 0.4f;        // 7% base chance to miss for big skill diff (%6 in 3.x)
    else
        HitChance = 95.0f + skillDiff * 0.1f;

	//If attacker is dual-wielding and not ranged + not special attack
	if (haveOffhandWeapon() && attType != RANGED_ATTACK && !spellId)
	{
		//-19% hit penalty for dual wield
		hitChance  -= 19.0f;
	}

    // Hit chance depends from victim auras
    if (attType == RANGED_ATTACK)
        HitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
    else
        HitChance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);

    // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
    if (spellId)
    {
        if (Player *modOwner = GetSpellModOwner())
            modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, HitChance);
    }

    // Miss = 100 - hit
    float miss_chance= 100.0f - HitChance;


    // Bonuses from attacker aura and ratings
    if (attType == RANGED_ATTACK)
        miss_chance -= m_modRangedHitChance;
    else
        miss_chance -= m_modMeleeHitChance;

    // bonus from skills is 0.04%
    //miss_chance -= skillDiff * 0.04f;
    int32 diff = -skillDiff;
    if (pVictim->GetTypeId() == TYPEID_PLAYER)
        miss_chance += diff > 0 ? diff * 0.04 : diff * 0.02;
    else
        miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4 : diff * 0.1;

    // Limit miss chance from 0 to 60%
    if (miss_chance < 0.0f)
        return 0.0f;
    if (miss_chance > 60.0f)
        return 60.0f;
    return miss_chance;
}

They key change is below:

Code: Select all


//If attacker is dual-wielding and not ranged + not special attack
	if (haveOffhandWeapon() && attType != RANGED_ATTACK && !spellId)
	{
		//-19% hit penalty for dual wield
		hitChance  -= 19.0f;
	}

This should ensure that only non-special non ranged dual wield attacks suffer the dual wield penalty. We wouldnt want hunters gimped by the change. Also if the change is made we really need to extensivly test the results in recount to ensure everything is working as intended.

And Deems is 100% right about the front end vs back-end stuff. I look at a file and figure out how it works. There are hundreds of files and I have not come across anything with commands/scripts yet (although I may in the future :)

And about Linux...I suck at Linux, I only used a little of it at Uni for cluster/parallel computing so I honestly should get round to improving my skills with it. For now I am going to compile/build and get my own Skyfire core working and take things from there :)

Any useful files I should look at Henhouse to learn a bit more about GM/admin scripting etc?
Last edited by Exsurgo on 07 Feb 2013, 16:28, edited 1 time in total.
Retired Developer.
Locked

Who is online

Users browsing this forum: No registered users and 1 guest