Urm.. How to fix this one? package server;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import client.IItem;
import client.ISkill;
import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleDisease;
import client.MapleMount;
import client.MapleInventory;
import client.MapleInventoryType;
import client.MapleJob;
import client.MapleStat;
import client.SkillFactory;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import constants.InventoryConstants;
import constants.ServerProperties;
import constants.skills.Assassin;
import constants.skills.Bandit;
import constants.skills.Beginner;
import constants.skills.Bishop;
import constants.skills.BlazeWizard;
import constants.skills.Bowmaster;
import constants.skills.Brawler;
import constants.skills.Buccaneer;
import constants.skills.ChiefBandit;
import constants.skills.Cleric;
import constants.skills.Corsair;
import constants.skills.Crossbowman;
import constants.skills.Crusader;
import constants.skills.DarkKnight;
import constants.skills.DawnWarrior;
import constants.skills.DragonKnight;
import constants.skills.FPArchMage;
import constants.skills.FPMage;
import constants.skills.FPWizard;
import constants.skills.Fighter;
import constants.skills.GM;
import constants.skills.Gunslinger;
import constants.skills.Hermit;
import constants.skills.Hero;
import constants.skills.Hunter;
import constants.skills.ILArchMage;
import constants.skills.ILMage;
import constants.skills.ILWizard;
import constants.skills.Magician;
import constants.skills.Marauder;
import constants.skills.Marksman;
import constants.skills.NightLord;
import constants.skills.NightWalker;
import constants.skills.Noblesse;
import constants.skills.Outlaw;
import constants.skills.Page;
import constants.skills.Paladin;
import constants.skills.Pirate;
import constants.skills.Priest;
import constants.skills.Ranger;
import constants.skills.Rogue;
import constants.skills.Shadower;
import constants.skills.Sniper;
import constants.skills.Spearman;
import constants.skills.SuperGM;
import constants.skills.ThunderBreaker;
import constants.skills.WhiteKnight;
import constants.skills.WindArcher;
import net.channel.ChannelServer;
import provider.MapleData;
import provider.MapleDataTool;
import server.life.MapleMonster;
import server.maps.MapleDoor;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import server.maps.MapleMist;
import server.maps.MapleSummon;
import server.maps.SummonMovementType;
import net.world.PlayerCoolDownValueHolder;
import net.MaplePacket;
import tools.ArrayMap;
import tools.MaplePacketCreator;
import tools.Pair;
public class MapleStatEffect implements Serializable {
static final long serialVersionUID = 9179541993413738569L;
private short watk, matk, wdef, mdef, acc, avoid, hands, speed, jump;
private short hp, mp;
private double hpR, mpR;
private short mpCon, hpCon;
private int duration;
private boolean overTime;
private int sourceid;
private int moveTo;
private boolean skill;
private List<Pair<MapleBuffStat, Integer>> statups;
private Map<MonsterStatus, Integer> monsterStatus;
private int x, y, z;
private double prop;
private int iProp;
private int itemCon, itemConNo;
private int damage, attackCount, bulletCount, bulletConsume;
private Point lt, rb;
private int mobCount;
private int moneyCon;
private int cooldown;
private boolean isMorph = false;
private int morphId = 0;
private List<MapleDisease> cureDebuffs;
private int mastery, range;
public static MapleStatEffect loadSkillEffectFromData(MapleData source, int skillid, boolean overtime) {
return loadFromData(source, skillid, true, overtime);
}
public static MapleStatEffect loadItemEffectFromData(MapleData source, int itemid) {
return loadFromData(source, itemid, false, false);
}
private static void addBuffStatPairToListIfNotZero(List<Pair<MapleBuffStat, Integer>> list, MapleBuffStat buffstat, Integer val) {
if (val.intValue() != 0) {
list.add(new Pair<MapleBuffStat, Integer>(buffstat, val));
}
}
private static MapleStatEffect loadFromData(MapleData source, int sourceid, boolean skill, boolean overTime) {
MapleStatEffect ret = new MapleStatEffect();
ret.duration = MapleDataTool.getIntConvert("time", source, -1);
ret.hp = (short) MapleDataTool.getInt("hp", source, 0);
ret.hpR = MapleDataTool.getInt("hpR", source, 0) / 100.0;
ret.mp = (short) MapleDataTool.getInt("mp", source, 0);
ret.mpR = MapleDataTool.getInt("mpR", source, 0) / 100.0;
ret.mpCon = (short) MapleDataTool.getInt("mpCon", source, 0);
ret.hpCon = (short) MapleDataTool.getInt("hpCon", source, 0);
int iprop = MapleDataTool.getInt("prop", source, 100);
ret.iProp = iprop;
ret.prop = ret.iProp / 100.0;
ret.mobCount = MapleDataTool.getInt("mobCount", source, 1);
ret.cooldown = MapleDataTool.getInt("cooltime", source, 0);
ret.morphId = MapleDataTool.getInt("morph", source, 0);
ret.isMorph = ret.morphId > 0 ? true : false;
ret.sourceid = sourceid;
ret.skill = skill;
if (!ret.skill && ret.duration > -1) {
ret.overTime = true;
} else {
ret.duration *= 1000;
ret.overTime = overTime;
}
ArrayList<Pair<MapleBuffStat, Integer>> statups = new ArrayList<Pair<MapleBuffStat, Integer>>();
ret.watk = (short) MapleDataTool.getInt("pad", source, 0);
ret.wdef = (short) MapleDataTool.getInt("pdd", source, 0);
ret.matk = (short) MapleDataTool.getInt("mad", source, 0);
ret.mdef = (short) MapleDataTool.getInt("mdd", source, 0);
ret.acc = (short) MapleDataTool.getIntConvert("acc", source, 0);
ret.avoid = (short) MapleDataTool.getInt("eva", source, 0);
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
if (ret.overTime && ret.getSummonMovementType() == null) {
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WATK, Integer.valueOf(ret.watk));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WDEF, Integer.valueOf(ret.wdef));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MATK, Integer.valueOf(ret.matk));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MDEF, Integer.valueOf(ret.mdef));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ACC, Integer.valueOf(ret.acc));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AVOID, Integer.valueOf(ret.avoid));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, Integer.valueOf(ret.speed));
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, Integer.valueOf(ret.jump));
}
MapleData ltd = source.getChildByPath("lt");
if (ltd != null) {
ret.lt = (Point) ltd.getData();
ret.rb = (Point) source.getChildByPath("rb").getData();
}
int x = MapleDataTool.getInt("x", source, 0);
ret.x = x;
ret.y = MapleDataTool.getInt("y", source, 0);
ret.z = MapleDataTool.getInt("z", source, 0);
ret.damage = MapleDataTool.getIntConvert("damage", source, 100);
ret.attackCount = MapleDataTool.getIntConvert("attackCount", source, 1);
ret.bulletCount = MapleDataTool.getIntConvert("bulletCount", source, 1);
ret.bulletConsume = MapleDataTool.getIntConvert("bulletConsume", source, 0);
ret.moneyCon = MapleDataTool.getIntConvert("moneyCon", source, 0);
ret.mastery = MapleDataTool.getIntConvert("mastery", source, 0);
ret.range = MapleDataTool.getIntConvert("range", source, 0);
ret.itemCon = MapleDataTool.getInt("itemCon", source, 0);
ret.itemConNo = MapleDataTool.getInt("itemConNo", source, 0);
ret.moveTo = MapleDataTool.getInt("moveTo", source, -1);
List<MapleDisease> localCureDebuffs = new ArrayList<MapleDisease>();
if (MapleDataTool.getInt("poison", source, 0) > 0) {
localCureDebuffs.add(MapleDisease.POISON);
}
if (MapleDataTool.getInt("seal", source, 0) > 0) {
localCureDebuffs.add(MapleDisease.SEAL);
}
if (MapleDataTool.getInt("darkness", source, 0) > 0) {
localCureDebuffs.add(MapleDisease.DARKNESS);
}
if (MapleDataTool.getInt("weakness", source, 0) > 0) {
localCureDebuffs.add(MapleDisease.WEAKEN);
}
if (MapleDataTool.getInt("curse", source, 0) > 0) {
localCureDebuffs.add(MapleDisease.CURSE);
}
ret.cureDebuffs = localCureDebuffs;
Map<MonsterStatus, Integer> monsterStatus = new ArrayMap<MonsterStatus, Integer>();
if (skill) {
switch (sourceid) {
case Beginner.RECOVERY:
case Noblesse.RECOVERY:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.RECOVERY, Integer.valueOf(x)));
break;
case Beginner.ECHO_OF_HERO:
case Noblesse.ECHO_OF_HERO:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.ECHO_OF_HERO, Integer.valueOf(ret.x)));
break;
case Beginner.MONSTER_RIDER:
case Noblesse.MONSTER_RIDER:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MONSTER_RIDING, Integer.valueOf(1)));
break;
case Beginner.BERSERK_FURY:
case Noblesse.BERSERK_FURY:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.BERSERK_FURY, Integer.valueOf(1)));
break;
case Beginner.INVINCIBLE_BARRIER:
case Noblesse.INVINCIBLE_BARRIER:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DIVINE_BODY, Integer.valueOf(1)));
break;
case Fighter.POWER_GUARD:
case Page.POWER_GUARD:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.POWERGUARD, Integer.valueOf(x)));
break;
case Spearman.HYPER_BODY:
case GM.HYPER_BODY:
case SuperGM.HYPER_BODY:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HYPERBODYHP, Integer.valueOf(x)));
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HYPERBODYMP, Integer.valueOf(ret.y)));
break;
case Crusader.COMBO:
case DawnWarrior.COMBO:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.COMBO, Integer.valueOf(1)));
break;
case WhiteKnight.BW_FIRE_CHARGE:
case WhiteKnight.BW_ICE_CHARGE:
case WhiteKnight.BW_LIT_CHARGE:
case WhiteKnight.SWORD_FIRE_CHARGE:
case WhiteKnight.SWORD_ICE_CHARGE:
case WhiteKnight.SWORD_LIT_CHARGE:
case Paladin.BW_HOLY_CHARGE:
case Paladin.SWORD_HOLY_CHARGE:
case DawnWarrior.SOUL_CHARGE:
case ThunderBreaker.LIGHTNING_CHARGE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.WK_CHARGE, Integer.valueOf(x)));
break;
case DragonKnight.DRAGON_BLOOD:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DRAGONBLOOD, Integer.valueOf(ret.x)));
break;
case DragonKnight.DRAGON_ROAR:
ret.hpR = -x / 100.0;
break;
case Hero.STANCE:
case Paladin.STANCE:
case DarkKnight.STANCE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.STANCE, Integer.valueOf(iprop)));
break;
case DawnWarrior.FINAL_ATTACK:
case WindArcher.FINAL_ATTACK:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.FINALATTACK, Integer.valueOf(x)));
break;
case Magician.MAGIC_GUARD:
case BlazeWizard.MAGIC_GUARD:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MAGIC_GUARD, Integer.valueOf(x)));
break;
case Cleric.INVINCIBLE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.INVINCIBLE, Integer.valueOf(x)));
break;
case Priest.HOLY_SYMBOL:
case SuperGM.HOLY_SYMBOL:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HOLY_SYMBOL, Integer.valueOf(x)));
break;
case FPArchMage.INFINITY:
case ILArchMage.INFINITY:
case Bishop.INFINITY:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.INFINITY, Integer.valueOf(x)));
break;
case FPArchMage.MANA_REFLECTION:
case ILArchMage.MANA_REFLECTION:
case Bishop.MANA_REFLECTION:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MANA_REFLECTION, Integer.valueOf(1)));
break;
case Bishop.HOLY_SHIELD:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HOLY_SHIELD, Integer.valueOf(x)));
break;
case Priest.MYSTIC_DOOR:
case Hunter.SOUL_ARROW:
case Crossbowman.SOUL_ARROW:
case WindArcher.SOUL_ARROW:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SOULARROW, Integer.valueOf(x)));
break;
case Ranger.PUPPET:
case Sniper.PUPPET:
case WindArcher.PUPPET:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.PUPPET, Integer.valueOf(1)));
break;
case Bowmaster.CONCENTRATE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.CONCENTRATE, x));
break;
case Bowmaster.HAMSTRING:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HAMSTRING, Integer.valueOf(x)));
monsterStatus.put(MonsterStatus.SPEED, x);
break;
case Marksman.BLIND:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.BLIND, Integer.valueOf(x)));
monsterStatus.put(MonsterStatus.ACC, x);
break;
case Bowmaster.SHARP_EYES:
case Marksman.SHARP_EYES:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SHARP_EYES, Integer.valueOf(ret.x << 8 | ret.y)));
break;
case Rogue.DARK_SIGHT:
case WindArcher.WIND_WALK:
case NightWalker.DARK_SIGHT:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, Integer.valueOf(x)));
break;
case Hermit.MESO_UP:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MESOUP, Integer.valueOf(x)));
break;
case Hermit.SHADOW_PARTNER:
case NightWalker.SHADOW_PARTNER:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SHADOWPARTNER, Integer.valueOf(x)));
break;
case ChiefBandit.MESO_GUARD:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MESOGUARD, Integer.valueOf(x)));
break;
case ChiefBandit.PICKPOCKET:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.PICKPOCKET, Integer.valueOf(x)));
break;
case NightLord.SHADOW_STARS:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SHADOW_CLAW, Integer.valueOf(0)));
break;
case Pirate.DASH:
case ThunderBreaker.DASH:
//statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DASH, Integer.valueOf(x)));
//statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DASH2, Integer.valueOf(ret.y)));
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SPEED, Integer.valueOf(ret.x)));
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.JUMP, Integer.valueOf(ret.y)));
break;
case Corsair.SPEED_INFUSION:
case Buccaneer.SPEED_INFUSION:
case ThunderBreaker.SPEED_INFUSION:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SPEED_INFUSION, Integer.valueOf(x)));
break;
case Outlaw.HOMING_BEACON:
case Corsair.BULLSEYE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.HOMING_BEACON, Integer.valueOf(x)));
break;
case Corsair.BATTLE_SHIP:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MONSTER_RIDING, Integer.valueOf(sourceid)));
break;
case GM.HIDE:
case SuperGM.HIDE:
ret.duration = 7200000;
ret.overTime = true;
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, Integer.valueOf(x)));
break;
case Fighter.AXE_BOOSTER:
case Fighter.SWORD_BOOSTER:
case Page.BW_BOOSTER:
case Page.SWORD_BOOSTER:
case Spearman.POLEARM_BOOSTER:
case Spearman.SPEAR_BOOSTER:
case Hunter.BOW_BOOSTER:
case Crossbowman.CROSSBOW_BOOSTER:
case Assassin.CLAW_BOOSTER:
case Bandit.DAGGER_BOOSTER:
case FPMage.SPELL_BOOSTER:
case ILMage.SPELL_BOOSTER:
case Brawler.KNUCKLER_BOOSTER:
case Gunslinger.GUN_BOOSTER:
case DawnWarrior.SWORD_BOOSTER:
case BlazeWizard.SPELL_BOOSTER:
case WindArcher.BOW_BOOSTER:
case NightWalker.CLAW_BOOSTER:
case ThunderBreaker.KNUCKLER_BOOSTER:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.BOOSTER, Integer.valueOf(x)));
break;
case Hero.MAPLE_WARRIOR:
case Paladin.MAPLE_WARRIOR:
case DarkKnight.MAPLE_WARRIOR:
case FPArchMage.MAPLE_WARRIOR:
case ILArchMage.MAPLE_WARRIOR:
case Bishop.MAPLE_WARRIOR:
case Bowmaster.MAPLE_WARRIOR:
case Marksman.MAPLE_WARRIOR:
case NightLord.MAPLE_WARRIOR:
case Shadower.MAPLE_WARRIOR:
case Corsair.MAPLE_WARRIOR:
case Buccaneer.MAPLE_WARRIOR:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MAPLE_WARRIOR, Integer.valueOf(ret.x)));
break;
case Ranger.SILVER_HAWK:
case Sniper.GOLDEN_EAGLE:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SUMMON, Integer.valueOf(1)));
monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1));
break;
case FPArchMage.ELQUINES:
case Marksman.FROST_PREY:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SUMMON, Integer.valueOf(1)));
monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1));
break;
case Priest.SUMMON_DRAGON:
case Bowmaster.PHOENIX:
case ILArchMage.IFRIT:
case Bishop.BAHAMUT:
case DarkKnight.BEHOLDER:
case Outlaw.OCTOPUS:
case Corsair.WRATH_OF_THE_OCTOPI:
case Outlaw.GAVIOTA:
case DawnWarrior.SOUL:
case BlazeWizard.FLAME:
case WindArcher.STORM:
case NightWalker.DARKNESS:
case ThunderBreaker.LIGHTNING:
case BlazeWizard.IFRIT:
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SUMMON, Integer.valueOf(1)));
break;
case Rogue.DISORDER:
monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x));
monsterStatus.put(MonsterStatus.WDEF, Integer.valueOf(ret.y));
break;
case Corsair.HYPNOTIZE:
monsterStatus.put(MonsterStatus.INERTMOB, 1);
break;
case NightLord.NINJA_AMBUSH:
case Shadower.NINJA_AMBUSH:
monsterStatus.put(MonsterStatus.NINJA_AMBUSH, Integer.valueOf(1));
break;
case Page.THREATEN:
monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x));
monsterStatus.put(MonsterStatus.WDEF, Integer.valueOf(ret.y));
break;
case Crusader.AXE_COMA:
case Crusader.SWORD_COMA:
case Crusader.SHOUT:
case WhiteKnight.CHARGE_BLOW:
case Hunter.ARROW_BOMB:
case ChiefBandit.ASSAULTER:
case Shadower.BOOMERANG_STEP:
case Brawler.BACK_SPIN_BLOW:
case Brawler.DOUBLE_UPPERCUT:
case Buccaneer.DEMOLITION:
case Buccaneer.SNATCH:
case Buccaneer.BARRAGE:
case Gunslinger.BLANK_SHOT:
case DawnWarrior.COMA:
monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1));
break;
case NightLord.TAUNT:
case Shadower.TAUNT:
monsterStatus.put(MonsterStatus.SHOWDOWN, Integer.valueOf(1));
break;
case ILWizard.COLD_BEAM:
case ILMage.ICE_STRIKE:
case ILArchMage.BLIZZARD:
case ILMage.ELEMENT_COMPOSITION:
case Sniper.BLIZZARD:
case Outlaw.ICE_SPLITTER:
case FPArchMage.PARALYZE:
monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1));
ret.duration *= 2;
break;
case FPWizard.SLOW:
case ILWizard.SLOW:
case BlazeWizard.SLOW:
monsterStatus.put(MonsterStatus.SPEED, Integer.valueOf(ret.x));
break;
case FPWizard.POISON_BREATH:
case FPMage.ELEMENT_COMPOSITION:
monsterStatus.put(MonsterStatus.POISON, Integer.valueOf(1));
break;
case Priest.DOOM:
monsterStatus.put(MonsterStatus.DOOM, Integer.valueOf(1));
break;
case ILMage.SEAL:
case FPMage.SEAL:
monsterStatus.put(MonsterStatus.SEAL, 1);
break;
case Hermit.SHADOW_WEB:
case NightWalker.SHADOW_WEB:
monsterStatus.put(MonsterStatus.SHADOW_WEB, 1);
break;
case FPArchMage.FIRE_DEMON:
case ILArchMage.ICE_DEMON:
monsterStatus.put(MonsterStatus.POISON, Integer.valueOf(1));
monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1));
break;
default:
break;
}
}
if (ret.isMorph()) {
statups.add(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MORPH, Integer.valueOf(ret.getMorph())));
}
ret.monsterStatus = monsterStatus;
statups.trimToSize();
ret.statups = statups;
return ret;
}
public void applyPassive(MapleCharacter applyto, MapleMapObject obj, int attack) {
if (makeChanceResult()) {
switch (sourceid) {
case FPWizard.MP_EATER:
case ILWizard.MP_EATER:
case Cleric.MP_EATER:
if (obj == null || obj.getType() != MapleMapObjectType.MONSTER) {
return;
}
MapleMonster mob = (MapleMonster) obj;
if (!mob.isBoss()) {
int absorbMp = Math.min((int) (mob.getMaxMp() * (getX() / 100.0)), mob.getMp());
if (absorbMp > 0) {
mob.setMp(mob.getMp() - absorbMp);
applyto.addMP(absorbMp);
applyto.getClient().getSession().write(MaplePacketCreator.showOwnBuffEffect(sourceid, 1));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.showBuffeffect(applyto.getId(), sourceid, 1, (byte) 3), false);
}
}
break;
}
}
}
public boolean applyTo(MapleCharacter chr) {
return applyTo(chr, chr, true, null);
}
public boolean applyTo(MapleCharacter chr, Point pos) {
return applyTo(chr, chr, true, pos);
}
private boolean applyTo(MapleCharacter applyfrom, MapleCharacter applyto, boolean primary, Point pos) {
int hpchange = calcHPChange(applyfrom, primary);
int mpchange = calcMPChange(applyfrom, primary);
if (primary) {
if (itemConNo != 0) {
MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(itemCon);
MapleInventoryManipulator.removeById(applyto.getClient(), type, itemCon, itemConNo, false, true);
}
}
if (cureDebuffs.size() > 0) {
for (MapleDisease debuff : cureDebuffs) {
applyfrom.dispelDebuff(debuff);
}
}
List<Pair<MapleStat, Integer>> hpmpupdate = new ArrayList<Pair<MapleStat, Integer>>(2);
if (!primary && isResurrection()) {
hpchange = applyto.getMaxHp();
applyto.setStance(0);
}
if (isDispel() && makeChanceResult()) {
MonsterStatus[] remove = {MonsterStatus.ACC, MonsterStatus.AVOID, MonsterStatus.WEAPON_IMMUNITY, MonsterStatus.MAGIC_IMMUNITY, MonsterStatus.SPEED};
for (MapleMapObject _mob : applyfrom.getMap().getMapObjectsInRange(applyfrom.getPosition(), 30000 + applyfrom.getSkillLevel(SkillFactory.getSkill(sourceid)) * 1000, Arrays.asList(MapleMapObjectType.MONSTER))) {
MapleMonster mob = (MapleMonster) _mob;
if (mob != null && mob.isAlive() && !mob.getMonsterBuffs().isEmpty()) {
for (int i = 0; i < remove.length; i++) {
if (mob.getMonsterBuffs().contains(remove)) {
mob.getMonsterBuffs().remove(remove);
MaplePacket packet = MaplePacketCreator.cancelMonsterStatus(mob.getObjectId(), Collections.singletonMap(remove, Integer.valueOf(1)));
mob.getMap().broadcastMessage(packet, mob.getPosition());
if (mob.getController() != null && !mob.getController().isMapObjectVisible(mob)) {
mob.getController().getClient().getSession().write(packet);
}
}
}
}
}
applyto.dispelDebuffs();
}
if (isHeroWill()) {
applyto.dispelDebuff(MapleDisease.SEDUCE);
applyto.dispelDebuffs();
}
if (hpchange != 0) {
if (hpchange < 0 && (-hpchange) > applyto.getHp()) {
return false;
}
int newHp = applyto.getHp() + hpchange;
if (newHp < 1) {
newHp = 1;
}
applyto.setHp(newHp);
hpmpupdate.add(new Pair<MapleStat, Integer>(MapleStat.HP, Integer.valueOf(applyto.getHp())));
}
if (mpchange != 0) {
if (mpchange < 0 && (-mpchange) > applyto.getMp()) {
return false;
}
applyto.setMp(applyto.getMp() + mpchange);
hpmpupdate.add(new Pair<MapleStat, Integer>(MapleStat.MP, Integer.valueOf(applyto.getMp())));
}
applyto.getClient().getSession().write(MaplePacketCreator.updatePlayerStats(hpmpupdate, true));
if (moveTo != -1) {
if (applyto.getMap().getReturnMapId() != applyto.getMapId()) {
MapleMap target;
if (moveTo == 999999999) {
target = applyto.getMap().getReturnMap();
} else {
target = ChannelServer.getInstance(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
if (target.getId() / 10000000 != 60 && applyto.getMapId() / 10000000 != 61) {
if (target.getId() / 10000000 != 21 && applyto.getMapId() / 10000000 != 20) {
if (target.getId() / 10000000 != applyto.getMapId() / 10000000) {
applyto.getClient().disconnect();
return false;
}
}
}
}
applyto.changeMap(target, target.getPortal(0));
} else {
return false;
}
}
if (isShadowClaw()) {
MapleInventory use = applyto.getInventory(MapleInventoryType.USE);
int projectile = 0;
for (int i = 0; i < 255; i++) {
IItem item = use.getItem((byte) i);
if (item != null) {
boolean isStar = InventoryConstants.isThrowingStar(item.getItemId());
if (isStar && item.getQuantity() >= 200) {
projectile = item.getItemId();
break;
}
}
}
if (projectile == 0) {
return false;
} else {
MapleInventoryManipulator.removeById(applyto.getClient(), MapleInventoryType.USE, projectile, 200, false, true);
}
}
if (overTime) {
applyBuffEffect(applyfrom, applyto, primary);
}
if (primary && (overTime || isHeal())) {
applyBuff(applyfrom);
}
if (primary && isMonsterBuff()) {
applyMonsterBuff(applyfrom);
}
SummonMovementType summonMovementType = getSummonMovementType();
if (summonMovementType != null && pos != null) {
final MapleSummon tosummon = new MapleSummon(applyfrom, sourceid, pos, summonMovementType);
if (!tosummon.isPuppet()) {
applyfrom.getAntiCheats().resetSummonAttack();
}
applyfrom.getMap().spawnSummon(tosummon);
applyfrom.getSummons().put(sourceid, tosummon);
tosummon.addHP(x);
if (isBeholder()) {
tosummon.addHP(1);
}
}
if (isMagicDoor()) {
Point doorPosition = new Point(applyto.getPosition());
MapleDoor door = new MapleDoor(applyto, doorPosition);
applyto.getMap().spawnDoor(door);
applyto.addDoor(door);
door = new MapleDoor(door);
applyto.addDoor(door);
door.getTown().spawnDoor(door);
if (applyto.getParty() != null) {
applyto.silentPartyUpdate();
}
applyto.disableDoor();
} else if (isMist()) {
Rectangle bounds = calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft());
MapleMist mist = new MapleMist(bounds, applyfrom, this);
applyfrom.getMap().spawnMist(mist, getDuration(), sourceid == 2111003, false);
}
if (isTimeLeap()) {
for (PlayerCoolDownValueHolder i : applyto.getAllCooldowns()) {
if (i.skillId != Buccaneer.TIME_LEAP) {
applyto.removeCooldown(i.skillId);
}
}
}
return true;
}
private void applyBuff(MapleCharacter applyfrom) {
if (isPartyBuff() && (applyfrom.getParty() != null || isGmBuff())) {
Rectangle bounds = calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft());
List<MapleMapObject> affecteds = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.PLAYER));
List<MapleCharacter> affectedp = new ArrayList<MapleCharacter>(affecteds.size());
for (MapleMapObject affectedmo : affecteds) {
MapleCharacter affected = (MapleCharacter) affectedmo;
if (affected != null && applyfrom == null && isHeal() && affected != applyfrom && affected.getParty() == applyfrom.getParty() && affected.isAlive()) {
int expadd = (int) ((calcHPChange(applyfrom, true) / 10) * (ServerProperties.getExpRate() + ((Math.random() * 10) + 30)) * (Math.floor(Math.random() * (applyfrom.getSkillLevel(SkillFactory.getSkill(2301002))) / 100) * (applyfrom.getLevel() / 30)));
if (affected.getHp() < affected.getMaxHp() - affected.getMaxHp() / 20) {
applyfrom.gainExp(expadd, true, false, false);
}
}
if (affected != applyfrom && (isGmBuff() || applyfrom.getParty().equals(affected.getParty()))) {
boolean isRessurection = isResurrection();
if ((isRessurection && !affected.isAlive()) || (!isRessurection && affected.isAlive())) {
affectedp.add(affected);
}
boolean isTimeLeap = isTimeLeap();
if (isTimeLeap) {
for (PlayerCoolDownValueHolder i : affected.getAllCooldowns()) {
affected.removeCooldown(i.skillId);
}
}
}
}
for (MapleCharacter affected : affectedp) {
applyTo(applyfrom, affected, false, null);
affected.getClient().getSession().write(MaplePacketCreator.showOwnBuffEffect(sourceid, 2));
affected.getMap().broadcastMessage(affected, MaplePacketCreator.showBuffeffect(affected.getId(), sourceid, 2, (byte) 3), false);
}
}
}
private void applyMonsterBuff(MapleCharacter applyfrom) {
Rectangle bounds = calculateBoundingBox(applyfrom.getPosition(), applyfrom.isFacingLeft());
List<MapleMapObject> affected = applyfrom.getMap().getMapObjectsInRect(bounds, Arrays.asList(MapleMapObjectType.MONSTER));
ISkill skill_ = SkillFactory.getSkill(sourceid);
int i = 0;
for (MapleMapObject mo : affected) {
MapleMonster monster = (MapleMonster) mo;
if (makeChanceResult()) {
monster.applyStatus(applyfrom, new MonsterStatusEffect(getMonsterStati(), skill_, false), isPoison(), getDuration());
}
i++;
if (i >= mobCount) {
break;
}
}
}
private Rectangle calculateBoundingBox(Point posFrom, boolean facingLeft) {
Point mylt;
Point myrb;
if (facingLeft) {
mylt = new Point(lt.x + posFrom.x, lt.y + posFrom.y);
myrb = new Point(rb.x + posFrom.x, rb.y + posFrom.y);
} else {
myrb = new Point(lt.x * -1 + posFrom.x, rb.y + posFrom.y);
mylt = new Point(rb.x * -1 + posFrom.x, lt.y + posFrom.y);
}
Rectangle bounds = new Rectangle(mylt.x, mylt.y, myrb.x - mylt.x, myrb.y - mylt.y);
return bounds;
}
public void silentApplyBuff(MapleCharacter chr, long starttime) {
int localDuration = duration;
localDuration = alchemistModifyVal(chr, localDuration, false);
CancelEffectAction cancelAction = new CancelEffectAction(chr, this, starttime);
ScheduledFuture<?> schedule = TimerManager.getInstance().schedule(cancelAction, ((starttime + localDuration) - System.currentTimeMillis()));
chr.registerEffect(this, starttime, schedule);
SummonMovementType summonMovementType = getSummonMovementType();
if (summonMovementType != null) {
final MapleSummon tosummon = new MapleSummon(chr, sourceid, chr.getPosition(), summonMovementType);
if (!tosummon.isPuppet()) {
chr.getMap().spawnSummon(tosummon);
chr.getAntiCheats().resetSummonAttack();
chr.getSummons().put(sourceid, tosummon);
tosummon.addHP(x);
}
}
}
private void applyBuffEffect(MapleCharacter applyfrom, MapleCharacter applyto, boolean primary) {
if (sourceid != Corsair.BATTLE_SHIP) {
if (!this.isMonsterRiding()) {
applyto.cancelEffect(this, true, -1);
}
} else {
applyto.cancelEffect(this, true, -1);
}
List<Pair<MapleBuffStat, Integer>> localstatups = statups;
int localDuration = duration;
int localsourceid = sourceid;
int localX = x;
int localY = y;
int seconds = localDuration / 1000;
MapleMount givemount = null;
if (isMonsterRiding()) {
int ridingLevel = 0;
IItem mount = applyfrom.getInventory(MapleInventoryType.EQUIPPED).getItem((byte) -18);
if (mount != null) {
ridingLevel = mount.getItemId();
}
if (sourceid == Corsair.BATTLE_SHIP) {
ridingLevel = 1932000;
givemount = new MapleMount(applyto, ridingLevel, 5221006);
givemount.setActive(false);
} else {
if (applyto.getMount() == null) {
applyto.Mount(ridingLevel, sourceid);
}
givemount = applyto.getMount();
givemount.startSchedule();
givemount.setActive(true);
}
localDuration = sourceid;
localsourceid = ridingLevel;
localstatups = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MONSTER_RIDING, 0));
}
if (isPirateMorph()) {
localstatups = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MORPH, getMorph(applyto)));
}
if (primary) {
localDuration = alchemistModifyVal(applyfrom, localDuration, false);
}
if (localstatups.size() > 0) {
if (isDash()) {
if (applyto.getJob().isA(MapleJob.PIRATE) || applyto.getJob().isA(MapleJob.THUNDERBREAKER1)) {
localstatups = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DASH, 1));
applyto.getClient().getSession().write(MaplePacketCreator.giveDash(localstatups, localX, localY, seconds));
} else {
applyto.changeSkillLevel(SkillFactory.getSkill(sourceid), 0, 10);
}
} else if (isInfusion()) {
applyto.getClient().getSession().write(MaplePacketCreator.giveInfusion(seconds, x));
} else {
applyto.getClient().getSession().write(MaplePacketCreator.giveBuff((skill ? localsourceid : -localsourceid), localDuration, localstatups));
}
} else {
applyto.getClient().getSession().write(MaplePacketCreator.giveBuffTest((skill ? localsourceid : -localsourceid), localDuration, 0));
}
if (isMonsterRiding()) {
if (givemount.getItemId() != 0) {
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.showMonsterRiding(applyto.getId(), Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MONSTER_RIDING, 1)), givemount), false);
}
localDuration = duration;
}
if (isDs()) {
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignBuff(applyto.getId(), dsstat, this), false);
}
if (isCombo()) {
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.COMBO, 1));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignBuff(applyto.getId(), stat, this), false);
}
if (isShadowPartner()) {
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SHADOWPARTNER, 0));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignBuff(applyto.getId(), stat, this), false);
}
if (isSoulArrow()) {
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.SOULARROW, 0));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignBuff(applyto.getId(), stat, this), false);
}
if (isEnrage()) {
applyto.handleOrbconsume();
}
if (isMorph()) {
List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.MORPH, Integer.valueOf(getMorph(applyto))));
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignBuff(applyto.getId(), stat, this), false);
}
if (isTimeLeap()) {
for (PlayerCoolDownValueHolder i : applyto.getAllCooldowns()) {
if (i.skillId != Buccaneer.TIME_LEAP) {
applyto.removeCooldown(i.skillId);
}
}
}
if (localstatups.size() > 0) {
long starttime = System.currentTimeMillis();
CancelEffectAction cancelAction = new CancelEffectAction(applyto, this, starttime);
ScheduledFuture<?> schedule = TimerManager.getInstance().schedule(cancelAction, localDuration);
applyto.registerEffect(this, starttime, schedule);
}
if (primary) {
if (isDash()) {
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.showDashEffecttoOthers(applyto.getId(), localX, localY, seconds), false);
} else if (isInfusion()) {
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.giveForeignInfusion(applyto.getId(), x, seconds), false);
} else {
applyto.getMap().broadcastMessage(applyto, MaplePacketCreator.showBuffeffect(applyto.getId(), sourceid, 1, (byte) 3), false);
}
}
}
private int calcHPChange(MapleCharacter applyfrom, boolean primary) {
int hpchange = 0;
if (hp != 0) {
if (!skill) {
if (primary) {
hpchange += alchemistModifyVal(applyfrom, hp, true);
} else {
hpchange += hp;
}
} else {
hpchange += makeHealHP(hp / 100.0, applyfrom.getTotalMagic(), 3, 5);
}
}
if (hpR != 0) {
hpchange += (int) (applyfrom.getCurrentMaxHp() * hpR);
}
if (primary) {
if (hpCon != 0) {
hpchange -= hpCon;
}
}
if (isChakra()) {
hpchange += makeHealHP(getY() / 100.0, applyfrom.getTotalLuk(), 2.3, 3.5);
}
return hpchange;
}
private int makeHealHP(double rate, double stat, double lowerfactor, double upperfactor) {
int maxHeal = (int) (stat * upperfactor * rate);
int minHeal = (int) (stat * lowerfactor * rate);
return (int) ((Math.random() * (maxHeal - minHeal + 1)) + minHeal);
}
private int calcMPChange(MapleCharacter applyfrom, boolean primary) {
int mpchange = 0;
if (mp != 0) {
if (primary) {
mpchange += alchemistModifyVal(applyfrom, mp, true);
} else {
mpchange += mp;
}
}
if (mpR != 0) {
mpchange += (int) (applyfrom.getCurrentMaxMp() * mpR);
}
if (primary) {
if (mpCon != 0) {
double mod = 1.0;
boolean isAFpMage = applyfrom.getJob().isA(MapleJob.FP_MAGE);
if (isAFpMage || applyfrom.getJob().isA(MapleJob.IL_MAGE)) {
ISkill amp;
if (isAFpMage) {
amp = SkillFactory.getSkill(2110001);
} else {
amp = SkillFactory.getSkill(2210001);
}
int ampLevel = applyfrom.getSkillLevel(amp);
if (ampLevel > 0) {
MapleStatEffect ampStat = amp.getEffect(ampLevel);
mod = ampStat.getX() / 100.0;
}
}
mpchange -= mpCon * mod;
if (applyfrom.getBuffedValue(MapleBuffStat.INFINITY) != null) {
mpchange = 0;
}
}
}
return mpchange;
}
private int alchemistModifyVal(MapleCharacter chr, int val, boolean withX) {
if (!skill && chr.getJob().isA(MapleJob.HERMIT)) {
MapleStatEffect alchemistEffect = getAlchemistEffect(chr);
if (alchemistEffect != null) {
return (int) (val * ((withX ? alchemistEffect.getX() : alchemistEffect.getY()) / 100.0));
}
}
return val;
}
private MapleStatEffect getAlchemistEffect(MapleCharacter chr) {
ISkill alchemist = SkillFactory.getSkill(4110000);
int alchemistLevel = chr.getSkillLevel(alchemist);
if (alchemistLevel == 0) {
return null;
}
return alchemist.getEffect(alchemistLevel);
}
public void setSourceId(int newid) {
sourceid = newid;
}
private boolean isGmBuff() {
switch (sourceid) {
case Beginner.ECHO_OF_HERO:
case Noblesse.ECHO_OF_HERO:
case SuperGM.HEAL_PLUS_DISPEL:
case SuperGM.HASTE:
case SuperGM.HOLY_SYMBOL:
case SuperGM.BLESS:
case SuperGM.RESURRECTION:
case SuperGM.HYPER_BODY:
return true;
default:
return false;
}
}
private boolean isMonsterBuff() {
if (!skill) {
return false;
}
switch (sourceid) {
case Page.THREATEN:
case FPWizard.SLOW:
case ILWizard.SLOW:
case FPMage.SEAL:
case ILMage.SEAL:
case Priest.DOOM:
case Hermit.SHADOW_WEB:
case NightLord.NINJA_AMBUSH:
case Shadower.NINJA_AMBUSH:
case BlazeWizard.SLOW:
case BlazeWizard.SEAL:
case NightWalker.SHADOW_WEB:
return true;
}
return false;
}
private boolean isPartyBuff() {
if (lt == null || rb == null) {
return false;
}
if ((sourceid >= 1211003 && sourceid <= 1211008) || sourceid == Paladin.SWORD_HOLY_CHARGE || sourceid == Paladin.BW_HOLY_CHARGE || sourceid == DawnWarrior.SOUL_CHARGE) {
return false;
}
return true;
}
public boolean isHeal() {
return sourceid == Cleric.HEAL || sourceid == SuperGM.HEAL_PLUS_DISPEL;
}
public boolean isResurrection() {
return sourceid == Bishop.RESURRECTION || sourceid == GM.RESURRECTION || sourceid == SuperGM.RESURRECTION;
}
public boolean isTimeLeap() {
return sourceid == Buccaneer.TIME_LEAP;
}
public short getHp() {
return hp;
}
public short getMp() {
return mp;
}
public short getWatk() {
return watk;
}
public short getMatk() {
return matk;
}
public short getWdef() {
return wdef;
}
public short getMdef() {
return mdef;
}
public short getAcc() {
return acc;
}
public short getAvoid() {
return avoid;
}
public short getHands() {
return hands;
}
public short getSpeed() {
return speed;
}
public short getJump() {
return jump;
}
public int getDuration() {
return duration;
}
public boolean isOverTime() {
return overTime;
}
public List<Pair<MapleBuffStat, Integer>> getStatups() {
return statups;
}
public boolean sameSource(MapleStatEffect effect) {
return this.sourceid == effect.sourceid && this.skill == effect.skill;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public int getDamage() {
return damage;
}
public int getAttackCount() {
return attackCount;
}
public int getBulletCount() {
return bulletCount;
}
public int getBulletConsume() {
return bulletConsume;
}
public int getMoneyCon() {
return moneyCon;
}
public int getCooldown() {
return cooldown;
}
public Map<MonsterStatus, Integer> getMonsterStati() {
return monsterStatus;
}
public boolean isHide() {
return skill && sourceid == SuperGM.HIDE;
}
public boolean isDragonBlood() {
return skill && sourceid == DragonKnight.DRAGON_BLOOD;
}
public boolean isBerserk() {
return skill && sourceid == DarkKnight.BERSERK;
}
private boolean isDs() {
return skill && (sourceid == Rogue.DARK_SIGHT || sourceid == WindArcher.WIND_WALK || sourceid == NightWalker.DARK_SIGHT);
}
private boolean isCombo() {
return skill && (sourceid == Crusader.COMBO || sourceid == DawnWarrior.COMBO);
}
private boolean isEnrage() {
return skill && sourceid == Hero.ENRAGE;
}
public boolean isBeholder() {
return skill && sourceid == DarkKnight.BEHOLDER;
}
private boolean isShadowPartner() {
return skill && (sourceid == Hermit.SHADOW_PARTNER || sourceid == NightWalker.SHADOW_PARTNER);
}
private boolean isChakra() {
return skill && sourceid == ChiefBandit.CHAKRA;
}
public boolean isMonsterRiding() {
return skill && (sourceid == 1004 || sourceid == Corsair.BATTLE_SHIP);
}
public boolean isMagicDoor() {
return skill && sourceid == Priest.MYSTIC_DOOR;
}
public boolean isMesoGuard() {
return skill && sourceid == ChiefBandit.MESO_GUARD;
}
public boolean isPoison() {
return skill && (sourceid == FPMage.POISON_MIST || sourceid == FPWizard.POISON_BREATH || sourceid == FPMage.ELEMENT_COMPOSITION || sourceid == NightWalker.POISON_BOMB);
}
private boolean isMist() {
return skill && (sourceid == FPMage.POISON_MIST || sourceid == Shadower.SMOKE_SCREEN || sourceid == BlazeWizard.FLAME_GEAR || sourceid == NightWalker.POISON_BOMB);
}
private boolean isSoulArrow() {
return skill && (sourceid == Hunter.SOUL_ARROW || sourceid == Crossbowman.SOUL_ARROW || sourceid == WindArcher.SOUL_ARROW);
}
private boolean isShadowClaw() {
return skill && sourceid == NightLord.SHADOW_STARS;
}
private boolean isDispel() {
return skill && (sourceid == Priest.DISPEL || sourceid == SuperGM.HEAL_PLUS_DISPEL);
}
private boolean isHeroWill() {
if (skill) {
switch (sourceid) {
case Hero.HEROS_WILL:
case Paladin.HEROS_WILL:
case DarkKnight.HEROS_WILL:
case FPArchMage.HEROS_WILL:
case ILArchMage.HEROS_WILL:
case Bishop.HEROS_WILL:
case Bowmaster.HEROS_WILL:
case Marksman.HEROS_WILL:
case NightLord.HEROS_WILL:
case Shadower.HEROS_WILL:
case Buccaneer.PIRATES_RAGE:
return true;
default:
return false;
}
}
return false;
}
private boolean isDash() {
return skill && (sourceid == Pirate.DASH || sourceid == ThunderBreaker.DASH);
}
public boolean isPirateMorph() {
return skill && (sourceid == Buccaneer.SUPER_TRANSFORMATION || sourceid == Marauder.TRANSFORMATION || sourceid == WindArcher.EAGLE_EYE || sourceid == ThunderBreaker.TRANSFORMATION);
}
public boolean isInfusion() {
return skill && (sourceid == Buccaneer.SPEED_INFUSION || sourceid == Corsair.SPEED_INFUSION || sourceid == ThunderBreaker.SPEED_INFUSION);
}
public boolean isMorph() {
return morphId > 0;
}
public int getMorph() {
return morphId;
}
public int getMorph(MapleCharacter chr) {
if (morphId == 1000) {
return 1000 + chr.getGender();
} else if (morphId == 1100) {
return 1100 + chr.getGender();
}
return morphId;
}
public SummonMovementType getSummonMovementType() {
if (!skill) {
return null;
}
switch (sourceid) {
case Ranger.PUPPET:
case Sniper.PUPPET:
case WindArcher.PUPPET:
case Outlaw.OCTOPUS:
case Corsair.WRATH_OF_THE_OCTOPI:
return SummonMovementType.STATIONARY;
case Ranger.SILVER_HAWK:
case Sniper.GOLDEN_EAGLE:
case Priest.SUMMON_DRAGON:
case Marksman.FROST_PREY:
case Bowmaster.PHOENIX:
case Outlaw.GAVIOTA:
return SummonMovementType.CIRCLE_FOLLOW;
case DarkKnight.BEHOLDER:
case FPArchMage.ELQUINES:
case ILArchMage.IFRIT:
case Bishop.BAHAMUT:
case DawnWarrior.SOUL:
case BlazeWizard.FLAME:
case BlazeWizard.IFRIT:
case WindArcher.STORM:
case NightWalker.DARKNESS:
case ThunderBreaker.LIGHTNING:
return SummonMovementType.FOLLOW;
}
return null;
}
public boolean isSkill() {
return skill;
}
public int getSourceId() {
return sourceid;
}
public boolean makeChanceResult() {
return prop == 1.0 || Math.random() < prop;
}
public static class CancelEffectAction implements Runnable {
private MapleStatEffect effect;
private WeakReference<MapleCharacter> target;
private long startTime;
public CancelEffectAction(MapleCharacter target, MapleStatEffect effect, long startTime) {
this.effect = effect;
this.target = new WeakReference<MapleCharacter>(target);
this.startTime = startTime;
}
@Override
public void run() {
MapleCharacter realTarget = target.get();
if (realTarget != null) {
realTarget.cancelEffect(effect, false, startTime);
}
}
}
public int getMastery() {
return mastery;
}
public int getRange() {
return range;
}
public double getProp() {
return iProp;
}
}