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!

Proper GMS ALike Mob Healing

Status
Not open for further replies.
Elite Diviner
Joined
Apr 7, 2008
Messages
494
Reaction score
66
MapleMonster

Find :

Code:
public void heal(int hp, int mp) {
        int l_hp = getHp() + hp;
        if (l_hp > getMaxHp()) {
            l_hp = getMaxHp();
        }
        int l_mp = getMp() + mp;
        if (l_mp > getMaxMp()) {
            l_mp = getMaxMp();
        }
        
        setHp(l_hp);
        setMp(l_mp);
        
        getMap().broadcastMessage(MaplePacketCreator.healMonster(getObjectId(), hp));
    }

Replace :

Code:
 public void skillHeal(int healHp, int healRange) {
        int pMin = (healHp - (healRange / 2));
        int pMax = (healHp + (healRange / 2));
        int pAmount = Randomizer.getInstance().nextInt(pMin, pMax);
        int pOriginal = pAmount;
        int mHp = getMaxHp();
        int mTotalHp = getHp() + getMaxHp();
        
        if (mHp + pAmount > getMaxHp()) {
            pAmount = getMaxHp() - hp;
            mHp = getMaxHp();
        } else {
            mHp += pAmount;
        }       
        
        mTotalHp += pAmount;


        getMap().broadcastMessage(MaplePacketCreator.healMonster(getObjectId(), pOriginal));
    }


Randomizer

Code:
 public int nextInt(int min, int max) {
    	callRandom();
        int randomNum = rand.nextInt((max - min) + 1) + min;
        return randomNum;
    }

Tested On ShooootSource v75

Bye. :thumbup:
 
Last edited:
Status
Not open for further replies.
Back
Top