Search in sources :

Example 1 with MapleMonster

use of server.life.MapleMonster in project HeavenMS by ronancpl.

the class MapleCharacter method Hide.

public void Hide(boolean hide, boolean login) {
    if (isGM() && hide != this.hidden) {
        if (!hide) {
            this.hidden = false;
            announce(MaplePacketCreator.getGMEffect(0x10, (byte) 0));
            List<MapleBuffStat> dsstat = Collections.singletonList(MapleBuffStat.DARKSIGHT);
            getMap().broadcastGMMessage(this, MaplePacketCreator.cancelForeignBuff(id, dsstat), false);
            getMap().broadcastMessage(this, MaplePacketCreator.spawnPlayerMapObject(this), false);
            for (MapleSummon ms : this.getSummonsValues()) {
                getMap().broadcastNONGMMessage(this, MaplePacketCreator.spawnSummon(ms, false), false);
            }
            updatePartyMemberHP();
        } else {
            this.hidden = true;
            announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
            if (!login) {
                getMap().broadcastMessage(this, MaplePacketCreator.removePlayerFromMap(getId()), false);
            }
            getMap().broadcastGMMessage(this, MaplePacketCreator.spawnPlayerMapObject(this), false);
            List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
            getMap().broadcastGMMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
            for (MapleMonster mon : this.getControlledMonsters()) {
                mon.setController(null);
                mon.setControllerHasAggro(false);
                mon.setControllerKnowsAboutAggro(false);
                mon.getMap().updateMonsterController(mon);
            }
        }
        announce(MaplePacketCreator.enableActions());
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MapleSummon(server.maps.MapleSummon) MapleMonster(server.life.MapleMonster) Pair(tools.Pair)

Example 2 with MapleMonster

use of server.life.MapleMonster in project HeavenMS by ronancpl.

the class MCBattlefield method addSpawn.

public void addSpawn(Player chr, int num) {
    if (numMonstersSpawned > wzData.mobGenMax) {
        chr.getClient().announce(CarnivalPackets.CarnivalMessage(3));
        return;
    }
    MCWZData.MCSummonMob mobToSummon = wzData.summons.get(num);
    MCWZData.MCMobGenPos spawnPos = getRandomSpawnPos(chr.getMCPQTeam());
    MCField.MCTeam team = chr.getMCPQTeam();
    if (spawnPos == null) {
        chr.getClient().announce(CarnivalPackets.CarnivalMessage(2));
        return;
    }
    int spendCp = mobToSummon.spendCP;
    if (spendCp > chr.getAvailableCP()) {
        readdSpawn(spawnPos, team);
        chr.getClient().announce(CarnivalPackets.CarnivalMessage(1));
        return;
    }
    chr.getMCPQField().loseCP(chr, spendCp);
    this.map.broadcastMessage(CarnivalPackets.PlayerSummoned(MonsterCarnival.TAB_SPAWNS, num, chr.getName()));
    // TODO: AtomicInteger this
    numMonstersSpawned++;
    MapleMonster monster = MapleLifeFactory.getMonster(mobToSummon.id);
    Point pos = new Point(spawnPos.x, spawnPos.y);
    SpawnPoint sp = new SpawnPoint(monster, pos, mobToSummon.mobTime, chr.getTeam());
    addedSpawns.add(sp);
    updateMonsterBuffs();
}
Also used : MCTeam(server.partyquest.mcpq.MCField.MCTeam) MCMobGenPos(server.partyquest.mcpq.MCWZData.MCMobGenPos) SpawnPoint(server.life.SpawnPoint) SpawnPoint(server.life.SpawnPoint) SpawnPoint(server.life.SpawnPoint) MapleMonster(server.life.MapleMonster)

Example 3 with MapleMonster

use of server.life.MapleMonster in project HeavenMS by ronancpl.

the class MCBattlefield method updateMonsterBuffs.

private void updateMonsterBuffs() {
    List<MCGuardian> redGuardians = new ArrayList<>();
    List<MCGuardian> blueGuardians = new ArrayList<>();
    for (MCGuardian g : this.redReactors.values()) {
        redGuardians.add(g);
        if (MonsterCarnival.DEBUG) {
            System.out.println("update buff red " + g.getMobSkillID());
        }
    }
    for (MCGuardian g : this.blueReactors.values()) {
        blueGuardians.add(g);
        if (MonsterCarnival.DEBUG) {
            System.out.println("update buff blue " + g.getMobSkillID());
        }
    }
    for (FieldObject mmo : map.getAllMonsters()) {
        if (mmo.getType() == FieldObjectType.MONSTER) {
            MapleMonster mob = ((MapleMonster) mmo);
            mob.dispel();
            if (mob.getTeam() == MCField.MCTeam.RED.code) {
                applyGuardians(mob, redGuardians);
            } else if (mob.getTeam() == MCField.MCTeam.BLUE.code) {
                applyGuardians(mob, blueGuardians);
            } else {
                MCTracker.log("[MCPQ] Attempting to give guardians to mob without team.");
            }
        }
    }
}
Also used : FieldObject(server.maps.FieldObject) ArrayList(java.util.ArrayList) MapleMonster(server.life.MapleMonster)

Example 4 with MapleMonster

use of server.life.MapleMonster in project HeavenMS by ronancpl.

the class MCBattlefield method spawningTask.

public void spawningTask() {
    for (SpawnPoint sp : originalSpawns) {
        if (sp.shouldSpawn()) {
            MapleMonster mob = sp.spawnMonster(this.map);
            giveMonsterBuffs(mob);
        }
    }
    for (SpawnPoint sp : addedSpawns) {
        if (sp.shouldSpawn()) {
            MapleMonster mob = sp.spawnMonster(this.map);
            giveMonsterBuffs(mob);
        }
    }
}
Also used : SpawnPoint(server.life.SpawnPoint) MapleMonster(server.life.MapleMonster)

Example 5 with MapleMonster

use of server.life.MapleMonster in project HeavenMS by ronancpl.

the class MobDamageMobFriendlyHandler method handlePacket.

@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    int attacker = slea.readInt();
    slea.readInt();
    int damaged = slea.readInt();
    MapleMonster monster = c.getPlayer().getMap().getMonsterByOid(damaged);
    if (monster == null || c.getPlayer().getMap().getMonsterByOid(attacker) == null) {
        return;
    }
    // Beng's formula.
    int damage = Randomizer.nextInt(((monster.getMaxHp() / 13 + monster.getPADamage() * 10)) * 2 + 500) / 10;
    if (monster.getHp() - damage < 1) {
        // friendly dies
        if (monster.getId() == 9300102) {
            monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "The Watch Hog has been injured by the aliens. Better luck next time..."));
        } else if (monster.getId() == 9300061) {
            // moon bunny
            monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "The Moon Bunny went home because he was sick."));
        } else if (monster.getId() == 9300093) {
            // tylus
            monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Tylus has fallen by the overwhelming forces of the ambush."));
        } else if (monster.getId() == 9300137) {
            // juliet
            monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Juliet has fainted on the middle of the combat."));
        } else if (monster.getId() == 9300138) {
            // romeo
            monster.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, "Romeo has fainted on the middle of the combat."));
        }
        c.getPlayer().getMap().killFriendlies(monster);
    } else {
        if (monster.getId() == 9300061) {
            MapleMap map = c.getPlayer().getEventInstance().getMapInstance(monster.getMap().getId());
            map.addBunnyHit();
        }
    }
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.MobDamageMobFriendly(monster, damage), monster.getPosition());
    c.announce(MaplePacketCreator.enableActions());
}
Also used : MapleMap(server.maps.MapleMap) MapleMonster(server.life.MapleMonster)

Aggregations

MapleMonster (server.life.MapleMonster)37 Point (java.awt.Point)20 MapleCharacter (client.MapleCharacter)15 SpawnPoint (server.life.SpawnPoint)13 ArrayList (java.util.ArrayList)9 MapleMapObject (server.maps.MapleMapObject)9 MapleMap (server.maps.MapleMap)7 Skill (client.Skill)6 MapleStatEffect (server.MapleStatEffect)6 MonsterStatusEffect (client.status.MonsterStatusEffect)5 Item (client.inventory.Item)4 SQLException (java.sql.SQLException)4 Rectangle (java.awt.Rectangle)3 IOException (java.io.IOException)3 UnknownHostException (java.net.UnknownHostException)3 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 MapleItemInformationProvider (server.MapleItemInformationProvider)3 MobSkill (server.life.MobSkill)3 MapleMapItem (server.maps.MapleMapItem)3