Rename and clean up MapleSummon
This commit is contained in:
@@ -993,7 +993,7 @@ public class MapleStatEffect {
|
||||
}
|
||||
|
||||
if (summonMovementType != null && pos != null) {
|
||||
final MapleSummon tosummon = new MapleSummon(applyfrom, sourceid, pos, summonMovementType);
|
||||
final Summon tosummon = new Summon(applyfrom, sourceid, pos, summonMovementType);
|
||||
applyfrom.getMap().spawnSummon(tosummon);
|
||||
applyfrom.addSummon(sourceid, tosummon);
|
||||
tosummon.addHP(x);
|
||||
@@ -1171,7 +1171,7 @@ public class MapleStatEffect {
|
||||
chr.registerEffect(this, localStartTime, localStartTime + localDuration, true);
|
||||
SummonMovementType summonMovementType = getSummonMovementType();
|
||||
if (summonMovementType != null) {
|
||||
final MapleSummon tosummon = new MapleSummon(chr, sourceid, chr.getPosition(), summonMovementType);
|
||||
final Summon tosummon = new Summon(chr, sourceid, chr.getPosition(), summonMovementType);
|
||||
if (!tosummon.isStationary()) {
|
||||
chr.addSummon(sourceid, tosummon);
|
||||
tosummon.addHP(x);
|
||||
|
||||
@@ -49,7 +49,7 @@ import server.loot.LootManager;
|
||||
import server.maps.AbstractAnimatedMapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleSummon;
|
||||
import server.maps.Summon;
|
||||
import tools.IntervalBuilder;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
@@ -1796,14 +1796,14 @@ public class Monster extends AbstractLoadedLife {
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
private boolean isPuppetInVicinity(MapleSummon summon) {
|
||||
private boolean isPuppetInVicinity(Summon summon) {
|
||||
return summon.getPosition().distanceSq(this.getPosition()) < 177777;
|
||||
}
|
||||
|
||||
public boolean isCharacterPuppetInVicinity(Character chr) {
|
||||
MapleStatEffect mse = chr.getBuffEffect(BuffStat.PUPPET);
|
||||
if (mse != null) {
|
||||
MapleSummon summon = chr.getSummonByKey(mse.getSourceId());
|
||||
Summon summon = chr.getSummonByKey(mse.getSourceId());
|
||||
|
||||
// check whether mob is currently under a puppet's field of action or not
|
||||
if (summon != null) {
|
||||
@@ -2098,7 +2098,7 @@ public class Monster extends AbstractLoadedLife {
|
||||
c.sendPacket(PacketCreator.controlMonster(mob, false, immediateAggro));
|
||||
}
|
||||
|
||||
private void aggroRefreshPuppetVisibility(Character chrController, MapleSummon puppet) {
|
||||
private void aggroRefreshPuppetVisibility(Character chrController, Summon puppet) {
|
||||
// lame patch for client to redirect all aggro to the puppet
|
||||
|
||||
List<Monster> puppetControlled = new LinkedList<>();
|
||||
@@ -2135,7 +2135,7 @@ public class Monster extends AbstractLoadedLife {
|
||||
|
||||
MapleStatEffect puppetEffect = chrController.getBuffEffect(BuffStat.PUPPET);
|
||||
if (puppetEffect != null) {
|
||||
MapleSummon puppet = chrController.getSummonByKey(puppetEffect.getSourceId());
|
||||
Summon puppet = chrController.getSummonByKey(puppetEffect.getSourceId());
|
||||
|
||||
if (puppet != null && isPuppetInVicinity(puppet)) {
|
||||
controllerHasPuppet = true;
|
||||
|
||||
@@ -2061,7 +2061,7 @@ public class MapleMap {
|
||||
return doorPortal;
|
||||
}
|
||||
|
||||
public void spawnSummon(final MapleSummon summon) {
|
||||
public void spawnSummon(final Summon summon) {
|
||||
spawnAndAddRangedMapObject(summon, c -> {
|
||||
if (summon != null) {
|
||||
c.sendPacket(PacketCreator.spawnSummon(summon, true));
|
||||
@@ -2537,7 +2537,7 @@ public class MapleMap {
|
||||
|
||||
MapleStatEffect summonStat = chr.getStatForBuff(BuffStat.SUMMON);
|
||||
if (summonStat != null) {
|
||||
MapleSummon summon = chr.getSummonByKey(summonStat.getSourceId());
|
||||
Summon summon = chr.getSummonByKey(summonStat.getSourceId());
|
||||
summon.setPosition(chr.getPosition());
|
||||
chr.getMap().spawnSummon(summon);
|
||||
updateMapObjectVisibility(chr, summon);
|
||||
@@ -2699,7 +2699,7 @@ public class MapleMap {
|
||||
|
||||
chr.leaveMap();
|
||||
|
||||
for (MapleSummon summon : new ArrayList<>(chr.getSummonsValues())) {
|
||||
for (Summon summon : new ArrayList<>(chr.getSummonsValues())) {
|
||||
if (summon.isStationary()) {
|
||||
chr.cancelEffectFromBuffStat(BuffStat.PUPPET);
|
||||
} else {
|
||||
@@ -2939,7 +2939,7 @@ public class MapleMap {
|
||||
if (isNonRangedType(o.getType())) {
|
||||
o.sendSpawnData(c);
|
||||
} else if (o.getType() == MapObjectType.SUMMON) {
|
||||
MapleSummon summon = (MapleSummon) o;
|
||||
Summon summon = (Summon) o;
|
||||
if (summon.getOwner() == chr) {
|
||||
if (chr.isSummonsEmpty() || !chr.containsSummon(summon)) {
|
||||
objectWLock.lock();
|
||||
|
||||
@@ -29,21 +29,23 @@ import tools.PacketCreator;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jan
|
||||
*/
|
||||
public class MapleSummon extends AbstractAnimatedMapObject {
|
||||
private Character owner;
|
||||
private byte skillLevel;
|
||||
private int skill, hp;
|
||||
private SummonMovementType movementType;
|
||||
public class Summon extends AbstractAnimatedMapObject {
|
||||
private final Character owner;
|
||||
private final byte skillLevel;
|
||||
private final int skill;
|
||||
private int hp;
|
||||
private final SummonMovementType movementType;
|
||||
|
||||
public MapleSummon(Character owner, int skill, Point pos, SummonMovementType movementType) {
|
||||
public Summon(Character owner, int skill, Point pos, SummonMovementType movementType) {
|
||||
this.owner = owner;
|
||||
this.skill = skill;
|
||||
this.skillLevel = owner.getSkillLevel(SkillFactory.getSkill(skill));
|
||||
if (skillLevel == 0) throw new RuntimeException();
|
||||
|
||||
if (skillLevel == 0) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
this.movementType = movementType;
|
||||
setPosition(pos);
|
||||
}
|
||||
@@ -92,12 +94,12 @@ public class MapleSummon extends AbstractAnimatedMapObject {
|
||||
}
|
||||
|
||||
public final boolean isPuppet() {
|
||||
switch (skill) {
|
||||
case 3111002:
|
||||
case 3211002:
|
||||
case 13111004:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
switch (skill) {
|
||||
case 3111002:
|
||||
case 3211002:
|
||||
case 13111004:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user