Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[All Versions] [Add on] Fix for Ninja Ambush

Joined
Nov 27, 2009
Messages
442
Reaction score
230
The title may be a bit misleading, since I don't know if the Damage Calculations have changed because of Big Bang. Anyways, players in the server I work for were complaining that Ninja Ambush was all fucked up, which is pretty much true due to the face that the Dmg. Calculation were never completed) Since I don't really contribute anything, I've released this. Now you no longer need to hear from your players that Ninja Ambush is all messed up :thumbup1:!

P.S: If any other developers have an idea on how to improve my code/simplify it, please post. Constructive criticism is allowed!



In MapleStatEffect replace/add:
PHP:
 case NightLord.NINJA_AMBUSH:
                case Shadower.NINJA_AMBUSH:
                    monsterStatus.put(MonsterStatus.NINJA_AMBUSH, Integer.valueOf(ret.damage));
                    break;

In AbstractDealDamageHandler add:
PHP:
if (attack.skill == NightLord.NINJA_AMBUSH || attack.skill == Shadower.NINJA_AMBUSH) {
                        ISkill skill = SkillFactory.getSkill(attack.skill);
                        for (int i = 0; i < attackCount; i++) {
                            if (monster != null) {
                                monster.applyStatus(player, new MonsterStatusEffect(Collections.singletonMap(MonsterStatus.NINJA_AMBUSH, 1), skill, false), false, skill.getEffect(player.getSkillLevel(skill)).getDuration(), false);
                            }
                        }
                        player.getClient().getSession().write(MaplePacketCreator.enableActions());
                    }

In MapleMonster add somewhere in the applyStatus function:
PHP:
} else if (status.getSkill().getId() == NightLord.NINJA_AMBUSH || status.getSkill().getId() == Shadower.NINJA_AMBUSH) {
                    ISkill skill = SkillFactory.getSkill(status.getSkill().getId());
                    final int damage = (int) (((from.getStr() + from.getLuk()) * (skill.getEffect(from.getSkillLevel(skill)).getDamage())) / 200); // Forumla from Fiel
                    if (getHp() - damage <= 1)  {
                        return false;
                    }
                    status.setValue(MonsterStatus.NINJA_AMBUSH, damage);
                    //from.getMap().damageMonster(from, this, damage);
                    // Wtf do we really need a Timer?
                    status.setPoisonSchedule(timerManager.schedule(new PoisonTask(damage, from, status, cancelTask, false), skill.getEffect(from.getSkillLevel(skill)).getDuration()));
                    System.out.println(damage);


Some Notes/Credits:
(Even though I diddn't define it in SpecialMoveHandler, Moogra did give me a hint on how to handle it.)
Depending on how you handle it, this could be either correct or incorrect. Currently it would just display 100 at max. Anyways to make it deal damage take a look at specialmovehandler (use packets) or edit something to do with monsterstatus in maplemonster

(Credits to Fiel for Damage Calculations, even though it might not be the Exact Formula as Fiel's since I suck at math :eek:tt1:)
I figured it out with a few tests:

floor((STR + LUK) * (1.5 + (skillLevel * 0.05)) * damage%)



Screenshot:
Expedia - [All Versions] [Add on] Fix for Ninja Ambush - RaGEZONE Forums
 
Last edited:
Legendary Battlemage
Joined
Mar 30, 2009
Messages
672
Reaction score
676
The add-on to AbstractDealDamageHandler should already have a check for a null monster
(unless your checking just in case the monster dies while the skill is still running), other than that everything seems good.
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
why don't you just use monster.isAlive() instead of == true?
either way it still gonna return true with either two ways since is a boolean o_O
 
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
@iAkira
But since its a boolean, it is better to use monster.isAlive() than defining it true again.
 
Joined
Nov 27, 2009
Messages
442
Reaction score
230
either way it still gonna return true with either two ways since is a boolean o_O

It doesn't matter. It's all about user preference, the VERY SMALL difference from monster.isAlive() == true and monster.isAlive() isn't even noticeable.

Anyways, about all the unadded checks, I was mainly working on the Damage Calculation which was the main goal. You can edit the release to where it's anti hackish or w/e.
 
Newbie Spellweaver
Joined
Feb 19, 2010
Messages
82
Reaction score
14
for hackers or mobs like HT stones might wanna use this

if (monster != null && monster.isAlive() == true) {

I'm pretty sure the null check is already there and you never need the alive check unless someone is really good at packet editing.

It doesn't matter. It's all about user preference, the VERY SMALL difference from monster.isAlive() == true and monster.isAlive() isn't even noticeable.

I think the default by java is that it fills each boolean with
boolean != false so it won't do anything different.
 
Custom Title Activated
Loyal Member
Joined
Mar 17, 2009
Messages
1,911
Reaction score
538
Thanks Kev. Bitches stop complaining :(
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
God(iAkira):Good job my son(Expedia), I love these new conflicts of calculations that not even I can come up with, amazing delightful equation/job. (FAIL as Godzz)
 
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
Btw expedia, when i added this, it deals damage, but mobs don't die..o_O..
 
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
You mean the damage dealt must be lesser than the mob's hp?
 
Joined
Nov 27, 2009
Messages
442
Reaction score
230
You mean the damage dealt must be lesser than the mob's hp?

In GMS, the Ninjas keep attacking until their duration runs out OR the monster reaches a certain HP (1 in this case). My if statement checks if the total damage - the monsters current HP is less than 1, it'll return.

Anyways, about your 'Not Dealing Damage' problem, I'll look into it later. Busy finishing up families right now :tongue:
 
Back
Top