public void changeStackAmount(int amount) { stacks = amount; int entityId = targetInterface.getSpatial().getUserData(UserData.ENTITY_ID); CmdBuffStacks cmdStacks = new CmdBuffStacks(entityId, buffId, stacks); Spatial spatial = targetInterface.getSpatial(); ServerFog fog = spatial.getControl(CEntityVariable.class).getAwareness().getFog(); fog.addCommand(spatial, cmdStacks); }
public void attachToCharacter(CInfluenceInterface targetInterface) { this.targetInterface = targetInterface; targetInterface.addBuff(this); CmdBuff buffCommand = generateBuffCommand(true); if (buffCommand != null) { Spatial spatial = targetInterface.getSpatial(); spatial .getControl(CEntityVariable.class) .getAwareness() .getFog() .addCommand(spatial, buffCommand); } }
public void destroy() { CmdBuff buffCommand = generateBuffCommand(false); if (buffCommand != null) { Spatial spatial = targetInterface.getSpatial(); ServerFog fog = spatial.getControl(CEntityVariable.class).getAwareness().getFog(); fog.addCommand(spatial, buffCommand); } for (EndEventListener endHandler : buffEndHandlers) { endHandler.buffEnded(); } }
public CmdBuff generateBuffCommand(boolean added) { int entityId = targetInterface.getSpatial().getUserData(UserData.ENTITY_ID); return typeId == -1 ? null : new CmdBuff(entityId, typeId, buffId, duration, stacks, added); }