(Monk Skill) Triple Attack Problem

09/17/2011 14:03 HerpDerpNigga#1
I am having problem with Triple Attack whenever activates it counts as 3 kills, not just 1, so if my pheasant drops 5 cps, and this skill activates it gives me 15 cps by one hit instead of 5 cps...does anyone see something wrong into this code?
I think the problem is at those 2 red lines I just highlighted...

Code:
case 10490:
                                    {
                                        if (CanUseSpell(spell, attacker.Owner))
                                        {
                                            PrepareSpell(spell, attacker.Owner);

                                            SpellUse suse = new SpellUse(true);
                                            suse.Attacker = attacker.UID;
                                            suse.SpellID = spell.ID;
                                            suse.SpellLevel = spell.Level;
                                            suse.X = X;
                                            suse.Y = Y;

                                            if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
                                            {
                                                if (attackedsob != null)
                                                {
                                                    if (CanAttack(attacker, attackedsob, spell))
                                                    {
                                                        PrepareSpell(spell, attacker.Owner);
                                                        suse.MakeConst();
                                                        [B][COLOR="Red"]for (uint c = 0; c < 3; c++)[/COLOR][/B]
                                                        {
                                                            uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob);
                                                            if (damage > attackedsob.Hitpoints)
                                                                damage = attackedsob.Hitpoints;

                                                            ReceiveAttack(attacker, attackedsob, attack, damage, spell);

                                                            suse.Targets.Add(attackedsob.UID + c, damage);
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
                                                    {
                                                        PrepareSpell(spell, attacker.Owner);
                                                        suse.MakeConst();
                                                        [B][COLOR="red"]for (uint c = 0; c < 3; c++)[/COLOR][/B]
                                                        {
                                                            uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell);
                                                            if (damage > attacked.Hitpoints)
                                                                damage = attacked.Hitpoints;
                                                            damage = ReceiveAttack(suse, attacker, attacked, attack, damage, spell);

                                                            suse.Targets.Add(attacked.UID + c, damage);
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                attacker.AttackPacket = null;
                                            }
                                            attacker.Owner.Screen.SendScreen(suse, true);
                                        }
                                        break;
                                    }
09/17/2011 14:12 BaussHacker#2
Well it's supposed to attack 3 times, make a check where the mob dies, if it's already dead.

If (Mob.IsDead)
return;

It's most likely something like that you have forgot and because you don't have a check like that it will kill the same mob all 3 times.
09/17/2011 21:06 pro4never#3
I think my system for it may actually be a bit better...

What I do is I do a Target structure which contains target uid, damage dealt and a hit bool as well as an option for activation type/effect for refineries.

I create a list of those and instead of performing the attack inside the spell handler I simply add valid targets with correct damage and refinery effects to the targeting list.

Then at the END of all the targeting I say "ok, lets take all these targets and perform these actions on them and send the final spell display packet!".

In my DealDamage method I don't let the target take damage if it's already dead.

This solves the problem AND will make triple attack still display correctly (cause even if they die it should still be hitting all 3 attacks should it not?)


It's not pretty but here's an example of my struct and implementation

Code:
public struct Targ
        {
            public Targ(Entity target, int dmg, bool hit = true, uint activType = 0, uint activValue = 0)
            {
                Who = target;
                Dmg = dmg;
                Hit = hit;
                ActivationType = activType;
                ActivationValue = activValue;
            }
            public Entity Who;
            public int Dmg;
            public bool Hit;
            public uint ActivationType;
            public uint ActivationValue;
        }
Fill in the values during your targeting method annnddd...

if (SpellTargets.Count > 0)
foreach (Targ t in SpellTargets)
DealDamage(packet, user, t.Who, (uint)t.Dmg);

Something like that + lots of other checks ususally.
09/17/2011 21:45 HerpDerpNigga#4
Thanks both of you, gonna try and see what I will done lol.
09/19/2011 13:02 m7mdxlife#5
Quote:
Originally Posted by pro4never View Post
in your source monsters gets confused and refuse to die, and i think if a monsters die from the 1st hit of the triple attack the dmg shouldn't show up, however the char should do the triple attack effect/movement
09/19/2011 14:55 pro4never#6
Actually monsters do not exist in the source I released. You're supposed to add their related systems yourself. I wish ppl would stop claiming things about it that simply are irrelevant.
09/19/2011 15:04 m7mdxlife#7
Quote:
Originally Posted by pro4never View Post
Actually monsters do not exist in the source I released. You're supposed to add their related systems yourself. I wish ppl would stop claiming things about it that simply are irrelevant.
was referring to hellmouthco server you got running bro, i know its beta but still...

P.S: rolling back to before the wipe was a mean thing to do
09/19/2011 17:29 { Angelius }#8
first thing the trip attack skill does not hit 3 times ALL THE TIME it depends on the skill level .

and you dont recalculate the damage for each hit and send the whole damage amount you are gonna have to split it and give it a damage % depending on the skill level

number 2 TQ has something that works as a multi attack packet IE scatter/fire of hell/trip attack/ etc so the packet should look something like this for the trip attack

Quote:
UInt16(length, 0, Buffer);
UInt16(1105, 2, Buffer);
UInt32(AttackerUID, 4, Buffer);
UInt32(AttackedUID, 8, Buffer);
UInt16(S.ID, 12, Buffer);
UInt16(S.Level, 14, Buffer);
UInt32(hitsCount, 16, Buffer);

UInt32(AttackedUID, 20, Buffer); > 0 = first hit
UInt32(Dmg, 24, Buffer); if data 20 > 0 damage is required or its gonna miss with the miss effect
UInt32(AttackedUID, 52, Buffer); > 0 = 2nd hit
UInt32(Dmg, 56, Buffer); if data 52 > 0 damage is required or its gonna miss with the miss effect
UInt32(AttackedUID, 84, Buffer); > 0 = 3rd hit
UInt32(Dmg, 88, Buffer); if data 84 > 0 damage is required or its gonna miss with the miss effect
simply you need to recode the skill/the skill use packet

oh and btw as long as your ReceiveAttack void is killing the target 3 times you will get cps 3 times . so you better find another way to handle the skill

good luck
09/19/2011 18:15 pro4never#9
Quote:
Originally Posted by m7mdxlife View Post
was referring to hellmouthco server you got running bro, i know its beta but still...

P.S: rolling back to before the wipe was a mean thing to do
Hellmouth.is considered shut down till staff have time to work on it. We've been over thiis w. Users a few times leave this thread on topic