Search in sources :

Example 1 with Player

use of client.player.Player in project HeavenMS by ronancpl.

the class MCField method onItemPickup.

/**
 * Handles a player looting an item.
 *   [MENTION=2000183830]para[/MENTION]m player Player that picked up the object.
 *   [MENTION=2000183830]para[/MENTION]m mapitem Object picked up.
 *
 *   [MENTION=850422]return[/MENTION] True if pickup was successful, false otherwise.
 */
public boolean onItemPickup(Player player, FieldItem mapitem) {
    if (mapitem == null) {
        MCTracker.log("[MCPQ] Attempting to loot null object.");
        return false;
    }
    int itemid = mapitem.getItem().getItemId();
    if (!MonsterCarnival.isCPQConsumeItem(itemid)) {
        return false;
    }
    MCParty pty = player.getMCPQParty();
    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    MapleStatEffect itemEffect = ii.getItemEffect(itemid);
    if (!itemEffect.isConsumeOnPickup()) {
        return false;
    }
    if (itemEffect.isParty()) {
        for (Player chr : pty.getMembers()) {
            if (chr.getStat().getCurrentHp() > 0) {
                itemEffect.applyTo(chr);
            }
        }
    } else {
        // Single Target Item
        itemEffect.applyTo(player);
    }
    // Status items
    if (itemEffect.getNuffSkill() != -1) {
        MCSkill debuff = MCSkillFactory.getMCSkill(itemEffect.getNuffSkill());
        if (debuff == null) {
            MCTracker.log("[MCPQ] debuff skill is null " + itemEffect.getNuffSkill());
            return false;
        }
        pty.getEnemy().applyMCSkill(debuff);
    }
    if (itemEffect.getCP() > 0) {
        this.gainCP(player, itemEffect.getCP());
    }
    return true;
}
Also used : Player(client.player.Player) MapleStatEffect(server.MapleStatEffect) MapleItemInformationProvider(server.itens.MapleItemInformationProvider)

Example 2 with Player

use of client.player.Player in project HeavenMS by ronancpl.

the class MCParty method deregisterPlayers.

/**
 * Resets MCPQ variables for all characters in the party.
 * Unlike updatePlayers, this method DOES warp players to the lobby map.
 */
public void deregisterPlayers() {
    for (Player chr : getMembers()) {
        MCParty.deregisterPlayer(chr);
        chr.changeMap(MonsterCarnival.MAP_EXIT);
    }
}
Also used : Player(client.player.Player)

Example 3 with Player

use of client.player.Player in project HeavenMS by ronancpl.

the class MCParty method applyMCSkill.

/**
 * Applies a MCSkill to the entire team. This is used on the team's own players
 * because it is called when the enemy team uses a debuff/cube of darkness.
 * [MENTION=2000183830]para[/MENTION]m skill Skill to apply.
 * [MENTION=850422]return[/MENTION] True if skill was applied, false otherwise.
 */
public boolean applyMCSkill(MCSkill skill) {
    MobSkill s = MobSkillFactory.getMobSkill(skill.getMobSkillID(), skill.getLevel());
    Disease disease = Disease.getType(skill.getMobSkillID());
    if (disease == null) {
        disease = Disease.DARKNESS;
        // HACK: darkness
        s = MobSkillFactory.getMobSkill(121, 6);
    } else if (disease == Disease.POISON) {
        return false;
    }
    // We only target players on the battlefield map.
    if (skill.getTarget() == 2) {
        for (Player chr : getMembers()) {
            if (MonsterCarnival.isBattlefieldMap(chr.getMapId())) {
                chr.giveDebuff(disease, s);
            }
        }
        return true;
    } else {
        if (getRandomMember() != null) {
            getRandomMember().giveDebuff(disease, 1, 30000L, disease.getDisease(), 1);
            return true;
        } else {
            return false;
        }
    }
}
Also used : Player(client.player.Player) Disease(client.player.buffs.Disease) MobSkill(server.life.MobSkill)

Example 4 with Player

use of client.player.Player in project HeavenMS by ronancpl.

the class MCParty method getAverageLevel.

public int getAverageLevel() {
    int sum = 0, num = 0;
    for (Player chr : getMembers()) {
        sum += chr.getLevel();
        num += 1;
    }
    return sum / num;
}
Also used : Player(client.player.Player)

Aggregations

Player (client.player.Player)4 Disease (client.player.buffs.Disease)1 MapleStatEffect (server.MapleStatEffect)1 MapleItemInformationProvider (server.itens.MapleItemInformationProvider)1 MobSkill (server.life.MobSkill)1