src/main/java/ru/alphatech/icfpc/cards/Attack.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 = opponent.getSlot(255 - j).getVitality();
    36 										int j = ((Value)jobj).getValue();
    38 										
    37 										
    39 										if (w > 0)
    38 										if(j >= 0 && j <= 255)
    40 										{
    39 										{
    41 											int wdec = (int) Math.floor(9 * n / 10);
    40 											int w = opponent.getSlot(255 - j).getVitality();
    42 											int resw = w - wdec;
    41 											
       
    42 											if (w > 0)
       
    43 											{
       
    44 												int wdec = (int) Math.floor(9 * n / 10);
       
    45 												int resw = w - wdec;
    43 
    46 
    44 											opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
    47 												opponent.getSlot(255 - j).setVitality(resw < 0 ? 0 : w);
       
    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 									}