Search in sources :

Example 1 with MapleSnowball

use of server.events.gm.MapleSnowball in project HeavenMS by ronancpl.

the class SnowballHandler method handlePacket.

public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    // D3 00 02 00 00 A5 01
    MapleCharacter chr = c.getPlayer();
    MapleMap map = chr.getMap();
    final MapleSnowball snowball = map.getSnowball(chr.getTeam());
    final MapleSnowball othersnowball = map.getSnowball(chr.getTeam() == 0 ? (byte) 1 : 0);
    int what = slea.readByte();
    if (snowball == null || othersnowball == null || snowball.getSnowmanHP() == 0)
        return;
    if ((System.currentTimeMillis() - chr.getLastSnowballAttack()) < 500)
        return;
    if (chr.getTeam() != (what % 2))
        return;
    chr.setLastSnowballAttack(System.currentTimeMillis());
    int damage = 0;
    if (what < 2 && othersnowball.getSnowmanHP() > 0)
        damage = 10;
    else if (what == 2 || what == 3) {
        if (Math.random() < 0.03)
            damage = 45;
        else
            damage = 15;
    }
    if (what >= 0 && what <= 4)
        snowball.hit(what, damage);
}
Also used : MapleMap(server.maps.MapleMap) MapleSnowball(server.events.gm.MapleSnowball) MapleCharacter(client.MapleCharacter)

Example 2 with MapleSnowball

use of server.events.gm.MapleSnowball in project HeavenMS by ronancpl.

the class MapleMap method startEvent.

public void startEvent(final MapleCharacter chr) {
    if (this.mapid == 109080000 && getCoconut() == null) {
        setCoconut(new MapleCoconut(this));
        coconut.startEvent();
    } else if (this.mapid == 109040000) {
        chr.setFitness(new MapleFitness(chr));
        chr.getFitness().startFitness();
    } else if (this.mapid == 109030101 || this.mapid == 109030201 || this.mapid == 109030301 || this.mapid == 109030401) {
        chr.setOla(new MapleOla(chr));
        chr.getOla().startOla();
    } else if (this.mapid == 109020001 && getOx() == null) {
        setOx(new MapleOxQuiz(this));
        getOx().sendQuestion();
        setOxQuiz(true);
    } else if (this.mapid == 109060000 && getSnowball(chr.getTeam()) == null) {
        setSnowball(0, new MapleSnowball(0, this));
        setSnowball(1, new MapleSnowball(1, this));
        getSnowball(chr.getTeam()).startEvent();
    }
}
Also used : MapleCoconut(server.events.gm.MapleCoconut) MapleOxQuiz(server.events.gm.MapleOxQuiz) MapleSnowball(server.events.gm.MapleSnowball) MapleFitness(server.events.gm.MapleFitness) MapleOla(server.events.gm.MapleOla)

Aggregations

MapleSnowball (server.events.gm.MapleSnowball)2 MapleCharacter (client.MapleCharacter)1 MapleCoconut (server.events.gm.MapleCoconut)1 MapleFitness (server.events.gm.MapleFitness)1 MapleOla (server.events.gm.MapleOla)1 MapleOxQuiz (server.events.gm.MapleOxQuiz)1 MapleMap (server.maps.MapleMap)1