Fix for issue 136

Fix for issue 136. Inspiration buffs should no longer stack.
This commit is contained in:
voronius
2014-08-06 20:05:04 +03:00
parent 4d99a84935
commit 3b1568339d
4 changed files with 132 additions and 19 deletions
+59 -15
View File
@@ -143,7 +143,7 @@ public class BuffService implements INetworkDispatch {
for (final Buff otherBuff : target.getBuffList()) {
if (buff.getGroup1().equals(otherBuff.getGroup1()))
if (buff.getGroup1().equals(otherBuff.getGroup1()))
if (buff.getPriority() >= otherBuff.getPriority()) {
if (buff.getBuffName().equals(otherBuff.getBuffName()))
{
@@ -164,11 +164,11 @@ public class BuffService implements INetworkDispatch {
if (otherBuff.getRemainingDuration() > buff.getDuration() && otherBuff.getStacks() >= otherBuff.getMaxStacks())
return null;
}
removeBuffFromCreature(target, otherBuff);
break;
} else {
System.out.println("buff not added:" + buffName);
} else
{
return null;
}
}
@@ -239,9 +239,12 @@ public class BuffService implements INetworkDispatch {
}
@SuppressWarnings("unused")
public void removeBuffFromCreature(CreatureObject creature, Buff buff) {
public void removeBuffFromCreature(CreatureObject creature, Buff buff)
{
if(!creature.getBuffList().contains(buff))
return;
{
return;
}
DamageOverTime dot = creature.getDotByBuff(buff);
if(dot != null) {
dot.getTask().cancel(true);
@@ -251,14 +254,40 @@ public class BuffService implements INetworkDispatch {
/* if(FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) core.scriptService.callScript("scripts/buffs/", buff.getBuffName(), "remove", core, creature, buff);
else
{*/
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect1Name(), (int) buff.getEffect1Value());
if(buff.getEffect2Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect2Name(), (int) buff.getEffect2Value());
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect3Name(), (int) buff.getEffect3Value());
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect4Name(), (int) buff.getEffect4Value());
if(buff.getEffect1Name().length() > 0) core.skillModService.deductSkillMod(creature, buff.getEffect5Name(), (int) buff.getEffect5Value());
// }
if (!buff.getCallback().equals("none") && !buff.getCallback().equals("")) {
if(buff.getEffect1Name().length() > 0)
{
core.skillModService.deductSkillMod(creature, buff.getEffect1Name(), (int) buff.getEffect1Value());
}
if(buff.getEffect2Name().length() > 0)
{
core.skillModService.deductSkillMod(creature, buff.getEffect2Name(), (int) buff.getEffect2Value());
}
if(buff.getEffect3Name().length() > 0)
{
core.skillModService.deductSkillMod(creature, buff.getEffect3Name(), (int) buff.getEffect3Value());
}
if(buff.getEffect4Name().length() > 0)
{
core.skillModService.deductSkillMod(creature, buff.getEffect4Name(), (int) buff.getEffect4Value());
}
if(buff.getEffect5Name().length() > 0)
{
core.skillModService.deductSkillMod(creature, buff.getEffect5Name(), (int) buff.getEffect5Value());
}
// }
// ??? callback for what ? toggle buff ?
if (!buff.getCallback().equals("none") && !buff.getCallback().equals(""))
{
if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py")) {
PyObject method = core.scriptService.getMethod("scripts/buffs/", buff.getBuffName(), buff.getCallback());
@@ -267,6 +296,19 @@ public class BuffService implements INetworkDispatch {
}
}
}
//remove method is more like it
else
{
if (FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py"))
{
PyObject method = core.scriptService.getMethod("scripts/buffs/", buff.getBuffName(), "remove");
if (method != null && method.isCallable())
{
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(buff));
}
}
}
creature.removeBuff(buff);
for (String effect : buff.getParticleEffect().split(",")) {
@@ -352,14 +394,16 @@ public class BuffService implements INetworkDispatch {
public void addGroupBuff(CreatureObject target, String buffName, CreatureObject buffer) {
if(buffer.getGroupId() == 0) {
if(buffer.getGroupId() == 0)
{
doAddBuff(target, buffName, buffer);
return;
}
GroupObject group = (GroupObject) core.objectService.getObject(buffer.getGroupId());
if(group == null) {
if(group == null)
{
doAddBuff(target, buffName, buffer);
return;
}