v1.3.0: added some safety checks to prevent stacking artifact/ring buffs
This commit is contained in:
+4
@@ -82,6 +82,10 @@ public class Artifact extends KindofMisc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate( Char ch ) {
|
public void activate( Char ch ) {
|
||||||
|
if (passiveBuff != null){
|
||||||
|
passiveBuff.detach();
|
||||||
|
passiveBuff = null;
|
||||||
|
}
|
||||||
passiveBuff = passiveBuff();
|
passiveBuff = passiveBuff();
|
||||||
passiveBuff.attachTo(ch);
|
passiveBuff.attachTo(ch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ public class Ring extends KindofMisc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate( Char ch ) {
|
public void activate( Char ch ) {
|
||||||
|
if (buff != null){
|
||||||
|
buff.detach();
|
||||||
|
buff = null;
|
||||||
|
}
|
||||||
buff = buff();
|
buff = buff();
|
||||||
buff.attachTo( ch );
|
buff.attachTo( ch );
|
||||||
}
|
}
|
||||||
@@ -121,8 +125,10 @@ public class Ring extends KindofMisc {
|
|||||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||||
if (super.doUnequip( hero, collect, single )) {
|
if (super.doUnequip( hero, collect, single )) {
|
||||||
|
|
||||||
hero.remove( buff );
|
if (buff != null) {
|
||||||
buff = null;
|
buff.detach();
|
||||||
|
buff = null;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user