use of client.MapleDisease in project HeavenMS by ronancpl.
the class MobSkill method applyEffect.
public void applyEffect(MapleCharacter player, MapleMonster monster, boolean skill, List<MapleCharacter> banishPlayers) {
MapleDisease disease = null;
Map<MonsterStatus, Integer> stats = new ArrayMap<MonsterStatus, Integer>();
List<Integer> reflection = new LinkedList<Integer>();
switch(skillId) {
case 100:
case 110:
case 150:
stats.put(MonsterStatus.WEAPON_ATTACK_UP, Integer.valueOf(x));
break;
case 101:
case 111:
case 151:
stats.put(MonsterStatus.MAGIC_ATTACK_UP, Integer.valueOf(x));
break;
case 102:
case 112:
case 152:
stats.put(MonsterStatus.WEAPON_DEFENSE_UP, Integer.valueOf(x));
break;
case 103:
case 113:
case 153:
stats.put(MonsterStatus.MAGIC_DEFENSE_UP, Integer.valueOf(x));
break;
case 114:
if (lt != null && rb != null && skill) {
List<MapleMapObject> objects = getObjectsInRange(monster, MapleMapObjectType.MONSTER);
final int hps = (getX() / 1000) * (int) (950 + 1050 * Math.random());
for (MapleMapObject mons : objects) {
((MapleMonster) mons).heal(hps, getY());
}
} else {
monster.heal(getX(), getY());
}
break;
case 120:
disease = MapleDisease.SEAL;
break;
case 121:
disease = MapleDisease.DARKNESS;
break;
case 122:
disease = MapleDisease.WEAKEN;
break;
case 123:
disease = MapleDisease.STUN;
break;
case 124:
disease = MapleDisease.CURSE;
break;
case 125:
disease = MapleDisease.POISON;
break;
case // Slow
126:
disease = MapleDisease.SLOW;
break;
case 127:
if (lt != null && rb != null && skill) {
for (MapleCharacter character : getPlayersInRange(monster, player)) {
character.dispel();
}
} else {
player.dispel();
}
break;
case // Seduce
128:
disease = MapleDisease.SEDUCE;
break;
case // Banish
129:
if (lt != null && rb != null && skill) {
for (MapleCharacter chr : getPlayersInRange(monster, player)) {
banishPlayers.add(chr);
}
} else {
banishPlayers.add(player);
}
break;
case // Mist
131:
monster.getMap().spawnMist(new MapleMist(calculateBoundingBox(monster.getPosition(), true), monster, this), x * 10, false, false, false);
break;
case 132:
disease = MapleDisease.CONFUSE;
break;
case // zombify
133:
disease = MapleDisease.ZOMBIFY;
break;
case 140:
if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) {
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
}
break;
case 141:
if (makeChanceResult() && !monster.isBuffed(MonsterStatus.WEAPON_IMMUNITY)) {
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
}
break;
case // Weapon Reflect
143:
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
reflection.add(x);
break;
case // Magic Reflect
144:
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
reflection.add(x);
break;
case // Weapon / Magic reflect
145:
stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
reflection.add(x);
break;
// accuracy up
case 154:
// avoid up
case 155:
case // speed up
156:
break;
case // summon
200:
if (monster.getMap().getSpawnedMonstersOnMap() < 80) {
for (Integer mobId : getSummons()) {
MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
if (toSpawn != null) {
// no littering on BRPQ pls
if (GameConstants.isBossRush(monster.getMap().getId()))
toSpawn.disableDrops();
toSpawn.setPosition(monster.getPosition());
int ypos, xpos;
xpos = (int) monster.getPosition().getX();
ypos = (int) monster.getPosition().getY();
switch(mobId) {
case // Pap bomb high
8500003:
toSpawn.setFh((int) Math.ceil(Math.random() * 19.0));
ypos = -590;
break;
case // Pap bomb
8500004:
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
if (ypos != -590) {
ypos = (int) monster.getPosition().getY();
}
break;
case // Pianus bomb
8510100:
if (Math.ceil(Math.random() * 5) == 1) {
ypos = 78;
xpos = (int) Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
} else {
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
}
break;
}
switch(monster.getMap().getId()) {
case // Pap map
220080001:
if (xpos < -890) {
xpos = (int) (Math.ceil(Math.random() * 150) - 890);
} else if (xpos > 230) {
xpos = (int) (230 - Math.ceil(Math.random() * 150));
}
break;
case // Pianus map
230040420:
if (xpos < -239) {
xpos = (int) (Math.ceil(Math.random() * 150) - 239);
} else if (xpos > 371) {
xpos = (int) (371 - Math.ceil(Math.random() * 150));
}
break;
}
toSpawn.setPosition(new Point(xpos, ypos));
if (toSpawn.getId() == 8500004) {
monster.getMap().spawnFakeMonster(toSpawn);
} else {
monster.getMap().spawnMonsterWithEffect(toSpawn, getSpawnEffect(), toSpawn.getPosition());
}
}
}
}
break;
default:
System.out.println("Unhandled Mob skill: " + skillId);
break;
}
if (stats.size() > 0) {
if (lt != null && rb != null && skill) {
for (MapleMapObject mons : getObjectsInRange(monster, MapleMapObjectType.MONSTER)) {
((MapleMonster) mons).applyMonsterBuff(stats, getX(), getSkillId(), getDuration(), this, reflection);
}
} else {
monster.applyMonsterBuff(stats, getX(), getSkillId(), getDuration(), this, reflection);
}
}
if (disease != null) {
if (lt != null && rb != null && skill) {
int i = 0;
for (MapleCharacter character : getPlayersInRange(monster, player)) {
if (!character.isActiveBuffedValue(2321005)) {
if (disease.equals(MapleDisease.SEDUCE)) {
if (i < 10) {
character.giveDebuff(MapleDisease.SEDUCE, this);
i++;
}
} else {
character.giveDebuff(disease, this);
}
}
}
} else {
player.giveDebuff(disease, this);
}
}
monster.usedSkill(skillId, skillLevel, cooltime);
monster.setMp(monster.getMp() - getMpCon());
}
use of client.MapleDisease in project HeavenMS by ronancpl.
the class MaplePacketCreator method giveForeignDebuff.
public static byte[] giveForeignDebuff(int cid, List<Pair<MapleDisease, Integer>> statups, MobSkill skill) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.GIVE_FOREIGN_BUFF.getValue());
mplew.writeInt(cid);
writeLongMaskD(mplew, statups);
for (Pair<MapleDisease, Integer> statup : statups) {
mplew.writeShort(statup.getRight().shortValue());
mplew.writeShort(skill.getSkillId());
mplew.writeShort(skill.getSkillLevel());
}
// same as give_buff
mplew.writeShort(0);
// Delay
mplew.writeShort(900);
return mplew.getPacket();
}
use of client.MapleDisease in project HeavenMS by ronancpl.
the class MaplePacketCreator method giveDebuff.
public static byte[] giveDebuff(List<Pair<MapleDisease, Integer>> statups, MobSkill skill) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.GIVE_BUFF.getValue());
writeLongMaskD(mplew, statups);
for (Pair<MapleDisease, Integer> statup : statups) {
mplew.writeShort(statup.getRight().shortValue());
mplew.writeShort(skill.getSkillId());
mplew.writeShort(skill.getSkillLevel());
mplew.writeInt((int) skill.getDuration());
}
// ??? wk charges have 600 here o.o
mplew.writeShort(0);
// Delay
mplew.writeShort(900);
mplew.write(1);
return mplew.getPacket();
}
Aggregations