src/main/java/ru/alphatech/icfpc/cards/Help.java
changeset 72 51bfc33c0566
parent 68 a84a3c755d93
child 74 b277f6c31f5f
equal deleted inserted replaced
71:497185ce6691 72:51bfc33c0566
    22 					{
    22 					{
    23 						if(iobj instanceof Value && nobj instanceof Value)
    23 						if(iobj instanceof Value && nobj instanceof Value)
    24 						{
    24 						{
    25 							int i = ((Value)iobj).getValue();
    25 							int i = ((Value)iobj).getValue();
    26 							int n = ((Value)nobj).getValue();
    26 							int n = ((Value)nobj).getValue();
    27 							int v = proponent.getSlot(i).getVitality();
       
    28 							
    27 							
    29 							if(i >= 0 && i <= 255 && n <= v)
    28 							if(i >= 0 && i <= 255)
    30 							{
    29 							{
    31 								if(jobj instanceof Value)
    30 								int v = proponent.getSlot(i).getVitality();
       
    31 								
       
    32 								if(n <= v)
    32 								{
    33 								{
    33 									int j = ((Value)jobj).getValue();
    34 									if(jobj instanceof Value)
    34 									
       
    35 									if(j >= 0 && j <= 255)
       
    36 									{
    35 									{
    37 										int w = proponent.getSlot(j).getVitality();
    36 										int j = ((Value)jobj).getValue();
    38 										
    37 										
    39 										if(w > 0)
    38 										if(j >= 0 && j <= 255)
    40 										{
    39 										{
    41 											int winc = (int) Math.floor(11 * n / 10);
    40 											int w = proponent.getSlot(j).getVitality();
    42 											int resw = w + winc;
       
    43 											
    41 											
    44 											proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw);
    42 											if(w > 0)
       
    43 											{
       
    44 												int winc = (int) Math.floor(11 * n / 10);
       
    45 												int resw = w + winc;
       
    46 												
       
    47 												proponent.getSlot(j).setVitality(resw > 65535 ? 65535 : resw);
       
    48 											}
       
    49 											
       
    50 											return new I();
    45 										}
    51 										}
    46 										
    52 										else
    47 										return new I();
    53 										{
       
    54 											throw new ICFPCException();
       
    55 										}
    48 									}
    56 									}
    49 									else
    57 									else
    50 									{
    58 									{
    51 										throw new ICFPCException();
    59 										throw new ICFPCException();
    52 									}
    60 									}