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;
}
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);
}
}
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;
}
}
}
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;
}
Aggregations