@ -30,12 +30,8 @@ import java.util.concurrent.ThreadLocalRandom;
				@@ -30,12 +30,8 @@ import java.util.concurrent.ThreadLocalRandom;
					 
			
		
	
		
			
				
					public  class  TransferStatPowerAction  extends  AbstractPowerAction  {  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    protected  String  effectID ;   
			
		
	
		
			
				
					    protected  boolean  transferFromHealth  =  false ;   
			
		
	
		
			
				
					    protected  boolean  transferFromMana  =  false ;   
			
		
	
		
			
				
					    protected  boolean  transferFromStamina  =  false ;   
			
		
	
		
			
				
					    protected  boolean  transferToHealth  =  false ;   
			
		
	
		
			
				
					    protected  boolean  transferToMana  =  false ;   
			
		
	
		
			
				
					    protected  boolean  transferToStamina  =  false ;   
			
		
	
		
			
				
					    public  PowerAction  powerAction ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    protected  float  transferAmount ;   
			
		
	
		
			
				
					    protected  float  transferRamp ;   
			
		
	
		
			
				
					    protected  boolean  transferRampAdd ;   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -48,22 +44,10 @@ public class TransferStatPowerAction extends AbstractPowerAction {
				@@ -48,22 +44,10 @@ public class TransferStatPowerAction extends AbstractPowerAction {
					 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  TransferStatPowerAction ( PowerAction  powerAction ,  HashMap < String ,  EffectsBase >  effects )  {   
			
		
	
		
			
				
					        super ( powerAction ) ;   
			
		
	
		
			
				
					        this . effectID  =  powerAction . effects . get ( 0 ) . effect_id ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        if  ( powerAction . statTransfer . fromStat . equals ( mbEnums . CostType . HEALTH ) )   
			
		
	
		
			
				
					            this . transferFromHealth  =  true ;   
			
		
	
		
			
				
					        else  if  ( powerAction . statTransfer . fromStat . equals ( mbEnums . CostType . MANA ) )   
			
		
	
		
			
				
					            this . transferFromMana  =  true ;   
			
		
	
		
			
				
					        else   
			
		
	
		
			
				
					            this . transferFromStamina  =  true ;   
			
		
	
		
			
				
					        this . powerAction  =  powerAction ;   
			
		
	
		
			
				
					        this . effectID  =  powerAction . effects . get ( 0 ) . effect_id ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        if  ( powerAction . statTransfer . toStat . equals ( mbEnums . CostType . HEALTH ) )   
			
		
	
		
			
				
					            this . transferToHealth  =  true ;   
			
		
	
		
			
				
					        else  if  ( powerAction . statTransfer . fromStat . equals ( mbEnums . CostType . MANA ) )   
			
		
	
		
			
				
					            this . transferToMana  =  true ;   
			
		
	
		
			
				
					        else   
			
		
	
		
			
				
					            this . transferToStamina  =  true ;   
			
		
	
		
			
				
					        this . transferAmount  =  powerAction . getFloat ( "transferAmount" ) ;   
			
		
	
		
			
				
					        this . transferRamp  =  powerAction . getFloat ( "transferRamp" ) ;   
			
		
	
		
			
				
					        this . transferEfficiency  =  powerAction . getFloat ( "transferEfficiency" ) ;   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -88,29 +72,6 @@ public class TransferStatPowerAction extends AbstractPowerAction {
				@@ -88,29 +72,6 @@ public class TransferStatPowerAction extends AbstractPowerAction {
					 
			
		
	
		
			
				
					        return  this . effectID ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferFromHealth ( )  {   
			
		
	
		
			
				
					        return  this . transferFromHealth ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferFromMana ( )  {   
			
		
	
		
			
				
					        return  this . transferFromMana ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferFromStamina ( )  {   
			
		
	
		
			
				
					        return  this . transferFromStamina ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferToHealth ( )  {   
			
		
	
		
			
				
					        return  this . transferToHealth ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferToMana ( )  {   
			
		
	
		
			
				
					        return  this . transferToMana ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  boolean  transferToStamina ( )  {   
			
		
	
		
			
				
					        return  this . transferToStamina ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  EffectsBase  getEffect ( )  {   
			
		
	
		
			
				
					        return  this . effect ;   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -158,7 +119,6 @@ public class TransferStatPowerAction extends AbstractPowerAction {
				@@ -158,7 +119,6 @@ public class TransferStatPowerAction extends AbstractPowerAction {
					 
			
		
	
		
			
				
					            toAwo  =  awo ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        if  ( AbstractWorldObject . IsAbstractCharacter ( fromAwo )  & &  AbstractWorldObject . IsAbstractCharacter ( toAwo ) )  {   
			
		
	
		
			
				
					            AbstractCharacter  from  =  ( AbstractCharacter )  fromAwo ;   
			
		
	
		
			
				
					            AbstractCharacter  to  =  ( AbstractCharacter )  toAwo ;   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -217,25 +177,34 @@ public class TransferStatPowerAction extends AbstractPowerAction {
				@@ -217,25 +177,34 @@ public class TransferStatPowerAction extends AbstractPowerAction {
					 
			
		
	
		
			
				
					            float  toAmount  =  fromAmount  *  ( getTransferEfficiency ( trains )  /  100 ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            //get max amount to transfer, don't give more then the target has
   
			
		
	
		
			
				
					            float  maxDrain ;   
			
		
	
		
			
				
					            if  ( this . transferFromHealth )   
			
		
	
		
			
				
					                maxDrain  =  from . getCurrentHitpoints ( ) ;   
			
		
	
		
			
				
					            else  if  ( this . transferFromMana )   
			
		
	
		
			
				
					                maxDrain  =  from . getMana ( ) ;   
			
		
	
		
			
				
					            else   
			
		
	
		
			
				
					                maxDrain  =  from . getStamina ( ) ;   
			
		
	
		
			
				
					            float  maxDrain  =  0 ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            switch  ( powerAction . statTransfer . fromStat )  {   
			
		
	
		
			
				
					                case  HEALTH :   
			
		
	
		
			
				
					                    maxDrain  =  from . getCurrentHitpoints ( ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  MANA :   
			
		
	
		
			
				
					                    maxDrain  =  from . getMana ( ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  STAMINA :   
			
		
	
		
			
				
					                    maxDrain  =  from . getStamina ( ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( toAmount  >  maxDrain )   
			
		
	
		
			
				
					                toAmount  =  maxDrain ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            //prep messages for transfer
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            int  powerID  =  pb . getToken ( ) ;   
			
		
	
		
			
				
					            int  effectID  =  496519310 ;   
			
		
	
		
			
				
					            String  powerName  =  pb . getName ( ) ;   
			
		
	
		
			
				
					            ModifyHealthMsg  mhmTo ;   
			
		
	
		
			
				
					            //			ModifyHealthMsg mhmFrom;
   
			
		
	
		
			
				
					
  
			
		
	
		
			
				
					            ModifyHealthMsg  mhmTo  =  null ;   
			
		
	
		
			
				
					            AbstractNetMsg  mhmFrom  =  null ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            //stop if target is immune to drains
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( from . getBonuses ( ) . getBool ( ModType . ImmuneTo ,  SourceType . Drain ) )  {   
			
		
	
		
			
				
					                ModifyHealthMsg  mhm  =  new  ModifyHealthMsg ( source ,  to ,  0f ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                mhm . setUnknown03 ( 5 ) ;  //set target is immune
   
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -243,32 +212,40 @@ public class TransferStatPowerAction extends AbstractPowerAction {
				@@ -243,32 +212,40 @@ public class TransferStatPowerAction extends AbstractPowerAction {
					 
			
		
	
		
			
				
					                return ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            //apply transfer bonus
   
			
		
	
		
			
				
					            if  ( this . transferToHealth )  {   
			
		
	
		
			
				
					                to . modifyHealth ( toAmount ,  source ,  false ) ;   
			
		
	
		
			
				
					                mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  toAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					            }  else  if  ( this . transferToMana )  {   
			
		
	
		
			
				
					                to . modifyMana ( toAmount ,  source ) ;   
			
		
	
		
			
				
					                mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  0f ,  toAmount ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					            }  else  {   
			
		
	
		
			
				
					                to . modifyStamina ( toAmount ,  source ) ;   
			
		
	
		
			
				
					                mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  0f ,  0f ,  toAmount ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					            switch  ( powerAction . statTransfer . toStat )  {   
			
		
	
		
			
				
					                case  HEALTH :   
			
		
	
		
			
				
					                    to . modifyHealth ( toAmount ,  source ,  false ) ;   
			
		
	
		
			
				
					                    mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  toAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  MANA :   
			
		
	
		
			
				
					                    to . modifyMana ( toAmount ,  source ) ;   
			
		
	
		
			
				
					                    mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  0f ,  toAmount ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  STAMINA :   
			
		
	
		
			
				
					                    to . modifyStamina ( toAmount ,  source ) ;   
			
		
	
		
			
				
					                    mhmTo  =  new  ModifyHealthMsg ( source ,  to ,  0f ,  0f ,  toAmount ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            //subtract transfer amount
   
			
		
	
		
			
				
					            if  ( this . transferFromHealth )  {   
			
		
	
		
			
				
					                float  modFrom  =  from . modifyHealth ( - fromAmount ,  source ,  false ) ;   
			
		
	
		
			
				
					                float  cur  =  from . getHealth ( ) ;   
			
		
	
		
			
				
					                if  ( cur  <  0  & &  modFrom  ! =  0 )   
			
		
	
		
			
				
					                    mhmFrom  =  new  ModifyHealthKillMsg ( source ,  from ,  - fromAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                else   
			
		
	
		
			
				
					                    mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  - fromAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					            }  else  if  ( this . transferFromMana )  {   
			
		
	
		
			
				
					                from . modifyMana ( - fromAmount ,  source ) ;   
			
		
	
		
			
				
					                mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  0f ,  - fromAmount ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					            }  else  {   
			
		
	
		
			
				
					                from . modifyStamina ( - fromAmount ,  source ) ;   
			
		
	
		
			
				
					                mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  0f ,  0f ,  - fromAmount ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            switch  ( powerAction . statTransfer . fromStat )  {   
			
		
	
		
			
				
					                case  HEALTH :   
			
		
	
		
			
				
					                    float  modFrom  =  from . modifyHealth ( - fromAmount ,  source ,  false ) ;   
			
		
	
		
			
				
					                    float  cur  =  from . getHealth ( ) ;   
			
		
	
		
			
				
					                    if  ( cur  <  0  & &  modFrom  ! =  0 )   
			
		
	
		
			
				
					                        mhmFrom  =  new  ModifyHealthKillMsg ( source ,  from ,  - fromAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    else   
			
		
	
		
			
				
					                        mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  - fromAmount ,  0f ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  MANA :   
			
		
	
		
			
				
					                    from . modifyMana ( - fromAmount ,  source ) ;   
			
		
	
		
			
				
					                    mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  0f ,  - fromAmount ,  0f ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					                case  STAMINA :   
			
		
	
		
			
				
					                    from . modifyStamina ( - fromAmount ,  source ) ;   
			
		
	
		
			
				
					                    mhmFrom  =  new  ModifyHealthMsg ( source ,  from ,  0f ,  0f ,  - fromAmount ,  powerID ,  powerName ,  trains ,  effectID ) ;   
			
		
	
		
			
				
					                    break ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            DispatchManager . sendToAllInRange ( to ,  mhmTo ) ;