Experimental Character/Client Closure + Morph & Crash skills patch

Player Trade is now enabled inside PQ & events.
Refactored minigame code, now using enums rather than strings for logistics.
Fixed Transformations not applying stat buffs properly.
Warrior's Crash skills now acts accordingly with their description (rather than applying all combined debuffs).
Added a server flag for Crash skills, to apply mob immunity debuffs as well.
Fixed Shark Wave not stacking charges.
Dragon Roar now properly stuns the mobs (stun effect won't show up, though).
Refactored empty method on MapleCharacter, now freeing more resources.
[EXPERIMENTAL] Upon lifetime's end of the object, empty function will be called alongside MapleClient's clear, should issues arise from that, it's TBD.
This commit is contained in:
ronancpl
2018-06-23 13:00:28 -03:00
parent c4d6531177
commit d50b7b6960
30 changed files with 387 additions and 163 deletions
+13 -8
View File
@@ -376,9 +376,6 @@ public class MapleStatEffect {
case DragonKnight.DRAGON_BLOOD:
statups.add(new Pair<>(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:
@@ -571,7 +568,7 @@ public class MapleStatEffect {
case Crusader.ARMOR_CRASH:
case DragonKnight.POWER_CRASH:
case WhiteKnight.MAGIC_CRASH:
monsterStatus.put(MonsterStatus.SEAL_SKILL, Integer.valueOf(1));
monsterStatus.put(MonsterStatus.SEAL_SKILL, Integer.valueOf(1));
break;
case Rogue.DISORDER:
monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x));
@@ -588,6 +585,10 @@ public class MapleStatEffect {
monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x));
monsterStatus.put(MonsterStatus.WDEF, Integer.valueOf(ret.y));
break;
case DragonKnight.DRAGON_ROAR:
ret.hpR = -x / 100.0;
monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1));
break;
case Crusader.AXE_COMA:
case Crusader.SWORD_COMA:
case Crusader.SHOUT:
@@ -1007,7 +1008,7 @@ public class MapleStatEffect {
public final void applyComboBuff(final MapleCharacter applyto, int combo) {
final List<Pair<MapleBuffStat, Integer>> stat = Collections.singletonList(new Pair<>(MapleBuffStat.ARAN_COMBO, combo));
applyto.getClient().announce(MaplePacketCreator.giveBuff(sourceid, 99999, stat));
applyto.announce(MaplePacketCreator.giveBuff(sourceid, 99999, stat));
final long starttime = System.currentTimeMillis();
// final CancelEffectAction cancelAction = new CancelEffectAction(applyto, this, starttime);
@@ -1021,8 +1022,7 @@ public class MapleStatEffect {
long leftDuration = (starttime + localDuration) - System.currentTimeMillis();
if(leftDuration > 0) {
byte[] buff = MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int)leftDuration, activeStats);
target.getClient().announce(buff);
target.announce(MaplePacketCreator.giveBuff((skill ? sourceid : -sourceid), (int)leftDuration, activeStats));
}
}
@@ -1080,7 +1080,12 @@ public class MapleStatEffect {
localsourceid = ridingMountId;
localstatups = Collections.singletonList(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0));
} else if (isSkillMorph()) {
localstatups = Collections.singletonList(new Pair<>(MapleBuffStat.MORPH, getMorph(applyto)));
for(int i = 0; i < localstatups.size(); i++) {
if(localstatups.get(i).getLeft().equals(MapleBuffStat.MORPH)) {
localstatups.set(i, new Pair<>(MapleBuffStat.MORPH, getMorph(applyto)));
break;
}
}
}
if (primary) {
localDuration = alchemistModifyVal(applyfrom, localDuration, false);
+29 -13
View File
@@ -30,11 +30,14 @@ import client.SkillFactory;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import constants.ServerConstants;
import constants.skills.Crusader;
import constants.skills.DragonKnight;
import constants.skills.FPMage;
import constants.skills.ILMage;
import constants.skills.NightLord;
import constants.skills.NightWalker;
import constants.skills.Shadower;
import constants.skills.WhiteKnight;
import java.awt.Point;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -990,22 +993,35 @@ public class MapleMonster extends AbstractLoadedMapleLife {
effect.setCancelTask(timerManager.schedule(cancelTask, duration));
}
private void debuffMobStat(MonsterStatus stat) {
if (isBuffed(stat)) {
final MonsterStatusEffect oldEffect = stati.get(stat);
byte[] packet = MaplePacketCreator.cancelMonsterStatus(getObjectId(), oldEffect.getStati());
map.broadcastMessage(packet, getPosition());
MapleCharacter controller = getController();
if (controller != null && !controller.isMapObjectVisible(MapleMonster.this)) {
controller.getClient().announce(packet);
}
stati.remove(stat);
}
}
public void debuffMob(int skillid) {
//skillid is not going to be used for now until I get warrior debuff working
MonsterStatus[] stats = {MonsterStatus.WEAPON_ATTACK_UP, MonsterStatus.WEAPON_DEFENSE_UP, MonsterStatus.MAGIC_ATTACK_UP, MonsterStatus.MAGIC_DEFENSE_UP};
MonsterStatus[] stats = {MonsterStatus.WEAPON_ATTACK_UP, MonsterStatus.WEAPON_DEFENSE_UP, MonsterStatus.MAGIC_ATTACK_UP};
statiLock.lock();
try {
for (int i = 0; i < stats.length; i++) {
if (isBuffed(stats[i])) {
final MonsterStatusEffect oldEffect = stati.get(stats[i]);
byte[] packet = MaplePacketCreator.cancelMonsterStatus(getObjectId(), oldEffect.getStati());
map.broadcastMessage(packet, getPosition());
MapleCharacter controller = getController();
if (controller != null && !controller.isMapObjectVisible(MapleMonster.this)) {
controller.getClient().announce(packet);
}
stati.remove(stats[i]);
int i = (skillid == Crusader.ARMOR_CRASH ? 1 : (skillid == WhiteKnight.MAGIC_CRASH ? 2 : 0));
debuffMobStat(stats[i]);
if(ServerConstants.USE_ANTI_IMMUNITY_CRASH) {
if (skillid == Crusader.ARMOR_CRASH) {
if(!isBuffed(MonsterStatus.WEAPON_REFLECT)) debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
if(!isBuffed(MonsterStatus.MAGIC_REFLECT)) debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
} else if (skillid == WhiteKnight.MAGIC_CRASH) {
if(!isBuffed(MonsterStatus.MAGIC_REFLECT)) debuffMobStat(MonsterStatus.MAGIC_IMMUNITY);
} else {
if(!isBuffed(MonsterStatus.WEAPON_REFLECT)) debuffMobStat(MonsterStatus.WEAPON_IMMUNITY);
}
}
} finally {
+35 -17
View File
@@ -31,12 +31,13 @@ import tools.MaplePacketCreator;
/**
*
* @author Matze
* @author Ronan (refactored String GameType to enum MiniGameType)
*/
public class MapleMiniGame extends AbstractMapleMapObject {
private MapleCharacter owner;
private MapleCharacter visitor;
private String password;
private String GameType = null;
private MiniGameType GameType = MiniGameType.UNDEFINED;
private int[] piece = new int[250];
private List<Integer> list4x3 = new ArrayList<>();
private List<Integer> list5x4 = new ArrayList<>();
@@ -49,6 +50,23 @@ public class MapleMiniGame extends AbstractMapleMapObject {
private int ownerpoints = 0;
private int matchestowin = 0;
public static enum MiniGameType {
UNDEFINED(0), OMOK(1), MATCH_CARD(2);
private int value = 0;
private MiniGameType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
public static enum MiniGameResult {
WIN, LOSS, TIE;
}
public MapleMiniGame(MapleCharacter owner, String description, String password) {
this.owner = owner;
this.description = description;
@@ -70,16 +88,16 @@ public class MapleMiniGame extends AbstractMapleMapObject {
public boolean isOwner(MapleCharacter c) {
return owner.equals(c);
}
public void addVisitor(MapleCharacter challenger) {
visitor = challenger;
if (GameType.equals("omok")) {
this.getOwner().getClient().announce(MaplePacketCreator.getMiniGameNewVisitor(challenger, 1));
this.getOwner().getMap().broadcastMessage(MaplePacketCreator.addOmokBox(owner, 2, 0));
}
if (GameType.equals("matchcard")) {
this.getOwner().getClient().announce(MaplePacketCreator.getMatchCardNewVisitor(challenger, 1));
this.getOwner().getMap().broadcastMessage(MaplePacketCreator.addMatchCardBox(owner, 2, 0));
MapleCharacter owner = this.getOwner();
if (GameType == MiniGameType.OMOK) {
owner.announce(MaplePacketCreator.getMiniGameNewVisitor(challenger, 1));
owner.getMap().broadcastMessage(MaplePacketCreator.addOmokBox(owner, 2, 0));
} else if (GameType == MiniGameType.MATCH_CARD) {
owner.announce(MaplePacketCreator.getMatchCardNewVisitor(challenger, 1));
owner.getMap().broadcastMessage(MaplePacketCreator.addMatchCardBox(owner, 2, 0));
}
}
@@ -87,10 +105,9 @@ public class MapleMiniGame extends AbstractMapleMapObject {
if (visitor == challenger) {
visitor = null;
this.getOwner().getClient().announce(MaplePacketCreator.getMiniGameRemoveVisitor());
if (GameType.equals("omok")) {
if (GameType == MiniGameType.OMOK) {
this.getOwner().getMap().broadcastMessage(MaplePacketCreator.addOmokBox(owner, 1, 0));
}
if (GameType.equals("matchcard")) {
} else if (GameType == MiniGameType.MATCH_CARD) {
this.getOwner().getMap().broadcastMessage(MaplePacketCreator.addMatchCardBox(owner, 1, 0));
}
}
@@ -156,9 +173,9 @@ public class MapleMiniGame extends AbstractMapleMapObject {
return piecetype;
}
public void setGameType(String game) {
public void setGameType(MiniGameType game) {
GameType = game;
if (game.equals("matchcard")) {
if (GameType == MiniGameType.MATCH_CARD) {
if (matchestowin == 6) {
for (int i = 0; i < 6; i++) {
list4x3.add(i);
@@ -178,7 +195,7 @@ public class MapleMiniGame extends AbstractMapleMapObject {
}
}
public String getGameType() {
public MiniGameType getGameType() {
return GameType;
}
@@ -217,8 +234,9 @@ public class MapleMiniGame extends AbstractMapleMapObject {
}
public void broadcast(final byte[] packet) {
if (owner.getClient() != null && owner.getClient().getSession() != null) {
owner.getClient().announce(packet);
MapleClient c = owner.getClient();
if (c != null && c.getSession() != null) {
c.announce(packet);
}
broadcastToVisitor(packet);
}